From a7981f2146914d3522101bf8c454fa2de80da016 Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Thu, 5 Feb 2015 10:07:20 +0100 Subject: [PATCH 01/78] Added event callbacks to CellView --- jointjs/jointjs.d.ts | 110 ++++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 49 deletions(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 9e6a2f0cc..e52c13f3c 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -17,33 +17,33 @@ declare module joint { class Graph extends Backbone.Model { initialize(); - fromJSON(json: any); + fromJSON(json:any); clear(); - addCell(cell: Cell); - addCells(cells: Cell[]); - getConnectedLinks(cell: Cell, opt?: any): Link[]; - disconnectLinks(cell: Cell); - removeLinks(cell: Cell); + addCell(cell:Cell); + addCells(cells:Cell[]); + getConnectedLinks(cell:Cell, opt?:any):Link[]; + disconnectLinks(cell:Cell); + removeLinks(cell:Cell); findModelsFromPoint(point:{x : number; y: number}):Element[]; } class Cell extends Backbone.Model { toJSON(); - remove(options?: any); + remove(options?:any); toFront(); toBack(); - embed(cell: Cell); - unembed(cell: Cell); - getEmbeddedCells(): Cell[]; - clone(opt?: any): Backbone.Model; // @todo: return can either be Cell or Cell[]. - attr(attrs: any): Cell; + embed(cell:Cell); + unembed(cell:Cell); + getEmbeddedCells():Cell[]; + clone(opt?:any):Backbone.Model; // @todo: return can either be Cell or Cell[]. + attr(attrs:any):Cell; } class Element extends Cell { - position(x: number, y: number): Element; - translate(tx: number, ty?: number): Element; - resize(width: number, height: number): Element; - rotate(angle: number, absolute): Element; + position(x:number, y:number):Element; + translate(tx:number, ty?:number):Element; + resize(width:number, height:number):Element; + rotate(angle:number, absolute):Element; } interface IDefaults { @@ -51,9 +51,9 @@ declare module joint { } class Link extends Cell { - defaults(): IDefaults; - disconnect(): Link; - label(idx?: number, value?: any): any; // @todo: returns either a label under idx or Link if both idx and value were passed + defaults():IDefaults; + disconnect():Link; + label(idx?:number, value?:any):any; // @todo: returns either a label under idx or Link if both idx and value were passed } interface IOptions { @@ -66,34 +66,41 @@ declare module joint { } class Paper extends Backbone.View { - options: IOptions; - setDimensions(width: number, height: number); - scale(sx: number, sy?: number, ox?: number, oy?: number): Paper; - rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already - findView(el: any): CellView; - findViewByModel(modelOrId: any): CellView; - findViewsFromPoint(p: { x: number; y: number; }): CellView[]; - findViewsInArea(r: { x: number; y: number; width: number; height: number; }): CellView[]; - snapToGrid(p): { x: number; y: number; }; + options:IOptions; + + setDimensions(width:number, height:number); + scale(sx:number, sy?:number, ox?:number, oy?:number):Paper; + rotate(deg:number, ox?:number, oy?:number):Paper; // @todo not released yet though it's in the source code already + findView(el:any):CellView; + findViewByModel(modelOrId:any):CellView; + findViewsFromPoint(p:{ x: number; y: number; }):CellView[]; + findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[]; + snapToGrid(p):{ x: number; y: number; }; } - class ElementView extends CellView { - scale(sx: number, sy: number); + class ElementView extends CellView { + scale(sx:number, sy:number); } class CellView extends Backbone.View { - getBBox(): { x: number; y: number; width: number; height: number; }; - highlight(el?: any); - unhighlight(el?: any); - findMagnet(el: any); - getSelector(el: any); + getBBox():{ x: number; y: number; width: number; height: number; }; + highlight(el?:any); + unhighlight(el?:any); + findMagnet(el:any); + getSelector(el:any); + + pointerdblclick(evt:any, x:number, y:number):void; + pointerclick(evt:any, x:number, y:number):void; + pointerdown(evt:any, x:number, y:number):void; + pointermove(evt:any, x:number, y:number):void; + pointerup(evt:any, x:number, y:number):void; } class LinkView extends CellView { - getConnectionLength(): number; - getPointAtLength(length: number): { x: number; y: number; }; + getConnectionLength():number; + getPointAtLength(length:number):{ x: number; y: number; }; } - + } module ui { @@ -127,21 +134,26 @@ declare module joint { module shapes { module basic { - class Generic extends joint.dia.Element { } - class Rect extends Generic { } - class Text extends Generic { } - class Circle extends Generic { } - class Image extends Generic { } + class Generic extends joint.dia.Element { + } + class Rect extends Generic { + } + class Text extends Generic { + } + class Circle extends Generic { + } + class Image extends Generic { + } } } module util { - function uuid(): string; - function guid(obj: any): string; - function mixin(objects: any[]): any; - function supplement(objects: any[]): any; - function deepMixin(objects: any[]): any; - function deepSupplement(objects: any[], defaultIndicator?: any): any; + function uuid():string; + function guid(obj:any):string; + function mixin(objects:any[]):any; + function supplement(objects:any[]):any; + function deepMixin(objects:any[]):any; + function deepSupplement(objects:any[], defaultIndicator?:any):any; } } From a0f9e136c004ef9894833bb09a98bdb60a25bb1f Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Fri, 6 Feb 2015 09:48:57 +0100 Subject: [PATCH 02/78] Separated jointjs and rappid definitions. --- jointjs/jointjs.d.ts | 34 ++++------------------------------ rappid/README.md | 1 + rappid/rappid.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 30 deletions(-) create mode 100644 rappid/README.md create mode 100644 rappid/rappid.d.ts diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index e52c13f3c..483523d67 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -1,6 +1,7 @@ -// Type definitions for Joint JS 0.6 +// Type definitions for Joint JS 0.9.3 // Project: http://www.jointjs.com/ -// Definitions by: Aidan Reel , David Durman +// Definitions by: Aidan Reel , +// David Durman , Ewout Van Gossum // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -103,34 +104,7 @@ declare module joint { } - module ui { - interface Handle { - name : string; - position : string; - icon: string; - } - - class SelectionView extends Backbone.Model { - paper:joint.dia.Paper; - graph:joint.dia.Graph; - model:Backbone.Collection; - - constructor(opt:{ - paper : joint.dia.Paper; - graph : joint.dia.Graph; - model : Backbone.Collection - }); - - createSelectionBox(cellView:joint.dia.CellView); - destroySelectionBox(cellView:joint.dia.CellView); - startSelecting(evt:any); - cancelSelection(); - - addHandle(handle:Handle); - removeHandle(name:string); - changeHandle(name:string, handle:Handle); - } - } + module ui {} module shapes { module basic { diff --git a/rappid/README.md b/rappid/README.md new file mode 100644 index 000000000..1119a7e6b --- /dev/null +++ b/rappid/README.md @@ -0,0 +1 @@ +These definitions are far from complete. \ No newline at end of file diff --git a/rappid/rappid.d.ts b/rappid/rappid.d.ts new file mode 100644 index 000000000..2b3aaf4e2 --- /dev/null +++ b/rappid/rappid.d.ts @@ -0,0 +1,38 @@ +// Type definitions for Rappid 1.5 +// Project: http://jointjs.com/about-rappid +// Definitions by: Ewout Van Gossum +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module joint{ + module ui{ + interface Handle { + name : string; + position : string; + icon: string; + } + + class SelectionView extends Backbone.Model { + paper:joint.dia.Paper; + graph:joint.dia.Graph; + model:Backbone.Collection; + + constructor(opt:{ + paper : joint.dia.Paper; + graph : joint.dia.Graph; + model : Backbone.Collection + }); + + createSelectionBox(cellView:joint.dia.CellView); + destroySelectionBox(cellView:joint.dia.CellView); + startSelecting(evt:any); + cancelSelection(); + + addHandle(handle:Handle); + removeHandle(name:string); + changeHandle(name:string, handle:Handle); + } + } +} \ No newline at end of file From 42c7718ad5ad711eae79c2f8d2c10e8fd7c491a7 Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Tue, 10 Feb 2015 08:55:17 +0100 Subject: [PATCH 03/78] Added return types where necessary. --- jointjs/jointjs.d.ts | 39 ++++++++++++++++++++------------------- rappid/rappid.d.ts | 14 +++++++------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 483523d67..5d2257ffd 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -17,24 +17,25 @@ declare module joint { } class Graph extends Backbone.Model { - initialize(); - fromJSON(json:any); - clear(); - addCell(cell:Cell); - addCells(cells:Cell[]); + addCell(cell:Cell) : void; + addCells(cells:Cell[]) : void; + initialize() : void; + fromJSON(json:any) : void; + toJSON() : Object; + clear() : void; getConnectedLinks(cell:Cell, opt?:any):Link[]; - disconnectLinks(cell:Cell); - removeLinks(cell:Cell); + disconnectLinks(cell:Cell) : void; + removeLinks(cell:Cell) : void; findModelsFromPoint(point:{x : number; y: number}):Element[]; } class Cell extends Backbone.Model { - toJSON(); - remove(options?:any); - toFront(); - toBack(); - embed(cell:Cell); - unembed(cell:Cell); + toJSON() : Object; + remove(options?:any) : void; + toFront() : void; + toBack() : void; + embed(cell:Cell) : void; + unembed(cell:Cell) : void; getEmbeddedCells():Cell[]; clone(opt?:any):Backbone.Model; // @todo: return can either be Cell or Cell[]. attr(attrs:any):Cell; @@ -69,7 +70,7 @@ declare module joint { class Paper extends Backbone.View { options:IOptions; - setDimensions(width:number, height:number); + setDimensions(width:number, height:number) : void; scale(sx:number, sy?:number, ox?:number, oy?:number):Paper; rotate(deg:number, ox?:number, oy?:number):Paper; // @todo not released yet though it's in the source code already findView(el:any):CellView; @@ -80,15 +81,15 @@ declare module joint { } class ElementView extends CellView { - scale(sx:number, sy:number); + scale(sx:number, sy:number) : void; } class CellView extends Backbone.View { getBBox():{ x: number; y: number; width: number; height: number; }; - highlight(el?:any); - unhighlight(el?:any); - findMagnet(el:any); - getSelector(el:any); + highlight(el?:any): void; + unhighlight(el?:any): void; + findMagnet(el:any): void; + getSelector(el:any): void; pointerdblclick(evt:any, x:number, y:number):void; pointerclick(evt:any, x:number, y:number):void; diff --git a/rappid/rappid.d.ts b/rappid/rappid.d.ts index 2b3aaf4e2..9cc438884 100644 --- a/rappid/rappid.d.ts +++ b/rappid/rappid.d.ts @@ -25,14 +25,14 @@ declare module joint{ model : Backbone.Collection }); - createSelectionBox(cellView:joint.dia.CellView); - destroySelectionBox(cellView:joint.dia.CellView); - startSelecting(evt:any); - cancelSelection(); + createSelectionBox(cellView:joint.dia.CellView) : void; + destroySelectionBox(cellView:joint.dia.CellView) : void; + startSelecting(evt:any) : void; + cancelSelection() : void; - addHandle(handle:Handle); - removeHandle(name:string); - changeHandle(name:string, handle:Handle); + addHandle(handle:Handle) : void; + removeHandle(name:string) : void; + changeHandle(name:string, handle:Handle) : void; } } } \ No newline at end of file From 24ef5a1d8aaa61548a42e54891f86023d06c3f5a Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Tue, 10 Feb 2015 09:04:47 +0100 Subject: [PATCH 04/78] Fixed Element rotate (and also updated to current jointjs api) --- jointjs/jointjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 5d2257ffd..5917f1811 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -45,7 +45,7 @@ declare module joint { position(x:number, y:number):Element; translate(tx:number, ty?:number):Element; resize(width:number, height:number):Element; - rotate(angle:number, absolute):Element; + rotate(angle:number, options : {absolute : boolean; origin: {x:number;y:number}}):Element; } interface IDefaults { From 7aa6024ba2db7b2e5b8ccee44168c6d362ddb37b Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Tue, 10 Feb 2015 09:08:35 +0100 Subject: [PATCH 05/78] Removed snapToGrid as it doesn't seem to be part of the public JointJS API. --- jointjs/jointjs.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 5917f1811..cf5efdc5b 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -1,7 +1,6 @@ // Type definitions for Joint JS 0.9.3 // Project: http://www.jointjs.com/ -// Definitions by: Aidan Reel , -// David Durman , Ewout Van Gossum +// Definitions by: Aidan Reel , David Durman , Ewout Van Gossum // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -77,7 +76,6 @@ declare module joint { findViewByModel(modelOrId:any):CellView; findViewsFromPoint(p:{ x: number; y: number; }):CellView[]; findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[]; - snapToGrid(p):{ x: number; y: number; }; } class ElementView extends CellView { From 3504f92e2f9cb5174f94010305d90cdde9adff8c Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Thu, 12 Feb 2015 17:03:25 +0100 Subject: [PATCH 06/78] Added remove(): void to Cell and Link. See: http://jointjs.com/api#joint.dia.Element:remove http://jointjs.com/api#joint.dia.Link:remove --- jointjs/jointjs.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index cf5efdc5b..19e239445 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -45,6 +45,7 @@ declare module joint { translate(tx:number, ty?:number):Element; resize(width:number, height:number):Element; rotate(angle:number, options : {absolute : boolean; origin: {x:number;y:number}}):Element; + remove(): void; } interface IDefaults { @@ -55,6 +56,7 @@ declare module joint { defaults():IDefaults; disconnect():Link; label(idx?:number, value?:any):any; // @todo: returns either a label under idx or Link if both idx and value were passed + remove(): void; } interface IOptions { From aebd7dec12bbe71ba544d2673fb6ed1868c4cecd Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Wed, 25 Feb 2015 07:57:03 +0900 Subject: [PATCH 07/78] Fix many incorrect types of socket.io.d.ts. references: https://github.com/Automattic/socket.io --- socket.io/socket.io.d.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 2571e239b..3a37d819a 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -37,19 +37,19 @@ declare module SocketIO { emit(name: string, ...args: any[]): Socket; use(fn: Function): Namespace; - on(event: 'connection', listener: (socket: Socket) => void): any; - on(event: 'connect', listener: (socket: Socket) => void): any; - on(event: string, listener: Function): any; + on(event: 'connection', listener: (socket: Socket) => void): Namespace; + on(event: 'connect', listener: (socket: Socket) => void): Namespace; + on(event: string, listener: Function): Namespace; } interface Namespace extends NodeJS.EventEmitter { name: string; connected: { [id: string]: Socket }; - use(fn: Function): Namespace + use(fn: Function): Namespace; - on(event: 'connection', listener: (socket: Socket) => void): any; - on(event: 'connect', listener: (socket: Socket) => void): any; - on(event: string, listener: Function): any; + on(event: 'connection', listener: (socket: Socket) => void): Namespace; + on(event: 'connect', listener: (socket: Socket) => void): Namespace; + on(event: string, listener: Function): Namespace; } interface Socket { @@ -63,8 +63,13 @@ declare module SocketIO { leave(name: string, fn?: Function): Socket; to(room: string): Socket; in(room: string): Socket; + send(): Socket; + write(): Socket; - on(event: string, listener: Function): any; + on(event: string, listener: Function): Socket; + once(event: string, listener: Function): Socket; + removeListener(event: string, listener: Function): Socket; + removeAllListeners(event: string): Socket; broadcast: Socket; volatile: Socket; connected: boolean; From 24991f93983dcd7b9004001583b74978114e3afd Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Wed, 25 Feb 2015 10:05:33 +0900 Subject: [PATCH 08/78] Fix socket.io.d.ts: argument of send(), write() oops --- socket.io/socket.io.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 3a37d819a..677d4fcc2 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -63,8 +63,8 @@ declare module SocketIO { leave(name: string, fn?: Function): Socket; to(room: string): Socket; in(room: string): Socket; - send(): Socket; - write(): Socket; + send(...args: any[]): Socket; + write(...args: any[]): Socket; on(event: string, listener: Function): Socket; once(event: string, listener: Function): Socket; From 4fb28c2c4aef8c4a3b6558cc11b6961b37fb13fd Mon Sep 17 00:00:00 2001 From: reppners Date: Wed, 25 Feb 2015 22:45:40 +0100 Subject: [PATCH 09/78] + initial commit --- js-data-angular/js-data-angular.d.ts | 19 ++ js-data/js-data.d.ts | 394 +++++++++++++++++++++++++++ 2 files changed, 413 insertions(+) create mode 100644 js-data-angular/js-data-angular.d.ts create mode 100644 js-data/js-data.d.ts diff --git a/js-data-angular/js-data-angular.d.ts b/js-data-angular/js-data-angular.d.ts new file mode 100644 index 000000000..a7c035722 --- /dev/null +++ b/js-data-angular/js-data-angular.d.ts @@ -0,0 +1,19 @@ +// Type definitions for JSDataAngular v2.1.0 +// Project: https://github.com/js-data/js-data-angular +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module JSData { + + class ngDS extends DS { + + // sync methods + bindAll(scope:ng.IScope, expr:string, resourceName:string, params:DSFilterParams, cb?:(err:DSError, items:Array)=>void):Function; + + bindOne(scope:ng.IScope, expr:string, resourceName:string, id:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(scope:ng.IScope, expr:string, resourceName:string, id:number, cb?:(err:DSError, item:T)=>void):Function; + } +} \ No newline at end of file diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts new file mode 100644 index 000000000..ce06edd89 --- /dev/null +++ b/js-data/js-data.d.ts @@ -0,0 +1,394 @@ +// Type definitions for JSData v1.3.0 +// Project: https://github.com/js-data/js-data +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/////////////////////////////////////////////////////////////////////////////// +// Promises in js-data are ES6 polyfill promises +/////////////////////////////////////////////////////////////////////////////// + +/// + +declare class JSDataPromise extends Promise { + + // enhanced with finally + finally(finallyCb?: () => U): Promise; +} + +/////////////////////////////////////////////////////////////////////////////// +// js-data module (js-data.js) +/////////////////////////////////////////////////////////////////////////////// + +// Support AMD require +declare module 'js-data' { + export = JSData; +} + +declare module JSData { + + class DS { + + constructor(config?:DSConfiguration); + + defaults:DSConfiguration; + + //TODO check if still exists + adapters:any; // Object consists of key-values pairs where the key is the name of the adapter and the value is + // the adapter itself. + //TODO check if still exists + errors:DSErrors; + + changeHistory(resourceName:string, id?:string):Array; + changeHistory(resourceName:string, id?:number):Array; + + changes(resourceName:string, id:string):Object; + changes(resourceName:string, id:number):Object; + + compute(resourceName:string, id:number):T; + compute(resourceName:string, id:string):T; + compute(resourceName:string, instance:Object):T; + + create(resourceName:string, attrs:any, options?:DSConfiguration):JSDataPromise; + + createInstance(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T; + + defineResource(resourceName:string):DSResourceDefinition; + defineResource(definition:DSResourceDefinitionConfiguration):DSResourceDefinition; + + destroy(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + destroy(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + + destroyAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise; + + digest():void; + + eject(resourceName:string, id:string, options?:DSConfiguration):T; + eject(resourceName:string, id:number, options?:DSConfiguration):T; + + ejectAll(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; + + filter(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; + + find(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + find(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + + findAll(resourceName:string, params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + + get(resourceName:string, id:string, options?:DSConfiguration):T; + get(resourceName:string, id:number, options?:DSConfiguration):T; + + getAll(resourceName:string, ids?:Array):Array; + getAll(resourceName:string, ids?:Array):Array; + + hasChanges(resourceName:string, id:string):boolean; + hasChanges(resourceName:string, id:number):boolean; + + inject(resourceName:string, attrs:T, options?:DSConfiguration):T; + inject(resourceName:string, items:Array, options?:DSConfiguration):Array; + + is(resourceName:string, object:Object): boolean; + + lastModified(resourceName:string, id?:string):number; // timestamp + lastModified(resourceName:string, id?:number):number; // timestamp + + lastSaved(resourceName:string, id?:string):number; // timestamp + lastSaved(resourceName:string, id?:number):number; // timestamp + + link(resourceName:string, id:string, relations?:Array):T; + link(resourceName:string, id:number, relations?:Array):T; + + linkAll(resourceName:string, params:DSFilterParams, relations?:Array):T; + + linkInverse(resourceName:string, id:string, relations?:Array):T; + linkInverse(resourceName:string, id:number, relations?:Array):T; + + loadRelations(resourceName:string, id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(resourceName:string, id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(resourceName:string, instance:Object, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(resourceName:string, id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(resourceName:string, id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(resourceName:string, instance:Object, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + + previous(resourceName:string, id:string):T; + previous(resourceName:string, id:number):T; + + reap(resourceName:string, options?:DSConfiguration):JSDataPromise; + + refresh(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + refresh(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + + registerAdapter(adapterId: string, adapter:IDSAdapter, options?:{default: boolean}):void; + + save(resourceName:string, id:string, options?:DSSaveConfiguration):JSDataPromise; + save(resourceName:string, id:number, options?:DSSaveConfiguration):JSDataPromise; + + unlinkInverse(resourceName:string, id:string, relations?:Array):T; + unlinkInverse(resourceName:string, id:number, relations?:Array):T; + + update(resourceName:string, id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; + update(resourceName:string, id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; + + updateAll(resourceName:string, attrs:any, params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + } + + interface DSConfiguration extends IDSResourceLifecycleEventHandlers { + actions?: Object; + allowSimpleWhere?: boolean; + basePath?: string; + bypassCache?: boolean; + cacheResponse?: boolean; + defaultAdapter?: string; + defaultFilter?: (collection:Array, resourceName:string, params:DSFilterParams, options:DSConfiguration)=>Array; + eagerEject?: boolean; + endpoint?: string; + error?: (message?: any, ...optionalParams: any[])=> void; + fallbackAdapters?: Array; + findAllFallbackAdapters?: Array; + findAllStrategy?: string; + findBelongsTo?: boolean; + findFallbackAdapters?: Array; + findHasOne?: boolean; + findHasMany?: boolean; + findInverseLinks?: boolean; + findStrategy?: string + idAttribute?: string; + ignoredChanges?:Array; + keepChangeHistory?: boolean; + loadFromServer?: boolean; + log?: any; + // log: (message?: any, ...optionalParams: any[])=> void; + // log: boolean; + maxAge?: number; + notify?: boolean; + reapAction?: string; + reapInterval?: number; + resetHistoryOnInject?: boolean; + strategy?: string; + upsert?: boolean; + useClass?: boolean; + useFilter: boolean; + } + + interface DSAdapterOperationConfiguration extends DSConfiguration { + adapter?: string + } + + interface DSSaveConfiguration extends DSAdapterOperationConfiguration { + changesOnly?: boolean; + } + + interface DSResourceDefinitionConfiguration extends DSConfiguration { + name: string; + computed?: any; + methods?: any; + relations?: { + hasMany?: Object; + hasOne?: Object; + belongsTo?: Object; + }; + } + + interface DSResourceDefinition extends DSResourceDefinitionConfiguration { + + changeHistory(id?:string):Array; + changeHistory(id?:number):Array; + + changes(id:string):Object; + changes(id:number):Object; + + compute(id:number):T; + compute(id:string):T; + compute(instance:Object):T; + + create(attrs:any, options?:DSConfiguration):JSDataPromise; + + createInstance(attrs?:T, options?:DSAdapterOperationConfiguration):T; + + defineResource(resourceName:string):DSResourceDefinition; + defineResource(definition:DSResourceDefinitionConfiguration):DSResourceDefinition; + + destroy(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + destroy(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + + destroyAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise; + + digest():void; + + eject(id:string, options?:DSConfiguration):T; + eject(id:number, options?:DSConfiguration):T; + + ejectAll(params:DSFilterParams, options?:DSConfiguration):Array; + + filter(params:DSFilterParams, options?:DSConfiguration):Array; + + find(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + find(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + + findAll(params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + + get(id:string, options?:DSConfiguration):T; + get(id:number, options?:DSConfiguration):T; + + getAll(ids?:Array):Array; + getAll(ids?:Array):Array; + + hasChanges(id:string):boolean; + hasChanges(id:number):boolean; + + inject(attrs:T, options?:DSConfiguration):T; + inject(items:Array, options?:DSConfiguration):Array; + + is(object:Object): boolean; + + lastModified(id?:string):number; // timestamp + lastModified(id?:number):number; // timestamp + + lastSaved(id?:string):number; // timestamp + lastSaved(id?:number):number; // timestamp + + link(id:string, relations?:Array):T; + link(id:number, relations?:Array):T; + + linkAll(params:DSFilterParams, relations?:Array):T; + + linkInverse(id:string, relations?:Array):T; + linkInverse(id:number, relations?:Array):T; + + loadRelations(id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(instance:Object, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(instance:Object, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + + previous(id:string):T; + previous(id:number):T; + + reap(options?:DSConfiguration):JSDataPromise; + + refresh(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + refresh(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + + save(id:string, options?:DSSaveConfiguration):JSDataPromise; + save(id:number, options?:DSSaveConfiguration):JSDataPromise; + + unlinkInverse(id:string, relations?:Array):T; + unlinkInverse(id:number, relations?:Array):T; + + update(id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; + update(id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; + + updateAll(attrs:any, params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + } + + interface DSFilterParams { + where?: Object; + + limit?: number; + + skip?: number; + offset?: number; + + orderBy?: any; + // wait for union types to be supported + //orderBy?: Array>; + //orderBy?: Array; + //orderBy?: string; + + sort?: any; + // wait for union types to be supported + //sort?: string; + //sort?: Array; + //sort?: Array>; + } + + interface IDSResourceLifecycleValidateEventHandlers { + beforeValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + validate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + afterValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + } + + interface IDSResourceLifecycleCreateEventHandlers { + beforeCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + afterCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + } + + interface IDSResourceLifecycleCreateInstanceEventHandlers { + beforeCreateInstance?: (resourceName:string, data:any)=>void; + afterCreateInstance?: (resourceName:string, data:any)=>void; + } + + interface IDSResourceLifecycleUpdateEventHandlers { + beforeUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + afterUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + } + + interface IDSResourceLifecycleDestroyEventHandlers { + beforeDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + afterDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void; + } + + interface IDSResourceLifecycleInjectEventHandlers { + beforeInject?: (resourceName:string, data:any)=>void; + afterInject?: (resourceName:string, data:any)=>void; + } + + interface IDSResourceLifecycleEjectEventHandlers { + beforeEject?: (resourceName:string, data:any)=>void; + afterEject?: (resourceName:string, data:any)=>void; + } + + interface IDSResourceLifecycleReapEventHandlers { + beforeReap?: (resourceName:string, data:any)=>void; + afterReap?: (resourceName:string, data:any)=>void; + } + + interface IDSResourceLifecycleEventHandlers extends IDSResourceLifecycleCreateEventHandlers, + IDSResourceLifecycleCreateInstanceEventHandlers, + IDSResourceLifecycleValidateEventHandlers, + IDSResourceLifecycleUpdateEventHandlers, + IDSResourceLifecycleDestroyEventHandlers, + IDSResourceLifecycleInjectEventHandlers, + IDSResourceLifecycleEjectEventHandlers, + IDSResourceLifecycleReapEventHandlers { + + } + + //TODO check if those are still valid + // errors + interface DSErrors { + + // types + IllegalArgumentError:DSError + NonexistentResourceError:DSError + RuntimeError:DSError + } + + //TODO check if those are still valid + interface DSError { + new (message?:string):DSError; + message: string; + type: string; + } + + // DSAdapter interface + interface IDSAdapter { + create(config:DSResourceDefinition, attrs:any, options?:DSConfiguration):JSDataPromise; + + destroy(config:DSResourceDefinition, id:string, options?:DSConfiguration):JSDataPromise; + destroy(config:DSResourceDefinition, id:number, options?:DSConfiguration):JSDataPromise; + + destroyAll(config:DSResourceDefinition, params:DSFilterParams, options?:DSConfiguration):JSDataPromise; + + find(config:DSResourceDefinition, id:string, options?:DSConfiguration):JSDataPromise; + find(config:DSResourceDefinition, id:number, options?:DSConfiguration):JSDataPromise; + + findAll(config:DSResourceDefinition, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; + + update(config:DSResourceDefinition, id:string, attrs:any, options?:DSConfiguration):JSDataPromise; + update(config:DSResourceDefinition, id:number, attrs:any, options?:DSConfiguration):JSDataPromise; + + updateAll(config:DSResourceDefinition, attrs:any, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; + } +} + From 143ee58d484a6fca6f59314ed141a16d55535fc7 Mon Sep 17 00:00:00 2001 From: reppners Date: Thu, 26 Feb 2015 09:53:11 +0100 Subject: [PATCH 10/78] + added tests + changed type definition to expose definitions as module and as globally defined namespace var --- js-data-angular/js-data-angular-tests.ts | 78 ++++ js-data-angular/js-data-angular.d.ts | 23 +- js-data/js-data-node-tests.ts | 17 + js-data/js-data-tests.ts | 493 +++++++++++++++++++++++ js-data/js-data.d.ts | 84 ++-- 5 files changed, 652 insertions(+), 43 deletions(-) create mode 100644 js-data-angular/js-data-angular-tests.ts create mode 100644 js-data/js-data-node-tests.ts create mode 100644 js-data/js-data-tests.ts diff --git a/js-data-angular/js-data-angular-tests.ts b/js-data-angular/js-data-angular-tests.ts new file mode 100644 index 000000000..670857dec --- /dev/null +++ b/js-data-angular/js-data-angular-tests.ts @@ -0,0 +1,78 @@ +/// + +interface IUser { + +} + +interface CustomScope extends ng.IScope { + + comments: Array; + user: IUser; + users: Array; +} + +angular.module('myApp') + .controller('commentsCtrl', function ($scope:CustomScope, store:JSData_.DS, Comment:JSData_.DSResourceDefinition, User:JSData_.DSResourceDefinition) { + + Comment.findAll().then(function (comments) { + $scope.comments = comments; + }); + + // shortest version + User.bindOne(1, $scope, 'user'); + +// short version + store.bindOne('user', 1, $scope, 'user'); + +// long version + $scope.$watch(function () { + return store.lastModified('user', 1); + }, function () { + $scope.user = store.get('user', 1); + }); + + var params = { + where: { + age: { + '>': 30 + } + } + }; + +// shortest verions + User.bindAll(params, $scope, 'users'); + +// short version + store.bindAll('user', params, $scope, 'users'); + +// long version + $scope.$watch(function () { + return store.lastModified('user'); + }, function () { + $scope.users = store.filter('user', params); + }); + }); + +angular.module('myApp') + .run(function (DS:JSData_.DS) { + // We don't register the "User" resource + // as a service, so it can only be used + // via DS.('user', ...) + // The advantage here is that this code + // is guaranteed to be executed, and you + // only ever have to inject "DS" + DS.defineResource('user'); + }) + .factory('Comment', function (DS:JSData_.DS) { + // This code won't execute unless you actually + // inject "Comment" somewhere in your code. + // Thanks Angular... + // Some like injecting actual Resource + // definitions, instead of just "DS" + return DS.defineResource('comment'); + }); + +angular.module('myApp') + .config(function (DSProvider:JSData_.DSProvider) { + DSProvider.defaults.basePath = '/myApi'; // etc. + }); \ No newline at end of file diff --git a/js-data-angular/js-data-angular.d.ts b/js-data-angular/js-data-angular.d.ts index a7c035722..851512d15 100644 --- a/js-data-angular/js-data-angular.d.ts +++ b/js-data-angular/js-data-angular.d.ts @@ -6,14 +6,25 @@ /// /// -declare module JSData { +declare module JSData_ { - class ngDS extends DS { + interface DSProvider { + defaults:DSConfiguration; + } - // sync methods - bindAll(scope:ng.IScope, expr:string, resourceName:string, params:DSFilterParams, cb?:(err:DSError, items:Array)=>void):Function; + interface DS { - bindOne(scope:ng.IScope, expr:string, resourceName:string, id:string, cb?:(err:DSError, item:T)=>void):Function; - bindOne(scope:ng.IScope, expr:string, resourceName:string, id:number, cb?:(err:DSError, item:T)=>void):Function; + bindAll(resourceName:string, params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array)=>void):Function; + + bindOne(resourceName:string, id:string, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(resourceName:string, id:number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + } + + interface DSResourceDefinition { + + bindAll(params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array)=>void):Function; + + bindOne(id:string, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(id:number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; } } \ No newline at end of file diff --git a/js-data/js-data-node-tests.ts b/js-data/js-data-node-tests.ts new file mode 100644 index 000000000..a0b39a161 --- /dev/null +++ b/js-data/js-data-node-tests.ts @@ -0,0 +1,17 @@ +/// + +import JSData = require('js-data'); +//TODO +//import DSRedisAdapter = require('js-data-redis') +var store = new JSData.DS(); + +// register and use http by default for async operations +//TODO +//store.registerAdapter('redis', new DSRedisAdapter(), {default: true}); + +// simplest model definition +var User = store.defineResource('user'); + +User.find(1).then(function (user: any) { + user; // { id: 1, name: 'John' } +}); \ No newline at end of file diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts new file mode 100644 index 000000000..1cb3e8e72 --- /dev/null +++ b/js-data/js-data-tests.ts @@ -0,0 +1,493 @@ +/// + +interface IUser { + id?: number; + name?: string; + age?: number; + first?: string; + last?: string; + comments?:Array; + profile?:any; +} + +interface IUserWithMethod extends IUser { + fullName?: () => string; +} + +interface IUserWithComputedProperty extends IUser { + fullName?: string; +} + +var store = new JSData.DS(); + +// register and use http by default for async operations +//TODO +//store.registerAdapter('http', new DSHttpAdapter(), {default: true}); + +// simplest model definition +var User = store.defineResource('user'); + +User.find(1).then(function (user:IUser) { + user; // { id: 1, name: 'John' } +}); + +var user:IUser = User.createInstance({name: 'John'}); + +var store = new JSData.DS(); +var User = store.defineResource('user'); +var user:IUser = User.inject({id: 1, name: 'John'}); +var user2:IUser = User.inject({id: 1, age: 30}); + +user; // User { id: 1, name: 'John', age: 30 } +user2; // User { id: 1, name: 'John', age: 30 } +User.get(1); // User { id: 1, name: 'John', age: 30 } +user === user2; // true +user === User.get(1); // true +user2 === User.get(1); // true + +var store = new JSData.DS({ + // set a default lifecycle hook + afterCreate: function () { + } +}); + +var User = store.defineResource({ + name: 'user', + // override the hook for this resource + afterCreate: function () { + } +}); + +User.create({ + name: 'john' +}, { + // override the hook just for this method call + afterCreate: function () { + } +}).then(()=> { + +}); + +var store = new JSData.DS(); + +var UserWithMethod = store.defineResource({ + name: 'user', + methods: { + fullName: function () { + return this.first + ' ' + this.last; + } + } +}); + +var userWithMethod = UserWithMethod.createInstance({first: 'John', last: 'Anderson'}); + +userWithMethod.fullName(); // "John Anderson" + +var store = new JSData.DS(); + +var UserWithComputedProperty = store.defineResource({ + name: 'user', + computed: { + // each function's argument list defines the fields + // that the computed property depends on + fullName: ['first', 'last', function (first: string, last: string) { + return first + ' ' + last; + }], + // shortand, use the array syntax above if you want + // you computed properties to work after you've + // minified your code. Shorthand style won't work when minified + initials: function (first: string, last: string) { + return first.toUpperCase()[0] + '. ' + last.toUpperCase()[0] + '.'; + } + } +}); + +var userWithComputedProperty:IUserWithComputedProperty = UserWithComputedProperty.inject({ + id: 1, + first: 'John', + last: 'Anderson' +}); + +userWithComputedProperty.fullName; // "John Anderson" + +userWithComputedProperty.first = 'Fred'; + +// js-data relies on dirty-checking, so the +// computed property (probably) hasn't been updated yet +userWithComputedProperty.fullName; // "John Anderson" + +// If your browser supports Object.observe this will have no effect +// otherwise it will trigger the dirty-checking +store.digest(); + +userWithComputedProperty.fullName; // "Fred Anderson" + +interface IComment { + comments?: any; + profile?: any; +} + +var aComment:JSData_.DSResourceDefinition = store.defineResource('comment'); + +// Get all comments where comment.userId == 5 +aComment.filter({ + where: { + userId: { + '==': 5 + } + } +}); + +// Get all comments where comment.userId == 5 +aComment.filter({ + userId: 5 +}); + +// Get all comments where comment.userId === 5 +aComment.filter({ + where: { + userId: { + '===': 5 + } + } +}); + +// Get all comments where comment.userId != 5 +aComment.filter({ + where: { + userId: { + '!=': 5 + } + } +}); + +// Get all comments where comment.userId !== 5 +aComment.filter({ + where: { + userId: { + '!==': 5 + } + } +}); + +// Get all users where user.age > 30 +User.filter({ + where: { + age: { + '>': 30 + } + } +}); + +// Get all users where user.age >= 30 +User.filter({ + where: { + age: { + '>=': 30 + } + } +}); + +// Get all users where user.age < 30 +User.filter({ + where: { + age: { + '<': 30 + } + } +}); + +// Get all users where user.name is in "John Anderson" +User.filter({ + where: { + name: { + 'in': 'John Anderson' + } + } +}); + +// Get all users where user.role is in ["admin", "owner"] +User.filter({ + where: { + role: { + 'in': ['admin', 'owner'] + } + } +}); + +// Get all users where user.name is NOT in "John Anderson" +User.filter({ + where: { + name: { + 'notIn': 'John Anderson' + } + } +}); + +// Get all users where user.role is NOT in ["admin", "owner"] +User.filter({ + where: { + role: { + 'notIn': ['admin', 'owner'] + } + } +}); + +// Get all users where user.name contains "John" +User.filter({ + where: { + name: { + 'contains': 'John' + } + } +}); + +// Get all users where user.roles contains "admin" +User.filter({ + where: { + roles: { + 'contains': 'admin' + } + } +}); + +// Sorts users by age in ascending order +User.filter({ + orderBy: 'age' +}); + +// Sorts users by age in descending order +User.filter({ + orderBy: ['age', 'DESC'] +}); + +// Sorts users by age in descending order and then sort by name in ascending order to break a tie +User.filter({ + orderBy: [ + ['age', 'DESC'], + ['name', 'ASC'] + ] +}); + +var PAGE_SIZE = 20; +var currentPage = 1; + +interface IPost { + +} + +var Post:JSData_.DSResourceDefinition; + +// Grab the first "page" of posts +Post.filter({ + offset: PAGE_SIZE * (currentPage - 1), + limit: PAGE_SIZE +}); + +var User = store.defineResource({ + name: 'user', + relations: { + hasMany: { + comment: { + localField: 'comments', + foreignKey: 'userId' + } + }, + hasOne: { + profile: { + localField: 'profile', + foreignKey: 'userId' + } + }, + belongsTo: { + organization: { + localKey: 'organizationId', + localField: 'organization', + + // if you add this to a belongsTo relation + // then js-data will attempt to use + // a nested url structure, e.g. /organization/15/user/4 + parent: true + } + } + } +}); + +var Organization = store.defineResource({ + name: 'organization', + relations: { + hasMany: { + // this is an example of multiple relations + // of the same type to the same resource + user: [ + { + localField: 'users', + foreignKey: 'organizationId' + }, + { + localField: 'owners', + foreignKey: 'organizationId' + } + ] + } + } +}); + +var Profile = store.defineResource({ + name: 'profile', + relations: { + belongsTo: { + user: { + localField: 'user', + localKey: 'userId' + } + } + } +}); + +var OtherComment = store.defineResource({ + name: 'comment', + relations: { + belongsTo: { + user: { + localField: 'user', + localKey: 'userId' + } + } + } +}); + +User.find(10).then(function (user:IUser) { + // let's assume the server only returned the user + user.comments; // undefined + user.profile; // undefined + + User.loadRelations(user, ['comment', 'profile']).then(function (user:IUser) { + user.comments; // array + user.profile; // object + }); +}); + +var OtherOtherComment = store.defineResource({ + name: 'comment', + relations: { + belongsTo: { + post: { + parent: true, + localKey: 'postId', + localField: 'post' + } + } + } +}); + +// The comment isn't in the data store yet, so js-data wouldn't know +// what the id of the parent "post" would be, so we pass it in manually +OtherOtherComment.find(5, {params: {postId: 4}}); // GET /post/4/comment/5 + +// vs + +OtherOtherComment.find(5); // GET /comment/5 + +OtherOtherComment.inject({id: 1, postId: 2}); + +// We don't have to provide the parentKey here +// because js-data found it in the comment +OtherOtherComment.update(1, {content: 'stuff'}); // PUT /post/2/comment/1 + +// If you don't want the nested for just one of the calls then +// you can do the following: +OtherOtherComment.update(1, {content: 'stuff'}, {params: {postId: false}}); // PUT /comment/1 + +var store = new JSData.DS({ + // set the default + beforeCreate: function (resource, data, cb) { + // do something general + cb(null, data); + } +}); + +var User = store.defineResource({ + name: 'user', + // set just for this resource + beforeCreate: function (resource, data, cb) { + // do something more specific to "users" + cb(null, data); + } +}); + +User.create({name: 'John'}, { + // set just for this method call + beforeCreate: function (resource, data, cb) { + // do something specific for this method call + cb(null, data); + } +}); + +module CustomAdapterTest { + + class MyCustomAdapter implements JSData_.IDSAdapter { + + // All of the methods shown here must return a promise + +// "definition" is a resource defintion that would +// be returned by DS#defineResource + +// "options" would be the options argument that +// was passed into the DS method that is calling +// the adapter method + + create(definition:JSData_.DSResourceDefinition, attrs:Object, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must resolve the promise with the created item + + var promise:JSData_.JSDataPromise; + return promise; + } + + find(definition:JSData_.DSResourceDefinition, id:any, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must resolve the promise with the found item + + var promise:JSData_.JSDataPromise; + return promise; + } + + findAll(definition:JSData_.DSResourceDefinition, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must resolve the promise with the found items + + var promise:JSData_.JSDataPromise; + return promise; + } + + update(definition:JSData_.DSResourceDefinition, id:any, attrs:Object, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must resolve the promise with the updated items + + var promise:JSData_.JSDataPromise; + return promise; + } + + updateAll(definition:JSData_.DSResourceDefinition, attrs:Object, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must resolve the promise with the updated items + + var promise:JSData_.JSDataPromise; + return promise; + } + + destroy(definition:JSData_.DSResourceDefinition, id:any, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must return a promise + + var promise:JSData_.JSDataPromise; + return promise; + } + + destroyAll(definition:JSData_.DSResourceDefinition, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + // Must return a promise + + var promise:JSData_.JSDataPromise; + return promise; + } + } + + var store = new JSData.DS(); + store.registerAdapter('mca', new MyCustomAdapter(), {default: true}); + // the data store will now use your custom adapter by default +} \ No newline at end of file diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index ce06edd89..13fc5e691 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -9,35 +9,29 @@ /// -declare class JSDataPromise extends Promise { - - // enhanced with finally - finally(finallyCb?: () => U): Promise; -} - /////////////////////////////////////////////////////////////////////////////// // js-data module (js-data.js) /////////////////////////////////////////////////////////////////////////////// -// Support AMD require -declare module 'js-data' { - export = JSData; -} +// defining what exists in JSData and how it looks +declare module JSData_ { -declare module JSData { + class JSDataPromise extends Promise { - class DS { + // enhanced with finally + finally(finallyCb?:() => U):Promise; + } - constructor(config?:DSConfiguration); + //TODO switch to class again when typescript supports open ended class declaration + interface DS { + + new(config?:DSConfiguration):DS; + + // rather undocumented + errors:DSErrors; defaults:DSConfiguration; - //TODO check if still exists - adapters:any; // Object consists of key-values pairs where the key is the name of the adapter and the value is - // the adapter itself. - //TODO check if still exists - errors:DSErrors; - changeHistory(resourceName:string, id?:string):Array; changeHistory(resourceName:string, id?:number):Array; @@ -72,7 +66,7 @@ declare module JSData { find(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; find(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - findAll(resourceName:string, params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + findAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; get(resourceName:string, id:string, options?:DSConfiguration):T; get(resourceName:string, id:number, options?:DSConfiguration):T; @@ -117,7 +111,7 @@ declare module JSData { refresh(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; refresh(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - registerAdapter(adapterId: string, adapter:IDSAdapter, options?:{default: boolean}):void; + registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void; save(resourceName:string, id:string, options?:DSSaveConfiguration):JSDataPromise; save(resourceName:string, id:number, options?:DSSaveConfiguration):JSDataPromise; @@ -128,7 +122,7 @@ declare module JSData { update(resourceName:string, id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; update(resourceName:string, id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - updateAll(resourceName:string, attrs:any, params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + updateAll(resourceName:string, attrs:any, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; } interface DSConfiguration extends IDSResourceLifecycleEventHandlers { @@ -140,8 +134,10 @@ declare module JSData { defaultAdapter?: string; defaultFilter?: (collection:Array, resourceName:string, params:DSFilterParams, options:DSConfiguration)=>Array; eagerEject?: boolean; + // TODO enable when eagerInject in DS#create is implemented + //eagerInject?: boolean; endpoint?: string; - error?: (message?: any, ...optionalParams: any[])=> void; + error?: (message?:any, ...optionalParams:any[])=> void; fallbackAdapters?: Array; findAllFallbackAdapters?: Array; findAllStrategy?: string; @@ -152,10 +148,13 @@ declare module JSData { findInverseLinks?: boolean; findStrategy?: string idAttribute?: string; - ignoredChanges?:Array; + ignoredChanges?: Array; + // TODO ignoreMissing is undocumented + //ignoreMissing: boolean; keepChangeHistory?: boolean; loadFromServer?: boolean; log?: any; + // TODO wait for union types to be supported // log: (message?: any, ...optionalParams: any[])=> void; // log: boolean; maxAge?: number; @@ -166,7 +165,7 @@ declare module JSData { strategy?: string; upsert?: boolean; useClass?: boolean; - useFilter: boolean; + useFilter?: boolean; } interface DSAdapterOperationConfiguration extends DSConfiguration { @@ -224,7 +223,7 @@ declare module JSData { find(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; find(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - findAll(params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + findAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; get(id:string, options?:DSConfiguration):T; get(id:number, options?:DSConfiguration):T; @@ -256,10 +255,10 @@ declare module JSData { loadRelations(id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; loadRelations(id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(instance:Object, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(instance:T, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; loadRelations(id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; loadRelations(id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(instance:Object, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + loadRelations(instance:T, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; previous(id:string):T; previous(id:number):T; @@ -278,7 +277,7 @@ declare module JSData { update(id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; update(id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - updateAll(attrs:any, params:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + updateAll(attrs:any, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; } interface DSFilterParams { @@ -290,13 +289,13 @@ declare module JSData { offset?: number; orderBy?: any; - // wait for union types to be supported + // TODO wait for union types to be supported //orderBy?: Array>; //orderBy?: Array; //orderBy?: string; sort?: any; - // wait for union types to be supported + // TODO wait for union types to be supported //sort?: string; //sort?: Array; //sort?: Array>; @@ -354,18 +353,19 @@ declare module JSData { } - //TODO check if those are still valid // errors interface DSErrors { // types - IllegalArgumentError:DSError - NonexistentResourceError:DSError - RuntimeError:DSError + IllegalArgumentError:DSError; + IA:DSError; + RuntimeError:DSError; + R:DSError; + NonexistentResourceError:DSError; + NER:DSError; } - //TODO check if those are still valid - interface DSError { + interface DSError extends Error { new (message?:string):DSError; message: string; type: string; @@ -392,3 +392,13 @@ declare module JSData { } } +// declaring the existing global js object +declare var JSData:{ + DS: JSData_.DS +}; + +//Support node require +declare module 'js-data' { + + export = JSData; +} \ No newline at end of file From cb67739c13ed9104d4527e7ed25ec726c2361fb8 Mon Sep 17 00:00:00 2001 From: reppners Date: Thu, 26 Feb 2015 10:01:27 +0100 Subject: [PATCH 11/78] + initial commit for ds-http-adapter definition --- js-data-http/js-data-http.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 js-data-http/js-data-http.d.ts diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts new file mode 100644 index 000000000..60a279103 --- /dev/null +++ b/js-data-http/js-data-http.d.ts @@ -0,0 +1,13 @@ +// Type definitions for JSData Http Adapter v1.2.0 +// Project: https://github.com/js-data/js-data-http +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JSData_ { + + interface DSHttpAdapter extends IDSAdapter { + + } +} \ No newline at end of file From 8385575c31441ffa956768161ebb653f51e7e706 Mon Sep 17 00:00:00 2001 From: reppners Date: Thu, 26 Feb 2015 10:35:21 +0100 Subject: [PATCH 12/78] + ds-http-adapter definition complete with tests --- js-data-http/js-data-http-tests.ts | 167 +++++++++++++++++++++++++++++ js-data-http/js-data-http.d.ts | 35 +++++- 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 js-data-http/js-data-http-tests.ts diff --git a/js-data-http/js-data-http-tests.ts b/js-data-http/js-data-http-tests.ts new file mode 100644 index 000000000..41459ed81 --- /dev/null +++ b/js-data-http/js-data-http-tests.ts @@ -0,0 +1,167 @@ +/// + +var adapter = new DSHttpAdapter(); +var store = new JSData.DS(); +store.registerAdapter('http', adapter, { default: true }); + +var ADocument:JSData_.DSResourceDefinition = store.defineResource('document'); + +ADocument.inject({ id: 5, author: 'John' }); + +// bypass the data store +adapter.update(ADocument, 5, { author: 'Johnny' }).then(function (document:any) { + document; // { id: 5, author: 'Johnny' } + + // The updated document has NOT been injected into the data store because we bypassed the data store + ADocument.get(document.id); // { id: 5, author: 'John' } +}); + +// Normally you would just go through the data store +ADocument.update(5, { author: 'Johnny' }).then(function (document:any) { + document; // { id: 5, author: 'Johnny' } + + // the updated document has been injected into the data store + ADocument.get(document.id); // { id: 5, author: 'Johnny' } +}); + +ADocument.inject({ id: 5, author: 'John' }); +ADocument.inject({ id: 6, author: 'John' }); + +// bypass the data store +adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) { + documents[0]; // { id: 5, author: 'Johnny' } + + // The updated documents have NOT been injected into the data store because we bypassed the data store + ADocument.filter({ author: 'John' }); // [{...}, {...}] + ADocument.filter({ author: 'Johnny' }); // [] +}); + +// Normally you would just go through the data store +ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (documents) { + documents[0]; // { id: 5, author: 'Johnny' } + + // the updated documents have been injected into the data store + ADocument.filter({ author: 'John' }); // [] + ADocument.filter({ author: 'Johnny' }); // [{...}, {...}] +}); + +adapter.PUT('/user/1', { name: 'Johnny' }).then(function (data) { + data.data; // { id: 1, name: 'Johnny', ... } + data.headers; // {...} + data.status; // 200 + data.config; //{...} +}); + +adapter.POST('/user/1', { name: 'John' }).then(function (data) { + data.data; // { id: 1, name: 'John', ... } + data.headers; // {...} + data.status; // 200 + data.config; //{...} +}); + +adapter.HTTP({ url: '/user/1', method: 'put', data: { name: 'Johnny' }}).then(function (data) { + data.data; // { id: 1, name: 'Johnny', ... } + data.headers; // {...} + data.status; // 200 + data.config; //{...} +}); + +adapter.GET('/user/1').then(function (data) { + data.data; // { id: 1, ... } + data.headers; // {...} + data.status; // 200 + data.config; //{...} +}); + +var User:JSData_.DSResourceDefinition = store.defineResource('user'); + +var params:any = { + age: { + '>': 30 + } +}; + +// bypass the data store +adapter.findAll(User, params).then(function (users) { + // users[0].age; 55 // etc., etc. + + // the users have NOT been injected into the data store because we bypassed the data store + User.filter(params); // [] +}); + +// normally you would go through the data store +User.findAll(params).then(function (users) { + // users[0].age; 55 // etc., etc. + + // the users have been injected into the data store + User.filter(params); // [{...}, {...}, ...] +}); + +// bypass the data store +adapter.find(ADocument, 5).then(function (document:any) { + document; // { id: 5, author: 'John Anderson' } + + // the document has NOT been injected into the data store because we bypassed the data store + ADocument.get(document.id); // undefined +}); + +// Normally you would just go through the data store +ADocument.find(5).then(function (document:any) { + document; // { id: 5, author: 'John Anderson' } + + // the document has been injected into the data store + ADocument.get(document.id); // { id: 5, author: 'John Anderson' } +}); + +var params:any = { + author: 'John' +}; + +// bypass the data store +adapter.destroyAll(ADocument, params).then(function () { + // the documents have NOT been ejected from the data store because we bypassed the data store + ADocument.filter(params); // [{...}, {...}, ...] +}); + +// normally you would go through the data store +ADocument.destroyAll(params).then(function () { + // the documents have been ejected from the data store + ADocument.filter(params); // [] +}); + +ADocument.inject({ id: 5, author: 'John' }); + +// bypass the data store +adapter.destroy(ADocument, 5).then(function () { + // the document is still in the data store because we bypassed the data store + //ADocument.get(document.id); // { id: 5, author: 'John' } +}); + +// Normally you would just go through the data store +ADocument.destroy(5).then(function () { + // the document has been ejected from the data store + //ADocument.get(document.id); // undefined +}); + +adapter.DEL('/user/1').then(function (data) { + data.data; // 1 + data.headers; // {...} + data.status; // 204 + data.config; //{...} +}); + +// bypass the data store +adapter.create(ADocument, { author: 'John' }).then(function (document:any) { + document; // { id: 5, author: 'John' } + + // The new document has NOT been injected into the data store because we bypassed the data store + ADocument.get(document.id); // undefined +}); + +// Normally you would just go through the data store +ADocument.create({ author: 'John' }).then(function (document:any) { + document; // { id: 5, author: 'John' } + + // the new document has been injected into the data store + ADocument.get(document.id); // { id: 5, author: 'John' } +}); \ No newline at end of file diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts index 60a279103..3a8a8adf0 100644 --- a/js-data-http/js-data-http.d.ts +++ b/js-data-http/js-data-http.d.ts @@ -6,8 +6,41 @@ /// declare module JSData_ { + + interface DSHttpAdapterOptions { + serialize?: (resourceName:string, data:any)=>any; + deserialize?: (resourceName:string, data:any)=>any; + queryTransform?: (resourceName:string, params:DSFilterParams)=>any; + httpConfig?: any; + forceTrailingSlash?: boolean; + log?: any; + // TODO wait for union types to be supported + // log: (message?: any, ...optionalParams: any[])=> void; + // log: boolean; + error?: any; + // TODO wait for union types to be supported + // error: (message?: any, ...optionalParams: any[])=> void; + // error: boolean; + } + + interface DSHttpAdapterPromiseResolveType { + data: any; + headers: any; + status: number; + config: any; + } interface DSHttpAdapter extends IDSAdapter { + new(options?:DSHttpAdapterOptions):DSHttpAdapter; + + // DSHttpAdapter uses axios so options are axios config objects. + HTTP(options?:Object):Promise; + DEL(url:string, data?:Object, options?:Object):Promise; + GET(url:string, data?:Object, options?:Object):Promise; + POST(url:string, data?:Object, options?:Object):Promise; + PUT(url:string, data?:Object, options?:Object):Promise; } -} \ No newline at end of file +} + +declare var DSHttpAdapter:JSData_.DSHttpAdapter; \ No newline at end of file From 819aa8bc552c8aacf526ebf6aa4b2d3a70084688 Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Sat, 28 Feb 2015 09:34:04 +0900 Subject: [PATCH 13/78] node.d.ts: child_process#send() 2nd argument is optional --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index b1e849535..c30b2a9b4 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -609,7 +609,7 @@ declare module "child_process" { stderr: stream.Readable; pid: number; kill(signal?: string): void; - send(message: any, sendHandle: any): void; + send(message: any, sendHandle?: any): void; disconnect(): void; } From c874400b6c500617c3a6fdd054edda3f3ca5e3e3 Mon Sep 17 00:00:00 2001 From: Matthew Hamilton Date: Mon, 2 Mar 2015 11:02:42 -0600 Subject: [PATCH 14/78] Fixed #3344: Added definitions and compile tests for angular-idle. --- angular-idle/angular-idle-tests.ts | 23 +++++ angular-idle/angular-idle.d.ts | 134 +++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 angular-idle/angular-idle-tests.ts create mode 100644 angular-idle/angular-idle.d.ts diff --git a/angular-idle/angular-idle-tests.ts b/angular-idle/angular-idle-tests.ts new file mode 100644 index 000000000..fc39bf72a --- /dev/null +++ b/angular-idle/angular-idle-tests.ts @@ -0,0 +1,23 @@ +/// + +angular.module('app', ['ngIdle']) + .config(['$keepaliveProvider', '$idleProvider', + ($keepaliveProvider: ng.idle.IKeepAliveProvider, $idleProvider: ng.idle.IIdleProvider) => { + $idleProvider.activeOn('mousemove keydown DOMMouseScroll mousewheel mousedown'); + $idleProvider.idleDuration(5); + $idleProvider.warningDuration(5); + $idleProvider.keepalive(true) + $idleProvider.autoResume(true); + $keepaliveProvider.interval(10); + }]) + .run(['$keepalive', '$idle', ($keepalive: ng.idle.IKeepAliveService, $idle: ng.idle.IIdleService) => { + $idle.watch(); + + if ($idle.running() || $idle.idling()) { + $idle.unwatch(); + } + + $keepalive.start(); + $keepalive.ping(); + $keepalive.stop(); + }]); \ No newline at end of file diff --git a/angular-idle/angular-idle.d.ts b/angular-idle/angular-idle.d.ts new file mode 100644 index 000000000..57ef2380b --- /dev/null +++ b/angular-idle/angular-idle.d.ts @@ -0,0 +1,134 @@ +// Type definitions for ng-idle v0.3.5 +// Project: http://hackedbychinese.github.io/ng-idle/ +// Definitions by: mthamil +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ng.idle { + + /** + * Used to configure the $keepalive service. + */ + interface IKeepAliveProvider extends IServiceProvider { + + /** + * If configured, options will be used to issue a request using $http. + * If the value is null, no HTTP request will be issued. + * You can specify a string, which it will assume to be a URL to a simple GET request. + * Otherwise, you can use the same options $http takes. However, cache will always be false. + * + * @param value May be string or object, default is null. + */ + http(value: any): void; + + /** + * This specifies how often the keepalive event is triggered and the + * HTTP request is issued. + * + * @param seconds Integer, default is 5 minutes. Must be greater than 0. + */ + interval(seconds: number): void; + } + + /** + * $keepalive will use a timeout to periodically wake, broadcast a $keepalive event on the root scope, + * and optionally make an $http request. By default, the $idle service will stop and start $keepalive + * when a user becomes idle or returns from idle, respectively. It is also started automatically when + * $idle.watch() is called. This can be disabled by configuring the $idleProvider. + */ + interface IKeepAliveService { + + /** + * Starts pinging periodically until stop() is called. + */ + start(): void; + + /** + * Stops pinging. + */ + stop(): void; + + /** + * Performs one ping only. + */ + ping(): void; + } + + /** + * Used to configure the $idle service. + */ + interface IIdleProvider extends IServiceProvider { + + /** + * Specifies the DOM events the service will watch to reset the idle timeout. + * Multiple events should be separated by a space. + * + * @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown' + */ + activeOn(events: string): void; + + /** + * The idle timeout duration in seconds. After this amount of time passes without the user + * performing an action that triggers one of the watched DOM events, the user is considered + * idle. + * + * @param seconds integer, default is 20min + */ + idleDuration(seconds: number): void; + + /** + * The amount of time the user has to respond (in seconds) before they have been considered + * timed out. + * + * @param seconds integer, default is 30s + */ + warningDuration(seconds: number): void; + + /** + * When true, user activity will automatically interrupt the warning countdown and reset the + * idle state. If false, you will need to manually call watch() when you want to start + * watching for idleness again. + * + * @param enabled boolean, default is true + */ + autoResume(enabled: boolean): void; + + /** + * When true, the $keepalive service is automatically stopped and started as needed. + * + * @param enabled boolean, default is true + */ + keepalive(enabled: boolean): void; + } + + /** + * $idle, once watch() is called, will start a timeout which if expires, will enter a warning state + * countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the + * user has timed out (where your app should log them out or whatever you like). If the user performs + * an action that triggers a watched DOM event that bubbles up to document.body, this will reset the + * idle/warning state and start the process over again. + */ + interface IIdleService { + + /** + * Whether or not the watch() has been called and it is watching for idleness. + */ + running(): boolean; + + /** + * Whether or not the user appears to be idle. + */ + idling(): boolean; + + /** + * Starts watching for idleness, or resets the idle/warning state and continues watching. + */ + watch(): void; + + /** + * Stops watching for idleness, and resets the idle/warning state. + */ + unwatch(): void; + } +} \ No newline at end of file From 0d3541aec2cbb3010c15e2cec227cfdb271af362 Mon Sep 17 00:00:00 2001 From: NN Date: Thu, 26 Feb 2015 08:26:30 +0200 Subject: [PATCH 15/78] Add global chrome object through window It allows to add a check for existence of 'chrome' object. Without it the strict mode can complain about undefined variable. --- chrome/chrome.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index e77f744fa..cbabf893a 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -5,6 +5,13 @@ /// +//////////////////// +// Global object +//////////////////// +interface Window { + chrome: typeof chrome; +} + //////////////////// // Alarms //////////////////// From c4e849a93dcd3f215cfb0b99559250d0b686c1e5 Mon Sep 17 00:00:00 2001 From: Eugene <12kb@sibmail.com> Date: Tue, 3 Mar 2015 02:26:03 +0600 Subject: [PATCH 16/78] Update three.d.ts http://threejs.org/docs/#Reference/Extras.Helpers/BoundingBoxHelper .box property type is THREE.Box3, not the array. Seems mistake. --- threejs/three.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 78beab253..b74844407 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -5613,7 +5613,7 @@ declare module THREE { constructor(object: Object3D, hex?: number); object: Object3D; - box: Box3[]; + box: Box3; update(): void; } From eec429264eb620e1575dd5168fd08cb6cce8e072 Mon Sep 17 00:00:00 2001 From: reppners Date: Mon, 2 Mar 2015 21:27:20 +0100 Subject: [PATCH 17/78] + changing the JSData Promise type to interface + adding definitions object with usage example in tests for enabling custom type definitions of created resource definitions --- js-data/js-data-tests.ts | 35 ++++++++++++++++++++++++++++++++--- js-data/js-data.d.ts | 9 +++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts index 1cb3e8e72..a6ac09a42 100644 --- a/js-data/js-data-tests.ts +++ b/js-data/js-data-tests.ts @@ -90,13 +90,13 @@ var UserWithComputedProperty = store.defineResource({ computed: { // each function's argument list defines the fields // that the computed property depends on - fullName: ['first', 'last', function (first: string, last: string) { + fullName: ['first', 'last', function (first:string, last:string) { return first + ' ' + last; }], // shortand, use the array syntax above if you want // you computed properties to work after you've // minified your code. Shorthand style won't work when minified - initials: function (first: string, last: string) { + initials: function (first:string, last:string) { return first.toUpperCase()[0] + '. ' + last.toUpperCase()[0] + '.'; } } @@ -490,4 +490,33 @@ module CustomAdapterTest { var store = new JSData.DS(); store.registerAdapter('mca', new MyCustomAdapter(), {default: true}); // the data store will now use your custom adapter by default -} \ No newline at end of file +} + +/** + * showing the use of open ended interface to realize typings + * on the Datastore.definitions object where all resource definitions + * are saved. + */ + +interface MyCustomDataStore { + + myResource: JSData_.DSResourceDefinition +} + +interface MyResourceDefinition { + +} + +module JSData_ { + + interface DS { + + definitions: MyCustomDataStore; + } +} + +var store = new JSData.DS(); + +var myResourceDefinition = store.defineResource('myResource'); + +myResourceDefinition = store.definitions.myResource; \ No newline at end of file diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index 13fc5e691..b7271c4e2 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -16,7 +16,7 @@ // defining what exists in JSData and how it looks declare module JSData_ { - class JSDataPromise extends Promise { + interface JSDataPromise extends Promise { // enhanced with finally finally(finallyCb?:() => U):Promise; @@ -30,6 +30,10 @@ declare module JSData_ { // rather undocumented errors:DSErrors; + // those are objects containing the defined resources and adapters + definitions:any; + adapters:any; + defaults:DSConfiguration; changeHistory(resourceName:string, id?:string):Array; @@ -394,7 +398,8 @@ declare module JSData_ { // declaring the existing global js object declare var JSData:{ - DS: JSData_.DS + DS: JSData_.DS; + DSErrors: JSData_.DSErrors; }; //Support node require From 337a91729625ee481c5c1d526f54788bcc5ba6d4 Mon Sep 17 00:00:00 2001 From: Yuki KAN Date: Tue, 3 Mar 2015 07:03:28 +0900 Subject: [PATCH 18/78] add png-async definition --- png-async/png-async-tests.ts | 32 ++++++++++++++++++++ png-async/png-async.d.ts | 58 ++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 png-async/png-async-tests.ts create mode 100644 png-async/png-async.d.ts diff --git a/png-async/png-async-tests.ts b/png-async/png-async-tests.ts new file mode 100644 index 000000000..6523089a2 --- /dev/null +++ b/png-async/png-async-tests.ts @@ -0,0 +1,32 @@ +/// + +import fs = require('fs'); +import png = require('png-async'); + +var devnull = process.platform === 'win32' ? 'nul' : '/dev/null'; + +// stream test +var img = new png.Image({ + width: 1, + height: 1, + fill: true +}) + .pack() + .pipe(png.createImage({ + deflateStrategy: png.EDeflateStrategy.FIXED, + filterType: png.EFilterType.Auto + }) + .on('parsed', function () { + + if (this.data[0] !== 0) { + throw new Error('invalid data'); + } + + this.data[0] = 255; + this.data[3] = 255; + + this.pack().pipe(fs.createWriteStream(devnull)).on('finish', () => { + console.log('done'); + }); + }) + ); diff --git a/png-async/png-async.d.ts b/png-async/png-async.d.ts new file mode 100644 index 000000000..2898c4665 --- /dev/null +++ b/png-async/png-async.d.ts @@ -0,0 +1,58 @@ +// Type definitions for png-async +// Project: https://github.com/kanreisa/node-png-async +// Definitions by: Yuki KAN +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'png-async' { + import stream = require('stream'); + + export interface IImageOptions { + width?: number; + height?: number; + fill?: boolean; + checkCRC?: boolean; + deflateChunkSize?: number; + deflateLevel?: number; + deflateStrategy?: EDeflateStrategy; + filterType?: EFilterType; + } + + export enum EDeflateStrategy { + DEFAULT_STRATEGY = 0, + FILTERED = 1, + HUFFMAN_ONLY = 2, + RLE = 3, + FIXED = 4, + } + + export enum EFilterType { + Auto = -1, + None = 0, + Sub = 1, + Up = 2, + Average = 3, + Paeth = 4, + } + + export function createImage(option?: IImageOptions): Image; + + export class Image extends stream.Duplex { + width: number; + height: number; + gamma: number; + data: Buffer; + constructor(option?: IImageOptions); + pack(): Image; + parse(data: Buffer, callback?: (err: Error, image: Image) => void): Image; + write(data: any, cb?: any): boolean; + end(data?: any): void; + bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image; + + on(event: string, listener: Function): Image; + once(event: string, listener: Function): Image; + removeListener(event: string, listener: Function): Image; + removeAllListeners(event: string): Image; + } +} From ff82514eca5d50932c31a1e65afc4190b79553a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Mar 2015 08:36:11 +0100 Subject: [PATCH 19/78] Added the findIndex function to underscore.d.ts --- underscore/underscore.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index aeaf253ca..9f49bc47a 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -264,7 +264,22 @@ interface UnderscoreStatic { detect( object: _.Dictionary, iterator: _.ObjectIterator, - context?: any): T; + context?: any): T; + + /** + * Looks through each value in the list, returning the index of the first one that passes a truth + * test (iterator). The function returns as soon as it finds an acceptable element, + * and doesn't traverse the entire list. + * @param list Searches for a value in this list. + * @param iterator Search iterator function for each element in `list`. + * @param context `this` object in `iterator`, optional. + * @return The index of the first acceptable found element in `list`, if nothing is found -1 is returned. + **/ + findIndex( + list: _.List, + iterator: _.ListIterator, + context?: any): T; + /** * Looks through each value in the list, returning an array of all the values that pass a truth From 5bc218fa5c611f0e12a20b2a515ab3731e8a9e37 Mon Sep 17 00:00:00 2001 From: Marc-Andre Roy Date: Tue, 3 Mar 2015 09:30:07 -0500 Subject: [PATCH 20/78] Remove configure() definition in KnockoutValidationStatic since it's now deprecated. Use init() instead. --- knockout.validation/knockout.validation.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/knockout.validation/knockout.validation.d.ts b/knockout.validation/knockout.validation.d.ts index f0b956d03..3ce139a99 100644 --- a/knockout.validation/knockout.validation.d.ts +++ b/knockout.validation/knockout.validation.d.ts @@ -108,7 +108,6 @@ interface KnockoutValidationGroup { interface KnockoutValidationStatic { init(options?: KnockoutValidationConfiguration, force?: boolean): void; - configure(options: KnockoutValidationConfiguration): void; reset(): void; group(obj: any, options?: any): KnockoutValidationErrors; From c0c420cd6c77897e6d21de7f2e8ee4e78a37f4f0 Mon Sep 17 00:00:00 2001 From: Jonathan Park Date: Tue, 3 Mar 2015 11:15:49 -0800 Subject: [PATCH 21/78] hotkeys interface supports both string and string[] for combos --- angular-hotkeys/angular-hotkeys-tests.ts | 5 +++++ angular-hotkeys/angular-hotkeys.d.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/angular-hotkeys/angular-hotkeys-tests.ts b/angular-hotkeys/angular-hotkeys-tests.ts index a065d4b21..358410811 100644 --- a/angular-hotkeys/angular-hotkeys-tests.ts +++ b/angular-hotkeys/angular-hotkeys-tests.ts @@ -22,4 +22,9 @@ hotkeyProvider.bindTo(scope) description: 'blah blah', callback: function() {} }); + .add({ + combo: ['w', 'mod+w'], + description: 'blah blah', + callback: function() {} + }); diff --git a/angular-hotkeys/angular-hotkeys.d.ts b/angular-hotkeys/angular-hotkeys.d.ts index 63da273ce..83d5021cc 100644 --- a/angular-hotkeys/angular-hotkeys.d.ts +++ b/angular-hotkeys/angular-hotkeys.d.ts @@ -40,7 +40,7 @@ declare module ng.hotkeys { } interface Hotkey { - combo: string; + combo: string | string[]; description?: string; callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void; action?: string; From 07305d7e950b258d185e3484300d6353056d696b Mon Sep 17 00:00:00 2001 From: Jonathan Park Date: Tue, 3 Mar 2015 11:50:52 -0800 Subject: [PATCH 22/78] Extend to all interfaces --- angular-hotkeys/angular-hotkeys-tests.ts | 5 ++++- angular-hotkeys/angular-hotkeys.d.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/angular-hotkeys/angular-hotkeys-tests.ts b/angular-hotkeys/angular-hotkeys-tests.ts index 358410811..c683540a3 100644 --- a/angular-hotkeys/angular-hotkeys-tests.ts +++ b/angular-hotkeys/angular-hotkeys-tests.ts @@ -6,10 +6,13 @@ var hotkeyProvider: ng.hotkeys.HotkeysProvider; var hotkeyObj: ng.hotkeys.Hotkey; hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} ); +hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} ); hotkeyProvider.add(hotkeyObj); hotkeyProvider.bindTo(scope); hotkeyProvider.del("mod+s"); +hotkeyProvider.del(["mod+s"]); hotkeyProvider.get("mod+s"); +hotkeyProvider.get(["mod+s"]); hotkeyProvider.toggleCheatSheet(); hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback); @@ -21,7 +24,7 @@ hotkeyProvider.bindTo(scope) combo: 'w', description: 'blah blah', callback: function() {} - }); + }) .add({ combo: ['w', 'mod+w'], description: 'blah blah', diff --git a/angular-hotkeys/angular-hotkeys.d.ts b/angular-hotkeys/angular-hotkeys.d.ts index 83d5021cc..0c0b9109a 100644 --- a/angular-hotkeys/angular-hotkeys.d.ts +++ b/angular-hotkeys/angular-hotkeys.d.ts @@ -14,19 +14,19 @@ declare module ng.hotkeys { cheatSheetHotkey: string; cheatSheetDescription: string; - add(combo: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; + add(combo: string|string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; - add(combo: string, description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; + add(combo: string|string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array, persistent?: boolean): ng.hotkeys.Hotkey; add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey; bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProviderChained; - del(combo: string): void; + del(combo: string|string[]): void; del(hotkeyObj: ng.hotkeys.Hotkey): void; - get(combo: string): ng.hotkeys.Hotkey; + get(combo: string|string[]): ng.hotkeys.Hotkey; toggleCheatSheet(): void; @@ -34,13 +34,13 @@ declare module ng.hotkeys { } interface HotkeysProviderChained { - add(combo: string, description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained; + add(combo: string|string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained; add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained; } interface Hotkey { - combo: string | string[]; + combo: string|string[]; description?: string; callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void; action?: string; From a76035cfb80d12c5f9155bff95040c2d7e3ade31 Mon Sep 17 00:00:00 2001 From: Tim JK Date: Wed, 4 Mar 2015 10:09:03 +1300 Subject: [PATCH 23/78] Add type definitions for polyglot.js --- node-polyglot/node-polyglot-tests.ts | 47 ++++++++++++++++++++++++++++ node-polyglot/node-polyglot.d.ts | 42 +++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 node-polyglot/node-polyglot-tests.ts create mode 100644 node-polyglot/node-polyglot.d.ts diff --git a/node-polyglot/node-polyglot-tests.ts b/node-polyglot/node-polyglot-tests.ts new file mode 100644 index 000000000..fee07d79e --- /dev/null +++ b/node-polyglot/node-polyglot-tests.ts @@ -0,0 +1,47 @@ +import Polyglot = require("node-polyglot"); + +function instantiatePolyglot(): void { + var polyglot = new Polyglot(); + var phrasedPolyglot = new Polyglot({phrases: {"hello": "Hello"}}); + var localePolyglot = new Polyglot({locale: "fr"}); +} + +function translate(): void { + var polyglot = new Polyglot(); + + polyglot.extend({ + "hello": "Hello", + "hello_name": "Hola, %{name}.", + "nav": { + "sidebar": { + "welcome": "Welcome" + } + }, + "num_cars": "%{smart_count} car |||| %{smart_count} cars" + }); + + polyglot.t("hello"); + polyglot.t("hello_name"); + polyglot.t("nav.sidebar.welcome"); + polyglot.t("num_cars", {smart_count: 0}); + polyglot.t("num_cars", 0); + polyglot.t("hello_name", {name: "Spike"}); + polyglot.t("i_like_to_write_in_language", { + _: "I like to write in %{language}.", + language: "Javascript" + }); + + polyglot.replace({ + "hello": "hey", + "nav": { + "sidebar": { + "welcome": "Greetings" + } + } + }); + + polyglot.clear(); + + polyglot.locale("fr"); + polyglot.locale(); +} diff --git a/node-polyglot/node-polyglot.d.ts b/node-polyglot/node-polyglot.d.ts new file mode 100644 index 000000000..1b3469f02 --- /dev/null +++ b/node-polyglot/node-polyglot.d.ts @@ -0,0 +1,42 @@ +// Type definitions for node-polyglot v0.4.1 +// Project: https://github.com/airbnb/polyglot.js +// Definitions by: Tim Jackson-Kiely +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "node-polyglot" { + module Polyglot { + interface InterpolationOptions { + name?: string; + smart_count?: number; + _?: string; + } + + interface PolyglotOptions { + phrases?: any; + locale?: string; + } + } + + class Polyglot { + constructor(options?: Polyglot.PolyglotOptions); + + extend(phrases: any): void; + + t(phrase: string): string; + + t(phrase: string, smartCount: number): string; + + t(phrase: string, interpolationOptions: Polyglot.InterpolationOptions): string; + + clear(): void; + + replace(phrases: any): void; + + locale(): string; + + locale(locale: string): void; + } + + export = Polyglot; +} + From ac52e5a7324b98731d92717be24cd547a9f78e46 Mon Sep 17 00:00:00 2001 From: Tim Jackson-Kiely Date: Wed, 4 Mar 2015 10:40:18 +1300 Subject: [PATCH 24/78] Remove unnecessary name field --- node-polyglot/node-polyglot.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/node-polyglot/node-polyglot.d.ts b/node-polyglot/node-polyglot.d.ts index 1b3469f02..0f5bd8922 100644 --- a/node-polyglot/node-polyglot.d.ts +++ b/node-polyglot/node-polyglot.d.ts @@ -6,7 +6,6 @@ declare module "node-polyglot" { module Polyglot { interface InterpolationOptions { - name?: string; smart_count?: number; _?: string; } From d779349a3e4fffbc08608abafc788978ac492704 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Tue, 3 Mar 2015 15:50:12 -0700 Subject: [PATCH 25/78] Update angular.d.ts to fix IHttpPromise. IHttpPromise does not extend IPromise directly. It always transforms it with the response (of type T) as the `data` member. See $httpProvider.$http.sendRec.resolvePromise(response, status, headers, statusText). This matters when exploiting the inheritance to IPromise (for example in a return). --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 2f88253f0..217deacf5 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1262,7 +1262,7 @@ declare module ng { statusText?: string; } - interface IHttpPromise extends IPromise { + interface IHttpPromise extends IPromise> { success(callback: IHttpPromiseCallback): IHttpPromise; error(callback: IHttpPromiseCallback): IHttpPromise; then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise|TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; From 370cffb381ddc2003fbb9214c0cb086741c25a76 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Wed, 4 Mar 2015 13:49:13 +1300 Subject: [PATCH 26/78] Add definitions for methods to change the default rest client --- rest/rest-tests.ts | 14 ++++++++++++++ rest/rest.d.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/rest/rest-tests.ts b/rest/rest-tests.ts index 26346389f..6d267c792 100644 --- a/rest/rest-tests.ts +++ b/rest/rest-tests.ts @@ -135,3 +135,17 @@ client = rest .wrap(fail) .wrap(knownConfig, { prop: 'value' }) .wrap(transformedConfig, { prop: 'value' }); + +import xhrClient = require('rest/client/xhr'); +import nodeClient = require('rest/client/node'); +import jsonpClient = require('rest/client/jsonp'); +import xdrClient = require('rest/client/xdr'); + +rest.setDefaultClient(xhrClient); +rest.setDefaultClient(nodeClient); +rest.setDefaultClient(jsonpClient); +rest.setDefaultClient(xdrClient); + +var defaultClient: rest.Client = rest.getDefaultClient(); + +rest.resetDefaultClient(); diff --git a/rest/rest.d.ts b/rest/rest.d.ts index 37041e150..a96e0822a 100644 --- a/rest/rest.d.ts +++ b/rest/rest.d.ts @@ -14,6 +14,10 @@ declare module "rest" { function rest(request: rest.Request): rest.ResponsePromise; module rest { + export function setDefaultClient(client: Client): void; + export function getDefaultClient(): Client; + export function resetDefaultClient(): void; + export function wrap(interceptor: Interceptor, config?: T): Client; export interface Request { @@ -319,3 +323,27 @@ declare module "rest/mime/registry" { export = registry; } + +declare module "rest/client/xhr" { + import rest = require("rest"); + var xhr: rest.Client; + export = xhr; +} + +declare module "rest/client/node" { + import rest = require("rest"); + var node: rest.Client; + export = node; +} + +declare module "rest/client/jsonp" { + import rest = require("rest"); + var jsonp: rest.Client; + export = jsonp; +} + +declare module "rest/client/xdr" { + import rest = require("rest"); + var xdr: rest.Client; + export = xdr; +} From 4837e53d25ed093aed6a5cf3120934f8ce0b9590 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 03:56:11 +0000 Subject: [PATCH 27/78] Add definitions and tests for gulp-concat --- gulp-concat/gulp-concat-tests.ts | 23 +++++++++++++++++ gulp-concat/gulp-concat.d.ts | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 gulp-concat/gulp-concat-tests.ts create mode 100644 gulp-concat/gulp-concat.d.ts diff --git a/gulp-concat/gulp-concat-tests.ts b/gulp-concat/gulp-concat-tests.ts new file mode 100644 index 000000000..a2a475b97 --- /dev/null +++ b/gulp-concat/gulp-concat-tests.ts @@ -0,0 +1,23 @@ +/// +/// + +import gulp = require("gulp"); +import concat = require("gulp-concat"); + +gulp.task("concat:simple", () => { + gulp.src(["file*.txt"]) + .pipe(concat("file.txt")) + .pipe(gulp.dest("build")); +}); + +gulp.task("concat:newLine", () => { + gulp.src(["file*.txt"]) + .pipe(concat("file.txt", { newLine: ";" })) + .pipe(gulp.dest("build")); +}); + +gulp.task("concat:vinyl", () => { + gulp.src(["file*.txt"]) + .pipe(concat({ path: "file.txt", stat: { mode: 0666 } })) + .pipe(gulp.dest("build")); +}); diff --git a/gulp-concat/gulp-concat.d.ts b/gulp-concat/gulp-concat.d.ts new file mode 100644 index 000000000..cad21c303 --- /dev/null +++ b/gulp-concat/gulp-concat.d.ts @@ -0,0 +1,42 @@ +// Type definitions for gulp-concat +// Project: http://github.com/wearefractal/gulp-concat +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-concat" { + + interface IOptions { + newLine: string; + } + + interface IFsStats { + dev?: number; + ino?: number; + mode?: number; + nlink?: number; + uid?: number; + gid?: number; + rdev?: number; + size?: number; + blksize?: number; + blocks?: number; + atime?: Date; + mtime?: Date; + ctime?: Date; + } + + interface IVinylOptions { + cwd?: string; + base?: string; + path?: string; + stat?: IFsStats; + contents?: NodeJS.ReadableStream | Buffer; + } + + function concat(filename: string, options?: IOptions): NodeJS.ReadWriteStream; + function concat(options: IVinylOptions): NodeJS.ReadWriteStream; + + export = concat; +} From 8c5f9860a49defcaad100aed4c599e57b404f8aa Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 04:40:03 +0000 Subject: [PATCH 28/78] Add definitions and tests for gulp-flatten --- gulp-flatten/gulp-flatten-tests.ts | 17 +++++++++++++++++ gulp-flatten/gulp-flatten.d.ts | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 gulp-flatten/gulp-flatten-tests.ts create mode 100644 gulp-flatten/gulp-flatten.d.ts diff --git a/gulp-flatten/gulp-flatten-tests.ts b/gulp-flatten/gulp-flatten-tests.ts new file mode 100644 index 000000000..ee5622564 --- /dev/null +++ b/gulp-flatten/gulp-flatten-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import gulp = require("gulp"); +import flatten = require("gulp-flatten"); + +gulp.task("flatten:simple", () => { + gulp.src(["files/**/*.txt"]) + .pipe(flatten()) + .pipe(gulp.dest("build")); +}); + +gulp.task("flatten:newPath", () => { + gulp.src(["files/**/*.txt"]) + .pipe(flatten({ newPath: "new/path" })) + .pipe(gulp.dest("build")); +}); diff --git a/gulp-flatten/gulp-flatten.d.ts b/gulp-flatten/gulp-flatten.d.ts new file mode 100644 index 000000000..ccd9cedf1 --- /dev/null +++ b/gulp-flatten/gulp-flatten.d.ts @@ -0,0 +1,17 @@ +// Type definitions for gulp-flatten +// Project: https://github.com/armed/gulp-flatten +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-flatten" { + + interface IOptions { + newPath: string; + } + + function flatten(options?: IOptions): NodeJS.ReadWriteStream; + + export = flatten; +} From 3613a5f06a168bb83b9a4f0b2c1df02c5a3ab038 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 04:59:29 +0000 Subject: [PATCH 29/78] Add definitions and tests for gulp-inject --- gulp-inject/gulp-inject-tests.ts | 41 ++++++++++++++++++++++++++++++++ gulp-inject/gulp-inject.d.ts | 36 ++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 gulp-inject/gulp-inject-tests.ts create mode 100644 gulp-inject/gulp-inject.d.ts diff --git a/gulp-inject/gulp-inject-tests.ts b/gulp-inject/gulp-inject-tests.ts new file mode 100644 index 000000000..804e6f9b5 --- /dev/null +++ b/gulp-inject/gulp-inject-tests.ts @@ -0,0 +1,41 @@ +/// +/// + +import gulp = require("gulp"); +import inject = require("gulp-inject"); + +gulp.task("inject:simple", () => { + gulp.src("src/index.html") + .pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }))) + .pipe(gulp.dest("build")); +}); + +gulp.task("inject:relative", () => { + gulp.src(["src/index.html"]) + .pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { relative: true })) + .pipe(gulp.dest("build")); +}); + +gulp.task("inject:starttag", () => { + gulp.src(["src/index.html"]) + .pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { starttag: "" })) + .pipe(gulp.dest("build")); +}); + +gulp.task("inject:name", () => { + gulp.src(["src/index.html"]) + .pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { name: "head" })) + .pipe(gulp.dest("build")); +}); + +gulp.task("inject:transform", () => { + gulp.src(["files.json"]) + .pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css", "src/**/*.html"], { read: false }), { + starttag: "\"{{ext}}\": [", + endtag: "]", + transform: (filepath, file, i, length) => { + return " \"" + filepath + "\"" + (i + 1 < length ? "," : ""); + } + })) + .pipe(gulp.dest("build")); +}); diff --git a/gulp-inject/gulp-inject.d.ts b/gulp-inject/gulp-inject.d.ts new file mode 100644 index 000000000..42f5fb348 --- /dev/null +++ b/gulp-inject/gulp-inject.d.ts @@ -0,0 +1,36 @@ +// Type definitions for gulp-inject +// Project: https://github.com/klei/gulp-inject +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "gulp-inject" { + + import File = require("vinyl"); + + interface ITagFunction { + (targetExt: string, sourceExt: string): string; + } + + interface ITransformFunction { + (filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string; + } + + interface IOptions { + ignorePath?: string | string[]; + relative?: boolean; + addPrefix?: string; + addRootSlash?: boolean; + name?: string; + starttag?: string | ITagFunction; + endtag?: string | ITagFunction; + transform?: ITransformFunction; + selfClosingTag?: boolean; + } + + function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream; + + export = inject; +} From 4c11c0079c1c28c6dee540914b8b220172b98ef7 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 05:28:53 +0000 Subject: [PATCH 30/78] Add definitions and tests for gulp-less --- gulp-less/gulp-less-tests.ts | 13 +++++++++++++ gulp-less/gulp-less.d.ts | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 gulp-less/gulp-less-tests.ts create mode 100644 gulp-less/gulp-less.d.ts diff --git a/gulp-less/gulp-less-tests.ts b/gulp-less/gulp-less-tests.ts new file mode 100644 index 000000000..76e0a697c --- /dev/null +++ b/gulp-less/gulp-less-tests.ts @@ -0,0 +1,13 @@ +/// +/// + +import gulp = require("gulp"); +import less = require("gulp-less"); + +gulp.task("less", () => { + gulp.src("less/**/*.less") + .pipe(less({ + paths: ["less/includes"] + })) + .pipe(gulp.dest("public/css")); +}); diff --git a/gulp-less/gulp-less.d.ts b/gulp-less/gulp-less.d.ts new file mode 100644 index 000000000..9ca5e35b7 --- /dev/null +++ b/gulp-less/gulp-less.d.ts @@ -0,0 +1,18 @@ +// Type definitions for gulp-less +// Project: https://github.com/plus3network/gulp-less +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-less" { + + interface IOptions { + paths: string[]; + plugins?: any[]; + } + + function less(options?: IOptions): NodeJS.ReadWriteStream; + + export = less; +} From ab697a6bbdedefc89af863b16e35c51eb57dbafa Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 06:15:45 +0000 Subject: [PATCH 31/78] Add definitions and tests for gulp-minify-css --- gulp-minify-css/gulp-minify-css-tests.ts | 11 +++++++++ gulp-minify-css/gulp-minify-css.d.ts | 31 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 gulp-minify-css/gulp-minify-css-tests.ts create mode 100644 gulp-minify-css/gulp-minify-css.d.ts diff --git a/gulp-minify-css/gulp-minify-css-tests.ts b/gulp-minify-css/gulp-minify-css-tests.ts new file mode 100644 index 000000000..1375042dd --- /dev/null +++ b/gulp-minify-css/gulp-minify-css-tests.ts @@ -0,0 +1,11 @@ +/// +/// + +import gulp = require("gulp"); +import minifyCSS = require("gulp-minify-css"); + +gulp.task("minify-css", () => { + gulp.src("css/**/*.css") + .pipe(minifyCSS({ keepBreaks: true })) + .pipe(gulp.dest("dist")); +}); diff --git a/gulp-minify-css/gulp-minify-css.d.ts b/gulp-minify-css/gulp-minify-css.d.ts new file mode 100644 index 000000000..be6d45b8b --- /dev/null +++ b/gulp-minify-css/gulp-minify-css.d.ts @@ -0,0 +1,31 @@ +// Type definitions for gulp-minify-css +// Project: https://github.com/jonathanepollack/gulp-minify-css +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-minify-css" { + + interface IOptions { + cache?: boolean; + advanced?: boolean; + aggressiveMerging?: boolean; + benchmark?: boolean; + compatibility?: string; + debug?: boolean; + inliner?: Object; + keepBreaks?: boolean; + keepSpecialComments?: string | number; + processImport?: boolean; + rebase?: boolean; + relativeTo?: string; + root?: string; + roundingPrecision?: number; + shorthandCompacting?: boolean; + } + + function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream; + + export = minifyCSS; +} From 3492e30a639f3e079dc31bdd4077e4033b67065f Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 06:25:34 +0000 Subject: [PATCH 32/78] Add definitions and tests for gulp-tsd --- gulp-tsd/gulp-tsd-tests.ts | 17 +++++++++++++++++ gulp-tsd/gulp-tsd.d.ts | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 gulp-tsd/gulp-tsd-tests.ts create mode 100644 gulp-tsd/gulp-tsd.d.ts diff --git a/gulp-tsd/gulp-tsd-tests.ts b/gulp-tsd/gulp-tsd-tests.ts new file mode 100644 index 000000000..9475ace65 --- /dev/null +++ b/gulp-tsd/gulp-tsd-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +import gulp = require("gulp"); +import tsd = require("gulp-tsd"); + +gulp.task("tsd", () => { + gulp.src("gulp_tsd.json") + .pipe(tsd()); +}); + +gulp.task("tsd:options", callback => { + tsd({ + command: "reinstall", + config: "tsd.json" + }, callback); +}); diff --git a/gulp-tsd/gulp-tsd.d.ts b/gulp-tsd/gulp-tsd.d.ts new file mode 100644 index 000000000..68a4c6728 --- /dev/null +++ b/gulp-tsd/gulp-tsd.d.ts @@ -0,0 +1,21 @@ +// Type definitions for gulp-tsd +// Project: https://github.com/moznion/gulp-tsd +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "gulp-tsd" { + + interface IOptions { + command?: string; + latest?: boolean; + config?: string; + opts?: Object; + } + + function tsd(opts?: IOptions, callback?: gulp.ITaskCallback): NodeJS.ReadWriteStream; + + export = tsd; +} From 5bff44a0592dc2de161477d22ff9c2f31105ca81 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 06:46:32 +0000 Subject: [PATCH 33/78] Add definitions and tests for main-bower-files --- main-bower-files/main-bower-files-tests.ts | 31 ++++++++++++++++++++ main-bower-files/main-bower-files.d.ts | 34 ++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 main-bower-files/main-bower-files-tests.ts create mode 100644 main-bower-files/main-bower-files.d.ts diff --git a/main-bower-files/main-bower-files-tests.ts b/main-bower-files/main-bower-files-tests.ts new file mode 100644 index 000000000..1658b3800 --- /dev/null +++ b/main-bower-files/main-bower-files-tests.ts @@ -0,0 +1,31 @@ +/// +/// + +import gulp = require("gulp"); +import mainBowerFiles = require("main-bower-files"); + +gulp.task("main-bower-files:simple", () => { + gulp.src(mainBowerFiles()) + .pipe(gulp.dest("dist/bower")); +}); + +gulp.task("main-bower-files:options", () => { + var files = mainBowerFiles({ + debugging: false, + env: process.env.NODE_ENV, + paths: { + bowerDirectory: "path/for/bower_components", + bowerrc: "path/for/.bowerrc", + bowerJson: "path/for/bower.json" + }, + checkExistence: false, + includeDev: false, + includeSelf: false, + filter: (filepath) => { + return filepath.indexOf("search") >= 0; + } + }); + + gulp.src(files, { base: "path/to/bower_components" }) + .pipe(gulp.dest("dist/bower")); +}); diff --git a/main-bower-files/main-bower-files.d.ts b/main-bower-files/main-bower-files.d.ts new file mode 100644 index 000000000..80a4996db --- /dev/null +++ b/main-bower-files/main-bower-files.d.ts @@ -0,0 +1,34 @@ +// Type definitions for main-bower-files +// Project: https://github.com/ck86/main-bower-files +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "main-bower-files" { + + interface IPaths { + bowerDirectory?: string; + bowerrc?: string; + bowerJson?: string; + } + + interface IFilterFunction { + (filepath: string): boolean; + } + + interface IOptions { + debugging?: boolean; + main?: string | string[] | Object; + env?: string; + paths?: IPaths | string; + checkExistence?: boolean; + includeDev?: boolean | string; + includeSelf?: boolean; + filter?: RegExp | IFilterFunction | string | string[]; + } + + function mainBowerFiles(options?: IOptions): string[]; + + export = mainBowerFiles; +} From dc2c61c4b295d88befeba7fa542582d0e8ec85dc Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 07:21:08 +0000 Subject: [PATCH 34/78] Add definitions and tests for merge-stream --- merge-stream/merge-stream-tests.ts | 13 +++++++++++++ merge-stream/merge-stream.d.ts | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 merge-stream/merge-stream-tests.ts create mode 100644 merge-stream/merge-stream.d.ts diff --git a/merge-stream/merge-stream-tests.ts b/merge-stream/merge-stream-tests.ts new file mode 100644 index 000000000..e0c744953 --- /dev/null +++ b/merge-stream/merge-stream-tests.ts @@ -0,0 +1,13 @@ +/// + +import stream = require("stream"); +import Stream = stream.Readable; +import merge = require("merge-stream"); + +var stream1 = new Stream(); +var stream2 = new Stream(); + +var merged = merge(stream1, stream2); + +var stream3 = new Stream(); +merged.add(stream3); diff --git a/merge-stream/merge-stream.d.ts b/merge-stream/merge-stream.d.ts new file mode 100644 index 000000000..6dfffdb95 --- /dev/null +++ b/merge-stream/merge-stream.d.ts @@ -0,0 +1,16 @@ +// Type definitions for merge-stream +// Project: https://github.com/grncdr/merge-stream +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "merge-stream" { + + interface IMergedStream extends NodeJS.ReadWriteStream { + add: (source: NodeJS.ReadableStream) => IMergedStream; + } + + function merge(...streams: T[]): IMergedStream; + export = merge; +} From 0e40e8a1a4b150bd08cac4c0587e4fde709b6092 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 07:43:52 +0000 Subject: [PATCH 35/78] Add definitions and tests for run-sequence --- run-sequence/run-sequence-tests.ts | 33 ++++++++++++++++++++++++++++++ run-sequence/run-sequence.d.ts | 19 +++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 run-sequence/run-sequence-tests.ts create mode 100644 run-sequence/run-sequence.d.ts diff --git a/run-sequence/run-sequence-tests.ts b/run-sequence/run-sequence-tests.ts new file mode 100644 index 000000000..98e57d9f3 --- /dev/null +++ b/run-sequence/run-sequence-tests.ts @@ -0,0 +1,33 @@ +/// +/// + +import gulp = require("gulp"); +import tmp = require("run-sequence"); +var runSequence = tmp.use(gulp); + +gulp.task("run-sequence", callback => { + runSequence("task1", + ["task2", "task3"], + "taks4", + callback); +}); + +gulp.task("task1", () => { + gulp.src("file1.txt") + .pipe(gulp.dest("build")); +}); + +gulp.task("task2", () => { + gulp.src("file2.txt") + .pipe(gulp.dest("build")); +}); + +gulp.task("task3", () => { + gulp.src("file3.txt") + .pipe(gulp.dest("build")); +}); + +gulp.task("task4", () => { + gulp.src("file4.txt") + .pipe(gulp.dest("build")); +}); diff --git a/run-sequence/run-sequence.d.ts b/run-sequence/run-sequence.d.ts new file mode 100644 index 000000000..3a2cb449c --- /dev/null +++ b/run-sequence/run-sequence.d.ts @@ -0,0 +1,19 @@ +// Type definitions for run-sequence +// Project: https://github.com/OverZealous/run-sequence +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "run-sequence" { + + interface IRunSequence { + (...streams: (string | string[] | gulp.ITaskCallback)[]): NodeJS.ReadWriteStream; + + use(gulp: gulp.Gulp): IRunSequence; + } + + var _tmp: IRunSequence; + export = _tmp; +} From 729356c657f45bef570286595a22ee4ea4e02fd9 Mon Sep 17 00:00:00 2001 From: Keita Kagurazaka Date: Wed, 4 Mar 2015 07:56:14 +0000 Subject: [PATCH 36/78] Add definitions and tests for stream-series --- stream-series/stream-series-tests.ts | 12 ++++++++++++ stream-series/stream-series.d.ts | 11 +++++++++++ 2 files changed, 23 insertions(+) create mode 100644 stream-series/stream-series-tests.ts create mode 100644 stream-series/stream-series.d.ts diff --git a/stream-series/stream-series-tests.ts b/stream-series/stream-series-tests.ts new file mode 100644 index 000000000..2ed31ffb1 --- /dev/null +++ b/stream-series/stream-series-tests.ts @@ -0,0 +1,12 @@ +/// + +import stream = require("stream"); +import Stream = stream.Duplex; +import series = require("stream-series"); + +var stream1 = new Stream(); +var stream2 = new Stream(); +var stream3 = new Stream(); + +var orderedStream = series(stream1, stream3, stream2); +console.log(orderedStream.toString()); diff --git a/stream-series/stream-series.d.ts b/stream-series/stream-series.d.ts new file mode 100644 index 000000000..6c2d07d78 --- /dev/null +++ b/stream-series/stream-series.d.ts @@ -0,0 +1,11 @@ +// Type definitions for stream-series +// Project: https://github.com/rschmukler/stream-series +// Definitions by: Keita Kagurazaka +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "stream-series" { + function series(...streams: T[]): NodeJS.ReadWriteStream; + export = series; +} From 5f2cc5b96612afdc1583f3171c6cf4038d7368ba Mon Sep 17 00:00:00 2001 From: reppners Date: Wed, 4 Mar 2015 09:09:27 +0100 Subject: [PATCH 37/78] + renaming module JSData_ to JSData since it is possible to declare var and module with the same name --- js-data-angular/js-data-angular-tests.ts | 8 ++--- js-data-angular/js-data-angular.d.ts | 2 +- js-data-http/js-data-http-tests.ts | 4 +-- js-data-http/js-data-http.d.ts | 4 +-- js-data/js-data-tests.ts | 38 ++++++++++++------------ js-data/js-data.d.ts | 6 ++-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/js-data-angular/js-data-angular-tests.ts b/js-data-angular/js-data-angular-tests.ts index 670857dec..8e036212f 100644 --- a/js-data-angular/js-data-angular-tests.ts +++ b/js-data-angular/js-data-angular-tests.ts @@ -12,7 +12,7 @@ interface CustomScope extends ng.IScope { } angular.module('myApp') - .controller('commentsCtrl', function ($scope:CustomScope, store:JSData_.DS, Comment:JSData_.DSResourceDefinition, User:JSData_.DSResourceDefinition) { + .controller('commentsCtrl', function ($scope:CustomScope, store:JSData.DS, Comment:JSData.DSResourceDefinition, User:JSData.DSResourceDefinition) { Comment.findAll().then(function (comments) { $scope.comments = comments; @@ -54,7 +54,7 @@ angular.module('myApp') }); angular.module('myApp') - .run(function (DS:JSData_.DS) { + .run(function (DS:JSData.DS) { // We don't register the "User" resource // as a service, so it can only be used // via DS.('user', ...) @@ -63,7 +63,7 @@ angular.module('myApp') // only ever have to inject "DS" DS.defineResource('user'); }) - .factory('Comment', function (DS:JSData_.DS) { + .factory('Comment', function (DS:JSData.DS) { // This code won't execute unless you actually // inject "Comment" somewhere in your code. // Thanks Angular... @@ -73,6 +73,6 @@ angular.module('myApp') }); angular.module('myApp') - .config(function (DSProvider:JSData_.DSProvider) { + .config(function (DSProvider:JSData.DSProvider) { DSProvider.defaults.basePath = '/myApi'; // etc. }); \ No newline at end of file diff --git a/js-data-angular/js-data-angular.d.ts b/js-data-angular/js-data-angular.d.ts index 851512d15..11a295562 100644 --- a/js-data-angular/js-data-angular.d.ts +++ b/js-data-angular/js-data-angular.d.ts @@ -6,7 +6,7 @@ /// /// -declare module JSData_ { +declare module JSData { interface DSProvider { defaults:DSConfiguration; diff --git a/js-data-http/js-data-http-tests.ts b/js-data-http/js-data-http-tests.ts index 41459ed81..d7c07d654 100644 --- a/js-data-http/js-data-http-tests.ts +++ b/js-data-http/js-data-http-tests.ts @@ -4,7 +4,7 @@ var adapter = new DSHttpAdapter(); var store = new JSData.DS(); store.registerAdapter('http', adapter, { default: true }); -var ADocument:JSData_.DSResourceDefinition = store.defineResource('document'); +var ADocument:JSData.DSResourceDefinition = store.defineResource('document'); ADocument.inject({ id: 5, author: 'John' }); @@ -73,7 +73,7 @@ adapter.GET('/user/1').then(function (data) { data.config; //{...} }); -var User:JSData_.DSResourceDefinition = store.defineResource('user'); +var User:JSData.DSResourceDefinition = store.defineResource('user'); var params:any = { age: { diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts index 3a8a8adf0..626f55648 100644 --- a/js-data-http/js-data-http.d.ts +++ b/js-data-http/js-data-http.d.ts @@ -5,7 +5,7 @@ /// -declare module JSData_ { +declare module JSData { interface DSHttpAdapterOptions { serialize?: (resourceName:string, data:any)=>any; @@ -43,4 +43,4 @@ declare module JSData_ { } } -declare var DSHttpAdapter:JSData_.DSHttpAdapter; \ No newline at end of file +declare var DSHttpAdapter:JSData.DSHttpAdapter; \ No newline at end of file diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts index a6ac09a42..35fdbf00f 100644 --- a/js-data/js-data-tests.ts +++ b/js-data/js-data-tests.ts @@ -127,7 +127,7 @@ interface IComment { profile?: any; } -var aComment:JSData_.DSResourceDefinition = store.defineResource('comment'); +var aComment:JSData.DSResourceDefinition = store.defineResource('comment'); // Get all comments where comment.userId == 5 aComment.filter({ @@ -276,7 +276,7 @@ interface IPost { } -var Post:JSData_.DSResourceDefinition; +var Post:JSData.DSResourceDefinition; // Grab the first "page" of posts Post.filter({ @@ -426,7 +426,7 @@ User.create({name: 'John'}, { module CustomAdapterTest { - class MyCustomAdapter implements JSData_.IDSAdapter { + class MyCustomAdapter implements JSData.IDSAdapter { // All of the methods shown here must return a promise @@ -437,52 +437,52 @@ module CustomAdapterTest { // was passed into the DS method that is calling // the adapter method - create(definition:JSData_.DSResourceDefinition, attrs:Object, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + create(definition:JSData.DSResourceDefinition, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must resolve the promise with the created item - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } - find(definition:JSData_.DSResourceDefinition, id:any, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + find(definition:JSData.DSResourceDefinition, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must resolve the promise with the found item - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } - findAll(definition:JSData_.DSResourceDefinition, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + findAll(definition:JSData.DSResourceDefinition, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must resolve the promise with the found items - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } - update(definition:JSData_.DSResourceDefinition, id:any, attrs:Object, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + update(definition:JSData.DSResourceDefinition, id:any, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must resolve the promise with the updated items - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } - updateAll(definition:JSData_.DSResourceDefinition, attrs:Object, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + updateAll(definition:JSData.DSResourceDefinition, attrs:Object, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must resolve the promise with the updated items - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } - destroy(definition:JSData_.DSResourceDefinition, id:any, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + destroy(definition:JSData.DSResourceDefinition, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must return a promise - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } - destroyAll(definition:JSData_.DSResourceDefinition, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise { + destroyAll(definition:JSData.DSResourceDefinition, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise { // Must return a promise - var promise:JSData_.JSDataPromise; + var promise:JSData.JSDataPromise; return promise; } } @@ -500,14 +500,14 @@ module CustomAdapterTest { interface MyCustomDataStore { - myResource: JSData_.DSResourceDefinition + myResource: JSData.DSResourceDefinition } interface MyResourceDefinition { } -module JSData_ { +module JSData { interface DS { diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index b7271c4e2..cf74b6b79 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -14,7 +14,7 @@ /////////////////////////////////////////////////////////////////////////////// // defining what exists in JSData and how it looks -declare module JSData_ { +declare module JSData { interface JSDataPromise extends Promise { @@ -398,8 +398,8 @@ declare module JSData_ { // declaring the existing global js object declare var JSData:{ - DS: JSData_.DS; - DSErrors: JSData_.DSErrors; + DS: JSData.DS; + DSErrors: JSData.DSErrors; }; //Support node require From 369935805c148d1d640fc483d41bed0fb2e38dee Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Wed, 4 Mar 2015 13:57:57 +0100 Subject: [PATCH 38/78] Add http.Agent to node.js typings --- node/node-0.10.d.ts | 37 ++++++++++++++++++++++++++++++++++++- node/node-tests.ts | 9 +++++++++ node/node.d.ts | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/node/node-0.10.d.ts b/node/node-0.10.d.ts index 99ab5eccd..28f0a3bc5 100644 --- a/node/node-0.10.d.ts +++ b/node/node-0.10.d.ts @@ -349,7 +349,42 @@ declare module "http" { pause(): void; resume(): void; } - export interface Agent { maxSockets: number; sockets: any; requests: any; } + + export interface AgentOptions { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number; + } + + export class Agent { + maxSockets: number; + sockets: any; + requests: any; + + constructor(opts?: AgentOptions); + + /** + * Destroy any sockets that are currently in use by the agent. + * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, + * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, + * sockets may hang open for quite a long time before the server terminates them. + */ + destroy(): void; + } export var STATUS_CODES: { [errorCode: number]: string; diff --git a/node/node-tests.ts b/node/node-tests.ts index f2702ec4a..b50e01f27 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -154,6 +154,15 @@ module http_tests { var code = 100; var codeMessage = http.STATUS_CODES['400']; var codeMessage = http.STATUS_CODES[400]; + + var agent: http.Agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: 10000, + maxSockets: Infinity, + maxFreeSockets: 256 + }); + + var agent: http.Agent = http.globalAgent; } //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index deae056a1..222963715 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -349,7 +349,42 @@ declare module "http" { pause(): void; resume(): void; } - export interface Agent { maxSockets: number; sockets: any; requests: any; } + + export interface AgentOptions { + /** + * Keep sockets around in a pool to be used by other requests in the future. Default = false + */ + keepAlive?: boolean; + /** + * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. + * Only relevant if keepAlive is set to true. + */ + keepAliveMsecs?: number; + /** + * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity + */ + maxSockets?: number; + /** + * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. + */ + maxFreeSockets?: number; + } + + export class Agent { + maxSockets: number; + sockets: any; + requests: any; + + constructor(opts?: AgentOptions); + + /** + * Destroy any sockets that are currently in use by the agent. + * It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled, + * then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise, + * sockets may hang open for quite a long time before the server terminates them. + */ + destroy(): void; + } export var STATUS_CODES: { [errorCode: number]: string; From ea43bdc3d3be5eef770a30bcc5575c5dbdd157f8 Mon Sep 17 00:00:00 2001 From: Wim Looman Date: Thu, 5 Mar 2015 11:28:00 +1300 Subject: [PATCH 39/78] Add more overloads of knockout-transformations map Not yet documented (see One-com/knockout-transformations#5), derived by studying the code (https://github.com/One-com/knockout-transformations/blob/master/lib/map.js) --- .../knockout-transformations-tests.ts | 43 +++++++++++++++++++ .../knockout-transformations.d.ts | 21 ++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/knockout-transformations/knockout-transformations-tests.ts b/knockout-transformations/knockout-transformations-tests.ts index 6b15b3ca0..5f132858c 100644 --- a/knockout-transformations/knockout-transformations-tests.ts +++ b/knockout-transformations/knockout-transformations-tests.ts @@ -161,3 +161,46 @@ var indexedTexts: KnockoutObservable<{ [suffixOrPrefix: string]: string[] }> = t // z: ['baz'], // x: ['qux', 'quux'] // } + + +(() => { + var sourceItems: KnockoutObservableArray = ko.observableArray([1, 2, 3, 4, 5]); + var asString: KnockoutObservableArray; + + asString = sourceItems.map((x: number) => x.toString()); + + asString = sourceItems.map({ + mapping: (x: number) => x.toString(), + }); + + asString = sourceItems.map({ + mapping: (x: number) => x.toString(), + disposeItem: (x: string) => console.log('disposing map to', x), + }); + + asString = sourceItems.map({ + mappingWithDisposeCallback: (x: number) => ({ + mappedValue: x.toString(), + dispose: () => console.log('disposing map from', x), + }), + }); + + asString = sourceItems.map(x => x.toString()); + + asString = sourceItems.map({ + mapping: x => x.toString(), + }); + + asString = sourceItems.map({ + mapping: x => x.toString(), + disposeItem: x => console.log('disposing map to', x), + }); + + asString = sourceItems.map({ + mappingWithDisposeCallback: x => ({ + mappedValue: x.toString(), + dispose: () => console.log('disposing map from', x), + }), + }); + +}); diff --git a/knockout-transformations/knockout-transformations.d.ts b/knockout-transformations/knockout-transformations.d.ts index b599c7d69..3048e7a0f 100644 --- a/knockout-transformations/knockout-transformations.d.ts +++ b/knockout-transformations/knockout-transformations.d.ts @@ -5,8 +5,27 @@ /// +declare module KnockoutTransformations { + interface Mapping { + (value: T): TResult; + } + interface MappingOption { + mapping: Mapping; + disposeItem?: (item: TResult) => void; + } + interface MappingWithDisposeCallbackOption { + mappingWithDisposeCallback: (value: T) => { + mappedValue: TResult; + dispose: () => void; + }; + } +} + interface KnockoutObservableArrayFunctions { - map(mapping: (value: T) => TResult): KnockoutObservableArray; + map(mapping: KnockoutTransformations.Mapping): KnockoutObservableArray; + map(mapping: KnockoutTransformations.MappingOption): KnockoutObservableArray; + map(mapping: KnockoutTransformations.MappingWithDisposeCallbackOption): KnockoutObservableArray; + filter(predicate: (value: T) => boolean): KnockoutObservableArray; sortBy(sorter: (value: T, descending: (sorter: any) => any) => any): KnockoutObservableArray; indexBy(indexer: (value: T) => string): KnockoutObservable<{ [index: string]: T[] }>; From 7ad1b21fe960f755ba8ee11c25d053e65fe40510 Mon Sep 17 00:00:00 2001 From: Patrick Desjardins Date: Wed, 4 Mar 2015 14:30:19 -0800 Subject: [PATCH 40/78] Remove the need of not necessary Html Element The current situation force the user to have a not necessary creation of an HtmlElement object. In fact, you do not need. JQuery Gridster has a plugin that take a single parameter which is the option. This is why that Pull Request fix this issue but also the issue that when debugging the unit test you can see that the injected options were the HtmlElement instead of the real options. --- jquery.gridster/gridster-tests.ts | 4 +--- jquery.gridster/gridster.d.ts | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/jquery.gridster/gridster-tests.ts b/jquery.gridster/gridster-tests.ts index 1521b205d..72c90a6f0 100644 --- a/jquery.gridster/gridster-tests.ts +++ b/jquery.gridster/gridster-tests.ts @@ -1,7 +1,5 @@ /// -var el: HTMLElement = new HTMLElement(); - interface SerializeData { x?: number; y?: number; @@ -18,7 +16,7 @@ var options: GridsterOptions = { } }; -var gridster = $('.gridster ul').gridster(el, options).data('grister'); +var gridster = $('.gridster ul').gridster(options).data('grister'); gridster.add_widget('
  • The HTML of the widget...
  • ', 2, 1); gridster.remove_widget($('gridster li').eq(3).get(0)); var json = gridster.serialize(); diff --git a/jquery.gridster/gridster.d.ts b/jquery.gridster/gridster.d.ts index b293dcb2f..53f26704e 100644 --- a/jquery.gridster/gridster.d.ts +++ b/jquery.gridster/gridster.d.ts @@ -160,11 +160,10 @@ interface JQuery { /** * Gridster - * @param el The HTMLElement that contains all the widgets. * @param options An object with all the gridster options you want to overwrite. * @return Gridster jQuery instance. **/ - gridster(el: HTMLElement, options?: GridsterOptions): JQuery; + gridster(options?: GridsterOptions): JQuery; } interface Gridster { From 68ae7bb60d3c1ef6dc1c458ffa0bcfda8d50240c Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Wed, 4 Mar 2015 20:56:23 -0500 Subject: [PATCH 41/78] Add tether typings --- tether/tether-tests.ts | 53 ++++++++++++++++++++++++++++++++++++++++++ tether/tether.d.ts | 50 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 tether/tether-tests.ts create mode 100644 tether/tether.d.ts diff --git a/tether/tether-tests.ts b/tether/tether-tests.ts new file mode 100644 index 000000000..4d3295b50 --- /dev/null +++ b/tether/tether-tests.ts @@ -0,0 +1,53 @@ +/// +/// + +var yellowBox = document.querySelector(".yellow"); +var greenBox = document.querySelector(".green"); + +new Tether({ + attachment: "bottom middle", + targetAttachment: "top middle", + targetModifier: "visible", + offset: "-15px 0", + targetOffset: "0 0" +}); + +new Tether({ + element: yellowBox, + target: greenBox, + attachment: "top left", + optimizations: { + gpu: false + } +}); + +new Tether({ + element: yellowBox, + target: greenBox, + attachment: "top left", + targetAttachment: "bottom left", + constraints: [ + { + to: "scrollParent", + pin: true + }, + { + to: "window", + attachment: "together" + } + ] +}); + +new Tether({ + element: yellowBox, + target: greenBox, + attachment: "middle left", + targetAttachment: "middle left", + constraints: [ + { + to: "scrollParent", + pin: ["top"] + } + ] +}); + diff --git a/tether/tether.d.ts b/tether/tether.d.ts new file mode 100644 index 000000000..be1200f28 --- /dev/null +++ b/tether/tether.d.ts @@ -0,0 +1,50 @@ +// Type definitions for Tether v0.6 +// Project: http://github.hubspot.com/tether/ +// Definitions by: Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module tether { + + interface TetherStatic { + new(options: ITetherOptions): Tether; + } + + interface ITetherOptions { + attachment?: string; + classes?: {[className: string]: boolean}; + classPrefix?: string; + constraints?: ITetherConstraint[]; + element?: Element | string | any /* JQuery */; + enabled?: boolean; + offset?: string; + optimizations?: any; + target?: Element | string | any /* JQuery */; + targetAttachment?: string; + targetOffset?: string; + targetModifier?: string; + } + + interface ITetherConstraint { + attachment?: string; + outOfBoundsClass?: string; + pin?: boolean | string[]; + pinnedClass?: string; + to?: string | Element | number[]; + } + + interface Tether { + setOptions(options: ITetherOptions): void; + disable(): void; + enable(): void; + destroy(): void; + position(): void; + } + +} + +declare module "tether" { + export = tether; +} + +declare var Tether: tether.TetherStatic; + From d8ea3e37f7ab9263a5cae5ac693658052aca5cdc Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Wed, 4 Mar 2015 21:00:31 -0500 Subject: [PATCH 42/78] Add drop typings --- drop/drop-tests.ts | 28 +++++++++++++++++++++++++++ drop/drop.d.ts | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 drop/drop-tests.ts create mode 100644 drop/drop.d.ts diff --git a/drop/drop-tests.ts b/drop/drop-tests.ts new file mode 100644 index 000000000..b5ae47456 --- /dev/null +++ b/drop/drop-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +var yellowBox = document.querySelector(".yellow"); +var greenBox = document.querySelector(".green"); + +var d = new Drop({ + position: "bottom left", + openOn: "click", + constrainToWindow: true, + constrainToScrollParent: true, + classes: "", + tetherOptions: {} +}); + +d.open(); +d.close(); +d.remove(); +d.toggle(); +d.position(); +d.destroy(); + +d.on("open", () => null); +d.on("close", () => null); +d.once("close", () => null); +d.off("close", () => null); +d.off("open"); + diff --git a/drop/drop.d.ts b/drop/drop.d.ts new file mode 100644 index 000000000..18568afdd --- /dev/null +++ b/drop/drop.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Drop v0.5 +// Project: http://github.hubspot.com/drop/ +// Definitions by: Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module drop { + + interface DropStatic { + new(options: IDropOptions): Drop; + } + + interface IDropOptions { + target?: Element; + content?: Element | string | (() => string); + position?: string; + openOn?: string; + constrainToWindow?: boolean; + constrainToScrollParent?: boolean; + remove?: boolean; + tetherOptions?: tether.ITetherOptions; + } + + interface Drop { + content: HTMLElement; + open(): void; + close(): void; + remove(): void; + toggle(): void; + position(): void; + destroy(): void; + /* + * Drop instances fire "open" and "close" events. + */ + on(event: string, handler: Function, context?: any): void; + once(event: string, handler: Function, context?: any): void; + off(event: string, handler?: Function): void; + } + +} + +declare module "drop" { + export = drop; +} + +declare var Drop: drop.DropStatic; + From a6cbfba663b3ec69923b7cf85cef84ad27e640b0 Mon Sep 17 00:00:00 2001 From: reppners Date: Thu, 5 Mar 2015 08:42:15 +0100 Subject: [PATCH 43/78] + changed promise declaration to own custom since it is not possible to reuse ES6 polyfill promise class declaration --- js-data-http/js-data-http.d.ts | 10 +++++----- js-data/js-data-tests.ts | 4 +++- js-data/js-data.d.ts | 14 ++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts index 626f55648..416aa3c8c 100644 --- a/js-data-http/js-data-http.d.ts +++ b/js-data-http/js-data-http.d.ts @@ -35,11 +35,11 @@ declare module JSData { new(options?:DSHttpAdapterOptions):DSHttpAdapter; // DSHttpAdapter uses axios so options are axios config objects. - HTTP(options?:Object):Promise; - DEL(url:string, data?:Object, options?:Object):Promise; - GET(url:string, data?:Object, options?:Object):Promise; - POST(url:string, data?:Object, options?:Object):Promise; - PUT(url:string, data?:Object, options?:Object):Promise; + HTTP(options?:Object):JSDataPromise; + DEL(url:string, data?:Object, options?:Object):JSDataPromise; + GET(url:string, data?:Object, options?:Object):JSDataPromise; + POST(url:string, data?:Object, options?:Object):JSDataPromise; + PUT(url:string, data?:Object, options?:Object):JSDataPromise; } } diff --git a/js-data/js-data-tests.ts b/js-data/js-data-tests.ts index 35fdbf00f..c6fe6d13b 100644 --- a/js-data/js-data-tests.ts +++ b/js-data/js-data-tests.ts @@ -387,7 +387,9 @@ OtherOtherComment.find(5, {params: {postId: 4}}); // GET /post/4/comment/5 // vs -OtherOtherComment.find(5); // GET /comment/5 +var promise = OtherOtherComment.find(5); // GET /comment/5 + +promise.then().catch().finally(); OtherOtherComment.inject({id: 1, postId: 2}); diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index cf74b6b79..7017481ee 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -3,12 +3,6 @@ // Definitions by: Stefan Steinhart // Definitions: https://github.com/borisyankov/DefinitelyTyped -/////////////////////////////////////////////////////////////////////////////// -// Promises in js-data are ES6 polyfill promises -/////////////////////////////////////////////////////////////////////////////// - -/// - /////////////////////////////////////////////////////////////////////////////// // js-data module (js-data.js) /////////////////////////////////////////////////////////////////////////////// @@ -16,10 +10,14 @@ // defining what exists in JSData and how it looks declare module JSData { - interface JSDataPromise extends Promise { + interface JSDataPromise { + + then(onFulfilled?: (value: R) => U | JSDataPromise, onRejected?: (error: any) => U | JSDataPromise): JSDataPromise; + + catch(onRejected?: (error: any) => U | JSDataPromise): JSDataPromise; // enhanced with finally - finally(finallyCb?:() => U):Promise; + finally(finallyCb?:() => U):JSDataPromise; } //TODO switch to class again when typescript supports open ended class declaration From ae81e340a9e897167cfef3122a5a3aed04293814 Mon Sep 17 00:00:00 2001 From: reppners Date: Thu, 5 Mar 2015 08:50:54 +0100 Subject: [PATCH 44/78] + chokidar type defs including tests --- chokidar/chokidar-tests.ts | 41 +++++++++++++++++++++++++++++++++++++ chokidar/chokidar.d.ts | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 chokidar/chokidar-tests.ts create mode 100644 chokidar/chokidar.d.ts diff --git a/chokidar/chokidar-tests.ts b/chokidar/chokidar-tests.ts new file mode 100644 index 000000000..b89dd81a0 --- /dev/null +++ b/chokidar/chokidar-tests.ts @@ -0,0 +1,41 @@ +/// + +import fs = require('fs'); +import chokidar = require('chokidar'); + +var watcher = chokidar.watch('file, dir, or glob', { + ignored: /[\/\\]\./, persistent: true +}); + +var log = console.log.bind(console); + +watcher + .on('add', function(path:string) { log('File', path, 'has been added'); }) + .on('addDir', function(path:string) { log('Directory', path, 'has been added'); }) + .on('change', function(path:string) { log('File', path, 'has been changed'); }) + .on('unlink', function(path:string) { log('File', path, 'has been removed'); }) + .on('unlinkDir', function(path:string) { log('Directory', path, 'has been removed'); }) + .on('error', function(error:any) { log('Error happened', error); }) + .on('ready', function() { log('Initial scan complete. Ready for changes.'); }) + .on('raw', function(event:Event, path:string, details:any) { log('Raw event info:', event, path, details); }) + +// 'add', 'addDir' and 'change' events also receive stat() results as second +// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats +watcher.on('change', function(path:string, stats:fs.Stats) { + if (stats) console.log('File', path, 'changed size to', stats.size); +}); + +// Watch new files. +watcher.add('new-file'); +watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); + +// Un-watch some files. +watcher.unwatch('new-file*'); + +// Only needed if watching is `persistent: true`. +watcher.close(); + +// One-liner +require('chokidar').watch('.', {ignored: /[\/\\]\./}).on('all', function(event:string, path:string) { + console.log(event, path); +}); \ No newline at end of file diff --git a/chokidar/chokidar.d.ts b/chokidar/chokidar.d.ts new file mode 100644 index 000000000..6a417ca72 --- /dev/null +++ b/chokidar/chokidar.d.ts @@ -0,0 +1,42 @@ +// Type definitions for chokidar 1.0.0 +// Project: https://github.com/paulmillr/chokidar +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "fs" +{ + interface FSWatcher + { + add(fileDirOrGlob:string):void; + add(filesDirsOrGlobs:Array):void; + unwatch(fileDirOrGlob:string):void; + unwatch(filesDirsOrGlobs:Array):void; + } +} + +declare module "chokidar" +{ + interface WatchOptions + { + persistent?:boolean; + ignored?:any; + ignoreInitial?:boolean; + followSymlinks?:boolean; + cwd?:string; + usePolling?:boolean; + useFsEvents?:boolean; + alwaysStat?:boolean; + depth?:number; + interval?:number; + binaryInterval?:number; + ignorePermissionErrors?:boolean; + atomic?:boolean; + } + + import fs = require("fs"); + + function watch( fileDirOrGlob:string, options?:WatchOptions ):fs.FSWatcher; + function watch( filesDirsOrGlobs:Array, options?:WatchOptions ):fs.FSWatcher; +} From c6b6779a46f0246df0f0a9660583c36e4e6e4ac2 Mon Sep 17 00:00:00 2001 From: Gildor Date: Thu, 5 Mar 2015 16:23:51 +0800 Subject: [PATCH 45/78] Fix return type of Selection.classed(string) to boolean --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 6cc372f7f..a12009bba 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -728,7 +728,7 @@ declare module D3 { }; classed: { - (name: string): string; + (name: string): boolean; (name: string, value: any): Selection; (name: string, valueFunction: (data: any, index: number) => any): Selection; (classValueMap: Object): Selection; From 6bfdd921c1199e3e2e557d68e036bbe00d1c5523 Mon Sep 17 00:00:00 2001 From: reppners Date: Thu, 5 Mar 2015 11:19:07 +0100 Subject: [PATCH 46/78] + added missing typings to node path module including tests --- node/node-tests.ts | 140 +++++++++++++++++++++++++++++++++++++++++++++ node/node.d.ts | 13 +++++ 2 files changed, 153 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index f2702ec4a..0ac9a9e8b 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -11,6 +11,7 @@ import http = require("http"); import net = require("net"); import dgram = require("dgram"); import querystring = require('querystring'); +import path = require("path"); assert(1 + 1 - 2 === 0, "The universe isn't how it should."); @@ -177,3 +178,142 @@ console.log(escaped); var unescaped: string = querystring.unescape(escaped); console.log(unescaped); // http://example.com/product/abcde.html + +//////////////////////////////////////////////////// +/// path tests : http://nodejs.org/api/path.html +//////////////////////////////////////////////////// + +module path_tests { + + path.normalize('/foo/bar//baz/asdf/quux/..'); + + path.join('/foo', 'bar', 'baz/asdf', 'quux', '..'); + // returns + //'/foo/bar/baz/asdf' + + try { + path.join('foo', {}, 'bar'); + } + catch(error) { + + } + + path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile'); + //Is similar to: + // + //cd foo/bar + //cd /tmp/file/ + //cd .. + // cd a/../subfile + //pwd + + path.resolve('/foo/bar', './baz') + // returns + // '/foo/bar/baz' + + path.resolve('/foo/bar', '/tmp/file/') + // returns + // '/tmp/file' + + path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif') + // if currently in /home/myself/node, it returns + // '/home/myself/node/wwwroot/static_files/gif/image.gif' + + path.isAbsolute('/foo/bar') // true + path.isAbsolute('/baz/..') // true + path.isAbsolute('qux/') // false + path.isAbsolute('.') // false + + path.isAbsolute('//server') // true + path.isAbsolute('C:/foo/..') // true + path.isAbsolute('bar\\baz') // false + path.isAbsolute('.') // false + + path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb') +// returns +// '..\\..\\impl\\bbb' + + path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb') +// returns +// '../../impl/bbb' + + path.dirname('/foo/bar/baz/asdf/quux') +// returns +// '/foo/bar/baz/asdf' + + path.basename('/foo/bar/baz/asdf/quux.html') +// returns +// 'quux.html' + + path.basename('/foo/bar/baz/asdf/quux.html', '.html') +// returns +// 'quux' + + path.extname('index.html') +// returns +// '.html' + + path.extname('index.coffee.md') +// returns +// '.md' + + path.extname('index.') +// returns +// '.' + + path.extname('index') +// returns +// '' + + 'foo/bar/baz'.split(path.sep) +// returns +// ['foo', 'bar', 'baz'] + + 'foo\\bar\\baz'.split(path.sep) +// returns +// ['foo', 'bar', 'baz'] + + console.log(process.env.PATH) +// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' + + process.env.PATH.split(path.delimiter) +// returns +// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] + + console.log(process.env.PATH) +// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\' + + process.env.PATH.split(path.delimiter) +// returns +// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\'] + + path.parse('/home/user/dir/file.txt') +// returns +// { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } + + path.parse('C:\\path\\dir\\index.html') +// returns +// { +// root : "C:\", +// dir : "C:\path\dir", +// base : "index.html", +// ext : ".html", +// name : "index" +// } + + path.format({ + root : "/", + dir : "/home/user/dir", + base : "file.txt", + ext : ".txt", + name : "file" + }); +// returns +// '/home/user/dir/file.txt' +} diff --git a/node/node.d.ts b/node/node.d.ts index b1e849535..22fb332e8 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -953,14 +953,27 @@ declare module "fs" { } declare module "path" { + + export interface ParsedPath { + root: string; + dir: string; + base: string; + ext: string; + name: string; + } + export function normalize(p: string): string; export function join(...paths: any[]): string; export function resolve(...pathSegments: any[]): string; + export function isAbsolute(p: string): boolean; export function relative(from: string, to: string): string; export function dirname(p: string): string; export function basename(p: string, ext?: string): string; export function extname(p: string): string; export var sep: string; + export var delimiter: string; + export function parse(p: string): ParsedPath; + export function format(pP: ParsedPath): string; } declare module "string_decoder" { From 235f7734ece03d8b499928e8f367fa9e3726f3e4 Mon Sep 17 00:00:00 2001 From: Schnell Henrik Date: Thu, 5 Mar 2015 11:22:09 +0100 Subject: [PATCH 47/78] Fixed link definition on IDirective with union type IDirectiveLinkFn | IDirectivePrePost. --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 2f88253f0..639f0b1e8 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1448,7 +1448,7 @@ declare module ng { controller?: any; controllerAs?: string; bindToController?: boolean; - link?: IDirectiveLinkFn; + link?: IDirectiveLinkFn | IDirectivePrePost; name?: string; priority?: number; replace?: boolean; From 69bdfb0884020e41f17a1dd80ad4c77de2636874 Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 5 Mar 2015 23:21:03 +0900 Subject: [PATCH 48/78] update CONTRIBUTORS.md --- CONTRIBUTORS.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index eb11f9f2a..88905c88a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -86,6 +86,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen) * [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) * [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners) * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) @@ -103,6 +104,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](chartjs/chart.d.ts) [Chart.js](https://github.com/nnnick/Chart.js) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](checksum/checksum.d.ts) [checksum](https://github.com/dshaw/checksum) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](cheerio/cheerio.d.ts) [Cheerio](https://github.com/cheeriojs/cheerio) by [Bret Little](https://github.com/blittle), [VILIC VANE](http://vilic.info), [Wayne Maurer](https://github.com/wmaurer) +* [:link:](chokidar/chokidar.d.ts) [chokidar](https://github.com/paulmillr/chokidar) by [Stefan Steinhart](https://github.com/reppners) * [:link:](chosen/chosen.jquery.d.ts) [Chosen.JQuery](http://harvesthq.github.com/chosen) by [Boris Yankov](https://github.com/borisyankov) * [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD) * [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10) @@ -159,6 +161,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](dot/dot.d.ts) [doT](https://github.com/olado/doT) by [ZombieHunter](https://github.com/ZombieHunter) * [:link:](dotdotdot/dotdotdot.d.ts) [dotdotdot](http://dotdotdot.frebsite.nl) by [Milan Jaros](https://github.com/milanjaros) * [:link:](doublearray/doublearray.d.ts) [doublearray](https://github.com/takuyaa/doublearray) by [MIZUSHIMA Junki](https://github.com/mzsm) +* [:link:](drop/drop.d.ts) [Drop](http://github.hubspot.com/drop) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](dropboxjs/dropboxjs.d.ts) [dropbox-js](https://github.com/dropbox/dropbox-js) by [Steve Fenton](https://github.com/Steve-Fenton), [Pedro Casaubon](https://github.com/xperiments) * [:link:](dropzone/dropzone.d.ts) [Dropzone](http://www.dropzonejs.com) by [Natan Vivo](https://github.com/nvivo) * [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com) @@ -254,19 +257,25 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](greensock/greensock.d.ts) [GreenSock Animation Platform](http://www.greensock.com/get-started-js) by [Robert S](https://github.com/codebelt) * [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm) * [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat) -* [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) -* [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) +* [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) +* [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) +* [:link:](gulp-concat/gulp-concat.d.ts) [gulp-concat](http://github.com/wearefractal/gulp-concat) by [Keita Kagurazaka](https://github.com/k-kagurazaka) +* [:link:](gulp-flatten/gulp-flatten.d.ts) [gulp-flatten](https://github.com/armed/gulp-flatten) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](gulp-gh-pages/gulp-gh-pages.d.ts) [gulp-gh-pages](https://github.com/rowoot/gulp-gh-pages) by [Asana](https://asana.com) * [:link:](gulp-if/gulp-if.d.ts) [gulp-if](https://github.com/robrich/gulp-if) by [Asana](https://asana.com) +* [:link:](gulp-inject/gulp-inject.d.ts) [gulp-inject](https://github.com/klei/gulp-inject) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](gulp-istanbul/gulp-istanbul.d.ts) [gulp-istanbul](https://github.com/SBoudrias/gulp-istanbul) by [Asana](https://asana.com) +* [:link:](gulp-less/gulp-less.d.ts) [gulp-less](https://github.com/plus3network/gulp-less) by [Keita Kagurazaka](https://github.com/k-kagurazaka) +* [:link:](gulp-minify-css/gulp-minify-css.d.ts) [gulp-minify-css](https://github.com/jonathanepollack/gulp-minify-css) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](gulp-mocha/gulp-mocha.d.ts) [gulp-mocha](https://github.com/sindresorhus/gulp-mocha) by [Asana](https://asana.com) * [:link:](gulp-rename/gulp-rename.d.ts) [gulp-rename](https://github.com/hparra/gulp-rename) by [Asana](https://asana.com) * [:link:](gulp-replace/gulp-replace.d.ts) [gulp-replace](https://github.com/lazd/gulp-replace) by [Asana](https://asana.com) * [:link:](gulp-sass/gulp-sass.d.ts) [gulp-sass](https://github.com/dlmanning/gulp-sass) by [Asana](https://asana.com) * [:link:](gulp-sourcemaps/gulp-sourcemaps.d.ts) [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) by [Asana](https://asana.com) +* [:link:](gulp-tsd/gulp-tsd.d.ts) [gulp-tsd](https://github.com/moznion/gulp-tsd) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](gulp-tslint/gulp-tslint.d.ts) [gulp-tslint](https://github.com/panuhorsmalahti/gulp-tslint) by [Asana](https://asana.com) * [:link:](gulp-typedoc/gulp-typedoc.d.ts) [gulp-typedoc](https://github.com/rogierschouten/gulp-typedoc) by [Asana](https://asana.com) * [:link:](gulp-typescript/gulp-typescript.d.ts) [gulp-typescript](https://github.com/ivogabe/gulp-typescript) by [Asana](https://asana.com) @@ -321,7 +330,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jjv/jjv.d.ts) [JJV](https://github.com/acornejo/jjv) by [Wim Looman](https://github.com/Nemo157) * [:link:](jjve/jjve.d.ts) [JJVE](https://github.com/silas/jjve) by [Wim Looman](https://github.com/Nemo157) * [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds) -* [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman) +* [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman), [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](jqrangeslider/jqrangeslider.d.ts) [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) by [Dániel Tar](https://github.com/qcz) * [:link:](jquery/jquery.d.ts) [jQuery 1.10.x / 2.0.x](http://jquery.com) by [Boris Yankov](https://github.com/borisyankov), [Christian Hoffmeister](https://github.com/choffmeister), [Steve Fenton](https://github.com/Steve-Fenton), [Diullei Gomes](https://github.com/Diullei), [Tass Iliopoulos](https://github.com/tasoili), [Jason Swearingen](https://github.com/jasons-novaleaf), [Sean Hill](https://github.com/seanski), [Guus Goossens](https://github.com/Guuz), [Kelly Summerlin](https://github.com/ksummerlin), [Basarat Ali Syed](https://github.com/basarat), [Nicholas Wolverson](https://github.com/nwolverson), [Derek Cicerone](https://github.com/derekcicerone), [Andrew Gaspar](https://github.com/AndrewGaspar), [James Harrison Fisher](https://github.com/jameshfisher), [Seikichi Kondo](https://github.com/seikichi), [Benjamin Jackman](https://github.com/benjaminjackman), [Poul Sorensen](https://github.com/s093294), [Josh Strobl](https://github.com/JoshStrobl), [John Reilly](https://github.com/johnnyreilly), [Dick van den Brink](https://github.com/DickvdBrink) * [:link:](jquery.blockUI/jquery.blockUI.d.ts) [jQuery BlockUI Plugin](http://malsup.com/jquery/block) by [Jeffrey Lee](http://blog.darkthread.net) @@ -393,6 +402,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](js-yaml/js-yaml.d.ts) [js-yaml](https://github.com/nodeca/js-yaml) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](jsbn/jsbn.d.ts) [jsbn](http://www-cs-students.stanford.edu/%7Etjw/jsbn) by [Eugene Chernyshov](https://github.com/Evgenus) * [:link:](jscrollpane/jscrollpane.d.ts) [jScrollPane](http://jscrollpane.kelvinluck.com) by [Dániel Tar](https://github.com/qcz) +* [:link:](js-data/js-data.d.ts) [JSData](https://github.com/js-data/js-data) by [Stefan Steinhart](https://github.com/reppners) +* [:link:](js-data-http/js-data-http.d.ts) [JSData Http Adapter](https://github.com/js-data/js-data-http) by [Stefan Steinhart](https://github.com/reppners) +* [:link:](js-data-angular/js-data-angular.d.ts) [JSDataAngular](https://github.com/js-data/js-data-angular) by [Stefan Steinhart](https://github.com/reppners) * [:link:](jsdeferred/jsdeferred.d.ts) [JSDeferred](https://github.com/cho45/jsdeferred) by [Daisuke Mino](https://github.com/minodisk) * [:link:](jsdom/jsdom.d.ts) [jsdom](https://github.com/tmpvar/jsdom) by [Asana](https://asana.com) * [:link:](jsesc/jsesc.d.ts) [jsesc](https://github.com/mathiasbynens/jsesc) by [Bart van der Schoor](https://github.com/Bartvds) @@ -462,6 +474,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz) * [:link:](lunr/lunr.d.ts) [lunr.js](https://github.com/olivernn/lunr.js) by [Sebastian Lenz](https://github.com/sebastian-lenz) * [:link:](lz-string/lz-string.d.ts) [lz-string](https://github.com/pieroxy/lz-string) by [Roman Nikitin](https://github.com/M0ns1gn0r) +* [:link:](main-bower-files/main-bower-files.d.ts) [main-bower-files](https://github.com/ck86/main-bower-files) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](mapbox/mapbox.d.ts) [Mapbox](https://www.mapbox.com/mapbox.js) by [Maxime Fabre](https://github.com/anahkiasen) * [:link:](mapsjs/mapsjs.d.ts) [Mapsjs](https://github.com/mapsjs) by [Matthew James Davis](https://github.com/davismj) * [:link:](marionette/marionette.d.ts) [Marionette](https://github.com/marionettejs) by [Zeeshan Hamid](https://github.com/zhamid), [Natan Vivo](https://github.com/nvivo), [Sven Tschui](https://github.com/sventschui) @@ -470,6 +483,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mathjax/mathjax.d.ts) [MathJax](https://github.com/mathjax/MathJax) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](mCustomScrollbar/mCustomScrollbar.d.ts) [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) by [Sarah Williams](https://github.com/flurg) * [:link:](memory-cache/memory-cache.d.ts) [memory-cache](http://github.com/ptarjan/node-cache) by [Jeff Goddard](https://github.com/jedigo) +* [:link:](merge-stream/merge-stream.d.ts) [merge-stream](https://github.com/grncdr/merge-stream) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](mess/mess.d.ts) [mess](https://github.com/bobrik/node-mess) by [Wim Looman](https://github.com/Nemo157) * [:link:](messenger/messenger.d.ts) [Messenger.js](https://github.com/HubSpot/messenger) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](meteor/meteor.d.ts) [Meteor](http://www.meteor.com) by [Dave Allen](https://github.com/fullflavedave) @@ -521,6 +535,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](needle/needle.d.ts) [needle](https://github.com/tomas/needle) by [San Chen](https://github.com/bigsan) * [:link:](nexpect/nexpect.d.ts) [nexpect](https://github.com/nodejitsu/nexpect) by [vvakame](http://github.com/vvakame) * [:link:](ng-grid/ng-grid.d.ts) [ng-grid](http://angular-ui.github.io/ng-grid) by [Ken Smith](https://github.com/smithkl42), [Roland Zwaga](https://github.com/rolandzwaga), [Kent Cooper](https://github.com/kentcooper) +* [:link:](angular-idle/angular-idle.d.ts) [ng-idle](http://hackedbychinese.github.io/ng-idle) by [mthamil](https://github.com/mthamil) * [:link:](ngprogress/ngprogress.d.ts) [ngProgress](http://victorbjelkholm.github.io/ngProgress) by [Martin McWhorter](https://github.com/martinmcwhorter) * [:link:](ngprogress-lite/ngprogress-lite.d.ts) [ngprogress-lite](https://github.com/voronianski/ngprogress-lite) by [Luke Forder](https://github.com/LukeForder) * [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi) @@ -538,6 +553,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](multiparty/multiparty.d.ts) [node-multiparty](https://github.com/andrewrk/node-multiparty) by [Ken Fukuyama](https://github.com/kenfdev) * [:link:](mysql/mysql.d.ts) [node-mysql](https://github.com/felixge/node-mysql) by [William Johnston](https://github.com/wjohnsto) * [:link:](node-persist/node-persist.d.ts) [node-persist](https://github.com/simonlast/node-persist) by [Spencer Williams](http://spencerwi.com) +* [:link:](node-polyglot/node-polyglot.d.ts) [node-polyglot](https://github.com/airbnb/polyglot.js) by [Tim Jackson-Kiely](https://github.com/timjk) * [:link:](promptly/promptly.d.ts) [node-promptly](https://github.com/IndigoUnited/node-promptly) by [Dan Spencer](https://github.com/danrspencer) * [:link:](radius/radius.d.ts) [node-radius](https://github.com/retailnext/node-radius) by [Peter Harris](https://github.com/codeanimal) * [:link:](node-uuid/node-uuid.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay) @@ -613,6 +629,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim) * [:link:](ractive/ractive.d.ts) [Ractive 0.7.0 edge f22ab8ad0a640591b1c263f57e21d1565cb26bf5](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) * [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall) +* [:link:](rappid/rappid.d.ts) [Rappid](http://jointjs.com/about-rappid) by [Ewout Van Gossum](https://github.com/DenEwout) * [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo) * [:link:](react/react.d.ts) [React](http://facebook.github.io/react) by [Asana](https://asana.com) * [:link:](react-router/react-router.d.ts) [React Router](https://github.com/rackt/react-router) by [Yuichi Murata](https://github.com/mrk21) @@ -633,6 +650,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](riotjs/riotjs.d.ts) [riot.js](https://github.com/moot/riotjs) by [vvakame](https://github.com/vvakame) * [:link:](routie/routie.d.ts) [routie](https://github.com/jgallen23/routie) by [Adilson](https://github.com/Adilson) * [:link:](rtree/rtree.d.ts) [rtree](https://github.com/leaflet-extras/RTree) by [Omede Firouz](https://github.com/oefirouz) +* [:link:](run-sequence/run-sequence.d.ts) [run-sequence](https://github.com/OverZealous/run-sequence) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](rx/rx.d.ts) [RxJS](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.aggregates.d.ts) [RxJS-Aggregates](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.all.d.ts) [RxJS-All](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek) @@ -696,6 +714,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](stats/stats.d.ts) [Stats.js r12](http://github.com/mrdoob/stats.js) by [Gregory Dalton](https://github.com/gregolai) * [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame) * [:link:](storejs/storejs.d.ts) [store.js](https://github.com/marcuswestin/store.js) by [Vincent Bortone](https://github.com/vbortone) +* [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Eric J. Smith](https://github.com/ejsmith) * [:link:](stylus/stylus.d.ts) [stylus](https://github.com/LearnBoost/stylus) by [Maxime LUCE](https://github.com/SomaticIT) @@ -718,6 +737,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](tedious/tedious.d.ts) [tedious](https://pekim.github.io/tedious) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](tedious-connection-pool/tedious-connection-pool.d.ts) [tedious-connection-pool](https://github.com/pekim/tedious-connection-pool) by [Cyprien Autexier](https://github.com/sandorfr) * [:link:](teechart/teechart.d.ts) [TeeChart](http://www.steema.com) by [Steema Software](https://steema.com) +* [:link:](tether/tether.d.ts) [Tether](http://github.hubspot.com/tether) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](text-buffer/text-buffer.d.ts) [text-buffer](https://github.com/atom/text-buffer) by [vvakame](https://github.com/vvakame) * [:link:](text-encoding/text-encoding.d.ts) [text-encoding](https://github.com/inexorabletash/text-encoding) by [MIZUNE Pine](https://github.com/pine613) * [:link:](threejs/three-canvasrenderer.d.ts) [three.js (CanvasRenderer.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CanvasRenderer.js) by [Satoru Kimura](https://github.com/gyohk) From 587449f4084a352bf0ef91cceda1b2fd57628d96 Mon Sep 17 00:00:00 2001 From: Marcin Porebski Date: Thu, 5 Mar 2015 16:31:17 +0100 Subject: [PATCH 49/78] ini module def. --- ini/ini-tests.ts | 10 ++++++++++ ini/ini.d.ts | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ini/ini-tests.ts create mode 100644 ini/ini.d.ts diff --git a/ini/ini-tests.ts b/ini/ini-tests.ts new file mode 100644 index 000000000..44241625f --- /dev/null +++ b/ini/ini-tests.ts @@ -0,0 +1,10 @@ +/// +/// + +import fs = require("fs"); +import ini = require("ini"); + +var ini_content = fs.readFileSync("path_to_file.ini", "utf-8"); + +var ini_object: any = ini.decode(ini_content); +var ini_rev_string: string = ini.encode(ini_object); \ No newline at end of file diff --git a/ini/ini.d.ts b/ini/ini.d.ts new file mode 100644 index 000000000..6cab73533 --- /dev/null +++ b/ini/ini.d.ts @@ -0,0 +1,25 @@ +// Type definitions for ini v1.3.3 +// Project: https://github.com/isaacs/ini +// Definitions by: Marcin PorÄ™bski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "ini" +{ + interface EncodeOptions { + section: string + whitespace: boolean + } + + function decode(inistring: string): any; + + function parse(initstring: string): any; + + function encode(object: any, options?: EncodeOptions): string; + + function stringify(object: any, options?: EncodeOptions): string; + + function safe(val: string): string; + + function unsafe(val: string): string; + +} From 8668b9ef4f037870ec83e6bad4c7bb702b43fb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=B6ller?= Date: Thu, 5 Mar 2015 16:54:26 +0100 Subject: [PATCH 50/78] Update chrome.d.ts Port has more properties. https://developer.chrome.com/extensions/runtime#type-Port change postMessage like onMessage was changed in 36f2213157fa535f5c4aef66da98559e9823e25c. add disconnect method. --- chrome/chrome.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index cbabf893a..bc0d52227 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1545,7 +1545,8 @@ declare module chrome.runtime { } interface Port { - postMessage: Function; + postMessage: (message: Object) => void; + disconnect: () => void; sender?: MessageSender; onDisconnect: chrome.events.Event; onMessage: PortMessageEvent; From 8d27cef4b0a2bfefd4d0d960cbf809d76c8d8849 Mon Sep 17 00:00:00 2001 From: falsandtru Date: Fri, 6 Mar 2015 00:49:46 +0900 Subject: [PATCH 51/78] Fix type mismatch --- jquery/jquery.d.ts | 55 ++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index b82711120..203180150 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -283,12 +283,12 @@ interface JQueryGenericPromise { * Interface for the JQuery promise/deferred callbacks */ interface JQueryPromiseCallback { - (value?: T, ...args: any[]): void; + (value?: T, ...args: T[]): void; } -interface JQueryPromiseOperator { - (callback: JQueryPromiseCallback, ...callbacks: JQueryPromiseCallback[]): JQueryPromise; - (callback: JQueryPromiseCallback[], ...callbacks: JQueryPromiseCallback[]): JQueryPromise; +interface JQueryPromiseOperator { + (callback1: JQueryPromiseCallback, ...callbackN: JQueryPromiseCallback[]): JQueryPromise; + (callbacks1: JQueryPromiseCallback[], ...callbacksN: JQueryPromiseCallback[][]): JQueryPromise; } /** @@ -301,28 +301,31 @@ interface JQueryPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always: JQueryPromiseOperator; + always(alwaysCallback1?: JQueryPromiseCallback, ...alwaysCallbackN: JQueryPromiseCallback[]): JQueryPromise; + always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done: JQueryPromiseOperator; + done(doneCallback1?: JQueryPromiseCallback, ...doneCallbackN: JQueryPromiseCallback[]): JQueryPromise; + done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail: JQueryPromiseOperator; + fail(failCallback1?: JQueryPromiseCallback, ...failCallbackN: JQueryPromiseCallback[]): JQueryPromise; + fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback: JQueryPromiseCallback): JQueryPromise; - progress(progressCallbacks: JQueryPromiseCallback[]): JQueryPromise; + progress(progressCallback1?: JQueryPromiseCallback, ...progressCallbackN: JQueryPromiseCallback[]): JQueryPromise; + progress(progressCallback1s?: JQueryPromiseCallback[], ...progressCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; /** * Determine the current state of a Deferred object. @@ -362,44 +365,38 @@ interface JQueryDeferred extends JQueryPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallbacks1?: JQueryPromiseCallback, ...alwaysCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback, ...alwaysCallbacks2: any[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacks2: any[]): JQueryDeferred; + always(alwaysCallback1?: JQueryPromiseCallback, ...alwaysCallbackN: JQueryPromiseCallback[]): JQueryDeferred; + always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallbacks1?: JQueryPromiseCallback, ...doneCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback, ...doneCallbacks2: any[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacks2: any[]): JQueryDeferred; + done(doneCallback1?: JQueryPromiseCallback, ...doneCallbackN: JQueryPromiseCallback[]): JQueryDeferred; + done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallbacks1?: JQueryPromiseCallback, ...failCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacks2: JQueryPromiseCallback[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback, ...failCallbacks2: any[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacks2: any[]): JQueryDeferred; + fail(failCallback1?: JQueryPromiseCallback, ...failCallbackN: JQueryPromiseCallback[]): JQueryDeferred; + fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback: JQueryPromiseCallback): JQueryDeferred; - progress(progressCallbacks: JQueryPromiseCallback[]): JQueryDeferred; + progress(progressCallback1?: JQueryPromiseCallback, ...progressCallbackN: JQueryPromiseCallback[]): JQueryDeferred; + progress(progressCallbacks1?: JQueryPromiseCallback[], ...progressCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given args. * * @param args Optional arguments that are passed to the progressCallbacks. */ - notify(...args: any[]): JQueryDeferred; + notify(...args: T[]): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given context and args. @@ -407,21 +404,21 @@ interface JQueryDeferred extends JQueryPromise { * @param context Context passed to the progressCallbacks as the this object. * @param args Optional arguments that are passed to the progressCallbacks. */ - notifyWith(context: any, ...args: any[]): JQueryDeferred; + notifyWith(context: any, ...args: T[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given args. * * @param args Optional arguments that are passed to the failCallbacks. */ - reject(...args: any[]): JQueryDeferred; + reject(...args: T[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given context and args. * * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. */ - rejectWith(context: any, ...args: any[]): JQueryDeferred; + rejectWith(context: any, ...args: T[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given args. @@ -429,7 +426,7 @@ interface JQueryDeferred extends JQueryPromise { * @param value First argument passed to doneCallbacks. * @param args Optional subsequent arguments that are passed to the doneCallbacks. */ - resolve(value?: T, ...args: any[]): JQueryDeferred; + resolve(value?: T, ...args: T[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given context and args. @@ -437,7 +434,7 @@ interface JQueryDeferred extends JQueryPromise { * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. */ - resolveWith(context: any, ...args: any[]): JQueryDeferred; + resolveWith(context: any, ...args: T[]): JQueryDeferred; /** * Return a Deferred's Promise object. From 2bb37c8f95764cf90c32a2046e86c199fabdbaa3 Mon Sep 17 00:00:00 2001 From: "Michael C. Bazarewsky" Date: Thu, 5 Mar 2015 16:10:25 -0500 Subject: [PATCH 52/78] add missing axis parameter to flot tickFormatter The tickFormatter entry for a flot axis definition now has the optional axis argument available. --- flot/jquery.flot.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flot/jquery.flot.d.ts b/flot/jquery.flot.d.ts index 9ea862c5c..c179d2f03 100644 --- a/flot/jquery.flot.d.ts +++ b/flot/jquery.flot.d.ts @@ -107,7 +107,7 @@ declare module jquery.flot { ticks?: any; // null or number or ticks array or (fn: axis -> ticks array) tickSize?: any; // number or array minTickSize?: any; // number or array - tickFormatter?: (t: number) => string; // (fn: number, object -> string) or string + tickFormatter?: (t: number, a?: axis) => string; // (fn: number, object -> string) or string tickDecimals?: number; labelWidth?: number; From 84d54cedba2eab3581d166c2ae2eaaa871ca8105 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Thu, 5 Mar 2015 23:03:57 +0100 Subject: [PATCH 53/78] Made keepEmptyLines optional If one decides to only use something of `TransformOptions` (e.g. `encoding`), it wouldn't be possible to omit the `keepEmptyLines` option. --- byline/byline.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/byline/byline.d.ts b/byline/byline.d.ts index 6dac6ad50..475386b28 100644 --- a/byline/byline.d.ts +++ b/byline/byline.d.ts @@ -9,7 +9,7 @@ declare module "byline" { import stream = require("stream"); export interface LineStreamOptions extends stream.TransformOptions { - keepEmptyLines: boolean; + keepEmptyLines?: boolean; } export interface LineStream extends stream.Transform { @@ -35,4 +35,4 @@ declare module "byline" { export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream; export var LineStream:LineStreamCreatable; -} \ No newline at end of file +} From 55fd327d6bf4876ff711cdfd2fba205e248de4ce Mon Sep 17 00:00:00 2001 From: Brandon Luong Date: Thu, 5 Mar 2015 19:37:54 -0800 Subject: [PATCH 54/78] symbol API takes in accessor --- d3/d3.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index a12009bba..3ab8a9b88 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1673,8 +1673,8 @@ declare module D3 { } export interface Symbol { - type: (string:string) => Symbol; - size: (number:number) => Symbol; + type: (symbolType: string | ((datum: any, index: number) => string)) => Symbol; + size: (size: number | ((datum: any, index: number) => number)) => Symbol; (datum:any, index:number): string; } From e26a0474bd909b46856721116b7c0c7a4dd4b938 Mon Sep 17 00:00:00 2001 From: reppners Date: Fri, 6 Mar 2015 08:23:21 +0100 Subject: [PATCH 55/78] + update of definitions to make use of union types --- js-data-angular/js-data-angular.d.ts | 6 +- js-data-http/js-data-http.d.ts | 10 +- js-data/js-data.d.ts | 258 +++++++-------------------- 3 files changed, 72 insertions(+), 202 deletions(-) diff --git a/js-data-angular/js-data-angular.d.ts b/js-data-angular/js-data-angular.d.ts index 11a295562..242c6d5ab 100644 --- a/js-data-angular/js-data-angular.d.ts +++ b/js-data-angular/js-data-angular.d.ts @@ -16,15 +16,13 @@ declare module JSData { bindAll(resourceName:string, params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array)=>void):Function; - bindOne(resourceName:string, id:string, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; - bindOne(resourceName:string, id:number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(resourceName:string, id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; } interface DSResourceDefinition { bindAll(params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array)=>void):Function; - bindOne(id:string, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; - bindOne(id:number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; + bindOne(id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function; } } \ No newline at end of file diff --git a/js-data-http/js-data-http.d.ts b/js-data-http/js-data-http.d.ts index 416aa3c8c..295e7cc6f 100644 --- a/js-data-http/js-data-http.d.ts +++ b/js-data-http/js-data-http.d.ts @@ -13,14 +13,8 @@ declare module JSData { queryTransform?: (resourceName:string, params:DSFilterParams)=>any; httpConfig?: any; forceTrailingSlash?: boolean; - log?: any; - // TODO wait for union types to be supported - // log: (message?: any, ...optionalParams: any[])=> void; - // log: boolean; - error?: any; - // TODO wait for union types to be supported - // error: (message?: any, ...optionalParams: any[])=> void; - // error: boolean; + log?: boolean | ((message?:any, ...optionalParams:any[])=> void); + error?: boolean | ((message?:any, ...optionalParams:any[])=> void); } interface DSHttpAdapterPromiseResolveType { diff --git a/js-data/js-data.d.ts b/js-data/js-data.d.ts index 7017481ee..bec41d331 100644 --- a/js-data/js-data.d.ts +++ b/js-data/js-data.d.ts @@ -1,4 +1,4 @@ -// Type definitions for JSData v1.3.0 +// Type definitions for JSData v1.5.4 // Project: https://github.com/js-data/js-data // Definitions by: Stefan Steinhart // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -34,97 +34,44 @@ declare module JSData { defaults:DSConfiguration; - changeHistory(resourceName:string, id?:string):Array; - changeHistory(resourceName:string, id?:number):Array; - - changes(resourceName:string, id:string):Object; - changes(resourceName:string, id:number):Object; - - compute(resourceName:string, id:number):T; - compute(resourceName:string, id:string):T; - compute(resourceName:string, instance:Object):T; - - create(resourceName:string, attrs:any, options?:DSConfiguration):JSDataPromise; - - createInstance(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T; - - defineResource(resourceName:string):DSResourceDefinition; - defineResource(definition:DSResourceDefinitionConfiguration):DSResourceDefinition; - - destroy(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - destroy(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + // async + create(resourceName:string, attrs:Object, options?:DSConfiguration):JSDataPromise; + destroy(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; destroyAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise; - - digest():void; - - eject(resourceName:string, id:string, options?:DSConfiguration):T; - eject(resourceName:string, id:number, options?:DSConfiguration):T; - - ejectAll(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; - - filter(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; - - find(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - find(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + find(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; findAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + loadRelations(resourceName:string, idOrInstance:string | number | Object, relations:string | Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + update(resourceName:string, id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise; + updateAll(resourceName:string, attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + reap(resourceName:string, options?:DSConfiguration):JSDataPromise; + refresh(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; + save(resourceName:string, id:string | number, options?:DSSaveConfiguration):JSDataPromise; - get(resourceName:string, id:string, options?:DSConfiguration):T; - get(resourceName:string, id:number, options?:DSConfiguration):T; - - getAll(resourceName:string, ids?:Array):Array; - getAll(resourceName:string, ids?:Array):Array; - - hasChanges(resourceName:string, id:string):boolean; - hasChanges(resourceName:string, id:number):boolean; - + // sync + changeHistory(resourceName:string, id?:string | number):Array; + changes(resourceName:string, id:string | number):Object; + compute(resourceName:string, idOrInstance:number | string | Object ):T; + createInstance(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T; + defineResource(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition; + digest():void; + eject(resourceName:string, id:string | number, options?:DSConfiguration):T; + ejectAll(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; + filter(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array; + get(resourceName:string, id:string | number, options?:DSConfiguration):T; + getAll(resourceName:string, ids?:Array):Array; + hasChanges(resourceName:string, id:string | number):boolean; inject(resourceName:string, attrs:T, options?:DSConfiguration):T; inject(resourceName:string, items:Array, options?:DSConfiguration):Array; - is(resourceName:string, object:Object): boolean; - - lastModified(resourceName:string, id?:string):number; // timestamp - lastModified(resourceName:string, id?:number):number; // timestamp - - lastSaved(resourceName:string, id?:string):number; // timestamp - lastSaved(resourceName:string, id?:number):number; // timestamp - - link(resourceName:string, id:string, relations?:Array):T; - link(resourceName:string, id:number, relations?:Array):T; - + lastModified(resourceName:string, id?:string | number):number; // timestamp + lastSaved(resourceName:string, id?:string | number):number; // timestamp + link(resourceName:string, id:string | number, relations?:Array):T; linkAll(resourceName:string, params:DSFilterParams, relations?:Array):T; - - linkInverse(resourceName:string, id:string, relations?:Array):T; - linkInverse(resourceName:string, id:number, relations?:Array):T; - - loadRelations(resourceName:string, id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, instance:Object, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(resourceName:string, instance:Object, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - - previous(resourceName:string, id:string):T; - previous(resourceName:string, id:number):T; - - reap(resourceName:string, options?:DSConfiguration):JSDataPromise; - - refresh(resourceName:string, id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - refresh(resourceName:string, id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; + linkInverse(resourceName:string, id:string | number, relations?:Array):T; + previous(resourceName:string, id:string | number):T; + unlinkInverse(resourceName:string, id:string | number, relations?:Array):T; registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void; - - save(resourceName:string, id:string, options?:DSSaveConfiguration):JSDataPromise; - save(resourceName:string, id:number, options?:DSSaveConfiguration):JSDataPromise; - - unlinkInverse(resourceName:string, id:string, relations?:Array):T; - unlinkInverse(resourceName:string, id:number, relations?:Array):T; - - update(resourceName:string, id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - update(resourceName:string, id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - - updateAll(resourceName:string, attrs:any, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; } interface DSConfiguration extends IDSResourceLifecycleEventHandlers { @@ -139,7 +86,7 @@ declare module JSData { // TODO enable when eagerInject in DS#create is implemented //eagerInject?: boolean; endpoint?: string; - error?: (message?:any, ...optionalParams:any[])=> void; + error?: boolean | ((message?:any, ...optionalParams:any[])=> void); fallbackAdapters?: Array; findAllFallbackAdapters?: Array; findAllStrategy?: string; @@ -150,15 +97,12 @@ declare module JSData { findInverseLinks?: boolean; findStrategy?: string idAttribute?: string; - ignoredChanges?: Array; + ignoredChanges?: Array; // TODO ignoreMissing is undocumented //ignoreMissing: boolean; keepChangeHistory?: boolean; loadFromServer?: boolean; - log?: any; - // TODO wait for union types to be supported - // log: (message?: any, ...optionalParams: any[])=> void; - // log: boolean; + log?: boolean | ((message?: any, ...optionalParams: any[])=> void); maxAge?: number; notify?: boolean; reapAction?: string; @@ -191,95 +135,41 @@ declare module JSData { interface DSResourceDefinition extends DSResourceDefinitionConfiguration { - changeHistory(id?:string):Array; - changeHistory(id?:number):Array; - - changes(id:string):Object; - changes(id:number):Object; - - compute(id:number):T; - compute(id:string):T; - compute(instance:Object):T; - - create(attrs:any, options?:DSConfiguration):JSDataPromise; - - createInstance(attrs?:T, options?:DSAdapterOperationConfiguration):T; - - defineResource(resourceName:string):DSResourceDefinition; - defineResource(definition:DSResourceDefinitionConfiguration):DSResourceDefinition; - - destroy(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - destroy(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + //async + create(attrs:Object, options?:DSConfiguration):JSDataPromise; + destroy(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; destroyAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise; - - digest():void; - - eject(id:string, options?:DSConfiguration):T; - eject(id:number, options?:DSConfiguration):T; - - ejectAll(params:DSFilterParams, options?:DSConfiguration):Array; - - filter(params:DSFilterParams, options?:DSConfiguration):Array; - - find(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - find(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - + find(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; findAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + loadRelations(idOrInstance:string | number | Object, relations:string | Array, options?:DSAdapterOperationConfiguration):JSDataPromise; + update(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise; + updateAll(attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + reap(resourceNametions?:DSConfiguration):JSDataPromise; + refresh(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise; + save(id:string | number, options?:DSSaveConfiguration):JSDataPromise; - get(id:string, options?:DSConfiguration):T; - get(id:number, options?:DSConfiguration):T; - - getAll(ids?:Array):Array; - getAll(ids?:Array):Array; - - hasChanges(id:string):boolean; - hasChanges(id:number):boolean; - + // sync + changeHistory(id?:string | number):Array; + changes(id:string | number):Object; + compute(idOrInstance:number | string | Object ):T; + createInstance(attrs?:T, options?:DSAdapterOperationConfiguration):T; + digest():void; + eject(id:string | number, options?:DSConfiguration):T; + ejectAll(params:DSFilterParams, options?:DSConfiguration):Array; + filter(params:DSFilterParams, options?:DSConfiguration):Array; + get(id:string | number, options?:DSConfiguration):T; + getAll(ids?:Array):Array; + hasChanges(id:string | number):boolean; inject(attrs:T, options?:DSConfiguration):T; inject(items:Array, options?:DSConfiguration):Array; - is(object:Object): boolean; - - lastModified(id?:string):number; // timestamp - lastModified(id?:number):number; // timestamp - - lastSaved(id?:string):number; // timestamp - lastSaved(id?:number):number; // timestamp - - link(id:string, relations?:Array):T; - link(id:number, relations?:Array):T; - + lastModified(id?:string | number):number; // timestamp + lastSaved(id?:string | number):number; // timestamp + link(id:string | number, relations?:Array):T; linkAll(params:DSFilterParams, relations?:Array):T; - - linkInverse(id:string, relations?:Array):T; - linkInverse(id:number, relations?:Array):T; - - loadRelations(id:string, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(id:number, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(instance:T, relations:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(id:string, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(id:number, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - loadRelations(instance:T, relations:Array, options?:DSAdapterOperationConfiguration):JSDataPromise; - - previous(id:string):T; - previous(id:number):T; - - reap(options?:DSConfiguration):JSDataPromise; - - refresh(id:string, options?:DSAdapterOperationConfiguration):JSDataPromise; - refresh(id:number, options?:DSAdapterOperationConfiguration):JSDataPromise; - - save(id:string, options?:DSSaveConfiguration):JSDataPromise; - save(id:number, options?:DSSaveConfiguration):JSDataPromise; - - unlinkInverse(id:string, relations?:Array):T; - unlinkInverse(id:number, relations?:Array):T; - - update(id:string, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - update(id:number, attrs:any, options?:DSSaveConfiguration):JSDataPromise; - - updateAll(attrs:any, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise>; + linkInverse(id:string | number, relations?:Array):T; + previous(id:string | number):T; + unlinkInverse(id:string | number, relations?:Array):T; } interface DSFilterParams { @@ -290,17 +180,8 @@ declare module JSData { skip?: number; offset?: number; - orderBy?: any; - // TODO wait for union types to be supported - //orderBy?: Array>; - //orderBy?: Array; - //orderBy?: string; - - sort?: any; - // TODO wait for union types to be supported - //sort?: string; - //sort?: Array; - //sort?: Array>; + orderBy?: string | Array | Array>; + sort?: string | Array | Array>; } interface IDSResourceLifecycleValidateEventHandlers { @@ -375,22 +256,19 @@ declare module JSData { // DSAdapter interface interface IDSAdapter { - create(config:DSResourceDefinition, attrs:any, options?:DSConfiguration):JSDataPromise; + create(config:DSResourceDefinition, attrs:Object, options?:DSConfiguration):JSDataPromise; - destroy(config:DSResourceDefinition, id:string, options?:DSConfiguration):JSDataPromise; - destroy(config:DSResourceDefinition, id:number, options?:DSConfiguration):JSDataPromise; + destroy(config:DSResourceDefinition, id:string | number, options?:DSConfiguration):JSDataPromise; destroyAll(config:DSResourceDefinition, params:DSFilterParams, options?:DSConfiguration):JSDataPromise; - find(config:DSResourceDefinition, id:string, options?:DSConfiguration):JSDataPromise; - find(config:DSResourceDefinition, id:number, options?:DSConfiguration):JSDataPromise; + find(config:DSResourceDefinition, id:string | number, options?:DSConfiguration):JSDataPromise; findAll(config:DSResourceDefinition, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; - update(config:DSResourceDefinition, id:string, attrs:any, options?:DSConfiguration):JSDataPromise; - update(config:DSResourceDefinition, id:number, attrs:any, options?:DSConfiguration):JSDataPromise; + update(config:DSResourceDefinition, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise; - updateAll(config:DSResourceDefinition, attrs:any, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; + updateAll(config:DSResourceDefinition, attrs:Object, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise; } } From 81b7aef410ee619ea6b3fdeac447fd0a2a91bacd Mon Sep 17 00:00:00 2001 From: reppners Date: Fri, 6 Mar 2015 09:10:15 +0100 Subject: [PATCH 56/78] + typings for extend including tests --- extend/extend-tests.ts | 41 +++++++++++++++++++++++++++++++++++++++++ extend/extend.d.ts | 9 +++++++++ 2 files changed, 50 insertions(+) create mode 100644 extend/extend-tests.ts create mode 100644 extend/extend.d.ts diff --git a/extend/extend-tests.ts b/extend/extend-tests.ts new file mode 100644 index 000000000..059aa22ba --- /dev/null +++ b/extend/extend-tests.ts @@ -0,0 +1,41 @@ +/// +/// + +import assert = require('assert'); +import extend = require('extend'); + +var objectBase = { + test: 'base' +}; + +var objectOne = { + test: 'one', + iamone: true +}; + +var objectTwo = { + test: 2, + iamtwo: true +}; + +var objectThree = { + iamthree: true, + depth: { + innerType: 'deep' + } +}; + +var extended = extend(objectBase, objectOne); +assert(extended.test === 'one'); +assert(extended.iamone === true); + +var moreExtended = extend(objectBase, objectOne, objectTwo); +assert(moreExtended.test === 2); +assert(moreExtended.iamone === true); +assert(moreExtended.iamtwo === true); + +var deepExtended = extend(true, objectBase, objectOne, objectTwo, objectThree); +assert(deepExtended.iamone === true); +assert(moreExtended.iamtwo === true); +assert(deepExtended.iamthree === true); +assert(deepExtended.depth.innerType === 'one'); \ No newline at end of file diff --git a/extend/extend.d.ts b/extend/extend.d.ts new file mode 100644 index 000000000..a6cb9151f --- /dev/null +++ b/extend/extend.d.ts @@ -0,0 +1,9 @@ +// Type definitions for Node.js v0.12.0 +// Project: http://nodejs.org/ +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyType +declare module "extend" { + + function extend(deepOrObject:boolean | Object, ...objectN: Object[]): any; + export = extend; +} \ No newline at end of file From aa219538851b3320999588e8c1482a4902c25113 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Fri, 6 Mar 2015 10:13:22 +0100 Subject: [PATCH 57/78] Add typings for timezonecomplete 1.13.0 --- .../timezonecomplete-1.12.0-tests.ts | 223 +++ timezonecomplete/timezonecomplete-1.12.0.d.ts | 1310 +++++++++++++++++ timezonecomplete/timezonecomplete-tests.ts | 1 + timezonecomplete/timezonecomplete.d.ts | 7 +- 4 files changed, 1540 insertions(+), 1 deletion(-) create mode 100644 timezonecomplete/timezonecomplete-1.12.0-tests.ts create mode 100644 timezonecomplete/timezonecomplete-1.12.0.d.ts diff --git a/timezonecomplete/timezonecomplete-1.12.0-tests.ts b/timezonecomplete/timezonecomplete-1.12.0-tests.ts new file mode 100644 index 000000000..8eb6015b7 --- /dev/null +++ b/timezonecomplete/timezonecomplete-1.12.0-tests.ts @@ -0,0 +1,223 @@ +/// + +import tc = require("timezonecomplete-1.12.0"); + +var b: boolean; +var n: number; +var s: string; +var w: tc.WeekDay; + +n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month); +b = tc.isLeapYear(2014); +n = tc.daysInMonth(2014, 10); +n = tc.daysInYear(2014); +n = tc.dayOfYear(2014, 1, 2); +w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); +w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); +n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); +n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); +n = tc.secondOfDay(13, 59, 59); +n = tc.weekOfMonth(2014, 1, 1); + +// DURATION + +var d: tc.Duration; +var d1: tc.Duration = tc.Duration.hours(24); +var d2: tc.Duration = tc.Duration.minutes(24); +var d3: tc.Duration = tc.Duration.seconds(24); +var d4: tc.Duration = tc.Duration.milliseconds(24); +var d5: tc.Duration = tc.hours(24); +var d6: tc.Duration = tc.minutes(24); +var d7: tc.Duration = tc.seconds(24); +var d8: tc.Duration = tc.milliseconds(24); +var d9: tc.Duration = new tc.Duration(24); +var d10: tc.Duration = new tc.Duration("00:01"); +var d11: tc.Duration = d6.clone(); +var d12: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second); + +n = d7.wholeHours(); +n = d7.hours(); +n = d7.minutes(); +n = d7.minute(); +n = d7.seconds(); +n = d7.second(); +n = d7.milliseconds(); +n = d7.millisecond(); +s = d7.sign(); +b = d7.lessThan(d6); +b = d7.greaterThan(d6); +d = d7.min(d6); +d = d7.max(d6); +d = d7.multiply(3); +d = d7.divide(0.3); +d = d7.add(d6); +d = d7.sub(d6); +s = d7.toString(); + +// TIMEZONE + +var t: tc.TimeZone; +var k: tc.TimeZoneKind; + +t = tc.TimeZone.local(); +t = tc.TimeZone.utc(); +t = tc.TimeZone.zone(2); +t = tc.TimeZone.zone("+01:00"); +t = tc.local(); +t = tc.utc(); +t = tc.zone(2); +t = tc.zone("+01:00"); +t = tc.zone("Europe/Amsterdam", false); +s = t.name(); +k = t.kind(); +b = t.equals(t); +b = t.isUtc(); +b = t.dst(); +n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); +n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); +n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); +n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); +s = t.toString(); +s = tc.TimeZone.offsetToString(2); +n = tc.TimeZone.stringToOffset("+00:01"); +b = t.equals(t); +b = t.identical(t); + +// REALTIMESOURCE + +var date: Date = (new tc.RealTimeSource()).now(); + +// DATETIME + +var dt: tc.DateTime; + +var ts: tc.TimeSource = tc.DateTime.timeSource; + +dt = tc.DateTime.nowLocal(); +dt = tc.DateTime.nowUtc(); +dt = tc.DateTime.now(tc.TimeZone.local()); +dt = tc.nowLocal(); +dt = tc.nowUtc(); +dt = tc.now(tc.TimeZone.local()); +dt = new tc.DateTime(); +dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); +dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); +dt = new tc.DateTime(date, tc.DateFunctions.Get); +dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); +dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); +dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); +dt = new tc.DateTime(89949284); +dt = new tc.DateTime(89949284, tc.TimeZone.utc()); +dt = dt.clone(); +t = dt.zone(); +n = dt.offset(); +n = dt.year(); +n = dt.month(); +n = dt.day(); +n = dt.hour(); +n = dt.minute(); +n = dt.second(); +n = dt.weekNumber(); +n = dt.weekOfMonth(); +n = dt.secondOfDay(); +n = dt.dayOfYear(); +n = dt.millisecond(); +n = dt.unixUtcMillis(); +n = dt.utcYear(); +n = dt.utcMonth(); +n = dt.utcDay(); +n = dt.utcHour(); +n = dt.utcMinute(); +n = dt.utcSecond(); +n = dt.utcMillisecond(); +n = dt.utcWeekNumber(); +n = dt.utcWeekOfMonth(); +n = dt.utcSecondOfDay(); +n = dt.utcDayOfYear(); +s = dt.format("%Y-%m-%d"); +dt.convert(tc.TimeZone.local()); +dt = dt.toZone(tc.TimeZone.utc()); +date = dt.toDate(); +dt = dt.add(tc.Duration.seconds(2)); +dt = dt.add(2, tc.TimeUnit.Year); +dt = dt.add(2, tc.TimeUnit.Month); +dt = dt.add(2, tc.TimeUnit.Week); +dt = dt.add(2, tc.TimeUnit.Day); +dt = dt.add(2, tc.TimeUnit.Hour); +dt = dt.add(2, tc.TimeUnit.Minute); +dt = dt.add(2, tc.TimeUnit.Second); +dt = dt.addLocal(2, tc.TimeUnit.Second); +dt = dt.sub(tc.Duration.seconds(2)); +dt = dt.sub(2, tc.TimeUnit.Year); +dt = dt.sub(2, tc.TimeUnit.Month); +dt = dt.sub(2, tc.TimeUnit.Week); +dt = dt.sub(2, tc.TimeUnit.Day); +dt = dt.sub(2, tc.TimeUnit.Hour); +dt = dt.sub(2, tc.TimeUnit.Minute); +dt = dt.sub(2, tc.TimeUnit.Second); +dt = dt.subLocal(2, tc.TimeUnit.Second); +d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); +b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); +b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); +b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); +b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); +dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); +dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); +s = dt.toIsoString(); +s = dt.toString(); +s = dt.toUtcString(); +dt = dt.startOfDay(); + +var wd: tc.WeekDay; +wd = dt.weekDay(); +wd = dt.utcWeekDay(); + +// PERIOD + +s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); +s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); + +var p: tc.Period; + +p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); +dt = p.start(); +n = p.amount(); +var tu: tc.TimeUnit = p.unit(); +var pd: tc.PeriodDst = p.dst(); +dt = p.findFirst(tc.DateTime.nowLocal()); +dt = p.findNext(dt); +s = p.toIsoString(); +s = p.toString(); +b = p.isBoundary(dt); +b = p.equals(p); +b = p.identical(p); + + +// GLOBALS +d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); +d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); + +dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); +dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); + + + + + + + + + + + + + + + + + + + + + + diff --git a/timezonecomplete/timezonecomplete-1.12.0.d.ts b/timezonecomplete/timezonecomplete-1.12.0.d.ts new file mode 100644 index 000000000..97ce750e2 --- /dev/null +++ b/timezonecomplete/timezonecomplete-1.12.0.d.ts @@ -0,0 +1,1310 @@ +// Type definitions for timezonecomplete 1.12.0 +// Project: https://github.com/SpiritIT/timezonecomplete +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Generated by dts-bundle v0.2.0 + +declare module 'timezonecomplete-1.12.0' { + import basics = require("__timezonecomplete/basics"); + export import TimeUnit = basics.TimeUnit; + export import WeekDay = basics.WeekDay; + export import timeUnitToMilliseconds = basics.timeUnitToMilliseconds; + export import isLeapYear = basics.isLeapYear; + export import daysInMonth = basics.daysInMonth; + export import daysInYear = basics.daysInYear; + export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; + export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; + export import weekDayOnOrAfter = basics.weekDayOnOrAfter; + export import weekDayOnOrBefore = basics.weekDayOnOrBefore; + export import weekNumber = basics.weekNumber; + export import weekOfMonth = basics.weekOfMonth; + export import dayOfYear = basics.dayOfYear; + export import secondOfDay = basics.secondOfDay; + import datetime = require("__timezonecomplete/datetime"); + export import DateTime = datetime.DateTime; + export import now = datetime.now; + export import nowLocal = datetime.nowLocal; + export import nowUtc = datetime.nowUtc; + import duration = require("__timezonecomplete/duration"); + export import Duration = duration.Duration; + export import hours = duration.hours; + export import minutes = duration.minutes; + export import seconds = duration.seconds; + export import milliseconds = duration.milliseconds; + import javascript = require("__timezonecomplete/javascript"); + export import DateFunctions = javascript.DateFunctions; + import period = require("__timezonecomplete/period"); + export import Period = period.Period; + export import PeriodDst = period.PeriodDst; + export import periodDstToString = period.periodDstToString; + import timesource = require("__timezonecomplete/timesource"); + export import TimeSource = timesource.TimeSource; + export import RealTimeSource = timesource.RealTimeSource; + import timezone = require("__timezonecomplete/timezone"); + export import NormalizeOption = timezone.NormalizeOption; + export import TimeZoneKind = timezone.TimeZoneKind; + export import TimeZone = timezone.TimeZone; + export import local = timezone.local; + export import utc = timezone.utc; + export import zone = timezone.zone; + import globals = require("__timezonecomplete/globals"); + export import min = globals.min; + export import max = globals.max; +} + +declare module '__timezonecomplete/basics' { + import javascript = require("__timezonecomplete/javascript"); + /** + * Day-of-week. Note the enum values correspond to JavaScript day-of-week: + * Sunday = 0, Monday = 1 etc + */ + export enum WeekDay { + Sunday = 0, + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6, + } + /** + * Time units + */ + export enum TimeUnit { + Second = 0, + Minute = 1, + Hour = 2, + Day = 3, + Week = 4, + Month = 5, + Year = 6, + } + /** + * Approximate number of milliseconds for a time unit. + * A day is assumed to have 24 hours, a month is assumed to equal 30 days + * and a year is set to 365 days. + * + * @param unit Time unit e.g. TimeUnit.Month + * @returns The number of milliseconds. + */ + export function timeUnitToMilliseconds(unit: TimeUnit): number; + /** + * @return True iff the given year is a leap year. + */ + export function isLeapYear(year: number): boolean; + /** + * The days in a given year + */ + export function daysInYear(year: number): number; + /** + * @param year The full year + * @param month The month 1-12 + * @return The number of days in the given month + */ + export function daysInMonth(year: number, month: number): number; + /** + * Returns the day of the year of the given date [0..365]. January first is 0. + * + * @param year The year e.g. 1986 + * @param month Month 1-12 + * @param day Day of month 1-31 + */ + export function dayOfYear(year: number, month: number, day: number): number; + /** + * Returns the last instance of the given weekday in the given month + * + * @param year The year + * @param month the month 1-12 + * @param weekDay the desired week day + * + * @return the last occurrence of the week day in the month + */ + export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; + /** + * Returns the first instance of the given weekday in the given month + * + * @param year The year + * @param month the month 1-12 + * @param weekDay the desired week day + * + * @return the first occurrence of the week day in the month + */ + export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; + /** + * Returns the day-of-month that is on the given weekday and which is >= the given day. + * Throws if the month has no such day. + */ + export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; + /** + * Returns the day-of-month that is on the given weekday and which is <= the given day. + * Throws if the month has no such day. + */ + export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; + /** + * The week of this month. There is no official standard for this, + * but we assume the same rules for the weekNumber (i.e. + * week 1 is the week that has the 4th day of the month in it) + * + * @param year The year + * @param month The month [1-12] + * @param day The day [1-31] + * @return Week number [1-5] + */ + export function weekOfMonth(year: number, month: number, day: number): number; + /** + * The ISO 8601 week number for the given date. Week 1 is the week + * that has January 4th in it, and it starts on Monday. + * See https://en.wikipedia.org/wiki/ISO_week_date + * + * @param year Year e.g. 1988 + * @param month Month 1-12 + * @param day Day of month 1-31 + * + * @return Week number 1-53 + */ + export function weekNumber(year: number, month: number, day: number): number; + /** + * Convert a unix milli timestamp into a TimeT structure. + * This does NOT take leap seconds into account. + */ + export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; + /** + * Convert a year, month, day etc into a unix milli timestamp. + * This does NOT take leap seconds into account. + * + * @param year Year e.g. 1970 + * @param month Month 1-12 + * @param day Day 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 (no leap seconds) + * @param milli Millisecond 0-999 + */ + export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; + /** + * Convert a TimeT structure into a unix milli timestamp. + * This does NOT take leap seconds into account. + */ + export function timeToUnixNoLeapSecs(tm: TimeStruct): number; + /** + * Return the day-of-week. + * This does NOT take leap seconds into account. + */ + export function weekDayNoLeapSecs(unixMillis: number): WeekDay; + /** + * N-th second in the day, counting from 0 + */ + export function secondOfDay(hour: number, minute: number, second: number): number; + /** + * Basic representation of a date and time + */ + export class TimeStruct { + /** + * Year, 1970-... + */ + year: number; + /** + * Month 1-12 + */ + month: number; + /** + * Day of month, 1-31 + */ + day: number; + /** + * Hour 0-23 + */ + hour: number; + /** + * Minute 0-59 + */ + minute: number; + /** + * Seconds, 0-59 + */ + second: number; + /** + * Milliseconds 0-999 + */ + milli: number; + /** + * Create a TimeStruct from a number of unix milliseconds + */ + static fromUnix(unixMillis: number): TimeStruct; + /** + * Create a TimeStruct from a JavaScript date + * + * @param d The date + * @param df Which functions to take (getX() or getUTCX()) + */ + static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; + /** + * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone + */ + static fromString(s: string): TimeStruct; + /** + * Constructor + * + * @param year Year e.g. 1970 + * @param month Month 1-12 + * @param day Day 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 (no leap seconds) + * @param milli Millisecond 0-999 + */ + constructor(/** + * Year, 1970-... + */ + year?: number, /** + * Month 1-12 + */ + month?: number, /** + * Day of month, 1-31 + */ + day?: number, /** + * Hour 0-23 + */ + hour?: number, /** + * Minute 0-59 + */ + minute?: number, /** + * Seconds, 0-59 + */ + second?: number, /** + * Milliseconds 0-999 + */ + milli?: number); + /** + * Validate a TimeStruct, returns false if invalid. + */ + validate(): boolean; + /** + * The day-of-year 0-365 + */ + yearDay(): number; + /** + * Returns this time as a unix millisecond timestamp + * Does NOT take leap seconds into account. + */ + toUnixNoLeapSecs(): number; + /** + * Deep equals + */ + equals(other: TimeStruct): boolean; + /** + * < operator + */ + lessThan(other: TimeStruct): boolean; + clone(): TimeStruct; + valueOf(): number; + /** + * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn + */ + toString(): string; + inspect(): string; + } +} + +declare module '__timezonecomplete/datetime' { + import basics = require("__timezonecomplete/basics"); + import duration = require("__timezonecomplete/duration"); + import timesource = require("__timezonecomplete/timesource"); + import javascript = require("__timezonecomplete/javascript"); + import timezone = require("__timezonecomplete/timezone"); + /** + * Current date+time in local time + */ + export function nowLocal(): DateTime; + /** + * Current date+time in UTC time + */ + export function nowUtc(): DateTime; + /** + * Current date+time in the given time zone + * @param timeZone The desired time zone (optional, defaults to UTC). + */ + export function now(timeZone?: timezone.TimeZone): DateTime; + /** + * DateTime class which is time zone-aware + * and which can be mocked for testing purposes. + */ + export class DateTime { + /** + * Actual time source in use. Setting this property allows to + * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() + * use this property for obtaining the current time. + */ + static timeSource: timesource.TimeSource; + /** + * Current date+time in local time + */ + static nowLocal(): DateTime; + /** + * Current date+time in UTC time + */ + static nowUtc(): DateTime; + /** + * Current date+time in the given time zone + * @param timeZone The desired time zone (optional, defaults to UTC). + */ + static now(timeZone?: timezone.TimeZone): DateTime; + /** + * Constructor. Creates current time in local timezone. + */ + constructor(); + /** + * Constructor + * Non-existing local times are normalized by rounding up to the next DST offset. + * + * @param isoString String in ISO 8601 format. Instead of ISO time zone, + * it may include a space and then and IANA time zone. + * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) + * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) + * or "2007-04-05T12:30:40.500Z" (UTC) + * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) + * @param timeZone if given, the date in the string is assumed to be in this time zone. + * Note that it is NOT CONVERTED to the time zone. Useful + * for strings without a time zone + */ + constructor(isoString: string, timeZone?: timezone.TimeZone); + /** + * Constructor. You provide a date, then you say whether to take the + * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, + * and then you state which time zone that date is in. + * Non-existing local times are normalized by rounding up to the next DST offset. + * Note that the Date class has bugs and inconsistencies when constructing them with times around + * DST changes. + * + * @param date A date object. + * @param getters Specifies which set of Date getters contains the date in the given time zone: the + * Date.getXxx() methods or the Date.getUTCXxx() methods. + * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) + */ + constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); + /** + * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. + * Use the add(duration) or sub(duration) for arithmetic. + * @param year The full year (e.g. 2014) + * @param month The month [1-12] (note this deviates from JavaScript Date) + * @param day The day of the month [1-31] + * @param hour The hour of the day [0-24) + * @param minute The minute of the hour [0-59] + * @param second The second of the minute [0-59] + * @param millisecond The millisecond of the second [0-999] + * @param timeZone The time zone, or null (for unaware dates) + */ + constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); + /** + * Constructor + * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 + * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). + */ + constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); + /** + * @return a copy of this object + */ + clone(): DateTime; + /** + * @return The time zone that the date is in. May be null for unaware dates. + */ + zone(): timezone.TimeZone; + /** + * Zone name abbreviation at this time + * @param dstDependent (default true) set to false for a DST-agnostic abbreviation + * @return The abbreviation + */ + zoneAbbreviation(dstDependent?: boolean): string; + /** + * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. + */ + offset(): number; + /** + * @return The full year e.g. 2014 + */ + year(): number; + /** + * @return The month 1-12 (note this deviates from JavaScript Date) + */ + month(): number; + /** + * @return The day of the month 1-31 + */ + day(): number; + /** + * @return The hour 0-23 + */ + hour(): number; + /** + * @return the minutes 0-59 + */ + minute(): number; + /** + * @return the seconds 0-59 + */ + second(): number; + /** + * @return the milliseconds 0-999 + */ + millisecond(): number; + /** + * @return the day-of-week (the enum values correspond to JavaScript + * week day numbers) + */ + weekDay(): basics.WeekDay; + /** + * Returns the day number within the year: Jan 1st has number 0, + * Jan 2nd has number 1 etc. + * + * @return the day-of-year [0-366] + */ + dayOfYear(): number; + /** + * The ISO 8601 week number. Week 1 is the week + * that has January 4th in it, and it starts on Monday. + * See https://en.wikipedia.org/wiki/ISO_week_date + * + * @return Week number [1-53] + */ + weekNumber(): number; + /** + * The week of this month. There is no official standard for this, + * but we assume the same rules for the weekNumber (i.e. + * week 1 is the week that has the 4th day of the month in it) + * + * @return Week number [1-5] + */ + weekOfMonth(): number; + /** + * Returns the number of seconds that have passed on the current day + * Does not consider leap seconds + * + * @return seconds [0-86399] + */ + secondOfDay(): number; + /** + * @return Milliseconds since 1970-01-01T00:00:00.000Z + */ + unixUtcMillis(): number; + /** + * @return The full year e.g. 2014 + */ + utcYear(): number; + /** + * @return The UTC month 1-12 (note this deviates from JavaScript Date) + */ + utcMonth(): number; + /** + * @return The UTC day of the month 1-31 + */ + utcDay(): number; + /** + * @return The UTC hour 0-23 + */ + utcHour(): number; + /** + * @return The UTC minutes 0-59 + */ + utcMinute(): number; + /** + * @return The UTC seconds 0-59 + */ + utcSecond(): number; + /** + * Returns the UTC day number within the year: Jan 1st has number 0, + * Jan 2nd has number 1 etc. + * + * @return the day-of-year [0-366] + */ + utcDayOfYear(): number; + /** + * @return The UTC milliseconds 0-999 + */ + utcMillisecond(): number; + /** + * @return the UTC day-of-week (the enum values correspond to JavaScript + * week day numbers) + */ + utcWeekDay(): basics.WeekDay; + /** + * The ISO 8601 UTC week number. Week 1 is the week + * that has January 4th in it, and it starts on Monday. + * See https://en.wikipedia.org/wiki/ISO_week_date + * + * @return Week number [1-53] + */ + utcWeekNumber(): number; + /** + * The week of this month. There is no official standard for this, + * but we assume the same rules for the weekNumber (i.e. + * week 1 is the week that has the 4th day of the month in it) + * + * @return Week number [1-5] + */ + utcWeekOfMonth(): number; + /** + * Returns the number of seconds that have passed on the current day + * Does not consider leap seconds + * + * @return seconds [0-86399] + */ + utcSecondOfDay(): number; + /** + * Convert this date to the given time zone (in-place). + * Throws if this date does not have a time zone. + * @return this (for chaining) + */ + convert(zone?: timezone.TimeZone): DateTime; + /** + * Returns this date converted to the given time zone. + * Unaware dates can only be converted to unaware dates (clone) + * Converting an unaware date to an aware date throws an exception. Use the constructor + * if you really need to do that. + * + * @param zone The new time zone. This may be null to create unaware date. + * @return The converted date + */ + toZone(zone?: timezone.TimeZone): DateTime; + /** + * Convert to JavaScript date with the zone time in the getX() methods. + * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. + * This is because Date calculates getUTCX() from getX() applying local time zone. + */ + toDate(): Date; + /** + * Add a time duration relative to UTC. Note that this simply adds a number + * of milliseconds to UTC and converts back to zone(), + * There is not DST handling. + * @return this + duration + */ + add(duration: duration.Duration): DateTime; + /** + * Add an amount of time relative to UTC, as regularly as possible. + * + * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month + * increments the utcMonth() field. + * Adding an amount of units leaves lower units intact. E.g. + * adding a month will leave the day() field untouched if possible. + * + * Note adding Months or Years will clamp the date to the end-of-month if + * the start date was at the end of a month, i.e. contrary to JavaScript + * Date#setUTCMonth() it will not overflow into the next month + * + * In case of DST changes, the utc time fields are still untouched but local + * time fields may shift. + */ + add(amount: number, unit: basics.TimeUnit): DateTime; + /** + * Add an amount of time to the zone time, as regularly as possible. + * + * Adding e.g. 1 hour will increment the hour() field of the zone + * date by one. In case of DST changes, the time fields may additionally + * increase by the DST offset, if a non-existing local time would + * be reached otherwise. + * + * Adding a unit of time will leave lower-unit fields intact, unless the result + * would be a non-existing time. Then an extra DST offset is added. + * + * Note adding Months or Years will clamp the date to the end-of-month if + * the start date was at the end of a month, i.e. contrary to JavaScript + * Date#setUTCMonth() it will not overflow into the next month + */ + addLocal(amount: number, unit: basics.TimeUnit): DateTime; + /** + * Same as add(-1*duration); + */ + sub(duration: duration.Duration): DateTime; + /** + * Same as add(-1*amount, unit); + */ + sub(amount: number, unit: basics.TimeUnit): DateTime; + /** + * Same as addLocal(-1*amount, unit); + */ + subLocal(amount: number, unit: basics.TimeUnit): DateTime; + /** + * Time difference between two DateTimes + * @return this - other + */ + diff(other: DateTime): duration.Duration; + /** + * Chops off the time part, yields the same date at 00:00:00.000 + * @return a new DateTime + */ + startOfDay(): DateTime; + /** + * @return True iff (this < other) + */ + lessThan(other: DateTime): boolean; + /** + * @return True iff (this <= other) + */ + lessEqual(other: DateTime): boolean; + /** + * @return True iff this and other represent the same moment in time in UTC + */ + equals(other: DateTime): boolean; + /** + * @return True iff this and other represent the same time and the same zone + */ + identical(other: DateTime): boolean; + /** + * @return True iff this > other + */ + greaterThan(other: DateTime): boolean; + /** + * @return True iff this >= other + */ + greaterEqual(other: DateTime): boolean; + /** + * @return The minimum of this and other + */ + min(other: DateTime): DateTime; + /** + * @return The maximum of this and other + */ + max(other: DateTime): DateTime; + /** + * Proper ISO 8601 format string with any IANA zone converted to ISO offset + * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam + */ + toIsoString(): string; + /** + * Return a string representation of the DateTime according to the + * specified format. The format is implemented as the LDML standard + * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) + * + * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") + * @return The string representation of this DateTime + */ + format(formatString: string): string; + /** + * Modified ISO 8601 format string with IANA name if applicable. + * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + /** + * The valueOf() method returns the primitive value of the specified object. + */ + valueOf(): any; + /** + * Modified ISO 8601 format string in UTC without time zone info + */ + toUtcString(): string; + } +} + +declare module '__timezonecomplete/duration' { + import basics = require("__timezonecomplete/basics"); + /** + * Construct a time duration + * @param n Number of hours (may be fractional or negative) + * @return A duration of n hours + */ + export function hours(n: number): Duration; + /** + * Construct a time duration + * @param n Number of minutes (may be fractional or negative) + * @return A duration of n minutes + */ + export function minutes(n: number): Duration; + /** + * Construct a time duration + * @param n Number of seconds (may be fractional or negative) + * @return A duration of n seconds + */ + export function seconds(n: number): Duration; + /** + * Construct a time duration + * @param n Number of milliseconds (may be fractional or negative) + * @return A duration of n milliseconds + */ + export function milliseconds(n: number): Duration; + /** + * Time duration. Create one e.g. like this: var d = Duration.hours(1). + * Note that time durations do not take leap seconds etc. into account: + * one hour is simply represented as 3600000 milliseconds. + */ + export class Duration { + /** + * Construct a time duration + * @param n Number of hours (may be fractional or negative) + * @return A duration of n hours + */ + static hours(n: number): Duration; + /** + * Construct a time duration + * @param n Number of minutes (may be fractional or negative) + * @return A duration of n minutes + */ + static minutes(n: number): Duration; + /** + * Construct a time duration + * @param n Number of seconds (may be fractional or negative) + * @return A duration of n seconds + */ + static seconds(n: number): Duration; + /** + * Construct a time duration + * @param n Number of milliseconds (may be fractional or negative) + * @return A duration of n milliseconds + */ + static milliseconds(n: number): Duration; + /** + * Construct a time duration of 0 + */ + constructor(); + /** + * Construct a time duration from a number of milliseconds + */ + constructor(milliseconds: number); + /** + * Construct a time duration from a string in format + * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 + */ + constructor(input: string); + /** + * Construct a duration from an amount and a time unit. + * @param amount Number of units + * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. + */ + constructor(amount: number, unit: basics.TimeUnit); + /** + * @return another instance of Duration with the same value. + */ + clone(): Duration; + /** + * The entire duration in milliseconds (negative or positive) + */ + milliseconds(): number; + /** + * The millisecond part of the duration (always positive) + * @return e.g. 400 for a -01:02:03.400 duration + */ + millisecond(): number; + /** + * The entire duration in seconds (negative or positive, fractional) + * @return e.g. 1.5 for a 1500 milliseconds duration + */ + seconds(): number; + /** + * The second part of the duration (always positive) + * @return e.g. 3 for a -01:02:03.400 duration + */ + second(): number; + /** + * The entire duration in minutes (negative or positive, fractional) + * @return e.g. 1.5 for a 90000 milliseconds duration + */ + minutes(): number; + /** + * The minute part of the duration (always positive) + * @return e.g. 2 for a -01:02:03.400 duration + */ + minute(): number; + /** + * The entire duration in hours (negative or positive, fractional) + * @return e.g. 1.5 for a 5400000 milliseconds duration + */ + hours(): number; + /** + * The hour part of the duration (always positive). + * Note that this part can exceed 23 hours, because for + * now, we do not have a days() function + * @return e.g. 25 for a -25:02:03.400 duration + */ + wholeHours(): number; + /** + * Sign + * @return "-" if the duration is negative + */ + sign(): string; + /** + * @return True iff (this < other) + */ + lessThan(other: Duration): boolean; + /** + * @return True iff (this <= other) + */ + lessEqual(other: Duration): boolean; + /** + * @return True iff this and other represent the same time duration + */ + equals(other: Duration): boolean; + /** + * @return True iff this > other + */ + greaterThan(other: Duration): boolean; + /** + * @return True iff this >= other + */ + greaterEqual(other: Duration): boolean; + /** + * @return The minimum (most negative) of this and other + */ + min(other: Duration): Duration; + /** + * @return The maximum (most positive) of this and other + */ + max(other: Duration): Duration; + /** + * Multiply with a fixed number. + * @return a new Duration of (this * value) + */ + multiply(value: number): Duration; + /** + * Divide by a fixed number. + * @return a new Duration of (this / value) + */ + divide(value: number): Duration; + /** + * Add a duration. + * @return a new Duration of (this + value) + */ + add(value: Duration): Duration; + /** + * Subtract a duration. + * @return a new Duration of (this - value) + */ + sub(value: Duration): Duration; + /** + * String in [-]hh:mm:ss.nnn notation. All fields are + * always present except the sign. + */ + toFullString(): string; + /** + * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are + * added as necessary + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + /** + * The valueOf() method returns the primitive value of the specified object. + */ + valueOf(): any; + } +} + +declare module '__timezonecomplete/javascript' { + /** + * Indicates how a Date object should be interpreted. + * Either we can take getYear(), getMonth() etc for our field + * values, or we can take getUTCYear(), getUtcMonth() etc to do that. + */ + export enum DateFunctions { + /** + * Use the Date.getFullYear(), Date.getMonth(), ... functions. + */ + Get = 0, + /** + * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. + */ + GetUTC = 1, + } +} + +declare module '__timezonecomplete/period' { + import basics = require("__timezonecomplete/basics"); + import datetime = require("__timezonecomplete/datetime"); + /** + * Specifies how the period should repeat across the day + * during DST changes. + */ + export enum PeriodDst { + /** + * Keep repeating in similar intervals measured in UTC, + * unaffected by Daylight Saving Time. + * E.g. a repetition of one hour will take one real hour + * every time, even in a time zone with DST. + * Leap seconds, leap days and month length + * differences will still make the intervals different. + */ + RegularIntervals = 0, + /** + * Ensure that the time at which the intervals occur stay + * at the same place in the day, local time. So e.g. + * a period of one day, starting at 8:05AM Europe/Amsterdam time + * will always start at 8:05 Europe/Amsterdam. This means that + * in UTC time, some intervals will be 25 hours and some + * 23 hours during DST changes. + * Another example: an hourly interval will be hourly in local time, + * skipping an hour in UTC for a DST backward change. + */ + RegularLocalTime = 1, + } + /** + * Convert a PeriodDst to a string: "regular intervals" or "regular local time" + */ + export function periodDstToString(p: PeriodDst): string; + /** + * Repeating time period: consists of a starting point and + * a time length. This class accounts for leap seconds and leap days. + */ + export class Period { + /** + * Constructor + * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, + * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. + * This is due to the enormous processing power required by these cases. They are not + * implemented and you will get an assert. + * + * @param start The start of the period. If the period is in Months or Years, and + * the day is 29 or 30 or 31, the results are maximised to end-of-month. + * @param amount The amount of units. + * @param unit The unit. + * @param dst Specifies how to handle Daylight Saving Time. Not relevant + * if the time zone of the start datetime does not have DST. + * Defaults to RegularLocalTime. + */ + constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst?: PeriodDst); + /** + * The start date + */ + start(): datetime.DateTime; + /** + * The amount of units + */ + amount(): number; + /** + * The unit + */ + unit(): basics.TimeUnit; + /** + * The dst handling mode + */ + dst(): PeriodDst; + /** + * The first occurrence of the period greater than + * the given date. The given date need not be at a period boundary. + * Pre: the fromdate and startdate must either both have timezones or not + * @param fromDate: the date after which to return the next date + * @return the first date matching the period after fromDate, given + * in the same zone as the fromDate. + */ + findFirst(fromDate: datetime.DateTime): datetime.DateTime; + /** + * Returns the next timestamp in the period. The given timestamp must + * be at a period boundary, otherwise the answer is incorrect. + * This function has MUCH better performance than findFirst. + * Returns the datetime "count" times away from the given datetime. + * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. + * @param count Optional, must be >= 1 and whole. + * @return (prev + count * period), in the same timezone as prev. + */ + findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; + /** + * Checks whether the given date is on a period boundary + * (expensive!) + */ + isBoundary(occurrence: datetime.DateTime): boolean; + /** + * Returns true iff this period has the same effect as the given one. + * i.e. a period of 24 hours is equal to one of 1 day if they have the same UTC start moment + * and same dst. + */ + equals(other: Period): boolean; + /** + * Returns true iff this period was constructed with identical arguments to the other one. + */ + identical(other: Period): boolean; + /** + * Returns an ISO duration string e.g. + * 2014-01-01T12:00:00.000+01:00/P1H + * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) + * 2014-01-01T12:00:00.000+01:00/P1M (one month) + */ + toIsoString(): string; + /** + * A string representation e.g. + * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + } +} + +declare module '__timezonecomplete/timesource' { + /** + * For testing purposes, we often need to manipulate what the current + * time is. This is an interface for a custom time source object + * so in tests you can use a custom time source. + */ + export interface TimeSource { + /** + * Return the current date+time as a javascript Date object + */ + now(): Date; + } + /** + * Default time source, returns actual time + */ + export class RealTimeSource implements TimeSource { + now(): Date; + } +} + +declare module '__timezonecomplete/timezone' { + import javascript = require("__timezonecomplete/javascript"); + /** + * The local time zone for a given date as per OS settings. Note that time zones are cached + * so you don't necessarily get a new object each time. + */ + export function local(): TimeZone; + /** + * Coordinated Universal Time zone. Note that time zones are cached + * so you don't necessarily get a new object each time. + */ + export function utc(): TimeZone; + /** + * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached + * so you don't necessarily get a new object each time. + * @returns a time zone with the given fixed offset + */ + export function zone(offset: number): TimeZone; + /** + * Time zone for an offset string or an IANA time zone string. Note that time zones are cached + * so you don't necessarily get a new object each time. + * @param s Empty string for no time zone (null is returned), + * "localtime" for local time, + * a TZ database time zone name (e.g. Europe/Amsterdam), + * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: + * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for + * "localtime", timezonecomplete will adhere to the computer settings, the DST flag + * does not have any effect. + */ + export function zone(name: string, dst?: boolean): TimeZone; + /** + * The type of time zone + */ + export enum TimeZoneKind { + /** + * Local time offset as determined by JavaScript Date class. + */ + Local = 0, + /** + * Fixed offset from UTC, without DST. + */ + Offset = 1, + /** + * IANA timezone managed through Olsen TZ database. Includes + * DST if applicable. + */ + Proper = 2, + } + /** + * Option for TimeZone#normalizeLocal() + */ + export enum NormalizeOption { + /** + * Normalize non-existing times by ADDING the DST offset + */ + Up = 0, + /** + * Normalize non-existing times by SUBTRACTING the DST offset + */ + Down = 1, + } + /** + * Time zone. The object is immutable because it is cached: + * requesting a time zone twice yields the very same object. + * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), + * i.e. offset 90 means +01:30. + * + * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, + * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST + * applied depending on the time zone rules. + */ + export class TimeZone { + /** + * The local time zone for a given date. Note that + * the time zone varies with the date: amsterdam time for + * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 + */ + static local(): TimeZone; + /** + * The UTC time zone. + */ + static utc(): TimeZone; + /** + * Time zone with a fixed offset + * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30 + */ + static zone(offset: number): TimeZone; + /** + * Time zone for an offset string or an IANA time zone string. Note that time zones are cached + * so you don't necessarily get a new object each time. + * @param s Empty string for no time zone (null is returned), + * "localtime" for local time, + * a TZ database time zone name (e.g. Europe/Amsterdam), + * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: + * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for + * "localtime", timezonecomplete will adhere to the computer settings, the DST flag + * does not have any effect. + */ + static zone(s: string, dst?: boolean): TimeZone; + /** + * Do not use this constructor, use the static + * TimeZone.zone() method instead. + * @param name NORMALIZED name, assumed to be correct + * @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets + */ + constructor(name: string, dst?: boolean); + /** + * The time zone identifier. Can be an offset "-01:30" or an + * IANA time zone name "Europe/Amsterdam", or "localtime" for + * the local time zone. + */ + name(): string; + dst(): boolean; + /** + * The kind of time zone (Local/Offset/Proper) + */ + kind(): TimeZoneKind; + /** + * Equality operator. Maps zero offsets and different names for UTC onto + * each other. Other time zones are not mapped onto each other. + */ + equals(other: TimeZone): boolean; + /** + * Returns true iff the constructor arguments were identical, so UTC !== GMT + */ + identical(other: TimeZone): boolean; + /** + * Is this zone equivalent to UTC? + */ + isUtc(): boolean; + /** + * Does this zone have Daylight Saving Time at all? + */ + hasDst(): boolean; + /** + * Calculate timezone offset from a UTC time. + * + * @param year Full year + * @param month Month 1-12 (note this deviates from JavaScript date) + * @param day Day of month 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 + * @param millisecond Millisecond 0-999 + * + * @return the offset of this time zone with respect to UTC at the given time, in minutes. + */ + offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; + /** + * Calculate timezone offset from a zone-local time (NOT a UTC time). + * @param year local full year + * @param month local month 1-12 (note this deviates from JavaScript date) + * @param day local day of month 1-31 + * @param hour local hour 0-23 + * @param minute local minute 0-59 + * @param second local second 0-59 + * @param millisecond local millisecond 0-999 + * @return the offset of this time zone with respect to UTC at the given time, in minutes. + */ + offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; + /** + * Note: will be removed in version 2.0.0 + * + * Convenience function, takes values from a Javascript Date + * Calls offsetForUtc() with the contents of the date + * + * @param date: the date + * @param funcs: the set of functions to use: get() or getUTC() + */ + offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; + /** + * Note: will be removed in version 2.0.0 + * + * Convenience function, takes values from a Javascript Date + * Calls offsetForUtc() with the contents of the date + * + * @param date: the date + * @param funcs: the set of functions to use: get() or getUTC() + */ + offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; + /** + * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. + * + * @param year Full year + * @param month Month 1-12 (note this deviates from JavaScript date) + * @param day Day of month 1-31 + * @param hour Hour 0-23 + * @param minute Minute 0-59 + * @param second Second 0-59 + * @param millisecond Millisecond 0-999 + * @param dstDependent (default true) set to false for a DST-agnostic abbreviation + * + * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. + */ + abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; + /** + * Normalizes non-existing local times by adding a forward offset change. + * During a forward standard offset change or DST offset change, some amount of + * local time is skipped. Therefore, this amount of local time does not exist. + * This function adds the amount of forward change to any non-existing time. After all, + * this is probably what the user meant. + * + * @param localUnixMillis Unix timestamp in zone time + * @param opt (optional) Round up or down? Default: up + * + * @returns Unix timestamp in zone time, normalized. + */ + normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; + /** + * The time zone identifier (normalized). + * Either "localtime", IANA name, or "+hh:mm" offset. + */ + toString(): string; + /** + * Used by util.inspect() + */ + inspect(): string; + /** + * Convert an offset number into an offset string + * @param offset The offset in minutes from UTC e.g. 90 minutes + * @return the offset in ISO notation "+01:30" for +90 minutes + */ + static offsetToString(offset: number): string; + /** + * String to offset conversion. + * @param s Formats: "-01:00", "-0100", "-01", "Z" + * @return offset w.r.t. UTC in minutes + */ + static stringToOffset(s: string): number; + } +} + +declare module '__timezonecomplete/globals' { + import datetime = require("__timezonecomplete/datetime"); + import duration = require("__timezonecomplete/duration"); + /** + * Returns the minimum of two DateTimes + */ + export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; + /** + * Returns the minimum of two Durations + */ + export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; + /** + * Returns the maximum of two DateTimes + */ + export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; + /** + * Returns the maximum of two Durations + */ + export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; +} + diff --git a/timezonecomplete/timezonecomplete-tests.ts b/timezonecomplete/timezonecomplete-tests.ts index 4db54a11d..653aecd78 100644 --- a/timezonecomplete/timezonecomplete-tests.ts +++ b/timezonecomplete/timezonecomplete-tests.ts @@ -96,6 +96,7 @@ var ts: tc.TimeSource = tc.DateTime.timeSource; dt = tc.DateTime.nowLocal(); dt = tc.DateTime.nowUtc(); dt = tc.DateTime.now(tc.TimeZone.local()); +dt = tc.DateTime.fromExcel(1.5); dt = tc.nowLocal(); dt = tc.nowUtc(); dt = tc.now(tc.TimeZone.local()); diff --git a/timezonecomplete/timezonecomplete.d.ts b/timezonecomplete/timezonecomplete.d.ts index 4132eb838..b2a76f70e 100644 --- a/timezonecomplete/timezonecomplete.d.ts +++ b/timezonecomplete/timezonecomplete.d.ts @@ -1,4 +1,4 @@ -// Type definitions for timezonecomplete 1.12.0 +// Type definitions for timezonecomplete 1.13.0 // Project: https://github.com/SpiritIT/timezonecomplete // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -349,6 +349,11 @@ declare module '__timezonecomplete/datetime' { * @param timeZone The desired time zone (optional, defaults to UTC). */ static now(timeZone?: timezone.TimeZone): DateTime; + /** + * Create a DateTime from a Lotus 123 / Microsoft Excel date-time value + * i.e. a double representing days since 1-1-1900 where 1900 is incorrectly seen as leap year + */ + static fromExcel(n: number, timeZone?: timezone.TimeZone): DateTime; /** * Constructor. Creates current time in local timezone. */ From a6625f59620cf2a4daf8daf894b494a12d8e4670 Mon Sep 17 00:00:00 2001 From: Raphael Schweizer Date: Fri, 6 Mar 2015 13:01:40 +0100 Subject: [PATCH 58/78] add angular $animate.animate declaration --- angularjs/angular-animate.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index a01c93ef5..f649d65f7 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.3 (ngAnimate module) // Project: http://angularjs.org -// Definitions by: Michel Salib , Adi Dahiya +// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -25,6 +25,17 @@ declare module ng.animate { */ enabled(value?: boolean, element?: JQuery): boolean; + /** + * Performs an inline animation on the element. + * + * @param element the element that will be the focus of the animation + * @param from a collection of CSS styles that will be applied to the element at the start of the animation + * @param to a collection of CSS styles that the element will animate towards + * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') + * @returns the animation callback promise + */ + animate(element: JQuery, from: any, to: any, className?: string): ng.IPromise; + /** * Appends the element to the parentElement element that resides in the document and then runs the enter animation. * From ebcec4e3d950fd87a222317e6ad4a80766f4e3e1 Mon Sep 17 00:00:00 2001 From: falsandtru Date: Fri, 6 Mar 2015 22:24:22 +0900 Subject: [PATCH 59/78] Fix error --- jquery/jquery.d.ts | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 203180150..b2ae6a755 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -283,12 +283,11 @@ interface JQueryGenericPromise { * Interface for the JQuery promise/deferred callbacks */ interface JQueryPromiseCallback { - (value?: T, ...args: T[]): void; + (value?: T, ...args: any[]): void; } interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback, ...callbackN: JQueryPromiseCallback[]): JQueryPromise; - (callbacks1: JQueryPromiseCallback[], ...callbacksN: JQueryPromiseCallback[][]): JQueryPromise; + (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; } /** @@ -301,31 +300,27 @@ interface JQueryPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback, ...alwaysCallbackN: JQueryPromiseCallback[]): JQueryPromise; - always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback, ...doneCallbackN: JQueryPromiseCallback[]): JQueryPromise; - done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback, ...failCallbackN: JQueryPromiseCallback[]): JQueryPromise; - fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback, ...progressCallbackN: JQueryPromiseCallback[]): JQueryPromise; - progress(progressCallback1s?: JQueryPromiseCallback[], ...progressCallbacksN: JQueryPromiseCallback[][]): JQueryPromise; + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Determine the current state of a Deferred object. @@ -365,38 +360,34 @@ interface JQueryDeferred extends JQueryPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback, ...alwaysCallbackN: JQueryPromiseCallback[]): JQueryDeferred; - always(alwaysCallbacks1?: JQueryPromiseCallback[], ...alwaysCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback, ...doneCallbackN: JQueryPromiseCallback[]): JQueryDeferred; - done(doneCallbacks1?: JQueryPromiseCallback[], ...doneCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback, ...failCallbackN: JQueryPromiseCallback[]): JQueryDeferred; - fail(failCallbacks1?: JQueryPromiseCallback[], ...failCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback, ...progressCallbackN: JQueryPromiseCallback[]): JQueryDeferred; - progress(progressCallbacks1?: JQueryPromiseCallback[], ...progressCallbacksN: JQueryPromiseCallback[][]): JQueryDeferred; + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; /** * Call the progressCallbacks on a Deferred object with the given args. * * @param args Optional arguments that are passed to the progressCallbacks. */ - notify(...args: T[]): JQueryDeferred; + notify(value?: any, ...args: any[]): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given context and args. @@ -404,21 +395,21 @@ interface JQueryDeferred extends JQueryPromise { * @param context Context passed to the progressCallbacks as the this object. * @param args Optional arguments that are passed to the progressCallbacks. */ - notifyWith(context: any, ...args: T[]): JQueryDeferred; + notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given args. * * @param args Optional arguments that are passed to the failCallbacks. */ - reject(...args: T[]): JQueryDeferred; + reject(value?: any, ...args: any[]): JQueryDeferred; /** * Reject a Deferred object and call any failCallbacks with the given context and args. * * @param context Context passed to the failCallbacks as the this object. * @param args An optional array of arguments that are passed to the failCallbacks. */ - rejectWith(context: any, ...args: T[]): JQueryDeferred; + rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given args. @@ -426,7 +417,7 @@ interface JQueryDeferred extends JQueryPromise { * @param value First argument passed to doneCallbacks. * @param args Optional subsequent arguments that are passed to the doneCallbacks. */ - resolve(value?: T, ...args: T[]): JQueryDeferred; + resolve(value?: T, ...args: any[]): JQueryDeferred; /** * Resolve a Deferred object and call any doneCallbacks with the given context and args. @@ -434,7 +425,7 @@ interface JQueryDeferred extends JQueryPromise { * @param context Context passed to the doneCallbacks as the this object. * @param args An optional array of arguments that are passed to the doneCallbacks. */ - resolveWith(context: any, ...args: T[]): JQueryDeferred; + resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred; /** * Return a Deferred's Promise object. From 4d201887009584cd1a7c27c47dd2d6058d5d786e Mon Sep 17 00:00:00 2001 From: falsandtru Date: Fri, 6 Mar 2015 22:29:38 +0900 Subject: [PATCH 60/78] Fix return type --- jquery/jquery.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index b2ae6a755..fd7ba70c9 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -360,27 +360,27 @@ interface JQueryDeferred extends JQueryPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given args. From d7dcca44c67070f4e6f699d4d555a7ae51715417 Mon Sep 17 00:00:00 2001 From: falsandtru Date: Fri, 6 Mar 2015 22:37:21 +0900 Subject: [PATCH 61/78] Fix generic type --- jquery/jquery.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index fd7ba70c9..e29b1046f 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -287,7 +287,7 @@ interface JQueryPromiseCallback { } interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; } /** From eba07e99412c054cca903a159817bc932bc60989 Mon Sep 17 00:00:00 2001 From: falsandtru Date: Fri, 6 Mar 2015 23:49:30 +0900 Subject: [PATCH 62/78] Fix definition --- jquery/jquery.d.ts | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index e29b1046f..8ddc072b0 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -300,27 +300,27 @@ interface JQueryPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; /** * Determine the current state of a Deferred object. @@ -354,34 +354,6 @@ interface JQueryPromise { * Interface for the JQuery deferred, part of callbacks */ interface JQueryDeferred extends JQueryPromise { - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** * Call the progressCallbacks on a Deferred object with the given args. * From 402f9a04111b198203277334cc693aa7ba5e72fd Mon Sep 17 00:00:00 2001 From: Adam Robins Date: Fri, 6 Mar 2015 14:54:03 +0000 Subject: [PATCH 63/78] Updating the TODO on the chartResetButton Ran into this issue today, not having a strongly defined theme for the reset zoom button. Didn't go any further than the first level as the states are branches of HTML elements which are not highcharts specific. --- highcharts/highcharts.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 98e96e2ef..3b0801651 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -191,7 +191,15 @@ interface HighchartsBoolOrShadow { interface HighchartsChartResetZoomButton { position: HighchartsPosition; relativeTo?: string; - theme?: any; //TO DO + theme?: HighchartsChartResetZoomButtonTheme; //TO DO +} + +interface HighchartsChartResetZoomButtonTheme { + fill?:string; //css HEX colours. + stroke?: string;//css HEX colours. + r?: number; // Radius % + states?: any; // HTML element states eg: hover, with css attributes in object. + display?:string; // css attr eg: 'none' } interface HighchartsChartOptions { From ef2e01a1892a77b8b88fdde54f891cb7dbc35182 Mon Sep 17 00:00:00 2001 From: reppners Date: Fri, 6 Mar 2015 19:32:26 +0100 Subject: [PATCH 64/78] + fixed mistaken type definition description --- extend/extend.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extend/extend.d.ts b/extend/extend.d.ts index a6cb9151f..39b5d1a04 100644 --- a/extend/extend.d.ts +++ b/extend/extend.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Node.js v0.12.0 -// Project: http://nodejs.org/ +// Type definitions for extend v2.0.0 +// Project: https://www.npmjs.com/package/extend // Definitions by: Stefan Steinhart -// Definitions: https://github.com/borisyankov/DefinitelyType +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "extend" { function extend(deepOrObject:boolean | Object, ...objectN: Object[]): any; From f58abd0e2ae52b1d96ba607449e0c4b4278fe692 Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Fri, 6 Mar 2015 10:41:14 -0800 Subject: [PATCH 65/78] Add arcgis-js-api definition --- arcgis-js-api/arcgis-js-api-tests.ts | 25 + .../arcgis-js-api-tests.ts.tscparams | 1 + arcgis-js-api/arcgis-js-api.d.ts | 16049 ++++++++++++++++ 3 files changed, 16075 insertions(+) create mode 100644 arcgis-js-api/arcgis-js-api-tests.ts create mode 100644 arcgis-js-api/arcgis-js-api-tests.ts.tscparams create mode 100644 arcgis-js-api/arcgis-js-api.d.ts diff --git a/arcgis-js-api/arcgis-js-api-tests.ts b/arcgis-js-api/arcgis-js-api-tests.ts new file mode 100644 index 000000000..bf13a1a0a --- /dev/null +++ b/arcgis-js-api/arcgis-js-api-tests.ts @@ -0,0 +1,25 @@ +/// + +import esri = require("esri"); +import Map = require("esri/map"); +import Point = require("esri/geometry/Point"); + +export = MapController; + +class MapController { + map: Map; + + constructor(public mapDiv: string) { + } + + start() { + var point = new Point(-122.45, 37.75); // long, lat + + var mapOptions: esri.MapOptions = {}; + mapOptions.basemap = "topo"; + mapOptions.center = point; + mapOptions.zoom = 13; + + this.map = new Map(this.mapDiv, mapOptions); + } +} diff --git a/arcgis-js-api/arcgis-js-api-tests.ts.tscparams b/arcgis-js-api/arcgis-js-api-tests.ts.tscparams new file mode 100644 index 000000000..51cd5f144 --- /dev/null +++ b/arcgis-js-api/arcgis-js-api-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module amd \ No newline at end of file diff --git a/arcgis-js-api/arcgis-js-api.d.ts b/arcgis-js-api/arcgis-js-api.d.ts new file mode 100644 index 000000000..1f6523a23 --- /dev/null +++ b/arcgis-js-api/arcgis-js-api.d.ts @@ -0,0 +1,16049 @@ +// Type definitions for ArcGIS API for JavaScript v3.13 +// Project: http://js.arcgis.com +// Definitions by: Esri +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "esri" { + import Graphic = require("esri/graphic"); + import Point = require("esri/geometry/Point"); + import ScreenPoint = require("esri/geometry/ScreenPoint"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + import ImageParameters = require("esri/layers/ImageParameters"); + import ImageServiceParameters = require("esri/layers/ImageServiceParameters"); + import InfoTemplate = require("esri/InfoTemplate"); + import Basemap = require("esri/dijit/Basemap"); + import Extent = require("esri/geometry/Extent"); + import TileInfo = require("esri/layers/TileInfo"); + import BasemapLayer = require("esri/dijit/BasemapLayer"); + import BookmarkItem = require("esri/dijit/BookmarkItem"); + import Units = require("esri/units"); + import Color = require("esri/Color"); + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol"); + import Geocoder = require("esri/dijit/Geocoder"); + import RouteParameters = require("esri/tasks/RouteParameters"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Font = require("esri/symbols/Font"); + import ArcGISDynamicMapServiceLayer = require("esri/layers/ArcGISDynamicMapServiceLayer"); + import LineSymbol = require("esri/symbols/LineSymbol"); + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + import LayerSource = require("esri/layers/LayerSource"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import SpatialReference = require("esri/SpatialReference"); + import Symbol = require("esri/symbols/Symbol"); + import Layer = require("esri/layers/layer"); + import Locator = require("esri/tasks/locator"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import LOD = require("esri/layers/LOD"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import PrintTemplate = require("esri/tasks/PrintTemplate"); + import QueryTask = require("esri/tasks/QueryTask"); + import TextSymbol = require("esri/symbols/TextSymbol"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask"); + import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo"); + + export interface AGSMouseEvent extends MouseEvent { + graphic?: Graphic; + mapPoint: Point; + screenPoint: ScreenPoint; + } + export interface AddOptions { + /** The features that were added to the feature layer. */ + addedGraphics?: Graphic[]; + /** The feature layer where the new feature(s) are added. */ + featureLayer?: FeatureLayer; + } + export interface AggregatePointsOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** A field name from pointLayer based on which the points will be grouped. */ + groupByField?: string; + /** When true, the polygons that have no points within them will be returned in the output. */ + keepBoundariesWithNoPoints?: boolean; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The point feature layer that will be aggregated into the polygons in the polygon feature layer. */ + pointLayer: FeatureLayer; + /** The polygon layer to be shown selected in in the Choose area menu. */ + polygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the input polygon layer. */ + polygonLayers: FeatureLayer[]; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** An array of attribute field names and statistic types that you would like to aggregate for all points within each polygon. */ + summaryFields?: string[]; + } + export interface ArcGISDynamicMapServiceLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + /** Id to assign to the layer. */ + id?: string; + /** Represents the image parameter options. */ + imageParameters?: ImageParameters; + /** infoTemplates object. */ + infoTemplates?: any; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + /** By default, images are exported in MIME format, and the image is streamed to the client. */ + useMapImage?: boolean; + /** When true, the layer will update its content based on the map's time extent. */ + useMapTime?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface ArcGISImageServiceLayerOptions { + /** Id to assign to the layer. */ + id?: string; + /** The image service parameter options used when exporting an Image Service layer. */ + imageServiceParameters?: ImageServiceParameters; + /** The template that defines the content to display in the map info window when the user clicks on a raster. */ + infoTemplate?: InfoTemplate; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** By default, images are exported in MIME format, and the image is streamed to the client. */ + useMapImage?: boolean; + /** When true, the layer will update its content based on the map's time extent. */ + useMapTime?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface ArcGISImageServiceVectorLayerOptions { + /** Apply a function for visualization or post-processing purposes. */ + pixelFilter?: any; + /** Set the default renderer from a list of predefined options. */ + rendererStyle?: string; + /** A value used to aggregate pixels into tiles for visualization purposes. */ + symbolTileSize?: number; + } + export interface ArcGISTiledMapServiceLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Lists which levels to draw. */ + displayLevels?: number; + /** An array of objects that define areas where a tiled map service should not display tiles. */ + exclusionAreas?: any[]; + /** Id to assign to the layer. */ + id?: string; + /** infoTemplates object. */ + infoTemplates?: any; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + /** Array of REST endpoints that can be used to retrieve tile images. */ + tileServers?: string[]; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface AttributeInspectorOptions { + /** See the object specifications table below for the structure of the layerInfos object. */ + layerInfos: any[]; + } + export interface AttributionOptions { + /** String used as the delimiter between attribution items. */ + itemDelimiter?: string; + /** Reference to the map object. */ + map: Map; + } + export interface BasemapGalleryOptions { + /** List of basemap layer ids in the current map. */ + basemapIds?: string[]; + /** An array of user-defined basemaps to display in the BasemapGallery. */ + basemaps?: Basemap[]; + /** Specify an ArcGIS.com group that contains web maps that will be used as basemaps in the gallery. */ + basemapsGroup?: any; + /** Specify your Bing Maps key if the basemap group you want to display in the gallery contains bing basemaps. */ + bingMapsKey?: string; + /** Reference to the map. */ + map: Map; + /** Specify the portal url, including the instance name, used to access the group that contains the basemap gallery items. */ + portalUrl?: string; + /** List of reference layer ids in the current map. */ + referenceIds?: string[]; + /** When true, queries ArcGIS.com to retrieve available basemaps. */ + showArcGISBasemaps?: boolean; + } + export interface BasemapLayerOptions { + /** If the url points to an image service, you can specify which band ids will display. */ + bandIds?: number[]; + /** The attribution information for the layer. */ + copyright?: string; + /** If the url points to a cached map service you can specify the levels to draw. */ + displayLevels?: number[]; + /** Specify the full extent of the layer. */ + fullExtent?: Extent; + /** Specify the initial extent of the layer. */ + initialExtent?: Extent; + /** Set to true if the layer is a reference layer and should be drawn on top of all other layers in the map. */ + isReference?: boolean; + /** Initial opacity or transparency of the basemap layer. */ + opacity?: number; + /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ + subDomains?: string[]; + /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo?: TileInfo; + /** Define additional tile server domains for the layer. */ + tileServer?: string[]; + /** The type of layer, valid values are "BingMapsAerial", "BingMapsHybrid", "BingMapsRoad", "OpenStreetMap", or "WebTiledLayer". */ + type?: string; + /** URL to the ArcGIS Server REST resource that represents a map or image service. */ + url?: string; + /** If the url points to a dynamic map service you can specify a subset of layers to display. */ + visibleLayers?: number[]; + } + export interface BasemapOptions { + /** The id of the basemap. */ + id?: string; + /** An array of layers to add to the basemap. */ + layers: BasemapLayer[]; + /** A URL to a thumbnail image for the basemap that will be displayed in the BasemapGallery. */ + thumbnailUrl?: string; + /** Title for the basemap. */ + title?: string; + } + export interface BasemapToggleOptions { + /** The secondary basemap to toggle to. */ + basemap?: string; + /** Object containing the labels and URLs for the image of each basemap. */ + basemaps?: any; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme?: string; + /** Whether the widget is visible by default. */ + visible?: boolean; + } + export interface BookmarksOptions { + /** An array of BookmarkItem objects or a json object with the BookmarkItem format to initially display in the bookmark widget. */ + bookmarks?: BookmarkItem[]; + /** When true, users can add, remove and edit bookmark items. */ + editable?: boolean; + /** Reference to the map. */ + map: Map; + } + export interface CSVLayerOptions { + /** The column delimiter. */ + columnDelimiter?: string; + /** Copyright information for the layer. */ + copyright?: string; + /** The fields property contains objects with "name", "alias" and "type" String properties. */ + fields?: any[]; + /** The latitude field name. */ + latitudeFieldName?: string; + /** The longitude field name. */ + longitudeFieldName?: string; + /** An array of strings which correspond to fields to include in the CSVLayer. */ + outFields?: string[]; + } + export interface CircleOptions1 { + /** Applicable when the spatial reference of the center point is either set to Web Mercator or geographic/geodesic as true would apply. */ + geodesic?: boolean; + /** A circle can be thought of similar to a polygon. */ + numberOfPoints?: number; + /** Radius of the circle. */ + radius?: number; + /** Unit of the radius. */ + radiusUnit?: Units; + } + export interface CircleOptions2 { + /** The center point of the circle. */ + center: any; + /** Applicable when the spatial reference of the center point is either set to Web Mercator or geographic/geodesic as true would apply. */ + geodesic?: boolean; + /** A circle can be thought of similar to a polygon. */ + numberOfPoints?: number; + /** The radius of the circle. */ + radius?: number; + /** Unit of the radius. */ + radiusUnit?: Units; + } + export interface ClassedColorSliderOptions { + /** Data map containing renderer information. */ + breakInfos: any; + /** Classification method. */ + classificationMethod?: string; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of the histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Normalization type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of the widget ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays slider labels when true. */ + showLabels?: boolean; + /** Displays ticks on slider when true. */ + showTicks?: boolean; + /** Represents statistics data object. */ + statistics?: any; + } + export interface ClassedSizeSliderOptions { + /** Data map containing renderer information. */ + breakInfos: any; + /** Classification method. */ + classificationMethod?: string; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Normalization type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + /** Represents statistics data object. */ + statistics?: any; + /** Indicates whether to use a circle or line-based ClassedSizeSlider. */ + symbol?: any; + } + export interface ColorInfoSliderOptions { + /** Classification method. */ + classificationMethod?: string; + /** Data map containing renderer information. */ + colorInfo: any; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of slider. */ + maxValue?: number; + /** Absolute minimum value of slider. */ + minValue?: number; + /** Normalization Type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of widget ramp in pixels. */ + rampWidth?: number; + /** Displays handles when set to true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays labels when set to true. */ + showLabels?: boolean; + /** Displays ticks when set to true. */ + showTicks?: boolean; + /** Displays transparent background when set to true. */ + showTransparentBackground?: boolean; + /** Represents statistics data object. */ + statistics?: any; + /** Object containing additional options. */ + zoomOptions?: any; + } + export interface ColorPickerOptions { + /** The selected color. */ + color: Color; + /** The row size of the palette. */ + colorsPerRow: number; + /** The set of available color options. */ + palette: Color[]; + /** Array of recent colors to show in the recent colors row. */ + recentColors: Color[]; + /** Toggles color selection being required. */ + required: boolean; + /** Toggles the recent color row. */ + showRecentColors: boolean; + /** Toggles the transparency slider. */ + showTransparencySlider: boolean; + } + export interface ConnectOriginsToDestinationsOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The linear unit used with the distance value(s). */ + distanceDefaultUnits?: string; + /** An array of feature layers containing destination points. */ + featureLayers: FeatureLayer[]; + /** Reference to the map object. */ + map?: Map; + /** The point feature layer containing the origin points. */ + originsLayer: FeatureLayer; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + } + export interface CoordinatesLocationProviderOptions { + /** The attribute field in the graphic object that contains the longitude (X) values. */ + xField: string; + /** The attribute field in the graphic object that has the latitude (Y) values. */ + yField: string; + } + export interface CreateBuffersOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An array of buffer distances to buffer the input feature layer. */ + bufferDistance?: number[]; + /** The input point, line, or polygon feature layer to be buffered. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: string; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface CreateDriveTimeAreasOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The units of the breakValues parameter. */ + breakUnits?: string; + /** An array of driving time break values. */ + breakValues?: number[]; + /** The point feature layer around which drive-time areas will be drawn. */ + inputLayer: FeatureLayer; + /** The geometry type of the input layer. */ + inputType?: string; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The rule of overlap. */ + overlapPolicy?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface CreateViewshedOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** Feature layer containing observation points to be used as input. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + } + export interface CreateWatershedsOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer containing input points used for calculating watersheds. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + } + export interface CutOptions { + /** The feature(s) added to the feature layer by the cut operation. */ + addedGraphics?: Graphic[]; + /** The feature layer that contains the cut feature(s). */ + featureLayer?: FeatureLayer; + /** The updated feature(s). */ + postUpdatedGraphics?: Graphic[]; + /** The feature(s) before the cut operation is performed. */ + preUpdatedGraphics?: Graphic[]; + } + export interface DataAdapterFeatureLayerOptions { + /** The query parameters to use in retrieving the data through the DataAdapter. */ + dataAdapterQuery: any; + /** An instance of the LocationProvider class. */ + locationProvider: LocationProviderBase; + } + export interface DataBrowserOptions { + /** Show/hide country drop down. */ + countryBox?: boolean; + /** Two-digit country code selected in the country drop down. */ + countryID?: string; + /** Selected variables array. */ + selection?: string[]; + /** Title to show in the top left hand corner. */ + title?: string; + } + export interface DeleteOptions { + /** The features that were removed from the feature layer. */ + deletedGraphics?: Graphic[]; + /** The feature layer from which the feature(s) are removed. */ + featureLayer?: FeatureLayer; + } + export interface DirectionsOptions { + /** Defines the values that label each stop. */ + alphabet?: any; + /** When true, solve will start when the last destination is complete and enter key is hit. */ + autoSolve?: boolean; + /** Display the 'Add Destination' button. */ + canModifyStops?: boolean; + /** Center the map at the start of the selected route segment. */ + centerAtSegmentStart?: boolean; + /** The returned directions object from the routing solve result. */ + directions?: any; + /** Length units. */ + directionsLengthUnits?: string; + /** Enable the dragging of stop locations on the map. */ + dragging?: boolean; + /** Focus the cursor in the stop input when a new stop is added. */ + focusOnNewStop?: boolean; + /** The symbol that is used to denote the start location on the map. */ + fromSymbol?: PictureMarkerSymbol; + /** The symbol that displays when the from location is dragged to a new location. */ + fromSymbolDrag?: PictureMarkerSymbol; + /** Define optional geocoder options view the Geocoder help for details on the object properties. */ + geocoderOptions?: any; + /** List of Geocoder widgets used for each stop. */ + geocoders?: Geocoder[]; + /** If available, this geometry service is used to provide latitude/longitude values for stops whose reverse geocoding did not return an address (Added at v3.11). */ + geometryTaskUrl?: string; + /** Reference to the map object. */ + map: Map; + /** Activates the map-click-active toggle button when true. */ + mapClickActive?: boolean; + /** Maximum number of stops. */ + maxStops?: number; + /** Minimum number of stops. */ + minStops?: number; + /** When true, stops on the route are re-ordered to provide an optimal route. */ + optimalRoute?: boolean; + /** URL link to a custom print page. */ + printPage?: string; + /** If available, this print task is used to display an overview map of the route on the directions print page (Added at v3.11). */ + printTaskUrl?: string; + /** HTML string for providing a custom printing page */ + printTemplate?: string; + /** When true, the route will return to start point. */ + returnToStart?: boolean; + /** Specify the input parameters for the route task. */ + routeParams?: RouteParameters; + /** Define the symbol used to draw the route on the map. */ + routeSymbol?: SimpleLineSymbol; + /** Specify the service that will be used to calculate directions. */ + routeTaskUrl?: string; + /** Define the info template for the popup that appears when the popup for a route segment is displayed. */ + segmentInfoTemplate?: InfoTemplate; + /** Specify the symbol used to render the individual route segments that display on the map when a direction step is clicked. */ + segmentSymbol?: SimpleLineSymbol; + /** Defines whether the Directions widget will show the map-click-active toggle button. */ + showActivateButton?: boolean; + /** If true, the Clear button is shown. */ + showClearButton?: boolean; + /** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */ + showMilesKilometersOption?: boolean; + /** When true, the Optimize order option is shown. */ + showOptimalRouteOption?: boolean; + /** When true the 'Print' button is displayed that allows users to display driving directions in a print page. */ + showPrintPage?: boolean; + /** When true, the Return to start option is shown. */ + showReturnToStartOption?: boolean; + /** Display the 'Show Reverse Stops' button. */ + showReverseStopsButton?: boolean; + /** Highlight the route segment when a directions step is clicked. */ + showSegmentHighlight?: boolean; + /** Display a popup with segment details when a direction step is clicked. */ + showSegmentPopup?: boolean; + /** When true, the Use traffic option is shown. */ + showTrafficOption?: boolean; + /** If true, and six Standard Travel Modes are supported by the service and accessible using current credentials, then two toggle button groups are shown: one to allow user to choose between Driving a Car, a Truck, and Walking, and one more group to choose between Fastest and Shortest routes. */ + showTravelModesOption?: boolean; + /** True if currently calculating the route from the routing service. */ + solving?: boolean; + /** List of graphics used to display the point marker. */ + stopGraphics?: Graphic[]; + /** An array of points that define the stop locations. */ + stops?: any; + /** Define the info template for the popup that appears when a stop is clicked. */ + stopsInfoTemplate?: InfoTemplate; + /** The symbol that displays on the map for the locations between the origin and final destination locations. */ + stopSymbol?: PictureMarkerSymbol; + /** The symbol that displays when an intermediate location is dragged to a new location. */ + stopSymbolDrag?: PictureMarkerSymbol; + /** List of graphics used to display the text over the point marker. */ + textGraphics?: Graphic[]; + /** The text color for the text that appears for each destination. */ + textSymbolColor?: Color; + /** The font used for the text that displays on the map for each stop location. */ + textSymbolFont?: Font; + /** Define an x and/or y offset for the text symbols that are used for the stop locations on the map. */ + textSymbolOffset?: any; + /** Specify a theme for the widget. */ + theme?: string; + /** The symbol that is used to denote the final destination location on the map. */ + toSymbol?: PictureMarkerSymbol; + /** The symbol that displays when an final destination location is dragged to a new location. */ + toSymbolDrag?: PictureMarkerSymbol; + /** When true, real-time traffic is used to plan the route. */ + traffic?: boolean; + /** The traffic layer used for real-time traffic. */ + trafficLayer?: ArcGISDynamicMapServiceLayer; + } + export interface DissolveBoundariesOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An array of field names based on which polygons are merged. */ + dissolveFields?: string[]; + /** The layer containing polygon features that will be dissolved. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** An array of field names and statistical summary types that you wish to calculate from the polygons that are dissolved together. */ + summaryFields?: string[]; + } + export interface DotDensityRendererOptions { + /** The color to be used for the background of the symbol. */ + backgroundColor?: Color; + /** The shape to be used for the dot. */ + dotShape?: string; + /** The size of the dot in pixels. */ + dotSize?: number; + /** The value that a dot represents. */ + dotValue: number; + /** An array of objects, where each object defines a field to be mapped and its color. */ + fields: any[]; + /** The line symbol to use on the outline of the feature. */ + outline?: LineSymbol; + } + export interface DrawOptions { + /** Determines how much time to wait before adding a new point when using a freehand tool. */ + drawTime?: number; + /** If true, tooltips are displayed when creating new graphics with the draw toolbar. */ + showTooltips?: boolean; + /** Determines how far the mouse moves before adding a new point when using one of the freehand tools. */ + tolerance?: number; + /** Determines how far to offset the tool tip from the mouse pointer. */ + tooltipOffset?: number; + } + export interface DriveBufferOptions { + /** The radii to use to create ring buffers */ + radius: number[]; + /** The units of the radii. */ + units: string; + } + export interface EditOptions { + /** Specifies whether users can add new vertices. */ + allowAddVertices?: boolean; + /** Specifies whether users can delete vertices. */ + allowDeletevertices?: boolean; + /** Line symbol used to draw the guild lines, displayed when moving vertices. */ + ghostLineSymbol?: LineSymbol; + /** Marker symbol used to display the insertable vertices. */ + ghostVertexSymbol?: MarkerSymbol; + /** If users want to place the text symbol editor to a user defined HTML element. */ + textSymbolEditorHolder?: any; + /** When true, if the geometry is re-sized the aspect ration will be preserved. */ + uniformScaling?: boolean; + /** Marker symbol used to draw the vertices. */ + vertexSymbol?: MarkerSymbol; + } + export interface EditorOptions { + /** Create a new settings object that defines the capabilities of the widget. */ + settings?: any; + } + export interface EnrichLayerOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An buffer distance or driving time value to buffer the input feature layer. */ + distance?: number; + /** When true, Travel Modes (Driving Time) is enabled for inputLayer with point geometries (esriGeometryPoint). */ + enableTravelModes?: boolean; + /** The input feature layer to enrich with new data. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** When true, you can specify a time for traffic condition under Define areas to enrich - Driving Time. */ + showTrafficWidget?: boolean; + } + export interface ExtractDataOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** If true, the Clip features option in Study area will be ckecked. */ + clip?: boolean; + /** The format of output data shown as the default selection in the Output data format menu. */ + dataFormat?: string; + /** An array for feature layers to be extracted. */ + featureLayers: FeatureLayer[]; + /** An array for feature layers to be extracted. */ + inputLayers?: FeatureLayer[]; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface FeatureLayerOptions { + /** Enable or disable the auto generalization of features from a non-editable layer in on-demand mode. */ + autoGeneralize?: boolean; + /** Class attribute to set for the layer's node. */ + className?: string; + /** Where clause to use as definition expression for layer. */ + definitionExpression?: string; + /** When true, graphics are displayed during panning. */ + displayOnPan?: boolean; + /** Set a callback function that will be invoked by FeatureLayer.getEditSummary. */ + editSummaryCallback?: Function; + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + /** Unique ID to assign to the layer. */ + id?: string; + /** The template that defines the content to display in the map info window when the user clicks on a feature. */ + infoTemplate?: InfoTemplate; + /** The maximum allowable offset, only applicable for layers that are not editable. */ + maxAllowableOffset?: number; + /** The query mode for the feature layer. */ + mode?: number; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** One or more fields used to order features by - for queries as well as for rendering. */ + orderByFields?: string[]; + /** An array of strings which correspond to fields to include in the FeatureLayer. */ + outFields?: string[]; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** Specify the metadata of the layer. */ + resourceInfo?: any; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + /** Indicates whether to show labels on the layer. */ + showLabels?: boolean; + /** The dynamic layer or table source. */ + source?: LayerSource; + /** Specify the size of the virtual tiles, used in on-demand mode. */ + tileHeight?: number; + /** Specify the size of the virtual tiles, used in on-demand mode. */ + tileWidth?: number; + /** The name of the trackIdField. */ + trackIdField?: string; + /** When true, the layer will update its content based on the map's time extent. */ + useMapTime?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface FeatureTableOptions { + /** A dGrid property. */ + allowSelectAll?: boolean; + /** A dGrid property. */ + cellNavigation?: boolean; + /** Object defining the date options specifically for formatting date and time editors. */ + dateOptions?: any; + /** The featureLayer that the table is associated with. */ + featureLayer: FeatureLayer; + /** Columns to hide by default using the dGrid ColumnHider extension. */ + hiddenFields?: string[]; + /** A reference to the Map. */ + map?: Map; + /** A dGrid property. */ + noDataMessage?: string; + /** A dGrid property. */ + selectionMode?: string; + } + export interface FindHotSpotsOptions { + /** An array of feature layer candidates to be selected as the aggregation polygon layer. */ + aggregationPolygonLayers: FeatureLayer[]; + /** The numeric field in the AnalysisLayer that will be analyzed. */ + analysisField?: string; + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer for which hot spots will be calculated. */ + analysisLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** When true, make process info to get analysis report. */ + isProcessInfo?: boolean; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface FindNearestOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer from which the nearest features are found. */ + analysisLayer: FeatureLayer; + /** When true, Travel Modes ( Driving Distance, Driving Time) are enabled for analysisLayer with point geometries (esriGeometryPoint). */ + enableTravelModes?: boolean; + /** Reference to the map object. */ + map?: Map; + /** The maximum number of nearest locations to find for each feature in analysisLayer. */ + maxCount?: number; + /** The feature layer to be shown selected in the "1. */ + nearLayer: FeatureLayer; + /** An array of near layer candidates. */ + nearLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** The maximum range to search for nearest locations from each feature in the analysisLayer. */ + searchCutoff?: number; + /** The units of the searchCutoff parameter. */ + searchCutoffUnits?: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + export interface FindTaskOptions { + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface GalleryOptions { + /** An array of items, see example below. */ + items: any[]; + /** Display the title for each item in the gallery. */ + showTitle?: boolean; + /** Specify the size of the gallery's thumbnail image. */ + thumbnailStyle?: string; + } + export interface GaugeOptions { + /** Text to display at the bottom of the gauge. */ + caption?: string; + /** Color used for the arc indicator on the gauge. */ + color?: string; + /** Name of the attribute field used to drive the gauge. */ + dataField?: string; + /** Either "value" or "percentage". */ + dataFormat?: string; + /** Name of the attribute field used to display a feature name on the gauge. */ + dataLabelField?: string; + /** When true, the gauge is created with JSON from an ArcGIS Online webmap. */ + fromWebmap?: boolean; + /** A esri.layers.GraphicsLayer or esri.layers.FeatureLayer used to drive the gauge. */ + layer?: GraphicsLayer; + /** Maximum value that will be displayed on the gauge. */ + maxDataValue?: number; + /** The text to display when a feature does not not a value for the dataLabelField. */ + noDataLabel?: string; + /** Object passed to dojo.number.format to specify how data values are formatted. */ + numberFormat?: any; + /** Text displayed above the gauge. */ + title?: string; + /** What to dsiplay after the value of the currently selected feature. */ + unitLabel?: string; + } + export interface GenerateRendererTaskOptions { + /** Prior to ArcGIS Server 10.2, map server/feature service only sample 1000 features to generate the renderer when using GenerateRenderer operation, which mean if there are more than 1000 features, it may run into the case that some feature will not be categorized into any breaks/unique values. */ + checkValueRange?: boolean; + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface GeoRSSLayerOptions { + /** The template used to display popup window for identify operation. */ + infoTemplate?: InfoTemplate; + /** The output spatial reference for the GeoRSSLayer. */ + outSpatialReference?: SpatialReference; + /** The default symbol use to display point features. */ + pointSymbol?: Symbol; + /** The default symbol used to display polygon features. */ + polygonSymbol?: Symbol; + /** The default symbol used to display polyline features. */ + polylineSymbol?: Symbol; + } + export interface GeocoderOptions { + /** By default, the Geocoder widget uses the Esri World Locator to find search locations. */ + arcgisGeocoder?: any; + /** When false, the geocoder will not display the auto-complete results menu. */ + autoComplete?: boolean; + /** When false, the geolocator will not navigate to the result after selection or search. */ + autoNavigate?: boolean; + /** When false, the geocoder menu will not be displayed when more than one geocoder is set. */ + geocoderMenu?: boolean; + /** Defines the geocoders that will be used by the Geocoder widget. */ + geocoders?: any[]; + /** Specify a graphicsLayer to use when highlightSymbol is true. */ + graphicsLayer?: GraphicsLayer; + /** Indicates whether to show a graphic at a selected location. */ + highlightLocation?: boolean; + /** Reference to the map. */ + map: Map; + /** Maximum number of results to return. */ + maxLocations?: number; + /** Minimum number of characters entered into the search field before querying for results. */ + minCharacters?: number; + /** Number of milliseconds before querying for results will begin. */ + searchDelay?: number; + /** When false, the geocoder will not show search suggestions while typing. */ + showResults?: boolean; + /** Symbol to use when highlightLocation is true. */ + symbol?: Symbol; + /** Specify a theme for the geocoder. */ + theme?: string; + /** Start the geocoder with a default value. */ + value?: string; + /** Scale to zoom to when geocoder does not return an extent. */ + zoomScale?: number; + } + export interface GeometryLocationProviderOptions { + /** The attribute field in the graphic object that contains the JSON string representing the geometry. */ + geometryField: string; + /** The geometry type of the returned features. */ + geometryType: string; + } + export interface GraphicsLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** List of attribute fields to be added as custom data attributes to graphics node. */ + dataAttributes?: any; + /** When true, graphics are displayed during panning. */ + displayOnPan?: boolean; + /** Id to assign to the layer. */ + id?: string; + /** The info template for the layer. */ + infoTemplate?: InfoTemplate; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** Indicates whether the layer is responsible for styling graphics. */ + styling?: boolean; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface Handle { + /** Remove the listener */ + remove(): void; + } + export interface HeatmapRendererOptions { + /** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */ + blurRadius?: number; + /** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */ + colors: string[]; + /** The name of the attribute field used to weight the heatmap points. */ + field?: string; + /** The pixel intensity value which is assigned the final color in the color ramp. */ + maxPixelIntensity?: number; + /** The pixel intensity value which is assigned the initial color in the color ramp. */ + minPixelIntensity?: number; + } + export interface HeatmapSliderOptions { + /** An array of colorStop objects describing the renderer's color ramp with more specificity than just colors. */ + colorStops: any[]; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays slider labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + } + export interface HistogramTimeSliderOptions { + /** Change color of histogram bars, default is "rgb(5, 112, 176)".color: "#555555" */ + color?: string; + /** Formats dates displayed by histogram slider.dateFormat: "DateFormat(selector: 'date', fullYear: true)" */ + dateFormat?: string; + /** Array of feature layers to be used by slider. */ + layers?: Layer[]; + /** With a stream layer, when the number of points on the map exceeds the maximum number allowed, this histogram will start removing bins at the beginning of the array if in the "show_partial" mode. */ + mode?: string; + /** Sets resolution for histogram slider (seconds/minutes/hours/etc) using Esri date formats. */ + timeInterval?: string; + } + export interface HomeButtonOptions { + /** The extent used to zoom to when clicked. */ + extent?: Extent; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme?: string; + /** Whether the widget is visible by default. */ + visible?: boolean; + } + export interface HorizontalSliderOptions { + /** Array of text labels to render - evenly spaced from left-to-right. */ + labels: string[]; + } + export interface IdentifyTaskOptions { + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface KMLLayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** The output spatial reference for the KMLLayer. */ + outSR?: SpatialReference; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + } + export interface LabelLayerOptions { + /** ID assigned to the layer. */ + id?: string; + /** Display mode for the label layer. */ + mode?: string; + } + export interface LayerOptions { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution?: boolean; + } + export interface LayerSwipeOptions { + /** The number of pixels to clip the swipe tool. */ + clip?: number; + /** If the widget is enabled and layers can be swiped. */ + enabled?: boolean; + /** The layers to be swiped. */ + layers: Layer[]; + /** The number of pixels to place the tool from the left of the map. */ + left?: number; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme?: string; + /** The number of pixels to place the tool from the top of the map. */ + top?: number; + /** Type of swipe tool to use. */ + type?: string; + } + export interface LegendOptions { + /** Specify the alignment of the legend within the HTML element where the legend is rendered. */ + arrangement?: number; + /** When false, the legend will not automatically update if the map changes scale or when layers are added are removed from the map. */ + autoUpdate?: boolean; + /** Specify a subset of the layers in the map to display in the legend. */ + layerInfos?: any[]; + /** Reference to the map. */ + map: Map; + /** When true the legend will update with every scale change and displays only the layers and sub layers that are visible in the current map scale. */ + respectCurrentMapScale?: boolean; + } + export interface LocateButtonOptions { + /** Centers the map to the location when a new position is returned. */ + centerAt?: boolean; + /** The HTML5 Geolocation Position options for locating. */ + geolocationOptions?: any; + /** If highlightLocation is on and this property is set then a graphic will be added to this layer instead of map.graphics. */ + graphicsLayer?: GraphicsLayer; + /** If true, the users location will be highlighted with a point. */ + highlightLocation?: boolean; + /** The infoTemplate used for the highlight graphic. */ + infoTemplate?: InfoTemplate; + /** Map object that this dijit is associated with. */ + map: Map; + /** The scale to zoom to when a users location has been found. */ + scale?: number; + /** Sets the maps scale when a new position is returned. */ + setScale?: boolean; + /** The symbol used on the highlight graphic to highlight the users location on the map. */ + symbol?: Symbol; + /** Class used for styling the widget. */ + theme?: string; + /** When enabled, the button becomes a toggle that creates an event to watch for location changes. */ + useTracking?: boolean; + /** Whether the widget is visible by default. */ + visible?: boolean; + } + export interface LocatorLocationProviderOptions { + /** Object that matches the Locator address fields to corresponding attribute names in the Graphic object. */ + addressFields: any; + /** An instance of a Locator object. */ + locator: Locator; + } + export interface MapImageOptions { + /** Specfiy an extent for the image. */ + extent?: Extent; + /** Specify the url of the image. */ + href?: string; + } + export interface MapOptions { + /** Width of the attribution node relative to the map width. */ + attributionWidth?: number; + /** When true the map will automatically resize when the browser window is resized or when the ContentPane widget enclosing the map is resized. */ + autoResize?: boolean; + /** Specify a basemap for the map. */ + basemap?: string; + /** The location where the map should be centered. */ + center?: any; + /** When true, graphics are displayed during panning. */ + displayGraphicsOnPan?: boolean; + /** If provided, the extent and projection of the map is set to the properties of Extent. */ + extent?: Extent; + /** When true a fade effect is enabled for supported layers. */ + fadeOnZoom?: boolean; + /** When true, for maps that contain tiled map service layers, you are guaranteed to have the initial extent defined using the extent constructor option shown completely on the map. */ + fitExtent?: boolean; + /** When the mapNavigation mode is set to 'css-transforms', CSS3 transforms will be used for map navigation when supported by the browser. */ + force3DTransforms?: boolean; + /** By default the map creates and uses an out-of-the-box esri/dijit/Popup. */ + infoWindow?: InfoWindowBase; + /** If provided, the map is initialized with the specified levels of detail. */ + lods?: LOD[]; + /** Display the esri logo on the map. */ + logo?: boolean; + /** Maximum visible scale of the map. */ + maxScale?: number; + /** Maximum map zoom level. */ + maxZoom?: number; + /** Minimum visible scale of the map. */ + minScale?: number; + /** Minimum map zoom level. */ + minZoom?: number; + /** Displays pan buttons on map. */ + nav?: boolean; + /** Specify whether or not to use CSS3 transformations when panning and zooming. */ + navigationMode?: string; + /** Default value is true, indicating that the map will skip panning animation when calling map.centerAt() or map.setExtent() (for map.setExtent(), the animation is only skipped if the map's zoom level is not changing) if the panning distance is twice the distance of the current extent. */ + optimizePanAnimation?: boolean; + /** Specify a time period in milliseconds to ignore repeated calls to the resize method. */ + resizeDelay?: number; + /** Initial map scale. */ + scale?: number; + /** Enable or disable map attribution display. */ + showAttribution?: boolean; + /** If true and a map click event occurs, it may show the map's infoWindow. */ + showInfoWindowOnClick?: boolean; + /** Indicate whether to display labels. */ + showLabels?: boolean; + /** Displays a slider on the map. */ + slider?: boolean; + /** Define labels for the slider. */ + sliderLabels?: string[]; + /** Orientation of the zoom slider. */ + sliderOrientation?: string; + /** Position of the zoom slider within the map control. */ + sliderPosition?: string; + /** Defines the slider style. */ + sliderStyle?: string; + /** When true, for Apple computers with a trackpad or magic mouse use, swipe pans instead of zooming. */ + smartNavigation?: boolean; + /** When true, supports continuous pan across the dateline. */ + wrapAround180?: boolean; + /** Initial zoom level of the map. */ + zoom?: number; + } + export interface MeasurementOptions { + /** Flag for showing full list of units in the Location tool. */ + advancedLocationUnits?: boolean; + /** The default area unit for the measure area tool. */ + defaultAreaUnit?: Units; + /** The default length unit for the measure distance tool. */ + defaultLengthUnit?: Units; + /** Allows the user to immediately measure previously-created geometry on dijit creation. */ + geometry?: any; + /** Line symbol used to draw the lines for the measure line and measure distance tools. */ + lineSymbol?: SimpleLineSymbol; + /** Reference to the map. */ + map: Map; + /** Marker symbol used to draw the points for the measure line tool. */ + pointSymbol?: MarkerSymbol; + } + export interface MergeLayersOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer to be merged with the mergeLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** An array of feature layer candidates to be selected as the merge layer. */ + mergeLayers: FeatureLayer[]; + /** An array of values that describe how fields from the mergeLayer are to be modified. */ + mergingAttributes?: string[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + } + /** Constants representing how the geometry is returned. */ + export interface NAOutputLine { + /** Do not return geometries. */ + NONE: any; + /** Return polylines containing striaght lines between input locations. */ + STRAIGHT: any; + /** Return polylines based on the underlying street geometries. */ + TRUE_SHAPE: any; + /** Return polylines based on the underlying street geometries with the M values set based on the accumulated impedance at each vertex. */ + TRUE_SHAPE_WITH_MEASURE: any; + } + /** Constants representing how the geometry is returned. */ + export interface NAOutputPolygon { + /** Detailed output polygons */ + DETAILED: any; + /** No output polygons */ + NONE: any; + /** Simplified output polygons. */ + SIMPLIFIED: any; + } + /** Constants representing directionality in network analysis. */ + export interface NATravelDirection { + /** Travel direction from the facility */ + FROM_FACILITY: any; + /** Travel direction to the facility */ + TO_FACILITY: any; + } + /** Constants representing how U-Turns are handled. */ + export interface NAUTurn { + /** Allow u-turns at the end of any street. */ + ALLOW_BACKTRACK: any; + /** Allow u-turns at dead ends and intersections. */ + AT_DEAD_ENDS_AND_INTERSECTIONS: any; + /** Only allow u-turns at dead ends where a street is not connected to another street. */ + AT_DEAD_ENDS_ONLY: any; + /** Do not allow u-turns at the end of any streets. */ + NO_BACKTRACK: any; + } + export interface OAuthInfoOptions { + /** The registered application Id. */ + appId: string; + /** Applications with the same value will share the stored token on the same host. */ + authNamespace?: string; + /** The number of minutes the token will be valid for. */ + expiration?: number; + /** The locale for the OAuth sign in page. */ + locale?: string; + /** The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use. */ + minTimeUntilExpiration?: number; + /** Set to true to show the OAuth sign in page in a popup window. */ + popup?: boolean; + /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + popupCallbackUrl?: string; + /** The window features passed to window.open(). */ + popupWindowFeatures?: string; + /** The ArcGIS for Portal URL. */ + portalUrl?: string; + } + export interface OpacitySliderOptions { + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Data map containing renderer information. */ + opacityInfo: any; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays slider labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + /** Displays the transparent background when true. */ + showTransparentBackground?: boolean; + /** Represents statistics data object. */ + statistics?: any; + /** Additional options for slider customization. */ + zoomOptions?: any; + } + export interface OpenStreetMapLayerOptions { + /** An array of levels at which to draw. */ + displayLevels?: number[]; + /** Id to assign to the layer. */ + id?: string; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** An array of tile servers */ + tileServers?: string[]; + /** Initial visibility of the layer. */ + visible?: boolean; + } + export interface OperationBaseOptions { + /** Provide information about the operation. */ + label?: string; + /** Specify the type of operation, for example: "edit" or "navigation". */ + type?: string; + } + export interface OverlayLayersOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** The feature layer that will be overlayed with the overlayLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** An array of feature layers to be overlaid with inputLayer. */ + overlayLayer: FeatureLayer[]; + /** Defines how two input layers are combined. */ + overlayType?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** When the distance between features is less than the tolerance, the features in the overlay layer will snap to the features in the input layer. */ + snapToInput?: boolean; + /** The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both). */ + tolerance?: number; + } + export interface OverviewMapOptions { + /** Specifies which corner of the map to attach the OverviewMap dijit. */ + attachTo?: string; + /** Specify the base layer for the overview map. */ + baseLayer?: Layer; + /** Fill color for the extent rectangle. */ + color?: string; + /** The ratio between the size of the overview map and the extent rectangle displayed on the overview map. */ + expandFactor?: number; + /** Height of the overview map dijit in screen pixels. */ + height?: number; + /** Unique identifier for the dijit. */ + id?: string; + /** Reference to the map. */ + map: Map; + /** Defines the visibility of the maximize/restore button. */ + maximizeButton?: boolean; + /** Opacity of the extent rectangle, defined as a number between 0 (invisible) and 1 (opaque). */ + opacity?: number; + /** Specifies the initial visibility of the overview map. */ + visible?: boolean; + /** Width of the overview map dijit in screen pixels. */ + width?: number; + } + export interface PixelBlockOptions { + /** Number of rows. */ + height: number; + /** An array of nodata mask. */ + mask?: any[]; + /** A two dimensional array. */ + pixels: number[][]; + /** Pixel type. */ + pixelType?: string; + /** Array of objects containing numeric statistical properties (e.g. */ + statistics?: any[]; + /** Number of columns. */ + width: number; + } + export interface PopupMobileOptions { + /** Define the symbol used to highlight polygon features. */ + fillSymbol?: FillSymbol; + /** When true, the feature is highlighted, set to false to disable highlighting. */ + highlight?: boolean; + /** Define the symbol used to highlight line features. */ + lineSymbol?: LineSymbol; + /** Specify the margin (in pixels) to leave to the left of the popup window when it is maximized. */ + marginLeft?: number; + /** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */ + marginTop?: number; + /** Define the marker symbol used to highlight point features. */ + markerSymbol?: MarkerSymbol; + /** Specify the x-offset (in pixels) used when positioning the popup. */ + offsetX?: number; + /** Specify the y-offset (in pixels) used when positioning the popup. */ + offsetY?: number; + /** Define the number of levels to zoom in, default value is 4. */ + zoomFactor?: number; + } + export interface PopupOptions { + /** Controls the placement of the popup window with respect to the geographic location. */ + anchor?: string; + /** Define the symbol used to highlight polygon features. */ + fillSymbol?: FillSymbol; + /** Number of milliseconds after which the popup window will be hidden when visibleWhenEmpty is false and there are no features to be displayed. */ + hideDelay?: boolean; + /** Indicates whether popup should highlight features. */ + highlight?: boolean; + /** Indicates whether a feature should remain highlighted after the user closes the popup window. */ + keepHighlightOnHide?: boolean; + /** Define the symbol used to highlight line features. */ + lineSymbol?: LineSymbol; + /** Specify the margin (in pixels) to leave to the left of the popup window when it is maximized. */ + marginLeft?: number; + /** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */ + marginTop?: number; + /** Define the marker symbol used to highlight point features. */ + markerSymbol?: MarkerSymbol; + /** Specify the x-offset (in pixels) used when positioning the popup. */ + offsetX?: number; + /** Specify the y-offset (in pixels) used when positioning the popup. */ + offsetY?: number; + /** Indicates whether popup should display previous and next buttons in the title bar. */ + pagingControls?: boolean; + /** Indicates whether popup should display the title bar text that contains the page number and total number of available features. */ + pagingInfo?: boolean; + /** Indicates whether the popup window should be displayed. */ + popupWindow?: boolean; + /** Indicates whether the feature's title should display within the body of the popup window as opposed to in the titlebar. */ + titleInBody?: boolean; + /** Indicates whether the popup window remains visible when there are no features to be displayed. */ + visibleWhenEmpty?: boolean; + /** Define the number of levels to zoom in when the 'Zoom to' link is clicked. */ + zoomFactor?: number; + } + export interface PopupTemplateOptions { + /** Positive or negative offset (in minutes) from UTC. */ + utcOffset?: number; + } + export interface PrintOptions { + /** Set to true if the print service is an asynchronous geoprocessing service. */ + async?: boolean; + /** The map to print. */ + map?: Map; + /** An optional array of user-defined templates. */ + templates?: PrintTemplate[]; + /** The url to an export web map task. */ + url?: string; + } + export interface PrintTaskOptions { + /** Set to true if the print service is an asynchronous geoprocessing service. */ + async?: boolean; + } + export interface ProcessorOptions { + /** Start processing features immediately. */ + autostart?: boolean; + /** Whether the processor allow the feature layer to draw its features. */ + drawFeatures?: boolean; + /** Whether the processor do the layer's I/O via a worker. */ + fetchWithWorker?: boolean; + /** A FeatureLayer or array of FeatureLayers to attach the processor to. */ + layers?: FeatureLayer[]; + /** Uses all FeatureLayers associated with the map in the processor. */ + map?: Map; + /** Whether the processor pass the features through without modification or delay to the FeatureLayer. */ + passFeatures?: boolean; + /** Whether the processor require Workers to function properly. */ + requireWorkerSupport?: boolean; + } + export interface QueryTaskLocationProviderOptions { + /** Object containing properties that will be used to query the ArcGIS layer. */ + queryParameters: any; + /** An instance of a QueryTask. */ + queryTask: QueryTask; + /** Set to true when querying a field that contains unicode characters. */ + unicode: boolean; + /** A mapping of the fields in the data and the ArcGIS layer to use to perform a join. */ + whereFields: any; + } + export interface QueryTaskOptions { + /** Specify the geodatabase version to display. */ + gdbVersion?: string; + } + export interface RasterLayerOptions { + /** Sets the layer's draw mode. */ + drawMode?: boolean; + /** Sets the context of the Canvas. */ + drawType?: string; + /** Additional parameters defined in an ImageServiceParameters object. */ + imageServiceParameters?: ImageServiceParameters; + /** Applies a function for visualization or post-processing purposes. */ + pixelFilter?: any; + } + export interface RendererSliderOptions { + /** Collection of indexes that indicates which children from the infos array to use as handles. */ + handles?: number[]; + /** Absolute maximum value allowed by the slider. */ + maximum: number; + /** Top label for the slider. */ + maxLabel?: string; + /** Absolute minimum value allowed by the slider. */ + minimum: number; + /** Bottom label for the slider. */ + minLabel?: string; + /** **CHECK THIS: Is it num of dec places? - Accuracy of the data (related to rounding). */ + precision?: number; + /** Primary handle identified by its index value within the related infos array (color, size, break). */ + primaryHandle?: number; + /** Toggle for showing the black handle bars. */ + showHandles?: boolean; + /** Flexible toggle for showing labels (e.g. */ + showLabels?: any; + /** Toggle for showing the horizontal line indicators from the center of the handle. */ + showTicks?: boolean; + /** Stores positions represented as numbers that fall between minimum and maximum. */ + values: number[]; + } + export interface RingBufferOptions { + /** The radii to use to create ring buffers */ + radii: number[]; + /** The units of the radii. */ + units: string; + } + export interface ScaleDependentRendererOptions { + /** An array of objects where each object defines a renderer and the zoom or scale range to which it applies. */ + rendererInfos?: any[]; + } + export interface ScalebarOptions { + /** Specify the scalebar position on the map. */ + attachTo?: string; + /** Reference to the map. */ + map: Map; + /** Specify the style for the scalebar. */ + scalebarStyle?: string; + /** Specify the scalebar units. */ + scalebarUnit?: string; + } + export interface SearchOptions { + /** The currently selected source. */ + activeSourceIndex?: any; + /** Indicates whether to automatically add all the feature layers from the map. */ + addLayersFromMap?: boolean; + /** Indicates whether to automatically navigate to the selected result. */ + autoNavigate?: boolean; + /** Indicates whether to automatically select the first result. */ + autoSelect?: boolean; + /** Indicates whether to enable an option to collapse/expand the search into a button. */ + enableButtonMode?: boolean; + /** Indicates whether to show the selected feature on the map using the highlight symbol property. */ + enableHighlight?: boolean; + /** Indicates whether to display the infoWindow on feature click. */ + enableInfoWindow?: boolean; + /** Indicates whether to enable showing a label for the geometry.The default value is false. */ + enableLabel?: boolean; + /** Indicates whether to enable the menu for selecting different sources. */ + enableSourcesMenu?: boolean; + /** Indicates whether or not to enable suggest on the widget. */ + enableSuggestions?: boolean; + /** Indicates whether to display suggest results. */ + enableSuggestionsMenu?: boolean; + /** Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false). */ + expanded?: boolean; + /** This the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. */ + graphicsLayer?: Layer; + /** The symbol used for highlightGraphic. */ + highlightSymbol?: Symbol; + /** A customized infoTemplate for the selected feature. */ + infoTemplate?: InfoTemplate; + /** The text symbol for the label graphic. */ + labelSymbol?: TextSymbol; + /** The default distance specified in meters used to reverse geocode, (if not specified by source).The default value is 1500. */ + locationToAddressDistance?: number; + /** Reference to the map. */ + map?: Map; + /** The default maximum number of results returned by the widget if not specified by source. */ + maxResults?: number; + /** The default maximum number of suggestions returned by the widget if not specified by source. */ + maxSuggestions?: number; + /** The default minimum amount of characters needed for the search if not specified by source. */ + minCharacters?: number; + /** Indicates whether to show the infoWindow when a result is selected. */ + showInfoWindowOnSelect?: boolean; + /** An array of source objects used to find search results. */ + sources?: any[]; + /** The millisecond delay after keyup and before making a suggest network request. */ + suggestionDelay?: number; + /** The CSS class selector used to uniquely style the widget. */ + theme?: string; + /** Current value of the search box input text string. */ + value?: string; + /** Indicates whether to show the Search widget. */ + visible?: boolean; + /** If the result does not have an associated extent, specify this number to use as the zoom scale for the result. */ + zoomScale?: number; + } + export interface SizeInfoSliderOptions { + /** Classification method. */ + classificationMethod?: string; + /** Handles identified by their index values within the stops array. */ + handles: number[]; + /** Represents histogram data object. */ + histogram?: any; + /** Width of the histogram in pixels. */ + histogramWidth?: number; + /** Absolute maximum value of the slider. */ + maxValue?: number; + /** Absolute minimum value of the slider. */ + minValue?: number; + /** Normalization type. */ + normalizationType?: string; + /** Handle identified by its index value within the stops array. */ + primaryHandle?: number; + /** Width of slider ramp in pixels. */ + rampWidth?: number; + /** Displays slider handles when true. */ + showHandles?: boolean; + /** Displays the histogram when true. */ + showHistogram?: boolean; + /** Displays labels when true. */ + showLabels?: boolean; + /** Displays slider ticks when true. */ + showTicks?: boolean; + /** Data map containing renderer information. */ + sizeInfo: any; + /** Represents statistics data object. */ + statistics?: any; + /** Additional options to customize slider. */ + zoomOptions?: any; + } + export interface SnappingManagerOptions { + /** When true, snapping is always enabled. */ + alwaysSnap?: boolean; + /** See the object specifications table below for the structure of the layerInfos object. */ + layerInfos?: any[]; + /** Reference to the map. */ + map: Map; + /** When alwaysSnap is set to false use this option to define the key users press to enable snapping. */ + snapKey?: any; + /** Define a symbol for the snapping location. */ + snapPointSymbol?: SimpleMarkerSymbol; + /** Specify the radius of the snapping circle in pixels. */ + tolerance?: number; + } + export interface SpatialIndexOptions { + /** Start processing features immediately. */ + autostart?: boolean; + /** Whether the processor allow the feature layer to draw its features. */ + drawFeatures?: boolean; + /** Whether the processor do the layer's I/O via a worker. */ + fetchWithWorkers?: boolean; + /** Index system specific options. */ + indexOptions?: any; + /** The indexing system to use. */ + indexType?: string; + /** A FeatureLayer or array of FeatureLayers to attach the processor to. */ + layers?: FeatureLayer[]; + /** Uses all FeatureLayers associated with the map in the processor. */ + map?: Map; + /** Whether the processor pass the features through without modification or delay to the FeatureLayer. */ + passFeatures?: boolean; + /** Whether the processor require Workers to function properly. */ + requireWorkerSupport?: boolean; + } + export interface StandardGeographyQueryLocationProviderOptions { + /** A template to be used to build the query for Standard Geography query. */ + geographyQueryTemplate: string; + /** An object that specifies the parameters to use in the Standard Geography query. */ + queryParameters?: any; + /** An instance of the StandardGeographyQuery class. */ + standardGeographyQueryTask: StandardGeographyQueryTask; + } + export interface StreamLayerOptions1 { + /** Class attribute to set for the layer's node. */ + className?: string; + /** Where clause to use as definition expression for layer. */ + definitionExpression?: string; + /** The extent to use as the spatial filter for the layer. */ + geometryDefinition?: Extent; + /** Maximum number of observations to show for each unique track. */ + maximumTrackPoints?: number; + /** An array of strings corresponding with fields to include in the StreamLayer. */ + outFields?: string[]; + /** Rules for purging data from the layer to avoid overloading the browser with too many features. */ + purgeOptions?: any; + } + export interface StreamLayerOptions2 { + /** Class attribute to set for the layer's node. */ + className?: string; + /** The extent to use as the spatial filter for the layer. */ + geometryDefinition?: Extent; + /** Maximum number of observations to show for each unique track. */ + maximumTrackPoints?: number; + /** An array of strings corresponding with fields to include in the StreamLayer. */ + outFields?: string[]; + /** Rules for purging data from the layer to avoid overloading the browser with too many features. */ + purgeOptions?: any; + /** The URL to use for connecting to a socket. */ + socketUrl?: string; + } + export interface SummarizeNearbyOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** An array of numbers that defines the search distance (for StraightLine or DrivingDistance) or time (for DrivingTime) shown in the distance input in the Find nearest features using a option. */ + distance?: number[]; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for sumNearbyLayer with point geometries (esriGeometryPoint). */ + enableTravelModes?: boolean; + /** A field of the summarizeLayer features that you can use to calculate statistics separately for each unique attribute value. */ + groupByField?: string; + /** Reference to the map object. */ + map?: Map; + /** Type of distance measurement shown as the defeault value in the Find nearest features using a option. */ + nearType?: string; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** Type of units shown under the Total Area checkbox in the Add statistics from option. */ + shapeUnits?: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** An array of possible statistics attribute field names and summary types that you wish to calculate for all nearby features. */ + summaryFields?: string[]; + /** The feature layer to be shown selected in the Choose layer to summarize dropdown. */ + summaryLayer?: FeatureLayer; + /** An array of possible feature layers summarizing toward. */ + summaryLayers: FeatureLayer[]; + /** The point, line, or polygon feature layer from which distances will be measured to features in summarizeLayer. */ + sumNearbyLayer: FeatureLayer; + /** If true. */ + sumShape?: boolean; + /** Type of units shown as the defeault value in the Find nearest features using a option. */ + units?: string; + } + export interface SummarizeWithinOptions { + /** The URL to the GPServer used to execute an analysis job. */ + analysisGpServer?: string; + /** A field name from summaryLayer that you can use to calculate statistics separately for each unique attribute value. */ + groupByField?: string; + /** Reference to the map object. */ + map?: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName?: string; + /** The url to the ArcGIS.com site or in-house portal where the GP server is hosted. */ + portalUrl?: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection?: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent?: boolean; + /** When true, the show credit option is visible. */ + showCredits?: boolean; + /** When true, the help links will be shown. */ + showHelp?: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder?: boolean; + /** A list of field names and statistical summary type that you wish to calculate for all features in SummaryLayer that are within each polygon in sumWithinLayer. */ + summaryFields?: string; + /** The summary layer to be shown selected in in the Choose layer to summarize menu. */ + summaryLayer?: FeatureLayer; + /** An array of summarize layer candidates. */ + summaryLayers: FeatureLayer[]; + /** The polygon feature layer to be summarized toward. */ + sumWithinLayer: FeatureLayer; + } + export interface SymbolStylerOptions { + /** Self response of Portal used as symbol provider. */ + portalSelf: string; + /** URL to Portal used as symbol provider. */ + portalUrl: string; + } + export interface TemplatePickerOptions { + /** Number of visible columns. */ + columns?: number; + /** Defines the text to be displayed when the template picker does not have any templates to display. */ + emptyMessage?: string; + /** Array of input feature layers. */ + featureLayers?: FeatureLayer[]; + /** Templates are grouped based on the containing feature layer. */ + grouping?: boolean; + /** An array of items described using the syntax below. */ + items?: any[]; + /** Length of label description. */ + maxLabelLength?: number; + /** Number of visible rows. */ + rows?: number; + /** Tooltip content contains the template name and description. */ + showTooltip?: boolean; + /** HTML style attributes for the widget. */ + style?: string; + /** When true, the template picker displays map service legend swatches for feature layers created in selection mode that have an associated map service added to the map as a dynamic map service layer. */ + useLegend?: boolean; + } + export interface TimeSliderOptions { + /** When true, subtracts one second to the time extent's end time to exclude data at the exact end time instant. */ + excludeDataAtLeadingThumb?: boolean; + /** When true, adds one second to the time extent's start time to exclude data at the exact start time instant. */ + excludeDataAtTrailingThumb?: boolean; + } + export interface UndoManagerOptions { + /** The maximum number of operations the UndoManager can perform. */ + maxOperations?: number; + } + export interface UnionOptions { + /** The feature(s) removed from the feature layer by the union operation. */ + deletedGraphics?: Graphic[]; + /** The feature layer that contains the unioned feature(s). */ + featureLayer?: FeatureLayer; + /** The updated feature(s). */ + postUpdatedGraphics?: Graphic[]; + /** The feature(s) before the union operation is performed. */ + preUpdatedGraphics?: Graphic[]; + } + export interface UpdateOptions { + /** The feature layer that contains the updated feature(s). */ + featureLayer?: FeatureLayer; + /** The updated feature(s). */ + postUpdatedGraphics?: Graphic[]; + /** The feature(s) prior to the update. */ + preUpdatedGraphics?: Graphic[]; + } + export interface VEGeocoderOptions { + /** Key used to access Bing Maps maps. */ + bingMapsKey?: string; + /** Specifies the culture in which to return results. */ + culture?: string; + } + export interface VETiledLayerOptions { + /** Key used to access Bing Maps maps. */ + bingMapsKey?: string; + /** Class attribute to set for the layer's node. */ + className?: string; + /** Specifies the culture in which to return results. */ + culture?: string; + /** Bing Maps style. */ + mapStyle?: string; + /** Refresh interval of the layer in minutes. */ + refreshInterval?: number; + } + export interface VectorFieldRendererOptions { + /** Sets the flow direction of the data. */ + flowRepresentation?: string; + /** A symbol that can be defined if the style is set to STYLE_SINGLE_ARROW. */ + singleArrowSymbol?: Symbol; + /** A predefined style. */ + style?: string; + } + export interface WMSLayerOptions { + /** Specify the map image format, valid options are png,jpg,bmp,gif,svg. */ + format?: string; + /** An optional resourceInfo object. */ + resourceInfo?: any; + /** If the WMS service supports transparency, specify whether the image background is transparent. */ + transparent?: boolean; + /** A version number. */ + version?: string; + /** A list of layer names that represent the layers to include in the exported map. */ + visibleLayers?: string[]; + } + export interface WMTSLayerInfoOptions { + /** The description of the layer defined by the abstract property of the capabilities file or resource info. */ + description?: string; + /** Specify a format supported by the service. */ + format?: string; + /** The full extent of the WMTS layer. */ + fullExtent?: Extent; + /** The layer id. */ + identifier?: string; + /** The initial extent of the WMTS layer. */ + initialExtent?: Extent; + /** Specify the layer style. */ + style?: string; + /** A tile info object. */ + tileInfo?: TileInfo; + /** Define the tileMatrixSet for the layer. */ + tileMatrixSet?: string; + /** The layer title. */ + title?: string; + } + export interface WMTSLayerOptions { + /** A WMTSLayerInfo object that when ResourceInfo options are not specified the map will display the first layer in the WMTS capabilities that matches the properties specified by WMTSLayerInfo. */ + layerInfo?: WMTSLayerInfo; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** An optional resource info object. */ + resourceInfo?: any; + /** Specify the service type. */ + serviceMode?: string; + } + export interface WebTiledLayerOptions { + /** Define attribution information for the layer to be used by the Attribution widget. */ + copyright?: string; + /** Specify the full extent of the layer. */ + fullExtent?: Extent; + /** Specify the initial extent of the layer. */ + initialExtent?: Extent; + /** When true, tile resampling is enabled. */ + resampling?: boolean; + /** Number of levels beyond the last level where tiles are available. */ + resamplingTolerance?: number; + /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ + subDomains?: string[]; + /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo?: TileInfo; + /** Define additional tile server domains for the layer. */ + tileServers?: string[]; + } +} + +declare module "esri/Color" { + /** Inherits all attributes from dojo/_base/Color to provide functions for setting colors. */ + class Color { + /** Dictionary list of all CSS named colors, by name. */ + static named: any; + /** The alpha value. */ + a: number; + /** The blue value. */ + b: number; + /** The green value. */ + g: number; + /** The red value. */ + r: number; + /** + * Creates a new Color object. + * @param color A named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object. + */ + constructor(color?: string); + /** + * Creates a new Color object. + * @param color A named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object. + */ + constructor(color?: number[]); + /** + * Creates a new Color object. + * @param color A named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object. + */ + constructor(color?: any); + /** + * Blend colors start and end with weight from 0 to 1, 0.5 being a 50/50 blend. + * @param start The start color. + * @param end The end color. + * @param weight The weight value. + * @param obj A previously allocated Color object to reuse for the result. + */ + static blendColors(start: Color, end: Color, weight: number, obj?: Color): Color; + /** + * Builds a Color from a 3 or 4 element array, mapping each element in sequence to the rgb(a) values of the color. + * @param a The input array. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromArray(a: number[], obj?: Color): Color; + /** + * Converts a hex string with a '#' prefix to a color object. + * @param color The input color. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromHex(color: string, obj?: Color): Color; + /** + * Returns a Color instance from a string of the form "rgb()" or "rgba()". + * @param color The input color. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromRgb(color: string, obj?: Color): Color; + /** + * Parses str for a color value. + * @param str The input value. + * @param obj A previously allocated Color object to reuse for the result. + */ + static fromString(str: string, obj?: Color): Color; + /** + * Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value. + * @param color The new color value. + */ + setColor(color: string): Color; + /** + * Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value. + * @param color The new color value. + */ + setColor(color: number[]): Color; + /** + * Takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another Color object and sets this color instance to that value. + * @param color The new color value. + */ + setColor(color: any): Color; + /** + * Returns a css color string in rgb(a) representation. + * @param includeAlpha If true, the alpha value will be included in the result. + */ + toCss(includeAlpha?: boolean): string; + /** Returns a CSS color string in hexadecimal representation. */ + toHex(): string; + /** Returns a 3 component array of rgb values. */ + toRgb(): number[]; + /** Returns a 4 component array of rgba values. */ + toRgba(): number[]; + } + export = Color; +} + +declare module "esri/Credential" { + import esri = require("esri"); + + /** The Credential class represents a credential object used to access a secure ArcGIS resource. */ + class Credential { + /** Token expiration time specified as number of milliseconds since 1 January 1970 00:00:00 UTC. */ + expires: number; + /** Indicates whether this credential belongs to a user with admin privileges. */ + isAdmin: boolean; + /** The Identity Manager's setOAuthRedirectionHandler returns an object that contains a "state" parameter. */ + oAuthState: any; + /** The server url. */ + server: string; + /** Indicates whether the resources accessed using this credential should be fetched over HTTPS protocol. */ + ssl: boolean; + /** Token generated by the token service using the specified userId and password. */ + token: string; + /** User associated wth the Credential object. */ + userId: string; + /** Destroy a credential. */ + destroy(): void; + /** Generate a new token and update the Credential's token property with the newly acquired token. */ + refreshToken(): any; + /** Return the properties of this object in JSON. */ + toJson(): any; + /** Fired when a credential object is destroyed. */ + on(type: "destroy", listener: (event: { target: Credential }) => void): esri.Handle; + /** Fired when the token associated with the credential is updated or changed. */ + on(type: "token-change", listener: (event: { target: Credential }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Credential; +} + +declare module "esri/IdentityManager" { + import esri = require("esri"); + import IdentityManagerBase = require("esri/IdentityManagerBase"); + + /** This module returns a singleton class that is automatically instantiated into esri.id when the module containing this class is imported into the application. */ + class IdentityManager extends IdentityManagerBase { + /** Dialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. */ + dialog: any; + /** + * When accessing secure resources via Oauth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. + * @param handlerFunction When called, the function passed to setOAuthRedirectionHandler receives an object containing the redirection properties. + */ + setOAuthRedirectionHandler(handlerFunction: Function): void; + /** + * Use this method in the popup callback page to pass the token and other values back to the IdentityManager. + * @param hash The token information in addition to any other values needed to be passed back to the IdentityManager. + */ + setOAuthResponseHash(hash: string): void; + /** This method is called by the base identity manager implementation. */ + signIn(): any; + /** Fired when the user clicks the cancel button on the dialog box widget. */ + on(type: "dialog-cancel", listener: (event: { info: any; target: IdentityManager }) => void): esri.Handle; + /** Fired when the dialog box widget, used to prompt users for their credentials, is created. */ + on(type: "dialog-create", listener: (event: { target: IdentityManager }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = IdentityManager; +} + +declare module "esri/IdentityManagerBase" { + import esri = require("esri"); + import Credential = require("esri/Credential"); + import OAuthInfo = require("esri/arcgis/OAuthInfo"); + import ServerInfo = require("esri/ServerInfo"); + + /** This class provides the framework and helper methods required to implement a solution for managing user credentials. */ + class IdentityManagerBase { + /** The suggested lifetime of the token in minutes. */ + tokenValidity: number; + /** + * Returns the credential (via Deferred) if the user has already signed in to access the given resource. + * @param resUrl The resource URL. + */ + checkSignInStatus(resUrl: string): any; + /** Destroys all credentials. */ + destroyCredentials(): void; + /** + * Returns the credential for the resource identified by the specified url. + * @param url The url to a server. + * @param userId The userId for which you want to obtain credentials. + */ + findCredential(url: string, userId?: string): Credential; + /** + * Returns the OAuth configuration for the passed in Portal server URL. + * @param url The URL to the Portal. + */ + findOAuthInfo(url: string): OAuthInfo; + /** + * Returns information about the server that is hosting the specified url. + * @param url The url to a server. + */ + findServerInfo(url: string): ServerInfo; + /** + * Returns an object containing a token and its expiration time. + * @param serverInfo A ServerInfo object that contains a token service URL. + * @param userInfo A user info object containing a user name and password. + * @param options Optional parameters. + */ + generateToken(serverInfo: ServerInfo, userInfo: any, options?: any): any; + /** + * Returns a Credential object that can be used to access the secured resource identified by the input url. + * @param url The url for the secure resource. + * @param options Optional parameters. + */ + getCredential(url: string, options?: any): any; + /** + * Call this method (during your application initialization) with JSON previously obtained from toJson method to re-hydrate the state of identity manager. + * @param json The JSON obtained from the toJson method. + */ + initialize(json: Object): any; + /** Returns true if the identity manager is busy accepting user input, i.e., the user has invoked signIn and is waiting for a response. */ + isBusy(): boolean; + /** + * Sub-classes must implement this method if OAuth support is required. + * @param resUrl The resource URL. + * @param serverInfo A ServerInfo object that contains the token service url. + * @param OAuthInfo A OAuthInfo object that contains the authorization configuration. + * @param options Optional parameters. + */ + oAuthSignIn(resUrl: string, serverInfo: ServerInfo, OAuthInfo: OAuthInfo, options?: any): any; + /** + * Registers OAuth configurations. + * @param oAuthInfos An OAuthInfos object that defines the OAuth configurations. + */ + registerOAuthInfos(oAuthInfos: OAuthInfo[]): void; + /** + * Register secure servers and the token endpoints. + * @param serverInfos A ServerInfos object that defines the secure service and token endpoint. + */ + registerServers(serverInfos: ServerInfo[]): void; + /** + * Registers the given OAuth2 access token with the identity manager. + * @param properties See the object specifications table below for the structure of the properties object. + */ + registerToken(properties: any): void; + /** + * When accessing secured resources, identity manager may prompt for username and password and send them to the server using a secure connection. + * @param handlerFunction The function to call when the protocol is mismatched. + */ + setProtocolErrorHandler(handlerFunction: Function): void; + /** + * When accessing secure resources from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com sign-in page. + * @param handlerFunction When called, the function passed to setRedirectionHandler receives an object containing redirection properties. + */ + setRedirectionHandler(handlerFunction: Function): void; + /** + * Sub-classes must implement this method to create and manager the user interface that is used to obtain a username and password from the end-user. + * @param url Url for the secure resource. + * @param serverInfo A ServerInfo object that contains the token service url. + * @param options Optional parameters. + */ + signIn(url: string, serverInfo: ServerInfo, options?: any): any; + /** Return properties of this object in JSON. */ + toJson(): any; + /** Fired when a credential is created. */ + on(type: "credential-create", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + /** Fired when all credentials are destroyed. */ + on(type: "credentials-destroy", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = IdentityManagerBase; +} + +declare module "esri/InfoTemplate" { + /** An InfoTemplate contains a title and content template string used to transform Graphic.attributes into an HTML representation. */ + class InfoTemplate { + /** The template for defining how to format the content used in an InfoWindow. */ + content: any; + /** The template for defining how to format the title used in an InfoWindow. */ + title: any; + /** Creates a new empty InfoTemplate object. */ + constructor(); + /** + * Creates a new InfoTemplate object. + * @param title The template for defining how to format the title used in an InfoWindow. + * @param content The template for defining how to format the content used in an InfoWindow. + */ + constructor(title: string, content: string); + /** + * Creates a new InfoTemplate object using a JSON object. + * @param json JSON object representing the InfoTemplate. + */ + constructor(json: Object); + /** + * Sets the content template. + * @param template The template for the content. + */ + setContent(template: string): InfoTemplate; + /** + * Sets the content template. + * @param template The template for the content. + */ + setContent(template: Function): InfoTemplate; + /** + * Sets the title template. + * @param template The template for the title. + */ + setTitle(template: string): InfoTemplate; + /** + * Sets the title template. + * @param template The template for the title. + */ + setTitle(template: Function): InfoTemplate; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = InfoTemplate; +} + +declare module "esri/InfoWindowBase" { + import esri = require("esri"); + import Map = require("esri/map"); + import Point = require("esri/geometry/Point"); + + /** The base class for the out-of-the-box InfoWindow. */ + class InfoWindowBase { + /** The reference to a DOM node where the info window is constructed. */ + domNode: any; + /** Indicates if the info window is visible. */ + isShowing: boolean; + /** Helper method. */ + destroyDijits(): void; + /** Hide the info window. */ + hide(): void; + /** + * Helper method. + * @param value A string with HTML tags or a DOM node. + * @param parentNode The parent node where the value will be placed. + */ + place(value: string, parentNode: Node): void; + /** + * Helper method. + * @param value A string with HTML tags or a DOM node. + * @param parentNode The parent node where the value will be placed. + */ + place(value: HTMLElement, parentNode: Node): void; + /** + * Resize the info window to the specified width and height (in pixels). + * @param width The new width of the InfoWindow in pixels. + * @param height The new height of the InfoWindow in pixels. + */ + resize(width: number, height: number): void; + /** + * Define the info window content. + * @param content The content argument can be any of the following. + */ + setContent(content: string): void; + /** + * Define the info window content. + * @param content The content argument can be any of the following. + */ + setContent(content: any): void; + /** + * This method is called by the map when the object is set as its info window. + * @param map The map object. + */ + setMap(map: Map): void; + /** + * Set the input value as the title for the info window. + * @param title In most cases the title will be a string value but the same options are available as for the setContent method. + */ + setTitle(title: string): void; + /** + * Set the input value as the title for the info window. + * @param title In most cases the title will be a string value but the same options are available as for the setContent method. + */ + setTitle(title: any): void; + /** + * Display the info window at the specified location. + * @param location Location is an instance of esri.geometry.Point. + */ + show(location: Point): void; + /** Helper method. */ + startupDijits(): void; + /** + * This method is called by the map when the object is no longer the map's info window. + * @param map The map object. + */ + unsetMap(map: Map): void; + /** Fires after the info window is hidden. */ + on(type: "hide", listener: (event: { target: InfoWindowBase }) => void): esri.Handle; + /** Fires after the info window becomes visible. */ + on(type: "show", listener: (event: { target: InfoWindowBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfoWindowBase; +} + +declare module "esri/OperationBase" { + import esri = require("esri"); + + /** The OperationBase class defines operations that can be added to the UndoManager. */ + class OperationBase { + /** Details about the operation, for example: "Update" may be the label for an edit operation that updates features. */ + label: string; + /** The type of operation, for example: "edit" or "navigation". */ + type: string; + /** + * Creates a new OperationBase object. + * @param params See options list for parameters. + */ + constructor(params: esri.OperationBaseOptions); + /** Re-perform the last undo operation. */ + performRedo(): void; + /** Reverse the operation. */ + performUndo(): void; + } + export = OperationBase; +} + +declare module "esri/ServerInfo" { + /** This class contains information about an ArcGIS Server and its token endpoint. */ + class ServerInfo { + /** The token service URL used to generate tokens for ArcGIS Server Admin resources. */ + adminTokenServiceUrl: string; + /** Version of the ArcGIS Server REST API deployed on this server. */ + currentVersion: number; + /** The server URL. */ + server: string; + /** Validity of short-lived token in minutes. */ + shortLivedTokenValidity: number; + /** The token service URL used to generate tokens for the secured resources on the server. */ + tokenServiceUrl: string; + /** Return the properties of this object in JSON. */ + toJson(): any; + } + export = ServerInfo; +} + +declare module "esri/SnappingManager" { + import esri = require("esri"); + import Point = require("esri/geometry/Point"); + + /** The SnappingManager is used to add snapping capability to the Editor, Measurement Widget, Draw toolbar and Edit toolbar. */ + class SnappingManager { + /** + * Create a new SnappingManager object. + * @param options Optional parameters. + */ + constructor(options?: esri.SnappingManagerOptions); + /** Destroy the SnappingManager object. */ + destroy(): void; + /** + * Returns a deferred object, which can be added to a callback to find the snap point. + * @param screenPoint The input screen point for which to find the snapping location. + */ + getSnappingPoint(screenPoint: Point): any; + /** + * An array of layerInfo objects used to specify the target snapping layers. + * @param layerInfos An array of layerInfo objects that define the snapping target layers. + */ + setLayerInfos(layerInfos: any[]): void; + } + export = SnappingManager; +} + +declare module "esri/SpatialReference" { + /** The spatial reference of a map, layer, or inputs to and outputs from a task. */ + class SpatialReference { + /** The well-known ID of a spatial reference. */ + wkid: number; + /** The well-known text that defines a spatial reference. */ + wkt: string; + /** + * Creates a new SpatialReference object. + * @param json The REST JSON representation of the spatial reference. + */ + constructor(json: Object); + /** + * Create a spatial reference object and initialize it with a well-known ID (wkid). + * @param wkid The well-known id (wkid) of the coordinate system. + */ + constructor(wkid: number); + /** + * Create a spatial reference object and initialize it with the given well-known text (wkt). + * @param wkt The well-known text (wkt) of the coordinate system. + */ + constructor(wkt: string); + /** + * Returns true if the input spatial reference object has the same wkid or wkt as this spatial reference object. + * @param sr The spatial reference to compare. + */ + equals(sr: SpatialReference): boolean; + /** Returns true if the wkid of the spatial reference object is one of the following values: 102113, 102100, 3857. */ + isWebMercator(): boolean; + /** Returns an easily serializable object representation of the spatial reference. */ + toJson(): any; + } + export = SpatialReference; +} + +declare module "esri/TimeExtent" { + /** The time extent is a span of time going from a start time to an end time. */ + class TimeExtent { + /** The end time for the specified time extent. */ + endTime: Date; + /** The start time for the specified time extent. */ + startTime: Date; + /** + * Creates a new TimeExtent object with the specifed start and end time. + * @param startTime The start time for the specified time extent. + * @param endTime The end time for the specified time extent. + */ + constructor(startTime: Date, endTime: Date); + /** + * Returns a new time extent indicating the intersection between "this" and the argument time extent. + * @param timeExtent The input time extent. + */ + intersection(timeExtent: number): TimeExtent; + /** + * Returns a new time extent with the given offset from "this' time extent. + * @param offsetValue The length of time to offset from "this" time extent. + * @param offsetUnits The offset units, see the TimeInfo constants for a list of valid values. + */ + offset(offsetValue: number, offsetUnits: string): TimeExtent; + } + export = TimeExtent; +} + +declare module "esri/arcgis/OAuthInfo" { + import esri = require("esri"); + + /** This class contains information about an OAuth configuration. */ + class OAuthInfo { + /** The registered application Id. */ + appId: string; + /** Applications with the same value will share the stored token on the same host. */ + authNamespace: string; + /** The number of minutes the token that the token is valid. */ + expiration: number; + /** The locale for the OAuth sign in page. */ + locale: string; + /** The minimum time in minutes before a saved token is due to expire that it should still be considered valid for use. */ + minTimeUntilExpiration: number; + /** Set to true to show the OAuth sign in page in a popup window. */ + popup: boolean; + /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + popupCallbackUrl: string; + /** The window features passed to window.open(). */ + popupWindowFeatures: string; + /** The ArcGIS for Portal URL. */ + portalUrl: string; + /** + * Creates a new OAuthInfo given the specified parameters. + * @param params Various options to configure the OAuthInfo object. + */ + constructor(params: esri.OAuthInfoOptions); + /** Returns an easily serializable object representation of the OAuthInfo. */ + toJson(): any; + } + export = OAuthInfo; +} + +declare module "esri/arcgis/Portal" { + import esri = require("esri"); + + /** The Portal class is part of the ArcGIS Portal API which provides a way to build applications that work with content from ArcGIS Online or an ArcGIS Portal. */ + export class Portal { + /** The access level of the organization. */ + access: string; + /** When true, access to the organization's Portal resources must occur over SSL. */ + allSSL: boolean; + /** The query that defines the basemaps that are displayed in the Basemap Gallery. */ + basemapGalleryGroupQuery: string; + /** The Bing key to use for web maps using Bing Maps. */ + bingKey: string; + /** Whether an organization can list applications in the marketplace . */ + canListApps: boolean; + /** Whether an organization can list data services in the marketplace. */ + canListData: boolean; + /** Whether an organization can list pre-provisioned items in the marketplace. */ + canListPreProvisionedItems: boolean; + /** Whether an organization can provision direct purchases in the marketplace without customer request. */ + canProvisionDirectPurchase: boolean; + /** When true, the organization's public items, groups and users are included in search queries. */ + canSearchPublic: boolean; + /** The Bing key can be shared to the public and is returned as part of a portal's description call (/sharing/rest/portals/). */ + canShareBingPublic: boolean; + /** When true, members of the organization can share resources outside the organization. */ + canSharePublic: boolean; + /** Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the ArcGIS sign in. */ + canSignInArcGIS: boolean; + /** Whether to allow an organization with an enterprise IDP configured to be able to turn on or off the enterprise sign in. */ + canSignInIDP: boolean; + /** The query that identifies the group containing the color sets used for rendering in the map viewer. */ + colorSetsGroupQuery: string; + /** Whether to allow the organization to disable commenting. */ + commentsEnabled: boolean; + /** Date the organization was created. */ + created: Date; + /** The default locale (language and country) information. */ + culture: string; + /** The custom base URL for the portal. */ + customBaseUrl: string; + /** The default basemap the portal displays in the map viewer. */ + defaultBasemap: any; + /** The default extent for the map the portal displays in the map viewer. */ + defaultExtent: any; + /** A description of the organization / portal. */ + description: string; + /** The featured groups for the portal. */ + featuredGroups: any[]; + /** The featured groups for the organization. */ + featuredGroupsId: string; + /** The query that defines the featured group. */ + featuredItemsGroupQuery: string; + /** The query that identifies the group containing features items for the gallery. */ + galleryTemplatesGroupQuery: string; + /** The group that contains featured content to be displayed on the home page. */ + homePageFeaturedContent: string; + /** The number of featured items that can be displayed on the home page. */ + homePageFeaturedContentCount: number; + /** The port used by the portal for HTTP communication. */ + httpPort: number; + /** The port used by the portal for HTTPS communication. */ + httpsPort: number; + /** The id of the organization that owns this portal. */ + id: string; + /** The country code of the calling IP (ArcGIS Online only). */ + ipCntryCode: string; + /** Indicates if the portal is an organization. */ + isOrganization: boolean; + /** Indicates if the portal is on premises. */ + isPortal: boolean; + /** The query that defines the collection of editable layer templates. */ + layerTemplatesGroupQuery: string; + /** The maximum validity in minutes of tokens issued for users of the organization. */ + maxTokenExpirationMinutes: number; + /** Date the organization was last modified. */ + modified: Date; + /** The Name of the organization / portal. */ + name: string; + /** The portal host's URL. */ + portalHostname: string; + /** Denotes multitenant or singletenant. */ + portalMode: string; + /** The name of the portal, i.e., ArcGIS Online. */ + portalName: string; + /** Stores properties specific to the organization, for example the "contact us" link. */ + portalProperties: any; + /** The URL to the thumbnail of the portal. */ + portalThumbnail: string; + /** URL to the portal. */ + portalUrl: string; + /** The region for the organization. */ + region: string; + /** Custom HTML for the home page. */ + rotatorPanels: string[]; + /** Whether the description of your organization displays on the home page. */ + showHomePageDescription: boolean; + /** Whether hosted services are supported. */ + supportsHostedServices: boolean; + /** Whether OAuth is supported. */ + supportsOAuth: boolean; + /** The query that defines the symbols sets used by the map viewer. */ + symbolSetsGroupQuery: string; + /** The query that defines the collection of templates that will appear in the template gallery. */ + templatesGroupQuery: string; + /** The URL to the thumbnail of the organization. */ + thumbnail: string; + /** The url to the thumbnail of the organization (full path). */ + thumbnailUrl: string; + /** Sets the units of measure for the organization's users. */ + units: string; + /** The portal url. */ + url: string; + /** The prefix selected by the organization's administrator to be used with the customBaseURL. */ + urlKey: string; + /** User information for the accessing user is returned only when a token is passed in. */ + user: any; + /** If true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. */ + useStandardizedQuery: boolean; + /** + * Creates a new Portal object. + * @param url URL to the ArcGIS.com site or in-house portal. + */ + constructor(url: string); + /** Returns a PortalUser object that describes the user currently signed in to the portal. */ + getPortalUser(): PortalUser; + /** + * Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalGroup objects for all the groups that match the input query. + * @param queryParams The input query parameters. + */ + queryGroups(queryParams?: any): any; + /** + * Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query. + * @param queryParams The input query parameters. + */ + queryItems(queryParams?: any): any; + /** + * Execute a query against the Portal to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalUser objects that match the input query. + * @param queryParams The input query parameters. + */ + queryUsers(queryParams?: any): any; + /** Prompts the user using the IdentityManager and returns a deferred that, when resolved, returns the PortalUser for the input credentials. */ + signIn(): any; + /** Sign out of the Portal which resets the Portal and disables identity checking. */ + signOut(): Portal; + /** Fires when the signIn() call fails or if the Portal is not able to load. */ + on(type: "error", listener: (event: { error: Error; target: Portal }) => void): esri.Handle; + /** Fired when the portal has loaded. */ + on(type: "load", listener: (event: { target: Portal }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + /** Details about a comment on a Portal item.View the ArcGIS Portal API REST documentation for the item comment for more details. */ + export class PortalComment { + /** The comment text. */ + comment: string; + /** The date and time the comment was created. */ + created: string; + /** The comment id. */ + id: string; + /** The user name of the user who created the comment. */ + owner: string; + } + /** The PortalFolder class provides information about folders used to organize content in a portal. */ + export class PortalFolder { + /** The date the folder was created. */ + created: Date; + /** The id of the folder. */ + id: string; + /** The portal for the folder. */ + portal: Portal; + /** The title of the folder. */ + title: string; + /** The url to to the folder. */ + url: string; + /** Find all the items in the folder. */ + getItems(): any; + } + /** The group resource represents a group within the Portal. */ + export class PortalGroup { + /** The access privileges on the group which determines who can see and access the group. */ + access: string; + /** The date the group was created. */ + created: Date; + /** A detailed description of the group. */ + description: string; + /** The id for the group. */ + id: string; + /** If this is set to true, then users will not be able to apply to join the group. */ + isInvitationOnly: boolean; + /** Denotes a view only group where members are not able to share items. */ + isViewOnly: boolean; + /** The date the group was last modified. */ + modified: Date; + /** The username of the group's owner. */ + owner: Portal; + /** The portal for the group. */ + portal: Portal; + /** A short summary that describes the group. */ + snippet: string; + /** User defined tags that describe the group. */ + tags: string[]; + /** The url to the thumbnail used for the group. */ + thumbnailUrl: string; + /** The title for the group. */ + title: string; + /** The url to the group. */ + url: string; + /** Get the current members for the group. */ + getMembers(): any; + /** + * Execute a query against the group to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query. + * @param queryParams The input query parameters. + */ + queryItems(queryParams?: any): any; + } + /** An item (a unit of content) in the Portal. */ + export class PortalItem { + /** Indicates the level of access: private, shared, org, or public. */ + access: string; + /** Information on the source of the item. */ + accessInformation: string; + /** Average rating. */ + avgRating: number; + /** The date the item was created. */ + created: Date; + /** The item locale information (language and country). */ + culture: string; + /** The detailed description of the item. */ + description: string; + /** The bounding rectangle of the item. */ + extent: any; + /** The unique id for this item. */ + id: string; + /** The url to the data resource associated with the item. */ + itemDataUrl: string; + /** The url to the item. */ + itemUrl: string; + /** Any license information or restrictions. */ + licenseInfo: string; + /** Date the item was last modified. */ + modified: Date; + /** The name of the item. */ + name: string; + /** Number of comments on the item. */ + numComments: number; + /** Number of ratings on the item. */ + numRatings: number; + /** Number of views on the item. */ + numViews: number; + /** The username of the user who owns this item. */ + owner: string; + /** The portal that contains the item. */ + portal: Portal; + /** The size of the item. */ + size: number; + /** A summary description of the item. */ + snippet: string; + /** The item's coordinate system. */ + spatialReference: string; + /** User defined tags that describe the item. */ + tags: string[]; + /** The url to the thumbnail used for the item. */ + thumbnailUrl: string; + /** The title for the item. */ + title: string; + /** The gis content type of this item. */ + type: string; + /** A set of keywords that further describes the type of this item. */ + typeKeywords: string[]; + /** The url for the resource represented by the item. */ + url: string; + /** The url to the user item. */ + userItemUrl: string; + /** + * Add a comment to the item. + * @param comment The text for the comment. + */ + addComment(comment: string): any; + /** + * Add a rating to an item that you have access to. + * @param rating Rating to set for the item. + */ + addRating(rating: number): any; + /** + * Deletes an item comment. + * @param comment The PortalComment to delete. + */ + deleteComment(comment: PortalComment): any; + /** + * Delete a rating that you created for the specified item. + * @param rating Rating to delete. + */ + deleteRating(rating: PortalRating): any; + /** Get the comments associated with the item. */ + getComments(): any; + /** Returns the rating (if any) given to the item. */ + getRating(): any; + /** + * Updates an item comment. + * @param comment A PortalComment that contains the comment updates. + */ + updateComment(comment: PortalComment): any; + } + /** Details about the result of a query. */ + export class PortalQueryResult { + /** The query parameters for the next set of results. */ + nextQueryParams: any; + /** The query parameters for the first set of results. */ + queryParams: any; + /** An array of result item objects. */ + results: any[]; + /** The total number of results. */ + total: number; + } + /** Details about the rating associated with a Portal item. */ + export class PortalRating { + /** Date the rating was added to the item. */ + created: Date; + /** A rating between 1.0 and 5.0 for the item. */ + rating: number; + } + /** Represents a registered user of the Portal. */ + export class PortalUser { + /** The access level for the user: private, org or public. */ + access: string; + /** The date the user was created. */ + created: Date; + /** The default culture for the user. */ + culture: string; + /** Description of the user. */ + description: string; + /** The user's email address. */ + email: string; + /** The user's full name. */ + fullName: string; + /** The date the user was modified. */ + modified: Date; + /** The id of the organization the user belongs to. */ + orgId: string; + /** The portal. */ + portal: Portal; + /** The user's preferred view for content, either Web or GIS. */ + preferredView: string; + /** The user's preferred region, used to set the featured maps on the portal home page, content in the gallery and the default extent for new maps in the Viewer. */ + region: string; + /** The user's role in the organization: administrator (org_admin), publisher (org_publisher), or user (org_user). */ + role: string; + /** User-defined tags that describe the user. */ + tags: string[]; + /** The url to the thumbnail image for the user. */ + thumbnailUrl: string; + /** The url for the user content. */ + userContentUrl: string; + /** The username for the user. */ + username: string; + /** Find folders for the portal user. */ + getFolders(): any; + /** Provides access to the group invitations for the portal user. */ + getGroupInvitations(): any; + /** Find all the groups that the portal user has permissions to access. */ + getGroups(): any; + /** + * Get the portal item along with folder info for the input item id. + * @param itemId The id of the item. + */ + getItem(itemId: string): any; + /** + * Retrieve all the items in the specified folder. + * @param folderId The id of the folder that contains the items to retrieve. + */ + getItems(folderId: string): any; + /** Get information about any notifications for the portal user. */ + getNotifications(): any; + /** Access the tag objects that have been created by the portal user. */ + getTags(): any; + } +} + +declare module "esri/arcgis/utils" { + import Layer = require("esri/layers/layer"); + + /** Utility methods to work with content from ArcGIS.com. */ + var utils: { + /** Specify the domain where the map associated with the webmap id is located. */ + arcgisUrl: string; + /** + * Create a map using information from an ArcGIS.com item. + * @param itemIdOrItemInfo An itemId for an ArcGIS.com item or the response object obtained from calling the arcgisUtils.getItem method. + * @param mapDiv Container ID for referencing map. + * @param options Optional parameters that define the map functionality. + */ + createMap(itemIdOrItemInfo: string, mapDiv: string, options?: any): any; + /** + * Create a map using information from an ArcGIS.com item. + * @param itemIdOrItemInfo An itemId for an ArcGIS.com item or the response object obtained from calling the arcgisUtils.getItem method. + * @param mapDiv Container ID for referencing map. + * @param options Optional parameters that define the map functionality. + */ + createMap(itemIdOrItemInfo: any, mapDiv: string, options?: any): any; + /** + * Get details about the input ArcGIS.com item. + * @param itemId The itemId for a publicly shared ArcGIS.com item. + */ + getItem(itemId: string): any; + /** + * Can be used with esri.dijit.Legend to get the layerInfos list to be passed into the Legend constructor. + * @param createMapResponse Object returned by .createMap() in the .then() callback. + */ + getLegendLayers(createMapResponse: any): Layer[]; + }; + export = utils; +} + +declare module "esri/basemaps" { + /** Contains properties referencing default basemaps used in the JS API. */ + var basemaps: { + /** The Light Gray Canvas basemap is designed to be used as a neutral background map for overlaying and emphasizing other map layers. */ + gray: any; + /** The World Imagery map is a detailed imagery map layer and labels that is designed to be used as a basemap for various maps and applications. */ + hybrid: any; + /** The Ocean Basemap is designed to be used as a basemap by marine GIS professionals and as a reference map by anyone interested in ocean data. */ + oceans: any; + /** The OpenStreetMap is a community map layer that is designed to be used as a basemap for various maps and applications. */ + osm: any; + /** The World Imagery map is a detailed imagery map layer that is designed to be used as a basemap for various maps and applications. */ + satellite: any; + /** The Streets basemap presents a multiscale street map for the world. */ + streets: any; + /** The Terrain with Labels basemap is designed to be used to overlay and emphasize other thematic map layers. */ + terrain: any; + /** The Topographic map includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings. */ + topo: any; + }; + export = basemaps; +} + +declare module "esri/config" { + /** The default values for all JS API configuration options. */ + var config: { + /** ArcGIS JavaScript API default configurations that can be overridden programmatically. */ + defaults: any; + }; + export = config; +} + +declare module "esri/dijit/AttributeInspector" { + import esri = require("esri"); + import Graphic = require("esri/graphic"); + + /** The AttributeInspector displays the attributes of selected features from one or more feature layers. */ + class AttributeInspector { + /** Field displayed as a rich text field. */ + static STRING_FIELD_OPTION_RICHTEXT: any; + /** Field displayed as a text area. */ + static STRING_FIELD_OPTION_TEXTAREA: any; + /** Field displays as a text box. */ + static STRING_FIELD_OPTION_TEXTBOX: any; + /** + * Creates a new Attribute Inspector object. + * @param params See options list. + * @param srcNodeRef HTML element where the attribute inspector should be rendered. + */ + constructor(params: esri.AttributeInspectorOptions, srcNodeRef: Node); + /** + * Creates a new Attribute Inspector object. + * @param params See options list. + * @param srcNodeRef HTML element where the attribute inspector should be rendered. + */ + constructor(params: esri.AttributeInspectorOptions, srcNodeRef: string); + /** Destroys the widget, used for page clean up. */ + destroy(): void; + /** Moves to the first feature. */ + first(): void; + /** Moves to the last feature. */ + last(): void; + /** Move to the next feature. */ + next(): void; + /** Move to the previous feature. */ + previous(): void; + /** Updates the contents of the AttributeInspector. */ + refresh(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when a fields value changes. */ + on(type: "attribute-change", listener: (event: { feature: Graphic; fieldName: string; fieldValue: string; target: AttributeInspector }) => void): esri.Handle; + /** Fires when the AttributeInspector's delete button is pressed. */ + on(type: "delete", listener: (event: { feature: Graphic; target: AttributeInspector }) => void): esri.Handle; + /** Fires when the AttributeInspector's next or back button is pressed. */ + on(type: "next", listener: (event: { feature: Graphic; target: AttributeInspector }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = AttributeInspector; +} + +declare module "esri/dijit/Attribution" { + import esri = require("esri"); + import Map = require("esri/map"); + + /** Displays attribution text for the layers in a map. */ + class Attribution { + /** String used as the delimiter between attribution items. */ + itemDelimiter: string; + /** Object containing elements where each element contains attribution text for a layer in the map. */ + itemNodes: any; + /** Reference to the span element that contains all the attribution items. */ + listNode: HTMLSpanElement; + /** Reference to the map object for which the widget is displaying attribution. */ + map: Map; + /** + * Creates a new Attribution object. + * @param options An object that defines the attribution options. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(options: esri.AttributionOptions, srcNodeRef: Node); + /** + * Creates a new Attribution object. + * @param options An object that defines the attribution options. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(options: esri.AttributionOptions, srcNodeRef: string); + /** Destroy the attribution widget. */ + destroy(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = Attribution; +} + +declare module "esri/dijit/Basemap" { + import esri = require("esri"); + import BasemapLayer = require("esri/dijit/BasemapLayer"); + + /** Define a basemap to display in the BasemapGallery dijit. */ + class Basemap { + /** The basemap's id. */ + id: string; + /** The URL to the thumbnail image for the basemap. */ + thumbnailUrl: string; + /** The title for the basemap. */ + title: string; + /** + * Creates a new Basemap Object. + * @param params Set of parameters used to create a basemap. + */ + constructor(params: esri.BasemapOptions); + /** The list of layers contained in the basemap or a dojo.Deferred if a call to ArcGIS.com needs to be made to retrieve the list of ArcGIS.com basemaps. */ + getLayers(): BasemapLayer[]; + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = Basemap; +} + +declare module "esri/dijit/BasemapGallery" { + import esri = require("esri"); + import Basemap = require("esri/dijit/Basemap"); + + /** The BasemapGallery dijit displays a collection basemaps from ArcGIS.com or a user-defined set of map or image services. */ + class BasemapGallery { + /** List of basemaps displayed in the BasemapGallery. */ + basemaps: Basemap[]; + /** This value is true after the BasemapGallery retrieves the ArcGIS.com basemaps. */ + loaded: boolean; + /** Optional parameter to pass in a portal URL, including the instance name, used to access the group containing the basemap gallery items. */ + portalUrl: string; + /** + * Creates a new BasemapGallery dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.BasemapGalleryOptions, srcNodeRef?: Node); + /** + * Creates a new BasemapGallery dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.BasemapGalleryOptions, srcNodeRef?: string); + /** + * Add a new basemap to the BasemapGallery's list of basemaps. + * @param basemap The basemap to add to the map. + */ + add(basemap: Basemap): boolean; + /** Destroys the basemap gallery. */ + destroy(): void; + /** + * Return the basemap with the specified id. + * @param id The basemap id. + */ + get(id: string): Basemap; + /** Gets the currently selected basemap. */ + getSelected(): Basemap; + /** + * Remove a basemap from the BasemapGallery's list of basemaps. + * @param id The basemap id. + */ + remove(id: string): Basemap; + /** + * Select a new basemap for the map. + * @param id The basemap id. + */ + select(id: string): Basemap; + /** Finalizes the creation of the basemap gallery. */ + startup(): void; + /** Fires when a basemap is added to the BasemapGallery's list of basemaps. */ + on(type: "add", listener: (event: { basemap: Basemap; target: BasemapGallery }) => void): esri.Handle; + /** Fires when an error occurs while switching basemaps. */ + on(type: "error", listener: (event: { target: BasemapGallery }) => void): esri.Handle; + /** Fires when the BasemapGallery retrieves the ArcGIS.com basemaps. */ + on(type: "load", listener: (event: { target: BasemapGallery }) => void): esri.Handle; + /** Fires when a basemap is removed from the BasemapGallery's list of basemaps. */ + on(type: "remove", listener: (event: { basemap: Basemap; target: BasemapGallery }) => void): esri.Handle; + /** Fires after the map is updated with a new basemap. */ + on(type: "selection-change", listener: (event: { target: BasemapGallery }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = BasemapGallery; +} + +declare module "esri/dijit/BasemapLayer" { + import esri = require("esri"); + import Extent = require("esri/geometry/Extent"); + import TileInfo = require("esri/layers/TileInfo"); + + /** Defines a layer that will be added to a basemap and displayed in the BasemapGallery dijit. */ + class BasemapLayer { + /** The attribution information for the layer. */ + copyright: string; + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ + subDomains: string[]; + /** The tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo: TileInfo; + /** Additional tile server domains for the layer. */ + tileServer: string[]; + /** The type of layer. */ + type: string; + /** + * Creates a new BasemapLayer object. + * @param params Set of parameters used to create a basemap layer. + */ + constructor(params: esri.BasemapLayerOptions); + } + export = BasemapLayer; +} + +declare module "esri/dijit/BasemapToggle" { + import esri = require("esri"); + import Map = require("esri/map"); + + /** BasemapToggle provides a simple button to toggle between two basemaps. */ + class BasemapToggle { + /** The secondary basemap to toggle to. */ + basemap: string; + /** Object containing the labels and URLs for the image of each basemap. */ + basemaps: any; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme: string; + /** Whether the widget is visible by default. */ + visible: boolean; + /** + * Creates a new BasemapToggle dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.BasemapToggleOptions, srcNodeRef: Node); + /** + * Creates a new BasemapToggle dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.BasemapToggleOptions, srcNodeRef: string); + /** Destroys the widget. */ + destroy(): void; + /** Hides the widget. */ + hide(): void; + /** Shows the widget. */ + show(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Toggles to the next basemap. */ + toggle(): void; + /** Fires when the widget has been loaded. */ + on(type: "load", listener: (event: { target: BasemapToggle }) => void): esri.Handle; + /** Fires when the toggle method has been called. */ + on(type: "toggle", listener: (event: { currentBasemap: string; error: any; previousBasemap: string; target: BasemapToggle }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = BasemapToggle; +} + +declare module "esri/dijit/BookmarkItem" { + import Extent = require("esri/geometry/Extent"); + + /** Defines a bookmark for use in the Bookmark widget. */ + class BookmarkItem { + /** + * Creates a new BookmarkItem. + * @param name The name for the bookmark item. + * @param extent The extent for the specified bookmark item. + */ + constructor(name: string, extent: Extent); + } + export = BookmarkItem; +} + +declare module "esri/dijit/Bookmarks" { + import esri = require("esri"); + import BookmarkItem = require("esri/dijit/BookmarkItem"); + + /** The Bookmarks widget is a ready to use tool for bookmarking the current map extent. */ + class Bookmarks { + /** An array of BookmarkItem objects. */ + bookmarks: BookmarkItem[]; + /** + * Creates a new Bookmark widget + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the bookmark widget should be rendered. + */ + constructor(params: esri.BookmarksOptions, srcNodeRef: Node); + /** + * Creates a new Bookmark widget + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the bookmark widget should be rendered. + */ + constructor(params: esri.BookmarksOptions, srcNodeRef: string); + /** + * Add a new bookmark to the bookmark widget. + * @param bookmarkItem A BookmarkItem or json object with the same structure that defines the new location. + */ + addBookmark(bookmarkItem: BookmarkItem): void; + /** Destroy the bookmark widget. */ + destroy(): void; + /** Hides the Bookmark widget. */ + hide(): void; + /** + * Remove a bookmark from the bookmark widget. + * @param bookmarkName The name of the bookmark to remove from the bookmark widget. + */ + removeBookmark(bookmarkName: string): void; + /** Show the Bookmark widget. */ + show(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Returns an array of json objects with the following structure: [{ name:bookmarkName, extent:bookmarkExtent }] */ + toJson(): any; + /** Fired when a bookmark item is clicked. */ + on(type: "click", listener: (event: { target: Bookmarks }) => void): esri.Handle; + /** Fired after the bookmark item is edited. */ + on(type: "edit", listener: (event: { target: Bookmarks }) => void): esri.Handle; + /** Fired when a bookmark item is removed. */ + on(type: "remove", listener: (event: { target: Bookmarks }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Bookmarks; +} + +declare module "esri/dijit/ClassedColorSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing a renderer used for visualizing features by their class and color. */ + class ClassedColorSlider extends RendererSlider { + /** Required */ + breakInfos: any; + /** Optional */ + classificationMethod: string; + /** Required: Handles identified by their index values within the stops array. */ + handles: number[]; + /** Optional: Property representing histogram data object. */ + histogram: any; + /** Optional */ + histogramWidth: boolean; + /** Optional */ + maxValue: number; + /** Optional */ + minValue: number; + /** Optional */ + normalizationType: string; + /** Optional: Handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional: Property for displaying the histogram. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Property for displaying the transparent background. */ + showTransparentBackground: boolean; + /** Optional: Property representing statistics data object. */ + statistics: any; + /** + * Creates a new ClassedColorSlider widget. + * @param params Set of parameters used to specify the ClassedColorSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedColorSliderOptions, srcNodeRef: Node); + /** + * Creates a new ClassedColorSlider widget. + * @param params Set of parameters used to specify the ClassedColorSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedColorSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the ClassedColorSlider widget properties change. */ + on(type: "change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of ClassedColorSlider changes. */ + on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle; + /** Fires when a ClassedColorSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ClassedColorSlider; +} + +declare module "esri/dijit/ClassedSizeSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing a renderer for visualizing features by varying classes and size. */ + class ClassedSizeSlider extends RendererSlider { + /** Required. */ + breakInfos: any; + /** Optional. */ + classificationMethod: string; + /** Required. */ + handles: number[]; + /** Optional. */ + histogram: any; + /** Optional. */ + histogramWidth: boolean; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Optional. */ + normalizationType: string; + /** Optional. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Optional. */ + statistics: any; + /** + * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ClassedSizeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: Node); + /** + * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ClassedSizeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: string); + /** Fires when ClassedSizeSlider changes. */ + on(type: "change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue changes in ClassedSizeSlider. */ + on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle; + /** Fires when a ClassedSizeSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ClassedSizeSlider; +} + +declare module "esri/dijit/ColorInfoSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing a renderer for visualizing features based upon colors. */ + class ColorInfoSlider extends RendererSlider { + /** Optional */ + classificationMethod: string; + /** Required: Example colorInfo: colorRenderer.renderer.visualVariables[0]. */ + colorInfo: any; + /** Required: Handles identified by their index values within the stops array. */ + handles: number[]; + /** Optional: Property representing histogram data object. */ + histogram: any; + /** Optional */ + histogramWidth: boolean; + /** Optional */ + maxValue: number; + /** Optional */ + minValue: number; + /** Optional */ + normalizationType: string; + /** Optional: Handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional: Property for displaying the histogram. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Property for displaying the transparent background. */ + showTransparentBackground: boolean; + /** Optional: Property representing statistics data object. */ + statistics: any; + /** Optional */ + zoomOptions: any; + /** + * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ColorInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorInfoSliderOptions, srcNodeRef: Node); + /** + * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the ColorInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorInfoSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when ColorInfoSlider changes. */ + on(type: "change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of ColorInfoSlider changes. */ + on(type: "data-value-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when a ColorInfoSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { target: ColorInfoSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ColorInfoSlider; +} + +declare module "esri/dijit/ColorPicker" { + import esri = require("esri"); + import Color = require("esri/Color"); + + /** A widget to assist choosing a color from a color palette. */ + class ColorPicker { + /** The selected color. */ + color: Color; + /** The set of available color options. */ + palette: Color[]; + /** An array of recent colors to show in the recent colors row. */ + recentColors: Color[]; + /** + * Creates a new ColorPicker widget. + * @param params Set of parameters used to specify the ColorPicker widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorPickerOptions, srcNodeRef: Node); + /** + * Creates a new ColorPicker widget. + * @param params Set of parameters used to specify the ColorPicker widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.ColorPickerOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the selected color has changed. */ + on(type: "color-change", listener: (event: { target: ColorPicker }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ColorPicker; +} + +declare module "esri/dijit/Directions" { + import esri = require("esri"); + import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet"); + import Graphic = require("esri/graphic"); + import RouteParameters = require("esri/tasks/RouteParameters"); + import RouteTask = require("esri/tasks/RouteTask"); + import Point = require("esri/geometry/Point"); + import RouteResult = require("esri/tasks/RouteResult"); + + /** The Directions widget makes it easy to calculate directions between two or more input locations. */ + class Directions { + /** Read-only: Get the directions to all the locations along the route. */ + directions: DirectionsFeatureSet; + /** An array of objects that defines the potential matches for the input locations. */ + geocoderResults: any[]; + /** Indicates whether the Directions widget adds a stop on each map click. */ + mapClickActive: boolean; + /** Read-only: When true, the maximum number of stops for the route has been reached. */ + maxStopsReached: boolean; + /** Read-only: The graphic for the calculated route. */ + mergedRouteGraphic: Graphic; + /** Routing parameters for the widget. */ + routeParams: RouteParameters; + /** Routing task for the widget. */ + routeTask: RouteTask; + /** Read-only: The Service Description object returned by the Route REST Endpoint. */ + serviceDescription: any; + /** Indicates whether the Directions widget will display the map-click-active toggle button. */ + showActivateButton: boolean; + /** If true, the Clear button is shown. */ + showClearButton: boolean; + /** If true, the toggle button group allowing user to choose between Miles and Kilometers is shown. */ + showMilesKilometersOption: boolean; + /** If true, and supported by the service, then two toggle button groups are shown: one to allow user to choose between driving a car, a truck, or walking, and one more group to choose between fastest or shortest routes. */ + showTravelModesOption: boolean; + /** An array of graphics that define the stop locations along the route. */ + stops: Graphic[]; + /** The css theme used to style the widget. */ + theme: string; + /** Read-only: If Directions Widget runs with Travel Modes enabled, this property returns current Travel Mode name. */ + travelModeName: string; + /** + * Creates a new Directions dijit using the given DOM node. + * @param options Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(options: esri.DirectionsOptions, srcNodeRef: Node); + /** + * Creates a new Directions dijit using the given DOM node. + * @param options Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(options: esri.DirectionsOptions, srcNodeRef: string); + /** Deprecated at v3.13. */ + activate(): void; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: Point, index?: number): any; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: number[], index?: number): any; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: string, index?: number): any; + /** + * Add a stop to the directions widget at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index location where the stop should be added. + */ + addStop(stop: any, index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: Point[], index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: number[][], index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: string[], index?: number): any; + /** + * Add multiple stops to the directions list starting at the specified location. + * @param stops An array of points that define the stop locations. + * @param index The index location where the stops will be added. + */ + addStops(stops: any[], index?: number): any; + /** + * Center the map at the start of the specified route segment. + * @param index The index of the segment where the map should be centered. + */ + centerAtSegmentStart(index: number): void; + /** Remove the route directions from the directions list. */ + clearDirections(): void; + /** Deprecated at v3.13. */ + deactivate(): void; + /** Destroy the Directions widget. */ + destroy(): void; + /** Calculate the route to the input locations and display the list of directions. */ + getDirections(): any; + /** If widget runs with Travel Modes enabled, call this method to obtain the list of supported Travel Mode names. */ + getSupportedTravelModeNames(): string[]; + /** + * Highlight the specified route segment on the map. + * @param index The index of the route segment to highlight. + */ + highlightSegment(index: number): void; + /** + * Remove the stop at the specified index. + * @param index The index of the stop to remove. + */ + removeStop(index: number): any; + /** Removes the existing stops from the directions widget. */ + removeStops(): any; + /** Resets the directions widget removing any directions, stops and map graphics. */ + reset(): any; + /** + * If widget runs with Travel Modes enabled, call this method to switch to particular Travel mode programmatically. + * @param travelModeName Travel mode. + */ + setTravelMode(travelModeName: string): any; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Removes the highlight symbol from the currently highlighted route segment. */ + unhighlightSegment(): void; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: Point, index: number): any; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: number[], index: number): any; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: string, index: number): any; + /** + * Update the existing stop at the specified index location. + * @param stop A point that defines the stop location. + * @param index The index of the stop to update. + */ + updateStop(stop: any, index: number): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: Point[]): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: number[][]): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: string[]): any; + /** + * Update multiple stops in the directions widget by specifying an array of stops information. + * @param stops An array of points that define the stop locations. + */ + updateStops(stops: any[]): any; + /** + * Sets the corresponding stop to point at the user's current location. + * @param stopIndex Index of the stop that will point to the user's current location. + */ + useMyCurrentLocation(stopIndex: number): any; + /** Zoom so that the full route is displayed within the current map extent. */ + zoomToFullRoute(): void; + /** + * Zoom to the specified route segment. + * @param index The index for a route segment. + */ + zoomToSegment(index: number): void; + /** Deprecated at v3.13. */ + on(type: "activate", listener: (event: { target: Directions }) => void): esri.Handle; + /** Deprecated at v3.13. */ + on(type: "deactivate", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the directions display is reset. */ + on(type: "directions-clear", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the route service has calculated the route and the directions are ready for display. */ + on(type: "directions-finish", listener: (event: { result: RouteResult; target: Directions }) => void): esri.Handle; + /** Fires when the route services starts to calculate the route. */ + on(type: "directions-start", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the directions widget has fully loaded. */ + on(type: "load", listener: (event: { target: Directions }) => void): esri.Handle; + /** Fires when the widget starts or stops listening for map clicks. */ + on(type: "map-click-active", listener: (event: { mapClickActive: boolean; target: Directions }) => void): esri.Handle; + /** Fired when you hover over a route segment in the directions display. */ + on(type: "segment-highlight", listener: (event: { graphic: Graphic; target: Directions }) => void): esri.Handle; + /** Fires when a route segment is selected in the directions display. */ + on(type: "segment-select", listener: (event: { graphic: Graphic; target: Directions }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Directions; +} + +declare module "esri/dijit/FeatureTable" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** (Beta at v3.12) Creates an instance of the FeatureTable widget within the provided DOM node. */ + class FeatureTable { + /** An optional dGrid property. */ + allowSelectAll: boolean; + /** An optional dGrid property. */ + cellNavigation: boolean; + /** A reference to the column objects and their parameters. */ + columns: any[]; + /** Reference to the dataStore used by the dGrid. */ + dataStore: any; + /** Object defining the date options specifically for formatting date and time editors. */ + dateOptions: any; + /** The featureLayer that the table is associated with. */ + featureLayer: FeatureLayer; + /** Reference to the dGrid. */ + grid: any; + /** Optional columns to hide by default using the dGrid ColumnHider extension. */ + hiddenFields: string[]; + /** A reference to the primary key used by the dataStore to differentiate columns. */ + idProperty: string; + /** When true, the FeatureTable widget has successfully loaded. */ + loaded: boolean; + /** Reference to the map. */ + map: Map; + /** A dGrid property. */ + noDataMessage: string; + /** Attribute fields to include in the FeatureTable. */ + outFields: string[]; + /** Indicates whether the data is editable via the widget. */ + readOnly: boolean; + /** A dGrid property. */ + selectionMode: string; + /** + * Creates an instance of the FeatureTable widget within the provided DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FeatureTableOptions, srcNodeRef: Node); + /** + * Creates an instance of the FeatureTable widget within the provided DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FeatureTableOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when a row is deselected. */ + on(type: "dgrid-deselect", listener: (event: { target: FeatureTable }) => void): esri.Handle; + /** Fired when the grid is refreshed. */ + on(type: "dgrid-refresh-complete", listener: (event: { target: FeatureTable }) => void): esri.Handle; + /** Fired when a row is selected. */ + on(type: "dgrid-select", listener: (event: { target: FeatureTable }) => void): esri.Handle; + /** Fired when the FeatureTable is loaded. */ + on(type: "load", listener: (event: { target: FeatureTable }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FeatureTable; +} + +declare module "esri/dijit/Gallery" { + import esri = require("esri"); + + /** The Gallery widget provides a touch-aware thumbnail gallery for mobile devices such as iOS and Android. */ + class Gallery { + /** + * Creates a new mobile Gallery. + * @param params See options list. + * @param srcNodeRef HTML element where the gallery should be rendered. + */ + constructor(params: esri.GalleryOptions, srcNodeRef: Node); + /** + * Creates a new mobile Gallery. + * @param params See options list. + * @param srcNodeRef HTML element where the gallery should be rendered. + */ + constructor(params: esri.GalleryOptions, srcNodeRef: string); + /** Removes any object references and associated objects created by the gallery. */ + destroy(): void; + /** Gets the item with the current focus. */ + getFocusedItem(): any; + /** Get the currently selected item. */ + getSelectedItem(): any; + /** Move the gallery to the next page of items. */ + next(): void; + /** Move the gallery to the previous page of items. */ + previous(): void; + /** + * Select an item in the gallery. + * @param item The item to select. + */ + select(item: any): void; + /** + * Set the focus to the specified item. + * @param item The item which will have focus. + */ + setFocus(item: any): void; + /** Finalize the creation of the gallery. */ + startup(): void; + /** Fires when the items setFocus method is called. */ + on(type: "focus", listener: (event: { item: any; target: Gallery }) => void): esri.Handle; + /** Fires when an item is selected. */ + on(type: "select", listener: (event: { item: any; target: Gallery }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Gallery; +} + +declare module "esri/dijit/Gauge" { + import esri = require("esri"); + import Graphic = require("esri/graphic"); + + /** The gauge widget provides a streamlined way to create a dashboard-like interface and display data on a semi-circular gauge. */ + class Gauge { + /** + * Create a new Gauge object. + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the gauge should be rendered. + */ + constructor(params: esri.GaugeOptions, srcNodeRef: Node); + /** + * Create a new Gauge object. + * @param params See options list for parameters. + * @param srcNodeRef HTML element where the gauge should be rendered. + */ + constructor(params: esri.GaugeOptions, srcNodeRef: string); + /** Destroy the gauge. */ + destroy(): void; + /** + * Get the value of the property from the Gauge. + * @param name Property to get value. + */ + get(name: string): any; + /** + * Set the value of a property from the Gauge. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: string): Gauge; + /** + * Set the value of a property from the Gauge. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: Graphic): Gauge; + /** + * Set the value of a property from the Gauge. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: number): Gauge; + /** Finalizes the creation of the gauge. */ + startup(): void; + } + export = Gauge; +} + +declare module "esri/dijit/Geocoder" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import Symbol = require("esri/symbols/Symbol"); + + /** Add a geographic search box to an application. */ + class Geocoder { + /** Currently selected locator object. */ + activeGeocoder: any; + /** Current locator index to search by default. */ + activeGeocoderIndex: number; + /** When true, the auto-complete menu is enabled. */ + autoComplete: boolean; + /** When true, the widget will navigate to the selected location. */ + autoNavigate: boolean; + /** When true the geocoder menu is enabled. */ + geocoderMenu: boolean; + /** List of geocoders the widget uses to find search results. */ + geocoders: any[]; + /** Specify a graphicsLayer to use when highlightLocation is true. */ + graphicsLayer: GraphicsLayer; + /** Indicates whether to show a graphic at a selected location. */ + highlightLocation: boolean; + /** Maximum number of locations to display in the results menu. */ + maxLocations: number; + /** Minimum number of characters required before the query is performed. */ + minCharacters: number; + /** Current results from query or select. */ + results: any[]; + /** Delay in milliseconds before each keyUp calls for the query to be performed. */ + searchDelay: number; + /** When true, suggestions are displayed as the user is typing. */ + showResults: boolean; + /** Symbol to use when highlightLocation is true. */ + symbol: Symbol; + /** Current theme being used to style the widget. */ + theme: string; + /** Current value of the input textbox. */ + value: string; + /** Scale to zoom to when geocoder does not return an extent. */ + zoomScale: number; + /** + * Create a new Geocoder widget using the given DOM node. + * @param params Set of parameters used to specify Geocoder options. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.GeocoderOptions, srcNodeRef: Node); + /** + * Create a new Geocoder widget using the given DOM node. + * @param params Set of parameters used to specify Geocoder options. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.GeocoderOptions, srcNodeRef: string); + /** Unfocus the widget's text input. */ + blur(): void; + /** Clears the values currently set in the widget. */ + clear(): void; + /** Releases all the resources used by the widget. */ + destroy(): void; + /** Executes a search using the current value of the geocoder. */ + find(): any; + /** Brings focus to the widget's text input. */ + focus(): void; + /** Hide the widget. */ + hide(): void; + /** + * Select a result using a result object. + * @param result An object with the following properties. + */ + select(result: any): void; + /** Show the widget. */ + show(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when results are returned from an auto-complete. */ + on(type: "auto-complete", listener: (event: { results : any; target: Geocoder }) => void): esri.Handle; + /** Fired when a result is cleared from the input box or a new result is selected. */ + on(type: "clear", listener: (event: { target: Geocoder }) => void): esri.Handle; + /** Fired when results are returned from a search. */ + on(type: "find-results", listener: (event: { results: any; target: Geocoder }) => void): esri.Handle; + /** Fired when a geocoder is selected. */ + on(type: "geocoder-select", listener: (event: { geocoder: any; target: Geocoder }) => void): esri.Handle; + /** Fired when a result has been selected, the submit button is pressed, or the enter key is fired. */ + on(type: "select", listener: (event: { results: any; target: Geocoder }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Geocoder; +} + +declare module "esri/dijit/HeatmapSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist in managing properties of a HeatmapRenderer. */ + class HeatmapSlider extends RendererSlider { + /** Required. */ + colorStops: any; + /** Required. */ + handles: number[]; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** + * Creates a new HeatmapSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the HeatmapSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HeatmapSliderOptions, srcNodeRef: Node); + /** + * Creates a new HeatmapSlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the HeatmapSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HeatmapSliderOptions, srcNodeRef: string); + /** Fires when HeatmapSlider changes. */ + on(type: "change", listener: (event: { colorStops: any; target: HeatmapSlider }) => void): esri.Handle; + /** Fires when HeatmapSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { colorStops: any; target: HeatmapSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = HeatmapSlider; +} + +declare module "esri/dijit/HistogramTimeSlider" { + import esri = require("esri"); + + /** The HistogramTimeSlider dijit provides a histogram chart representation of data for time-enabled layers on a map. */ + class HistogramTimeSlider { + /** + * Creates a new HistogramTimeSlider dijit using the given DOM node. + * @param params Input parameters. + * @param srcNodeRef HTML element where the tool should be rendered. + */ + constructor(params: esri.HistogramTimeSliderOptions, srcNodeRef: Node); + /** + * Creates a new HistogramTimeSlider dijit using the given DOM node. + * @param params Input parameters. + * @param srcNodeRef HTML element where the tool should be rendered. + */ + constructor(params: esri.HistogramTimeSliderOptions, srcNodeRef: string); + /** Set related objects as null and hide the widget. */ + destroy(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires whenever the slider moved, and the visible time extent is changed. */ + on(type: "time-extent-change", listener: (event: { target: HistogramTimeSlider }) => void): esri.Handle; + /** Fires fires each time the histogram is drawn. */ + on(type: "update", listener: (event: { target: HistogramTimeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = HistogramTimeSlider; +} + +declare module "esri/dijit/HomeButton" { + import esri = require("esri"); + import Extent = require("esri/geometry/Extent"); + import Map = require("esri/map"); + + /** HomeButton provides a simple button to return to the map's default starting extent. */ + class HomeButton { + /** The extent used to zoom to when clicked. */ + extent: Extent; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme: string; + /** Whether the widget is visible by default. */ + visible: boolean; + /** + * Creates a new HomeButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.HomeButtonOptions, srcNodeRef: Node); + /** + * Creates a new HomeButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.HomeButtonOptions, srcNodeRef: string); + /** Destroys the widget. */ + destroy(): void; + /** Hides the widget. */ + hide(): void; + /** Goes to the home extent. */ + home(): any; + /** Shows the widget. */ + show(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires when the home method has been called. */ + on(type: "home", listener: (event: { error: any; extent: Extent; target: HomeButton }) => void): esri.Handle; + /** Fires when the widget has been loaded. */ + on(type: "load", listener: (event: { target: HomeButton }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = HomeButton; +} + +declare module "esri/dijit/HorizontalSlider" { + import esri = require("esri"); + + /** A form widget that allows one to select a value with a horizontally draggable handle. */ + class HorizontalSlider { + /** Show increment/decrement buttons at the ends of the slider. */ + showButtons: boolean; + /** + * Creates a new HorizontalSlider widget. + * @param params Set of parameters used to specify the HorizontalSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HorizontalSliderOptions, srcNodeRef: Node); + /** + * Creates a new HorizontalSlider widget. + * @param params Set of parameters used to specify the HorizontalSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.HorizontalSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = HorizontalSlider; +} + +declare module "esri/dijit/InfoWindow" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + + /** An InfoWindow is an HTML popup. */ + class InfoWindow extends InfoWindowBase { + /** InfoWindow is anchored to the lower left of the point. */ + static ANCHOR_LOWERLEFT: any; + /** InfoWindow is anchored to the lower right of the point. */ + static ANCHOR_LOWERRIGHT: any; + /** InfoWindow is anchored to the upper left of the point. */ + static ANCHOR_UPPERLEFT: any; + /** InfoWindow is anchored to the upper right of the point. */ + static ANCHOR_UPPERRIGHT: any; + /** Placement of the InfoWindow with respect to the graphic. */ + anchor: string; + /** The anchor point of the InfoWindow in screen coordinates. */ + coords: Point; + /** InfoWindow always show with the specified anchor. */ + fixedAnchor: string; + /** Determines whether the InfoWindow is currently shown on the map. */ + isShowing: boolean; + /** + * Create a new Info Window. + * @param params Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Create a new Info Window. + * @param params Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** Hides the InfoWindow. */ + hide(): void; + /** + * Moves the InfoWindow to the specified screen point. + * @param point The new anchor point when moving the InfoWindow. + */ + move(point: Point): void; + /** + * Resizes the InfoWindow to the specified height and width in pixels. + * @param width The new width of the InfoWindow in pixels. + * @param height The new height of the InfoWindow in pixels. + */ + resize(width: number, height: number): void; + /** + * Sets the content in the InfoWindow. + * @param content The content for the InfoWindow. + */ + setContent(content: any): InfoWindow; + /** + * Sets the fixed location of the InfoWindow anchor. + * @param anchor Fixed anchor that cannot be overridden by InfoWindow.show(). + */ + setFixedAnchor(anchor: string): void; + /** + * Sets the title for the InfoWindow. + * @param title The title for the InfoWindow. + */ + setTitle(title: string): InfoWindow; + /** + * Display the InfoWindow at the specified location. + * @param point Location to place anchor. + * @param placement Placement of the InfoWindow with respect to the graphic. + */ + show(point: Point, placement?: string): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when an infoWindow is hidden. */ + on(type: "hide", listener: (event: { target: InfoWindow }) => void): esri.Handle; + /** Fires when an InfoWindow is visible. */ + on(type: "show", listener: (event: { target: InfoWindow }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfoWindow; +} + +declare module "esri/dijit/InfoWindowLite" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + import InfoWindow = require("esri/dijit/InfoWindow"); + + /** Creates a new InfoWindowLite object. */ + class InfoWindowLite extends InfoWindowBase { + /** Placement of the InfoWindow with respect to the graphic. */ + anchor: string; + /** The anchor point of the InfoWindowLite in screen coordinates. */ + coords: Point; + /** Always display the info window using the specified anchor. */ + fixedAnchor: string; + /** Determines whether the InfoWindowLite is currently shown on the map. */ + isShowing: boolean; + /** Hides the InfoWindow. */ + hide(): void; + /** + * Moves the InfoWindow to the specified screen point. + * @param point The new anchor point when moving the InfoWindowLite. + */ + move(point: Point): void; + /** + * Resizes the InfoWindowLite to the specified height and width in pixels. + * @param width The new width of the InfoWindowLite in pixels. + * @param height The new height of the InfoWindowLite in pixels. + */ + resize(width: number, height: number): void; + /** + * Sets the content in the InfoWindow. + * @param content The content for the InfoWindow. + */ + setContent(content: any): void; + /** + * Set the fixed location of the InfoWindowLite anchor. + * @param anchor Fixed anchor that cannot be overridden by InfoWindowLite.show(). + */ + setFixedAnchor(anchor: string): void; + /** + * Define the title for the InfoWindowLite. + * @param title The title for the InfoWindowLite. + */ + setTitle(title: string): InfoWindow; + /** + * Display the InfoWindow at the specified location. + * @param point Location to place anchor. + * @param placement Placement of the InfoWindow with respect to the graphic. + */ + show(point: Point, placement?: string): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when an infoWindow is hidden. */ + on(type: "hide", listener: (event: { target: InfoWindowLite }) => void): esri.Handle; + /** Fires when an InfoWindowLite is displayed. */ + on(type: "show", listener: (event: { target: InfoWindowLite }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfoWindowLite; +} + +declare module "esri/dijit/LayerSwipe" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Map = require("esri/map"); + + /** LayerSwipe provides a simple tool to show a portion of a layer or layers on top of a map. */ + class LayerSwipe { + /** The number of pixels to clip the swipe tool. */ + clip: number; + /** If the widget is enabled and layers can be swiped. */ + enabled: boolean; + /** The layers to be swiped. */ + layers: Layer[]; + /** The number of pixels to place the tool from the left of the map. */ + left: number; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** Class used for styling the widget. */ + theme: string; + /** The number of pixels to place the tool from the top of the map. */ + top: number; + /** Type of swipe tool to use. */ + type: string; + /** Whether the widget is visible by default. */ + visible: boolean; + /** + * Creates a new LayerSwipe dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LayerSwipeOptions, srcNodeRef: Node); + /** + * Creates a new LayerSwipe dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LayerSwipeOptions, srcNodeRef: string); + /** Destroys the widget. */ + destroy(): void; + /** Disables the widget. */ + disable(): void; + /** Enables the widget. */ + enable(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Updates the map to the position of the swipe node. */ + swipe(): void; + /** Event is fired when the widget has been loaded. */ + on(type: "load", listener: (event: { target: LayerSwipe }) => void): esri.Handle; + /** Event is fired when the tool has moved. */ + on(type: "swipe", listener: (event: { layers: any[]; target: LayerSwipe }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = LayerSwipe; +} + +declare module "esri/dijit/Legend" { + import esri = require("esri"); + + /** The legend dijit displays a label and symbol for some or all of the layers in the map. */ + class Legend { + /** + * Creates a new Legend dijit. + * @param params Parameters used to configure the dijit. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.LegendOptions, srcNodeRef: Node); + /** + * Creates a new Legend dijit. + * @param params Parameters used to configure the dijit. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.LegendOptions, srcNodeRef: string); + /** Destroys the legend. */ + destroy(): void; + /** Refresh the legend. */ + refresh(): void; + /** Finalizes the creation of the legend . */ + startup(): void; + } + export = Legend; +} + +declare module "esri/dijit/LocateButton" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import InfoTemplate = require("esri/InfoTemplate"); + import Map = require("esri/map"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** LocateButton provides a simple button to locate and zoom to the users current location. */ + class LocateButton { + /** Centers the map to the location when a new position is returned. */ + centerAt: boolean; + /** Removes existing graphic when tracking stops. */ + clearOnTrackingStop: boolean; + /** The HTML5 Geolocation Position options for locating. */ + geolocationOptions: any; + /** Layer in which the highlighted graphic is set to. */ + graphicsLayer: GraphicsLayer; + /** If true, the users location will be highlighted with a point. */ + highlightLocation: boolean; + /** The infoTemplate used for the highlight graphic. */ + infoTemplate: InfoTemplate; + /** Whether the widget has been loaded. */ + loaded: boolean; + /** Map object that this dijit is associated with. */ + map: Map; + /** The scale to zoom to when a users location has been found. */ + scale: number; + /** Sets the maps scale when a new position is returned. */ + setScale: boolean; + /** The symbol used on the highlight graphic to highlight the users location on the map. */ + symbol: Symbol; + /** Class used for styling the widget. */ + theme: string; + /** Shows the current tracking state. */ + tracking: boolean; + /** When enabled, the button becomes a toggle that creates an event to watch for location changes. */ + useTracking: boolean; + /** Whether the widget is visible. */ + visible: boolean; + /** + * Creates a new LocateButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LocateButtonOptions, srcNodeRef: Node); + /** + * Creates a new LocateButton dijit using the given DOM node. + * @param params Various parameters to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.LocateButtonOptions, srcNodeRef: string); + /** Clears the point graphic. */ + clear(): void; + /** Destroys the widget. */ + destroy(): void; + /** Hides the widget. */ + hide(): void; + /** Goes to the users extent. */ + locate(): any; + /** Shows the widget. */ + show(): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires when the widget has been loaded. */ + on(type: "load", listener: (event: { target: LocateButton }) => void): esri.Handle; + /** Fires when the locate method has been called. */ + on(type: "locate", listener: (event: { error: any; graphic: Graphic; position: any; scale: number; target: LocateButton }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = LocateButton; +} + +declare module "esri/dijit/Measurement" { + import esri = require("esri"); + import Point = require("esri/geometry/Point"); + import Polyline = require("esri/geometry/Polyline"); + import Polygon = require("esri/geometry/Polygon"); + import Geometry = require("esri/geometry/Geometry"); + + /** The Measurement widget provides tools for calculating the current location (Get Location) and measuring distance (Measure Distance) and area (Measure Area). */ + class Measurement { + /** + * Creates a new Measurement widget. + * @param params See options list for parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.MeasurementOptions, srcNodeRef: Node); + /** + * Creates a new Measurement widget. + * @param params See options list for parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.MeasurementOptions, srcNodeRef: string); + /** Remove the measurement graphics and results. */ + clearResult(): void; + /** Destroy the measurement widget. */ + destroy(): void; + /** Returns an Object with two properties: toolName and unitName. */ + getTool(): any; + /** Returns current measurement unit of the active tool. */ + getUnit(): string; + /** Hide the measurement widget. */ + hide(): void; + /** + * Hide the specified tool. + * @param toolName Valid values are "area", "distance" or "location". + */ + hideTool(toolName: string): void; + /** + * Invoke the measurement functionality of the widget by passing in a previously created geometry. + * @param geometry Geometry to be measured. + */ + measure(geometry: Point): void; + /** + * Invoke the measurement functionality of the widget by passing in a previously created geometry. + * @param geometry Geometry to be measured. + */ + measure(geometry: Polyline): void; + /** + * Invoke the measurement functionality of the widget by passing in a previously created geometry. + * @param geometry Geometry to be measured. + */ + measure(geometry: Polygon): void; + /** + * Activate or deactivate a tool. + * @param toolName The name of the tool to activate or deactivate. + * @param activate When true, the specified tool is activated. + */ + setTool(toolName: string, activate: boolean): void; + /** Show the measurement widget after it has been hidden using the hide method. */ + show(): void; + /** + * Display the specified tool. + * @param toolName Valid values are "area", "distance" or "location". + */ + showTool(toolName: string): void; + /** Finalizes the creation of the measurement widget . */ + startup(): void; + /** Fires when a measurement is made but the measurement is not complete (single-click). */ + on(type: "measure", listener: (event: { geometry: Geometry; toolName: string; unitName: string; values: number; target: Measurement }) => void): esri.Handle; + /** Fired when the measurement is complete. */ + on(type: "measure-end", listener: (event: { geometry: Geometry; toolName: string; unitName: string; values: any; target: Measurement }) => void): esri.Handle; + /** Fires when a measurement operation begins (single-click). */ + on(type: "measure-start", listener: (event: { toolName: string; unitName: string; target: Measurement }) => void): esri.Handle; + /** Fires when the primary tool is changed. */ + on(type: "tool-change", listener: (event: { toolName: string; unitName: string; target: Measurement }) => void): esri.Handle; + /** Fires when the units currently being used by the Measurement widget changes. */ + on(type: "unit-change", listener: (event: { toolName: string; unitName: string; target: Measurement }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Measurement; +} + +declare module "esri/dijit/OpacitySlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + /** A widget to assist with managing opacity with a renderer. */ + class OpacitySlider extends RendererSlider { + /** Required. */ + handles: number[]; + /** Optional. */ + histogram: any; + /** Optional: */ + histogramWidth: boolean; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Required. */ + opacityInfo: any; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Property for displaying the transparent background. */ + showTransparentBackground: boolean; + /** Optional. */ + statistics: any; + /** Optional. */ + zoomOptions: any; + /** + * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the OpacitySlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.OpacitySliderOptions, srcNodeRef: Node); + /** + * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. + * @param params Set of parameters used to specify the OpacitySlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.OpacitySliderOptions, srcNodeRef: string); + /** Fires when OpacitySlider changes. */ + on(type: "change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of OpacitySlider changes. */ + on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when an OpacitySlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = OpacitySlider; +} + +declare module "esri/dijit/OverviewMap" { + import esri = require("esri"); + + /** The OverviewMap widget displays the current extent of the map within the context of a larger area. */ + class OverviewMap { + /** + * Creates a new OverviewMap object. + * @param params Parameters that define the functionality of the OverviewMap widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.OverviewMapOptions, srcNodeRef: Node); + /** + * Creates a new OverviewMap object. + * @param params Parameters that define the functionality of the OverviewMap widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.OverviewMapOptions, srcNodeRef: string); + /** Releases the resources used by the dijit. */ + destroy(): void; + /** Hide the overview map. */ + hide(): void; + /** + * Resize the widget. + * @param size Object containing width and height of the desired size. + */ + resize(size: any): void; + /** Show the overview map. */ + show(): void; + /** Finalizes the creation of the OverviewMap dijit. */ + startup(): void; + } + export = OverviewMap; +} + +declare module "esri/dijit/Popup" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Graphic = require("esri/graphic"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import LineSymbol = require("esri/symbols/LineSymbol"); + import Point = require("esri/geometry/Point"); + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + + /** The Popup class is an implementation of InfoWindow that inherits from InfoWindowBase to provide additional capabilities. */ + class Popup extends InfoWindowBase { + /** Controls the placement of the popup window with respect to the geographic location. */ + anchor: string; + /** The number of features associated with the info window. */ + count: number; + /** An array of pending deferreds, null if there are not any pending deferreds. */ + deferreds: any[]; + /** The HTML element (reference to a DOM Node) where the info window is constructed. */ + domNode: any; + /** The array of features currently associated with the info window. */ + features: Graphic[]; + /** Define the symbol used to highlight polygon features. */ + fillSymbol: FillSymbol; + /** Number of milliseconds after which the popup window will be hidden when visibleWhenEmpty is false and there are no features to be displayed. */ + hideDelay: number; + /** Indicates whether popup should highlight features. */ + highlight: boolean; + /** Indicates if the info window is visible. */ + isShowing: boolean; + /** Indicates whether a feature should remain highlighted after the user closes the popup window. */ + keepHighlightOnHide: boolean; + /** Define the symbol used to highlight line features. */ + lineSymbol: LineSymbol; + /** The location the info window is pointing to. */ + location: Point; + /** Specify the margin (in pixels) to leave to the left of the popup window when it is maximized. */ + marginLeft: number; + /** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */ + marginTop: number; + /** Define the marker symbol used to highlight point features. */ + markerSymbol: MarkerSymbol; + /** Specify the x-offset (in pixels) used when positioning the popup. */ + offsetX: number; + /** Specify the y-offset (in pixels) used when positioning the popup. */ + offsetY: number; + /** Indicates whether popup should display previous and next buttons in the title bar. */ + pagingControls: boolean; + /** Indicates whether popup should display the title bar text that contains the page number and total number of available features. */ + pagingInfo: boolean; + /** Indicates whether the popup window should be displayed. */ + popupWindow: boolean; + /** The index of the currently selected feature in the features array. */ + selectedIndex: number; + /** Indicates whether the feature's title should display within the body of the popup window as opposed to in the titlebar. */ + titleInBody: boolean; + /** Indicates whether the popup window remains visible when there are no features to be displayed. */ + visibleWhenEmpty: boolean; + /** Define the number of levels to zoom in when the 'Zoom to' link is clicked. */ + zoomFactor: number; + /** + * Create a new Popup object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupOptions, srcNodeRef: Node); + /** + * Create a new Popup object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupOptions, srcNodeRef: string); + /** Removes all features and destroys any pending deferreds. */ + clearFeatures(): void; + /** Destroy the popup. */ + destroy(): void; + /** Get the currently selected feature. */ + getSelectedFeature(): Graphic; + /** Hide the info window. */ + hide(): void; + /** Maximize the info window. */ + maximize(): void; + /** Re-calculates the popup's position with respect to the map location it is pointing to. */ + reposition(): void; + /** + * Resize the info window to the specified height (in pixels). + * @param width The new width of the InfoWindow in pixels. + * @param height The new height of the InfoWindow in pixels. + */ + resize(width: number, height: number): void; + /** Restore the info window to the pre-maximized state. */ + restore(): void; + /** + * Selects the feature at the specified index. + * @param index The index of the feature to select. + */ + select(index: number): void; + /** Go to the next feature. */ + selectNext(): void; + /** Go to the previous feature. */ + selectPrevious(): void; + /** + * Set the value of a property. + * @param name Property to set value. + * @param value Value to set. + */ + set(name: string, value: any): Popup; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: string): void; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: Function): void; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: Graphic[]): void; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: any[]): void; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: string): void; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: Function): void; + /** + * Display the info window at the specified location. + * @param location An instance of esri.geometry.Point that represents the geographic location to display the popup. + * @param options See the object specifications table below for the structure of the options object. + */ + show(location: Point, options?: any): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when clearFeatures is called. */ + on(type: "clear-features", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the info window is hidden. */ + on(type: "hide", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the popup has finished maximizing. */ + on(type: "maximize", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the popup has been restored from its maximized state. */ + on(type: "restore", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the selection changes. */ + on(type: "selection-change", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired after registering an array of features. */ + on(type: "set-features", listener: (event: { target: Popup }) => void): esri.Handle; + /** Fired when the info window becomes visible. */ + on(type: "show", listener: (event: { target: Popup }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Popup; +} + +declare module "esri/dijit/PopupMobile" { + import esri = require("esri"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + import Graphic = require("esri/graphic"); + + /** The PopupMobile class is an implementation of InfoWindow that inherits from InfoWindowBase to provide additional capabilities. */ + class PopupMobile extends InfoWindowBase { + /** The location the info window is pointing to. */ + location: Point; + /** + * Create a new PopupMobile object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupMobileOptions, srcNodeRef: Node); + /** + * Create a new PopupMobile object. + * @param options Optional parameters. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.PopupMobileOptions, srcNodeRef: string); + /** Removes all features and destroys any pending deferreds. */ + clearFeatures(): void; + /** Destroy the popup. */ + destroy(): void; + /** Get the currently selected feature. */ + getSelectedFeature(): Graphic; + /** Hide the info window. */ + hide(): void; + /** + * Selects the feature at the specified index. + * @param index The index of the feature to select. + */ + select(index: number): void; + /** Go to the next feature. */ + selectNext(): void; + /** Go to the previous feature. */ + selectPrevious(): void; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: string): void; + /** + * Set the content for the info window. + * @param content The content for the info window. + */ + setContent(content: Function): void; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: Graphic[]): any; + /** + * Associate an array of features or an array of deferreds that return features with the info window. + * @param features An array of features or deferreds. + */ + setFeatures(features: any[]): any; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: string): void; + /** + * Sets the info window title. + * @param title The text for the title. + */ + setTitle(title: Function): void; + /** + * Display the info window at the specified location. + * @param location An instance of esri.geometry.Point that represents the geographic location to display the popup. + */ + show(location: Point): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fired when clearFeatures is called. */ + on(type: "clear-features", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired when the info window is hidden. */ + on(type: "hide", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired when the selection changes. */ + on(type: "selection-change", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired after registering an array of features. */ + on(type: "set-features", listener: (event: { target: PopupMobile }) => void): esri.Handle; + /** Fired when the info window becomes visible. */ + on(type: "show", listener: (event: { target: PopupMobile }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = PopupMobile; +} + +declare module "esri/dijit/PopupTemplate" { + import esri = require("esri"); + import InfoTemplate = require("esri/InfoTemplate"); + + /** The PopupTemplate class extends esri/InfoTemplate and provides support for defining a layout. */ + class PopupTemplate extends InfoTemplate { + /** The popup definition defined as a JavaScript object. */ + info: any; + /** + * Create a new PopupTemplate object. + * @param popupInfo An object that defines popup content. + * @param options Optional parameters. + */ + constructor(popupInfo: any, options?: esri.PopupTemplateOptions); + } + export = PopupTemplate; +} + +declare module "esri/dijit/Print" { + import esri = require("esri"); + import PrintTemplate = require("esri/tasks/PrintTemplate"); + + /** The Print widget simplifies the process of printing a map using a default or user-defined layout. */ + class Print { + /** + * Creates a new Print widget. + * @param params Parameters for the print widget. + * @param srcNodeRef HTML element where the print widget button and drop down list will be rendered. + */ + constructor(params: esri.PrintOptions, srcNodeRef: Node); + /** + * Creates a new Print widget. + * @param params Parameters for the print widget. + * @param srcNodeRef HTML element where the print widget button and drop down list will be rendered. + */ + constructor(params: esri.PrintOptions, srcNodeRef: string); + /** Destroys the print widget. */ + destroy(): void; + /** Hide the print widget. */ + hide(): void; + /** + * User can call this function so that it programatically print the map. + * @param template Print template. + */ + printMap(template: PrintTemplate): void; + /** Set the print widget's visibility to true. */ + show(): void; + /** Finalizes the creation of the print widget. */ + startup(): void; + /** Fired when an error occurs during the print request. */ + on(type: "error", listener: (event: { error: Error; target: Print }) => void): esri.Handle; + /** Fired when the print job has succeeded. */ + on(type: "print-complete", listener: (event: { value: any; target: Print }) => void): esri.Handle; + /** Fired when the request is sent to the print service. */ + on(type: "print-start", listener: (event: { target: Print }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Print; +} + +declare module "esri/dijit/RendererSlider" { + import esri = require("esri"); + + /** The base slider class for all Subclass Slider widgets listed below. */ + class RendererSlider { + /** Absolute maximum value allowed by the slider. */ + maximum: number; + /** Top label for the slider. */ + maxLabel: string; + /** Absolute minimum value allowed by the slider. */ + minimum: number; + /** Bottom label for the slider. */ + minLabel: string; + /** Accuracy of the data (related to rounding). */ + precision: number; + /** Toggle for showing the black handle bars. */ + showHandles: boolean; + /** Flexible toggle for showing labels e.g. */ + showLabels: any; + /** Toggle for showing the horizontal line indicators from the center of the handle. */ + showTicks: boolean; + /** Handle positions represented as numbers that fall between minimum and maximum. */ + values: number[]; + /** + * Creates a new RendererSlider widget. + * @param params Set of parameters used to specify the RendererSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.RendererSliderOptions, srcNodeRef: Node); + /** + * Creates a new RendererSlider widget. + * @param params Set of parameters used to specify the RendererSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.RendererSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the user actively slides the handle. */ + on(type: "slide", listener: (event: { values: number[]; target: RendererSlider }) => void): esri.Handle; + /** Fires when the user lets go of the handle. */ + on(type: "stop", listener: (event: { values: number[]; target: RendererSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = RendererSlider; +} + +declare module "esri/dijit/Scalebar" { + import esri = require("esri"); + + /** The Scalebar widget displays a scalebar on the map or in a specified HTML node. */ + class Scalebar { + /** + * Creates a new Scalebar dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.ScalebarOptions, srcNodeRef?: Node); + /** + * Creates a new Scalebar dijit. + * @param params Parameters used to configure the widget. + * @param srcNodeRef Reference or id of the HTML element where the widget should be rendered. + */ + constructor(params: esri.ScalebarOptions, srcNodeRef?: string); + /** Destroy the scalebar. */ + destroy(): void; + /** Hide the scalebar dijit. */ + hide(): void; + /** Set the scalebar's visibility to true. */ + show(): void; + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = Scalebar; +} + +declare module "esri/dijit/Search" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Graphic = require("esri/graphic"); + import InfoTemplate = require("esri/InfoTemplate"); + import TextSymbol = require("esri/symbols/TextSymbol"); + import Map = require("esri/map"); + import Geometry = require("esri/geometry/Geometry"); + + /** The Search widget provides a way to perform search capabilities based on locator service(s) and/or map/feature service feature layer(s). */ + class Search { + /** Read-only property of the source object currently selected. */ + activeSource: any; + /** The currently selected source. */ + activeSourceIndex: number; + /** Indicates whether to automatically add all the feature layers from the map. */ + addLayersFromMap: boolean; + /** Indicates whether to automatically navigate to the selected result. */ + autoNavigate: boolean; + /** Indicates whether to automatically select the first result. */ + autoSelect: boolean; + /** Indicates whether to enable an option to collapse/expand the search into a button. */ + enableButtonMode: boolean; + /** Show the selected feature on the map using a default symbol determined by the source's geometry type. */ + enableHighlight: boolean; + /** Indicates whether to display the infoWindow on feature click. */ + enableInfoWindow: boolean; + /** Indicates whether to enable showing a label for the geometry. */ + enableLabel: boolean; + /** Indicates whether to enable the menu for selecting different sources. */ + enableSourcesMenu: boolean; + /** Enable suggestions for the widget. */ + enableSuggestions: boolean; + /** Indicates whether to display suggest results. */ + enableSuggestionsMenu: boolean; + /** Indicates whether to set the state of the enableButtonMode to expanded (true) or collapsed (false). */ + expanded: boolean; + /** This is the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. */ + graphicsLayer: Layer; + /** Read-only property indicating the highlighted location graphic. */ + highlightGraphic: Graphic; + /** A customized infoTemplate for the selected feature. */ + infoTemplate: InfoTemplate; + /** Read-only graphic property for the text label. */ + labelGraphic: Graphic; + /** The text symbol for the label graphic. */ + labelSymbol: TextSymbol; + /** Read-only property indicating whether the widget is loaded. */ + loaded: boolean; + /** The default distance specified in meters used to reverse geocode (if not specified by source). */ + locationToAddressDistance: number; + /** Reference to the map. */ + map: Map; + /** The default maximum number of results returned by the widget if not specified by source. */ + maxResults: number; + /** The default maximum number of suggestions returned by the widget if not specified by source. */ + maxSuggestions: number; + /** The default minimum number of characters needed for the search if not specified by source. */ + minCharacters: number; + /** Read-only property that returns an array of current results from the search. */ + searchResults: any[]; + /** Indicates whether to show the infoWindow when a result is selected. */ + showInfoWindowOnSelect: boolean; + /** An array of source objects used to find search results. */ + sources: any[]; + /** The millisecond delay after keyup and before making a suggest network request. */ + suggestionDelay: number; + /** Read-only property that returns an array of current results from the suggest. */ + suggestResults: any[]; + /** The CSS class selector used to uniquely style the widget. */ + theme: string; + /** The current value of the search box input text string. */ + value: string; + /** Indicate whether to show the widget. */ + visible: boolean; + /** If the result does not have an associated extent, specify this number to use as the zoom scale for the result. */ + zoomScale: number; + /** + * Create a new Search widget using the given DOM node. + * @param options Set of options used to specify Search options. + * @param srcNode Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.SearchOptions, srcNode: Node); + /** + * Create a new Search widget using the given DOM node. + * @param options Set of options used to specify Search options. + * @param srcNode Reference or id of the HTML element where the widget should be rendered. + */ + constructor(options: esri.SearchOptions, srcNode: string); + /** Unfocus the widget's text input. */ + blur(): void; + /** Clears the current value, search results, suggest results, graphic, and/or graphics layer. */ + clear(): void; + /** Closes the widget from button mode. */ + collapse(): void; + /** Destroys the Search widget. */ + destroy(): void; + /** Opens the widget from button mode. */ + expand(): void; + /** Brings focus to the widget's text input. */ + focus(): void; + /** + * Get the value of the property from the Search widget. + * @param name String value indicating the property to get. + */ + get(name: string): any; + /** Hides the Search widget. */ + hide(): void; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: string): any; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: Geometry): any; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: any): any; + /** + * Depending on the sources specified, search() queries the feature layer(s) and/or performs address matching using any specified Locator(s) and returns any applicable results. + * @param value This value can be a string, geometry, suggest candidate object, or an array of [latitude,longitude]. + */ + search(value?: any[]): any; + /** + * Selects a result. + * @param value The result object to select. + */ + select(value: any): void; + /** + * Set the value of a non "read-only" property from the widget. + * @param name The string value to set. + */ + set(name: string): any; + /** Show the Search widget. */ + show(): void; + /** Finalizes the creation of the Search widget. */ + startup(): void; + /** + * Performs a suggest() request on the active Locator. + * @param value The string value used to suggest() on an active Locator. + */ + suggest(value?: string): any; + /** Fired when the widget's text input loses focus. */ + on(type: "blur", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when a result is cleared from the input box or a new result is selected. */ + on(type: "clear-search", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when the widget's text input sets focus. */ + on(type: "focus", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when the search widget has fully loaded. */ + on(type: "load", listener: (event: { target: Search }) => void): esri.Handle; + /** Fired when the search method is called and returns its results. */ + on(type: "search-results", listener: (event: { activeSourceIndex: number; error: Error; numResults: number; results: any; value: string; target: Search }) => void): esri.Handle; + /** Fired when a search result is selected. */ + on(type: "select-result", listener: (event: { result: any; source: any; sourceIndex: number; target: Search }) => void): esri.Handle; + /** Fired when the suggest method is called and returns its results. */ + on(type: "suggest-results", listener: (event: { activeSourceIndex: number; error: Error; numResults: number; results: any; value: string; target: Search }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Search; +} + +declare module "esri/dijit/SizeInfoSlider" { + import esri = require("esri"); + import RendererSlider = require("esri/dijit/RendererSlider"); + + class SizeInfoSlider extends RendererSlider { + /** Optional. */ + classificationMethod: string; + /** Required. */ + handles: number[]; + /** Optional. */ + histogram: any; + /** Optional. */ + histogramWidth: boolean; + /** Optional. */ + maxValue: number; + /** Optional. */ + minValue: number; + /** Optional. */ + normalizationType: string; + /** Optional. */ + primaryHandle: number; + /** Optional */ + rampWidth: number; + /** Property for showing handles. */ + showHandles: boolean; + /** Optional. */ + showHistogram: boolean; + /** Property for showing labels. */ + showLabels: boolean; + /** Property for showing ticks. */ + showTicks: boolean; + /** Required. */ + sizeInfo: any; + /** Optional. */ + statistics: any; + /** Optional. */ + zoomOptions: any; + /** + * Creates a new SizeInfoSlider widget. + * @param params Set of parameters used to specify the SizeInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SizeInfoSliderOptions, srcNodeRef: Node); + /** + * Creates a new SizeInfoSlider widget. + * @param params Set of parameters used to specify the SizeInfoSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SizeInfoSliderOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the SizeInfoSlider properties change. */ + on(type: "change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when minValue or maxValue of SizeInfoSlider change. */ + on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when a SizeInfoSlider handle is moved. */ + on(type: "handle-value-change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = SizeInfoSlider; +} + +declare module "esri/dijit/SymbolStyler" { + import esri = require("esri"); + import Symbol = require("esri/symbols/Symbol"); + + /** A widget that assist with applying properties to Symbols. */ + class SymbolStyler { + /** Read-only: Returns the name of the currently active tab. */ + activeTab: string; + /** + * Creates a new SymbolStyler widget. + * @param params Set of parameters used to specify the SymbolStyler widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SymbolStylerOptions, srcNodeRef: Node); + /** + * Creates a new SymbolStyler widget. + * @param params Set of parameters used to specify the SymbolStyler widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: esri.SymbolStylerOptions, srcNodeRef: string); + /** + * Sets the symbol to edit. + * @param symbol Symbol to edit. + * @param options Styling options. + */ + edit(symbol: Symbol, options: any): void; + /** Returns the current style. */ + getStyle(): any; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Saves the recent fill and outline colors. */ + storeColors(): void; + } + export = SymbolStyler; +} + +declare module "esri/dijit/TimeSlider" { + import esri = require("esri"); + import TimeExtent = require("esri/TimeExtent"); + + /** The TimeSlider widget is used for visualizing content within a map that contains time-aware layers. */ + class TimeSlider { + /** Default value is false. */ + loop: boolean; + /** Default value is false. */ + playing: boolean; + /** Default value is 1. */ + thumbCount: number; + /** Rate at which the time animation plays. */ + thumbMovingRate: number; + /** An array of dates representing the stops (tics) on the TimeSlider. */ + timeStops: Date[]; + /** + * Creates a new TimeSlider object. + * @param params Parameters for the time slider object. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(params: esri.TimeSliderOptions, srcNodeRef: Node); + /** + * Creates a new TimeSlider object. + * @param params Parameters for the time slider object. + * @param srcNodeRef HTML element where the time slider should be rendered. + */ + constructor(params: esri.TimeSliderOptions, srcNodeRef: string); + /** + * The specified number of time stops are created for the input time extent. + * @param timeExtent The time extent used to define the time slider's start and end time stops. + * @param count The number of time stops to create. + */ + createTimeStopsByCount(timeExtent: TimeExtent, count?: number): void; + /** + * Create a time stop for each interval specified, i.e., (week, month, day). + * @param timeExtent The time extent used to define the time slider's start and end time stops. + * @param timeInterval The length of the time interval. + * @param timeIntervalUnits Valid values are listed in the TimeInfo constants table. + */ + createTimeStopsByTimeInterval(timeExtent: TimeExtent, timeInterval?: number, timeIntervalUnits?: string): void; + /** Gets the current time extent for the time slider. */ + getCurrentTimeExtent(): TimeExtent; + /** Move to the next time step. */ + next(): void; + /** Pause the time slider. */ + pause(): void; + /** Play the time slider. */ + play(): void; + /** Move to the previous time step. */ + previous(): void; + /** + * Specify an array of strings to be used as labels. + * @param labels An array of strings that define the labels for each tick. + */ + setLabels(labels: string[]): void; + /** + * Determines whether or not loop. + * @param loop True plays the time slider continuously. + */ + setLoop(loop: boolean): void; + /** + * The number of thumbs to display. + * @param thumbCount The number of thumbs to display. + */ + setThumbCount(thumbCount: number): void; + /** + * Array of two integers, the first value determines where to put the first thumb. + * @param indexes Array of two integers. + */ + setThumbIndexes(indexes: number[]): void; + /** + * Change the rate at which the time animation plays. + * @param thumbMovingRate The rate at which the time slider plays. + */ + setThumbMovingRate(thumbMovingRate: number): void; + /** + * Specify the number of ticks to display on the time slider. + * @param count The number of ticks to display on the slider. + */ + setTickCount(count: number): void; + /** + * Manually define the time stop locations by providing an array of dates. + * @param timeStops Array of dates + */ + setTimeStops(timeStops: Date[]): void; + /** + * Determine if the time is displayed for an instant in time. + * @param createTimeInstants When true, the time slider displays features for the current point in time. + */ + singleThumbAsTimeInstant(createTimeInstants: boolean): void; + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the timeExtent of the TimeSlider is changed. */ + on(type: "time-extent-change", listener: (event: { timeExtent: TimeExtent; target: TimeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = TimeSlider; +} + +declare module "esri/dijit/VisibleScaleRangeSlider" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** A widget that helps set the visible scale range for a layer. */ + class VisibleScaleRangeSlider { + /** Setting the layer will update the suggested scale range, minScale and maxScale. */ + layer: FeatureLayer; + /** Setting this property will update the slider's minimum/maximum values and current scale indicator. */ + map: Map; + /** Read-only: The maxScale bound in the slider range */ + maximum: number; + /** The current maxScale value. */ + maxScale: number; + /** Read-only: The minScale bound in the slider range. */ + minimum: number; + /** The current minScale value. */ + minScale: number; + /** + * Creates a new VisibleScaleRangeSlider widget. + * @param params Set of parameters used to specify the VisibleScaleRangeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new VisibleScaleRangeSlider widget. + * @param params Set of parameters used to specify the VisibleScaleRangeSlider widget options. + * @param srcNodeRef Reference or ID of the HTMLElement where the widget should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Dispatched whenever minScale or maxScale changes. */ + on(type: "scale-range-change", listener: (event: { target: VisibleScaleRangeSlider }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VisibleScaleRangeSlider; +} + +declare module "esri/dijit/analysis/AggregatePoints" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The AggregatePoints widget works with point feature layer and a polygon feature layer. */ + class AggregatePoints extends AnalysisBase { + /** A field name from pointLayer based on which the points will be grouped. */ + groupByField: string; + /** When true, the polygons that have no points within them will be returned in the output. */ + keepBoundariesWithNoPoints: boolean; + /** Reference to the map object. */ + map: Map; + /** When true, two fields will be added to your result layer to indicate which attribute values within each group are the minority (least dominant) or the majority (most dominant) within each boundary. */ + minorityMajority: boolean; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, a new field will be added to the result table containing the percentages of each attribute value within each group. */ + percentPoints: boolean; + /** The point feature layer that will be aggregated into the polygons in the polygon feature layer. */ + pointLayer: FeatureLayer; + /** The polygon layer to be shown selected in in the Choose area menu. */ + polygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the input polygon layer. */ + polygonLayers: FeatureLayer[]; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** An array of attribute field names and statistic types that you would like to aggregate for all points within each polygon. */ + summaryFields: string[]; + /** + * Creates a new AggregatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.AggregatePointsOptions, srcNodeRef: Node); + /** + * Creates a new AggregatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.AggregatePointsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = AggregatePoints; +} + +declare module "esri/dijit/analysis/AnalysisBase" { + import esri = require("esri"); + + /** The AnalysisBase widget is the base class for all other widgets under esri/dijit/analysis. */ + class AnalysisBase { + /** The URL to the analysis service, for example "http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer". */ + analysisGpServer: string; + /** Sets the selected folder of the select folder dropdown, based on the provided folderId, when showSelectFolder is true. */ + folderId: string; + /** Sets the selected folder of the select folder dropdown, based on the provided folderName, when showSelectFolder is true. */ + folderName: string; + /** The URL to the ArcGIS.com site or in-house portal where the GP server is hosted, for example "http://www.arcgis.com". */ + portalUrl: string; + /** + * Cancels an analysis job that is being processed. + * @param jobInfo An object containing job information including job ID, status, message, etc returned by the job-status event. + */ + cancel(jobInfo: any): void; + /** + * Starts checking the analysis job status for the given jobId. + * @param jobId Job id of the analysis job to check. + */ + checkJobStatus(jobId: string): void; + /** + * Starts an analysis tool. + * @param params See the object specifications table below for the structure of the params object. + */ + execute(params: string): void; + /** + * Gets credits estimate for a specific analysis job. + * @param toolName The name of the analysis tool from which a credits estimate will be returned. + * @param jobParams The input job parameters. + */ + getCreditsEstimate(toolName: string, jobParams: string): any; + /** Fires when close icon is clicked or when run analysis button is clicked. */ + on(type: "close", listener: (event: { target: AnalysisBase }) => void): esri.Handle; + /** Fires when the drawn boundaries option is activated. */ + on(type: "drawtool-activate", listener: (event: { target: AnalysisBase }) => void): esri.Handle; + /** Fires when the drawn boundaries option is deactivated. */ + on(type: "drawtool-deactivate", listener: (event: { target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job in cancelled. */ + on(type: "job-cancel", listener: (event: { response: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job fails. */ + on(type: "job-fail", listener: (event: { error: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires after the job fetches result data. */ + on(type: "job-result", listener: (event: { result: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job execution status is received. */ + on(type: "job-status", listener: (event: { jobInfo: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job is submitted to the server for asynchronous processing. */ + on(type: "job-submit", listener: (event: { params: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the job succeeds. */ + on(type: "job-success", listener: (event: { jobInfo: any; target: AnalysisBase }) => void): esri.Handle; + /** Fires when the execute method is called. */ + on(type: "start", listener: (event: { params: any; target: AnalysisBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = AnalysisBase; +} + +declare module "esri/dijit/analysis/CalculateDensity" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Create a density map from point or line features by spreading known quantities of some phenomenon (represented as attributes of the points or lines) across the map. */ + class CalculateDensity extends AnalysisBase { + /** Possible values are "SquareMiles" or "SquareKilometers". */ + areaUnits: string; + /** A layer specifying the area where you want densities to be calculated. */ + boundingPolygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** Classification type to use for the analysis. */ + classificationType: string; + /** The input point, line, or polygon feature layer. */ + inputLayer: FeatureLayer; + /** The number of classes (range of predicted values) in the result layer. */ + numClasses: number; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** The distance specifying how far to search to find point or line features when calculating density values. */ + radius: number; + /** Possible values are Miles, Yards, Kilometers and Meters. */ + radiusUnits: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new CalculateDensity dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new CalculateDensity dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CalculateDensity; +} + +declare module "esri/dijit/analysis/ConnectOriginsToDestinations" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** Measure the travel time or distance between pairs of points. */ + class ConnectOriginsToDestinations extends AnalysisBase { + /** The linear unit used with the distance value(s). */ + distanceDefaultUnits: string; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for analysisLayer with point geometries. */ + enableTravelModes: boolean; + /** An array of feature layers containing destination points. */ + featureLayers: FeatureLayer[]; + /** References the map object. */ + map: Map; + /** The point feature layer containing the origin points. */ + originsLayer: FeatureLayer; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new ConnectOriginsToDestinations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ConnectOriginsToDestinationsOptions, srcNodeRef: Node); + /** + * Creates a new ConnectOriginsToDestinations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ConnectOriginsToDestinationsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = ConnectOriginsToDestinations; +} + +declare module "esri/dijit/analysis/CreateBuffers" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The CreateBuffers widget creates polygons that cover a given distance from an input point, line, or polygon feature layer. */ + class CreateBuffers extends AnalysisBase { + /** An array of buffer distances to buffer the input feature layer. */ + bufferDistance: number[]; + /** The input point, line, or polygon feature layer to be buffered. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** The linear unit to be used with the distance value(s). */ + units: string; + /** + * Creates a new CreateBuffers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateBuffersOptions, srcNodeRef: Node); + /** + * Creates a new CreateBuffers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateBuffersOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateBuffers; +} + +declare module "esri/dijit/analysis/CreateDriveTimeAreas" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The CreateDriveTimeAreas widget creates drive-time (or drive-distance) polygons around input points for the given drive-time values. */ + class CreateDriveTimeAreas extends AnalysisBase { + /** The units of the breakValues parameter. */ + breakUnits: string; + /** An array of driving time break values. */ + breakValues: number[]; + /** The point feature layer around which drive-time areas will be drawn. */ + inputLayer: FeatureLayer; + /** The geometry type of the input layer. */ + inputType: string; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** The rule of overlap. */ + overlapPolicy: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new CreateDriveTimeAreas dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateDriveTimeAreasOptions, srcNodeRef: Node); + /** + * Creates a new CreateDriveTimeAreas dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateDriveTimeAreasOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateDriveTimeAreas; +} + +declare module "esri/dijit/analysis/CreateViewshed" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** Creates areas that are visible based on locations you specify. */ + class CreateViewshed extends AnalysisBase { + /** Feature layer containing points representing observation points. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The linear units to use for the 'maximumDistance' value. */ + maxDistanceUnits: string; + /** The cutoff distance where the computation of visible areas stops. */ + maximumDistance: number; + /** The height above ground of your analysis points. */ + observerHeight: number; + /** The linear units to use for the 'observerHeight' value. */ + observerHeightUnits: string; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** The height of structures or people on the ground used to establish visibility. */ + targetHeight: number; + /** The linear units to use for the 'targetHeight' value. */ + targetHeightUnits: string; + /** + * Creates a new CreateViewshed dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateViewshedOptions, srcNodeRef: Node); + /** + * Creates a new CreateViewshed dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateViewshedOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateViewshed; +} + +declare module "esri/dijit/analysis/CreateWatersheds" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** Creates catchment areas based on locations you specify. */ + class CreateWatersheds extends AnalysisBase { + /** The input feature layer containing points used to calculate watersheds. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** The default unit provided to the user for searching a specified distance from the origin points to their nearest drainages. */ + searchUnits: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new CreateWatersheds dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateWatershedsOptions, srcNodeRef: Node); + /** + * Creates a new CreateWatersheds dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.CreateWatershedsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = CreateWatersheds; +} + +declare module "esri/dijit/analysis/DeriveNewLocations" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Derive new features from the input layers that meet a query you specify. */ + class DeriveNewLocations extends AnalysisBase { + /** The analysis layer to derive new locations from. */ + analysisLayer: FeatureLayer; + /** An array of feature layers to use as input. */ + inputLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new DeriveNewLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new DeriveNewLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = DeriveNewLocations; +} + +declare module "esri/dijit/analysis/DissolveBoundaries" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The DissolveBoundaries widget finds polygons that overlap or share a common boundary, and merges them together to form a single polygon. */ + class DissolveBoundaries extends AnalysisBase { + /** An array of field names based on which polygons are merged. */ + dissolveFields: string[]; + /** The layer containing polygon features that will be dissolved. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** An array of field names and statistical summary types that you wish to calculate from the polygons that are dissolved together. */ + summaryFields: string[]; + /** + * Creates a new DissolveBoundaries dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.DissolveBoundariesOptions, srcNodeRef: Node); + /** + * Creates a new DissolveBoundaries dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.DissolveBoundariesOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = DissolveBoundaries; +} + +declare module "esri/dijit/analysis/EnrichLayer" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The EnrichLayer widget enriches an input layer with facts about the people, places, and businesses nearby. */ + class EnrichLayer extends AnalysisBase { + /** An buffer distance or driving time value to buffer the input feature layer. */ + distance: number; + /** When true, Travel Modes (Driving Time) is enabled for inputLayer with point geometries (esriGeometryPoint). */ + enableTravelModes: boolean; + /** The input feature layer to enrich with new data. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** When true, you can specify a time for traffic condition under Define areas to enrich - Driving Time. */ + showTrafficWidget: boolean; + /** + * Creates a new EnrichLayer dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.EnrichLayerOptions, srcNodeRef: Node); + /** + * Creates a new EnrichLayer dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.EnrichLayerOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = EnrichLayer; +} + +declare module "esri/dijit/analysis/ExtractData" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The ExtractData widget is used to extract data from one or more layers within a given extent. */ + class ExtractData extends AnalysisBase { + /** If true, the Clip features option in Study area will be ckecked. */ + clip: boolean; + /** The format of output data shown as the default selection in the Output data format menu. */ + dataFormat: string; + /** An array for feature layers to be extracted. */ + featureLayers: FeatureLayer[]; + /** An array of feature layers to be shown in the Layers to extract menu as selected. */ + inputLayers: FeatureLayer[]; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new ExtractData dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ExtractDataOptions, srcNodeRef: Node); + /** + * Creates a new ExtractData dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.ExtractDataOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = ExtractData; +} + +declare module "esri/dijit/analysis/FindExistingLocations" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Select features in the input layer that meet an attribute and/or spatial query you specify. */ + class FindExistingLocations extends AnalysisBase { + /** The analysis layer to find existing locations from. */ + analysisLayer: FeatureLayer; + /** An array of feature layers to use as input. */ + inputLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindExistingLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new FindExistingLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = FindExistingLocations; +} + +declare module "esri/dijit/analysis/FindHotSpots" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The FindHotSpots widget finds statistically significant clusters of incident points, weighted points, or weighted polygons. */ + class FindHotSpots extends AnalysisBase { + /** An array of feature layer candidates to be selected as the aggregation polygon layer. */ + aggregationPolygonLayers: FeatureLayer[]; + /** The numeric field in the AnalysisLayer that will be analyzed. */ + analysisField: string; + /** The feature layer for which hot spots will be calculated. */ + analysisLayer: FeatureLayer; + /** A layer of bounding areas to answer the question: Within the bounding areas, are there any locations with unexpectedly high or low point concentrations? */ + boundingPolygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Return a report of the analysis process. */ + returnProcessInfo: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindHotSpots dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindHotSpotsOptions, srcNodeRef: Node); + /** + * Creates a new FindHotSpots dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindHotSpotsOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = FindHotSpots; +} + +declare module "esri/dijit/analysis/FindNearest" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The FindNearest widget works with two layers: an analysis layer and a near layer. */ + class FindNearest extends AnalysisBase { + /** The feature layer from which the nearest features are found. */ + analysisLayer: FeatureLayer; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for analysisLayer with point geometries (esriGeometryPoint). */ + enableTravelModes: boolean; + /** Reference to the map object. */ + map: Map; + /** The maximum number of nearest locations to find for each feature in analysisLayer. */ + maxCount: number; + /** The feature layer to be shown selected in the "1. */ + nearLayer: FeatureLayer; + /** An array of near layer candidates. */ + nearLayers: FeatureLayer[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** The maximum range to search for nearest locations from each feature in the analysisLayer. */ + searchCutoff: number; + /** The units of the searchCutoff parameter. */ + searchCutoffUnits: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindNearest dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindNearestOptions, srcNodeRef: Node); + /** + * Creates a new FindNearest dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.FindNearestOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = FindNearest; +} + +declare module "esri/dijit/analysis/FindSimilarLocations" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Measure the similarity of candidate locations to one or more reference locations. */ + class FindSimilarLocations extends AnalysisBase { + /** The input point, line, or polygon feature layer. */ + inputLayer: FeatureLayer; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Return a report of the analysis process. */ + returnProcessInfo: boolean; + /** The point, line, or polygon feature layer to search. */ + searchLayers: FeatureLayer[]; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new FindSimilarLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new FindSimilarLocations dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the select tool option is activated. */ + on(type: "selecttool-activate", listener: (event: { target: FindSimilarLocations }) => void): esri.Handle; + /** Fires when the select tool option is deactivated. */ + on(type: "selecttool-deactivate", listener: (event: { target: FindSimilarLocations }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FindSimilarLocations; +} + +declare module "esri/dijit/analysis/InterpolatePoints" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Predict values at new locations based on measurements from a collection of points. */ + class InterpolatePoints extends AnalysisBase { + /** A layer specifying the area where you want the result to be drawn. */ + boundingPolygonLayer: FeatureLayer; + /** Polygon layers (optional). */ + boundingPolygonLayers: FeatureLayer[]; + /** Classification type to use for the analysis. */ + classificationType: string; + /** The point features that will be interpolated. */ + inputLayer: FeatureLayer; + /** Maximum number to display in widget UI from which user can pick the number of classes to use in the analysis. */ + maxClasses: number; + /** Minimum number to display in widget UI from which user can pick the number of classes to use in the analysis. */ + minClasses: number; + /** The number of classes (range of predicted values) in the result layer. */ + numClasses: number; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** Point layers (optional). */ + predictAtPointLayers: FeatureLayer[]; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new InterpolatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new InterpolatePoints dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = InterpolatePoints; +} + +declare module "esri/dijit/analysis/MergeLayers" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The MergeLayers widget copies features from two layers into a new layer. */ + class MergeLayers extends AnalysisBase { + /** URL to the GPServer to be used for this analysis. */ + analysisGpServer: string; + /** The feature layer to be merged with the mergeLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** An array of feature layer candidates to be selected as the merge layer. */ + mergeLayers: FeatureLayer[]; + /** An array of values that describe how fields from the mergeLayer are to be modified. */ + mergingAttributes: string[]; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** + * Creates a new MergeLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.MergeLayersOptions, srcNodeRef: Node); + /** + * Creates a new MergeLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.MergeLayersOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = MergeLayers; +} + +declare module "esri/dijit/analysis/OverlayLayers" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The OverlayLayers widget combines two or more layers into one single layer containing all the information found in the stack. */ + class OverlayLayers extends AnalysisBase { + /** The feature layer that will be overlayed with the overlayLayer. */ + inputLayer: FeatureLayer; + /** Reference to the map object. */ + map: Map; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** An array of feature layers to be overlaid with inputLayer. */ + overlayLayer: FeatureLayer[]; + /** Defines how two input layers are combined. */ + overlayType: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** When the distance between features is less than the tolerance, the features in the overlay layer will snap to the features in the input layer. */ + snapToInput: boolean; + /** The minimum distance separating all feature coordinates (nodes and vertices) as well as the distance a coordinate can move in X or Y (or both). */ + tolerance: number; + /** + * Creates a new OverlayLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.OverlayLayersOptions, srcNodeRef: Node); + /** + * Creates a new OverlayLayers dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.OverlayLayersOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = OverlayLayers; +} + +declare module "esri/dijit/analysis/PlanRoutes" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Determine how to efficiently divide tasks among a mobile workforce. */ + class PlanRoutes extends AnalysisBase { + /** Possible values are "Miles" or "Kilometers". */ + distanceDefaultUnits: string; + /** Provide the locations where the people or vehicles end their routes. */ + endLayer: string; + /** Layers to list in the dijit's input boxes. */ + featureLayers: FeatureLayer[]; + /** Whether to limit the max time per route. */ + limitMaxTimePerRoute: boolean; + /** Maximum number of stops per vehicle. */ + maxStopsPerRoute: number; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Whether each route must end its trip at the same place where it started. */ + returnToStart: boolean; + /** The number of vehicles that are available to visit the stops. */ + routeCount: number; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** Provide the locations where the people or vehicles start their routes. */ + startLayer: string; + /** The points that the vehicles, drivers, or routes, should visit. */ + stopsLayer: FeatureLayer; + /** + * Creates a new PlanRoutes dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new PlanRoutes dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = PlanRoutes; +} + +declare module "esri/dijit/analysis/SummarizeNearby" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The FindNearest widget works with two layers: an summarize nearby layer and a summary layer. */ + class SummarizeNearby extends AnalysisBase { + /** An array of numbers that defines the search distance (for StraightLine or DrivingDistance) or time (for DrivingTime) shown in the distance input in the Find nearest features using a option. */ + distances: number[]; + /** When true, Travel Modes (Driving Distance, Driving Time) are enabled for sumNearbyLayer with point geometries (esriGeometryPoint). */ + enableTravelModes: boolean; + /** A field of the summarizeLayer features that you can use to calculate statistics separately for each unique attribute value. */ + groupByField: string; + /** Reference to the map object. */ + map: Map; + /** When true, two fields will be added to your result layer to indicate which attribute values within each group are the minority (least dominant) or the majority (most dominant) within each boundary. */ + minorityMajority: boolean; + /** Type of distance measurement shown as the defeault value in the Find nearest features using a option. */ + nearType: string; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, a new field will be added to the result table containing the percentages of each attribute value within each group. */ + percentPoints: boolean; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** Type of units shown under the Total Area checkbox in the Add statistics from option. */ + shapeUnits: string; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** An array of possible statistics attribute field names and summary types that you wish to calculate for all nearby features. */ + summaryFields: string[]; + /** The feature layer to be shown selected in the Choose layer to summarize dropdown. */ + summaryLayer: FeatureLayer; + /** An array of possible feature layers summarizing toward. */ + summaryLayers: FeatureLayer[]; + /** The point, line, or polygon feature layer from which distances will be measured to features in summarizeLayer. */ + sumNearbyLayer: FeatureLayer; + /** If true. */ + sumShape: boolean; + /** Type of units shown as the defeault value in the Find nearest features using a option. */ + units: string; + /** + * Creates a new SummarizeNearby dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeNearbyOptions, srcNodeRef: Node); + /** + * Creates a new SummarizeNearby dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeNearbyOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = SummarizeNearby; +} + +declare module "esri/dijit/analysis/SummarizeWithin" { + import esri = require("esri"); + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The SummarizeWithin widget works with two layers: an summarize within layer and a summary layer. */ + class SummarizeWithin extends AnalysisBase { + /** A field name from summaryLayer that you can use to calculate statistics separately for each unique attribute value. */ + groupByField: string; + /** Reference to the map object. */ + map: Map; + /** When true, two fields will be added to your result layer to indicate which attribute values within each group are the minority (least dominant) or the majority (most dominant) within each boundary. */ + minorityMajority: boolean; + /** The name of the output layer to be shown in the Result layer name inputbox. */ + outputLayerName: string; + /** When true, a new field will be added to the result table containing the percentages of each attribute value within each group. */ + percentPoints: boolean; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** A list of field names and statistical summary type that you wish to calculate for all features in SummaryLayer that are within each polygon in sumWithinLayer. */ + summaryFields: string; + /** The summary layer to be shown selected in in the Choose layer to summarize menu. */ + summaryLayer: FeatureLayer; + /** An array of summarize layer candidates. */ + summaryLayers: FeatureLayer[]; + /** The polygon feature layer to be summarized toward. */ + sumWithinLayer: FeatureLayer; + /** + * Creates a new SummarizeWithin dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeWithinOptions, srcNodeRef: Node); + /** + * Creates a new SummarizeWithin dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: esri.SummarizeWithinOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = SummarizeWithin; +} + +declare module "esri/dijit/analysis/TraceDownstream" { + import AnalysisBase = require("esri/dijit/analysis/AnalysisBase"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Determine the flow paths in a downstream direction from the locations you specify. */ + class TraceDownstream extends AnalysisBase { + /** A layer specifying the area where you want the trace to be clipped. */ + boundingPolygonLayer: FeatureLayer; + /** An array of feature layer candidates to be selected as the bounding polygon layer. */ + boundingPolygonLayers: FeatureLayer[]; + /** Total length of the line that will be returned. */ + maxDistance: number; + /** The linear units to use for the 'maxDistance' value. */ + maxDistanceUnits: string; + /** The name of the output layer to be shown in the Result layer name input box. */ + outputLayerName: string; + /** When true, returns the result of analysis as a client-side feature collection. */ + returnFeatureCollection: boolean; + /** When true, the choose extent checkbox will be shown. */ + showChooseExtent: boolean; + /** When true, the show credit option is visible. */ + showCredits: boolean; + /** When true, the help links will be shown. */ + showHelp: boolean; + /** When true, the select folder dropdown will be shown. */ + showSelectFolder: boolean; + /** The trace line will be split into multiple lines where each line is of the specified length. */ + splitDistance: number; + /** The units that splitDistance is specified in. */ + splitUnits: string; + /** + * Creates a new TraceDownstream dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new TraceDownstream dijit using the given DOM node. + * @param params Various options to configure this dijit. + * @param srcNodeRef Reference or id of a HTML element that this dijit is rendered into. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + } + export = TraceDownstream; +} + +declare module "esri/dijit/editing/Add" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Add extends OperationBase { + /** + * Create a new Add operation. + * @param params See options list for parameters. + */ + constructor(params: esri.AddOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Add; +} + +declare module "esri/dijit/editing/AttachmentEditor" { + import Graphic = require("esri/graphic"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** Widget that supports viewing attachments for feature layers that have attachments enabled. */ + class AttachmentEditor { + /** + * Creates a new AttachmentEditor object. + * @param params No parameter options. + * @param srcNodeRef HTML element where the widget is rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new AttachmentEditor object. + * @param params No parameter options. + * @param srcNodeRef HTML element where the widget is rendered. + */ + constructor(params: any, srcNodeRef: string); + /** + * Display the attachment editor. + * @param graphic Graphic, with attachments, to display in the attachment editor. + * @param featureLayer The feature layer to display attachments for. + */ + showAttachments(graphic: Graphic, featureLayer: FeatureLayer): void; + /** Finalizes the creation of the attachment editor. */ + startup(): void; + } + export = AttachmentEditor; +} + +declare module "esri/dijit/editing/Cut" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Cut extends OperationBase { + /** + * Create a new Cut operation. + * @param params See options list for parameters. + */ + constructor(params: esri.CutOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Cut; +} + +declare module "esri/dijit/editing/Delete" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Delete extends OperationBase { + /** + * Create a new Delete operation. + * @param params See options list for parameters. + */ + constructor(params: esri.DeleteOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Delete; +} + +declare module "esri/dijit/editing/Editor" { + import esri = require("esri"); + + /** The Editor widget provides out-of-the-box editing capabilities using an editable layer in a Feature Service. */ + class Editor { + /** Arrow tool */ + static CREATE_TOOL_ARROW: any; + /** Autocomplete polygon tool */ + static CREATE_TOOL_AUTOCOMPLETE: any; + /** Circle tool */ + static CREATE_TOOL_CIRCLE: any; + /** Ellipse tool */ + static CREATE_TOOL_ELLIPSE: any; + /** Freehand polygon tool */ + static CREATE_TOOL_FREEHAND_POLYGON: any; + /** Freehand polyline tool */ + static CREATE_TOOL_FREEHAND_POLYLINE: any; + /** Polygon tool */ + static CREATE_TOOL_POLYGON: any; + /** Polyline tool */ + static CREATE_TOOL_POLYLINE: any; + /** Rectangle tool */ + static CREATE_TOOL_RECTANGLE: any; + /** Triangle tool */ + static CREATE_TOOL_TRIANGLE: any; + /** + * Creates a new Editor object. + * @param params Parameters that define the functionality of the editor widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.EditorOptions, srcNodeRef: Node); + /** + * Creates a new Editor object. + * @param params Parameters that define the functionality of the editor widget. + * @param srcNodeRef HTML element where the widget should be rendered. + */ + constructor(params: esri.EditorOptions, srcNodeRef: string); + /** Finalizes the creation of the widget. */ + startup(): void; + /** Fires when the widget has fully loaded. */ + on(type: "load", listener: (event: { target: Editor }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Editor; +} + +declare module "esri/dijit/editing/TemplatePicker" { + import esri = require("esri"); + + /** A template picker displays a gallery of templates from one or more feature layers. */ + class TemplatePicker { + /** Reference to the data grid used to display the templates. */ + grid: any; + /** If tooltips are enabled the reference to the tooltip div. */ + tooltip: HTMLDivElement; + /** + * Creates a new TemplatePicker object that displays a gallery of templates from the input feature layers or items. + * @param params FeatureLayers or items are required all other parameters are optional. + * @param srcNodeRef HTML element where the TemplatePicker will be rendered. + */ + constructor(params: esri.TemplatePickerOptions, srcNodeRef: Node); + /** + * Creates a new TemplatePicker object that displays a gallery of templates from the input feature layers or items. + * @param params FeatureLayers or items are required all other parameters are optional. + * @param srcNodeRef HTML element where the TemplatePicker will be rendered. + */ + constructor(params: esri.TemplatePickerOptions, srcNodeRef: string); + /** + * Get or set the properties of the template picker. + * @param name Name of the attribute of interest. + * @param value Value for the specified attribute. + */ + attr(name: string, value?: any): void; + /** Clears the current selection. */ + clearSelection(): void; + /** Destroys the template picker. */ + destroy(): void; + /** Gets the selected item picked by the user. */ + getSelected(): any; + /** Finalizes the creation of the template picker. */ + startup(): void; + /** Updates the templatePicker after modifying the properties of the widget. */ + update(): void; + /** Fires when an item is selected or unselected in the template picker. */ + on(type: "selection-change", listener: (event: { target: TemplatePicker }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = TemplatePicker; +} + +declare module "esri/dijit/editing/Union" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Union extends OperationBase { + /** + * Create a new Union operation. + * @param params See options list for parameters. + */ + constructor(params: esri.UnionOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Union; +} + +declare module "esri/dijit/editing/Update" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The esri/dijit/editing namespace contains editing related operations that inherit from OperationBase. */ + class Update extends OperationBase { + /** + * Create a new Update operation. + * @param params See options list for parameters. + */ + constructor(params: esri.UpdateOptions); + /** Redo the current operation. */ + performRedo(): void; + /** Undo the current operation. */ + performUndo(): void; + } + export = Update; +} + +declare module "esri/dijit/geoenrichment/DataBrowser" { + import esri = require("esri"); + + /** The DataBrowser widget allows users to search or browse for geoenrichment variables. */ + class DataBrowser { + /** + * Creates a new DataBrowser dijit using the given DOM node. + * @param options Optional parameters used to create the layer. + * @param srcNodeRef Reference or id of an HTML element where the DataBrowser should be rendered. + */ + constructor(options: esri.DataBrowserOptions, srcNodeRef: Node); + /** + * Creates a new DataBrowser dijit using the given DOM node. + * @param options Optional parameters used to create the layer. + * @param srcNodeRef Reference or id of an HTML element where the DataBrowser should be rendered. + */ + constructor(options: esri.DataBrowserOptions, srcNodeRef: string); + /** Finalizes the creation of the DataBrowser. */ + startup(): void; + /** Fires when user clicks the Back button. */ + on(type: "back", listener: (event: { target: DataBrowser }) => void): esri.Handle; + /** Fires when user clicks the Cancel button. */ + on(type: "cancel", listener: (event: { target: DataBrowser }) => void): esri.Handle; + /** Fires when user clicks the OK button. */ + on(type: "ok", listener: (event: { target: DataBrowser }) => void): esri.Handle; + /** Fires when variables are selected. */ + on(type: "select", listener: (event: { target: DataBrowser }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = DataBrowser; +} + +declare module "esri/dijit/geoenrichment/InfoGraphic" { + import esri = require("esri"); + import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** Displays an Infographic of one or more variables that describe the geographic context of a location. */ + class Infographic { + /** The number of Infographic's for which data retrieved is cached for that browser session. */ + cacheLimit: number; + /** The ID of the country for which data is retrieved. */ + countryID: string; + /** The ID of the dataset to which variables used in this Infographic belong. */ + datasetID: string; + /** If true, the Infographic will be displayed in its expanded state. */ + expanded: boolean; + /** When true, output geometry will be available as the geometry property in the returned object of the "data-ready" event handler. */ + returnGeometry: boolean; + /** The study area for this Infographic. */ + studyArea: GeometryStudyArea; + /** The options to apply to the study area. */ + studyAreaOptions: any; + /** An HTML template string used to define the Infographic subtitle. */ + subtitle: string; + /** The title of the Infographic. */ + title: string; + /** The type of the Infographic. */ + type: string; + /** The set of variables displayed in this Infographic. */ + variables: string[]; + /** + * Creates a new Infographic dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Infographic should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new Infographic dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Infographic should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** + * Define the infographic data. + * @param data Specify the FeatureSet containing the custom data to display in the Infographic. + * @param metadata Define the mappings of feature set attributes to Infographic display fields. + */ + setData(data: FeatureSet, metadata?: any): void; + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires if an error occurs in retrieving data for the study area. */ + on(type: "data-error", listener: (event: { error: any; target: Infographic }) => void): esri.Handle; + /** Fires when loading data for the study area. */ + on(type: "data-load", listener: (event: { target: Infographic }) => void): esri.Handle; + /** Fires when data for the study area is ready. */ + on(type: "data-ready", listener: (event: { provider: any; target: Infographic }) => void): esri.Handle; + /** Fires when requesting data for the study area. */ + on(type: "data-request", listener: (event: { target: Infographic }) => void): esri.Handle; + /** Fires when the Infographic is resized. */ + on(type: "resize", listener: (event: { size: number[]; target: Infographic }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Infographic; +} + +declare module "esri/dijit/geoenrichment/InfographicsCarousel" { + import esri = require("esri"); + import InfographicsOptions = require("esri/dijit/geoenrichment/InfographicsOptions"); + import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); + + /** Displays a set of Infographic dijits in a carousel. */ + class InfographicsCarousel { + /** If true, the Infographic will be displayed in its expanded state. */ + expanded: boolean; + /** Describes the options used to configure the contents of the carousel. */ + options: InfographicsOptions; + /** When true, output geometry will be available as the geometry property in the returned object of the "data-ready" event handler. */ + returnGeometry: boolean; + /** The index of the currently selected InfoGraphic in this InfographicsCarousel. */ + selectedIndex: number; + /** The study area for this InfographicsCarousel. */ + studyArea: GeometryStudyArea; + /** The name of the study area to be shown in this InfographicsCarousel. */ + studyAreaTitle: string; + /** + * Creates a new InfographicsCarousel dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Directions widget should be rendered. + */ + constructor(params: any, srcNodeRef: Node); + /** + * Creates a new InfographicsCarousel dijit using the given DOM node. + * @param params Various optional parameters that can be used to configure the dijit. + * @param srcNodeRef Reference or id of an HTML element where the Directions widget should be rendered. + */ + constructor(params: any, srcNodeRef: string); + /** Finalizes the creation of this dijit. */ + startup(): void; + /** Fires if an error occurs in retrieving data for the study area. */ + on(type: "data-error", listener: (event: { error: any; target: InfographicsCarousel }) => void): esri.Handle; + /** Fires when loading data for the study area. */ + on(type: "data-load", listener: (event: { target: InfographicsCarousel }) => void): esri.Handle; + /** Fires when data for the study area is ready. */ + on(type: "data-ready", listener: (event: { provider: any; target: InfographicsCarousel }) => void): esri.Handle; + /** Fires when the InfographicsCarousel is resized. */ + on(type: "resize", listener: (event: { size: number[]; target: InfographicsCarousel }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = InfographicsCarousel; +} + +declare module "esri/dijit/geoenrichment/InfographicsOptions" { + /** InfographicsOptions is used to customize and configure the Infographic's included in a InfographicCarousel. */ + class InfographicsOptions { + /** The options to apply to the study area. */ + studyAreaOptions: any; + /** The name of the css theme used to format the InfographicsCarousel. */ + theme: string; + /** + * Constructs instance from serialized state. + * @param json Various options to configure this InfographicsOptions. + */ + constructor(json?: Object); + /** + * Gets an array of default InfographicsOptions.Item's in the InfographicsCarousel with a countryID. + * @param countryID The ID of the country for which data is retrieved. + */ + getItems(countryID: string): any; + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = InfographicsOptions; +} + +declare module "esri/dijit/geoenrichment/InfographicsOptionsItem" { + /** Defines the options for each Infographic in an InfographicsCarousel. */ + class InfographicsOptionsItem { + /** The ID of the dataset to which variables used in this Infographic belong. */ + datasetID: string; + /** When true, the Infographic is configured to be visible. */ + isVisible: boolean; + /** The title or name of the Infographic. */ + title: string; + /** The type of the Infographic. */ + type: string; + /** The set of variables displayed in this Infographic. */ + variables: string[]; + /** + * Constructs an InfographicsOptionsItem object. + * @param type The type of the Infographic. + * @param variables The set of variables displayed in this InfographicsOptionsItem. + */ + constructor(type: string, variables: string[]); + } + export = InfographicsOptionsItem; +} + +declare module "esri/dijit/util/busyIndicator" { + /** This module provides the ability to create a busy indicator for a target. */ + var busyIndicator: { + /** + * Creates a busy indicator on a target. + * @param target The String (Node id, dijit/_WidgetBase id), HTMLElement reference (Node), or dijit/_WidgetBase. + * @param params (Optional) The params options can be used when needing more fine-grained control. + */ + create(target: string, params?: any): any; + /** + * Creates a busy indicator on a target. + * @param target The String (Node id, dijit/_WidgetBase id), HTMLElement reference (Node), or dijit/_WidgetBase. + * @param params (Optional) The params options can be used when needing more fine-grained control. + */ + create(target: HTMLElement, params?: any): any; + /** + * Creates a busy indicator on a target. + * @param target The String (Node id, dijit/_WidgetBase id), HTMLElement reference (Node), or dijit/_WidgetBase. + * @param params (Optional) The params options can be used when needing more fine-grained control. + */ + create(target: any, params?: any): any; + }; + export = busyIndicator; +} + +declare module "esri/domUtils" { + /** Utility methods related to working with the DOM. */ + var domUtils: { + /** Represents the size of the client side window or document at first load. */ + documentBox: any; + /** + * Returns the DOM node from HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase to retrieve. + */ + getNode(target: HTMLElement): Node; + /** + * Returns the DOM node from HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase to retrieve. + */ + getNode(target: any): Node; + /** + * Hides the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + hide(target: HTMLElement): void; + /** + * Hides the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + hide(target: any): void; + /** + * Shows the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + show(target: HTMLElement): void; + /** + * Shows the HTMLElement or dijit/_WidgetBase. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + show(target: any): void; + /** + * If the target (HTMLElement or dijit/_WidgetBase) is currently visible, the target is hidden. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + toggle(target: HTMLElement): void; + /** + * If the target (HTMLElement or dijit/_WidgetBase) is currently visible, the target is hidden. + * @param target The HTMLElement or dijit/_WidgetBase. + */ + toggle(target: any): void; + }; + export = domUtils; +} + +declare module "esri/geometry/Circle" { + import esri = require("esri"); + import Polygon = require("esri/geometry/Polygon"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** A circle (Polygon) created by a specified center point. */ + class Circle extends Polygon { + /** Center point of the circle. */ + center: any; + /** The radius of the circle based. */ + radius: number; + /** Unit of the radius. */ + radiusUnit: string; + /** Array of coordinate values constituting the circle like [[x1, y1], [x2, y2],...]. */ + rings: number[][][]; + /** The spatial reference of the circle will be the same as the spatial reference of the center point. */ + spatialReference: SpatialReference; + /** + * Create a new Circle by specifying an input center location using either an esri.geometry.Point object or a latitude/longitude array and an object with the following optional properties: radius, radiusUnits, geodesic and numberOfPoints. + * @param center Center point of the circle. + * @param options See options descriptions for further information. + */ + constructor(center: Point, options?: esri.CircleOptions1); + /** + * Create a new Circle by specifying an input center location using either an esri.geometry.Point object or a latitude/longitude array and an object with the following optional properties: radius, radiusUnits, geodesic and numberOfPoints. + * @param center Center point of the circle. + * @param options See options descriptions for further information. + */ + constructor(center: number[], options?: esri.CircleOptions1); + /** + * Create a new Circle by specifying an object with a required center location, defined as a longitude/latitude array or an esri.geometry.Point, and the following additional optional parameters: radius, radiusUnits, geodesic, and numberOfPoints. + * @param params If no center parameter is provided, it must be set within the options. + */ + constructor(params: esri.CircleOptions2); + } + export = Circle; +} + +declare module "esri/geometry/Extent" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** The minimum and maximum X- and Y- coordinates of a bounding box. */ + class Extent extends Geometry { + /** Top-right X-coordinate of an extent envelope. */ + xmax: number; + /** Bottom-left X-coordinate of an extent envelope. */ + xmin: number; + /** Top-right Y-coordinate of an extent envelope. */ + ymax: number; + /** Bottom-left Y-coordinate of an extent envelope. */ + ymin: number; + /** + * Creates a new Extent object. + * @param xmin Bottom-left X-coordinate of an extent envelope. + * @param ymin Bottom-left Y-coordinate of an extent envelope. + * @param xmax Top-right X-coordinate of an extent envelope. + * @param ymax Top-right Y-coordinate of an extent envelope. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(xmin: number, ymin: number, xmax: number, ymax: number, spatialReference: SpatialReference); + /** + * Creates a new Extent object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * A new extent is returned with the same width and height centered at the argument point. + * @param point Centers the extent on the specified x,y location. + */ + centerAt(point: Point): Extent; + /** + * When "true", the geometry in the argument is contained in this extent. + * @param geometry Can be a Point or Extent. + */ + contains(geometry: Geometry): boolean; + /** + * Expands the extent by the factor given. + * @param factor The multiplier value. + */ + expand(factor: number): Extent; + /** Returns the center point of the extent in map units. */ + getCenter(): Point; + /** Distance between ymin and ymax. */ + getHeight(): number; + /** Distance between xmin and xmax. */ + getWidth(): number; + /** + * Returns the interesection extent if the input geometry is an extent that intersects this extent. + * @param geometry The geometry used to test the intersection. + */ + intersects(geometry: Geometry): any; + /** Returns an array with either one Extent that's been shifted to within +/- 180 or two Extents if the original extent intersects the dateline. */ + normalize(): Extent[]; + /** + * Returns a new Extent with x and y offsets. + * @param dx The offset distance in map units for the y-coordinate. + * @param dy The offset distance in map units for the x-coordinate. + */ + offset(dx: number, dy: number): Extent; + /** Returns an extent with a spatial reference with a custom shifted central meridian if the extent intersects the dateline. */ + shiftCentralMeridian(): Extent; + /** + * Expands this extent to include the extent of the argument. + * @param extent The minx, miny, maxx, and maxy bounding box. + */ + union(extent: Extent): Extent; + /** + * Updates this extent with the specified parameters. + * @param xmin Bottom-left X-coordinate of an extent envelope. + * @param ymin Bottom-left Y-coordinate of an extent envelope. + * @param xmax Top-right X-coordinate of an extent envelope. + * @param ymax Top-right Y-coordinate of an extent envelope. + * @param spatialReference Spatial reference of the geometry. + */ + update(xmin: number, ymin: number, xmax: number, ymax: number, spatialReference: SpatialReference): Extent; + } + export = Extent; +} + +declare module "esri/geometry/Geometry" { + import SpatialReference = require("esri/SpatialReference"); + + /** The base class for geometry objects. */ + class Geometry { + /** The cache is used to store values computed from geometries that need to cleared or recomputed upon mutation. */ + cache: any; + /** The spatial reference of the geometry. */ + spatialReference: SpatialReference; + /** The type of geometry. */ + type: string; + /** Sets the cache property to undefined. */ + clearCache(): void; + /** + * Returns the value for a named property stored in the cache. + * @param name The property name of the value to retrieve from the cache. + */ + getCacheValue(name: string): any; + /** + * Sets the value for a named property stored in the cache. + * @param name The property name for the value Object to store in the cache. + * @param value The value Object for a named property to store in the cache. + */ + setCacheValue(name: string, value: any): void; + /** + * Sets the spatial reference. + * @param sr Spatial reference of the geometry. + */ + setSpatialReference(sr: SpatialReference): Geometry; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Geometry; +} + +declare module "esri/geometry/Multipoint" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import Extent = require("esri/geometry/Extent"); + + /** An ordered collection of points. */ + class Multipoint extends Geometry { + /** An array of one or more points. */ + points: number[][]; + /** + * Creates a new Multipoint object. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(spatialReference: SpatialReference); + /** + * Creates a new Multipoint object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * Adds a point to the Multipoint. + * @param point The point to add. + */ + addPoint(point: Point): Multipoint; + /** + * Adds a point to the Multipoint. + * @param point The point to add. + */ + addPoint(point: number[]): Multipoint; + /** Gets the extent of all the points. */ + getExtent(): Extent; + /** + * Returns the point at the specified index. + * @param index Positional index of the point in the points property. + */ + getPoint(index: number): Point; + /** + * Removes a point from the Multipoint. + * @param index The index of the point to remove. + */ + removePoint(index: number): Point; + /** + * Updates the point at the specified index. + * @param index Positional index of the point in the points property. + * @param point Point that specifies the new location. + */ + setPoint(index: number, point: Point): Multipoint; + } + export = Multipoint; +} + +declare module "esri/geometry/Point" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + + /** A location defined by an X- and Y- coordinate. */ + class Point extends Geometry { + /** X-coordinate of a point in map units. */ + x: number; + /** Y-coordinate of a point in map units. */ + y: number; + /** + * Creates a new Point object using x, y, and a spatial reference. + * @param x X-coordinate of a point in map units. + * @param y Y-coordinate of a point in map units. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(x: number, y: number, spatialReference: SpatialReference); + /** + * Creates a new Point object using an array containing an x,y coordinate value and a spatial reference. + * @param coords An array that includes an x,y coordinate. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(coords: number[], spatialReference: SpatialReference); + /** + * Creates a new Point object using a JSON object. + * @param json A JSON object that contains an x,y coordinate. + */ + constructor(json: Object); + /** + * Create a point object and initialize it with specified longitude and latitude. + * @param long Longitude value. + * @param lat Latitude value. + */ + constructor(long: number, lat: number); + /** + * Create a point object and initialize it with an array containing longitude and latitude values. + * @param point An input array containing the longitude and latitude values for the point. + */ + constructor(point: number[]); + /** + * Create a point object and initialize it with an object that has latitude and longitude properties. + * @param point An object with latitude and longitude properties. + */ + constructor(point: any); + /** Returns the latitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326). */ + getLatitude(): number; + /** Returns the longitude coordinate for this point if the spatial reference of the point is Web Mercator or Geographic (4326). */ + getLongitude(): number; + /** Shifts the x coordinate to within +/- 180 span. */ + normalize(): Point; + /** + * Returns a new Point with x and y offsets. + * @param dx The offset distance in map units from the x-coordinate. + * @param dy The offset distance in map units from the y-coordinate. + */ + offset(dx: number, dy: number): Point; + /** + * Sets the latitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326). + * @param lat A valid latitude value. + */ + setLatitude(lat: number): Point; + /** + * Sets the longitude coordinate for this point to the specified value if the point's spatial reference is Web Mercator or Geographic (4326). + * @param lon A valid longitude value. + */ + setLongitude(lon: number): Point; + /** + * Sets x-coordinate of point. + * @param x Value for x-coordinate of point. + */ + setX(x: number): Point; + /** + * Sets y-coordinate of point. + * @param y Value for y-coordinate of point. + */ + setY(y: number): Point; + /** + * Updates a point. + * @param x X-coordinate of the updated point. + * @param y Y-coordinate of the updated point. + */ + update(x: number, y: number): Point; + } + export = Point; +} + +declare module "esri/geometry/Polygon" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import Extent = require("esri/geometry/Extent"); + + /** An array of rings where each ring is an array of points. */ + class Polygon extends Geometry { + /** An array of rings. */ + rings: number[][][]; + /** + * Creates a new Polygon object. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(spatialReference: SpatialReference); + /** + * Creates a new Polygon object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * Create a new polygon by providing an array of geographic coordinate pairs. + * @param coordinates An array of geographic coordinates that define the polygon. + */ + constructor(coordinates: number[][]); + /** + * Create a new polygon by providing an array of geographic coordinate pairs. + * @param coordinates An array of geographic coordinates that define the polygon. + */ + constructor(coordinates: number[][][]); + /** + * Adds a ring to the Polygon. + * @param ring A polygon ring. + */ + addRing(ring: Point[]): Polygon; + /** + * Adds a ring to the Polygon. + * @param ring A polygon ring. + */ + addRing(ring: number[][]): Polygon; + /** + * Checks on the client if the specified point is inside the polygon. + * @param point The location defined by an X- and Y- coordinate in map units. + */ + contains(point: Point): boolean; + /** + * Returns a new Polygon with one ring containing points equivalent to the coordinates of the extent. + * @param extent The Extent geometry to convert to a Polygon. + */ + static fromExtent(extent: Extent): Polygon; + /** Returns the centroid of the polygon as defined here. */ + getCentroid(): Point; + /** Returns the extent of the polygon. */ + getExtent(): Extent; + /** + * Returns a point specified by a ring and point in the path. + * @param ringIndex The index of a ring. + * @param pointIndex The index of a point in a ring. + */ + getPoint(ringIndex: number, pointIndex: number): Point; + /** + * Inserts a new point into a polygon. + * @param ringIndex Ring index to insert point. + * @param pointIndex The index of the inserted point in the ring. + * @param point Point to insert into the ring. + */ + insertPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; + /** + * Checks if a Polygon ring is clockwise. + * @param ring A polygon ring. + */ + isClockwise(ring: Point[]): boolean; + /** + * Checks if a Polygon ring is clockwise. + * @param ring A polygon ring. + */ + isClockwise(ring: number[][]): boolean; + /** + * When true, the polygon is self-intersecting which means that the ring of the polygon crosses itself. + * @param polygon The polygon to test for self-intersection. + */ + isSelfIntersecting(polygon: Polygon): boolean; + /** + * Remove a point from the polygon at the given pointIndex within the ring identified by ringIndex. + * @param ringIndex The index of the ring containing the point. + * @param pointIndex The index of the point within the ring. + */ + removePoint(ringIndex: number, pointIndex: number): Point; + /** + * Removes a ring from the Polygon. + * @param ringIndex The index of the ring to remove. + */ + removeRing(ringIndex: number): Point[]; + /** + * Updates a point in a polygon. + * @param ringIndex Ring index for updated point. + * @param pointIndex The index of the updated point in the ring. + * @param point Point to update in the ring. + */ + setPoint(ringIndex: number, pointIndex: number, point: Point): Polygon; + } + export = Polygon; +} + +declare module "esri/geometry/Polyline" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import Extent = require("esri/geometry/Extent"); + + /** An array of paths where each path is an array of points. */ + class Polyline extends Geometry { + /** An array of paths. */ + paths: number[][][]; + /** + * Creates a new Polyline object. + * @param spatialReference Spatial reference of the geometry. + */ + constructor(spatialReference: SpatialReference); + /** + * Creates a new Polyline object using a JSON object. + * @param json JSON object representing the geometry. + */ + constructor(json: Object); + /** + * Create a new polyline by providing an array of geographic coordinates. + * @param coordinates An array of geographic coordinates that define the polyline. + */ + constructor(coordinates: number[][]); + /** + * Create a new polyline by providing an array of geographic coordinates. + * @param coordinates An array of geographic coordinates that define the polyline. + */ + constructor(coordinates: number[][][]); + /** + * Adds a path to the Polyline. + * @param path Path to add to the Polyline. + */ + addPath(path: Point[]): Polyline; + /** + * Adds a path to the Polyline. + * @param path Path to add to the Polyline. + */ + addPath(path: number[][]): Polyline; + /** Returns the extent of the Polyline. */ + getExtent(): Extent; + /** + * Returns a point specified by a path and point in the path. + * @param pathIndex The index of a path in a polyline. + * @param pointIndex The index of a point in a path. + */ + getPoint(pathIndex: number, pointIndex: number): Point; + /** + * Inserts a new point into a polyline. + * @param pathIndex Path index to insert point. + * @param pointIndex The index of the inserted point in the path. + * @param point Point to insert into the path. + */ + insertPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; + /** + * Removes a path from the Polyline. + * @param pathIndex The index of a path to remove. + */ + removePath(pathIndex: number): Point[]; + /** + * Remove a point from the polyline at the given pointIndex within the path identified by the given pathIndex. + * @param pathIndex The index of the path containing the point. + * @param pointIndex The index of the point within the path. + */ + removePoint(pathIndex: number, pointIndex: number): Point; + /** + * Updates a point in a polyline. + * @param pathIndex Path index for updated point. + * @param pointIndex The index of the updated point in the path. + * @param point Point to update in the path. + */ + setPoint(pathIndex: number, pointIndex: number, point: Point): Polyline; + } + export = Polyline; +} + +declare module "esri/geometry/ScreenPoint" { + /** ScreenPoint represents a point in terms of pixels relative to the top-left corner of the map control. */ + class ScreenPoint { + /** X-coordinate relative to the top-left corner of the map control in pixels. */ + x: number; + /** Y-coordinate relative to the top-left corner of the map control in pixels. */ + y: number; + /** + * Creates a new ScreenPoint object with X-, Y- coordinates. + * @param x X-coordinate relative to the top-left corner of the map control in pixels. + * @param y Y-coordinate relative to the top-left corner of the map control in pixels. + */ + constructor(x: number, y: number); + /** + * Creates a new ScreenPoint object with an array containing X-, Y- coordinates. + * @param coords An array that includes X-, Y- coordinates. + */ + constructor(coords: number[]); + /** + * Creates a new ScreenPoint object with a JSON object. + * @param json A JSON object that includes X-, Y- coordinates. + */ + constructor(json: Object); + /** + * Offsets the point in an x and y direction. + * @param dx Value for x-coordinate of point. + * @param dy Value for y-coordinate of point. + */ + offset(dx: number, dy: number): ScreenPoint; + /** + * Sets x-coordinate of point. + * @param x Value for x-coordinate of point. + */ + setX(x: number): ScreenPoint; + /** + * Sets y-coordinate of point. + * @param y Value for y-coordinate of point. + */ + setY(y: number): ScreenPoint; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + /** + * Updates a ScreenPoint. + * @param x X-coordinate relative to the top-left corner of the map control in pixels. + * @param y Y-coordinate relative to the top-left corner of the map control in pixels. + */ + update(x: number, y: number): ScreenPoint; + } + export = ScreenPoint; +} + +declare module "esri/geometry/geodesicUtils" { + import Polygon = require("esri/geometry/Polygon"); + import Geometry = require("esri/geometry/Geometry"); + import Polyline = require("esri/geometry/Polyline"); + + /** Utility methods for various geodesic calculations. */ + var geodesicUtils: { + /** + * Determine the area for the input polygons. + * @param polygons An array of polygons. + * @param areaUnit The area unit. + */ + geodesicAreas(polygons: Polygon[], areaUnit: string): number[]; + /** + * Returns a densified geometry. + * @param geometry A polyline or polygon to densify. + * @param maxSegmentLength The maximum segment length in meters. + */ + geodesicDensify(geometry: Geometry, maxSegmentLength: number): Geometry; + /** + * Determine the length for the input polylines using the specified length unit. + * @param polylines An array of polylines. + * @param lengthUnit The length unit. + */ + geodesicLengths(polylines: Polyline[], lengthUnit: string): number[]; + }; + export = geodesicUtils; +} + +declare module "esri/geometry/geometryEngine" { + import Geometry = require("esri/geometry/Geometry"); + import Extent = require("esri/geometry/Extent"); + import Polyline = require("esri/geometry/Polyline"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** (Beta at v3.13) A client-side geometry engine. */ + var geometryEngine: { + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates the clipped geometry from a target geometry by an envelope. + * @param geometry The geometry to be clipped. + * @param envelope The envelope used to clip. + */ + clip(geometry: Geometry, envelope: Extent): Geometry; + /** + * Indicates if one geometry contains another geometry. + * @param geometry1 The geometry that is tested for the contains relationship to the other geometry. + * @param geometry2 The geometry that is tested for within relationship to the other geometry. + */ + contains(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry, merge?: boolean): any; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry[], merge?: boolean): any; + /** + * Indicates if one geometry crosses another geometry. + * @param geometry1 The geometry to cross. + * @param geometry2 The geometry being crossed. + */ + crosses(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Split the input polyline or polygon where it crosses a cutting polyline. + * @param geometry The geometry to be cut. + * @param cutter The polyline to cut the geometry. + */ + cut(geometry: Geometry, cutter: Polyline): Geometry[]; + /** + * Densify geometries by plotting points between existing vertices. + * @param geometry The geometry to be densified. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Unit for the maximum segment length. + */ + densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit?: number): Geometry; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry, subtractor: Geometry): any; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry[], subtractor: Geometry): any; + /** + * Indicates if one geometry is disjoint from another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the disjoint relationship to the other geometry. + */ + disjoint(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Calculates the 2D planar shortest distance between two geometries. + * @param geometry1 + * @param geometry2 + * @param distanceUnit Units of the return value. + */ + distance(geometry1: Geometry, geometry2: Geometry, distanceUnit?: number): number; + /** + * Indicates if two geometries are equal. + * @param geometry1 + * @param geometry2 + */ + equals(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Returns an object containing additional information about the input spatial reference. + * @param spatialReference The spatial Reference. + */ + extendedSpatialReferenceInfo(spatialReference: SpatialReference): any; + /** + * Flips a geometry on the horizontal axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipHorizontal(geometry: Geometry, flipOrigin?: Point): Geometry; + /** + * Flips a geometry on the vertical axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipVertical(geometry: Geometry, flipOrigin?: Point): Geometry; + /** + * Performs the generalize operation on the geometries in the cursor. + * @param geometry The geometry to be generalized. + * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. + * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). + * @param maxDeviationUnit A unit for maximum deviation. + */ + generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: number): Geometry; + /** + * Calculates area of input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicArea(geometry: Geometry, unit?: number): number; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates length of the input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicLength(geometry: Geometry, unit?: number): number; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry, intersector: Geometry): any; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry[], intersector: Geometry): any; + /** + * Indicates if one geometry intersects another geometry. + * @param geometry1 The geometry that is tested for the intersects relationship to the other geometry. + * @param geometry2 The geometry being intersected. + */ + intersects(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Indicates if the given geometry is simple. + * @param geometry Geometry + */ + isSimple(geometry: Geometry): boolean; + /** + * Finds the coordinate of the geometry which is closest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point to find the nearest coordinate in the geometry for. + */ + nearestCoordinate(geometry: Geometry, inputPoint: Point): any; + /** + * Finds vertex on the geometry nearest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point to find the nearest vertex in the geometry for. + */ + nearestVertex(geometry: Geometry, inputPoint: Point): any; + /** + * Finds all vertices in the given distance from the specified point, sorted from the closest to the furthest and returns them as an array of objects. + * @param geometry The geometry to consider. + * @param inputPoint The point to start from. + * @param searchRadius The search radius. + * @param maxVertexCountToReturn The maximum number number of vertices to return. + */ + nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any[]; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry, distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry[], distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Indicates if one geometry overlaps another geometry. + * @param geometry1 The base geometry that is tested for overlaps relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the overlaps relationship to the other geometry. + */ + overlaps(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * Calculates the area of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarArea(geometry: Geometry, unit?: number): number; + /** + * Calculates the length of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarLength(geometry: Geometry, unit: number): number; + /** + * Indicates if the given relation holds for the two geometries. + * @param geometry1 The first geometry for the relation. + * @param geometry2 The second geometry for the relation. + * @param relation The DE-9IM matrix relation encoded as a string. + */ + relate(geometry1: Geometry, geometry2: Geometry, relation: string): boolean; + /** + * Rotates a geometry by a specified angle. + * @param geometry The input geometry. + * @param angle The rotation angle + * @param rotationOrigin Point to rotate the geometry around. + */ + rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): Geometry; + /** + * Performs the simplify operation on the geometry which alters the given geometries to make their definitions topologically legal with respect to their geometry type. + * @param geometry Geometry + */ + simplify(geometry: Geometry): Geometry; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry, rightGeometry: Geometry): any; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry[], rightGeometry: Geometry): any; + /** + * Indicates if one geometry touches another geometry. + * @param geometry1 The geometry which may be touching another geometry. + * @param geometry2 The geometry to be touched. + */ + touches(geometry1: Geometry, geometry2: Geometry): boolean; + /** + * All inputs must be of the same type of geometries and share one spatial reference. + * @param geometries The geometries to union. + */ + union(geometries: Geometry[]): Geometry; + /** + * Indicates if one geometry is within another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry. + */ + within(geometry1: Geometry, geometry2: Geometry): boolean; + }; + export = geometryEngine; +} + +declare module "esri/geometry/geometryEngineAsync" { + import Geometry = require("esri/geometry/Geometry"); + import Extent = require("esri/geometry/Extent"); + import Polyline = require("esri/geometry/Polyline"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + + /** (Beta at v3.13) A client-side asynchronous geometry engine. */ + var geometryEngineAsync: { + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + buffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates the clipped geometry from a target geometry by an envelope. + * @param geometry The geometry to be clipped. + * @param envelope The envelope used to clip. + */ + clip(geometry: Geometry, envelope: Extent): any; + /** + * Indicates if one geometry contains another geometry. + * @param geometry1 The geometry that is tested for the contains relationship to the other geometry. + * @param geometry2 The geometry that is tested for within relationship to the other geometry. + */ + contains(geometry1: Geometry, geometry2: Geometry): any; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry, merge?: boolean): any; + /** + * Calculates the convex hull of the input geometry. + * @param geometry The input geometry. + * @param merge Whether to merge output geometries. + */ + convexHull(geometry: Geometry[], merge?: boolean): any; + /** + * Indicates if one geometry crosses another geometry. + * @param geometry1 The geometry to cross. + * @param geometry2 The geometry being crossed. + */ + crosses(geometry1: Geometry, geometry2: Geometry): any; + /** + * Split the input polyline or polygon where it crosses a cutting polyline. + * @param geometry The geometry to be cut. + * @param cutter The polyline to cut the geometry. + */ + cut(geometry: Geometry, cutter: Polyline): any; + /** + * Densify geometries by plotting points between existing vertices. + * @param geometry The geometry to be densified. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Unit for the maximum segment length. + */ + densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit?: number): any; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry, subtractor: Geometry): any; + /** + * Creates the difference of two geometries. + * @param geometry The input geometry. + * @param subtractor The geometry being subtracted. + */ + difference(geometry: Geometry[], subtractor: Geometry): any; + /** + * Indicates if one geometry is disjoint from another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the disjoint relationship to the other geometry. + */ + disjoint(geometry1: Geometry, geometry2: Geometry): any; + /** + * Calculates the 2D planar shortest distance between two geometries. + * @param geometry1 + * @param geometry2 + * @param distanceUnit Units of the return value. + */ + distance(geometry1: Geometry, geometry2: Geometry, distanceUnit?: number): any; + /** + * Indicates if two geometries are equal. + * @param geometry1 + * @param geometry2 + */ + equals(geometry1: Geometry, geometry2: Geometry): any; + /** + * Returns an object containing additional information about the input spatial reference. + * @param spatialReference The spatial Reference. + */ + extendedSpatialReferenceInfo(spatialReference: SpatialReference): any; + /** + * Flips a geometry on the horizontal axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipHorizontal(geometry: Geometry, flipOrigin?: Point): any; + /** + * Flips a geometry on the vertical axis. + * @param geometry The input geometry. + * @param flipOrigin Point to flip the geometry around. + */ + flipVertical(geometry: Geometry, flipOrigin?: Point): any; + /** + * Performs the generalize operation on the geometries in the cursor. + * @param geometry The geometry to be generalized. + * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. + * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). + * @param maxDeviationUnit A unit for maximum deviation. + */ + generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: number): any; + /** + * Calculates area of input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicArea(geometry: Geometry, unit?: number): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry, distance: number, unit?: number, unionResults?: boolean): any; + /** + * Creates buffer polygons at a specified distance around the given geometries using geographic (geodesic) coordinates. + * @param geometry The buffer input geometry. + * @param distance The specified distance(s) for buffering. + * @param unit Unit for the distances. + * @param unionResults Whether the output geometries should be unioned into a single polygon. + */ + geodesicBuffer(geometry: Geometry[], distance: number[], unit?: number, unionResults?: boolean): any; + /** + * Calculates length of the input geometry using geographic (geodesic) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + geodesicLength(geometry: Geometry, unit?: number): any; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry, intersector: Geometry): any; + /** + * Creates a new geometry through intersection between two geometries. + * @param geometry The input geometry. + * @param intersector The geometry being intersected. + */ + intersect(geometry: Geometry[], intersector: Geometry): any; + /** + * Indicates if one geometry intersects another geometry. + * @param geometry1 The geometry that is tested for the intersects relationship to the other geometry. + * @param geometry2 The geometry being intersected. + */ + intersects(geometry1: Geometry, geometry2: Geometry): any; + /** + * Indicates if the given geometry is simple. + * @param geometry Geometry + */ + isSimple(geometry: Geometry): any; + /** + * Finds the coordinate of the geometry which is closest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point used to find the nearest coordinate in the geometry. + */ + nearestCoordinate(geometry: Geometry, inputPoint: Point): any; + /** + * Finds vertex on the geometry nearest to the specified point. + * @param geometry The geometry to consider. + * @param inputPoint The point to find the nearest vertex in the geometry for. + */ + nearestVertex(geometry: Geometry, inputPoint: Point): any; + /** + * Finds all vertices in the given distance from the specified point, sorted from the closest to the furthest and returns them as an array of objects once resolved. + * @param geometry The geometry to consider. + * @param inputPoint The point to start from. + * @param searchRadius The search radius. + * @param maxVertexCountToReturn The maximum number number of vertices to return. + */ + nearestVertices(geometry: Geometry, inputPoint: Point, searchRadius: number, maxVertexCountToReturn: number): any; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry, distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Creates offset version of the input geometry. + * @param geometry The geometries to offset. + * @param distance The offset distance for the Geometries. + * @param offsetUnit Unit for the offset. + * @param joinType The join type. + * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. + * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. + */ + offset(geometry: Geometry[], distance: number, offsetUnit: number, joinType: number, bevelRatio?: number, flattenError?: number): any; + /** + * Indicates if one geometry overlaps another geometry. + * @param geometry1 The base geometry that is tested for overlaps relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the overlaps relationship to the other geometry. + */ + overlaps(geometry1: Geometry, geometry2: Geometry): any; + /** + * Calculates the area of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarArea(geometry: Geometry, unit?: number): any; + /** + * Calculates the length of the input geometry using projected (planar) coordinates. + * @param geometry + * @param unit Units of the return value. + */ + planarLength(geometry: Geometry, unit: number): any; + /** + * Indicates if the given relation holds for the two geometries. + * @param geometry1 The first geometry for the relation. + * @param geometry2 The second geometry for the relation. + * @param relation The DE-9IM matrix relation encoded as a string. + */ + relate(geometry1: Geometry, geometry2: Geometry, relation: string): any; + /** + * Rotates a geometry by a specified angle. + * @param geometry The input geometry. + * @param angle The rotation angle + * @param rotationOrigin Point to rotate the geometry around. + */ + rotate(geometry: Geometry, angle: number, rotationOrigin?: Point): any; + /** + * Performs the simplify operation on the geometry which alters the given geometries to make their definitions topologically legal with respect to their geometry type. + * @param geometry Geometry + */ + simplify(geometry: Geometry): any; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry, rightGeometry: Geometry): any; + /** + * Creates the symmetric difference of two geometries. + * @param leftGeometry One of the Geometry instances in the XOR operation. + * @param rightGeometry One of the Geometry instances in the XOR operation. + */ + symmetricDifference(leftGeometry: Geometry[], rightGeometry: Geometry): any; + /** + * Indicates if one geometry touches another geometry. + * @param geometry1 The geometry which may be touching another geometry. + * @param geometry2 The geometry to be touched. + */ + touches(geometry1: Geometry, geometry2: Geometry): any; + /** + * All inputs must be of the same type of geometries and share one spatial reference. + * @param geometries The geometries to union. + */ + union(geometries: Geometry[]): any; + /** + * Indicates if one geometry is within another geometry. + * @param geometry1 The base geometry that is tested for within relationship to the other geometry. + * @param geometry2 The comparison geometry that is tested for the contains relationship to the other geometry. + */ + within(geometry1: Geometry, geometry2: Geometry): any; + }; + export = geometryEngineAsync; +} + +declare module "esri/geometry/jsonUtils" { + import Geometry = require("esri/geometry/Geometry"); + + /** Utility methods for working with JSON geometry objects. */ + var jsonUtils: { + /** + * Converts the input JSON object to the appropriate esri.geometry.* object. + * @param json The JSON object. + */ + fromJson(json: Object): Geometry; + /** + * Requests the geometry type name as represented in the ArcGIS REST. + * @param geometry The ArcGIS JavaScript API geometry type to be converted. + */ + getJsonType(geometry: Geometry): string; + }; + export = jsonUtils; +} + +declare module "esri/geometry/mathUtils" { + import Point = require("esri/geometry/Point"); + + /** Utility methods for getting length of a line segment or intersection of two segments. */ + var mathUtils: { + /** + * Calculates the length of a line based on the input of two points. + * @param point1 The beginning point. + * @param point2 The ending point. + */ + getLength(point1: Point, point2: Point): number; + /** + * Calculates the intersecting point of two lines. + * @param line1start The beginning point of the first line. + * @param line1end The ending point of the first line. + * @param line2start The beginning point of the second line. + * @param line2end The ending point of the second line. + */ + getLineIntersection(line1start: Point, line1end: Point, line2start: Point, line2end: Point): Point; + }; + export = mathUtils; +} + +declare module "esri/geometry/normalizeUtils" { + import Geometry = require("esri/geometry/Geometry"); + import GeometryService = require("esri/tasks/GeometryService"); + + /** Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the current coordinate system. */ + var normalizeUtils: { + /** + * Normalizes geometries that intersect the central meridian or fall outside the world extent so they stay within the current coordinate system. + * @param geometries An array of geometries to normalize. + * @param geometryService Specify a valid geometry service. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned, if an error occurs on the Server during task execution. + */ + normalizeCentralMeridian(geometries: Geometry[], geometryService?: GeometryService, callback?: Function, errback?: Function): any; + }; + export = normalizeUtils; +} + +declare module "esri/geometry/scaleUtils" { + import Map = require("esri/map"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + + /** Utility methods to get map scale or extent for a given scale. */ + var scaleUtils: { + /** + * Get the extent for the specified scale. + * @param map The input map. + * @param scale The input scale. + */ + getExtentForScale(map: Map, scale: number): Extent; + /** + * Gets the current scale of the map. + * @param map The map whose scale should be calculated. + */ + getScale(map: Map): number; + /** + * Returns the value of one map unit for the given spatial reference (in meters). + * @param sr The spatial reference represented as a SpatialReference class, Number, or String. + */ + getUnitValueForSR(sr: SpatialReference): number; + /** + * Returns the value of one map unit for the given spatial reference (in meters). + * @param sr The spatial reference represented as a SpatialReference class, Number, or String. + */ + getUnitValueForSR(sr: number): number; + /** + * Returns the value of one map unit for the given spatial reference (in meters). + * @param sr The spatial reference represented as a SpatialReference class, Number, or String. + */ + getUnitValueForSR(sr: string): number; + }; + export = scaleUtils; +} + +declare module "esri/geometry/screenUtils" { + import Extent = require("esri/geometry/Extent"); + import Geometry = require("esri/geometry/Geometry"); + import ScreenPoint = require("esri/geometry/ScreenPoint"); + import Point = require("esri/geometry/Point"); + + /** Convert map coordinates to screen coordinates and vice versa. */ + var screenUtils: { + /** + * Converts the geometry argument to map coordinates based on the extent, width, and height of the Map. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in map units. + * @param height The current width of the map in map units. + * @param screenGeometry The geometry to convert from screen to map units. + */ + toMapGeometry(extent: Extent, width: number, height: number, screenGeometry: Geometry): Geometry; + /** + * Converts and returns the argument screen point in map coordinates. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in screen units. + * @param height The current width of the map in screen units. + * @param screenPoint The screenPoint to convert from screen to map units. + */ + toMapPoint(extent: Extent, width: number, height: number, screenPoint: ScreenPoint): Point; + /** + * Converts the geometry argument to screen coordinates based on the extent, width, and height of the Map. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in screen units. + * @param height The current width of the map in screen units. + * @param mapGeometry The geometry to convert from map to screen units. + */ + toScreenGeometry(extent: Extent, width: number, height: number, mapGeometry: Geometry): Geometry; + /** + * Converts and returns the argument map point in screen coordinates. + * @param extent The current extent of the map in map coordinates. + * @param width The current width of the map in screen units. + * @param height The current width of the map in screen units. + * @param mapPoint The point to convert from map to screen units. + */ + toScreenPoint(extent: Extent, width: number, height: number, mapPoint: Point): ScreenPoint; + }; + export = screenUtils; +} + +declare module "esri/geometry/webMercatorUtils" { + import SpatialReference = require("esri/SpatialReference"); + import Geometry = require("esri/geometry/Geometry"); + + /** Convert Web Mercator coordinates to geographic and vice versa. */ + var webMercatorUtils: { + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: SpatialReference, target: any): boolean; + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: any, target: SpatialReference): boolean; + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: SpatialReference, target: SpatialReference): boolean; + /** + * Returns true if the 'source' can be projected to 'target' by the project() function, or if the 'source' and 'target' is the same spatialReference. + * @param source An input of type SpatialReference or an object with spatialReference property such as Geometry or Map. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + canProject(source: any, target: any): boolean; + /** + * Converts geometry from geographic units to Web Mercator units. + * @param geometry The geometry to convert. + */ + geographicToWebMercator(geometry: Geometry): Geometry; + /** + * Translates the given latitude and longitude values to Web Mercator. + * @param long The longitude value to convert. + * @param lat The latitude value to convert. + */ + lngLatToXY(long: number, lat: number): number[]; + /** + * Project the geometry clientside (if possible). + * @param geometry An input geometry. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + project(geometry: Geometry, target: SpatialReference): any; + /** + * Project the geometry clientside (if possible). + * @param geometry An input geometry. + * @param target The target spatial reference, of type SpatialReference or an object with spatialReference property such as Map. + */ + project(geometry: Geometry, target: any): any; + /** + * Converts geometry from Web Mercator units to geographic units. + * @param geometry The geometry to convert. + */ + webMercatorToGeographic(geometry: Geometry): Geometry; + /** + * Translates the given Web Mercator coordinates to Longitude and Latitude. + * @param x The x coordinate value to convert. + * @param y The y coordinate value to convert. + */ + xyToLngLat(x: number, y: number): number[]; + }; + export = webMercatorUtils; +} + +declare module "esri/graphic" { + import Geometry = require("esri/geometry/Geometry"); + import InfoTemplate = require("esri/InfoTemplate"); + import Symbol = require("esri/symbols/Symbol"); + import Layer = require("esri/layers/layer"); + + /** A Graphic can contain geometry, a symbol, attributes, or an infoTemplate. */ + class Graphic { + /** Name value pairs of fields and field values associated with the graphic. */ + attributes: any; + /** The geometry that defines the graphic. */ + geometry: Geometry; + /** The content for display in an InfoWindow. */ + infoTemplate: InfoTemplate; + /** The symbol for the graphic. */ + symbol: Symbol; + /** Indicate the visibility of the graphic. */ + visible: boolean; + /** + * Creates a new Graphic object. + * @param geometry The geometry that defines the graphic. + * @param symbol Symbol used for drawing the graphic. + * @param attributes Name value pairs of fields and field values associated with the graphic. + * @param infoTemplate The content for display in an InfoWindow. + */ + constructor(geometry?: Geometry, symbol?: Symbol, attributes?: any, infoTemplate?: InfoTemplate); + /** + * Creates a new Graphic object using a JSON object. + * @param json JSON object representing the graphic. + */ + constructor(json: Object); + /** + * Adds a new attribute or changes the value of an existing attribute on the graphic's node. + * @param name The name of the attribute. + * @param value The value of the attribute. + */ + attr(name: string, value: string): Graphic; + /** Draws the graphic. */ + draw(): Graphic; + /** Returns the content string based on attributes and infoTemplate values. */ + getContent(): string; + /** Returns the dojo/gfx/shape.Shape of the Esri graphic. */ + getDojoShape(): any; + /** Returns the info template associated with the graphic. */ + getInfoTemplate(): InfoTemplate; + /** Returns a reference to the associated layer. */ + getLayer(): Layer; + /** Returns the DOM node used to draw the graphic. */ + getNode(): any; + /** Returns one or more DOM nodes used to draw the graphic. */ + getNodes(): any; + /** Returns the dojox/gfx/shape.Shape of the Esri graphic. */ + getShape(): any; + /** Returns one or more dojox/gfx/shape.Shape used to draw the graphic. */ + getShapes(): any[]; + /** Returns the title string based on attributes and infoTemplate values. */ + getTitle(): string; + /** Hides the graphic. */ + hide(): void; + /** + * Defines the attributes of the graphic. + * @param attributes The name value pairs of fields and field values associated with the graphic. + */ + setAttributes(attributes: any): Graphic; + /** + * Defines the geometry of the graphic. + * @param geometry The geometry that defines the graphic. + */ + setGeometry(geometry: Geometry): Graphic; + /** + * Defines the InfoTemplate for the InfoWindow of the graphic. + * @param infoTemplate The content for display in an InfoWindow. + */ + setInfoTemplate(infoTemplate: InfoTemplate): Graphic; + /** + * Sets the symbol of the graphic. + * @param symbol The symbol for the graphic. + */ + setSymbol(symbol: Symbol): Graphic; + /** Shows the graphic. */ + show(): void; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Graphic; +} + +declare module "esri/graphicsUtils" { + import Graphic = require("esri/graphic"); + import Geometry = require("esri/geometry/Geometry"); + import Extent = require("esri/geometry/Extent"); + + /** Utility methods for working with graphics. */ + var graphicsUtils: { + /** + * Converts an array of graphics to an array of geometries. + * @param graphics Array of graphics to convert to geometries + */ + getGeometries(graphics: Graphic[]): Geometry[]; + /** + * Utility function that returns the extent of an array of graphics. + * @param graphics The input graphics array. + */ + graphicsExtent(graphics: Graphic[]): Extent; + }; + export = graphicsUtils; +} + +declare module "esri/kernel" { + /** Utility methods for retrieving API version. */ + var kernel: { + /** Current version of the JavaScript API. */ + version: string; + }; + export = kernel; +} + +declare module "esri/lang" { + /** Utility methods for working with strings, arrays and objects. */ + var lang: { + /** + * Creates a new object with all properties that pass the test implemented by the filter provided in the function. + * @param object Object to filter. + * @param callback Function or string implementing the filtering. + * @param thisObject Optional object used to scope the call to the callback. + */ + filter(object: any, callback: Function, thisObject: any): any; + /** + * Returns true when the value is neither null or undefined. + * @param value The value to test. + */ + isDefined(value: any): boolean; + /** + * Strips HTML tags from a String or Object. + * @param value Object or String to be stripped of HTML tags. + */ + stripTags(value: any): any; + /** + * Strips HTML tags from a String or Object. + * @param value Object or String to be stripped of HTML tags. + */ + stripTags(value: string): any; + /** + * A wrapper around dojo.string.substitute that can also handle wildcard substitution. + * @param data The data object used in the substitution. + * @param template The template used for the substitution. + * @param first When true, returns only the first property found in the data object. + */ + substitute(data: any, template?: string, first?: boolean): string; + /** + * Iterates through the argument array and searches for the identifier to which the argument value matches. + * @param array The argument array for testing. + * @param value The value used in the search. + */ + valueOf(array: any[], value: any): any; + }; + export = lang; +} + +declare module "esri/layers/ArcGISDynamicMapServiceLayer" { + import esri = require("esri"); + import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer"); + import DynamicLayerInfo = require("esri/layers/DynamicLayerInfo"); + import LayerDrawingOptions = require("esri/layers/LayerDrawingOptions"); + import LayerInfo = require("esri/layers/LayerInfo"); + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import TimeInfo = require("esri/layers/TimeInfo"); + import ImageParameters = require("esri/layers/ImageParameters"); + import MapImage = require("esri/layers/MapImage"); + + /** Allows you to work with a dynamic map service resource exposed by the ArcGIS Server REST API. */ + class ArcGISDynamicMapServiceLayer extends DynamicMapServiceLayer { + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** Capabilities of the map service, possible values are Map, Query and Data. */ + capabilities: string; + /** Copyright string as defined by the map service. */ + copyright: string; + /** Map description as defined by the map service. */ + description: string; + /** When true, images are always requested from the server and the browser's cache is ignored. */ + disableClientCaching: boolean; + /** The output dpi of the dynamic map service layer. */ + dpi: number; + /** Array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ + dynamicLayerInfos: DynamicLayerInfo[]; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** The output image type. */ + imageFormat: string; + /** Whether or not background of dynamic image is transparent. */ + imageTransparency: boolean; + /** A dictionary from the layer id to the layerInfoTemplateOptions object. */ + infoTemplates: any; + /** Sets the layer definitions used to filter the features of individual layers in the map service. */ + layerDefinitions: string[]; + /** Array of LayerDrawingOptions used to override the way layers are drawn. */ + layerDrawingOptions: LayerDrawingOptions[]; + /** Returns the available layers in service and their default visibility. */ + layerInfos: LayerInfo[]; + /** Returns the current layer time options if applicable. */ + layerTimeOptions: LayerTimeOptions[]; + /** The maximum image height, in pixels, that the map service will export. */ + maxImageHeight: number; + /** The maximum image width, in pixels, that the map service will export. */ + maxImageWidth: number; + /** The maximum number of results that can be returned from query, identify and find operations. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** Indicates if the service supports dynamic layers. */ + supportsDynamicLayers: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** Temporal information for the layer, such as time extent. */ + timeInfo: TimeInfo; + /** Default units of the layer as defined by the service. */ + units: string; + /** When true, the image is saved to the server, and a JSON formatted response is sent to the client with the URL location of the image. */ + useMapImage: boolean; + /** The version of ArcGIS Server where the map service is published. */ + version: number; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** Gets the visible layers of the exported map. */ + visibleLayers: number[]; + /** + * Creates a new ArcGISDynamicMapServiceLayer object. + * @param url URL to the ArcGIS Server REST resource that represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISDynamicMapServiceLayerOptions); + /** Create an array of DynamicLayerInfos based on the current set of LayerInfo. */ + createDynamicLayerInfosFromLayerInfos(): DynamicLayerInfo[]; + /** + * Exports a map using values as specified by ImageParameters. + * @param imageParameters Input parameters assigned before exporting the map image. + * @param callback The function to call when the method has completed. + */ + exportMapImage(imageParameters?: ImageParameters, callback?: Function): void; + /** Asynchronously returns custom data for the layer when available. */ + getAttributionData(): any; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** Resumes layer drawing. */ + resume(): void; + /** + * Resets all layer definitions to those defined in the service. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setDefaultLayerDefinitions(doNotRefresh?: boolean): void; + /** + * Clears the visible layers as defined in setVisibleLayers, and resets to the default layers of the map service. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setDefaultVisibleLayers(doNotRefresh?: boolean): void; + /** + * Sets whether images are always requested from the server and the browser's cache is ignored. + * @param disable When true, client side caching is disabled. + */ + setDisableClientCaching(disable: boolean): void; + /** + * Sets the dpi of the exported map. + * @param dpi DPI value. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setDPI(dpi: number, doNotRefresh?: boolean): void; + /** + * Specify an array of DynamicLayerInfos used to change the layer ordering or to redefine the map. + * @param dynamicLayerInfos An array of dynamic layer infos. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setDynamicLayerInfos(dynamicLayerInfos: DynamicLayerInfo[], doNotRefresh?: boolean): void; + /** + * Set the version for the ArcGIS DynamicMapServiceLayer. + * @param gdbVersion The name of the version to display. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setGDBVersion(gdbVersion: string, doNotRefresh?: boolean): void; + /** + * Sets the image format of the exported map. + * @param imageFormat Valid values are png | png8 | png24 | png32 | jpg | pdf | bmp | gif | svg. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Sets the background of a dynamic image to transparent. + * @param transparent Valid values are true | false. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setImageTransparency(transparent: boolean, doNotRefresh?: boolean): void; + /** + * Set the infoTemplates property. + * @param infoTemplates infoTemplates object. + */ + setInfoTemplates(infoTemplates: any): void; + /** + * Sets the layer definitions used to filter the features of individual layers in the map service. + * @param layerDefinitions An array containing each layer's definition. + * @param doNotRefresh Added at version 2.2 When true the layer will not refresh the map image. + */ + setLayerDefinitions(layerDefinitions: string[], doNotRefresh?: boolean): void; + /** + * Specify an array of LayerDrawingOptions that override the way the layers are drawn. + * @param layerDrawingOptions An array of layer drawing options. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setLayerDrawingOptions(layerDrawingOptions: LayerDrawingOptions[], doNotRefresh?: boolean): void; + /** + * Sets the time-related options for the layer. + * @param options Array of LayerTimeOptions objects that allow you to override how a layer is exported in reference to the map's time extent. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setLayerTimeOptions(options: LayerTimeOptions[], doNotRefresh?: boolean): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale at which the layer is visible. + * @param maxScale The maximum scale at which the layer is visible. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** + * Determine if the layer will update its content based on the map's current time extent. + * @param update When false the layer will not update its content based on the map's time extent. + */ + setUseMapTime(update: boolean): void; + /** + * Sets the visible layers of the exported map. + * @param ids Array of layer IDs. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setVisibleLayers(ids: number[], doNotRefresh?: boolean): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Fired when the geodatabase version is switched. */ + on(type: "gdb-version-change", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when the map export is completed. */ + on(type: "map-image-export", listener: (event: { mapImage: MapImage; target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + /** Fires when the visibleLayers property is changed. */ + on(type: "visible-layers-change", listener: (event: { visibleLayers: number[]; target: ArcGISDynamicMapServiceLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ArcGISDynamicMapServiceLayer; +} + +declare module "esri/layers/ArcGISImageServiceLayer" { + import esri = require("esri"); + import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer"); + import MosaicRule = require("esri/layers/MosaicRule"); + import InfoTemplate = require("esri/InfoTemplate"); + import RasterFunction = require("esri/layers/RasterFunction"); + import TimeInfo = require("esri/layers/TimeInfo"); + import ImageServiceParameters = require("esri/layers/ImageServiceParameters"); + import Graphic = require("esri/graphic"); + import Query = require("esri/tasks/query"); + import MapImage = require("esri/layers/MapImage"); + + /** Allows you to work with an image map service resource exposed by the ArcGIS Server REST API. */ + class ArcGISImageServiceLayer extends DynamicMapServiceLayer { + /** Number of bands in ArcGISImageServiceLayer. */ + bandCount: number; + /** Array of current band selections. */ + bandIds: number[]; + /** The raster bands that the raster dataset is composed of and their statistics. */ + bands: any[]; + /** Current compression quality value. */ + compressionQuality: number; + /** Copyright string as defined by the image service. */ + copyrightText: string; + /** Returns a MosaicRule object that defines the default mosaic properties published by the image service. */ + defaultMosaicRule: MosaicRule; + /** Description as defined by the image service. */ + description: string; + /** When true, images are always requested from the server and the browser's cache is ignored. */ + disableClientCaching: boolean; + /** The output image type. */ + format: string; + /** The template that defines the content to display in the map info window when the user clicks on a raster. */ + infoTemplate: InfoTemplate; + /** Current interpolation method. */ + interpolation: string; + /** The maximum image height, in pixels, that the map service will export. */ + maxImageHeight: number; + /** The maximum image width, in pixels, that the map service will export. */ + maxImageWidgth: number; + /** The maximum number of results that can be returned from query, identify and find operations. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** Specifies the mosaic rule when defining how individual images should be mosaicked. */ + mosaicRule: MosaicRule; + /** Size of pixel in X direction. */ + pixelSizeX: number; + /** Size of pixel in Y direction. */ + pixelSizeY: number; + /** The pixel type of the image service. */ + pixelType: number; + /** Specifies the rendering rule for how the requested image should be rendered. */ + renderingRule: RasterFunction; + /** Temporal information for the layer, such as time extent. */ + timeInfo: TimeInfo; + /** By default, images are exported in MIME format, and the image is streamed to the client. */ + useMapImage: boolean; + /** The version of ArcGIS Server the image service is published to, e.g. */ + version: number; + /** + * Creates a new ArcGISImageServiceLayer object. + * @param url URL to the ArcGIS Server REST resource that represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISImageServiceLayerOptions); + /** + * Exports a map using values as specified by ImageServiceParameters. + * @param imageServiceParameters Input parameters assigned before exporting the map image. + * @param callback The function to call when the method has completed. + */ + exportMapImage(imageServiceParameters?: ImageServiceParameters, callback?: Function): void; + /** Returns the current definition expression. */ + getDefinitionExpression(): string; + /** Get key properties of an ImageService including information such as the band names associated with the imagery. */ + getKeyProperties(): any; + /** Asynchronously returns the raster attribute table of an ImageService which returns categorical mapping of pixel values (e.g. */ + getRasterAttributeTable(): any; + /** Gets the currently visible rasters. */ + getVisibleRasters(): Graphic[]; + /** + * Returns the rasters that are visible in the area defined by the geometry (required to be point or polygon) in the query parameter. + * @param query The esri.tasks.Query to be passed as the input to query visible rasters. + * @param options Options for query. + * @param callback The function to call when the method has completed. + * @param errback The function to call when an error occurs. + */ + queryVisibleRasters(query: Query, options?: any, callback?: Function, errback?: string): void; + /** + * Sets the R,G,B of the exported image to the appropriate ImageService Band ID. + * @param bandIds Array of band IDs to use in the exported image. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setBandIds(bandIds: number[], doNotRefresh?: boolean): void; + /** + * Sets the compression quality of the exported image. + * @param quality A value from 0 to 100. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setCompressionQuality(quality: number, doNotRefresh?: boolean): void; + /** + * Sets the definition expression for the ImageService Layer. + * @param expression The definition expression to be set. + * @param doNotRefresh Whether or not the expression definition will be refreshed. + */ + setDefinitionExpression(expression: string, doNotRefresh: boolean): void; + /** + * Sets whether images are always requested from the server and the browser's cache is ignored. + * @param disable When true, browser client side caching is disabled. + */ + setDisableClientCaching(disable: boolean): void; + /** + * Set the image format. + * @param imageFormat Valid values are png | png8 | png24 | jpg | pdf | bmp | gif | svg. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Specify or change the info template for a layer. + * @param infoTemplate The content for display in an InfoWindow. + */ + setInfoTemplate(infoTemplate: InfoTemplate): void; + /** + * Sets the interpolation method. + * @param interpolation Interpolation value defined in ImageServiceParameters Constants Table. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setInterpolation(interpolation: string, doNotRefresh?: boolean): void; + /** + * Sets the mosaic rule of the layer to the specified value. + * @param mosaicRule The mosaic rule. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setMosaicRule(mosaicRule: MosaicRule, doNotRefresh?: boolean): void; + /** + * Sets the rendering rule of the layer to the given value. + * @param renderingRule The new rendering rule. + * @param doNotRefresh When true the layer will not refresh the map image. + */ + setRenderingRule(renderingRule: RasterFunction, doNotRefresh?: boolean): void; + /** + * Determine if the layer will update its content based on the map's current time extent. + * @param update When false the layer will not update its content based on the map's time extent. + */ + setUseMapTime(update: boolean): void; + /** Fires when the map export is completed. */ + on(type: "map-image-export", listener: (event: { mapImage: MapImage; target: ArcGISImageServiceLayer }) => void): esri.Handle; + /** Fired when the layers mosaic rule is changed. */ + on(type: "mosaic-rule-change", listener: (event: { target: ArcGISImageServiceLayer }) => void): esri.Handle; + /** Fired when the layers band ids are changed or if a raster function is applied. */ + on(type: "rendering-change", listener: (event: { target: ArcGISImageServiceLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ArcGISImageServiceLayer; +} + +declare module "esri/layers/ArcGISImageServiceVectorLayer" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import Renderer = require("esri/renderers/Renderer"); + + /** The ArcGISImageServiceVectorLayer displays pixel values as vectors. */ + class ArcGISImageServiceVectorLayer extends GraphicsLayer { + /** + * Creates a new ArcGISImageServiceLayer object. + * @param url URL to the ArcGIS Server REST resource that represents an image service vector layer service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISImageServiceVectorLayerOptions); + /** Returns the flow direction of the data as determined by the service via key properties. */ + getFlowRepresentation(): string; + /** + * Sets the renderer for the layer. + * @param renderer The renderer object to apply to the layer. + */ + setRenderer(renderer: Renderer): void; + /** + * Enables the layer to update its content based on the map's current time extent. + * @param update A value of true allows the layer to use the map's time extent to update layer content. + */ + setUseMapTime(update: boolean): void; + /** + * Set the default renderer from a list of predefined options. + * @param style The default renderer. + */ + setVectorRendererStyle(style: string): void; + } + export = ArcGISImageServiceVectorLayer; +} + +declare module "esri/layers/ArcGISTiledMapServiceLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + import LayerInfo = require("esri/layers/LayerInfo"); + import TimeInfo = require("esri/layers/TimeInfo"); + + /** Allows you to work with a cached map service resource exposed by the ArcGIS Server REST API. */ + class ArcGISTiledMapServiceLayer extends TiledMapServiceLayer { + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** Capabilities of the map service, possible values are Map, Query and Data. */ + capabilities: string; + /** Copyright string as defined by the map service. */ + copyright: string; + /** Map description as defined by the map service. */ + description: string; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** A dictionary from the layer id to the layerInfoTemplateOptions object. */ + infoTemplates: any; + /** Returns the available layers in service and their default visibility. */ + layerInfos: LayerInfo[]; + /** The maximum image height, in pixels, that the map service will export. */ + maxImageHeight: number; + /** The maximum image width, in pixels, that the map service will export. */ + maxImageWidth: number; + /** The maximum number of results that can be returned from query, identify and find operations. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** Temporal information for the layer, such as time extent. */ + timeInfo: TimeInfo; + /** Default units of the layer as defined by the service. */ + units: string; + /** The version of ArcGIS Server where the map service is published. */ + version: number; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** + * Creates a new ArcGISTiledMapServiceLayer object. + * @param url URL to the ArcGIS Server REST resource at represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.ArcGISTiledMapServiceLayerOptions); + /** Asynchronously returns custom data for the layer when available. */ + getAttributionData(): any; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** Resumes layer drawing. */ + resume(): void; + /** + * Set the infoTemplates property. + * @param infoTemplates infoTemplates object. + */ + setInfoTemplates(infoTemplates: any): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale at which the layer is visible. + * @param maxScale The maximum scale at which the layer is visible. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: ArcGISTiledMapServiceLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ArcGISTiledMapServiceLayer; +} + +declare module "esri/layers/CSVLayer" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** CSVLayer extends FeatureLayer to create a point layer based on a CSV file (.csv, .txt). */ + class CSVLayer extends FeatureLayer { + /** The column delimiter. */ + columnDelimiter: string; + /** The latitude field name. */ + latitudeFieldName: string; + /** The longitude field name. */ + longitudeFieldName: string; + /** The url to a CSV resource. */ + url: string; + /** + * Creates a CSV layer. + * @param url URL to a CSV resource. + * @param options Optional parameters used to create the layer. + */ + constructor(url: string, options?: esri.CSVLayerOptions); + } + export = CSVLayer; +} + +declare module "esri/layers/CodedValueDomain" { + import Domain = require("esri/layers/Domain"); + + /** Information about the coded values belonging to the domain. */ + class CodedValueDomain extends Domain { + /** An array of the coded values in the domain. */ + codedValues: any[]; + /** + * Returns the name of the coded-value associated with the specified code. + * @param code The code in which you wish to search for the name. + */ + getName(code: number): string; + /** + * Returns the name of the coded-value associated with the specified code. + * @param code The code in which you wish to search for the name. + */ + getName(code: string): string; + } + export = CodedValueDomain; +} + +declare module "esri/layers/DataAdapterFeatureLayer" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + + /** (Beta at v3.12) Display features using data that contains location information such as X and Y coordinates, Street address, place names etc using a DataAdapter object to retrieve the features and a LocationProvider to generate their geometries. */ + class DataAdapterFeatureLayer extends FeatureLayer { + /** The DataAdapter object points to data sources that contain non-spatial tables. */ + dataAdapter: any; + /** The query parameters to use for the DataAdapter. */ + dataAdapterQuery: any; + /** List of attribute fields added as custom data attributes to graphics node. */ + dataAttributes: string[]; + /** An instance of the Location Provider class. */ + locationProvider: LocationProviderBase; + /** + * Creates a DataAdapterFeatureLayer. + * @param dataAdapter The DataAdapter object. + * @param options Optional parameters used to create the layer. + */ + constructor(dataAdapter: any, options: esri.DataAdapterFeatureLayerOptions); + } + export = DataAdapterFeatureLayer; +} + +declare module "esri/layers/DataSource" { + /** Used to denote classes that may be used as a data source. */ + class DataSource { + /** + * Creates a new DataSource object. + * @param json JSON object representing the DataSource. + */ + constructor(json?: Object); + } + export = DataSource; +} + +declare module "esri/layers/DimensionalDefinition" { + /** A dimensional definition defines a filter based on one variable and one dimension. */ + class DimensionalDefinition { + /** (Optional) The dimension associated with the variable. */ + dimensionName: string; + /** Indicates whether the values indicate slices (rather than ranges). */ + isSlice: boolean; + /** An array of tuples (min, max) each defining a range of valid values along the specified dimension. */ + values: any[]; + /** The variable name by which to filter. */ + variableName: string; + /** + * Create a new dimensional definition object from an existing json object. + * @param json The REST JSON representation for Dimensional Definition. + */ + constructor(json: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = DimensionalDefinition; +} + +declare module "esri/layers/Domain" { + /** Domains define constraints on a layer field. */ + class Domain { + /** The domain name. */ + name: string; + /** The domain type. */ + type: string; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Domain; +} + +declare module "esri/layers/DynamicLayerInfo" { + import LayerInfo = require("esri/layers/LayerInfo"); + import LayerSource = require("esri/layers/LayerSource"); + + /** Information about each layer in a map service. */ + class DynamicLayerInfo extends LayerInfo { + /** Default visibility of the layers in the map service. */ + defaultVisibility: boolean; + /** Layer ID assigned by ArcGIS Server for a layer. */ + id: number; + /** The maximum visible scale for each layer in the map service. */ + maxScale: number; + /** The minimum visible scale for each layer in the map service. */ + minScale: number; + /** Layer name as defined in the map service. */ + name: string; + /** If the layer is part of a group layer, it will include the parent ID of the group layer. */ + parentLayerId: number; + /** The source for the dynamic layer can be either a LayerMapSource or LayerDataSource. */ + source: LayerSource; + /** If the layer is a parent layer, it will have one or more sub layers included in an array. */ + subLayerIds: number[]; + /** + * Creates a new DynamicLayerInfo object. + * @param json JSON object representing the DynamicLayerInfo. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = DynamicLayerInfo; +} + +declare module "esri/layers/DynamicMapServiceLayer" { + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + + /** The base class for ArcGIS Server dynamic map services. */ + class DynamicMapServiceLayer extends Layer { + /** Full extent as defined by the map service. */ + fullExtent: Extent; + /** Initial extent as defined by the map service. */ + initialExtent: Extent; + /** The spatial reference of the map service. */ + spatialReference: SpatialReference; + /** + * Method to implement when extending DynamicMapServiceLayer. + * @param extent Current extent of the map. + * @param width Current width of the map in pixels. + * @param height Current height of the map in pixels. + * @param callback The function to call when the method has completed. + */ + getImageUrl(extent: Extent, width: number, height: number, callback: Function): string; + /** Refreshes the map by making a new request to the server. */ + refresh(): void; + } + export = DynamicMapServiceLayer; +} + +declare module "esri/layers/FeatureEditResult" { + /** The results of a feature edit such as add, update or delete. */ + class FeatureEditResult { + /** Unique ID of the attachment. */ + attachmentId: number; + /** Information about errors that occur if the edit operation failed. */ + error: Error; + /** Unique ID of the feature or object. */ + objectId: number; + /** If true the operation was successful. */ + success: boolean; + } + export = FeatureEditResult; +} + +declare module "esri/layers/FeatureLayer" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import Field = require("esri/layers/Field"); + import Extent = require("esri/geometry/Extent"); + import Graphic = require("esri/graphic"); + import LabelClass = require("esri/layers/LabelClass"); + import Renderer = require("esri/renderers/Renderer"); + import LayerSource = require("esri/layers/LayerSource"); + import FeatureTemplate = require("esri/layers/FeatureTemplate"); + import TimeInfo = require("esri/layers/TimeInfo"); + import FeatureType = require("esri/layers/FeatureType"); + import Domain = require("esri/layers/Domain"); + import Symbol = require("esri/symbols/Symbol"); + import TimeExtent = require("esri/TimeExtent"); + import Query = require("esri/tasks/query"); + import RelationshipQuery = require("esri/tasks/RelationshipQuery"); + import InfoTemplate = require("esri/InfoTemplate"); + import FeatureEditResult = require("esri/layers/FeatureEditResult"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** The feature layer inherits from the graphics layer and can be used to display features from a single layer in either a Map Service or Feature Service. */ + class FeatureLayer extends GraphicsLayer { + /** Delegate to either on-demand or snapshot mode depending on the characteristics of the service. */ + static MODE_AUTO: any; + /** In on-demand mode, the feature layer retrieves features from the server when needed. */ + static MODE_ONDEMAND: any; + /** In selection mode, features are retrieved from the server only when they are selected. */ + static MODE_SELECTION: any; + /** In snapshot mode, the feature layer retrieves all the features from the associated layer resource and displays them as graphics on the client. */ + static MODE_SNAPSHOT: any; + /** The popup displays content in HTML/TEXT. */ + static POPUP_HTML_TEXT: any; + /** No popup type defined. */ + static POPUP_NONE: any; + /** The popup displays the contents of a URL. */ + static POPUP_URL: any; + /** Adds features to the current selection set. */ + static SELECTION_ADD: any; + /** Creates a new selection. */ + static SELECTION_NEW: any; + /** Removes features from the current selection. */ + static SELECTION_SUBTRACT: any; + /** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */ + advancedQueryCapabilities: any; + /** Returns true if the geometry of the features in the layer can be edited, false otherwise. */ + allowGeometryUpdates: boolean; + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** Information about the capabilities enabled for this layer. */ + capabilities: string; + /** Copyright information for the layer. */ + copyright: string; + /** Metadata describing the default definition expression for the layer as defined by the service. */ + defaultDefinitionExpression: string; + /** Indicates the default visibility for the layer. */ + defaultVisibility: boolean; + /** The description of the layer as defined in the map service. */ + description: string; + /** The name of the layer's primary display field. */ + displayField: string; + /** Indicates the field names for the editor fields. */ + editFieldsInfo: any; + /** The array of fields in the layer. */ + fields: Field[]; + /** The full extent of the layer. */ + fullExtent: Extent; + /** Geometry type of the features in the layer. */ + geometryType: string; + /** The globalIdField for the layer. */ + globalIdField: string; + /** Array of features in the layer. */ + graphics: Graphic[]; + /** True if attachments are enabled on the feature layer. */ + hasAttachments: boolean; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** The html popup type defined for the layer. */ + htmlPopupType: string; + /** Label definition for this layer, specified as an array of label classes. */ + labelingInfo: LabelClass[]; + /** Unique ID of the layer that the FeatureLayer was constructed against. */ + layerId: number; + /** The maximum number of results that will be returned from a query. */ + maxRecordCount: number; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** Supports feature services whose data source is a multipatch featureclass. */ + multipatchOption: string; + /** The name of the layer as defined in the map service. */ + name: string; + /** The name of the field that contains the Object ID field for the layer. */ + objectIdField: string; + /** Indicates the ownership access control configuration. */ + ownershipBasedAccessControlForFeatures: any; + /** Each element in the array is an object that describes the layer's relationship with another layer or table. */ + relationships: any[]; + /** The renderer for the layer. */ + renderer: Renderer; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** Determines if labels are displayed. */ + showLabels: boolean; + /** The dynamic layer or table source. */ + source: LayerSource; + /** When true, the layer supports orderByFields in a query operation. */ + supportsAdvancedQueries: boolean; + /** When true, the layer supports uploading attachments with Uploads REST operation, which then can be used in the Add Attachment or Update Attachment REST operations. */ + supportsAttachmentsByUploadId: boolean; + /** When true, the layer supports the Calculate REST operation when updating features. */ + supportsCalculate: boolean; + /** When true, the layer supports statistical functions in query operations. */ + supportsStatistics: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** An array of feature templates defined in the Feature Service layer. */ + templates: FeatureTemplate[]; + /** Time information for the layer, such as start time field, end time field, track id field, layers time extent and the draw time interval. */ + timeInfo: TimeInfo; + /** Specifies the type of layer. */ + type: string; + /** The field that represents the Type ID field. */ + typeIdField: string; + /** An array of sub types defined in the Feature Service layer. */ + types: FeatureType[]; + /** The version of ArcGIS Server where the layer is published. */ + version: number; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** + * Creates a new instance of a feature layer object from the ArcGIS Server REST resource identified by the input URL. + * @param url URL to the ArcGIS Server REST resource that represents a feature service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.FeatureLayerOptions); + /** + * Creates a new instance of a feature layer using a FeatureCollection object. + * @param featureCollectionObject A feature collection object. + * @param options Optional parameters. + */ + constructor(featureCollectionObject: any, options?: esri.FeatureLayerOptions); + /** + * Add an attachment to the feature specified by the ObjectId. + * @param objectId The ObjectId of the feature to which the attachment is added. + * @param formNode HTML form that contains a file upload field pointing to the file to be added as an attachment. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + addAttachment(objectId: number, formNode: HTMLFormElement, callback?: Function, errback?: Function): any; + /** + * Apply edits to the feature layer. + * @param adds Array of features to add to the layer in the feature service. + * @param updates Array of features whose geometry and/or attributes have changed. + * @param deletes Array of features to delete. + * @param callback This function will be called when the operation is complete. + * @param errback An error object is returned if an error occurs. + */ + applyEdits(adds?: Graphic[], updates?: Graphic[], deletes?: Graphic[], callback?: Function, errback?: Function): any; + /** Clears the current selection. */ + clearSelection(): FeatureLayer; + /** + * Delete one or more attachments for the feature specified by the input ObjectId. + * @param objectId The ObjectId of the feature from which the attachment is removed. + * @param attachmentIds The array of attachment ids to delete. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + deleteAttachments(objectId: number, attachmentIds: number[], callback?: Function, errback?: Function): any; + /** Asynchrously returns custom data for the layer when available. */ + getAttributionData(): any; + /** Returns the current definition expression. */ + getDefinitionExpression(): string; + /** + * Returns the Domain associated with the given field name. + * @param fieldName Name of the attribute field. + * @param options Please see the options object specification table below. + */ + getDomain(fieldName: string, options?: any): Domain; + /** + * Returns an object that describes the edit capabilities of the layer. + * @param options If the layer supports ownership based access control, use the options to determine if the specified user can edit features. + */ + getEditCapabilities(options?: any): any; + /** + * Returns an object describing the most recent edit operation performed on the given feature, if available. + * @param feature The feature to get the edit info for. + * @param options See the object specifications table below for the structure of the options object. + */ + getEditInfo(feature: Graphic, options?: any): any; + /** + * Returns a localized summary of the last edit operation performed on the given feature, if available. + * @param feature The feature to get the edit summary for. + * @param options See the object specifications table below for the structure of the options object. + */ + getEditSummary(feature: Graphic, options?: any): string; + /** + * Returns the Field given the specified field name. + * @param fieldName Name of the attribute field. + */ + getField(fieldName: string): Field; + /** Returns the current value of the maxAllowableOffset used by the layer. */ + getMaxAllowableOffset(): number; + /** Returns the list of fields used to order features by. */ + getOrderByFields(): string[]; + /** Gets the currently selected features. */ + getSelectedFeatures(): Graphic[]; + /** Gets the current selection symbol. */ + getSelectionSymbol(): Symbol; + /** Get the current time definition applied to the feature layer. */ + getTimeDefinition(): TimeExtent; + /** + * Returns a FeatureType describing the feature's type. + * @param feature A feature from this layer. + */ + getType(feature: Graphic): FeatureType; + /** Returns true if geometryType is esriGeometryMultipatch and multipatchOption is xyFootprint. */ + hasXYFootprint(): boolean; + /** Returns true if the FeatureLayer is editable. */ + isEditable(): boolean; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** + * Query for information about attachments associated with the specified ObjectIds. + * @param objectId The ObjectId for the feature to query for attachment information. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryAttachmentInfos(objectId: number, callback?: Function, errback?: Function): any; + /** + * Get a count of the number of features that satisfy the input query. + * @param query The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryCount(query: Query, callback?: Function, errback?: Function): any; + /** + * Get the extent of features that satisfy the input query. + * @param query The query definition. + * @param callback The function called when the method has completed. + * @param errback The function called when error occurred. + */ + queryExtent(query: Query, callback?: Function, errback?: Function): any; + /** + * Query features from the feature layer. + * @param query The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryFeatures(query: Query, callback?: Function, errback?: Function): any; + /** + * Query for ObjectIds. + * @param query The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryIds(query: Query, callback?: Function, errback?: Function): any; + /** + * Query features or records, from another layer or table, related to features in this layer. + * @param relQuery The input query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + queryRelatedFeatures(relQuery: RelationshipQuery, callback?: Function, errback?: Function): any; + /** Redraws all the graphics in the graphics layer. */ + redraw(): void; + /** Refreshes the features in the feature layer. */ + refresh(): void; + /** Resumes layer drawing. */ + resume(): void; + /** + * Selects features from the FeatureLayer. + * @param query The input query. + * @param selectionMethod The selection method defines how the rest of the selection is combined with the existing selection. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs. + */ + selectFeatures(query: Query, selectionMethod?: number, callback?: Function, errback?: Function): any; + /** + * Enable or disable auto generalization for the layer. + * @param enable When true, auto generalize is enabled. + */ + setAutoGeneralize(enable: boolean): FeatureLayer; + /** + * Set's the definition expression for the FeatureLayer. + * @param expression The definition expression to apply. + */ + setDefinitionExpression(expression: string): FeatureLayer; + /** + * Set the editability of feature layers created from a feature collection. + * @param editable When true, the layer will be set as editable. + */ + setEditable(editable: boolean): FeatureLayer; + /** + * Set the layer's data source to the specified geodatabase version. + * @param versionName The name of the geodatabase version to use as the layer's data source. + */ + setGDBVersion(versionName: string): FeatureLayer; + /** + * Specify or change the info template for a layer. + * @param infoTemplate The new info template. + */ + setInfoTemplate(infoTemplate: InfoTemplate): void; + /** + * Sets labeling info on the layer. + * @param labelingInfo This is the label definition for this layer, specified as an array of label classes. + */ + setLabelingInfo(labelingInfo: LabelClass[]): void; + /** + * Sets the maximum allowable offset used when generalizing geometries. + * @param offset The maximum allowable offset. + */ + setMaxAllowableOffset(offset: number): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Initial opacity or transparency of layer. + * @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. + */ + setOpacity(opacity: number): void; + /** + * Set the renderer for the feature layer. + * @param renderer The renderer to apply to the feature layer + */ + setRenderer(renderer: Renderer): void; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale for the layer. + * @param maxScale The maximum scale for the layer. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** + * Set's the selection symbol for the feature layer. + * @param symbol Symbol for the current selection. + */ + setSelectionSymbol(symbol: Symbol): FeatureLayer; + /** + * Sets whether to display labels or not. + * @param showLabels Set to true to show labels. + */ + setShowLabels(showLabels: boolean): void; + /** + * Set's the time definition for the feature layer. + * @param definition The new time extent used to filter the layer. + */ + setTimeDefinition(definition: TimeExtent): FeatureLayer; + /** + * Time offset allows you to display the features at a different time so they can be overlaid on top of previous or future time periods. + * @param offsetValue The length of time to offset from "this" time. + * @param offsetUnits Units in which the offset is specified. + */ + setTimeOffset(offsetValue: number, offsetUnits: string): FeatureLayer; + /** + * Determine if the layer will update its content based on the map's current time extent. + * @param update When false the layer will not update its content based on the map's time extent. + */ + setUseMapTime(update: boolean): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Returns an easily serializable object representation of the layer. */ + toJson(): any; + /** Fires when addAttachments() is complete. */ + on(type: "add-attachment-complete", listener: (event: { result: FeatureEditResult; target: FeatureLayer }) => void): esri.Handle; + /** Fired before edits are applied to the feature layer. */ + on(type: "before-apply-edits", listener: (event: { adds: Graphic[]; deletes: Graphic[]; updates: Graphic[]; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the capabilities of the layer are modified using the setEditable method. */ + on(type: "capabilities-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a feature has been double clicked. */ + on(type: "dbl-click", listener: (event: { event: any; target: FeatureLayer }) => void): esri.Handle; + /** Fires when deleteAttachments is complete. */ + on(type: "delete-attachments-complete", listener: (event: { results: any[]; target: FeatureLayer }) => void): esri.Handle; + /** Fires after applyEdits() is complete. */ + on(type: "edits-complete", listener: (event: { adds: FeatureEditResult[]; deletes: FeatureEditResult[]; updates: FeatureEditResult[]; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the geodatabase version is switched. */ + on(type: "gdb-version-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fired when labeling info on the layer changes. */ + on(type: "labeling-info-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryAttachmentInfos method is called. */ + on(type: "query-attachment-infos-complete", listener: (event: { info: any[]; target: FeatureLayer }) => void): esri.Handle; + /** Fires when the query for the count is complete. */ + on(type: "query-count-complete", listener: (event: { count: number; target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryExtent method has completed. */ + on(type: "query-extent-complete", listener: (event: { count: number; extent: Extent; target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryFeatures() is complete. */ + on(type: "query-features-complete", listener: (event: { featureSet: FeatureSet; target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryIds() is complete. */ + on(type: "query-ids-complete", listener: (event: { objectIds: number[]; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the feature layer could not draw all the features due to a maxRecordCount limitation on a query operation. */ + on(type: "query-limit-exceeded", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when queryRelatedFeatures() is complete. */ + on(type: "query-related-features-complete", listener: (event: { relatedFeatures: any; target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires after clearSelection has been called. */ + on(type: "selection-clear", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when selectFeatures() completes. */ + on(type: "selection-complete", listener: (event: { features: Graphic[]; method: number; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the feature layer's labels are changed. */ + on(type: "show-labels-change", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + /** Fired when the layer has finished updating its content. */ + on(type: "update-end", listener: (event: { error: Error; info: any; target: FeatureLayer }) => void): esri.Handle; + /** Fired when the layer begins to update its content. */ + on(type: "update-start", listener: (event: { target: FeatureLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FeatureLayer; +} + +declare module "esri/layers/FeatureTemplate" { + import Graphic = require("esri/graphic"); + + /** Feature templates define the information required to create a new feature. */ + class FeatureTemplate { + /** The default drawing tool specified for this template is the arrow tool. */ + static TOOL_ARROW: any; + /** The default drawing tool specified for this template is a auto complete polygon tool. */ + static TOOL_AUTO_COMPLETE_POLYGON: any; + /** The default drawing tool specified for this template is the circle tool. */ + static TOOL_CIRCLE: any; + /** The default drawing tool specified for this template is a ellipse tool. */ + static TOOL_ELLIPSE: any; + /** The default drawing tool specified for this template is the freehand tool. */ + static TOOL_FREEHAND: any; + /** The default drawing tool specified for this template is the line tool. */ + static TOOL_LINE: any; + /** No default tool is specified. */ + static TOOL_NONE: any; + /** The default drawing tool specified for this template is the point tool. */ + static TOOL_POINT: any; + /** The default drawing tool specified for this template is the polygon tool. */ + static TOOL_POLYGON: any; + /** The default drawing tool specified for this template is the rectangle. */ + static TOOL_RECTANGLE: any; + /** The default drawing tool specified for this template is the triangle. */ + static TOOL_TRIANGLE: any; + /** The description of the template. */ + description: string; + /** The default drawing tool defined for the template. */ + drawingTool: string; + /** The templates name. */ + name: string; + /** An instance of the prototypical feature described by the template. */ + prototype: Graphic; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = FeatureTemplate; +} + +declare module "esri/layers/FeatureType" { + import FeatureTemplate = require("esri/layers/FeatureTemplate"); + + /** A type defined by a feature layer. */ + class FeatureType { + /** Map of field names to domains. */ + domains: any; + /** The feature type identifier. */ + id: number; + /** The feature type name. */ + name: string; + /** Array of feature templates associated with this feature type. */ + templates: FeatureTemplate[]; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = FeatureType; +} + +declare module "esri/layers/Field" { + import Domain = require("esri/layers/Domain"); + + /** Information about each field in a layer. */ + class Field { + /** The alias name for the field. */ + alias: string; + /** Domain associated with the field. */ + domain: Domain; + /** Indicates whether the field is editable. */ + editable: boolean; + /** The field length */ + length: number; + /** The name of the field. */ + name: string; + /** Indicates if the field can accept null values. */ + nullable: boolean; + /** The data type of the field. */ + type: string; + } + export = Field; +} + +declare module "esri/layers/GeoRSSLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Graphic = require("esri/graphic"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** The GeoRSSLayer class is used to create a layer based on GeoRSS. */ + class GeoRSSLayer extends Layer { + /** The copyright information for the layer. */ + copyright: string; + /** The default visibility of the layer. */ + defaultVisibility: boolean; + /** The layer description. */ + description: string; + /** An array that contains all the graphics in the GeoRSSLayer. */ + items: Graphic[]; + /** The name of the layer. */ + name: string; + /** + * Creates a new GeoRSSLayer object. + * @param url URL to the GeoRSS resource. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.GeoRSSLayerOptions); + /** An array of feature layers for the GeoRSSLayer. */ + getFeatureLayers(): FeatureLayer[]; + /** Fires when the layer is refreshed. */ + on(type: "refresh", listener: (event: { target: GeoRSSLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GeoRSSLayer; +} + +declare module "esri/layers/GraphicsLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Graphic = require("esri/graphic"); + import InfoTemplate = require("esri/InfoTemplate"); + import Renderer = require("esri/renderers/Renderer"); + + /** A layer that contains one or more Graphic features. */ + class GraphicsLayer extends Layer { + /** List of attribute fields added as custom data attributes to graphics node. */ + dataAttributes: any; + /** The array of graphics that make up the layer. */ + graphics: Graphic[]; + /** The info template for the layer. */ + infoTemplate: InfoTemplate; + /** Renderer assigned to the GraphicsLayer. */ + renderer: Renderer; + /** Indicates whether the layer is responsible for styling graphics. */ + styling: boolean; + /** Type of vector graphics surface used to draw graphics. */ + surfaceType: string; + /** Creates a new GraphicsLayer object. */ + constructor(); + /** + * Creates a new GraphicsLayer object with parameters. + * @param options See options list for parameters. + */ + constructor(options?: esri.GraphicsLayerOptions); + /** + * Adds a graphic. + * @param graphic The graphic to add. + */ + add(graphic: Graphic): Graphic; + /** Clears all graphics. */ + clear(): void; + /** Disables all mouse events on the graphics layer. */ + disableMouseEvents(): void; + /** Enables all mouse events on the graphics layer. */ + enableMouseEvents(): void; + /** Redraws all the graphics in the layer. */ + redraw(): void; + /** + * Removes a graphic. + * @param graphic The graphic to remove. + */ + remove(graphic: Graphic): Graphic; + /** + * Specify or change the info template for a layer. + * @param infoTemplate The new info template. + */ + setInfoTemplate(infoTemplate: InfoTemplate): void; + /** + * Initial opacity or transparency of layer. + * @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. + */ + setOpacity(opacity: number): void; + /** + * Sets the renderer for the graphics layer. + * @param renderer The renderer used for the graphic. + */ + setRenderer(renderer: Renderer): void; + /** Fires when a graphic has been clicked. */ + on(type: "click", listener: (event: { event: any; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic has been double clicked. */ + on(type: "dbl-click", listener: (event: { target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic is added to the GraphicsLayer. */ + on(type: "graphic-add", listener: (event: { graphic: Graphic; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic is drawn. */ + on(type: "graphic-draw", listener: (event: { graphic: Graphic; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic's DOM node is created and added to the layer. */ + on(type: "graphic-node-add", listener: (event: { graphic: Graphic; node: HTMLElement; target: GraphicsLayer }) => void): esri.Handle; + /** This event is fired when a graphic's DOM node is removed (consider the node destroyed). */ + on(type: "graphic-node-remove", listener: (event: { graphic: Graphic; node: HTMLElement; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a graphic is removed from the GraphicsLayer. */ + on(type: "graphic-remove", listener: (event: { graphic: Graphic; target: GraphicsLayer }) => void): esri.Handle; + /** Fires when all graphics in the GraphicsLayer are cleared. */ + on(type: "graphics-clear", listener: (event: { target: GraphicsLayer }) => void): esri.Handle; + /** Fires when a mouse button is pressed down and the mouse cursor is on a graphic. */ + on(type: "mouse-down", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires while the mouse is being dragged until the mouse button is released. */ + on(type: "mouse-drag", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires as the mouse moves through a graphic on the GraphicsLayer. */ + on(type: "mouse-move", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires as the mouse exits a graphic on the GraphicsLayer. */ + on(type: "mouse-out", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse first enters into a graphic on the GraphicsLayer. */ + on(type: "mouse-over", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a mouse button is released and the mouse cursor is on a graphic. */ + on(type: "mouse-up", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GraphicsLayer; +} + +declare module "esri/layers/ImageParameters" { + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import TimeExtent = require("esri/TimeExtent"); + + /** Represents the image parameter options used when calling ArcGISDynamicMapServiceLayer.exportMapImage, Geoprocessor.getResultImage, and Geoprocessor.getResultImageLayer. */ + class ImageParameters { + /** Shows all layers visible by default except the specified layer ID's. */ + static LAYER_OPTION_EXCLUDE: any; + /** Shows all layers except the specified layer ID's. */ + static LAYER_OPTION_HIDE: any; + /** Shows specified layer ID's in addition to layers visible by default. */ + static LAYER_OPTION_INCLUDE: any; + /** Shows only the specified layer ID's. */ + static LAYER_OPTION_SHOW: any; + /** Extent of map to be exported. */ + bbox: Extent; + /** Dots per inch setting for an ArcGISDynamicMapServiceLayer. */ + dpi: number; + /** Map image format. */ + format: string; + /** Requested image height in pixels. */ + height: number; + /** Spatial reference of exported map. */ + imageSpatialReference: SpatialReference; + /** Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image. */ + layerDefinitions: string[]; + /** A list of layer ID's, that represent which layers to include in the exported map. */ + layerIds: number[]; + /** The option for displaying or hiding the layer. */ + layerOption: string; + /** Array of LayerTimeOptions objects that allow you to override how a layer is exported in reference to the map's time extent. */ + layerTimeOptions: LayerTimeOptions[]; + /** The time extent for the map image. */ + timeExtent: TimeExtent; + /** Whether or not background of dynamic image is transparent. */ + transparent: boolean; + /** Requested image width in pixels. */ + width: number; + /** Creates a new ImageParameters object. */ + constructor(); + } + export = ImageParameters; +} + +declare module "esri/layers/ImageServiceParameters" { + import Extent = require("esri/geometry/Extent"); + import MosaicRule = require("esri/layers/MosaicRule"); + import RasterFunction = require("esri/layers/RasterFunction"); + import TimeExtent = require("esri/TimeExtent"); + + /** Represents the image service parameter options used when calling ArcGISImageServiceLayer.exportMapImage. */ + class ImageServiceParameters { + /** Resamples pixel by bilinear interpolation. */ + static INTERPOLATION_BILINEAR: any; + /** Resamples pixel by cubic convolution. */ + static INTERPOLATION_CUBICCONVOLUTION: any; + /** Resamples pixel by majority value. */ + static INTERPOLATION_MAJORITY: any; + /** Resamples pixel by nearest neighbor. */ + static INTERPOLATION_NEARESTNEIGHBOR: any; + /** Array of current band selections. */ + bandIds: number[]; + /** Current compression quality value. */ + compressionQuality: number; + /** Extent of the exported image. */ + extent: Extent; + /** Map image format. */ + format: string; + /** Requested image height in pixels. */ + height: number; + /** Current interpolation method. */ + interpolation: string; + /** Specifies the mosaic rule when defining how individual images should be mosaicked. */ + mosaicRule: MosaicRule; + /** The pixel value that represents no information. */ + noData: number; + /** Specifies the rendering rule for how the requested image should be rendered. */ + renderingRule: RasterFunction; + /** Define the time extent for the image. */ + timeExtent: TimeExtent; + /** Requested image width in pixels. */ + width: number; + /** Creates a new ImageServiceParameters object. */ + constructor(); + } + export = ImageServiceParameters; +} + +declare module "esri/layers/InheritedDomain" { + import Domain = require("esri/layers/Domain"); + + /** This class is a subclass of esri/layers/Domain. */ + class InheritedDomain extends Domain { + } + export = InheritedDomain; +} + +declare module "esri/layers/JoinDataSource" { + import DataSource = require("esri/layers/DataSource"); + import LayerSource = require("esri/layers/LayerSource"); + + /** The JoinDataSource class defines and provides information about the result of a join operation. */ + class JoinDataSource extends DataSource { + /** The type of join that will be performed. */ + joinType: string; + /** The key field used for the left table source for the join. */ + leftTableKey: string; + /** The data source to be used as the left table for the join operation. */ + leftTableSource: LayerSource; + /** The key field used for the right table source for the join. */ + rightTableKey: string; + /** The data source to be used as the right table for the join operation. */ + rightTableSource: LayerSource; + /** + * Creates a new JoinDataSource object. + * @param json JSON object representing the JoinDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = JoinDataSource; +} + +declare module "esri/layers/KMLFolder" { + /** Defines information about a KML folder. */ + class KMLFolder { + /** The KML folder description. */ + description: string; + /** An array of objects that describe top-level KML features ids and their types. */ + featureInfos: any[]; + /** The KML folder id. */ + id: number; + /** The KML folder name. */ + name: string; + /** The id of the parent folder. */ + parentFolderId: number; + /** The KML folder snippet. */ + snippet: string; + /** An array of ids for the KML folder's subfolders. */ + subFolderIds: number[]; + /** The visibility of the KML folder. */ + visibility: number; + } + export = KMLFolder; +} + +declare module "esri/layers/KMLGroundOverlay" { + import Extent = require("esri/geometry/Extent"); + + /** The KMLGroundOverlay class provides details about a KML ground overlay. */ + class KMLGroundOverlay { + /** KML ground overlay description. */ + description: string; + /** Extent of image. */ + extent: Extent; + /** Requested image height in pixels. */ + height: number; + /** URL to returned image. */ + href: string; + /** The id of the KML ground overlay. */ + id: number; + /** The name of the KML ground overlay. */ + name: string; + /** Scale of requested dynamic map. */ + scale: number; + /** Short snippet describing the KML ground overlay. */ + snippet: string; + /** The KML ground overlay visibility. */ + visibility: number; + /** Requested image width in pixels. */ + width: number; + } + export = KMLGroundOverlay; +} + +declare module "esri/layers/KMLLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import KMLFolder = require("esri/layers/KMLFolder"); + + /** The KMLLayer class is used to create a layer based on a KML file (.kml, .kmz). */ + class KMLLayer extends Layer { + /** An array of objects that describe top-level KML features ids and their types. */ + featureInfos: any[]; + /** An array of KMLFolder objects that describe the folders and nested folders defined in the KML file. */ + folders: KMLFolder[]; + /** A link info object with properties that describe the network link. */ + linkInfo: any; + /** The publicly accessible URL for a .kml or .kmz file. */ + url: string; + /** + * Creates a new KMLLayer based upon the given URL. + * @param id Id to assign to the layer. + * @param url URL for a .kml or .kmz file. + * @param options Optional parameters. + */ + constructor(id: string, url: string, options?: esri.KMLLayerOptions); + /** + * Get the KML feature identified by the input feature info. + * @param featureInfo Feature info for the kml feature. + */ + getFeature(featureInfo: any): any; + /** Get an array of map layers that were created to draw placemarks, ground and screen overlays. */ + getLayers(): Layer[]; + /** + * Set the visibility for the specified folder. + * @param folder A KML folder. + * @param isVisible The visibility of the folder and all kml features within the folder. + */ + setFolderVisibility(folder: KMLFolder, isVisible: boolean): void; + /** Fired after the layer is refreshed. */ + on(type: "refresh", listener: (event: { target: KMLLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = KMLLayer; +} + +declare module "esri/layers/LOD" { + /** An ArcGISTiledMapServiceLayer has a number of LODs (Levels of Detail). */ + class LOD { + /** ID for each level. */ + level: number; + /** String to be used when constructing URL to access a tile from this LOD. */ + levelValue: string; + /** Resolution in map units of each pixel in a tile for each level. */ + resolution: number; + /** Scale for each level. */ + scale: number; + } + export = LOD; +} + +declare module "esri/layers/LabelClass" { + import TextSymbol = require("esri/symbols/TextSymbol"); + + /** LabelClass defines the styles of labels for ArcGISDynamicMapServiceLayer. */ + class LabelClass { + /** Adjusts the formatting of labels. */ + labelExpression: string; + /** The position of the label. */ + labelPlacement: string; + /** The maximum scale to show labels. */ + maxScale: number; + /** The minimum scale to show labels. */ + minScale: number; + /** If this is defined, the symbol size changes proportionally. */ + sizeInfo: any; + /** Sets the Rendering symbol for the label. */ + symbol: TextSymbol; + /** When true, show the fields in the labelExpression that have domains using the domain's name. */ + useCodedValues: boolean; + /** A where clause determining which features are labeled. */ + where: string; + /** + * Create a LabelClass, in order to be added to layerDrawingOption.labelingInfo. + * @param json Various options to configure this LabelClass. + */ + constructor(json?: Object); + } + export = LabelClass; +} + +declare module "esri/layers/LabelLayer" { + import esri = require("esri"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import SimpleRenderer = require("esri/renderers/SimpleRenderer"); + import UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer"); + import ClassBreaksRenderer = require("esri/renderers/ClassBreaksRenderer"); + + /** The LabelLayer inherits from the graphics layer and can be used to display texts and symbols on map. */ + class LabelLayer extends GraphicsLayer { + /** + * Creates a new Label layer. + * @param params Constructor parameters. + */ + constructor(params?: esri.LabelLayerOptions); + /** + * Adds reference to the feature layer which is labeled. + * @param featureLayer The feature layer to be added to the label layer. + * @param renderer The renderer used to render text labels. + * @param textExpression An expression determining what text and field(s) will be displayed as in labels. + */ + addFeatureLayer(featureLayer: FeatureLayer, renderer?: SimpleRenderer, textExpression?: any): void; + /** + * Adds reference to the feature layer which is labeled. + * @param featureLayer The feature layer to be added to the label layer. + * @param renderer The renderer used to render text labels. + * @param textExpression An expression determining what text and field(s) will be displayed as in labels. + */ + addFeatureLayer(featureLayer: FeatureLayer, renderer?: UniqueValueRenderer, textExpression?: any): void; + /** + * Adds reference to the feature layer which is labeled. + * @param featureLayer The feature layer to be added to the label layer. + * @param renderer The renderer used to render text labels. + * @param textExpression An expression determining what text and field(s) will be displayed as in labels. + */ + addFeatureLayer(featureLayer: FeatureLayer, renderer?: ClassBreaksRenderer, textExpression?: any): void; + /** + * Returns reference to the feature layer which features will be labeled. + * @param index Index of the referenced feature layer. + */ + getFeatureLayer(index: number): FeatureLayer; + } + export = LabelLayer; +} + +declare module "esri/layers/LayerDataSource" { + import LayerSource = require("esri/layers/LayerSource"); + import DataSource = require("esri/layers/DataSource"); + + /** The LayerDataSource class defines and provides information about a layer created on the fly from a data source. */ + class LayerDataSource extends LayerSource { + /** The data source used to create a dynamic data layer on the fly. */ + dataSource: DataSource; + /** + * Creates a new LayerDataSource object. + * @param json JSON object representing the LayerDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = LayerDataSource; +} + +declare module "esri/layers/LayerDrawingOptions" { + import LabelClass = require("esri/layers/LabelClass"); + import Renderer = require("esri/renderers/Renderer"); + + /** The LayerDrawingOptions class provides options for setting ArcGISDynamicMapServiceLayer rendering options. */ + class LayerDrawingOptions { + /** Define labels of dynamicLayers. */ + labelingInfo: LabelClass[]; + /** The renderer to use for the dynamic layer. */ + renderer: Renderer; + /** Determines if the layer renders the symbols based on scale. */ + scaleSymbols: boolean; + /** Determines if labels are displayed. */ + showLabels: boolean; + /** The transparency of the layer. */ + transparency: number; + /** + * Creates a new LayerDrawingOptions object. + * @param json JSON object representing the LayerDrawingOptions. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = LayerDrawingOptions; +} + +declare module "esri/layers/LayerInfo" { + /** Contains information about each layer in a map service. */ + class LayerInfo { + /** Default visibility of the layers in the map service. */ + defaultVisibility: boolean; + /** Layer ID assigned by ArcGIS Server for a layer. */ + id: number; + /** The maximum visible scale for each layer in the map service. */ + maxScale: number; + /** The minimum visible scale for each layer in the map service. */ + minScale: number; + /** Layer name as defined in the map service. */ + name: string; + /** If the layer is part of a group layer, it will include the parent ID of the group layer. */ + parentLayerId: number; + /** If the layer is a parent layer, it will have one or more sub layers included in an array. */ + subLayerIds: number[]; + } + export = LayerInfo; +} + +declare module "esri/layers/LayerMapSource" { + import LayerSource = require("esri/layers/LayerSource"); + + /** The LayerMapSource class defines and provides information about an existing map service layer. */ + class LayerMapSource extends LayerSource { + /** When supported, specify the version in an SDE workspace that the layer will use. */ + gdbVersion: string; + /** The layer id for a sub-layer in the current map service. */ + mapLayerId: number; + /** + * Creates a new LayerMapSource object. + * @param json JSON object representing the LayerMapSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = LayerMapSource; +} + +declare module "esri/layers/LayerSource" { + /** Used to denote classes that may be used as a layer's source. */ + class LayerSource { + /** Used to describe the origin of the LayerSource. */ + type: string; + /** + * Creates a new LayerSource object. + * @param json Creates a new LayerSource object. + */ + constructor(json?: Object); + } + export = LayerSource; +} + +declare module "esri/layers/LayerTimeOptions" { + /** Defines the time options for the layer. */ + class LayerTimeOptions { + /** If true, the layer will draw all features from the beginning of the data's time extent. */ + timeDataCumulative: boolean; + /** The length of time the data is offset from the time when the data was recorded. */ + timeOffset: number; + /** Temporal unit in which the time offset is measured. */ + timeOffsetUnits: string; + /** If true, the layer participates in time-related rendering and query operations. */ + useTime: boolean; + } + export = LayerTimeOptions; +} + +declare module "esri/layers/MapImage" { + import esri = require("esri"); + import Extent = require("esri/geometry/Extent"); + + /** Represents the data object for the dynamically generated map. */ + class MapImage { + /** Extent of exported map. */ + extent: Extent; + /** Requested image height in pixels. */ + height: number; + /** URL to returned image. */ + href: string; + /** Scale of requested dynamic map. */ + scale: number; + /** Requested image width in pixels. */ + width: number; + /** + * Creates a new Map Image object. + * @param options An object that defines the map image options. + */ + constructor(options: esri.MapImageOptions); + } + export = MapImage; +} + +declare module "esri/layers/MapImageLayer" { + import Layer = require("esri/layers/layer"); + import MapImage = require("esri/layers/MapImage"); + + /** The MapImageLayer class is used to add georeferenced images to the map. */ + class MapImageLayer extends Layer { + /** + * Creates a new MapImageLayer object + * @param options Optional parameters. + */ + constructor(options?: any); + /** + * Add an image to the map. + * @param mapImage A MapImage object that defines the image to add to the map. + */ + addImage(mapImage: MapImage): void; + /** Get an array of MapImage objects that define the images in the MapImageLayer. */ + getImages(): MapImage[]; + /** Remove all images from the layer. */ + removeAllImages(): void; + /** + * Remove the specified image from the layer. + * @param mapImage The MapImage object that defines the image to remove. + */ + removeImage(mapImage: MapImage): void; + } + export = MapImageLayer; +} + +declare module "esri/layers/MosaicRule" { + import DimensionalDefinition = require("esri/layers/DimensionalDefinition"); + import Point = require("esri/geometry/Point"); + + /** Specifies the mosaic rule when defining how individual images should be mosaicked. */ + class MosaicRule { + /** Sorts rasters based on an attribute field and its difference from a base value. */ + static METHOD_ATTRIBUTE: any; + /** Sorts rasters where rasters that have their centers closest to the view center or center of view extent are placed on top. */ + static METHOD_CENTER: any; + /** Specifies that only rasters in the given list of raster Ids participate in the mosaic. */ + static METHOD_LOCKRASTER: any; + /** Sorts rasters by the distance between the nadir position and view center. */ + static METHOD_NADIR: any; + /** No mosaic method specified. */ + static METHOD_NONE: any; + /** Sorts rasters in a view independent way, where rasters with their centers most northwest are displayed on top. */ + static METHOD_NORTHWEST: any; + /** Cuts the raster using the predefined seamline shape. */ + static METHOD_SEAMLINE: any; + /** Sorts rasters based on a user-defined viewpoint location and nadir location. */ + static METHOD_VIEWPOINT: any; + /** Takes the blended value of all overlapping pixels. */ + static OPERATION_BLEND: any; + /** Takes the first value of all overlapping pixels. */ + static OPERATION_FIRST: any; + /** Takes the last value of all overlapping pixels. */ + static OPERATION_LAST: any; + /** Takes the maximum value of all overlapping pixels. */ + static OPERATION_MAX: any; + /** Takes the mean value of all overlapping pixels. */ + static OPERATION_MEAN: any; + /** Takes the minimum value of all overlapping pixels. */ + static OPERATION_MIN: any; + /** Indicates whether the sort should be ascending or not. */ + ascending: boolean; + /** An array of raster Ids. */ + lockRasterIds: number[]; + /** The mosaic method determines how the selected rasters are ordered. */ + method: string; + /** A multiple dimensional service can have multiple variables and multiple dimensions. */ + multidimensionalDefinition: DimensionalDefinition[]; + /** Defines a selection using a set of ObjectIds. */ + objectIds: number[]; + /** Defines the mosaic operation used to resolve overlapping pixels. */ + operation: string; + /** The name of the attribute field that is used together with a constant sortValue to define the mosaicking order when the mosaic method is set to METHOD_ATTRIBUTE. */ + sortField: string; + /** A constant value defining a reference or base value for the sort field when the mosaic method is set to METHOD_ATTRIBUTE. */ + sortValue: string; + /** Defines the viewpoint location on which the ordering is defined based on the distance from the viewpoint and the nadir of rasters. */ + viewpoint: Point; + /** The where clause determines which rasters will participate in the mosaic. */ + where: string; + /** Creates a new MosaicRule object */ + constructor(); + /** + * Create a new mosaic rule object using a json string representing a serialized version of the mosaic rule. + * @param json A json string representing a serialized version of the mosaic rule. + */ + constructor(json: Object); + /** Returns an easily serializable object representation of the mosaic rule. */ + toJson(): any; + } + export = MosaicRule; +} + +declare module "esri/layers/OpenStreetMapLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + + /** Allows you to use basemaps from OpenStreetMap . */ + class OpenStreetMapLayer extends TiledMapServiceLayer { + /** The copyright text. */ + copyright: string; + /** + * Creates a new OpenStreetMapLayer object. + * @param options Optional parameters. + */ + constructor(options?: esri.OpenStreetMapLayerOptions); + } + export = OpenStreetMapLayer; +} + +declare module "esri/layers/PixelBlock" { + import esri = require("esri"); + + /** (Beta at v3.13) The PixelBlock is used to hold pixels. */ + class PixelBlock { + /** Number of rows. */ + height: number; + /** An array of nodata mask. */ + mask: any[]; + /** A two dimensional array. */ + pixels: number[][]; + /** Pixel type. */ + pixelType: string; + /** Array of objects containing numeric statistical properties (e.g. */ + statistics: any[]; + /** Number of columns. */ + width: number; + /** + * Creates a new PixelBlock object. + * @param options Constructor parameters. + */ + constructor(options: esri.PixelBlockOptions); + /** + * Adds another plane. + * @param planeData Must have two properties set: pixels and statistics. + */ + addData(planeData: any): void; + /** Returns pixels and masks using a single array in bip format (e.g. */ + getAsRGBA(): any[]; + /** Similar to getAsRGBA, but returns floating point data. */ + getAsRGBAFloat(): any[]; + /** Returns the plane band count. */ + getPlaneCount(): number; + } + export = PixelBlock; +} + +declare module "esri/layers/QueryDataSource" { + import DataSource = require("esri/layers/DataSource"); + import SpatialReference = require("esri/SpatialReference"); + + /** The QueryDataSource class defines and provides information about a layer or table that is defined by a SQL query. */ + class QueryDataSource extends DataSource { + /** The geometry type of the data source. */ + geometryType: string; + /** An array of field names that define a unique identifier for the feature. */ + oidFields: string[]; + /** The SQL query string that defines the data source output. */ + query: string; + /** The spatial reference for the data source. */ + spatialReference: SpatialReference; + /** The workspace id for the registered file geodatabase, SDE or Shapefile workspace. */ + workspaceId: string; + /** + * Creates a new QueryDataSource object. + * @param json JSON object representing the QueryDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = QueryDataSource; +} + +declare module "esri/layers/RangeDomain" { + import Domain = require("esri/layers/Domain"); + + /** Information about the range of values belonging to the domain. */ + class RangeDomain extends Domain { + /** The maximum valid value. */ + maxValue: number; + /** The minimum valid value. */ + minValue: number; + } + export = RangeDomain; +} + +declare module "esri/layers/RasterDataSource" { + import DataSource = require("esri/layers/DataSource"); + + /** The RasterDataSource class defines and provides information about a file-based raster that resides in a registered raster workspace. */ + class RasterDataSource extends DataSource { + /** The name of a raster that resides in the registered workspace. */ + dataSourceName: string; + /** The workspace id for the registered raster workspace. */ + workspaceId: string; + /** + * Creates a new RasterDataSource object. + * @param json JSON object representing the RasterDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = RasterDataSource; +} + +declare module "esri/layers/RasterFunction" { + /** Specifies the processing to be done to the image service. */ + class RasterFunction { + /** Deprecated at v3.10, use functionArguments instead. */ + arguments: any; + /** The arguments for the raster function. */ + functionArguments: any; + /** The raster function name. */ + functionName: string; + /** Variable name for the raster function. */ + variableName: string; + /** Creates a new RasterFunction object. */ + constructor(); + /** + * Create a new Raster Function object using a json string representing a serialized version of a raster function. + * @param json A json string representing a serialized version of a raster function. + */ + constructor(json: Object); + /** Returns an easily serializable object representation of the raster function. */ + toJson(): any; + } + export = RasterFunction; +} + +declare module "esri/layers/RasterLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + + /** (Beta at v3.13) The RasterLayer is used to display image services. */ + class RasterLayer extends Layer { + /** + * Creates a new RasterLayer object. + * @param url URL to the ArcGIS Server REST resource that represents a raster layer service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.RasterLayerOptions); + /** Returns the context of the Canvas. */ + getContext(): any; + } + export = RasterLayer; +} + +declare module "esri/layers/StreamLayer" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Extent = require("esri/geometry/Extent"); + import Layer = require("esri/layers/layer"); + + /** The stream layer extends the feature layer to add the ability to connect to a stream of data using HTML5 WebSockets. */ + class StreamLayer extends FeatureLayer { + /** The maximum number of observations being shown for each unique track. */ + maximumTrackPoints: number; + /** Purge interval of the layer in minutes. */ + purgeInterval: number; + /** Raw access to the connected websocket. */ + socket: any; + /** URL used to make the socket connection. */ + socketUrl: string; + /** + * Creates a new StreamLayer with a service URL. + * @param url URL to an ArcGIS Server Stream Service. + * @param options Optional parameters used to create the layer. + */ + constructor(url: string, options?: esri.StreamLayerOptions1); + /** + * Creates a new StreamLayer with a FeatureCollection object. + * @param featureCollectionObject A feature collection object. + * @param options Optional parameters used to create the layer. + */ + constructor(featureCollectionObject: any, options?: esri.StreamLayerOptions2); + /** + * Connect to the Stream Server socket. + * @param callback The function to call when the method has completed. + */ + connect(callback?: Function): void; + /** + * Disconnect from the Stream Server socket. + * @param callback The function to call when the method has completed. + */ + disconnect(callback?: Function): void; + /** Gets the where property of the layer's filter. */ + getDefinitionExpression(): string; + /** Gets the spatial filter set on the layer. */ + getGeometryDefinition(): Extent; + /** + * Gets the unique values of the graphics (in the StreamLayer) based on the `fieldName` parameter. + * @param fieldName Field to get the unique values from. + */ + getUniqueValues(fieldName: string): any[]; + /** + * Sets the spatial filter for the layer. + * @param extent Limit the features in the StreamLayer by setting a bounding box. + */ + setGeometryDefinition(extent: Extent): void; + /** + * Sets the maximumTrackPoints property for the layer. + * @param value The maximum track points for the layer. + */ + setMaximumTrackPoints(value: number): void; + /** + * Changes the layer's purge interval to the given value (in minutes). + * @param interval The purge interval in minutes. + */ + setPurgeInterval(interval: number): Layer; + /** Fires when the layer attempts to reconnect to the web socket. */ + on(type: "attempt-reconnect", listener: (event: { count: number; url: string; target: StreamLayer }) => void): esri.Handle; + /** Fires when connection is successfully made to socket. */ + on(type: "connect", listener: (event: { target: StreamLayer }) => void): esri.Handle; + /** Fires when a connection cannot be made with the web socket. */ + on(type: "connection-error", listener: (event: { error: Error; target: StreamLayer }) => void): esri.Handle; + /** Fires when disconnect from socket. */ + on(type: "disconnect", listener: (event: { target: StreamLayer }) => void): esri.Handle; + /** Fires when the layer receives a message that the server-side filter has been changed. */ + on(type: "filter-change", listener: (event: { error: Error; filter: any; target: StreamLayer }) => void): esri.Handle; + /** Fires after a message is pushed to the layer. */ + on(type: "message", listener: (event: { message: any; target: StreamLayer }) => void): esri.Handle; + /** Fires when the purgeInterval property is changed. */ + on(type: "purge-interval-change", listener: (event: { target: StreamLayer }) => void): esri.Handle; + /** Fires when layer is added to map (if stream service is associated with an archive feature service) and when graphics are updated on the map due to new ones being added or removed (for example purged). */ + on(type: "update-start", listener: (event: { target: StreamLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = StreamLayer; +} + +declare module "esri/layers/TableDataSource" { + import DataSource = require("esri/layers/DataSource"); + + /** The TableDataSource class defines and provides information about a table, feature class, or raster that resides in a registered file geodatabase, SDE or Shapefile workspace. */ + class TableDataSource extends DataSource { + /** The name of a table, feature class or raster that resides in the registered workspace. */ + dataSourceName: string; + /** For versioned SDE workspaces, use this property to point to an alternate version. */ + gdbVersion: string; + /** The workspace id for the registered file geodatabase, SDE or Shapefile workspace. */ + workspaceId: string; + /** + * Creates a new TableDataSource object. + * @param json JSON object representing the TableDataSource. + */ + constructor(json?: Object); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = TableDataSource; +} + +declare module "esri/layers/TileInfo" { + import LOD = require("esri/layers/LOD"); + import Point = require("esri/geometry/Point"); + import SpatialReference = require("esri/SpatialReference"); + + /** Contains information about the tiling scheme for an ArcGISTiledMapServiceLayer. */ + class TileInfo { + /** The dpi of the tiling scheme. */ + dpi: number; + /** Image format of the cached tiles. */ + format: string; + /** Height of each tile in pixels. */ + height: number; + /** An array of levels of detail that define the tiling scheme. */ + lods: LOD[]; + /** The tiling scheme origin. */ + origin: Point; + /** The spatial reference of the tiling schema. */ + spatialReference: SpatialReference; + /** Width of each tile in pixels. */ + width: number; + /** + * Creates a new object describing the given tiling scheme. + * @param properties Properties describing the tiling scheme. + */ + constructor(properties: any); + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = TileInfo; +} + +declare module "esri/layers/TiledMapServiceLayer" { + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** The base class for all tiled map service layers. */ + class TiledMapServiceLayer extends Layer { + /** Full extent as defined by the map service. */ + fullExtent: Extent; + /** Initial extent as defined by the map service. */ + initialExtent: Extent; + /** The spatial reference of the map service. */ + spatialReference: SpatialReference; + /** Returns TileInfo, which has information on the tiling schema. */ + tileInfo: TileInfo; + /** Creates a new TiledMapServiceLayer object. */ + constructor(); + /** + * Method to implement when extending TiledMapServiceLayer. + * @param level Requested tile's level. + * @param row Requested tile's row. + * @param column Requested tile's column. + */ + getTileUrl(level: number, row: number, column: number): string; + /** Reloads all the tiles in the current view. */ + refresh(): void; + /** Specify areas to not show tiles. */ + setExclusionAreas(): any[]; + } + export = TiledMapServiceLayer; +} + +declare module "esri/layers/TimeInfo" { + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import TimeExtent = require("esri/TimeExtent"); + import TimeReference = require("esri/layers/TimeReference"); + + /** Time information details. */ + class TimeInfo { + /** Indicates a value measured in centuries. */ + static UNIT_CENTURIES: any; + /** Indicates a value measured in days. */ + static UNIT_DAYS: any; + /** Indicates a value measured in decades. */ + static UNIT_DECADES: any; + /** Indicates a value measured in hours. */ + static UNIT_HOURS: any; + /** Indicates a value measured in milliseconds. */ + static UNIT_MILLISECONDS: any; + /** Indicates a value measured in minutes. */ + static UNIT_MINUTES: any; + /** Indicates a value measured in months. */ + static UNIT_MONTHS: any; + /** Indicates a value measured in seconds. */ + static UNIT_SECONDS: any; + /** Indicates a value measured in unknown units. */ + static UNIT_UNKNOWN: any; + /** Indicates a value measured in weeks. */ + static UNIT_WEEKS: any; + /** Indicates a value measured in years. */ + static UNIT_YEARS: any; + /** The name of the attribute field that contains the end time information. */ + endTimeField: string; + /** Default time-related export options for the layer. */ + exportOptions: LayerTimeOptions; + /** The name of the attribute field that contains the start time information. */ + startTimeField: string; + /** The time extent for all the data in the layer. */ + timeExtent: TimeExtent; + /** Time interval of the data in the layer. */ + timeInterval: number; + /** Temporal unit in which the time interval is measured. */ + timeIntervalUnits: string; + /** Information about how the time was measured. */ + timeReference: TimeReference; + /** The field that contains the trackId. */ + trackIdField: string; + } + export = TimeInfo; +} + +declare module "esri/layers/TimeReference" { + /** TimeReference contains information about how the time was measured. */ + class TimeReference { + /** Indicates whether the time reference respects daylight savings time. */ + respectsDaylightSaving: boolean; + /** The time zone information associated with the time reference. */ + timeZone: string; + } + export = TimeReference; +} + +declare module "esri/layers/WMSLayer" { + import esri = require("esri"); + import DynamicMapServiceLayer = require("esri/layers/DynamicMapServiceLayer"); + import Extent = require("esri/geometry/Extent"); + import WMSLayerInfo = require("esri/layers/WMSLayerInfo"); + import SpatialReference = require("esri/SpatialReference"); + + /** A layer for OGC Web Map Services (WMS). */ + class WMSLayer extends DynamicMapServiceLayer { + /** Copyright of the WMS service. */ + copyright: string; + /** Description of the WMS service. */ + description: string; + /** Extent of the WMS service. */ + extent: Extent; + /** The URL for the WMS GetMap call. */ + getMapUrl: string; + /** The map image format. */ + imageFormat: string; + /** List of layers in the WMS service. */ + layerInfos: WMSLayerInfo[]; + /** Maximum height in pixels the WMS service supports. */ + maxHeight: number; + /** Maximum width in pixels the WMS service supports. */ + maxWidth: number; + /** Spatial reference of the WMS service. */ + spatialReference: SpatialReference; + /** Title of the WMS service. */ + title: string; + /** Version of the WMS service. */ + version: string; + /** + * Creates a new WMSLayer object. + * @param url URL to the OGC Web Map Service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.WMSLayerOptions); + /** + * Set the map image format; valid values are "png", "jpg", "pdf", "bmp", "gif" and "svg". + * @param format The image format. + */ + setImageFormat(format: string): void; + /** + * Specify whether the background image is transparent. + * @param transparency When true the background image is transparent. + */ + setImageTransparency(transparency: boolean): void; + /** + * Specify a list of layer names to updates the visible layers. + * @param layers An array of layer ids. + */ + setVisibleLayers(layers: string[]): void; + } + export = WMSLayer; +} + +declare module "esri/layers/WMSLayerInfo" { + import Extent = require("esri/geometry/Extent"); + + /** The WMSLayerInfo class defines and provides information about layers in a WMS service. */ + class WMSLayerInfo { + /** The layer description defines the value of the Abstract capabilities property. */ + description: string; + /** The layer extent. */ + extent: Extent; + /** Contains the value of the LegendURL capabilities property. */ + legendURL: string; + /** The layer name. */ + name: string; + /** The layer title. */ + title: string; + /** + * Creates a new WMSLayerInfo object. + * @param layer WMSLayerInfo layer object. + */ + constructor(layer: any); + } + export = WMSLayerInfo; +} + +declare module "esri/layers/WMTSLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + import WMTSLayerInfo = require("esri/layers/WMTSLayerInfo"); + + /** The WMTSLayer class is used to create a layer based on an OGC Web Map Tile Service layer. */ + class WMTSLayer extends TiledMapServiceLayer { + /** Copyright information for the service. */ + copyright: string; + /** The description of the active layer if specified in the capabilties file or the resource info. */ + description: string; + /** The tile format. */ + format: string; + /** The full extent of the active layer. */ + fullExtent: Extent; + /** The initial extent of the active layer. */ + initialExtent: Extent; + /** An array of WMTSLayerInfo objects. */ + layerInfos: any[]; + /** The service mode for the WMTS layer. */ + serviceMode: string; + /** The spatial reference for the WMTS service. */ + spatialReference: SpatialReference; + /** The tile info for the active layer. */ + tileInfo: TileInfo; + /** Title of the WMTS service. */ + title: string; + /** Version of the WMTS service. */ + version: string; + /** + * Creates a new WMTSLayer object. + * @param url URL for the WMTS endpoint. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.WMTSLayerOptions); + /** + * Set the active layer for the WMTS service. + * @param WMTSLayerInfo The WMTSLayerInfo for the layer to make active. + */ + setActiveLayer(WMTSLayerInfo: WMTSLayerInfo): void; + } + export = WMTSLayer; +} + +declare module "esri/layers/WMTSLayerInfo" { + import esri = require("esri"); + + /** The WMTSLayerInfo class defines and provides information about layers in a WMTS service. */ + class WMTSLayerInfo { + /** + * Creates a new WMTSLayerInfo object. + * @param options An object that defines the layer info options. + */ + constructor(options: esri.WMTSLayerInfoOptions); + } + export = WMTSLayerInfo; +} + +declare module "esri/layers/WebTiledLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** The WebTiledLayer class provides a simple way to add non-ArcGIS Server map tiles as a layer to a map. */ + class WebTiledLayer extends TiledMapServiceLayer { + /** The attribution information for the layer. */ + copyright: string; + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The spatial reference of the layer. */ + spatialReference: SpatialReference; + /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ + tileInfo: TileInfo; + /** The tile server names for the layer. */ + tileServers: string[]; + /** + * Creates a new WebTiledLayer. + * @param urlTemplate The URL template to retrieve the tiles. + * @param options Optional parameters. + */ + constructor(urlTemplate: string, options?: esri.WebTiledLayerOptions); + } + export = WebTiledLayer; +} + +declare module "esri/layers/layer" { + import esri = require("esri"); + import Credential = require("esri/Credential"); + import Map = require("esri/map"); + + /** The base class for all layers that can be added to a map. */ + class Layer { + /** The URL, when available, where the layer's attribution data is stored. */ + attributionDataUrl: string; + /** class attribute of the layer's node. */ + className: string; + /** Provides credential information for the layer such as userid and token if the layer represents a resource that is secured with token-based authentication. */ + credential: Credential; + /** When true, the layer has attribution data. */ + hasAttributionData: boolean; + /** ID assigned to the layer. */ + id: string; + /** When the layer is loaded, the value becomes "true", and layer properties can be accessed. */ + loaded: boolean; + /** Set if the layer failed to load. */ + loadError: Error; + /** Maximum visible scale for the layer. */ + maxScale: number; + /** Minimum visible scale for the layer. */ + minScale: number; + /** Opacity or transparency of layer. */ + opacity: number; + /** Refresh interval of the layer in minutes. */ + refreshInterval: number; + /** When true, the layer's attribution is displayed on the map. */ + showAttribution: boolean; + /** When true, the layer is suspended. */ + suspended: boolean; + /** URL to the ArcGIS Server REST resource that represents a map service. */ + url: string; + /** Visibility of the layer. */ + visible: boolean; + /** When true, the layer is visible at the current map scale. */ + visibleAtMapScale: boolean; + /** + * Creates a new Layer object. + * @param options Optional parameters. + */ + constructor(options?: esri.LayerOptions); + /** + * Adds a new attribute or changes the value of an existing attribute on the layer's node. + * @param name The name of the attribute. + * @param value The value of the attribute. + */ + attr(name: string, value: string): Layer; + /** Asynchrously returns custom data for the layer when available. */ + getAttributionData(): any; + /** Returns reference to the map control the layer is added to. */ + getMap(): Map; + /** Returns the layer's DOM node. */ + getNode(): HTMLElement; + /** Sets the visibility of the layer to "false". */ + hide(): void; + /** + * Returns true if the layer is visible at the given scale. + * @param scale The scale at which to check if the layer is visible. + */ + isVisibleAtScale(scale: number): boolean; + /** Resumes layer drawing. */ + resume(): void; + /** + * Set the maximum scale for the layer. + * @param scale The maximum scale at which the layer is visible. + */ + setMaxScale(scale: number): void; + /** + * Set the minimum scale for the layer. + * @param scale The minimum scale at which the layer is visible. + */ + setMinScale(scale: number): void; + /** + * Sets the opacity of the layer. + * @param opacity Value from 0 to 1, where 0 is 100% transparent and 1 has no transparency. + */ + setOpacity(opacity: number): void; + /** + * Changes the layer's refresh interval to the given value (in minutes). + * @param interval Refresh interval of the layer in minutes. + */ + setRefreshInterval(interval: number): Layer; + /** + * Set the scale range for the layer. + * @param minScale The minimum scale at which the layer is visible. + * @param maxScale The maximum scale at which the layer is visible. + */ + setScaleRange(minScale: number, maxScale: number): void; + /** + * Sets the visibility of the layer. + * @param isVisible Set the visibility of the layer. + */ + setVisibility(isVisible: boolean): void; + /** Sets the visibility of the layer to "true". */ + show(): void; + /** Suspends layer drawing. */ + suspend(): void; + /** Fires when there is a problem retrieving a layer. */ + on(type: "error", listener: (event: { error: Error; target: Layer }) => void): esri.Handle; + /** Fires after layer properties for the layer are successfully populated. */ + on(type: "load", listener: (event: { layer: Layer; target: Layer }) => void): esri.Handle; + /** Fires when the layer opacity has been changed, and returns an object with the opacity value. */ + on(type: "opacity-change", listener: (event: { opacity: number; target: Layer }) => void): esri.Handle; + /** This event is fired when the layer's refreshInterval is modified. */ + on(type: "refresh-interval-change", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer resumes drawing. */ + on(type: "resume", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer's minScale and/or maxScale is changed. */ + on(type: "scale-range-change", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer's scale visibility changes. */ + on(type: "scale-visibility-change", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer suspends drawing. */ + on(type: "suspend", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires any time a layer has finished loading or updating itself. */ + on(type: "update", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when a layer has finished updating its content. */ + on(type: "update-end", listener: (event: { error: Error; target: Layer }) => void): esri.Handle; + /** Fires when a layer begins to update its content. */ + on(type: "update-start", listener: (event: { target: Layer }) => void): esri.Handle; + /** Fires when the layer visibility has been changed, and returns an object with a Boolean visible property containing the new visibility value of the layer. */ + on(type: "visibility-change", listener: (event: { visible: boolean; target: Layer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Layer; +} + +declare module "esri/map" { + import esri = require("esri"); + import Attribution = require("esri/dijit/Attribution"); + import Extent = require("esri/geometry/Extent"); + import GraphicsLayer = require("esri/layers/GraphicsLayer"); + import InfoWindowBase = require("esri/InfoWindowBase"); + import Point = require("esri/geometry/Point"); + import SnappingManager = require("esri/SnappingManager"); + import SpatialReference = require("esri/SpatialReference"); + import TimeExtent = require("esri/TimeExtent"); + import Layer = require("esri/layers/layer"); + import ScreenPoint = require("esri/geometry/ScreenPoint"); + import TimeSlider = require("esri/dijit/TimeSlider"); + import LOD = require("esri/layers/LOD"); + + /** The Map class creates a container and required DOM structure for adding layers, graphics, an info window, and other navigation controls. */ + class Map { + /** Reference to the attribution widget created by the map when map attribution is enabled. */ + attribution: Attribution; + /** Value is true when the map automatically resizes if the browser window or ContentPane widget enclosing the map is resized. */ + autoResize: boolean; + /** An array of IDs corresponding to the layers that make up the map's current basemap. */ + basemapLayerIds: string[]; + /** The current extent of the map in map units. */ + extent: Extent; + /** Indicates if the fade effect is enabled while zooming. */ + fadeOnZoom: boolean; + /** When the mapNavigation mode is set to 'css-transforms', CSS3 transforms will be used for map navigation when supported by the browser. */ + force3DTransforms: boolean; + /** The extent (or bounding box) of the map in geographic coordinates. */ + geographicExtent: Extent; + /** Provides access to the Map's GraphicsLayer. */ + graphics: GraphicsLayer; + /** An array of the current GraphicsLayers in the map. */ + graphicsLayerIds: string[]; + /** Current height of the map in screen pixels. */ + height: number; + /** Reference to HTML DIV or other element where the map is placed on the page. */ + id: string; + /** Displays the InfoWindow on a map. */ + infoWindow: InfoWindowBase; + /** When true, the key sequence of shift then click to recenter the map is enabled. */ + isClickRecenter: boolean; + /** When true, double click zoom is enabled. */ + isDoubleClickZoom: boolean; + /** When true, keyboard navigation is enabled. */ + isKeyboardNavigation: boolean; + /** When true, map panning is enabled using the mouse. */ + isPan: boolean; + /** When true, pan arrows are displayed around the edge of the map. */ + isPanArrows: boolean; + /** When true, rubberband zoom is enabled. */ + isRubberBandZoom: boolean; + /** When true, the mouse scroll wheel zoom is enabled. */ + isScrollWheelZoom: boolean; + /** When true, shift double click zoom is enabled. */ + isShiftDoubleClickZoom: boolean; + /** When true, the zoom slider is displayed on the map. */ + isZoomSlider: boolean; + /** Array of IDs corresponding to layers in the map, except for GraphicsLayers and FeatureLayers, which are maintained in map.graphicsLayerIds. */ + layerIds: string[]; + /** After the first layer is loaded, the value is set to true. */ + loaded: boolean; + /** Indicates whether the map uses CSS3 transformations when panning and zooming. */ + navigationMode: string; + /** This point geometry in screen coordinates represent the top-left corner of the map container. */ + position: Point; + /** The DOM node that contains the container of layers, build-in info window, logo and slider. */ + root: Node; + /** When true, map attribution is enabled. */ + showAttribution: boolean; + /** If snapping is enabled on the map using map.enableSnapping() this property provides access to the SnappingManager. */ + snappingManager: SnappingManager; + /** The spatial reference of the map. */ + spatialReference: SpatialReference; + /** The current TimeExtent for the map. */ + timeExtent: TimeExtent; + /** Indicates whether map is visible. */ + visible: boolean; + /** Current width of the map in screen pixels. */ + width: number; + /** + * Creates a new map inside of the given HTML container, which is often a DIV element. + * @param divId Container id for the referencing map. + * @param options Optional parameters. + */ + constructor(divId: string, options?: esri.MapOptions); + /** + * Adds an Esri Layer to the map. + * @param layer Layer to be added to the map. + * @param index A layer can be added at a specified index in the map. + */ + addLayer(layer: Layer, index?: number): Layer; + /** + * Adds multiple layers to a map. + * @param layers Layers to be added to the map. + */ + addLayers(layers: Layer[]): void; + /** + * Adds a new attribute or changes the value of an existing attribute on the map container. + * @param name The name of the attribute. + * @param value The value of the attribute. + */ + attr(name: string, value: string): Map; + /** + * Centers and zooms the map. + * @param mapPoint Centers the map on the specified x,y location. + * @param levelOrFactor When using an ArcGISTiledMapServiceLayer, the map is zoomed to the level specified. + */ + centerAndZoom(mapPoint: Point, levelOrFactor: number): any; + /** + * Centers the map based on map coordinates as the center point. + * @param mapPoint Centers the map on the specified x,y location. + */ + centerAt(mapPoint: Point): any; + /** Destroys the map instance. */ + destroy(): void; + /** Disallows clicking on a map to center it. */ + disableClickRecenter(): void; + /** Disallows double clicking on a map to zoom in a level and center the map. */ + disableDoubleClickZoom(): void; + /** Disallows panning and zooming using the keyboard. */ + disableKeyboardNavigation(): void; + /** Disallows all map navigation except the slider and pan arrows. */ + disableMapNavigation(): void; + /** Disallows panning a map using the mouse. */ + disablePan(): void; + /** Disallows zooming in or out on a map using a bounding box. */ + disableRubberBandZoom(): void; + /** Disallows zooming in or out on a map using the mouse scroll wheel. */ + disableScrollWheelZoom(): void; + /** Disallows shift double clicking on a map to zoom in a level and center the map. */ + disableShiftDoubleClickZoom(): void; + /** Disables snapping on the map. */ + disableSnapping(): void; + /** Permits users to click on a map to center it. */ + enableClickRecenter(): void; + /** Permits users to double click on a map to zoom in a level and center the map. */ + enableDoubleClickZoom(): void; + /** Permits users to pan and zoom using the keyboard. */ + enableKeyboardNavigation(): void; + /** Allows all map navigation. */ + enableMapNavigation(): void; + /** Permits users to pan a map using the mouse. */ + enablePan(): void; + /** Permits users to zoom in or out on a map using a bounding box. */ + enableRubberBandZoom(): void; + /** Permits users to zoom in or out on a map using the mouse scroll wheel. */ + enableScrollWheelZoom(): void; + /** Permits users to shift double click on a map to zoom in a level and center the map. */ + enableShiftDoubleClickZoom(): void; + /** + * Enable snapping on the map when working with the Editor, Measurement widget or the Draw and Edit toolbars. + * @param snapOptions See the object specifications table below for the structure of the snapOptions object. + */ + enableSnapping(snapOptions?: any): SnappingManager; + /** Returns the name of the current basemap. */ + getBasemap(): string; + /** + * Sets an InfoWindow's anchor when calling InfoWindow.show. + * @param screenCoords The anchor point in screen units. + */ + getInfoWindowAnchor(screenCoords: ScreenPoint): string; + /** + * Returns an individual layer of a map. + * @param id ID assigned to the layer. + */ + getLayer(id: string): Layer; + /** Return an array of layers visible at the current scale. */ + getLayersVisibleAtScale(): Layer[]; + /** Gets the current level of detail for the map. */ + getLevel(): number; + /** Returns the maximum visible scale of the map. */ + getMaxScale(): number; + /** Returns the maximum zoom level of the map. */ + getMaxZoom(): number; + /** Returns the minimum visible scale of the map. */ + getMinScale(): number; + /** Returns the minimum zoom level of the map. */ + getMinZoom(): number; + /** Returns the current map scale. */ + getScale(): number; + /** Returns the current zoom level of the map. */ + getZoom(): number; + /** Hides the pan arrows from the map. */ + hidePanArrows(): void; + /** Hides the zoom slider from the map. */ + hideZoomSlider(): void; + /** Pans the map south. */ + panDown(): any; + /** Pans the map west. */ + panLeft(): any; + /** Pans the map southwest. */ + panLowerLeft(): any; + /** Pans the map southeast. */ + panLowerRight(): any; + /** Pans the map east. */ + panRight(): any; + /** Pans the map north. */ + panUp(): any; + /** Pans the map northwest. */ + panUpperLeft(): any; + /** Pans the map northeast. */ + panUpperRight(): any; + /** Removes all layers from the map. */ + removeAllLayers(): void; + /** + * Removes the specified layer from the map. + * @param layer Layer to be removed from the map. + */ + removeLayer(layer: Layer): void; + /** + * Changes the layer order in the map. + * @param layer The layer to be moved. + * @param index Refers to the location for placing the layer. + */ + reorderLayer(layer: Layer, index: number): void; + /** Repositions the map DIV on the page. */ + reposition(): void; + /** + * Resizes the map DIV. + * @param immediate By default, the actual resize logic is delayed internally in order to throttle spurious resize events dispatched by some browsers. + */ + resize(immediate?: boolean): void; + /** + * Change the map's current basemap. + * @param basemap A valid basemap name. + */ + setBasemap(basemap: string): void; + /** + * Sets the extent of the map. + * @param extent Sets the minx, miny, maxx, and maxy for a map. + * @param fit When true, for maps that contain tiled map service layers, you are guaranteed to have the input extent shown completely on the map. + */ + setExtent(extent: Extent, fit?: boolean): any; + /** + * If true and a map click event occurs, it may show the map's infoWindow. + * @param enabled Toggles the behavior initially set by the map's showInfoWindowOnClick constructor option. + */ + setInfoWindowOnClick(enabled: boolean): void; + /** + * Sets the map to the specified level. + * @param level The level ID. + */ + setLevel(level: number): any; + /** + * Sets the default cursor for the map. + * @param cursor A standard CSS cursor value. + */ + setMapCursor(cursor: string): void; + /** + * Sets the map scale to the specified value. + * @param scale A map scale value greater than 0. + */ + setScale(scale: number): any; + /** + * Sets the TimeExtent for the map. + * @param timeExtent Set the time extent for which data is displayed on the map. + */ + setTimeExtent(timeExtent: TimeExtent): void; + /** + * Set the time slider associated with the map. + * @param timeSlider The time slider dijit to associate with the map. + */ + setTimeSlider(timeSlider: TimeSlider): void; + /** + * Show or hide the map. + * @param visible If true, map will be visible. + */ + setVisibility(visible: boolean): Map; + /** + * Set the map zoom level to the given value. + * @param zoom A valid zoom level value. + */ + setZoom(zoom: number): any; + /** Shows the pan arrows on the map. */ + showPanArrows(): void; + /** Shows the zoom slider on the map. */ + showZoomSlider(): void; + /** + * Converts a single screen point to map coordinates. + * @param screenPoint Converts screen coordinates to map coordinates. + */ + toMap(screenPoint: ScreenPoint): Point; + /** + * Converts a single map point to screen coordinate. + * @param mapPoint Converts map coordinates to screen coordinates. + */ + toScreen(mapPoint: Point): ScreenPoint; + /** Fired when the map's basemap is changed. */ + on(type: "basemap-change", listener: (event: { current: any; previous: any; target: Map }) => void): esri.Handle; + /** Event is fired before the map gets destroyed. */ + on(type: "before-unload", listener: (event: { map: Map; target: Map }) => void): esri.Handle; + /** Fires when a user single clicks on the map using the mouse and the mouse pointer is within the map region of the HTML page. */ + on(type: "click", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a user double clicks on the map using the mouse and the mouse pointer is within the map region of the HTML page. */ + on(type: "dbl-click", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the extent of the map has changed. */ + on(type: "extent-change", listener: (event: { delta: Point; extent: Extent; levelChange: boolean; lod: LOD; target: Map }) => void): esri.Handle; + /** Fires when a keyboard key is pressed. */ + on(type: "key-down", listener: (event: KeyboardEvent) => void): esri.Handle; + /** Fires when a keyboard key is released. */ + on(type: "key-up", listener: (event: KeyboardEvent) => void): esri.Handle; + /** Fires any time a layer is added to the map. */ + on(type: "layer-add", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires after specified layer has been added to the map. */ + on(type: "layer-add-result", listener: (event: { error: Error; layer: Layer; target: Map }) => void): esri.Handle; + /** Fires after the layer has been removed. */ + on(type: "layer-remove", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires when the map layer order has been changed. */ + on(type: "layer-reorder", listener: (event: { index: number; layer: Layer; target: Map }) => void): esri.Handle; + /** Fires when a map layer resumes drawing. */ + on(type: "layer-resume", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires after all layers are added to the map using the map.addLayers method. */ + on(type: "layers-add-result", listener: (event: { layers: Layer[]; target: Map }) => void): esri.Handle; + /** Fires after all the layers have been removed. */ + on(type: "layers-removed", listener: (event: { target: Map }) => void): esri.Handle; + /** Fires when all the layers have been reordered. */ + on(type: "layers-reordered", listener: (event: { layerIds: string[]; target: Map }) => void): esri.Handle; + /** Fires when a map layer suspends drawing. */ + on(type: "layer-suspend", listener: (event: { layer: Layer; target: Map }) => void): esri.Handle; + /** Fires when the first or base layer has been successfully added to the map. */ + on(type: "load", listener: (event: { map: Map; target: Map }) => void): esri.Handle; + /** Fires when a mouse button is pressed down and the mouse cursor is in the map region of the HTML page. */ + on(type: "mouse-down", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires while the mouse is being dragged until the mouse button is released. */ + on(type: "mouse-drag", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a mouse button is released and the user stops dragging the mouse. */ + on(type: "mouse-drag-end", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when a mouse button is pressed down and the user starts to drag the mouse. */ + on(type: "mouse-drag-start", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires any time the mouse pointer moves over the map region. */ + on(type: "mouse-move", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse moves out of the map region of the HTML page. */ + on(type: "mouse-out", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse moves into the map region of the HTML page. */ + on(type: "mouse-over", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse button is released and the mouse pointer is within the map region of the HTML page. */ + on(type: "mouse-up", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires when the mouse wheel is scrolled. */ + on(type: "mouse-wheel", listener: (event: esri.AGSMouseEvent) => void): esri.Handle; + /** Fires during the pan process. */ + on(type: "pan", listener: (event: { delta: Point; extent: Extent; target: Map }) => void): esri.Handle; + /** Fires when the pan is complete. */ + on(type: "pan-end", listener: (event: { delta: Point; extent: Extent; target: Map }) => void): esri.Handle; + /** Fires when a user commences panning. */ + on(type: "pan-start", listener: (event: { extent: Extent; target: Map }) => void): esri.Handle; + /** Fires when the map DIV is repositioned. */ + on(type: "reposition", listener: (event: { x: number; y: number; target: Map }) => void): esri.Handle; + /** Fires when the map's container has been resized. */ + on(type: "resize", listener: (event: { extent: Extent; height: number; width: number; target: Map }) => void): esri.Handle; + /** Fires when the map's timeExtent property is set. */ + on(type: "time-extent-change", listener: (event: { timeExtent: TimeExtent; target: Map }) => void): esri.Handle; + /** Fires when the page is refreshed. */ + on(type: "unload", listener: (event: { map: Map; target: Map }) => void): esri.Handle; + /** Fires after layers that are updating their content have completed. */ + on(type: "update-end", listener: (event: { error: Error; target: Map }) => void): esri.Handle; + /** Fires when one or more layers begins updating their content. */ + on(type: "update-start", listener: (event: { target: Map }) => void): esri.Handle; + /** Fires during the zoom process. */ + on(type: "zoom", listener: (event: { anchor: Point; extent: Extent; zoomFactor: number; target: Map }) => void): esri.Handle; + /** Fires when the zoom is complete. */ + on(type: "zoom-end", listener: (event: { anchor: Point; extent: Extent; level: number; zoomFactor: number; target: Map }) => void): esri.Handle; + /** Fires when a user commences zooming. */ + on(type: "zoom-start", listener: (event: { anchor: Point; extent: Extent; level: number; zoomFactor: number; target: Map }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Map; +} + +declare module "esri/plugins/FeatureLayerStatistics" { + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** This module defines a class and a feature layer plugin that is used to calculate feature layer statistics. */ + class FeatureLayerStatistics { + /** + * Creates a new object that is used to calculate statistics about features in a feature layer. + * @param params Parameters that define the FeatureLayerStatistics. + */ + constructor(params: any); + /** + * This function is called internally when the plugin is added to a feature layer. + * @param layer The target FeatureLayer that have the plugin added. + * @param options Additional options that will be passed into the FeatureLayerStatistics constructor when it is added as a plugin to the target FeatureLayer. + */ + add(layer: FeatureLayer, options?: any): void; + /** + * Calculate class breaks for data stored in the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getClassBreaks(params: any): any; + /** + * Calculate basic statistics for data stored in the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getFieldStatistics(params: any): any; + /** + * Calculate heatmap statistics. + * @param options See the Object Specifications table below for the structure of the options object. + */ + getHeatmapStatistics(options?: any): any; + /** + * Calculate histogram for data stored in the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getHistogram(params: any): any; + /** + * Get a random sampling of features in this layer. + * @param options See the Object Specifications table below for the structure of the options object. + */ + getSampleFeatures(options?: any): any; + /** + * Find optimal scale range for viewing this layer. + * @param options See the Object Specifications table below for the structure of the options object. + */ + getSuggestedScaleRange(options?: any): any; + /** + * Find unique values available for the given field. + * @param params See the Object Specifications table below for the structure of the params object. + */ + getUniqueValues(params: any): any; + /** + * This function is called internally when the plugin is removed from a feature layer. + * @param layer The target FeatureLayer that will have the plugin removed. + */ + remove(layer: FeatureLayer): void; + } + export = FeatureLayerStatistics; +} + +declare module "esri/plugins/spatialIndex" { + import Map = require("esri/map"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + + /** A static utility module that adds or removes a SpatialIndex instance on a Map or FeatureLayer. */ + var spatialIndex: { + /** + * Adds an index property to the target instance. + * @param target The map or feature layer to which the index is connected. + * @param options See the object specifications table below for the structure of the index options object. + */ + add(target: Map, options?: any): void; + /** + * Adds an index property to the target instance. + * @param target The map or feature layer to which the index is connected. + * @param options See the object specifications table below for the structure of the index options object. + */ + add(target: FeatureLayer, options?: any): void; + /** Removes the index plugin. */ + remove(): void; + }; + export = spatialIndex; +} + +declare module "esri/process/Processor" { + import esri = require("esri"); + import FeatureLayer = require("esri/layers/FeatureLayer"); + import Map = require("esri/map"); + + /** The base processor class provides the generic api for processors and provides an extension point from which developers can create and extend additional processors. */ + class Processor { + /** Allow the feature layer to draw the features. */ + drawFeatures: boolean; + /** Should features be fetched through the Worker. */ + fetchWithWorker: boolean; + /** Layer(s) connected to the processor. */ + layers: FeatureLayer[]; + /** Pass features back to layer without delay before processing. */ + passFeatures: boolean; + /** Require support for Worker in order to use this processor. */ + requireWorkerSupport: boolean; + /** + * Creates a processor. + * @param options Configuration options for the processor. + */ + constructor(options?: esri.ProcessorOptions); + /** + * Add layer to processor. + * @param layer FeatureLayer to be added. + */ + addLayer(layer: FeatureLayer): void; + /** + * Remove layer from processor. + * @param layer FeatureLayer to be removed. + */ + removeLayer(layer: FeatureLayer): void; + /** + * Synchronize the layers the processor handles with the map's GraphicsLayer and GraphicsLayer subclasses (FeatureLayer etc). + * @param map The map instance to synchronize layers with. + */ + setMap(map: Map): void; + /** Start the processor. */ + start(): void; + /** Stop the processor. */ + stop(): void; + /** Unset the map and detach processor from all layers. */ + unsetMap(): void; + /** Fires when the processor is started. */ + on(type: "start", listener: (event: { target: Processor }) => void): esri.Handle; + /** Fires when the processor is stopped. */ + on(type: "stop", listener: (event: { target: Processor }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Processor; +} + +declare module "esri/process/SpatialIndex" { + import esri = require("esri"); + import Processor = require("esri/process/Processor"); + import Point = require("esri/geometry/Point"); + import Graphic = require("esri/graphic"); + import Extent = require("esri/geometry/Extent"); + + /** Builds and maintains a spatial index of feature geometry in one or more FeatureLayer. */ + class SpatialIndex extends Processor { + /** + * Creates a SpatialIndex. + * @param options Configuration options for the processor. + */ + constructor(options?: esri.SpatialIndexOptions); + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: Point, layerId?: string, getRects?: boolean): any; + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: Graphic, layerId?: string, getRects?: boolean): any; + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: Extent, layerId?: string, getRects?: boolean): any; + /** + * Searches index for items which intersect the test object. + * @param test The point or area to intersect. + * @param layerId ID assigned to the layer. + * @param getRects Whether to get the rectangle object with data in leaf, otherwise just get the stored data. + */ + intersects(test: number[], layerId?: string, getRects?: boolean): any; + /** + * Searches for the nearest point(s) to the passed point within the specified criteria. + * @param criteria See the object specifications table below for the structure of the criteria object. + * @param layerId ID assigned to the layer. + */ + nearest(criteria: any, layerId?: string): any; + } + export = SpatialIndex; +} + +declare module "esri/renderers/ClassBreaksRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** A class breaks renderer symbolizes each graphic based on the value of some numeric attribute. */ + class ClassBreaksRenderer extends Renderer { + /** Attribute field renderer uses to match values. */ + attributeField: string; + /** To symbolize polygon features with graduated symbols, use backgroundFillSymbol to specify a simple fill symbol to represent polygon features, and use marker symbols of varying sizes in class breaks to indicate the quantity. */ + backgroundFillSymbol: FillSymbol; + /** Deprecated at v2.0, use infos instead. */ + breaks: any[]; + /** The classification method used to generate class breaks. */ + classificationMethod: string; + /** Default symbol used when a value or break cannot be matched. */ + defaultSymbol: Symbol; + /** Each element in the array is an object that provides information about the class breaks associated with the renderer. */ + infos: any[]; + /** Include graphics with attribute values equal to the max value of a class in that class. */ + isMaxInclusive: boolean; + /** When normalizationType is "field", this property contains the attribute field name used for normalization. */ + normalizationField: string; + /** When normalizationType is "percent-of-total", this property contains the total of all data values. */ + normalizationTotal: number; + /** Indicates how the data is normalized. */ + normalizationType: string; + /** + * Creates a new ClassBreaksRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against class breaks. + */ + constructor(defaultSymbol: Symbol, attributeField: string); + /** + * Creates a new ClassBreaksRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against class breaks. + */ + constructor(defaultSymbol: Symbol, attributeField: Function); + /** + * Creates a new ClassBreaksRenderer. + * @param json JSON object representing the ClassBreaksRenderer. + */ + constructor(json: Object); + /** + * Adds a class break. + * @param minValueOrInfo The value can be provided as individual arguments or as an info object. + * @param maxValue Maximum value in the break. + * @param symbol Symbol used for the break. + */ + addBreak(minValueOrInfo: number, maxValue?: number, symbol?: Symbol): void; + /** + * Adds a class break. + * @param minValueOrInfo The value can be provided as individual arguments or as an info object. + * @param maxValue Maximum value in the break. + * @param symbol Symbol used for the break. + */ + addBreak(minValueOrInfo: any, maxValue?: number, symbol?: Symbol): void; + /** Remove all existing class breaks for this renderer. */ + clearBreaks(): void; + /** + * Returns the index at which rendering and legend information can be found in the break infos array for the given graphic. + * @param graphic The graphic whose rendering and legend information index in the break infos array will be returned. + */ + getBreakIndex(graphic: Graphic): number; + /** + * Returns rendering and legend information (as defined by the renderer) associated with the given graphic. + * @param graphic The graphic whose rendering and legend information will be returned. + */ + getBreakInfo(graphic: Graphic): any; + /** + * Removes a break. + * @param minValue Minimum value in the break to remove. + * @param maxValue Maximum value in the break to remove. + */ + removeBreak(minValue: number, maxValue: number): void; + /** + * A graphic or feature is considered a match for a class break for the first break where the graphic's attribute value is greater than or equal to the class's min value and less than or equal to the class's max value. + * @param enable Set true to enable the max inclusive behavior. + */ + setMaxInclusive(enable: boolean): void; + } + export = ClassBreaksRenderer; +} + +declare module "esri/renderers/DotDensityRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + import Color = require("esri/Color"); + import LineSymbol = require("esri/symbols/LineSymbol"); + + /** The DotDensityRenderer provides the ability to create dot density visualizations on data. */ + class DotDensityRenderer extends Renderer { + /** The color to be used for the background of the symbol. */ + backgroundColor: Color; + /** The shape to be used for the dot. */ + dotShape: string; + /** The size of the dot in pixels. */ + dotSize: number; + /** The value that a dot represents. */ + dotValue: number; + /** An array of objects, where each object defines a field to be mapped and its color. */ + fields: any[]; + /** The line symbol to use on the outline of the feature. */ + outline: LineSymbol; + /** + * Creates a new instance of dot density renderer. + * @param params An object with various options. + */ + constructor(params: esri.DotDensityRendererOptions); + /** + * Updates the background color of the shape. + * @param color Background color. + */ + setBackgroundColor(color: Color): void; + /** + * Updates the size of the dot. + * @param size The size of the dot in pixels. + */ + setDotSize(size: number): void; + /** + * Updates the value that a dot represents. + * @param value The value that a dot represents. + */ + setDotValue(value: number): void; + /** + * Updates the outline symbol of the shape. + * @param outline The line symbol to use on the outline of the feature. + */ + setOutline(outline: LineSymbol): void; + } + export = DotDensityRenderer; +} + +declare module "esri/renderers/HeatmapRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + + /** The HeatmapRenderer renders point data into a raster visualization that emphasizes areas of higher density or weighted values. */ + class HeatmapRenderer extends Renderer { + /** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */ + blurRadius: number; + /** An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). */ + colors: string[]; + /** An array of colorStop objects describing the renderer's color ramp with more specificity than just colors. */ + colorStops: any[]; + /** The name of the attribute field used to weight the heatmap points. */ + field: string; + /** The pixel intensity value which is assigned the final color in the color ramp. */ + maxPixelIntensity: number; + /** The pixel intensity value which is assigned the initial color in the color ramp. */ + minPixelIntensity: number; + /** + * Creates a new HeatmapRenderer object from json. + * @param options A parameterized list of options for constructing a HeatmapRenderer. + */ + constructor(options: esri.HeatmapRendererOptions); + /** + * Set the renderer's blur radius. + * @param blurRadius The radius (in pixels) of the circle over which the majority of each points value is spread out over. + */ + setBlurRadius(blurRadius: number): void; + /** + * Set the colors used to interpolate the color ramp of the renderer. + * @param colors An array of CSS color strings (#RGB, #RRGGBB, rgb(r,g,b), rgba(r,g,b,a)). + */ + setColors(colors: string[]): void; + /** + * Sets the colorStops property and returns the HeatmapRenderer instance to allow method chaining. + * @param stops An array of colorStop objects describing the renderer's color ramp with more specificity than just colors. + */ + setColorStops(stops: any[]): HeatmapRenderer; + /** + * Set the attribute field that the renderer uses to determine the weight on the heatmap points. + * @param field The name of the attribute field used to weight the heatmap points. + */ + setField(field: string): void; + /** + * Set the renderer's maxPixelIntensity. + * @param maxPixelIntensity The pixel intensity value which is assigned the final color in the color ramp. + */ + setMaxPixelIntensity(maxPixelIntensity: number): void; + /** + * Set the renderer's minPixelIntensity. + * @param minPixelIntensity The pixel intensity value which is assigned the initial color in the color ramp. + */ + setMinPixelIntensity(minPixelIntensity: number): void; + /** Returns the JSON string representation of the renderer's options. */ + toJson(): string; + } + export = HeatmapRenderer; +} + +declare module "esri/renderers/Renderer" { + import Graphic = require("esri/graphic"); + import Color = require("esri/Color"); + import Symbol = require("esri/symbols/Symbol"); + + /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, and TemporalRenderer used with a GraphicsLayer and FeatureLayer. */ + class Renderer { + /** An object defining a color ramp used to render the layer. */ + colorInfo: any; + /** An object that describes how opacity of features is calculated. */ + opacityInfo: any; + /** Defines how marker symbols are rotated. */ + rotationInfo: any; + /** Defines the size of the symbol where feature size is proportional to data value. */ + sizeInfo: any; + /** + * Gets the color for the Graphic. + * @param graphic Graphic to get color from. + */ + getColor(graphic: Graphic): Color; + /** + * Returns the opacity value for the specified graphic. + * @param graphic Returns the opacity value appropriate for the given graphic. + */ + getOpacity(graphic: Graphic): number; + /** + * Returns the angle of rotation (in degrees) for the graphic calculated using rotationInfo. + * @param graphic An input graphic for which you want to get the angle of rotation. + */ + getRotationAngle(graphic: Graphic): number; + /** + * Return the symbol size (in pixels) for the graphic, calculated using sizeInfo. + * @param graphic The graphic for which you want to calculate the symbol size. + */ + getSize(graphic: Graphic): number; + /** + * Gets the symbol for the Graphic. + * @param graphic Graphic to symbolize. + */ + getSymbol(graphic: Graphic): Symbol; + /** + * Sets the colorInfo property. + * @param info An info object that defines the color. + */ + setColorInfo(info: any): Renderer; + /** + * Sets opacity info for the renderer as defined by the info parameter. + * @param info The info parameter is an object with the same properties as opacityInfo. + */ + setOpacityInfo(info: any): Renderer; + /** + * Modifies rotation info for the renderer. + * @param info An object with the same properties as rotationInfo. + */ + setRotationInfo(info: any): Renderer; + /** Set size info of the renderer to modify the symbol size based on data value. */ + setSizeInfo(): Renderer; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Renderer; +} + +declare module "esri/renderers/ScaleDependentRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + import Graphic = require("esri/graphic"); + + /** ScaleDependentRenderer provides the capability to apply multiple scale-dependent renderers to a layer. */ + class ScaleDependentRenderer extends Renderer { + /** Indicates whether rendererInfos uses zoom range or scale range. */ + rangeType: string; + /** An array of objects, where each object defines a renderer and the zoom/scale range to which it applies. */ + rendererInfos: any; + /** + * Create a ScaleDependentRenderer. + * @param options Various options to configure this renderer. + */ + constructor(options?: esri.ScaleDependentRendererOptions); + /** + * Adds the specified renderer info to the array of existing renderers. + * @param info An object as defined in the rendererInfos property. + */ + addRendererInfo(info: any): ScaleDependentRenderer; + /** + * Returns the renderer info for the input graphic. + * @param graphic The graphic for which you want to get renderer info. + */ + getRendererInfo(graphic: Graphic): any; + /** + * Returns the renderer info for the specified scale. + * @param scale Returns the renderer info for the specified scale. + */ + getRendererInfoByScale(scale: number): any; + /** + * Returns the rendererInfo for the specified zoom level. + * @param zoom Specify the zoom level for which you want to retrieve the renderer info. + */ + getRenderInfoByZoom(zoom: number): any; + /** + * Replaces existing rendererInfos with new ones. + * @param infos An array of objects as defined in the rendererInfos property. + */ + setRendererInfos(infos: any): ScaleDependentRenderer; + } + export = ScaleDependentRenderer; +} + +declare module "esri/renderers/SimpleRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import Symbol = require("esri/symbols/Symbol"); + + /** A renderer that uses one symbol only. */ + class SimpleRenderer extends Renderer { + /** Description for the renderer. */ + description: string; + /** Label for the renderer. */ + label: string; + /** The symbol for the renderer. */ + symbol: Symbol; + /** + * Creates a new SimpleRenderer object with a Symbol parameter. + * @param symbol Symbol to use for the renderer. + */ + constructor(symbol: Symbol); + /** + * Creates a new Simple Renderer. + * @param json JSON object representing the SimpleRenderer. + */ + constructor(json: Object); + } + export = SimpleRenderer; +} + +declare module "esri/renderers/SymbolAger" { + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** Base class for agers. */ + class SymbolAger { + /** + * All subclasses override this method to provide their own implementation to calculate aging and return the appropriate symbol. + * @param symbol The symbol to age. + * @param graphic Feature being rendered. + */ + getAgedSymbol(symbol: Symbol, graphic: Graphic): Symbol; + } + export = SymbolAger; +} + +declare module "esri/renderers/TemporalRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import SymbolAger = require("esri/renderers/SymbolAger"); + import Graphic = require("esri/graphic"); + import Symbol = require("esri/symbols/Symbol"); + + /** Temporal renderers provide time-based rendering of features in a feature layer. */ + class TemporalRenderer extends Renderer { + /** + * Creates a new TemporalRenderer object that can be used with a time-aware feature layer. + * @param observationRenderer Renderer for regular/historic observations. + * @param latestObservationRenderer Renderer for the most current observations.In the snippet below RouteID is the field that contains the trackID for the feature layer this is used to display the latest observation for the specified tracks. + * @param trackRenderer Renderer for the tracks. + * @param observationAger Symbol ager for regular observations. + */ + constructor(observationRenderer: Renderer, latestObservationRenderer?: Renderer, trackRenderer?: Renderer, observationAger?: SymbolAger); + /** + * Returns the symbol used to render the graphic. + * @param graphic The input graphic. + */ + getSymbol(graphic: Graphic): Symbol; + } + export = TemporalRenderer; +} + +declare module "esri/renderers/TimeClassBreaksAger" { + import SymbolAger = require("esri/renderers/SymbolAger"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** Time class breaks ager displays aging by classifying features based on an age range. */ + class TimeClassBreaksAger extends SymbolAger { + /** Time breaks are measured in days. */ + static UNIT_DAYS: any; + /** Time breaks are measured in hours. */ + static UNIT_HOURS: any; + /** Time breaks are measured in milliseconds. */ + static UNIT_MILLISECONDS: any; + /** Time breaks are measured in minutes. */ + static UNIT_MINUTES: any; + /** Time breaks are measured in months. */ + static UNIT_MONTHS: any; + /** Time breaks are measured in seconds. */ + static UNIT_SECONDS: any; + /** Time breaks are measured in weeks. */ + static UNIT_WEEKS: any; + /** Time breaks are measured in years. */ + static UNIT_YEARS: any; + /** + * Creates a new TimeClassBreaksAgerObject with the specified time breaks inforamtion. + * @param infos Each element in the array is an object that describes the class breaks information. + * @param timeUnits The unit in which the minimum and maximum break values are measured. + */ + constructor(infos: any[], timeUnits?: string); + /** + * Calculates aging and returns the appropriate symbol. + * @param symbol The symbol to age. + * @param graphic Feature being rendered. + */ + getAgedSymbol(symbol: Symbol, graphic: Graphic): Symbol; + } + export = TimeClassBreaksAger; +} + +declare module "esri/renderers/TimeRampAger" { + import SymbolAger = require("esri/renderers/SymbolAger"); + import Color = require("esri/Color"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** Time ramp agers display aging using a gradual change in symbology. */ + class TimeRampAger extends SymbolAger { + /** + * Creates a new TimeRampAger object with the specified color and size ranges. + * @param colorRange An array containing the minimum and maximum color values. + * @param sizeRange An array containing the minimum and maximum size in pixels. + * @param alphaRange An array containing the minimum and maximum alpha opacity values. + */ + constructor(colorRange?: Color[], sizeRange?: number[], alphaRange?: number[]); + /** + * Calculates aging and returns the appropriate symbol. + * @param symbol The symbol to age. + * @param graphic Feature being rendered. + */ + getAgedSymbol(symbol: Symbol, graphic: Graphic): Symbol; + } + export = TimeRampAger; +} + +declare module "esri/renderers/UniqueValueRenderer" { + import Renderer = require("esri/renderers/Renderer"); + import Symbol = require("esri/symbols/Symbol"); + import Graphic = require("esri/graphic"); + + /** A unique value renderer symbolizes groups of graphics that have matching attributes. */ + class UniqueValueRenderer extends Renderer { + /** Attribute field renderer uses to match values. */ + attributeField: string; + /** If needed, specify an additional attribute field the renderer uses to match values. */ + attributeField2: string; + /** If needed, specify an additional attribute field the renderer uses to match values. */ + attributeField3: string; + /** Label for the default symbol used to draw unspecified values. */ + defaultLabel: string; + /** Default symbol used when a value or break cannot be matched. */ + defaultSymbol: Symbol; + /** String inserted between the values if multiple attribute fields are specified. */ + fieldDelimiter: string; + /** Each element in the array is an object that provides information about the unique values associated with the renderer. */ + infos: any[]; + /** Deprecated at v2.0, use infos instead. */ + values: string[]; + /** + * Creates a new UniqueValueRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against unique values. + * @param attributeField2 If needed, specify an additional attribute field the renderer uses to match values. + * @param attributeField3 If needed, specify an additional attribute field the renderer uses to match values. + * @param fieldDelimeter String inserted between the values of different fields. + */ + constructor(defaultSymbol: Symbol, attributeField: string, attributeField2?: string, attributeField3?: string, fieldDelimeter?: string); + /** + * Creates a new UniqueValueRenderer object. + * @param defaultSymbol Default symbol for the renderer. + * @param attributeField Specify either the attribute field the renderer uses to match values or starting at version 3.3, a function that returns a value to be compared against unique values. + * @param attributeField2 If needed, specify an additional attribute field the renderer uses to match values. + * @param attributeField3 If needed, specify an additional attribute field the renderer uses to match values. + * @param fieldDelimeter String inserted between the values of different fields. + */ + constructor(defaultSymbol: Symbol, attributeField: Function, attributeField2?: string, attributeField3?: string, fieldDelimeter?: string); + /** + * Creates a new Unique Value Renderer. + * @param json JSON object representing the UniqueValueRenderer. + */ + constructor(json: Object); + /** + * Adds a unique value and symbol. + * @param valueOrInfo Value to match with. + * @param symbol Symbol used for the value. + */ + addValue(valueOrInfo: string, symbol?: Symbol): void; + /** + * Adds a unique value and symbol. + * @param valueOrInfo Value to match with. + * @param symbol Symbol used for the value. + */ + addValue(valueOrInfo: any, symbol?: Symbol): void; + /** + * Returns rendering and legend information (as defined by the renderer) associated with the given graphic. + * @param graphic The graphic whose rendering and legend information will be returned. + */ + getUniqueValueInfo(graphic: Graphic): any; + /** + * Removes a unique value. + * @param value Value to remove. + */ + removeValue(value: string): void; + } + export = UniqueValueRenderer; +} + +declare module "esri/renderers/VectorFieldRenderer" { + import esri = require("esri"); + import Renderer = require("esri/renderers/Renderer"); + + /** The VectorFieldRenderer function symbolizes a U-V or Magnitude-Direction data. */ + class VectorFieldRenderer extends Renderer { + /** Flow from angle */ + static FLOW_FROM: any; + /** Flow to angle */ + static FLOW_TO: any; + /** Beaufort point symbol (feet) */ + static STYLE_BEAUFORT_FEET: any; + /** Beaufort point symbol (kilometers) */ + static STYLE_BEAUFORT_KM: any; + /** Beaufort point symbol (knots) */ + static STYLE_BEAUFORT_KN: any; + /** Beaufort point symbol (meters) */ + static STYLE_BEAUFORT_METER: any; + /** Beaufort point symbol (miles) */ + static STYLE_BEAUFORT_MILE: any; + /** Classified arrow point symbol */ + static STYLE_CLASSIFIED_ARROW: any; + /** Ocean current point symbol (knots) */ + static STYLE_OCEAN_CURRENT_KN: any; + /** Ocean current point symbol (meters) */ + static STYLE_OCEAN_CURRENT_M: any; + /** Simple scalar point symbol */ + static STYLE_SCALAR: any; + /** Single arrow point symbol */ + static STYLE_SINGLE_ARROW: any; + /** Barb wind speed point symbol */ + static STYLE_WIND_BARBS: any; + /** + * Creates a new VectorFieldRenderer object. + * @param options Optional parameters. + */ + constructor(options?: esri.VectorFieldRendererOptions); + } + export = VectorFieldRenderer; +} + +declare module "esri/renderers/jsonUtils" { + import Renderer = require("esri/renderers/Renderer"); + + /** Utility method to create a renderer from JSON. */ + var jsonUtils: { + /** + * Converts the input JSON object to the appropriate esri.renderer.* object. + * @param json The JSON object. + */ + fromJson(json: Object): Renderer; + }; + export = jsonUtils; +} + +declare module "esri/renderers/smartMapping" { + /** This module contains a collection of helper functions used to create pre-configured renderers for smart feature styling. */ + var smartMapping: { + /** + * Creates a renderer for visualizing features using colors. + * @param params See the object specifications table below for the structure of the params object. + */ + createClassedColorRenderer(params: any): any; + /** + * Creates a renderer for visualizing features by varying their size. + * @param params See the object specifications table below for the structure of the params object. + */ + createClassedSizeRenderer(params: any): any; + /** + * Creates a renderer for visualizing features using colors. + * @param params See the object specifications table below for the structure of the params object. + */ + createColorRenderer(params: any): any; + /** + * Creates a renderer for visualizing features using heatmap. + * @param params See the object specifications table below for the structure of the params object. + */ + createHeatmapRenderer(params: any): any; + /** + * Creates a renderer for visualizing features by varying their size based on data. + * @param params See the object specifications table below for the structure of the params object. + */ + createSizeRenderer(params: any): any; + /** + * Creates a renderer for visualizing features by their type. + * @param params See the object specifications table below for the structure of the params object. + */ + createTypeRenderer(params: any): any; + }; + export = smartMapping; +} + +declare module "esri/request" { + /** Retrieve data from a remote server or upload a file. */ + var request: { + /** + * Retrieve data from a remote server or upload a file from a user's computer. + * @param request The request parameter is an object with the following properties that describe the request. + * @param options See the object specifications table below for the structure of the options object. + */ + (request: any, options?: any): any; + /** + * Define a callback function that will be called just before esri.request calls into dojo IO functions such as dojo.rawXhrPost and dojo.io.script.get. + * @param callbackFunction The callback function that will be executed prior to esri.request calls into dojo IO functions. + */ + setRequestPreCallback(callbackFunction: Function): void; + }; + export = request; +} + +declare module "esri/symbols/CartographicLineSymbol" { + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Color = require("esri/Color"); + + /** Line symbols are used to draw linear features on the graphics layer. */ + class CartographicLineSymbol extends SimpleLineSymbol { + /** Line ends square at the end point. */ + static CAP_BUTT: any; + /** Line is rounded just beyond the end point. */ + static CAP_ROUND: any; + /** Line is squared just beyond the end point. */ + static CAP_SQUARE: any; + /** The joined lines are beveled. */ + static JOIN_BEVEL: any; + /** The joined lines are not rounded or beveled. */ + static JOIN_MITER: any; + /** The joined lines are rounded. */ + static JOIN_ROUND: any; + /** The line is made of dashes. */ + static STYLE_DASH: any; + /** The line is made of a dash-dot pattern. */ + static STYLE_DASHDOT: any; + /** The line is made of a dash-dot-dot pattern. */ + static STYLE_DASHDOTDOT: any; + /** The line is made of dots. */ + static STYLE_DOT: any; + /** The line is made of a long dash pattern. */ + static STYLE_LONGDASH: any; + /** The line is made of a long dash-dot pattern. */ + static STYLE_LONGDASHDOT: any; + /** The line has no symbol. */ + static STYLE_NULL: any; + /** The line is made of a short dash pattern. */ + static STYLE_SHORTDASH: any; + /** The line is made of a short dash-dot pattern. */ + static STYLE_SHORTDASHDOT: any; + /** The line is made of a short dash-dot-dot pattern. */ + static STYLE_SHORTDASHDOTDOT: any; + /** The line is made of a short dot pattern. */ + static STYLE_SHORTDOT: any; + /** The line is solid. */ + static STYLE_SOLID: any; + /** The cap style. */ + cap: string; + /** The join style. */ + join: string; + /** Size threshold for showing mitered line joins. */ + miterLimit: string; + /** Creates a new empty CartographicLineSymbol object. */ + constructor(); + /** + * Creates a new CartographicLineSymbol object with parameters. + * @param style See Constants table for values. + * @param color Symbol color. + * @param width Width of the line in pixels. + * @param cap See Constants table for values. + * @param join See Constants table for values. + * @param miterLimit Size threshold for showing mitered line joins. + */ + constructor(style?: string, color?: Color, width?: number, cap?: string, join?: string, miterLimit?: string); + /** + * Creates a new CartographicLineSymbol object using a JSON object. + * @param json JSON object representing the CartographicLineSymbol. + */ + constructor(json: Object); + /** + * Sets the cap style. + * @param cap Cap style. + */ + setCap(cap: string): CartographicLineSymbol; + /** + * Sets the join style. + * @param join Join style. + */ + setJoin(join: string): CartographicLineSymbol; + /** + * Sets the size threshold for showing mitered line joins. + * @param miterLimit Miter limit. + */ + setMiterLimit(miterLimit: string): CartographicLineSymbol; + } + export = CartographicLineSymbol; +} + +declare module "esri/symbols/FillSymbol" { + import Symbol = require("esri/symbols/Symbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + + /** Fill symbols are used to draw polygon features on the graphics layer. */ + class FillSymbol extends Symbol { + /** Outline of the polygon. */ + outline: SimpleLineSymbol; + /** + * Sets the outline of the fill symbol. + * @param outline Symbol used for outline. + */ + setOutline(outline: SimpleLineSymbol): FillSymbol; + } + export = FillSymbol; +} + +declare module "esri/symbols/Font" { + /** Font used for text symbols added to the graphics layer. */ + class Font { + /** Text is in italics. */ + static STYLE_ITALIC: any; + /** Text style is normal. */ + static STYLE_NORMAL: any; + /** Text is slanted. */ + static STYLE_OBLIQUE: any; + /** Text variant is normal. */ + static VARIANT_NORMAL: any; + /** Text is in all small caps. */ + static VARIANT_SMALLCAPS: any; + /** Text weight is bold. */ + static WEIGHT_BOLD: any; + /** Text weight is extra bold. */ + static WEIGHT_BOLDER: any; + /** Text weight is lighter than normal. */ + static WEIGHT_LIGHTER: any; + /** Text weight is normal. */ + static WEIGHT_NORMAL: any; + /** Text decoration. */ + decoration: string; + /** Font family. */ + family: string; + /** Font size. */ + size: number; + /** Text style. */ + style: string; + /** Text variant. */ + variant: string; + /** Text weight. */ + weight: string; + /** Creates a new Font object. */ + constructor(); + /** + * Creates a new Font object. + * @param size Font size. + * @param style Font style. + * @param variant Font variant. + * @param weight Font weight. + * @param family Font family. + */ + constructor(size?: number, style?: string, variant?: string, weight?: string, family?: string); + /** + * Creates a new Font object. + * @param size Font size. + * @param style Font style. + * @param variant Font variant. + * @param weight Font weight. + * @param family Font family. + */ + constructor(size?: string, style?: string, variant?: string, weight?: string, family?: string); + /** + * Creates a new Font object using a JSON object. + * @param json JSON object representing the font. + */ + constructor(json: Object); + /** + * Updates the font with the given decoration. + * @param decoration Text decoration. + */ + setDecoration(decoration: string): Font; + /** + * Sets the font family. + * @param family Font family. + */ + setFamily(family: string): Font; + /** + * Sets the font size. + * @param size Font size. + */ + setSize(size: number): Font; + /** + * Sets the font size. + * @param size Font size. + */ + setSize(size: string): Font; + /** + * Sets the font style. + * @param style Font style. + */ + setStyle(style: string): Font; + /** + * Sets the font variant. + * @param variant Font variant. + */ + setVariant(variant: string): Font; + /** + * Sets the font weight. + * @param weight Font weight. + */ + setWeight(weight: string): Font; + } + export = Font; +} + +declare module "esri/symbols/LineSymbol" { + import Symbol = require("esri/symbols/Symbol"); + + /** Line symbols are used to draw linear features on the graphics layer. */ + class LineSymbol extends Symbol { + /** Width of line symbol in pixels. */ + width: number; + /** + * Sets the LineSymbol width. + * @param width Width of line symbol in pixels. + */ + setWidth(width: number): LineSymbol; + } + export = LineSymbol; +} + +declare module "esri/symbols/MarkerSymbol" { + import Symbol = require("esri/symbols/Symbol"); + + /** Marker symbols are used to draw points and multipoints on the graphics layer. */ + class MarkerSymbol extends Symbol { + /** The angle of the marker. */ + angle: number; + /** Size of the marker in pixels. */ + size: number; + /** The offset on the x-axis in pixels. */ + xoffset: number; + /** The offset on the y-axis in pixels. */ + yoffset: number; + /** + * Rotates the symbol clockwise around its center by the specified angle. + * @param angle The angle value. + */ + setAngle(angle: number): MarkerSymbol; + /** + * Sets the x and y offset of a marker in screen units. + * @param x The X offset value in pixels. + * @param y The Y offset value in pixels. + */ + setOffset(x: number, y: number): MarkerSymbol; + /** + * Sets the size of a marker in pixels. + * @param size The width of the symbol in pixels. + */ + setSize(size: number): MarkerSymbol; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = MarkerSymbol; +} + +declare module "esri/symbols/PictureFillSymbol" { + import FillSymbol = require("esri/symbols/FillSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + + /** Fill symbols are used to draw polygon features on the graphics layer. */ + class PictureFillSymbol extends FillSymbol { + /** Height of the image in pixels. */ + height: number; + /** URL of the image. */ + url: string; + /** Width of the image in pixels. */ + width: number; + /** The offset on the x-axis in pixels. */ + xoffset: number; + /** Scale factor in x direction. */ + xscale: number; + /** The offset on the y-axis in pixels. */ + yoffset: number; + /** Scale factor in y direction. */ + yscale: number; + /** + * Creates a new PictureFillSymbol object. + * @param url URL of the image. + * @param outline Outline of the symbol. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + */ + constructor(url: string, outline: SimpleLineSymbol, width: number, height: number); + /** + * Creates a new PictureFillSymbol object using a JSON object. + * @param json JSON object representing the PictureFillSymbol. + */ + constructor(json: Object); + /** + * Sets the height of the symbol. + * @param height Height in pixels. + */ + setHeight(height: number): PictureFillSymbol; + /** + * Sets the symbol offset. + * @param x Offset in x direction in pixels. + * @param y Offset in y direction in pixels. + */ + setOffset(x: number, y: number): PictureFillSymbol; + /** + * Sets the URL to the location of the symbol. + * @param url URL string. + */ + setUrl(url: string): PictureFillSymbol; + /** + * Sets the width of the symbol. + * @param width Width in pixels. + */ + setWidth(width: number): PictureFillSymbol; + /** + * Sets the scale factor in x direction. + * @param scale Scale factor in x direction. + */ + setXScale(scale: number): PictureFillSymbol; + /** + * Sets the scale factor in y direction. + * @param scale Scale factor in y direction. + */ + setYScale(scale: number): PictureFillSymbol; + } + export = PictureFillSymbol; +} + +declare module "esri/symbols/PictureMarkerSymbol" { + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + + /** Marker symbols are used to draw points and multipoints on the graphics layer. */ + class PictureMarkerSymbol extends MarkerSymbol { + /** Height of the image in pixels. */ + height: number; + /** URL of the image. */ + url: string; + /** Width of the image in pixels. */ + width: number; + /** + * Creates a new PictureMarkerSymbol object. + * @param url URL of the image. + * @param width Width of the image in pixels. + * @param height Height of the image in pixels. + */ + constructor(url: string, width: number, height: number); + /** + * Creates a new PictureMarkerSymbol object using a JSON object. + * @param json JSON object representing the PictureMarkerSymbol. + */ + constructor(json: Object); + /** + * Sets the height of the image for display. + * @param height Height of marker in pixels. + */ + setHeight(height: number): PictureMarkerSymbol; + /** + * Sets the URL where the image is located. + * @param url URL location of marker image. + */ + setUrl(url: string): PictureMarkerSymbol; + /** + * Sets the width of the image for display. + * @param width Width of marker in pixels. + */ + setWidth(width: number): PictureMarkerSymbol; + } + export = PictureMarkerSymbol; +} + +declare module "esri/symbols/SimpleFillSymbol" { + import FillSymbol = require("esri/symbols/FillSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Color = require("esri/Color"); + + /** Fill symbols are used to draw polygon features on the graphics layer. */ + class SimpleFillSymbol extends FillSymbol { + /** The fill is backward diagonal lines. */ + static STYLE_BACKWARD_DIAGONAL: any; + /** The fill is a cross. */ + static STYLE_CROSS: any; + /** The fill is a diagonal cross. */ + static STYLE_DIAGONAL_CROSS: any; + /** The fill is forward diagonal lines. */ + static STYLE_FORWARD_DIAGONAL: any; + /** The fill is horizontal lines. */ + static STYLE_HORIZONTAL: any; + /** The polygon has no fill. */ + static STYLE_NULL: any; + /** The fill is solid. */ + static STYLE_SOLID: any; + /** The fill is vertical lines. */ + static STYLE_VERTICAL: any; + /** The fill style. */ + style: string; + /** Creates a new empty SimpleFillSymbol object. */ + constructor(); + /** + * Creates a new SimpleFillSymbol object with parameters. + * @param style See Constants table for values. + * @param outline See SimpleLineSymbol. + * @param color Symbol color. + */ + constructor(style: string, outline: SimpleLineSymbol, color: Color); + /** + * Creates a new SimpleFillSymbol object using a JSON object. + * @param json JSON object representing the SimpleFillSymbol. + */ + constructor(json: Object); + /** + * Sets the fill symbol style. + * @param style Fill style. + */ + setStyle(style: string): SimpleFillSymbol; + } + export = SimpleFillSymbol; +} + +declare module "esri/symbols/SimpleLineSymbol" { + import LineSymbol = require("esri/symbols/LineSymbol"); + import Color = require("esri/Color"); + + /** Line symbols are used to draw linear features on the graphics layer. */ + class SimpleLineSymbol extends LineSymbol { + /** The line is made of dashes. */ + static STYLE_DASH: any; + /** The line is made of a dash-dot pattern. */ + static STYLE_DASHDOT: any; + /** The line is made of a dash-dot-dot pattern. */ + static STYLE_DASHDOTDOT: any; + /** The line is made of dots. */ + static STYLE_DOT: any; + /** Line is constructed of a series of dashes. */ + static STYLE_LONGDASH: any; + /** Line is constructed of a series of short dashes. */ + static STYLE_LONGDASHDOT: any; + /** The line has no symbol. */ + static STYLE_NULL: any; + /** Line is constructed of a series of short dashes. */ + static STYLE_SHORTDASH: any; + /** Line is constructed of a dash followed by a dot. */ + static STYLE_SHORTDASHDOT: any; + /** Line is constructed of a series of a dash and two dots. */ + static STYLE_SHORTDASHDOTDOT: any; + /** Line is constructed of a series of short dots. */ + static STYLE_SHORTDOT: any; + /** The line is solid. */ + static STYLE_SOLID: any; + /** The line style. */ + style: string; + /** Creates a new empty SimpleLineSymbol object. */ + constructor(); + /** + * Creates a new SimpleLineSymbol object with parameters. + * @param style See Constants table for values. + * @param color Symbol color. + * @param width Width of the line in pixels. + */ + constructor(style: string, color: Color, width: number); + /** + * Creates a new SimpleLineSymbol object using a JSON object. + * @param json JSON object representing the SimpleLineSymbol. + */ + constructor(json: Object); + /** + * Sets the line symbol style. + * @param style Line style. + */ + setStyle(style: string): SimpleLineSymbol; + } + export = SimpleLineSymbol; +} + +declare module "esri/symbols/SimpleMarkerSymbol" { + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import Color = require("esri/Color"); + + /** Marker symbols are used to draw points and multipoints on the graphics layer. */ + class SimpleMarkerSymbol extends MarkerSymbol { + /** The marker is a circle. */ + static STYLE_CIRCLE: any; + /** The marker is a cross. */ + static STYLE_CROSS: any; + /** The marker is a diamond. */ + static STYLE_DIAMOND: any; + /** The marker is a shape defined using an SVG Path string. */ + static STYLE_PATH: any; + /** The marker is a square. */ + static STYLE_SQUARE: any; + /** The marker is a diagonal cross. */ + static STYLE_X: any; + /** Outline of the marker. */ + outline: SimpleLineSymbol; + /** Size of the marker in pixels. */ + size: number; + /** The marker style. */ + style: string; + /** Creates a new empty SimpleMarkerSymbol object. */ + constructor(); + /** + * Creates a new SimpleMarkerSymbol object with parameters. + * @param style See Constants table for values. + * @param size Size of the marker in pixels. + * @param outline See SimpleLineSymbol. + * @param color Symbol color. + */ + constructor(style: string, size: number, outline: SimpleLineSymbol, color: Color); + /** + * Creates a new SimpleMarkerSymbol object using a JSON object. + * @param json JSON object representing the SimpleMarkerSymbol. + */ + constructor(json: Object); + /** + * Sets the outline of the marker symbol. + * @param outline Symbol used for outline. + */ + setOutline(outline: SimpleLineSymbol): SimpleMarkerSymbol; + /** + * Sets the marker shape to the given path string and switches the marker style to STYLE_PATH. + * @param path SVG path of the icon. + */ + setPath(path: string): SimpleMarkerSymbol; + /** + * Sets the marker symbol style. + * @param style Marker style. + */ + setStyle(style: string): SimpleMarkerSymbol; + } + export = SimpleMarkerSymbol; +} + +declare module "esri/symbols/Symbol" { + import Color = require("esri/Color"); + + /** Symbols are used to display points, lines, and polygons on the graphics layer. */ + class Symbol { + /** Symbol color. */ + color: Color; + /** The type of symbol. */ + type: string; + /** + * Sets the symbol color. + * @param color Symbol color. + */ + setColor(color: Color): Symbol; + /** Converts object to its ArcGIS Server JSON representation. */ + toJson(): any; + } + export = Symbol; +} + +declare module "esri/symbols/TextSymbol" { + import Symbol = require("esri/symbols/Symbol"); + import Font = require("esri/symbols/Font"); + import Color = require("esri/Color"); + + /** Text symbols are used to add text on the graphics layer. */ + class TextSymbol extends Symbol { + /** The end of the text string is aligned with the point. */ + static ALIGN_END: any; + /** The center of the text string is aligned with the point. */ + static ALIGN_MIDDLE: any; + /** The beginning of the text string is aligned with the point. */ + static ALIGN_START: any; + /** Text has a lined striked through it. */ + static DECORATION_LINETHROUGH: any; + /** Text has no decoration. */ + static DECORATION_NONE: any; + /** Text has a line along the top. */ + static DECORATION_OVERLINE: any; + /** Text is underlined. */ + static DECORATION_UNDERLINE: any; + /** The text alignment in relation to the point. */ + align: string; + /** Text angle. */ + angle: number; + /** The decoration on the text. */ + decoration: string; + /** Font for displaying text. */ + font: Font; + /** Horizontal alignment of the text with respect to the graphic. */ + horizontalAlignment: string; + /** Determines whether to adjust the spacing between characters in the text string. */ + kerning: boolean; + /** Determines whether every character in the text string is rotated. */ + rotated: boolean; + /** Text string for display in the graphics layer. */ + text: string; + /** Vertical alignment of the text with respect to the graphic. */ + verticalAlignment: string; + /** The offset on the x-axis in pixels from the point. */ + xoffset: number; + /** The offset on the y-axis in pixels from the point. */ + yoffset: number; + /** + * Creates a new TextSymbol object that includes only the text. + * @param text Text string for display in the graphics layer. + */ + constructor(text: string); + /** + * Creates a new TextSymbol object. + * @param text Text string for display in the graphics layer. + * @param font Font for displaying text. + * @param color Symbol color. + */ + constructor(text: string, font: Font, color: Color); + /** + * Creates a new TextSymbol object using a JSON object. + * @param json JSON object representing the TextSymbol. + */ + constructor(json: Object); + /** + * Sets the alignment of the text. + * @param align The text alignment. + */ + setAlign(align: string): TextSymbol; + /** + * Sets the angle of the text. + * @param angle Angle value between 0 and 359. + */ + setAngle(angle: number): TextSymbol; + /** + * Sets the decoration for the text. + * @param decoration The decoration on the text. + */ + setDecoration(decoration: string): TextSymbol; + /** + * Sets the text font. + * @param font Text font. + */ + setFont(font: Font): TextSymbol; + /** + * Updates the horizontal alignment of the text symbol. + * @param alignment Horizontal alignment of the text with respect to the graphic. + */ + setHorizontalAlignment(alignment: string): TextSymbol; + /** + * Sets whether to adjust the spacing between characters in the text string. + * @param kerning Set to true for kerning. + */ + setKerning(kerning: boolean): TextSymbol; + /** + * Sets the x and y offset of the text. + * @param x X offset value in pixels. + * @param y Y offset value in pixels. + */ + setOffset(x: number, y: number): TextSymbol; + /** + * Sets whether every character in the text string is rotated. + * @param rotated Set to true to rotate all characters in the string. + */ + setRotated(rotated: boolean): TextSymbol; + /** + * Sets the text string. + * @param text The text string. + */ + setText(text: string): TextSymbol; + /** + * Updates the vertical alignment of the text symbol. + * @param alignment Vertical alignment of the text with respect to the graphic. + */ + setVerticalAlignment(alignment: string): TextSymbol; + } + export = TextSymbol; +} + +declare module "esri/symbols/jsonUtils" { + import Symbol = require("esri/symbols/Symbol"); + + /** Utility methods for working with symbols. */ + var jsonUtils: { + /** + * Converts input json into a symbol, returns null if the input json represents an unknown or unsupported symbol type. + * @param json The input JSON. + */ + fromJson(json: Object): Symbol; + /** + * Returns the shape description properties for the given symbol as defined by the Dojo GFX API. + * @param symbol The input symbol. + */ + getShapeDescriptors(symbol: Symbol): any; + }; + export = jsonUtils; +} + +declare module "esri/tasks/AddressCandidate" { + import Point = require("esri/geometry/Point"); + + /** Represents an address and its location. */ + class AddressCandidate { + /** Address of the candidate. */ + address: any; + /** Name value pairs of field name and field value as defined in outFields in Locator.addressToLocations. */ + attributes: any; + /** X- and y-coordinate of the candidate. */ + location: Point; + /** Numeric score between 0 and 100 for geocode candidates. */ + score: number; + } + export = AddressCandidate; +} + +declare module "esri/tasks/AlgorithmicColorRamp" { + import ColorRamp = require("esri/tasks/ColorRamp"); + import Color = require("esri/Color"); + + /** Create an algorithmic color ramp to define the range of colors used in the renderer generated by the GenerateRendererTask. */ + class AlgorithmicColorRamp extends ColorRamp { + /** The algorithm used to generate the colors between the fromColor and toColor. */ + algorithm: string; + /** The first color in the color ramp. */ + fromColor: Color; + /** The last color in the color ramp. */ + toColor: Color; + /** Creates a new AlgorithmicColorRamp object. */ + constructor(); + /** Returns an easily serializable object representation of an algorithmic color ramp. */ + toJson(): any; + } + export = AlgorithmicColorRamp; +} + +declare module "esri/tasks/AreasAndLengthsParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input parameters for the areasAndLengths() method on the Geometry Service. */ + class AreasAndLengthsParameters { + /** The area unit in which areas of polygons will be calculated. */ + areaUnit: any; + /** Defines the type of calculation for the geometry. */ + calculationType: string; + /** The length unit in which perimeters of polygons will be calculated. */ + lengthUnit: any; + /** Polygon geometries for which to compute areas and lengths */ + polygons: Geometry[]; + /** Creates a new AreasAndLengthsParameters object. */ + constructor(); + } + export = AreasAndLengthsParameters; +} + +declare module "esri/tasks/BufferParameters" { + import SpatialReference = require("esri/SpatialReference"); + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the distances, units, and other parameters for a buffer operation. */ + class BufferParameters { + /** The spatial reference in which the geometries are buffered. */ + bufferSpatialReference: SpatialReference; + /** The distances the input features are buffered. */ + distances: number[]; + /** If the input geometries are in geographic coordinate system set geodesic to true in order to generate a buffer polygon using a geodesic distance. */ + geodesic: boolean; + /** The input geometries to buffer. */ + geometries: Geometry[]; + /** The spatial reference for the returned geometries. */ + outSpatialReference: SpatialReference; + /** If true, all geometries buffered at a given distance are unioned into a single (possibly multipart) polygon, and the unioned geometry is placed in the output array. */ + unionResults: boolean; + /** The units for calculating each buffer distance. */ + unit: string; + /** Creates a new BufferParameters object. */ + constructor(); + } + export = BufferParameters; +} + +declare module "esri/tasks/ClassBreaksDefinition" { + import ClassificationDefinition = require("esri/tasks/ClassificationDefinition"); + import Symbol = require("esri/symbols/Symbol"); + import ColorRamp = require("esri/tasks/ColorRamp"); + + /** Define a class breaks classification scheme used by the GenerateRendererTask to generate classes. */ + class ClassBreaksDefinition extends ClassificationDefinition { + /** Define a default symbol for the classification. */ + baseSymbol: Symbol; + /** The number of class breaks. */ + breakCount: number; + /** The name of the field used to match values. */ + classificationField: string; + /** The name of the classification method. */ + classificationMethod: string; + /** Define a color ramp for the classification. */ + colorRamp: ColorRamp; + /** The name of the field that contains the values used to normalize class breaks when normalizationType is set to 'field'. */ + normalizationField: string; + /** The type of normalization used to normalize class breaks. */ + normalizationType: string; + /** The standard deviation interval. */ + standardDeviationInterval: number; + /** Creates a new ClassBreaksDefinition object */ + constructor(); + /** Returns an easily serializable object representation of the class breaks definition. */ + toJson(): any; + } + export = ClassBreaksDefinition; +} + +declare module "esri/tasks/ClassificationDefinition" { + import Symbol = require("esri/symbols/Symbol"); + import ColorRamp = require("esri/tasks/ColorRamp"); + + /** The super class for the classification definition objects used by the GenerateRendererTask class to generate data classes. */ + class ClassificationDefinition { + /** Define a default symbol for the classification. */ + baseSymbol: Symbol; + /** Define a color ramp for the classification. */ + colorRamp: ColorRamp; + /** The type of classification definition. */ + type: string; + } + export = ClassificationDefinition; +} + +declare module "esri/tasks/ClosestFacilityParameters" { + import SpatialReference = require("esri/SpatialReference"); + + /** Input parameters for the ClosestFacilityTask. */ + class ClosestFacilityParameters { + /** The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. */ + accumulateAttributes: string[]; + /** An array of attribute parameter values that determine which network elements can be used by a vehicle. */ + attributeParameterValues: any[]; + /** The cutoff value used to determine when to stop traversing. */ + defaultCutoff: number; + /** The number of facilities to find. */ + defaultTargetFacilityCount: number; + /** The language used when computing directions. */ + directionsLanguage: string; + /** The length units used when computing directions. */ + directionsLengthUnits: string; + /** Defines the amount of direction information returned. */ + directionsOutputType: string; + /** The style to be used when returning directions. */ + directionsStyleName: string; + /** The name of the attribute field that contains the drive time values. */ + directionsTimeAttribute: string; + /** When true, restricted network elements should be considered when finding network locations. */ + doNotLocateOnRestrictedElements: boolean; + /** The set of facilities loaded as network locations during analysis. */ + facilities: any; + /** The network attribute field name used as the impedance attribute during analysis. */ + impedenceAttribute: string; + /** The set of incidents loaded as network locations during analysis. */ + incidents: any; + /** The output geometry precision. */ + outputGeometryPrecision: number; + /** The units of the output geometry precision. */ + outputGeometryPrecisionUnits: string; + /** The type of output lines to be generated in the result. */ + outputLines: string; + /** The well-known id of the spatial reference for the geometries returned with the analysis results. */ + outSpatialReference: SpatialReference; + /** The set of point barriers loaded as network locations during analysis. */ + pointBarriers: any; + /** The set of polygon barriers loaded as network locations during analysis. */ + polygonBarriers: any; + /** The set of polyline barriers loaded as network locations during analysis. */ + polylineBarriers: any; + /** The list of network attribute names to be used as restrictions with the analysis. */ + restrictionAttributes: string[]; + /** Specifies how U-Turns should be handled. */ + restrictUTurns: string; + /** If true, directions will be generated and returned in the directions property of each RouteResult and RouteSolveResult. */ + returnDirections: boolean; + /** If true, facilities will be returned with the analysis results. */ + returnFacilities: boolean; + /** If true, incidents will be returned with the analysis results. */ + returnIncidents: boolean; + /** If true, barriers will be returned in the barriers property of the ClosestFacilitySolveResult. */ + returnPointBarriers: boolean; + /** If true, polygon barriers will be returned in the barriers property of the ClosestFacilitySolveResult. */ + returnPolygonBarriers: boolean; + /** If true, polyline barriers will be returned in the barriers property of the ClosestFacilitySolveResult. */ + returnPolylineBarriers: boolean; + /** When true, closest facility routes will be generated and returned in the route property of each ClosestFacilityResult and ClosestFacilitySolveResult. */ + returnRoutes: boolean; + /** The arrival or departure date and time. */ + timeOfDay: Date; + /** Defines the way the timeOfDay value is used. */ + timeOfDayUsage: string; + /** Options for traveling to or from the facility. */ + travelDirection: string; + /** If true, the hierarchy attribute for the network will be used in analysis. */ + useHierarchy: boolean; + /** Creates a new ClosestFacilityParameters object */ + constructor(); + } + export = ClosestFacilityParameters; +} + +declare module "esri/tasks/ClosestFacilitySolveResult" { + import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet"); + import Point = require("esri/geometry/Point"); + import NAMessage = require("esri/tasks/NAMessage"); + import Polygon = require("esri/geometry/Polygon"); + import Polyline = require("esri/geometry/Polyline"); + import Graphic = require("esri/graphic"); + + /** The result from a ClosestFacilityTask operation. */ + class ClosestFacilitySolveResult { + /** An array of directions. */ + directions: DirectionsFeatureSet; + /** An array of points, only returned when ClosestFacilityParameters.returnFacilities is true. */ + facilities: Point[]; + /** An array of points, only returned when ClosestFacilityParameters.returnIncidents is true. */ + incidents: Point[]; + /** Message received when the solve is complete. */ + messages: NAMessage[]; + /** The point barriers are an array of points. */ + pointBarriers: Point[]; + /** The polygon barriers are an array of polygons. */ + polygonBarriers: Polygon[]; + /** The polyline barriers are an array of polylines. */ + polylineBarriers: Polyline[]; + /** The array of routes. */ + routes: Graphic[]; + } + export = ClosestFacilitySolveResult; +} + +declare module "esri/tasks/ClosestFacilityTask" { + import esri = require("esri"); + import ClosestFacilityParameters = require("esri/tasks/ClosestFacilityParameters"); + import ClosestFacilitySolveResult = require("esri/tasks/ClosestFacilitySolveResult"); + + /** Helps you find closest facilities around any location (incident) on a network. */ + class ClosestFacilityTask { + /** + * Creates a new ClosestFacilityTask object. + * @param url URL to the ArcGIS Server REST resource that represents a network analysis service. + */ + constructor(url: string); + /** + * Solve the closest facility. + * @param params The ClosestFacilityParameters object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + solve(params: ClosestFacilityParameters, callback?: Function, errback?: Function): any; + /** Fires when ClosestFacilityTask has completed. */ + on(type: "solve-complete", listener: (event: { result: ClosestFacilitySolveResult; target: ClosestFacilityTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ClosestFacilityTask; +} + +declare module "esri/tasks/ColorRamp" { + /** Used to denote classes that may be used as a color ramp. */ + class ColorRamp { + /** A string value representing the color ramp type. */ + type: string; + } + export = ColorRamp; +} + +declare module "esri/tasks/DataFile" { + /** A geoprocessing data object containing a data source. */ + class DataFile { + /** The ID of the uploaded file returned as a result of the upload operation. */ + itemID: string; + /** URL to the location of the data file. */ + url: string; + /** Creates a new DataFile object. */ + constructor(); + } + export = DataFile; +} + +declare module "esri/tasks/DataLayer" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input for properties of ClosestFacilityParameters,RouteParameters or ServiceAreaParameters. */ + class DataLayer { + /** Part or all of a feature from feature class 1 is contained within a feature from feature class 2. */ + static SPATIAL_REL_CONTAINS: any; + /** The feature from feature class 1 crosses a feature from feature class 2. */ + static SPATIAL_REL_CROSSES: any; + /** The envelope of feature class 1 intersects with the envelope of feature class 2. */ + static SPATIAL_REL_ENVELOPEINTERSECTS: any; + /** The envelope of the query feature class intersects the index entry for the target feature class. */ + static SPATIAL_REL_INDEXINTERSECTS: any; + /** Part of a feature from feature class 1 is contained in a feature from feature class 2. */ + static SPATIAL_REL_INTERSECTS: any; + /** Features from feature class 1 overlap features in feature class 2. */ + static SPATIAL_REL_OVERLAPS: any; + /** The feature from feature class 1 touches the border of a feature from feature class 2. */ + static SPATIAL_REL_TOUCHES: any; + /** The feature from feature class 1 is completely enclosed by the feature from feature class 2. */ + static SPATIAL_REL_WITHIN: any; + /** The geometry to apply to the spatial filter. */ + geometry: Geometry; + /** The name of the data layer in the map service that is being referenced. */ + name: string; + /** The spatial relationship to be applied on the input geometry while performing the query. */ + spatialRelationship: string; + /** A where clause for the query. */ + where: string; + /** Creates a new DataLayer object. */ + constructor(); + } + export = DataLayer; +} + +declare module "esri/tasks/Date" { + /** Date used in geoprocessing. */ + class AGSDate { + /** Date value returned from server. */ + date: Date; + /** The format of the date used in the date property. */ + format: string; + /** Creates a new Date object. */ + constructor(); + } + export = AGSDate; +} + +declare module "esri/tasks/DensifyParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input parameters for the densify() method on the GeometryService - contains geometries, maxSegmentLength, and optionally lengthUnit, geodesic. */ + class DensifyParameters { + /** If true, GCS spatial references are used or densify geodesic is to be performed. */ + geodesic: boolean; + /** The array of geometries to be densified. */ + geometries: Geometry[]; + /** The length unit of maxSegmentLength, can be any esriUnits constant. */ + lengthUnit: any; + /** All segments longer than maxSegmentLength are replaced with sequences of lines no longer than maxSegmentLength. */ + maxSegmentLength: number; + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = DensifyParameters; +} + +declare module "esri/tasks/DirectionsFeatureSet" { + import FeatureSet = require("esri/tasks/FeatureSet"); + import Extent = require("esri/geometry/Extent"); + import Polyline = require("esri/geometry/Polyline"); + + /** A FeatureSet that has properties specific to routing. */ + class DirectionsFeatureSet extends FeatureSet { + /** The extent of the route. */ + extent: Extent; + /** A single polyline representing the route. */ + mergedGeometry: Polyline; + /** The ID of the route returned from the server. */ + routeId: string; + /** Name specified in RouteParameters.stops. */ + routeName: string; + /** Lists additional information about the direction depending on the value of directionsOutputType. */ + strings: any[]; + /** Actual drive time calculated for the route. */ + totalDriveTime: number; + /** The length of the route as specified in RouteParameters.directionsLengthUnits. */ + totalLength: number; + /** The total time calculated for the route as specified in RouteParameters.directionsTimeAttribute. */ + totalTime: number; + } + export = DirectionsFeatureSet; +} + +declare module "esri/tasks/DistanceParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Input parameters for the distance method on the GeometryService. */ + class DistanceParameters { + /** Specifies the units for measuring distance between geometry1 and geometry2. */ + distanceUnit: any; + /** When true, the geodesic distance between geometry1 and geometry2 is measured. */ + geodesic: boolean; + /** The geometry from which the distance is to measured. */ + geometry1: Geometry; + /** The geometry to which the distance is measured. */ + geometry2: Geometry; + /** Creates a new DistanceParameters object. */ + constructor(); + } + export = DistanceParameters; +} + +declare module "esri/tasks/FeatureSet" { + import Graphic = require("esri/graphic"); + import SpatialReference = require("esri/SpatialReference"); + + /** A collection of features returned from ArcGIS Server or used as input to tasks. */ + class FeatureSet { + /** The name of the layer's primary display field. */ + displayFieldName: string; + /** Typically a layer has a limit on the number of features (i.e., records) returned by the query operation. */ + exceededTransferLimit: boolean; + /** The array of graphics returned. */ + features: Graphic[]; + /** Set of name-value pairs for the attribute's field and alias names. */ + fieldAliases: any; + /** The geometry type of the FeatureSet. */ + geometryType: string; + /** When a FeatureSet is used as input to Geoprocessor, the spatial reference is set to the map's spatial reference by default. */ + spatialReference: SpatialReference; + /** Creates a new FeatureSet object. */ + constructor(); + /** + * Creates a new FeatureSet object using a JSON object. + * @param json A JSON object that contains feature set. + */ + constructor(json: Object); + } + export = FeatureSet; +} + +declare module "esri/tasks/FindParameters" { + import DynamicLayerInfo = require("esri/layers/DynamicLayerInfo"); + import SpatialReference = require("esri/SpatialReference"); + + /** This data object is used as the findParameters argument to FindTask.execute method. */ + class FindParameters { + /** The contains parameter determines whether to look for an exact match of the search text or not. */ + contains: boolean; + /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ + dynamicLayerInfos: DynamicLayerInfo[]; + /** Array of layer definition expressions that allows you to filter the features of individual layers. */ + layerDefinitions: string[]; + /** The layers to perform the find operation on. */ + layerIds: number[]; + /** The maximum allowable offset used for generalizing geometries returned by the find operation. */ + maxAllowableOffset: number; + /** The spatial reference of the output geometries. */ + outSpatialReference: SpatialReference; + /** If "true", the result set include the geometry associated with each result. */ + returnGeometry: boolean; + /** The names of the fields of a layer to search. */ + searchFields: string[]; + /** The search string text that is searched across the layers and the fields as specified in the layers and searchFields parameters. */ + searchText: string; + /** Creates a new FindParameters object. */ + constructor(); + } + export = FindParameters; +} + +declare module "esri/tasks/FindResult" { + import Graphic = require("esri/graphic"); + + /** Represents a result of a find operation. */ + class FindResult { + /** The name of the layer's primary display field. */ + displayFieldName: string; + /** The found feature. */ + feature: Graphic; + /** The name of the field that contains the search text. */ + foundFieldName: string; + /** Unique ID of the layer that contains the feature. */ + layerId: number; + /** The layer name that contains the feature. */ + layerName: string; + } + export = FindResult; +} + +declare module "esri/tasks/FindTask" { + import esri = require("esri"); + import FindParameters = require("esri/tasks/FindParameters"); + import FindResult = require("esri/tasks/FindResult"); + + /** Search a map service exposed by the ArcGIS Server REST API based on a string value. */ + class FindTask { + /** URL to the ArcGIS Server REST resource that represents a map service. */ + url: string; + /** + * Creates a new FindTask object. + * @param url URL to the ArcGIS Server REST resource that represents a layer in a service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.FindTaskOptions); + /** + * Sends a request to the ArcGIS REST map service resource to perform a search based on the FindParameters specified in the findParameters argument. + * @param findParameters Specifies the layers and fields that are used to search against. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(findParameters: FindParameters, callback?: Function, errback?: Function): any; + /** Fires when the find operation is complete. */ + on(type: "complete", listener: (event: { results: FindResult[]; target: FindTask }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: FindTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = FindTask; +} + +declare module "esri/tasks/GPMessage" { + /** Represents a message generated during the execution of a geoprocessing task. */ + class GPMessage { + /** esriJobMessageTypeAbort */ + static TYPE_ABORT: any; + /** esriGPMessageTypeEmpty */ + static TYPE_EMPTY: any; + /** esriGPMessageTypeError */ + static TYPE_ERROR: any; + /** esriGPMessageTypeInformative */ + static TYPE_INFORMATIVE: any; + /** TBA */ + static TYPE_PROCESS_DEFINITION: any; + /** TBA */ + static TYPE_PROCESS_START: any; + /** TBA */ + static TYPE_PROCESS_STOP: any; + /** esriGPMessageTypeWarning */ + static TYPE_WARNING: any; + /** A description of the geoprocessing message. */ + description: string; + /** The geoprocessing message type. */ + type: number; + } + export = GPMessage; +} + +declare module "esri/tasks/GeneralizeParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the geometries, maximum deviation and units for the generalize operation. */ + class GeneralizeParameters { + /** The maximum deviation unit. */ + deviationUnit: any; + /** The array of input geometries to generalize. */ + geometries: Geometry[]; + /** The maximum deviation for constructing a generalized geometry based on the input geometries. */ + maxDeviation: number; + /** Creates a new GeneralizeParameters object. */ + constructor(); + } + export = GeneralizeParameters; +} + +declare module "esri/tasks/GenerateRendererParameters" { + import ClassificationDefinition = require("esri/tasks/ClassificationDefinition"); + + /** Define the classification definition and optional where clause for the GenerateRendererTask operation. */ + class GenerateRendererParameters { + /** A ClassBreaksDefinition or UniqueValueDefinition classification definition used to generate the data classes. */ + classificationDefinition: ClassificationDefinition; + /** Indicate if the label should be formatted */ + formatLabel: boolean; + /** Round values for the renderer. */ + precision: number; + /** The label in the legend will have this prefix */ + prefix: string; + /** The label in the legend will have this at the end of each label */ + unitLabel: string; + /** A where clause used to generate the data classes. */ + where: string; + /** Creates a new GenerateRendererParameters object. */ + constructor(); + } + export = GenerateRendererParameters; +} + +declare module "esri/tasks/GenerateRendererTask" { + import esri = require("esri"); + import GenerateRendererParameters = require("esri/tasks/GenerateRendererParameters"); + import Renderer = require("esri/renderers/Renderer"); + + /** The GenerateRendererTask class creates a renderer based on a classification definition and optional where clause. */ + class GenerateRendererTask { + /** + * Creates a new GenerateRendererTask object. + * @param url URL to a layer in a map service or table. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.GenerateRendererTaskOptions); + /** + * Perform a classification on the layer or table resource. + * @param generateRendererParameters A GenerateRendererParameters object that defines the classification definition and an optional where clause. + * @param callback This function will be called when the operation is complete. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(generateRendererParameters: GenerateRendererParameters, callback?: Function, errback?: Function): any; + /** Fired when the classification operation is complete. */ + on(type: "complete", listener: (event: { renderer: Renderer; target: GenerateRendererTask }) => void): esri.Handle; + /** Fired when an error occurs during task execution. */ + on(type: "error", listener: (event: { error: Error; target: GenerateRendererTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GenerateRendererTask; +} + +declare module "esri/tasks/GeometryService" { + import esri = require("esri"); + import AreasAndLengthsParameters = require("esri/tasks/AreasAndLengthsParameters"); + import Polygon = require("esri/geometry/Polygon"); + import Polyline = require("esri/geometry/Polyline"); + import BufferParameters = require("esri/tasks/BufferParameters"); + import Geometry = require("esri/geometry/Geometry"); + import DensifyParameters = require("esri/tasks/DensifyParameters"); + import DistanceParameters = require("esri/tasks/DistanceParameters"); + import GeneralizeParameters = require("esri/tasks/GeneralizeParameters"); + import LengthsParameters = require("esri/tasks/LengthsParameters"); + import OffsetParameters = require("esri/tasks/OffsetParameters"); + import ProjectParameters = require("esri/tasks/ProjectParameters"); + import RelationParameters = require("esri/tasks/RelationParameters"); + import TrimExtendParameters = require("esri/tasks/TrimExtendParameters"); + + /** Represents a geometry service resource exposed by the ArcGIS Server REST API. */ + class GeometryService { + /** Acres (areal unit) */ + static UNIT_ACRES: any; + /** Ares (areal unit) */ + static UNIT_ARES: any; + /** International foot (0.3048 meters) */ + static UNIT_FOOT: any; + /** Hectares (areal unit) */ + static UNIT_HECTARES: any; + /** Kilometer */ + static UNIT_KILOMETER: any; + /** International meters */ + static UNIT_METER: any; + /** Nautical Miles (1,852 meters) */ + static UNIT_NAUTICAL_MILE: any; + /** Square Centimeters (areal unit) */ + static UNIT_SQUARE_CENTIMETERS: any; + /** Square Decimeters (areal unit) */ + static UNIT_SQUARE_DECIMETERS: any; + /** Square Feet (areal unit) */ + static UNIT_SQUARE_FEET: any; + /** Square Inches (areal unit) */ + static UNIT_SQUARE_INCHES: any; + /** Square Kilometers (areal unit) */ + static UNIT_SQUARE_KILOMETERS: any; + /** Square Meters (areal unit) */ + static UNIT_SQUARE_METERS: any; + /** Square Miles (areal unit) */ + static UNIT_SQUARE_MILES: any; + /** Square Millimeters (areal unit) */ + static UNIT_SQUARE_MILLIMETERS: any; + /** Square Yards (areal unit) */ + static UNIT_SQUARE_YARDS: any; + /** Miles (5,280 feet, 1,760 yards, or exactly 1,609.344 meters) */ + static UNIT_STATUTE_MILE: any; + /** US Nautical Mile */ + static UNIT_US_NAUTICAL_MILE: any; + /** URL to the ArcGIS Server REST resource that represents a locator service. */ + url: string; + /** + * Creates a new GeometryService object. + * @param url URL to the ArcGIS Server REST resource that represents a GeometryService, e.g., http://sampleserver6.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer. + */ + constructor(url: string); + /** + * Computes the area and length for the input polygons. + * @param areasAndLengthsParameters Specify the input polygons and optionally the linear and areal units. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + areasAndLengths(areasAndLengthsParameters: AreasAndLengthsParameters, callback?: Function, errback?: Function): any; + /** + * The Auto Complete operation is performed on a geometry service resource. + * @param polygons The array of polygons that will provide some boundaries for new polygons. + * @param polylines An array of polylines that will provide the remaining boundaries for new polygons. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + autoComplete(polygons: Polygon[], polylines: Polyline[], callback?: Function, errback?: Function): any; + /** + * Creates buffer polygons at a specified distance around the given geometries. + * @param bufferParameters Specifies the input geometries, buffer distances, and other options. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + buffer(bufferParameters: BufferParameters, callback?: Function, errback?: Function): any; + /** + * The convexHull operation is performed on a geometry service resource. + * @param geometries The geometries whose convex hull is to be created. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + convexHull(geometries: Geometry[], callback?: Function, errback?: Function): any; + /** + * The cut operation is performed on a geometry service resource. + * @param geometries The polyline or polygon to be cut. + * @param cutterGeometry The polyline that will be used to divide the target into pieces where it crosses the target. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + cut(geometries: Geometry[], cutterGeometry: Geometry, callback?: Function, errback?: Function): any; + /** + * The densify operation is performed on a geometry service resource. + * @param densifyParameters The DensifyParameters objects contains geometries, geodesic, lengthUnit, and maxSegmentLength parameters. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + densify(densifyParameters: DensifyParameters, callback?: Function, errback?: Function): any; + /** + * The difference operation is performed on a geometry service resource. + * @param geometries An array of points, multipoints, polylines or polygons. + * @param geometry A single geometry of any type, of dimension equal to or greater than the elements of geometries. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + difference(geometries: Geometry[], geometry: Geometry, callback?: Function, errback?: Function): any; + /** + * Measures the planar or geodesic distance between geometries. + * @param params Sets the input geometries to measure, distance units and other parameters. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + distance(params: DistanceParameters, callback?: Function, errback?: Function): any; + /** + * Converts an array of well-known strings into xy-coordinates based on the conversion type and spatial reference supplied by the user. + * @param params See the object specifications table below for the structure of the params object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + fromGeoCoordinateString(params: any, callback?: Function, errback?: Function): any; + /** + * Generalizes the input geometries using the Douglas-Peucker algorithm. + * @param params An array of geometries to generalize and a maximum deviation. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + generalize(params: GeneralizeParameters, callback?: Function, errback?: Function): any; + /** + * The intersect operation is performed on a geometry service resource. + * @param geometries An array of points, multipoints, polylines or polygons. + * @param geometry A single geometry of any type, of dimension equal to or greater than the elements of geometries. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + intersect(geometries: Geometry[], geometry: Geometry, callback?: Function, errback?: Function): any; + /** + * Calculates an interior point for each polygon specified. + * @param polygons The graphics to process. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + labelPoints(polygons: Geometry[], callback?: Function, errback?: Function): any; + /** + * Gets the lengths for a Geometry[] when the geometry type is Polyline. + * @param lengthsParameter Specify the polylines and optionally the length unit and the geodesic length option. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + lengths(lengthsParameter: LengthsParameters, callback?: Function, errback?: Function): any; + /** + * Constructs the offset of the input geometries. + * @param params Set the geometries to offset, distance and units. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + offset(params: OffsetParameters, callback?: Function, errback?: Function): any; + /** + * Projects a set of geometries into a new spatial reference. + * @param params The input projection parameters. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + project(params: ProjectParameters, callback?: Function, errback?: Function): any; + /** + * Computes the set of pairs of geometries from the input geometry arrays that belong to the specified relation. + * @param relationParameters The set of parameters required to perform the comparison. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + relation(relationParameters: RelationParameters, callback?: Function, errback?: Function): any; + /** + * The reshape operation is performed on a geometry service resource. + * @param targetGeometry The polyline or polygon to be reshaped. + * @param reshaperGeometry The single-part polyline that does the reshaping. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + reshape(targetGeometry: Geometry, reshaperGeometry: Geometry, callback?: Function, errback?: Function): any; + /** + * Alters the given geometries to make their definitions topologically legal with respect to their geometry type. + * @param geometries The geometries to simplify + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + simplify(geometries: Geometry[], callback?: Function, errback?: Function): any; + /** + * Converts an array of xy-coordinates into well-known strings based on the conversion type and spatial reference supplied by the user. + * @param params See the object specifications table below for the structure of the params object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + toGeoCoordinateString(params: any, callback?: Function, errback?: Function): any; + /** + * Trims or extends the input polylines using the user specified guide polyline. + * @param params Input parameters for the trimExtend operation. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + trimExtend(params: TrimExtendParameters, callback?: Function, errback?: Function): any; + /** + * The union operation is performed on a geometry service resource. + * @param geometries The array of geometries to be unioned. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + union(geometries: Geometry[], callback?: Function, errback?: Function): any; + /** Fires when the areasAndLengths operation is complete. */ + on(type: "areas-and-lengths-complete", listener: (event: { result: any; target: GeometryService }) => void): esri.Handle; + /** Fires when the autoComplete operation is complete. */ + on(type: "auto-complete-complete", listener: (event: { geometries: Polygon[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the buffer operation is complete. */ + on(type: "buffer-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the convexHull operation is complete. */ + on(type: "convex-hull-complete", listener: (event: { geometry: Geometry; target: GeometryService }) => void): esri.Handle; + /** Fires when the cut operation is complete. */ + on(type: "cut-complete", listener: (event: { result: any; target: GeometryService }) => void): esri.Handle; + /** Fires when the densify operation is complete. */ + on(type: "densify-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the difference operation is complete. */ + on(type: "difference-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the distance operation is complete. */ + on(type: "distance-complete", listener: (event: { distance: number; target: GeometryService }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { target: GeometryService }) => void): esri.Handle; + /** Fires when the generalize operation is complete. */ + on(type: "generalize-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the intersect operation is complete. */ + on(type: "intersect-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the labelPoints operation is complete. */ + on(type: "label-points-complete ", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the lengths operation is complete. */ + on(type: "lengths-complete", listener: (event: { result: any; target: GeometryService }) => void): esri.Handle; + /** Fires when the offset operation is complete. */ + on(type: "offset-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the project operation is complete. */ + on(type: "project-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the relation operation is complete. */ + on(type: "relation-complete", listener: (event: { target: GeometryService }) => void): esri.Handle; + /** Fires when the reshape operation is complete. */ + on(type: "reshape-complete", listener: (event: { geometry: Geometry; target: GeometryService }) => void): esri.Handle; + /** Fires when the simplify operation is complete. */ + on(type: "simplify-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the trimExtend operation is complete. */ + on(type: "trim-extend-complete", listener: (event: { geometries: Geometry[]; target: GeometryService }) => void): esri.Handle; + /** Fires when the union operation is complete. */ + on(type: "union-complete", listener: (event: { geometry: Geometry; target: GeometryService }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = GeometryService; +} + +declare module "esri/tasks/Geoprocessor" { + import esri = require("esri"); + import SpatialReference = require("esri/SpatialReference"); + import ImageParameters = require("esri/layers/ImageParameters"); + import ArcGISDynamicMapServiceLayer = require("esri/layers/ArcGISDynamicMapServiceLayer"); + import GPMessage = require("esri/tasks/GPMessage"); + import ParameterValue = require("esri/tasks/ParameterValue"); + import MapImage = require("esri/layers/MapImage"); + + /** Represents a GP Task resource exposed by the ArcGIS Server REST API. */ + class Geoprocessor { + /** Deprecated at v2.0, use outSpatialReference instead. */ + outputSpatialReference: SpatialReference; + /** The spatial reference of the output geometries. */ + outSpatialReference: SpatialReference; + /** The spatial reference that the model will use to perform geometry operations. */ + processSpatialReference: SpatialReference; + /** The time interval in milliseconds between each job status request sent to an asynchronous GP task. */ + updateDelay: number; + /** ArcGIS Server Rest API endpoint to the resource that receives the geoprocessing request. */ + url: string; + /** + * Creates a new Geoprocessor object that represents the GP Task identifed by a URL. + * @param url URL to the ArcGIS Server REST resource that represents a geoprocessing service. + */ + constructor(url: string); + /** + * Cancel an asynchronous geoprocessing job. + * @param jobId A string that uniquely identifies a job on the server. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + cancelJob(jobId: string, callback: Function, errback: Function): any; + /** + * Cancels the periodic job status updates initiated automatically when submitJob() is invoked for the job identified by jobId. + * @param jobId A string that uniquely identifies the job for which the job updates are cancelled. + */ + cancelJobStatusUpdates(jobId: string): void; + /** + * Sends a request to the GP Task for the current state of the job identified by jobId. + * @param jobId A string that uniquely identifies a job on the server. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + checkJobStatus(jobId: string, callback?: Function, errback?: Function): void; + /** + * Sends a request to the server to execute a synchronous GP task. + * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(inputParameters: any, callback?: Function, errback?: Function): any; + /** + * Sends a request to the GP Task to get the task result identified by jobId and resultParameterName. + * @param jobId The jobId returned from JobInfo. + * @param parameterName The name of the result parameter as defined in Services Directory. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + getResultData(jobId: string, parameterName: string, callback?: Function, errback?: Function): any; + /** + * Sends a request to the GP Task to get the task result identified by jobId and resultParameterName as an image. + * @param jobId The jobId returned from JobInfo. + * @param parameterName The name of the result parameter as defined in Services Directory. + * @param imageParameters Specifies the properties of the result image. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + getResultImage(jobId: string, parameterName: string, imageParameters: ImageParameters, callback?: Function, errback?: Function): any; + /** + * Get the task result identified by jobId and resultParameterName as an ArcGISDynamicMapServiceLayer. + * @param jobId The jobId returned from JobInfo. + * @param parameterName The name of the result parameter as defined in Services Directory. + * @param imageParameters Contains various options that can be specified when generating a dynamic map image. + * @param callback The function to call when the method has completed. + */ + getResultImageLayer(jobId: string, parameterName?: string, imageParameters?: ImageParameters, callback?: Function): ArcGISDynamicMapServiceLayer; + /** + * Deprecated at v2.0, use setOutSpatialReference instead. + * @param spatialReference The well-known ID of a spatial reference. + */ + setOutputSpatialReference(spatialReference: SpatialReference): void; + /** + * Sets the well-known ID of the spatial reference of the output geometries. + * @param spatialReference The well-known ID of a spatial reference. + */ + setOutSpatialReference(spatialReference: SpatialReference): void; + /** + * Sets the well-known ID of the spatial reference that the model uses to perform geometry operations. + * @param spatialReference The well-known ID of a spatial reference. + */ + setProcessSpatialReference(spatialReference: SpatialReference): void; + /** + * Sets the time interval in milliseconds between each job status request sent to an asynchronous GP task. + * @param delay The value in milliseconds. + */ + setUpdateDelay(delay: number): void; + /** + * Submits a job to the server for asynchronous processing by the GP task. + * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. + * @param callback The function to call when the method has completed. + * @param statusCallback Checks the current status of the job. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): void; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: Geoprocessor }) => void): esri.Handle; + /** Fires when a synchronous GP task is completed. */ + on(type: "execute-complete", listener: (event: { messages: GPMessage[]; results: ParameterValue[]; target: Geoprocessor }) => void): esri.Handle; + /** Fires when the result of an asynchronous GP task execution is available. */ + on(type: "get-result-data-complete", listener: (event: { result: ParameterValue; target: Geoprocessor }) => void): esri.Handle; + /** Fires when a map image is generated by invoking the getResultImage method. */ + on(type: "get-result-image-complete", listener: (event: { mapImage: MapImage; target: Geoprocessor }) => void): esri.Handle; + /** Fires when getResultImageLayer method has completed. */ + on(type: "get-result-image-layer-complete", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + /** Fires when the geoprocessing job is cancelled using the cancelJob method. */ + on(type: "job-cancel", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + /** Fires when an asynchronous GP task using submitJob is complete. */ + on(type: "job-complete", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + /** Fires when a job status update is available. */ + on(type: "status-update", listener: (event: { target: Geoprocessor }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Geoprocessor; +} + +declare module "esri/tasks/IdentifyParameters" { + import DynamicLayerInfo = require("esri/layers/DynamicLayerInfo"); + import Geometry = require("esri/geometry/Geometry"); + import LayerTimeOptions = require("esri/layers/LayerTimeOptions"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TimeExtent = require("esri/TimeExtent"); + + /** This data object is used as the identifyParameters argument to IdentifyTask.execute method. */ + class IdentifyParameters { + /** All layers are identified, even if they are not visible. */ + static LAYER_OPTION_ALL: any; + /** Only the top-most visible layer is identified. */ + static LAYER_OPTION_TOP: any; + /** All visible layers are identified. */ + static LAYER_OPTION_VISIBLE: any; + /** Resolution of the current map view in dots per inch. */ + dpi: number; + /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ + dynamicLayerInfos: DynamicLayerInfo[]; + /** The geometry used to select features during Identify. */ + geometry: Geometry; + /** Height of the map currently being viewed in pixels. */ + height: number; + /** Array of layer definition expressions that allows you to filter the features of individual layers. */ + layerDefinitions: string[]; + /** The layers to perform the identify operation on. */ + layerIds: number[]; + /** Specifies which layers to use when using Identify. */ + layerOption: string; + /** Array of LayerTimeOptions objects that allow you to define time options for the specified layers. */ + layerTimeOptions: LayerTimeOptions[]; + /** The Extent or bounding box of the map currently being viewed. */ + mapExtent: Extent; + /** The maximum allowable offset used for generalizing geometries returned by the identify operation. */ + maxAllowableOffset: number; + /** If "true", the result set includes the geometry associated with each result. */ + returnGeometry: boolean; + /** The spatial reference of the input and output geometries as well as of the mapExtent. */ + spatialReference: SpatialReference; + /** Specify the time extent used by the identify task. */ + timeExtent: TimeExtent; + /** The distance in screen pixels from the specified geometry within which the identify should be performed. */ + tolerance: number; + /** Width of the map currently being viewed in pixels. */ + width: number; + /** Creates a new IdentifyParameters object. */ + constructor(); + } + export = IdentifyParameters; +} + +declare module "esri/tasks/IdentifyResult" { + import Graphic = require("esri/graphic"); + + /** Represents a result of an identify operation. */ + class IdentifyResult { + /** The name of the layer's primary display field. */ + displayFieldName: string; + /** An identified feature. */ + feature: Graphic; + /** Unique ID of the layer that contains the feature. */ + layerId: number; + /** The layer name that contains the feature. */ + layerName: string; + } + export = IdentifyResult; +} + +declare module "esri/tasks/IdentifyTask" { + import esri = require("esri"); + import IdentifyParameters = require("esri/tasks/IdentifyParameters"); + import IdentifyResult = require("esri/tasks/IdentifyResult"); + + /** Performs an identify operation on the layers of a map service resource exposed by the ArcGIS Server REST API. */ + class IdentifyTask { + /** URL to the ArcGIS Server REST resource that represents a map service. */ + url: string; + /** + * Creates a new IdentifyTask object. + * @param url URL to the ArcGIS Server REST resource that represents a map service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.IdentifyTaskOptions); + /** + * Sends a request to the ArcGIS REST map service resource to identify features based on the IdentifyParameters specified in the identifyParameters argument. + * @param identifyParameters Specifies the criteria used to identify the features. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(identifyParameters: IdentifyParameters, callback?: Function, errback?: Function): any; + /** Fires when the identify operation is complete. */ + on(type: "complete", listener: (event: { results: IdentifyResult[]; target: IdentifyTask }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: IdentifyTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = IdentifyTask; +} + +declare module "esri/tasks/ImageServiceIdentifyParameters" { + import Geometry = require("esri/geometry/Geometry"); + import MosaicRule = require("esri/layers/MosaicRule"); + import Symbol = require("esri/symbols/Symbol"); + import RasterFunction = require("esri/layers/RasterFunction"); + import TimeExtent = require("esri/TimeExtent"); + + /** Input parameters for the ImageServiceIdentifyTask. */ + class ImageServiceIdentifyParameters { + /** Input geometry that defines the location to be identified. */ + geometry: Geometry; + /** Specifies the mosaic rules defining the image sorting order. */ + mosaicRule: MosaicRule; + /** The pixel or RGB color value representing no information. */ + noData: any; + /** Used along with the noData property. */ + noDataInterpretation: string; + /** Specify the pixel level being identified on the x and y axis. */ + pixelSize: Symbol; + /** The pixel level being identified (or the resolution being looked at) on the x-axis. */ + pixelSizeX: number; + /** The pixel level being identified (or the resolution being looked at) on the y-axis. */ + pixelSizeY: number; + /** Specifies the rendering rule for how the requested image should be rendered. */ + renderingRule: RasterFunction; + /** If "true", returns both geometry and attributes of the catalog items. */ + returnCatalogItems: boolean; + /** When true, each feature in the catalog items includes the geometry. */ + returnGeometry: boolean; + /** Specify a time extent. */ + timeExtent: TimeExtent; + /** Creates a new ImageServiceIdentifyParameters object. */ + constructor(); + } + export = ImageServiceIdentifyParameters; +} + +declare module "esri/tasks/ImageServiceIdentifyResult" { + import FeatureSet = require("esri/tasks/FeatureSet"); + import Point = require("esri/geometry/Point"); + + /** The results from an ImageServiceIdentifyTask. */ + class ImageServiceIdentifyResult { + /** The set of catalog items that overlap the input geometry. */ + catalogItems: FeatureSet; + /** The set of visible areas for the identified catalog items. */ + catalogItemVisibilities: number[]; + /** The identified location. */ + location: Point; + /** The identify property name. */ + name: string; + /** The identify property id. */ + objectId: number; + /** The attributes of the identified object. */ + properties: any; + /** The identify property pixel value. */ + value: string; + } + export = ImageServiceIdentifyResult; +} + +declare module "esri/tasks/ImageServiceIdentifyTask" { + import esri = require("esri"); + import ImageServiceIdentifyParameters = require("esri/tasks/ImageServiceIdentifyParameters"); + import ImageServiceIdentifyResult = require("esri/tasks/ImageServiceIdentifyResult"); + + /** Performs an identify operation on an image service resource . */ + class ImageServiceIdentifyTask { + /** + * Creates a new ImageServiceIdentifyTask object. + * @param url URL to the ArcGIS Server REST resource that represents an image service. + */ + constructor(url: string); + /** + * Sends a request to the ArcGIS REST image service resource to identify content based on the ImageServiceIdentifyParameters specified in the imageServiceIdentifyParameters argument. + * @param params Specifies the criteria used to identify the features. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(params: ImageServiceIdentifyParameters, callback?: Function, errback?: Function): any; + /** Fires when the identify operation is complete. */ + on(type: "complete", listener: (event: { result: ImageServiceIdentifyResult; target: ImageServiceIdentifyTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ImageServiceIdentifyTask; +} + +declare module "esri/tasks/JobInfo" { + import GPMessage = require("esri/tasks/GPMessage"); + + /** Represents information pertaining to the execution of an asynchronous GP task on the server. */ + class JobInfo { + /** The job has been cancelled. */ + static STATUS_CANCELLED: any; + /** The job is in the process of cancelling. */ + static STATUS_CANCELLING: any; + /** The job has been deleted. */ + static STATUS_DELETED: any; + /** The job is in the process of deleting. */ + static STATUS_DELETING: any; + /** The job is being executed by job processor. */ + static STATUS_EXECUTING: any; + /** The job execution has failed. */ + static STATUS_FAILED: any; + /** The job is new. */ + static STATUS_NEW: any; + /** The job is submitted for execution. */ + static STATUS_SUBMITTED: any; + /** The job has completed successfully. */ + static STATUS_SUCCEEDED: any; + /** The job execution has timed out. */ + static STATUS_TIMED_OUT: any; + /** The job is waiting for available job processor. */ + static STATUS_WAITING: any; + /** The unique job ID assigned by ArcGIS Server. */ + jobId: string; + /** The job status. */ + jobStatus: string; + /** An array of messages that include the message type and a description. */ + messages: GPMessage[]; + } + export = JobInfo; +} + +declare module "esri/tasks/LegendLayer" { + /** Define layer properties for the legend layers associated with a PrintTemplate. */ + class LegendLayer { + /** The id of the operational layer to include in the printout's legend. */ + layerId: string; + /** The ids of the sublayers to include in the printout's legend. */ + subLayerIds: string[]; + /** Creates a new LegendLayer object. */ + constructor(); + } + export = LegendLayer; +} + +declare module "esri/tasks/LengthsParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the length units and other parameters for Lengths operation. */ + class LengthsParameters { + /** Defines the type of calculation for the geometry. */ + calculationType: string; + /** If polylines are in geographic coordinate system, then geodesic needs to be set to true in order to calculate the ellipsoidal shortest path distance between each pair of the vertices in the polylines. */ + geodesic: boolean; + /** The length unit in which perimeters of polygons will be calculated. */ + lengthUnit: any; + /** The array of polylines whose lengths are to be computed. */ + polylines: Geometry[]; + /** Creates a new LengthsParameter object. */ + constructor(); + } + export = LengthsParameters; +} + +declare module "esri/tasks/LinearUnit" { + /** A data object containing a linear distance. */ + class LinearUnit { + /** Specifies the value of the linear distance. */ + distance: number; + /** Specifies the unit type of the linear distance, such as "esriMeters", "esriMiles", "esriKilometers" etc. */ + units: string; + /** Creates a new LinearUnit object. */ + constructor(); + } + export = LinearUnit; +} + +declare module "esri/tasks/MultipartColorRamp" { + import ColorRamp = require("esri/tasks/ColorRamp"); + import AlgorithmicColorRamp = require("esri/tasks/AlgorithmicColorRamp"); + + /** Create a multipart color ramp to concatenate multiple color ramps for use in the renderer generated by the GenerateRendererTask. */ + class MultipartColorRamp extends ColorRamp { + /** Define an array of algorithmic color ramps used to generate the multi part ramp. */ + colorRamps: AlgorithmicColorRamp[]; + /** Creates a new MultipartColorRamp object. */ + constructor(); + /** Returns an easily serializable object representation of a multipart color ramp. */ + toJson(): any; + } + export = MultipartColorRamp; +} + +declare module "esri/tasks/NAMessage" { + /** Represents a message generated during the execution of a network analyst task. */ + class NAMessage { + /** TBA */ + static TYPE_ABORT: any; + /** TBA */ + static TYPE_EMPTY: any; + /** TBA */ + static TYPE_ERROR: any; + /** TBA */ + static TYPE_INFORMATIVE: any; + /** TBA */ + static TYPE_PROCESS_DEFINITION: any; + /** TBA */ + static TYPE_PROCESS_START: any; + /** TBA */ + static TYPE_PROCESS_STOP: any; + /** TBA */ + static TYPE_WARNING: any; + /** A description of the network analyst message. */ + description: string; + /** The network analyst message type, see constants table for a list of values. */ + type: number; + } + export = NAMessage; +} + +declare module "esri/tasks/NATypes" { + import esri = require("esri"); + + var NATypes: { + OutputLine: esri.NAOutputLine; + OutputPolygon: esri.NAOutputPolygon; + TravelDirection: esri.NATravelDirection; + UTurn: esri.NAUTurn; + }; + export = NATypes; +} + +declare module "esri/tasks/OffsetParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the offset distance, type and other parameters for the GeometryService.offset operation. */ + class OffsetParameters { + /** The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. */ + bevelRatio: number; + /** The array of geometries to be offset. */ + geometries: Geometry[]; + /** Specifies the distance for constructing an offset based on the input geometries. */ + offsetDistance: number; + /** Options that determine how the ends intersect. */ + offsetHow: string; + /** The offset distance unit. */ + offsetUnit: string; + /** Creates a new OffsetParameters object. */ + constructor(); + } + export = OffsetParameters; +} + +declare module "esri/tasks/ParameterValue" { + /** Represent the output parameters of a GP task and their properties and values. */ + class ParameterValue { + /** Specifies the type of data for the parameter. */ + dataType: string; + /** The value of the parameter. */ + value: any; + } + export = ParameterValue; +} + +declare module "esri/tasks/PrintParameters" { + import Map = require("esri/map"); + import SpatialReference = require("esri/SpatialReference"); + import PrintTemplate = require("esri/tasks/PrintTemplate"); + + /** Input parameters for the PrintTask. */ + class PrintParameters { + /** Additional parameters for the print service. */ + extraParameters: any; + /** The map to print. */ + map: Map; + /** Specify the output spatial reference for the printout. */ + outSpatialReference: SpatialReference; + /** Defines the layout template used for the printed map. */ + template: PrintTemplate; + /** Creates a new PrintParameters object. */ + constructor(); + } + export = PrintParameters; +} + +declare module "esri/tasks/PrintTask" { + import esri = require("esri"); + import PrintParameters = require("esri/tasks/PrintParameters"); + + /** The PrintTask class generates a printer-ready version of the map using an Export Web Map Task available with ArGIS Server 10.1 and later. */ + class PrintTask { + /** The url to the Export Web Map Task. */ + url: string; + /** + * Creates a new PrintTask object. + * @param url URL to the Export Web Map Task. + * @param params Parameters for the print task. + */ + constructor(url: string, params?: esri.PrintTaskOptions); + /** + * Sends a request to the print service resource to create a print page using the information specified in the printParameters argument. + * @param printParameters A PrintParameters object that defines the printing options. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + execute(printParameters: PrintParameters, callback?: Function, errback?: Function): any; + /** Fired when the print operation is complete. */ + on(type: "complete", listener: (event: { url: string; target: PrintTask }) => void): esri.Handle; + /** Fired when an error occurs while executing the print task. */ + on(type: "error", listener: (event: { error: Error; target: PrintTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = PrintTask; +} + +declare module "esri/tasks/PrintTemplate" { + /** Define the layout template options used by the PrintTask and Print widget to generate the print page. */ + class PrintTemplate { + /** Define the map width, height and dpi. */ + exportOptions: any; + /** The print output format. */ + format: string; + /** The text that appears on the PrintWidget's print button. */ + label: string; + /** The layout used for the print output. */ + layout: string; + /** Define the layout elements. */ + layoutOptions: any; + /** The optional map scale of the printed map. */ + outScale: number; + /** Define whether the printed map should preserve map scale or map extent. */ + preserveScale: boolean; + /** When false, attribution is not displayed on the printout. */ + showAttribution: boolean; + /** Creates a new PrintTemplate object. */ + constructor(); + } + export = PrintTemplate; +} + +declare module "esri/tasks/ProjectParameters" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + + /** Define the projection parameters used when calling the GeometryService project method. */ + class ProjectParameters { + /** The input geometries to project. */ + geometries: Geometry[]; + /** The spatial reference to which you are projecting the geometries. */ + outSR: SpatialReference; + /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transfomation to be applied on the projected geometries. */ + transformation: any; + /** Indicates whether to transform forward or not. */ + transformForward: boolean; + /** Creates a new ProjectParameters object. */ + constructor(); + } + export = ProjectParameters; +} + +declare module "esri/tasks/QueryTask" { + import esri = require("esri"); + import Query = require("esri/tasks/query"); + import RelationshipQuery = require("esri/tasks/RelationshipQuery"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** Executes a query operation on a layer resource of a map service exposed by the ArcGIS Server REST API. */ + class QueryTask { + /** URL to the ArcGIS Server REST resource that represents a map service layer. */ + url: string; + /** + * Creates a new QueryTask object used to execute a query on the layer resource identified by the url. + * @param url URL to the ArcGIS Server REST resource that represents a layer in a service. + * @param options Optional parameters. + */ + constructor(url: string, options?: esri.QueryTaskOptions); + /** + * Executes a Query against an ArcGIS Server map layer. + * @param parameters Specifies the attributes and spatial filter of the query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + execute(parameters: Query, callback?: Function, errback?: Function): any; + /** + * Get a count of the number of features that satisfy the input query. + * @param query Specify the input query object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeForCount(query: Query, callback?: Function, errback?: Function): any; + /** + * Get the extent of the features that satisfy the input query. + * @param query Specify the input query object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeForExtent(query: Query, callback?: Function, errback?: Function): any; + /** + * Executes a Query against an ArcGIS Server map layer. + * @param parameters Specifies the attributes and spatial filter of the query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeForIds(parameters: Query, callback?: Function, errback?: Function): any; + /** + * Executes a RelationshipQuery against an ArcGIS Server map layer (or table). + * @param parameters Specifies the attributes and spatial filter of the query. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + executeRelationshipQuery(parameters: RelationshipQuery, callback?: Function, errback?: Function): any; + /** Fires when the query operation is complete. */ + on(type: "complete", listener: (event: { featureSet: FeatureSet; target: QueryTask }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: QueryTask }) => void): esri.Handle; + /** Fires when the query for the count is complete. */ + on(type: "execute-for-count-complete", listener: (event: { count: number; target: QueryTask }) => void): esri.Handle; + /** Fires when the query for the extent is complete. */ + on(type: "execute-for-extent-complete", listener: (event: { count: number; extent: any; target: QueryTask }) => void): esri.Handle; + /** Fires when the query on IDs is complete. */ + on(type: "execute-for-ids-complete", listener: (event: { objectIds: number[]; target: QueryTask }) => void): esri.Handle; + /** Fires when the executeRelationshipQuery is complete. */ + on(type: "execute-relationship-query-complete", listener: (event: { featureSets: FeatureSet[]; target: QueryTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = QueryTask; +} + +declare module "esri/tasks/RasterData" { + /** A geoprocessing data object containing a raster data source. */ + class RasterData { + /** Specifies the format of the raster data such as "jpg", "tif" etc. */ + format: string; + /** The ID of the uploaded file returned as a result of the upload operation. */ + itemID: string; + /** URL to the location of the raster data file. */ + url: string; + /** Creates a new RasterData object. */ + constructor(); + } + export = RasterData; +} + +declare module "esri/tasks/RelationParameters" { + import Geometry = require("esri/geometry/Geometry"); + + /** Sets the relation and other parameters for Relation operation. */ + class RelationParameters { + /** The boundaries of the geometries must share an intersection, but the relationship between the interiors of the shapes is not considered (they could overlap, one could be contained in the other, or their interiors could be disjoint). */ + static SPATIAL_REL_COINCIDENCE: any; + /** Two polylines cross if they share only points in common, at least one of which is not an endpoint. */ + static SPATIAL_REL_CROSS: any; + /** Two geometries are disjoint if their intersection is empty. */ + static SPATIAL_REL_DISJOINT: any; + /** The base geometry is within the comparison geometry if the base geometry is the intersection of the geometries and the intersection of their interiors is not empty. */ + static SPATIAL_REL_IN: any; + /** Geometries intersect excluding boundary touch. */ + static SPATIAL_REL_INTERIORINTERSECTION: any; + /** Geometry interiors intersect or boundaries touch, same as 'not disjoint'. */ + static SPATIAL_REL_INTERSECTION: any; + /** Two geometries are said to touch when the intersection of the geometries is non-empty, but the intersection of their interiors is empty. */ + static SPATIAL_REL_LINETOUCH: any; + /** Two polylines share a common sub-line, or two polygons share a common sub-area. */ + static SPATIAL_REL_OVERLAP: any; + /** Two geometries are said to touch when the intersection of the geometries is non-empty, but the intersection of their interiors is empty. */ + static SPATIAL_REL_POINTTOUCH: any; + /** Allows specification of any relationship defined using the Shape Comparison Language. */ + static SPATIAL_REL_RELATION: any; + /** The union of point touch and line touch. */ + static SPATIAL_REL_TOUCH: any; + /** Same as SPATIAL_REL_IN but also allows polylines that are strictly on the boundaries of polygons to be considered in the polygon. */ + static SPATIAL_REL_WITHIN: any; + /** The first array of geometries to compute the relations. */ + geometries1: Geometry[]; + /** The second array of geometries to compute the relations. */ + geometries2: Geometry[]; + /** The spatial relationship to be tested between the two input geometry arrays. */ + relation: string; + /** The 'Shape Comparison Language' string to evaluate. */ + relationParam: string; + /** Creates a new RelationParameter object. */ + constructor(); + } + export = RelationParameters; +} + +declare module "esri/tasks/RelationshipQuery" { + import SpatialReference = require("esri/SpatialReference"); + + /** Define query parameters for the feature layer's queryRelatedFeatures method. */ + class RelationshipQuery { + /** The definition expression to be applied to the related table or layer. */ + definitionExpression: string; + /** Specify the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; + /** The maximum allowable offset used for generalizing geometries returned by the query operation. */ + maxAllowableOffset: number; + /** A comma delimited list of ObjectIds for the features in the layer/table that you want to query. */ + objectIds: number[]; + /** Attribute fields to include in the FeatureSet. */ + outFields: string[]; + /** The spatial reference for the returned geometry. */ + outSpatialReference: SpatialReference; + /** The ID of the relationship to test. */ + relationshipId: number; + /** If "true", each feature in the FeatureSet includes the geometry. */ + returnGeometry: boolean; + /** Creates a new RelationshipQuery object. */ + constructor(); + } + export = RelationshipQuery; +} + +declare module "esri/tasks/RouteParameters" { + import SpatialReference = require("esri/SpatialReference"); + + /** Input parameters for the RouteTask. */ + class RouteParameters { + /** The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. */ + accumulateAttributes: string[]; + /** Each element in the array is an object that describes the parameter values. */ + attributeParameterValues: any[]; + /** The set of point barriers loaded as network locations during analysis. */ + barriers: any; + /** The language used when computing directions. */ + directionsLanguage: string; + /** The length units to use when computing directions. */ + directionsLengthUnits: string; + /** Defines the amount of direction information returned. */ + directionsOutputType: string; + /** The style to be used when returning directions. */ + directionsStyleName: string; + /** The name of network attribute to use for the drive time when computing directions. */ + directionsTimeAttribute: string; + /** If true, avoids network elements restricted by barriers or due to restrictions specified in restrictionAttributes. */ + doNotLocateOnRestrictedElements: boolean; + /** The RouteTask can help you find the most efficient path for visiting a given list of stops. */ + findBestSequence: boolean; + /** In routes where a stop is not located on a network or a stop could not be reached, the results will differ depending on the value of ignoreInvalidLocations. */ + ignoreInvalidLocations: boolean; + /** The network attribute name to be used as the impedance attribute in analysis. */ + impedanceAttribute: string; + /** The precision of the output geometry after generalization. */ + outputGeometryPrecision: number; + /** The units of the output geometry precision. */ + outputGeometryPrecisionUnits: string; + /** The type of output lines to be generated in the result. */ + outputLines: string; + /** The well-known ID of the spatial reference for the geometries returned with the analysis results. */ + outSpatialReference: SpatialReference; + /** The set of polygon barriers loaded as network locations during analysis. */ + polygonBarriers: any; + /** The set of polyline barriers loaded as network locations during analysis. */ + polylineBarriers: any; + /** If true, keeps the first stop fixed in the sequence even when findBestSequence is true. */ + preserveFirstStop: boolean; + /** If true, keeps the last stop fixed in the sequence even when findBestSequence is true. */ + preserveLastStop: boolean; + /** The list of network attribute names to be used as restrictions with the analysis. */ + restrictionAttributes: string[]; + /** Specifies how U-Turns should be handled. */ + restrictUTurns: string; + /** If true, barriers are returned as the second parameter of RouteTask.onSolveComplete. */ + returnBarriers: boolean; + /** If true, directions are generated and returned in the directions property of each RouteResult. */ + returnDirections: boolean; + /** If true, polygon barriers are returned as the third parameter of RouteTask.onSolveComplete. */ + returnPolygonBarriers: boolean; + /** If true, polyline barriers are returned as the fourth parameter of RouteTask.onSolveComplete. */ + returnPolylineBarriers: boolean; + /** If true, routes are generated and returned in the route property of each RouteResult. */ + returnRoutes: boolean; + /** If true, stops are returned in the stops property of each RouteResult. */ + returnStops: boolean; + /** The time the route begins. */ + startTime: Date; + /** Start time is in UTC format */ + startTimeIsUTC: boolean; + /** The set of stops loaded as network locations during analysis. */ + stops: any; + /** If true, the hierarchy attribute for the network should be used in analysis. */ + useHierarchy: boolean; + /** A useful feature of the RouteTask is the ability to constrain stop visits to certain times of day, or "time windows". */ + useTimeWindows: boolean; + /** Creates a new RouteParameters object. */ + constructor(); + } + export = RouteParameters; +} + +declare module "esri/tasks/RouteResult" { + import DirectionsFeatureSet = require("esri/tasks/DirectionsFeatureSet"); + import Graphic = require("esri/graphic"); + + /** The result from the Route Task. */ + class RouteResult { + /** Route directions are returned if RouteParameters.returnDirections is set to true. */ + directions: DirectionsFeatureSet; + /** The Route graphic that is returned if RouteParameters.returnRoutes is true. */ + route: Graphic; + /** The name of the route. */ + routeName: string; + /** Array of stops. */ + stops: Graphic[]; + } + export = RouteResult; +} + +declare module "esri/tasks/RouteTask" { + import esri = require("esri"); + import RouteParameters = require("esri/tasks/RouteParameters"); + + /** The ArcGIS JavaScript API's routeTask allows you to find routes between two or more locations and optionally get driving directions. */ + class RouteTask { + /** URL to the ArcGIS Server REST resource that represents a network analysis service. */ + url: string; + /** + * Creates a new RouteTask object. + * @param url URL to the ArcGIS Server REST resource that represents a network analysis service. + */ + constructor(url: string); + /** + * Solves the route against the route layer with the route parameters. + * @param params Route parameters used as input to generate the route. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + solve(params: RouteParameters, callback?: Function, errback?: Function): any; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: RouteTask }) => void): esri.Handle; + /** Fires when RouteTask.solve() has completed. */ + on(type: "solve-complete", listener: (event: { result: any; target: RouteTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = RouteTask; +} + +declare module "esri/tasks/ServiceAreaParameters" { + import SpatialReference = require("esri/SpatialReference"); + + /** Input parameters for a ServiceAreaTask. */ + class ServiceAreaParameters { + /** The list of network attribute names to be accumulated with the analysis, i.e., which attributes should be returned as part of the response. */ + accumulateAttributes: string[]; + /** A set of attribute parameter values that can be parameterized to determine which network elements can be used by a vehicle. */ + attributeParameterValues: any[]; + /** An array of numbers defining the breaks. */ + defaultBreaks: number[]; + /** When true, restricted network elements should be considered when finding network locations. */ + doNotLocateOnRestrictedElements: boolean; + /** An array of network source names to NOT use when generating polygons. */ + excludeSourcesFromPolygons: string[]; + /** The set of facilities loaded as network locations during analysis. */ + facilities: any; + /** The network attribute name used as the impedance attribute in analysis. */ + impedanceAttribute: string; + /** If true, similar ranges will be merged in the result polygons. */ + mergeSimilarPolygonRanges: boolean; + /** The precision of the output geometry after generalization. */ + outputGeometryPrecision: number; + /** The units of the output geometry precision. */ + outputGeometryPrecisionUnits: string; + /** The type of output lines to be generated in the result. */ + outputLines: string; + /** The type of output polygons to be generated in the result. */ + outputPolygons: string; + /** The well-known ID of the spatial reference for the geometries returned with the analysis results. */ + outSpatialReference: SpatialReference; + /** Indicates if the lines should overlap from multiple facilities. */ + overlapLines: boolean; + /** Indicates if the polygons should overlap from multiple facilities. */ + overlapPolygons: boolean; + /** The set of point barriers loaded as network locations during analysis. */ + pointBarriers: any; + /** The set of polygons barriers loaded as network locations during analysis. */ + polygonBarriers: any; + /** The set of polyline barriers loaded as network locations during analysis. */ + polylineBarriers: any; + /** The list of network attribute names to be used as restrictions with the analysis. */ + restrictionAttributes: string[]; + /** Specifies how U-Turns should be handled. */ + restrictUTurns: string; + /** If true, facilities will be returned with the analysis results. */ + returnFacilities: boolean; + /** If true, barriers will be returned in the barriers property of ClosestFacilitySolveResult. */ + returnPointBarriers: boolean; + /** If true, polygon barriers will be returned in the polygonBarriers property of ClosestFacilitySolveResult. */ + returnPolygonBarriers: boolean; + /** If true, polyline barriers will be returned in the polylineBarriers property of ClosestFacilitySolveResult. */ + returnPolylineBarriers: boolean; + /** If true, lines will be split at breaks. */ + splitLinesAtBreaks: boolean; + /** If true, polygons will be split at breaks. */ + splitPolygonsAtBreaks: boolean; + /** Local date and time at the facility. */ + timeOfDay: Date; + /** Options for traveling to or from the facility. */ + travelDirection: string; + /** If true, the outermost polygon (at the maximum break value) will be trimmed. */ + trimOuterPolygon: boolean; + /** If polygons are being trimmed, provides the distance to trim. */ + trimPolygonDistance: number; + /** If polygons are being trimmed, specifies the units of the trimPolygonDistance. */ + trimPolygonDistanceUnits: string; + /** When true, the hierarchy attributes for the network will be used in analysis. */ + useHierarchy: boolean; + /** Creates a new ServiceAreaParameters object. */ + constructor(); + } + export = ServiceAreaParameters; +} + +declare module "esri/tasks/ServiceAreaSolveResult" { + import Point = require("esri/geometry/Point"); + import NAMessage = require("esri/tasks/NAMessage"); + import Polygon = require("esri/geometry/Polygon"); + import Polyline = require("esri/geometry/Polyline"); + import Graphic = require("esri/graphic"); + + /** The result from a ServiceAreaTask operation. */ + class ServiceAreaSolveResult { + /** Array of points, only returned if ServiceAreaParameters.returnFacilities is set to true. */ + facilities: Point[]; + /** Message received when solve is completed. */ + messages: NAMessage[]; + /** The point barriers are an array of points. */ + pointBarriers: Point[]; + /** The polygon barriers are an array of polygons. */ + polygonBarriers: Polygon[]; + /** The polyline barriers are an array of polylines. */ + polylineBarriers: Polyline[]; + /** Array of service area polygon graphics. */ + serviceAreaPolygons: Graphic[]; + /** Array of service area polyline graphics. */ + serviceAreaPolylines: Graphic[]; + } + export = ServiceAreaSolveResult; +} + +declare module "esri/tasks/ServiceAreaTask" { + import esri = require("esri"); + import ServiceAreaParameters = require("esri/tasks/ServiceAreaParameters"); + import ServiceAreaSolveResult = require("esri/tasks/ServiceAreaSolveResult"); + + /** Helps you find service areas around any location on a network. */ + class ServiceAreaTask { + /** + * Creates a new ServiceAreaTask object. + * @param url URL to the ArcGIS Server REST resource that represents a network analysis service. + */ + constructor(url: string); + /** + * Solve the service area. + * @param params The ServiceAreaParameters object. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + solve(params: ServiceAreaParameters, callback?: Function, errback?: Function): any; + /** Fires when ServiceAreaTask has completed. */ + on(type: "solve-complete", listener: (event: { result: ServiceAreaSolveResult; target: ServiceAreaTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = ServiceAreaTask; +} + +declare module "esri/tasks/StatisticDefinition" { + /** The StatisticDefinition class defines the type of statistics, the field used to calculate the statistics and the resulting output field name. */ + class StatisticDefinition { + /** Define the field on which statistics will be calculated. */ + onStatisticField: string; + /** Specify the output field name. */ + outStatisticFieldName: string; + /** Define the type of statistic. */ + statisticType: string; + /** Creates a new StatisticDefinition object. */ + constructor(); + } + export = StatisticDefinition; +} + +declare module "esri/tasks/TrimExtendParameters" { + import Polyline = require("esri/geometry/Polyline"); + + /** Sets the polylines and other parameters for the trimExtend operation. */ + class TrimExtendParameters { + /** A flag used along with the trimExtend operation. */ + extendHow: string; + /** The array of polylines to trim or extend. */ + polylines: Polyline[]; + /** A polyline used as a guide for trimming or extending input polylines. */ + trimExtendTo: Polyline; + /** Creates a new TrimExtendParameters object. */ + constructor(); + } + export = TrimExtendParameters; +} + +declare module "esri/tasks/UniqueValueDefinition" { + import ClassificationDefinition = require("esri/tasks/ClassificationDefinition"); + import Symbol = require("esri/symbols/Symbol"); + import ColorRamp = require("esri/tasks/ColorRamp"); + + /** Define a unique value classification scheme used by the GenerateRendererTask to create a renderer that groups values based on a unique combination of one or more fields. */ + class UniqueValueDefinition extends ClassificationDefinition { + /** Attribute field renderer uses to match values. */ + attributeField: string; + /** The name of the field that contains unique values when combined with the values specified by attributeField. */ + attributeField2: string; + /** The name of the field that contains unique values when combined with the values specified by attributeField and attributeField2. */ + attributeField3: string; + /** Define a default symbol for the classification. */ + baseSymbol: Symbol; + /** Define a color ramp for the classification. */ + colorRamp: ColorRamp; + /** Creates a new UniqueValueDefinition object. */ + constructor(); + /** Returns an easily serializable object representation of the unique value definition. */ + toJson(): any; + } + export = UniqueValueDefinition; +} + +declare module "esri/tasks/geoenrichment/AddressStudyArea" { + import StudyArea = require("esri/tasks/geoenrichment/StudyArea"); + + /** The study area that is based on an address. */ + class AddressStudyArea extends StudyArea { + /** The address key value pairs to geocode to obtain this study area. */ + attributes: any; + } + export = AddressStudyArea; +} + +declare module "esri/tasks/geoenrichment/DriveBuffer" { + import esri = require("esri"); + + /** The study area is created with a drive time or drive distance buffer. */ + class DriveBuffer { + /** The radii to use to create ring buffers. */ + radius: number[]; + /** The units of the radii. */ + units: string; + /** + * Constructs a DriveBuffer. + * @param params Various optional parameters that can be used to configure this class. + */ + constructor(params: esri.DriveBufferOptions); + } + export = DriveBuffer; +} + +declare module "esri/tasks/geoenrichment/DriveUnits" { + /** DriveUnits provides various length units that can be passed as the units in the DriveBuffer. */ + class DriveUnits { + /** Acres (esriAcres). */ + static ACRES: any; + /** Ares (esriAres). */ + static ARES: any; + /** Centimeters (esriCentimeters). */ + static CENTIMETERS: any; + /** Decimal degrees (esriDecimalDegrees). */ + static DECIMAL_DEGREES: any; + /** Decimeters (esriDecimeters). */ + static DECIMETERS: any; + /** Degree minute seconds (esriDegreeMinuteSeconds). */ + static DEGREE_MINUTE_SECONDS: any; + /** Feet (esriFeet). */ + static FEET: any; + /** Hectares (esriHectares). */ + static HECTARES: any; + /** Inches (esriInches). */ + static INCHES: any; + /** Kilometers (esriKilometers). */ + static KILOMETERS: any; + /** Meters (esriMeters). */ + static METERS: any; + /** Miles (esriMiles). */ + static MILES: any; + /** Millimeters (esriMillimeters). */ + static MILLIMETERS: any; + /** Minutes (esriDriveTimeUnitsMinutes). */ + static MINUTES: any; + /** Nautical miles (esriNauticalMiles). */ + static NAUTICAL_MILES: any; + /** Points (esriPoints). */ + static POINTS: any; + /** Square centimeters (esriSquareCentimeters). */ + static SQUARE_CENTIMETERS: any; + /** Square decimeters (esriSquareDecimeters). */ + static SQUARE_DECIMETERS: any; + /** Square feet (esriSquareFeet). */ + static SQUARE_FEET: any; + /** Square inches (esriSquareInches). */ + static SQUARE_INCHES: any; + /** Square kilometers (esriSquareKilometers). */ + static SQUARE_KILOMETERS: any; + /** Square meters (esriSquareMeters). */ + static SQUARE_METERS: any; + /** Square miles (esriSquareMiles). */ + static SQUARE_MILES: any; + /** Square millimeters (esriSquareMillimeters). */ + static SQUARE_MILLIMETERS: any; + /** Square yards (esriSquareYards). */ + static SQUARE_YARDS: any; + /** Unknown (esriUnknownUnits). */ + static UNKNOWN: any; + /** Yards (esriYards). */ + static YARDS: any; + } + export = DriveUnits; +} + +declare module "esri/tasks/geoenrichment/GeographyLevel" { + /** GeographicLevel works with IntersectingGeographies to define a study area of InfoGraphic with a feature from a standard geography layer. */ + class GeographyLevel { + /** The ID of the country for which data is retrieved. */ + countryID: string; + /** The ID of the dataset to which variables used in this GeographyLevel belong. */ + datasetID: string; + /** The ID of the layer. */ + layerID: string; + /** + * Create a GeographyLevel object. + * @param json Various options to configure this GeographyLevel. + */ + constructor(json?: Object); + } + export = GeographyLevel; +} + +declare module "esri/tasks/geoenrichment/GeographyQuery" { + import GeographyQueryBase = require("esri/tasks/geoenrichment/GeographyQueryBase"); + + /** (Beta at v3.12) Represents StandardGeographyQuery parameters to search for geographies by ID or Name. */ + class GeographyQuery extends GeographyQueryBase { + /** Array of geography IDs. */ + geographyIDs: string[]; + /** Array of geography layer IDs. */ + geographyLayerIDs: string[]; + /** A where clause for the query. */ + where: string; + /** Creates a new instance of the GeographyQuery object. */ + constructor(); + } + export = GeographyQuery; +} + +declare module "esri/tasks/geoenrichment/GeographyQueryBase" { + import SpatialReference = require("esri/SpatialReference"); + + /** (Beta at v3.12) Base class for all GeographyQuery objects. */ + class GeographyQueryBase { + /** Two-digit country code. */ + countryID: string; + /** Optional string that denotes the ID of a dataset associated with a particular country. */ + datasetID: string; + /** Optional integer value where you can limit the number of features that are returned from the geographyQuery. */ + featureLimit: number; + /** Optional integer that specifies the level of generalization of the geometries. */ + generalizationLevel: number; + /** Determines spatial reference for output geometry if returnGeometry is set to true. */ + outSR: SpatialReference; + /** Use this parameter to return all the geometries as points. */ + returnCentroids: boolean; + /** Determines whether response will also include geometries. */ + returnGeometry: boolean; + /** Optional boolean to enable fuzzy search. */ + useFuzzySearch: boolean; + /** + * Creates a new instance of the GeographyQueryBase object. + * @param json JSON object used to set the properties of the object. + */ + constructor(json?: Object); + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = GeographyQueryBase; +} + +declare module "esri/tasks/geoenrichment/GeometryStudyArea" { + import StudyArea = require("esri/tasks/geoenrichment/StudyArea"); + import Geometry = require("esri/geometry/Geometry"); + + /** The study area that is based on a geometry. */ + class GeometryStudyArea extends StudyArea { + /** The geometry for this study area. */ + geometry: Geometry; + /** Constructs a GeometryStudyArea. */ + constructor(); + } + export = GeometryStudyArea; +} + +declare module "esri/tasks/geoenrichment/IntersectingGeographies" { + import GeographyLevel = require("esri/tasks/geoenrichment/GeographyLevel"); + + /** The study area is created with the geometries intersecting the passed in geometry from specified layers. */ + class IntersectingGeographies { + /** The layers from which intersecting geographies should be used as study areas. */ + levels: GeographyLevel[]; + } + export = IntersectingGeographies; +} + +declare module "esri/tasks/geoenrichment/RingBuffer" { + import esri = require("esri"); + + /** The study area is created with a simple ring buffer with a radius. */ + class RingBuffer { + /** The radii to use to create ring buffers. */ + radii: number[]; + /** The units of the radii. */ + units: string; + /** + * Constructs a RingBuffer. + * @param params Various optional parameters that can be used to configure this class. + */ + constructor(params: esri.RingBufferOptions); + } + export = RingBuffer; +} + +declare module "esri/tasks/geoenrichment/StandardGeographyQueryTask" { + import esri = require("esri"); + import GeographyQueryBase = require("esri/tasks/geoenrichment/GeographyQueryBase"); + import FeatureSet = require("esri/tasks/FeatureSet"); + + /** (Beta at v3.12) Geoenrichment helper task that returns standard geography IDs and features for the supported geographic levels in Canada, the United States and a number of European countries. */ + class StandardGeographyQueryTask { + /** + * Creates a new instance of the StandardGeographyQueryTask class. + * @param url URL to the Geoenrichment server. + */ + constructor(url?: string); + /** + * Executes the StandardGeographyQueryTask. + * @param GeographyQuery See GeographyQuery or SubGeographyQuery classes for more details about available properties. + */ + execute(GeographyQuery: GeographyQueryBase): any; + /** Fires when an error occurs during the query. */ + on(type: "error", listener: (event: { error: Error; target: StandardGeographyQueryTask }) => void): esri.Handle; + /** Fires when the query successfully executes. */ + on(type: "execute-complete", listener: (event: { features: FeatureSet; target: StandardGeographyQueryTask }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = StandardGeographyQueryTask; +} + +declare module "esri/tasks/geoenrichment/StandardGeographyStudyArea" { + import StudyArea = require("esri/tasks/geoenrichment/StudyArea"); + + /** The study area that is based on a standard geography. */ + class StandardGeographyStudyArea extends StudyArea { + /** The country to which this geography belongs. */ + countryID: string; + /** The ID of the standard geography layer. */ + geographyLayerID: string; + /** The IDs of the standard geographies. */ + ids: string[]; + } + export = StandardGeographyStudyArea; +} + +declare module "esri/tasks/geoenrichment/StudyArea" { + import GeographyLevel = require("esri/tasks/geoenrichment/GeographyLevel"); + + /** The study area that is used for enrichment or for display in an Infographic widget. */ + class StudyArea { + /** Attributes of the study area. */ + attributes: any; + /** The identifiers for layers used to find comparison geographies. */ + comparisonGeographyLevels: GeographyLevel[]; + /** The options to apply to the study area. */ + options: any; + /** If true, geometry will be returned. */ + returnGeometry: boolean; + /** Converts object to its JSON representation. */ + toJson(): any; + } + export = StudyArea; +} + +declare module "esri/tasks/geoenrichment/SubGeographyQuery" { + import GeographyQueryBase = require("esri/tasks/geoenrichment/GeographyQueryBase"); + + /** (Beta at v3.12) Represents StandardGeographyQuery parameters to search subgeographic areas that are within a parent geography. */ + class SubGeographyQuery extends GeographyQueryBase { + /** Parent layer geography IDs. */ + filterGeographyIDs: string; + /** Parent layer ID. */ + filterGeographyLayerID: string; + /** Parent layer search string. */ + filterGeographyWhere: string; + /** Layer ID to return features from. */ + subGeographyLayerID: string; + /** Query string for the subquery. */ + subGeographyWhere: string; + /** + * Creates a new instance of the SubGeographyQuery object. + * @param json JSON object used to set the properties of the object. + */ + constructor(json?: Object); + } + export = SubGeographyQuery; +} + +declare module "esri/tasks/locationproviders/CoordinatesLocationProvider" { + import esri = require("esri"); + import LocationProviderClientBase = require("esri/tasks/locationproviders/LocationProviderClientBase"); + + /** (Beta at v3.12) The CoordinatesLocationProvider class uses the fields that contain Latitude and Longitude values to generate or locate geometries. */ + class CoordinatesLocationProvider extends LocationProviderClientBase { + /** The attribute field in the graphic object that has the longitude (X) values. */ + xField: string; + /** The attribute field in the graphic object that has the latitude (X) values. */ + yField: string; + /** + * Creates a new instance of the CoordinatesLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.CoordinatesLocationProviderOptions); + } + export = CoordinatesLocationProvider; +} + +declare module "esri/tasks/locationproviders/GeometryLocationProvider" { + import esri = require("esri"); + import LocationProviderClientBase = require("esri/tasks/locationproviders/LocationProviderClientBase"); + + /** (Beta at v3.12) The GeometryLocationProvider class uses the field in the data that has geometry as a JSON to generate the corresponding geometry. */ + class GeometryLocationProvider extends LocationProviderClientBase { + /** The attribute field in the graphic object that contains the JSON string representing the geometry. */ + geometryField: string; + /** + * Creates a new instance of the GeometryLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.GeometryLocationProviderOptions); + } + export = GeometryLocationProvider; +} + +declare module "esri/tasks/locationproviders/LocationProviderBase" { + import esri = require("esri"); + import Graphic = require("esri/graphic"); + + /** (Beta at v3.12) The base class for all LocationProviders. */ + class LocationProviderBase { + /** The geometry type of the returned features. */ + geometryType: string; + /** Returns true when the load event has been fired. */ + loaded: boolean; + /** + * Assigns geometries to the array of Graphic objects. + * @param features An array of Graphic objects. + * @param options Optional parameters. + */ + locate(features: Graphic[], options?: any): any; + /** Fires when an error occurs during locate. */ + on(type: "error", listener: (event: { error: Error; target: LocationProviderBase }) => void): esri.Handle; + /** Fires after the provider has loaded. */ + on(type: "load", listener: (event: { target: LocationProviderBase }) => void): esri.Handle; + /** Fires when the locate has completed. */ + on(type: "locate-complete", listener: (event: { failed: Graphic[]; features: Graphic[]; target: LocationProviderBase }) => void): esri.Handle; + /** Fires when the locate() method is in progress. */ + on(type: "locate-progress", listener: (event: { features: Graphic[]; target: LocationProviderBase }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = LocationProviderBase; +} + +declare module "esri/tasks/locationproviders/LocationProviderClientBase" { + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + import SpatialReference = require("esri/SpatialReference"); + + /** (Beta at v3.12) The base class for CoordinatesLocationProvider and GeometryLocationProvider. */ + class LocationProviderClientBase extends LocationProviderBase { + /** The Spatial Reference of the input geometries. */ + inSpatialReference: SpatialReference; + } + export = LocationProviderClientBase; +} + +declare module "esri/tasks/locationproviders/LocationProviderRemoteBase" { + import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase"); + + /** (Beta at v3.12) The base class for Location Providers that use a remote service to locate geometries. */ + class LocationProviderRemoteBase extends LocationProviderBase { + } + export = LocationProviderRemoteBase; +} + +declare module "esri/tasks/locationproviders/LocatorLocationProvider" { + import esri = require("esri"); + import LocationProviderRemoteBase = require("esri/tasks/locationproviders/LocationProviderRemoteBase"); + import Locator = require("esri/tasks/locator"); + + /** (Beta at v3.12) The LocatorLocationProvider class uses a geocode service through the Locator object to generate or locate geometries using fields in the graphics that contain Street address information */ + class LocatorLocationProvider extends LocationProviderRemoteBase { + /** Object that matches the Locator address fields to corresponding attribute names in the Graphic object. */ + addressFields: any; + /** An instance of a Locator object. */ + locator: Locator; + /** + * Creates a new instance of the LocatorLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.LocatorLocationProviderOptions); + } + export = LocatorLocationProvider; +} + +declare module "esri/tasks/locationproviders/QueryTaskLocationProvider" { + import esri = require("esri"); + import LocationProviderRemoteBase = require("esri/tasks/locationproviders/LocationProviderRemoteBase"); + import QueryTask = require("esri/tasks/QueryTask"); + + /** (Beta at v3.12) The QueryTaskLocationProvider performs a query against a ArcGIS Feature service or Map service layer based on common fields that are present in both the data and the ArcGIS layer. */ + class QueryTaskLocationProvider extends LocationProviderRemoteBase { + /** A query parameter object that will be used to query the ArcGIS layer. */ + queryParameters: any; + /** An instance of a QueryTask. */ + queryTask: QueryTask; + /** Set to true when querying a field that contains unicode characters. */ + unicode: boolean; + /** A mapping of the fields in the data and the ArcGIS layer to use to perform a join. */ + whereFields: any; + /** + * Creates a new instance of the QueryTaskLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options?: esri.QueryTaskLocationProviderOptions); + } + export = QueryTaskLocationProvider; +} + +declare module "esri/tasks/locationproviders/StandardGeographyQueryLocationProvider" { + import esri = require("esri"); + import LocationProviderRemoteBase = require("esri/tasks/locationproviders/LocationProviderRemoteBase"); + import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask"); + + /** (Beta at v3.12) The StandardGeographyQueryLocationProvider class uses the Geoenrichment service to generate geometries by querying the standard geography layers. */ + class StandardGeographyQueryLocationProvider extends LocationProviderRemoteBase { + /** A template to be used to build the query for Standard Geography query. */ + geographyQueryTemplate: string; + /** An object that specifies the parameters to use in the Standard Geography query. */ + queryParameters: any; + /** An instance of the StandardGeographyQueryTask class. */ + standardGeographyQueryTask: StandardGeographyQueryTask; + /** + * Creates a new instance of the StandardGeographyQueryLocationProvider object. + * @param options Define the properties to use when creating the class. + */ + constructor(options: esri.StandardGeographyQueryLocationProviderOptions); + } + export = StandardGeographyQueryLocationProvider; +} + +declare module "esri/tasks/locator" { + import esri = require("esri"); + import SpatialReference = require("esri/SpatialReference"); + import Point = require("esri/geometry/Point"); + import AddressCandidate = require("esri/tasks/AddressCandidate"); + + /** Represents a geocode service resource exposed by the ArcGIS Server REST API. */ + class Locator { + /** Limit the results to one or more categories. */ + categories: string[]; + /** The country to limit results to for example "US" for United States or "SE" for Sweden. */ + countryCode: string; + /** The spatial reference of the output geometries. */ + outSpatialReference: SpatialReference; + /** URL to the ArcGIS Server REST resource that represents a locator service. */ + url: string; + /** + * Creates a new Locator object. + * @param url URL to the ArcGIS Server REST resource that represents a locator service. + */ + constructor(url: string); + /** + * Find address candidates for the input addresses. + * @param params The input addresses in the format supported by the geocoding service. + * @param callback The function to call when the method has completed. + * @param errback The function to call if an error occurs on the server during task execution. + */ + addressesToLocations(params: any, callback: Function, errback: Function): any; + /** + * Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter. + * @param params Specify the address and optionally specify the outFields and searchExtent. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + addressToLocations(params: any, callback?: Function, errback?: Function): any; + /** + * Locates an address based on a given point. + * @param location The point at which to search for the closest address. + * @param distance The distance in meters from the given location within which a matching address should be searched. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs on the Server during task execution. + */ + locationToAddress(location: Point, distance: number, callback?: Function, errback?: Function): any; + /** + * Sets the well-known ID of the spatial reference of the output geometries. + * @param spatialReference The well-known ID of a spatial reference. + */ + setOutSpatialReference(spatialReference: SpatialReference): void; + /** + * Get character by character auto complete suggestions. + * @param params An object that defines suggest parameters. + */ + suggestLocations(params: any): any; + /** Fires when Locator.addressesToLocations method has completed. */ + on(type: "addresses-to-locations-complete", listener: (event: { addresses: AddressCandidate[]; target: Locator }) => void): esri.Handle; + /** Fires when Locator.addressToLocation method has completed. */ + on(type: "address-to-locations-complete", listener: (event: { addresses: AddressCandidate[]; target: Locator }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: Locator }) => void): esri.Handle; + /** Fires when Locator.locationToAddress method has completed. */ + on(type: "location-to-address-complete", listener: (event: { address: AddressCandidate; target: Locator }) => void): esri.Handle; + /** Fires when the suggestLocations method has completed. */ + on(type: "suggest-locations-complete", listener: (event: { suggestions: any[]; target: Locator }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Locator; +} + +declare module "esri/tasks/query" { + import Geometry = require("esri/geometry/Geometry"); + import SpatialReference = require("esri/SpatialReference"); + import StatisticDefinition = require("esri/tasks/StatisticDefinition"); + import Symbol = require("esri/symbols/Symbol"); + import TimeExtent = require("esri/TimeExtent"); + + /** Query for input to the QueryTask. */ + class Query { + /** Part or all of a feature from feature class 1 is contained within a feature from feature class 2. */ + static SPATIAL_REL_CONTAINS: any; + /** The feature from feature class 1 crosses a feature from feature class 2. */ + static SPATIAL_REL_CROSSES: any; + /** The envelope of feature class 1 intersects with the envelope of feature class 2. */ + static SPATIAL_REL_ENVELOPEINTERSECTS: any; + /** The envelope of the query feature class intersects the index entry for the target feature class. */ + static SPATIAL_REL_INDEXINTERSECTS: any; + /** Part of a feature from feature class 1 is contained in a feature from feature class 2. */ + static SPATIAL_REL_INTERSECTS: any; + /** Features from feature class 1 overlap features in feature class 2. */ + static SPATIAL_REL_OVERLAPS: any; + /** Allows specification of any relationship defined using the Shape Comparison Language. */ + static SPATIAL_REL_RELATION: any; + /** The feature from feature class 1 touches the border of a feature from feature class 2. */ + static SPATIAL_REL_TOUCHES: any; + /** The feature from feature class 1 is completely enclosed by the feature from feature class 2. */ + static SPATIAL_REL_WITHIN: any; + /** Distance to buffer input geometry. */ + distance: number; + /** The geometry to apply to the spatial filter. */ + geometry: Geometry; + /** Specify the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; + /** One or more field names that will be used to group the statistics. */ + groupByFieldsForStatistics: string[]; + /** The maximum allowable offset used for generalizing geometries returned by the query operation. */ + maxAllowableOffset: number; + /** Parameter to support querying feature services whose data source is a multipatch featureclass. */ + multipatchOption: string; + /** Number of features to retrieve. */ + num: number; + /** A comma delimited list of ObjectIds for the features in the layer/table that you want to query. */ + objectIds: number[]; + /** One or more field names that will be used to order the query results. */ + orderByFields: string[]; + /** Attribute fields to include in the FeatureSet. */ + outFields: string[]; + /** The spatial reference for the returned geometry. */ + outSpatialReference: SpatialReference; + /** The definitions for one or more field-based statistic to be calculated. */ + outStatistics: StatisticDefinition[]; + /** Specify the pixel level to be identified on the x and y axis. */ + pixelSize: Symbol; + /** Used to project the geometry onto a virtual grid, likely representing pixels on the screen. */ + quantizationParameters: any; + /** The 'Shape Comparison Language' string to evaluate. */ + relationParam: string; + /** If true then returns distinct values based on the fields specified in the outFields. */ + returnDistinctValues: boolean; + /** If "true", each feature in the FeatureSet includes the geometry. */ + returnGeometry: boolean; + /** The spatial relationship to be applied on the input geometry while performing the query. */ + spatialRelationship: string; + /** Zero-based index indicating where to begin retrieving features. */ + start: number; + /** Shorthand for a where clause using "like". */ + text: string; + /** Specify a time extent for the query. */ + timeExtent: TimeExtent; + /** Distance unit. */ + units: string; + /** A where clause for the query. */ + where: string; + /** Creates a new Query object used to execute a query on the layer resource identified by the URL. */ + constructor(); + } + export = Query; +} + +declare module "esri/toolbars/draw" { + import esri = require("esri"); + import SimpleFillSymbol = require("esri/symbols/SimpleFillSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import Map = require("esri/map"); + import FillSymbol = require("esri/symbols/FillSymbol"); + import LineSymbol = require("esri/symbols/LineSymbol"); + import MarkerSymbol = require("esri/symbols/MarkerSymbol"); + import Geometry = require("esri/geometry/Geometry"); + + /** Toolbar that supports functionality to create new geometries by drawing them: points (POINT or MULTI_POINT), lines (LINE, POLYLINE, or FREEHAND_POLYLINE), polygons (FREEHAND_POLYGON or POLYGON), or rectangles (EXTENT). */ + class Draw { + /** Draws an arrow. */ + static ARROW: any; + /** Draws a circle. */ + static CIRCLE: any; + /** Draws an arrow that points down. */ + static DOWN_ARROW: any; + /** Draws an ellipse. */ + static ELLIPSE: any; + /** Draws an extent box. */ + static EXTENT: any; + /** Draws a freehand polygon. */ + static FREEHAND_POLYGON: any; + /** Draws a freehand polyline. */ + static FREEHAND_POLYLINE: any; + /** Draws an arrow that points left. */ + static LEFT_ARROW: any; + /** Draws a line. */ + static LINE: any; + /** Draws a Multipoint. */ + static MULTI_POINT: any; + /** Draws a point. */ + static POINT: any; + /** Draws a polygon. */ + static POLYGON: any; + /** Draws a polyline. */ + static POLYLINE: any; + /** Draws a rectangle. */ + static RECTANGLE: any; + /** Draws an arrow that points right. */ + static RIGHT_ARROW: any; + /** Draws a triangle. */ + static TRIANGLE: any; + /** Draws an arrow that points up. */ + static UP_ARROW: any; + /** Symbol to be used when drawing a Polygon or Extent. */ + fillSymbol: SimpleFillSymbol; + /** Symbol to be used when drawing a Polyline. */ + lineSymbol: SimpleLineSymbol; + /** Symbol to be used when drawing a Point or Multipoint. */ + markerSymbol: SimpleMarkerSymbol; + /** When set to false, the geometry is modified to be topologically correct. */ + respectDrawingVertexOrder: boolean; + /** + * Creates a new Draw object. + * @param map Map the toolbar is associated with. + * @param options Parameters that define the functionality of the draw toolbar. + */ + constructor(map: Map, options?: esri.DrawOptions); + /** + * Activates the toolbar for drawing geometries. + * @param geometryType The type of geometry drawn. + * @param options Options that define the functionality of the draw toolbar. + */ + activate(geometryType: string, options?: any): void; + /** Deactivates the toolbar and reactivates map navigation. */ + deactivate(): void; + /** Finishes drawing the geometry and fires the onDrawEnd event. */ + finishDrawing(): void; + /** + * Sets the fill symbol. + * @param fillSymbol The fill symbol. + */ + setFillSymbol(fillSymbol: FillSymbol): void; + /** + * Sets the line symbol. + * @param lineSymbol The line symbol. + */ + setLineSymbol(lineSymbol: LineSymbol): void; + /** + * Sets the marker symbol. + * @param markerSymbol The marker symbol. + */ + setMarkerSymbol(markerSymbol: MarkerSymbol): void; + /** + * Sets whether the polygon geometry should be modified to be topologically correct. + * @param set When set to false, the geometry is modified to be topologically correct. + */ + setRespectDrawingVertexOrder(set: boolean): void; + /** Fired when the user has ended drawing. */ + on(type: "draw-complete", listener: (event: { geographicGeometry: Geometry; geometry: Geometry; target: Draw }) => void): esri.Handle; + /** Fires when drawing is complete. */ + on(type: "draw-end", listener: (event: { geometry: Geometry; target: Draw }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Draw; +} + +declare module "esri/toolbars/edit" { + import esri = require("esri"); + import Map = require("esri/map"); + import Graphic = require("esri/graphic"); + + /** The Edit toolbar is a helper class that provides functionality to move graphics or modify individual vertices, i.e., edit the geometry of existing graphics. */ + class Edit { + /** When a textSymbol point is in edit mode, double-clicking leads to text editing mode, which is a text box where uses can change the text content. */ + static EDIT_TEXT: any; + /** Display and edit vertices of a Polyline, Polygon, or Multipoint. */ + static EDIT_VERTICES: any; + /** Move graphic to a new location on the map. */ + static MOVE: any; + /** Rotate the graphic. */ + static ROTATE: any; + /** Scale or resize a graphic. */ + static SCALE: any; + /** + * Creates a new Edit object. + * @param map Map the toolbar is associated with. + * @param options Optional parameters. + */ + constructor(map: Map, options?: esri.EditOptions); + /** + * Activates the toolbar to edit the supplied graphic. + * @param tool Specify the active tool(s). + * @param graphic The graphic to edit. + * @param options See the object specifications table below for the structure of the options object. + */ + activate(tool: string, graphic: Graphic, options?: any): void; + /** Deactivates the toolbar. */ + deactivate(): void; + /** An object with the following properties that describe the current state. */ + getCurrentState(): any; + /** Refreshes the internal state of the toolbar. */ + refresh(): void; + /** Activates the toolbar for editing geometries. */ + on(type: "activate", listener: (event: { graphic: Graphic; tool: string; target: Edit }) => void): esri.Handle; + /** Deactivates the toolbar and reactivates map navigation. */ + on(type: "deactivate", listener: (event: { graphic: Graphic; info: any; tool: string; target: Edit }) => void): esri.Handle; + /** Fires when a graphic is clicked. */ + on(type: "graphic-click", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires when the user begins to move a graphic. */ + on(type: "graphic-first-move", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fired continuously as the graphic moves. */ + on(type: "graphic-move", listener: (event: { graphic: Graphic; transform: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is pressed down on the graphic, usually while moving a graphic. */ + on(type: "graphic-move-start", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is released, usually after moving the graphic. */ + on(type: "graphic-move-stop", listener: (event: { graphic: Graphic; transform: any; target: Edit }) => void): esri.Handle; + /** Fires continuously as a graphic is rotated. */ + on(type: "rotate", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires when the user begins to drag a handle to rotate the graphic. */ + on(type: "rotate-first-move", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when a user clicks on the handle to begin rotating a graphic. */ + on(type: "rotate-start", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when the mouse button is released from the rotate handle to finish rotating the graphic. */ + on(type: "rotate-stop", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires continuously as the graphic is being scaled. */ + on(type: "scale", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fires when the user begins to drag a handle to scale the graphic. */ + on(type: "scale-first-move", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when a user clicks on the handle to scale or resize a graphic. */ + on(type: "scale-start", listener: (event: { graphic: Graphic; target: Edit }) => void): esri.Handle; + /** Fires when the mouse button is released from the scale handle to finish scaling the graphic. */ + on(type: "scale-stop", listener: (event: { graphic: Graphic; info: any; target: Edit }) => void): esri.Handle; + /** Fired after a new vertex is added to a polyline or polygon or a new point is added to a multipoint. */ + on(type: "vertex-add", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is clicked on the vertex of a polyline or polygon or a point in a multipoint. */ + on(type: "vertex-click", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired after a vertex(polyline, polygon) or point(multipoint) is deleted. */ + on(type: "vertex-delete", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the user begins to move the vertex of a polyline or polygon or a point of a multipoint. */ + on(type: "vertex-first-move", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fires as the mouse exits a vertex(polyline, polygon) or a point(multipoint). */ + on(type: "vertex-mouse-out", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse moves over a vertex (polyline, polygon) or point (multipoint). */ + on(type: "vertex-mouse-over", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired continuously as the user is moving a vertex (polyline, polygon) or point (multipoint). */ + on(type: "vertex-move", listener: (event: { graphic: Graphic; transform: any; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is pressed down on a vertex (polyline, polygon) or point (multipoint). */ + on(type: "vertex-move-start", listener: (event: { graphic: Graphic; vertexinfo: any; target: Edit }) => void): esri.Handle; + /** Fired when the mouse button is released from a vertex (polyline, polygon) or point(multipoint). */ + on(type: "vertex-move-stop", listener: (event: { graphic: Graphic; transform: any; vertexinfo: any; target: Edit }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Edit; +} + +declare module "esri/toolbars/navigation" { + import esri = require("esri"); + import Map = require("esri/map"); + import Symbol = require("esri/symbols/Symbol"); + + /** Toolbar that supports basic navigation such as pan and zoom. */ + class Navigation { + /** Map is panned. */ + static PAN: any; + /** Map zooms in. */ + static ZOOM_IN: any; + /** Map zooms out. */ + static ZOOM_OUT: any; + /** + * Creates a new Navigation object. + * @param map Map the toolbar is associated with. + */ + constructor(map: Map); + /** + * Activates the toolbar for map navigation. + * @param navType The navigation type. + */ + activate(navType: string): void; + /** Deactivates the toolbar and reactivates map navigation. */ + deactivate(): void; + /** When "true", map is at the first extent. */ + isFirstExtent(): boolean; + /** When "true", map is at the last extent. */ + isLastExtent(): boolean; + /** + * Set the SimpleFillSymbol used for the rubber band zoom. + * @param symbol The SimpleFillSymbol used for the rubber band zoom. + */ + setZoomSymbol(symbol: Symbol): void; + /** Zoom to full extent of base layer. */ + zoomToFullExtent(): void; + /** Zoom to next extent in extent history. */ + zoomToNextExtent(): void; + /** Zoom to previous extent in extent history. */ + zoomToPrevExtent(): void; + /** Fires when the extent history changes. */ + on(type: "extent-history-change", listener: (event: { target: Navigation }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = Navigation; +} + +declare module "esri/undoManager" { + import esri = require("esri"); + import OperationBase = require("esri/OperationBase"); + + /** The UndoManager is a utility object that allows you to easily build applications with undo/redo functionality. */ + class UndoManager { + /** When true, there are redo operations available on the stack. */ + canRedo: boolean; + /** When true, there are undo operations available on the stack. */ + canUndo: boolean; + /** The number of operations stored in the history stack. */ + length: number; + /** The current operation position. */ + position: number; + /** + * Creates a new UndoManager object. + * @param options See options list for parameters. + */ + constructor(options?: esri.UndoManagerOptions); + /** + * Adds an undo operation to the stack and clears the redo stack. + * @param operation An operation to add to the stack. + */ + add(operation: OperationBase): void; + /** Clear the redo stack */ + clearRedo(): void; + /** Clear the undo stack. */ + clearUndo(): void; + /** Destroy the operation manager. */ + destroy(): void; + /** + * Get the specified operation from the stack. + * @param operationId The operation id. + */ + get(operationId: number): OperationBase; + /** Get the next redo operation from the stack */ + peekRedo(): OperationBase; + /** Get the next undo operation from the stack. */ + peekUndo(): OperationBase; + /** Moves the current position to the next redo operation and calls the operation's performRedo() method. */ + redo(): void; + /** + * Remove the specified operation from the stack. + * @param operationId The operation id. + */ + remove(operationId: number): OperationBase; + /** Moves the current position to the next undo operation and calls the operation's performUndo method. */ + undo(): void; + /** Fires when the add method is called to add an operation is added to the stack. */ + on(type: "add", listener: (event: { target: UndoManager }) => void): esri.Handle; + /** Fires when the undo/redo stack changes. */ + on(type: "change", listener: (event: { target: UndoManager }) => void): esri.Handle; + /** Fires when the redo method is called. */ + on(type: "redo", listener: (event: { target: UndoManager }) => void): esri.Handle; + /** Fires when the undo method is called. */ + on(type: "undo", listener: (event: { target: UndoManager }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = UndoManager; +} + +declare module "esri/units" { + /** Esri unit constants. */ + class Units { + /** Units are acres. */ + static ACRES: any; + /** Units are ares. */ + static ARES: any; + /** Units are centimeters. */ + static CENTIMETERS: any; + /** Units are decimal degrees. */ + static DECIMAL_DEGREES: any; + /** Units are decimeters. */ + static DECIMETERS: any; + /** Units are degree, minute, seconds. */ + static DEGREE_MINUTE_SECONDS: any; + /** Units are feet. */ + static FEET: any; + /** Units are hectares. */ + static HECTARES: any; + /** Units are inches. */ + static INCHES: any; + /** Units are kilometers. */ + static KILOMETERS: any; + /** Units are meters. */ + static METERS: any; + /** Units are miles. */ + static MILES: any; + /** Units are millimeters. */ + static MILLIMETERS: any; + /** Units are nautical miles. */ + static NAUTICAL_MILES: any; + /** Units are points. */ + static POINTS: any; + /** Units are square centimeters. */ + static SQUARE_CENTIMETERS: any; + /** Units are square deciemeters. */ + static SQUARE_DECIMETERS: any; + /** Units are square feet. */ + static SQUARE_FEET: any; + /** Units are square inches. */ + static SQUARE_INCHES: any; + /** Units are square kilometers. */ + static SQUARE_KILOMETERS: any; + /** Units are square meters. */ + static SQUARE_METERS: any; + /** Units are square miles. */ + static SQUARE_MILES: any; + /** Units are square millimeters. */ + static SQUARE_MILLIMETERS: any; + /** Units are square yards. */ + static SQUARE_YARDS: any; + /** Units are unknown. */ + static UNKNOWN: any; + /** Units are yards. */ + static YARDS: any; + } + export = Units; +} + +declare module "esri/urlUtils" { + /** Utility methods for working with URLs. */ + var urlUtils: { + /** + * Adds the given proxy rule to the proxy rules list: esri.config.defaults.io.proxyRules + * @param rule The rule argument should have the following properties. + */ + addProxyRule(rule: any): number; + /** Returns the proxy rule that matches the given url. */ + getProxyRule(): any; + /** + * Converts the URL arguments to an object representation. + * @param url The input URL. + */ + urlToObject(url: string): any; + }; + export = urlUtils; +} + +declare module "esri/virtualearth/VEAddress" { + /** The Bing Maps address details. */ + class VEAddress { + /** Specifies the street line of an address. */ + addressLine: string; + /** Specifies the subdivision name within the country or region for an address. */ + adminDistrict: string; + /** Specifies the country or region name of an address. */ + countryRegion: string; + /** Specifies the higher level administrative subdivision used in some countries or regions. */ + district: string; + /** Contains the complete address. */ + formattedAddress: string; + /** Specifies the populated place for the address. */ + locality: string; + /** Specifies the post code, postal code, or ZIP Code of an address. */ + postalCode: string; + /** Specifies the postal city of an address. */ + postalTown: string; + } + export = VEAddress; +} + +declare module "esri/virtualearth/VEGeocodeResult" { + import VEAddress = require("esri/virtualearth/VEAddress"); + import Extent = require("esri/geometry/Extent"); + import Point = require("esri/geometry/Point"); + + /** Represents a Bing Maps address and its location. */ + class VEGeocodeResult { + /** Specifies address properties for the result. */ + address: VEAddress; + /** Best extent for displaying the result. */ + bestView: Extent; + /** Contains values that indicate the geocode method used to match the location to the map. */ + calculationMethod: string; + /** Value indicating how confident the service is about the result. */ + confidence: string; + /** Contains a display name for the result. */ + displayName: string; + /** Further refines the geocode results that have been returned. */ + entityType: string; + /** The X and Y coordinates of the result in decimal degrees. */ + location: Point; + /** An array of values that indicate the geocoding level of the location match. */ + matchCodes: string; + } + export = VEGeocodeResult; +} + +declare module "esri/virtualearth/VEGeocoder" { + import esri = require("esri"); + import VEGeocodeResult = require("esri/virtualearth/VEGeocodeResult"); + + /** Bing Maps geocoder. */ + class VEGeocoder { + /** Specifies the culture in which to return results. */ + culture: string; + /** + * Creates a new VEGeocoder object. + * @param options See options list for parameters. + */ + constructor(options: esri.VEGeocoderOptions); + /** + * Sends a geocode request to Bing Maps to find candidates for a single address specified in the query argument. + * @param query The address to locate. + * @param callback The function to call when the method has completed. + * @param errback An error object is returned if an error occurs during task execution. + */ + addressToLocations(query: string, callback?: Function, errback?: Function): any; + /** + * Sets the culture in which to return results. + * @param culture The culture value. + */ + setCulture(culture: string): void; + /** Fires when VEGeocode.addressToLocation() has completed. */ + on(type: "address-to-locations-complete", listener: (event: { geocodeResults: VEGeocodeResult[]; target: VEGeocoder }) => void): esri.Handle; + /** Fires when an error occurs when executing the task. */ + on(type: "error", listener: (event: { error: Error; target: VEGeocoder }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VEGeocoder; +} + +declare module "esri/virtualearth/VETiledLayer" { + import esri = require("esri"); + import TiledMapServiceLayer = require("esri/layers/TiledMapServiceLayer"); + + /** Bing Maps tiled layer. */ + class VETiledLayer extends TiledMapServiceLayer { + /** Bing Maps Aerial layer. */ + static MAP_STYLE_AERIAL: any; + /** Bing Maps Aerial with Labels layer. */ + static MAP_STYLE_AERIAL_WITH_LABELS: any; + /** Bing Maps Roads layer. */ + static MAP_STYLE_ROAD: any; + /** The copyright text. */ + copyright: string; + /** Specifies the culture in which to return results. */ + culture: string; + /** Bing Maps style. */ + mapStyle: string; + /** + * Creates a new VETiledLayer object. + * @param options See options list for parameters. + */ + constructor(options: esri.VETiledLayerOptions); + /** + * Sets the culture in which to return results. + * @param culture The culture value. + */ + setCulture(culture: string): void; + /** + * Sets the Bing Maps style. + * @param style Bing Maps style. + */ + setMapStyle(style: string): void; + /** Fires when the map style is changed. */ + on(type: "map-style-change", listener: (event: { target: VETiledLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VETiledLayer; +} + +declare module "esri/workers/WorkerClient" { + /** The WorkerClient is the primary entry point for interfacing with background Workers. */ + class WorkerClient { + /** Return Deferreds rather than Promises from postMessage. */ + returnDeferreds: boolean; + /** Reference to the actual HTML5 Worker instance. */ + worker: Worker; + /** + * Creates a WorkerClient. + * @param path A require style string path to the worker script. + * @param deferreds Whether to return Deferreds rather than Promises from methods. + */ + constructor(path: string, deferreds?: boolean); + /** + * Adds a function to the worker that takes the worker's internal calls to postMessage and calls this function before sending the original message back to the main thread. + * @param module A require path to a worker-compatible script containing the callback function. + * @param name The name of the callback function. + */ + addWorkerCallback(module: string, name?: string): any; + /** + * Import any script or function into the worker. + * @param paths An AMD require path to a script file to import. + */ + importScripts(paths: string): any; + /** + * Import any script or function into the worker. + * @param paths An AMD require path to a script file to import. + */ + importScripts(paths: string[]): any; + /** + * Posts a message to the worker. + * @param msg The data to post to the worker. + * @param transfers An optional array of transferable objects. + */ + postMessage(msg: any, transfers?: any[]): any; + /** + * Posts a message to the worker. + * @param msg The data to post to the worker. + * @param transfers An optional array of transferable objects. + */ + postMessage(msg: any[], transfers?: any[]): any; + /** + * Sets the worker that is used in the Worker Client. + * @param paths An AMD require path to a script file to import. + */ + setWorker(paths: string): void; + /** + * Sets the worker that is used in the Worker Client. + * @param paths An AMD require path to a script file to import. + */ + setWorker(paths: string[]): void; + /** Terminates the worker and cancels all unresolved messages. */ + terminate(): void; + } + export = WorkerClient; +} + From 85f3a510463c0c60f84dd7a156103aab1bfa65f3 Mon Sep 17 00:00:00 2001 From: David Li Date: Sat, 7 Mar 2015 00:58:39 -0500 Subject: [PATCH 66/78] add: Definition and test for jsSHA Definition and test files for the jsSHA library at Signed-off-by: David Li --- jssha/jssha-tests.ts | 15 ++++++++++ jssha/jssha.d.ts | 65 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100755 jssha/jssha-tests.ts create mode 100755 jssha/jssha.d.ts diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts new file mode 100755 index 000000000..8d6eec5a6 --- /dev/null +++ b/jssha/jssha-tests.ts @@ -0,0 +1,15 @@ +/// +/// + +var imported = require("jssha"); + +var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8"); +var shaObj2 = new imported("This is a Test", "TEXT"); + +var hash1:string = shaObj2.getHash("SHA-512", "HEX"); +var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2); +var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"}); + +var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"}; +var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX"); +var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format); diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts new file mode 100755 index 000000000..1c75c3862 --- /dev/null +++ b/jssha/jssha.d.ts @@ -0,0 +1,65 @@ +// Type definitions for jsSHA +// Project: https://github.com/Caligatio/jsSHA +// Definitions by: David Li +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module jsSHA { + export interface OutputFormatOptions { + outputUpper : boolean; + b64Pad : string; + } + + export interface jsSHA { + /** + * jsSHA is the workhorse of the library. Instantiate it with the string to + * be hashed as the parameter + * + * @constructor + * @this {jsSHA} + * @param {string} srcString The string to be hashed + * @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES + * @param {string=} encoding The text encoding to use to encode the source + * string + */ + new (srcString:string, inputFormat:string, encoding?:string):jsSHA; + + /** + * Returns the desired SHA hash of the string specified at instantiation + * using the specified parameters + * + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, + * SHA-256, SHA-384, or SHA-512) + * @param {string} format The desired output formatting (B64, HEX, or BYTES) + * @param {number=} numRounds The number of rounds of hashing to be + * executed + * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts + * Hash list of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string; + + /** + * Returns the desired HMAC of the string specified at instantiation + * using the key and variant parameter + * + * @param {string} key The key used to calculate the HMAC + * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, + * SHA-256, SHA-384, or SHA-512) + * @param {string} outputFormat The desired output formatting + * (B64, HEX, or BYTES) + * @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts + * associative array of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string; + } +} + +declare var jsSHA: jsSHA.jsSHA; +declare module 'jssha' { + export = jsSHA; +} From 817bbaddc0beca1000bc4ae48f68a5f9e12ec02a Mon Sep 17 00:00:00 2001 From: falsandtru Date: Sat, 7 Mar 2015 15:31:10 +0900 Subject: [PATCH 67/78] Fix trap suggestion --- jquery/jquery-tests.ts | 26 +++++++++++- jquery/jquery.d.ts | 91 ++++++++++++++++++++---------------------- 2 files changed, 68 insertions(+), 49 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 8a2e23cf9..13289606f 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -3212,7 +3212,7 @@ function test_EventIsCallable() { } $.when($.ajax("/my/page.json")).then(a => a.asdf); // is type JQueryPromise -$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise +$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise $.when("asdf", "jkl;").done((x,y) => x.length + y.length, (x,y) => x.length + y.length); var f1 = $.when("fetch"); // Is type JQueryPromise @@ -3370,4 +3370,26 @@ function test_promise_then_change_type() { count().done(data => { }).fail((exception: Error) => { }); -} \ No newline at end of file +} + +function test_promise_then_not_return_deferred() { + var deferred: JQueryDeferred = $.Deferred(); + deferred = deferred.progress(); + deferred = deferred.done(); + deferred = deferred.fail(); + deferred = deferred.always(); + deferred = deferred.notify(); + deferred = deferred.resolve(); + deferred = deferred.reject(); + deferred.state(); + promise = deferred.promise(); + promise = deferred.then(function () { }); + + var promise: JQueryPromise = $.Deferred().promise(); + promise = promise.then(function () { }); + promise = promise.progress(); + promise = promise.done(); + promise = promise.fail(); + promise = promise.always(); + promise.state(); +} diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 8ddc072b0..3d46b3faa 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -276,7 +276,15 @@ interface JQueryGenericPromise { * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ - then(doneFilter: (value: T) => U|JQueryGenericPromise, failFilter?: (reason: any) => U|JQueryGenericPromise): JQueryGenericPromise; + then(doneFilter: (value: T, ...values: any[]) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; + + /** + * Determine the current state of a Deferred object. + */ + state(): string; + + // Deprecated - given no typings + pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; } /** @@ -293,7 +301,40 @@ interface JQueryPromiseOperator { /** * Interface for the JQuery promise, part of callbacks */ -interface JQueryPromise { +interface JQueryPromise extends JQueryGenericPromise { + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * + * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + */ + always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + */ + done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + */ + fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. + */ + progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; +} + +/** + * Interface for the JQuery deferred, part of callbacks + */ +interface JQueryDeferred extends JQueryGenericPromise { /** * Add handlers to be called when the Deferred object is either resolved or rejected. * @@ -322,38 +363,6 @@ interface JQueryPromise { */ progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Determine the current state of a Deferred object. - */ - state(): string; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (value: T) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; - - // Because JQuery Promises Suck - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (...values: any[]) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; -} - -/** - * Interface for the JQuery deferred, part of callbacks - */ -interface JQueryDeferred extends JQueryPromise { /** * Call the progressCallbacks on a Deferred object with the given args. * @@ -765,19 +774,7 @@ interface JQueryStatic { * * @param deferreds One or more Deferred objects, or plain JavaScript objects. */ - when(...deferreds: JQueryGenericPromise[]): JQueryPromise; - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - */ - when(...deferreds: T[]): JQueryPromise; - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - */ - when(...deferreds: any[]): JQueryPromise; + when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; /** * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. From f6229f0cf4834132014863aa3e7800f1a69691d3 Mon Sep 17 00:00:00 2001 From: David Li Date: Sat, 7 Mar 2015 01:39:50 -0500 Subject: [PATCH 68/78] filesystem: Quality-of-life changes Certain methods always return a specific Entry type. Define more specific callbacks so that typescript can infer when an Entry is a DirectoryEntry or FileEntry, removing the need to explicitly state the type in certain callbacks. Existing code using this definition should not be broken as a result of this change. Signed-off-by: David Li --- filesystem/filesystem-tests.ts | 4 ++-- filesystem/filesystem.d.ts | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/filesystem/filesystem-tests.ts b/filesystem/filesystem-tests.ts index 8f175db98..9eb6fbaae 100644 --- a/filesystem/filesystem-tests.ts +++ b/filesystem/filesystem-tests.ts @@ -7,7 +7,7 @@ declare function writeDataToLogFile(fileWriter:FileWriterSync): void; function useAsyncFS(fs:FileSystem):void { // see getAsText example in [FILE-API-ED]. - fs.root.getFile("already_there.txt", null, function (f:FileEntry): void{ + fs.root.getFile("already_there.txt", null, function (f): void{ // In the example of the specification, there is a following code: // @@ -19,7 +19,7 @@ function useAsyncFS(fs:FileSystem):void { }); // But now we can also write to the file; see [FILE-WRITER-ED]. - fs.root.getFile("logFile", {create: true}, function (f:FileEntry): void{ + fs.root.getFile("logFile", {create: true}, function (f): void{ f.createWriter(writeDataToLogFile); }); } diff --git a/filesystem/filesystem.d.ts b/filesystem/filesystem.d.ts index 8b20b113c..1b76846b4 100644 --- a/filesystem/filesystem.d.ts +++ b/filesystem/filesystem.d.ts @@ -197,7 +197,7 @@ interface Entry { * @param successCallback A callback that is called to return the parent Entry. * @param errorCallback A callback that is called when errors happen. */ - getParent(successCallback:EntryCallback, errorCallback?:ErrorCallback):void; + getParent(successCallback:DirectoryEntryCallback, errorCallback?:ErrorCallback):void; } /** @@ -223,7 +223,7 @@ interface DirectoryEntry extends Entry { * @param successCallback A callback that is called to return the File selected or created. * @param errorCallback A callback that is called when errors happen. */ - getFile(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void; + getFile(path:string, options?:Flags, successCallback?:FileEntryCallback, errorCallback?:ErrorCallback):void; /** * Creates or looks up a directory. @@ -240,7 +240,7 @@ interface DirectoryEntry extends Entry { * @param errorCallback A callback that is called when errors happen. * */ - getDirectory(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void; + getDirectory(path:string, options?:Flags, successCallback?:DirectoryEntryCallback, errorCallback?:ErrorCallback):void; /** * Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem. @@ -307,6 +307,26 @@ interface EntryCallback { (entry:Entry):void; } +/** + * This interface is the callback used to look up FileEntry objects. + */ +interface FileEntryCallback { + /** + * @param entry + */ + (entry:FileEntry):void; +} + +/** + * This interface is the callback used to look up DirectoryEntry objects. + */ +interface DirectoryEntryCallback { + /** + * @param entry + */ + (entry:DirectoryEntry):void; +} + /** * When readEntries() succeeds, the following callback is made. */ From bb9b1b076104da2eb3d43f8fff700ee5962b732b Mon Sep 17 00:00:00 2001 From: falsandtru Date: Sat, 7 Mar 2015 16:10:07 +0900 Subject: [PATCH 69/78] Improve test codes --- jquery/jquery-tests.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 13289606f..006140f2f 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -3373,7 +3373,10 @@ function test_promise_then_change_type() { } function test_promise_then_not_return_deferred() { + var state: string; + var deferred: JQueryDeferred = $.Deferred(); + state = deferred.state(); deferred = deferred.progress(); deferred = deferred.done(); deferred = deferred.fail(); @@ -3381,15 +3384,14 @@ function test_promise_then_not_return_deferred() { deferred = deferred.notify(); deferred = deferred.resolve(); deferred = deferred.reject(); - deferred.state(); promise = deferred.promise(); promise = deferred.then(function () { }); var promise: JQueryPromise = $.Deferred().promise(); + state = promise.state(); promise = promise.then(function () { }); promise = promise.progress(); promise = promise.done(); promise = promise.fail(); promise = promise.always(); - promise.state(); } From 3af6e3b8dfba7a50231b7543d941d5297c14209e Mon Sep 17 00:00:00 2001 From: falsandtru Date: Sat, 7 Mar 2015 17:00:45 +0900 Subject: [PATCH 70/78] Fix type definition --- jquery/jquery.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 3d46b3faa..a2ab74ebd 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -276,7 +276,7 @@ interface JQueryGenericPromise { * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ - then(doneFilter: (value: T, ...values: any[]) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; + then(doneFilter: (value: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => U|JQueryPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; /** * Determine the current state of a Deferred object. From 1dc67b231b7ac3289e29e10303516ce2a6cfb9bf Mon Sep 17 00:00:00 2001 From: falsandtru Date: Sat, 7 Mar 2015 17:01:00 +0900 Subject: [PATCH 71/78] Fix type definition --- q/Q-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index ff540bd6b..7872f23b2 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -67,6 +67,7 @@ Q.allResolved([]) declare var arrayPromise: Q.IPromise; declare var stringPromise: Q.IPromise; declare function returnsNumPromise(text: string): Q.Promise; +declare function returnsNumPromise(text: string): JQueryPromise; Q(arrayPromise) // type specification required .then(arr => arr.join(',')) From 4f28dbebbb358ef26a4477bd50d65055b94722a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Pluci=C5=84ski?= Date: Sat, 7 Mar 2015 19:02:20 +0100 Subject: [PATCH 72/78] added new definitions of functions fixed error with untyped state added new definitions of functions fixed error with untyped state --- jstree/jstree.d.ts | 426 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 399 insertions(+), 27 deletions(-) diff --git a/jstree/jstree.d.ts b/jstree/jstree.d.ts index 5d4be29bf..ff0338e13 100644 --- a/jstree/jstree.d.ts +++ b/jstree/jstree.d.ts @@ -1,7 +1,8 @@ -// Type definitions for jsTree v3.0.4 +// Type definitions for jsTree v3.0.9 // Project: http://www.jstree.com/ // Definitions by: Adam PluciÅ„ski // Definitions: https://github.com/borisyankov/DefinitelyTyped +// 45 commit df38535 2015-03-02 13:23 +2:00 /// @@ -14,7 +15,6 @@ interface JQueryStatic { * @type {JSTreeStatic} */ jstree?: JSTreeStatic; - } interface JQuery { @@ -165,6 +165,11 @@ interface JSTreeStaticDefaults { */ dnd?: JSTreeStaticDefaultsDragNDrop; + /** + * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). + */ + massload?: JSTreeStaticDefaultsMassload; + /** * stores all defaults for the search plugin */ @@ -347,6 +352,12 @@ interface JSTreeStaticDefaultsCore { * @name $.jstree.defaults.core.force_text */ force_text?: boolean; + + /** + * Should the node should be toggled if the text is double clicked . Defaults to `true` + * @name $.jstree.defaults.core.dblclick_toggle + */ + dblclick_toggle?: boolean; } interface JSTreeStaticDefaultsCoreThemes { @@ -524,17 +535,71 @@ interface JSTreeStaticDefaultsDragNDrop { * @plugin dnd */ inside_pos: any; + + /** + * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node + * @name $.jstree.defaults.dnd.drag_selection + * @plugin dnd + */ + drag_selection: boolean; + + /** + * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. + * @name $.jstree.defaults.dnd.touch + * @plugin dnd + */ + touch: boolean; + + /** + * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. + * @name $.jstree.defaults.dnd.large_drop_target + * @plugin dnd + */ + large_drop_target: boolean; + + /** + * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". + * @name $.jstree.defaults.dnd.large_drag_target + * @plugin dnd + */ + large_drag_target: boolean; +} + +interface JSTreeStaticDefaultsMassload { + /** + * massload configuration + * + * It is possible to set this to a standard jQuery-like AJAX config. + * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. + * + * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. + * + * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. + * + * { + * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], + * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] + * } + * + * @name $.jstree.defaults.massload + * @plugin massload + */ + + url: any; + + data: any; } interface JSTreeStaticDefaultsSearch { /** * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. * - * A `str` (which is the search string) parameter will be added with the request. + * A `str` (which is the search string) parameter will be added with the request, + * an optional `inside` parameter will be added if the search is limited to a node id. * The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. * Leave this setting as `false` to not query the server. You can also set this to a function, - * which will be invoked in the instance's scope and receive 2 parameters - - * the search string and the callback to call with the array of nodes to load. + * which will be invoked in the instance's scope and receive 3 parameters - the search string, + * the callback to call with the array of nodes to load, and the optional node ID to limit the search to * @name $.jstree.defaults.search.ajax * @plugin search */ @@ -556,7 +621,7 @@ interface JSTreeStaticDefaultsSearch { /** * Indicates if the tree should be filtered (by default) to show only matching nodes - * (keep in mind this can be a heavy on large trees in old browsers). + * (keep in mind this can be a heavy on large trees in old browsers). * This setting can be changed at runtime when calling the search method. Default is `false`. * @name $.jstree.defaults.search.show_only_matches * @plugin search @@ -637,12 +702,65 @@ interface JSTreeStaticDefaultsUnique { } interface JSTree extends JQuery { + /** + * used to decorate an instance with a plugin. Used internally. + * @private + * @name plugin(deco [, opts]) + * @param {String} deco the plugin to decorate with + * @param {Object} opts options for the plugin + * @return {jsTree} + */ + plugin: (deco: string, opts?: any) => JSTree; + + /** + * used to decorate an instance with a plugin. Used internally. + * @private + * @name init(el, options) + * @param {DOMElement|jQuery|String} el the element we are transforming + * @param {Object} options options for this instance + * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree + */ + init: (el:any, options:any) => void; + /** * destroy an instance * @name destroy() * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact */ destroy: (keep_html?: boolean) => void; + + /** + * part of the destroying of an instance. Used internally. + * @private + * @name teardown() + */ + teardown: () => void; + + /** + * bind all events. Used internally. + * @private + * @name bind() + */ + bind: () => any; + + /** + * part of the destroying of an instance. Used internally. + * @private + * @name unbind() + */ + unbind: () => any; + + /** + * trigger an event. Used internally. + * @private + * @name trigger(ev [, data]) + * @param {String} ev the name of the event to trigger + * @param {Object} data additional data to pass with the event + */ + /* + * defined in JQuery + */ + // trigger: (ev: string, data?: Object) => any; /** * returns the jQuery extended instance container @@ -651,6 +769,50 @@ interface JSTree extends JQuery { */ get_container: () => JQuery; + /** + * returns the jQuery extended main UL node inside the instance container. Used internally. + * @private + * @name get_container_ul() + * @return {jQuery} + */ + get_container_ul: () => JQuery; + + /** + * gets string replacements (localization). Used internally. + * @private + * @name get_string(key) + * @param {String} key + * @return {String} + */ + get_string: (key: string) => string; + + /** + * gets the first child of a DOM node. Used internally. + * @private + * @name _firstChild(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _firstChild: (dom: HTMLElement) => HTMLElement; + + /** + * gets the next sibling of a DOM node. Used internally. + * @private + * @name _nextSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _nextSibling: (dom: HTMLElement) => HTMLElement; + + /** + * gets the previous sibling of a DOM node. Used internally. + * @private + * @name _previousSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _previousSibling: (dom: HTMLElement) => HTMLElement; + /** * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) * @name get_node(obj [, as_dom]) @@ -763,6 +925,107 @@ interface JSTree extends JQuery { */ load_node: (obj: any, callback: (node: any, status: boolean) => void) => boolean; + /** + * load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally. + * @private + * @name _load_nodes(nodes [, callback]) + * @param {array} nodes + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes + * @param {Boolean} is_callback - if false reloads node (AP - original comment missing in source code) + */ + _load_nodes: (nodes: any[], callback?: (nodes: any[]) => void, is_callback?: boolean) => void; + + /** + * loads all unloaded nodes + * @name load_all([obj, callback]) + * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree + * @param {function} callback a function to be executed once loading all the nodes is complete, + * @trigger load_all.jstree + */ + load_all: (obj: any, callback: () => void) => void; + + /** + * handles the actual loading of a node. Used only internally. + * @private + * @name _load_node(obj [, callback]) + * @param {mixed} obj + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status + * @return {Boolean} + */ + _load_node: (obj: any, callback?: (status: boolean) => void) => boolean; + + /** + * adds a node to the list of nodes to redraw. Used only internally. + * @private + * @name _node_changed(obj) + * @param {mixed} obj + */ + _node_changed: (obj: any) => void; + + /** + * appends HTML content to the tree. Used internally. + * @private + * @name _append_html_data(obj, data) + * @param {mixed} obj the node to append to + * @param {String} data the HTML string to parse and append + * @param {function} callback function which takes boolean flag executes after append (AP: originally lack of comment) + * @trigger model.jstree, changed.jstree + */ + _append_html_data: (dom: any, data: string, cb: (flag: boolean) => void) => void; + + /** + * appends JSON content to the tree. Used internally. + * @private + * @name _append_json_data(obj, data) + * @param {mixed} dom the node to append to + * @param {String} data the JSON object to parse and append + * @param {function} cb function which takes boolean flag executes after append (AP: originally lack of comment) + * @param {Boolean} force_processing internal param - do not set + * @trigger model.jstree, changed.jstree + */ + _append_json_data: (dom: any, data: string, cb: (flag: boolean) => void, force_processing: boolean) => void; + + /** + * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_html(d [, p, ps]) + * @param {jQuery} d the jQuery object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_html: (d: JQuery, p?: string, ps?: any[]) => string; + + /** + * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_flat_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_flat_json: (d: any, p?: string, ps?: any[]) => string; + + /** + * parses a node from a JSON object and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_json: (d: any, p?: string, ps?: any[]) => string; + + /** + * redraws all nodes that need to be redrawn. Used internally. + * @private + * @name _redraw() + * @trigger redraw.jstree + */ + _redraw: () => void ; + /** * redraws all nodes that need to be redrawn or optionally - the whole tree * @name redraw([full]) @@ -770,6 +1033,25 @@ interface JSTree extends JQuery { */ redraw: (full?: boolean) => void; + /** + * redraws a single node's children. Used internally. + * @private + * @name draw_children(node) + * @param {mixed} node the node whose children will be redrawn + */ + draw_children: (node: any) => void; + + /** + * redraws a single node. Used internally. + * @private + * @name redraw_node(node, deep, is_callback, force_render) + * @param {mixed} node the node to redraw + * @param {Boolean} deep should child nodes be redrawn too + * @param {Boolean} is_callback is this a recursion call + * @param {Boolean} force_render should children of closed parents be drawn anyway + */ + redraw_node: (node: any, deep: boolean, is_callback: boolean, force_render: boolean) => void; + /** * opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready. * @name open_node(obj [, callback, animation]) @@ -781,6 +1063,14 @@ interface JSTree extends JQuery { */ open_node: (obj: any, callback?: any, animation?: any) => void; + /** + * opens every parent of a node (node should be loaded) + * @name _open_to(obj) + * @param {mixed} obj the node to reveal + * @private + */ + _open_to: (obj:any) => void; + /** * closes a node, hiding its children * @name close_node(obj [, animation]) @@ -841,6 +1131,34 @@ interface JSTree extends JQuery { */ disable_node: (obj: any) => boolean; + /** + * called when a node is selected by the user. Used internally. + * @private + * @name activate_node(obj, e) + * @param {mixed} obj the node + * @param {Object} e the related event + * @trigger activate_node.jstree, changed.jstree + */ + activate_node: (obj: any, e: any) => void; + + /** + * applies the hover state on a node, called when a node is hovered by the user. Used internally. + * @private + * @name hover_node(obj) + * @param {mixed} obj + * @trigger hover_node.jstree + */ + hover_node: (obj: any) => void; + + /** + * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. + * @private + * @name dehover_node(obj) + * @param {mixed} obj + * @trigger dehover_node.jstree + */ + dehover_node: (obj: any) => void; + /** * select a node * @name select_node(obj [, supress_event, prevent_open]) @@ -908,6 +1226,24 @@ interface JSTree extends JQuery { */ get_bottom_selected: (full?: any) => any[]; + /** + * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. + * @name get_state() + * @private + * @return {Object} + */ + get_state: () => any; + + /** + * sets the state of the tree. Used internally. + * @name set_state(state [, callback]) + * @private + * @param {Object} state the state to restore + * @param {Function} callback an optional function to execute once the state is restored. + * @trigger set_state.jstree + */ + set_state: (state: any, callback: () => void) => void; + /** * refreshes the tree - all nodes are reloaded with calls to `load_node`. * @name refresh() @@ -943,6 +1279,17 @@ interface JSTree extends JQuery { */ get_text: (obj: any) => string; + /** + * set the text value of a node. Used internally, please use `rename_node(obj, val)`. + * @private + * @name set_text(obj, val) + * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes + * @param {String} val the new text value + * @return {Boolean} + * @trigger set_text.jstree + */ + set_text: (obj:any, val:string) => boolean; + /** * gets a JSON representation of a node (or the whole tree) * @name get_json([obj, options]) @@ -989,6 +1336,19 @@ interface JSTree extends JQuery { */ delete_node: (obj: any) => boolean; + /** + * check if an operation is premitted on the tree. Used internally. + * @private + * @name check(chk, obj, par, pos) + * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" + * @param {mixed} obj the node + * @param {mixed} par the parent + * @param {mixed} pos the position to insert at, or if "rename_node" - the new name + * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node + * @return {Boolean} + */ + check: (chk: string, obj: any, par: any, pos: any, more: any) => boolean; + /** * get the last error * @name last_error() @@ -1005,9 +1365,10 @@ interface JSTree extends JQuery { * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance * @trigger move_node.jstree */ - move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean) => void; + move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; /** * copy a node to a new parent @@ -1018,9 +1379,10 @@ interface JSTree extends JQuery { * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance * @trigger model.jstree copy_node.jstree */ - copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean) => void; + copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void; /** * cut a node (a later call to `paste(obj)` would move the node) @@ -1193,15 +1555,12 @@ interface JSTree extends JQuery { show_icon: (obj: any) => void; /** - * redraws a single node. Used internally. + * set the undetermined state where and if necessary. Used internally. * @private - * @name redraw_node(node, deep, is_callback) - * @param {mixed} node the node to redraw - * @param {Boolean} deep should child nodes be redrawn too - * @param {Boolean} is_callback is this a recursion call - * @param {Boolean} force_render should children of closed parents be drawn anyway + * @name _undetermined() + * @plugin checkbox */ - redraw_node: (obj: any, deep?: boolean, is_callback?: boolean, force_render?: boolean) => any; + _undetermined: () => void; /** * show the node checkbox icons @@ -1232,16 +1591,6 @@ interface JSTree extends JQuery { */ is_undetermined: (obj: any) => boolean; - /** - * called when a node is selected by the user. Used internally. - * @private - * @name activate_node(obj, e) - * @param {mixed} obj the node - * @param {Object} e the related event - * @trigger activate_node.jstree, changed.jstree - */ - activate_node: (obj: any, e: any) => any; - /** * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) * @name check_node(obj) @@ -1315,7 +1664,6 @@ interface JSTree extends JQuery { /** * context menu plugin */ - teardown: () => void; /** * prepare and show the context menu for a node @@ -1329,16 +1677,31 @@ interface JSTree extends JQuery { */ show_contextmenu: (obj: any, x?: number, y?: number, e?: any) => void; + /** + * show the prepared context menu for a node + * @name _show_contextmenu(obj, x, y, i) + * @param {mixed} obj the node + * @param {Number} x the x-coordinate relative to the document to show the menu at + * @param {Number} y the y-coordinate relative to the document to show the menu at + * @param {Number} i the object of items to show + * @plugin contextmenu + * @trigger show_contextmenu.jstree + * @private + */ + _show_contextmenu: (obj: any, x: number, y: number, i: number) => void; + /** * used to search the tree nodes for a given string * @name search(str [, skip_async]) * @param {String} str the search string * @param {Boolean} skip_async if set to true server will not be queried even if configured * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) + * @param {mixed} inside an optional node to whose children to limit the search + * @param {Boolean} append if set to true the results of this search are appended to the previous search * @plugin search * @trigger search.jstree */ - search: (str: string, skip_async?: boolean, show_only_matches?: boolean) => void; + search: (str: string, skip_async?: boolean, show_only_matches?: boolean, inside?: any, append?: boolean) => void; /** * used to clear the last search (removes classes and shows all nodes if filtering is on) @@ -1348,6 +1711,15 @@ interface JSTree extends JQuery { */ clear_search: () => void; + /** + * opens nodes that need to be opened to reveal the search results. Used only internally. + * @private + * @name _search_open(d) + * @param {Array} d an array of node IDs + * @plugin search + */ + _search_open: (d: string[]) => void; + /** * used to sort a node's children * @private From b04b6b41e1b4a062b7454c9a9b84ebef0335ba80 Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Sun, 8 Mar 2015 10:39:42 -0700 Subject: [PATCH 73/78] The mocha options are optional This was frustrating before if you wanted to use gulp mocha without customization. --- gulp-mocha/gulp-mocha.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-mocha/gulp-mocha.d.ts b/gulp-mocha/gulp-mocha.d.ts index e6bc099c3..8d21b1323 100644 --- a/gulp-mocha/gulp-mocha.d.ts +++ b/gulp-mocha/gulp-mocha.d.ts @@ -7,6 +7,6 @@ /// declare module "gulp-mocha" { - function mocha(setupOptions: MochaSetupOptions): NodeJS.ReadWriteStream; + function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream; export = mocha; } \ No newline at end of file From afdc4fb569ec4a983ac137f3dc4dff972705eccd Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Sun, 8 Mar 2015 10:42:04 -0700 Subject: [PATCH 74/78] Adding a function for gulp-replace Adding a function for replacing strings. --- gulp-replace/gulp-replace.d.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gulp-replace/gulp-replace.d.ts b/gulp-replace/gulp-replace.d.ts index 6607da98c..cf6ef7164 100644 --- a/gulp-replace/gulp-replace.d.ts +++ b/gulp-replace/gulp-replace.d.ts @@ -10,8 +10,12 @@ declare module "gulp-replace" { skipBinary?: boolean; } - function replace(pattern: string, replacement: string, opts?: Options): NodeJS.ReadWriteStream; - function replace(pattern: RegExp, replacement: string, opts?: Options): NodeJS.ReadWriteStream; + interface Replacer { + (match: string): string + } + + function replace(pattern: string, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; + function replace(pattern: RegExp, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream; export = replace; } \ No newline at end of file From 91438ca0a160b6c6d8797bd5859dda44a0cee88f Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Sun, 8 Mar 2015 20:30:37 +0200 Subject: [PATCH 75/78] feat(angular-ui): add angular-ui-sortable definition --- angular-ui/angular-ui-sortable-tests.ts | 143 ++++++++++++++++ angular-ui/angular-ui-sortable.d.ts | 210 ++++++++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100644 angular-ui/angular-ui-sortable-tests.ts create mode 100644 angular-ui/angular-ui-sortable.d.ts diff --git a/angular-ui/angular-ui-sortable-tests.ts b/angular-ui/angular-ui-sortable-tests.ts new file mode 100644 index 000000000..836dc71e9 --- /dev/null +++ b/angular-ui/angular-ui-sortable-tests.ts @@ -0,0 +1,143 @@ +/// +/// + +var myApp = angular.module('testModule'); + +interface MySortableControllerScope extends ng.IScope { + items: SortableModelInfo[]; + sortableOptions: ng.ui.UISortableOptions; + sortingLog: SortLogInfo[]; +} + +interface SortableModelInfo { + text: string; + value: number; +} + +interface SortLogInfo { + ID: number; + Text: string; +} + +myApp.controller('sortableController', function ($scope: MySortableControllerScope) { + $scope.sortableOptions = { + activate: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + beforeStop: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + change: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + deactivate: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + out: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + over: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + receive: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + remove: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + sort: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + start: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + }, + stop: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + var uiitem: ng.ui.UISortableUIItem = ui.item; + var uiitemscope: ng.IScope = uiitem.scope(); + var uiitemsortable: ng.ui.UISortableProperties = uiitem.sortable; + + var dropindex: number = uiitemsortable.dropindex; + var droptarget: number = uiitemsortable.droptarget; + var droptargetModel: SortableModelInfo[] = uiitemsortable.droptargetModel; + var index: number = uiitemsortable.index; + var model: SortableModelInfo = uiitemsortable.model; + var moved: SortableModelInfo = uiitemsortable.moved; + var received: Boolean = uiitemsortable.received; + var source: ng.IAugmentedJQuery = uiitemsortable.source; + var sourceModel: SortableModelInfo[] = uiitemsortable.sourceModel; + + var logEntry = { + ID: $scope.sortingLog.length + 1, + Text: 'Moved element: ' + ui.item.sortable.model.text + }; + $scope.sortingLog.push(logEntry); + }, + update: function(e, ui) { + var jQueryEventObject: JQueryEventObject = e; + var uiSortableUIParams: ng.ui.UISortableUIParams = ui; + var voidcanceled: void = ui.item.sortable.cancel(); + var isCanceled: Boolean = ui.item.sortable.isCanceled(); + var isCustomHelperUsed: Boolean =ui.item.sortable.isCustomHelperUsed(); + } + }; + + $scope.sortableOptions.appendTo = document.body; + $scope.sortableOptions.appendTo = angular.element(document.body); + $scope.sortableOptions.appendTo = 'body'; + $scope.sortableOptions.axis = 'x'; + $scope.sortableOptions.axis = 'y'; + $scope.sortableOptions.axis = false; + $scope.sortableOptions.cancel = '.disabled'; + $scope.sortableOptions.connectWith = '.connectedSortable'; + $scope.sortableOptions.connectWith = false; + $scope.sortableOptions.containment = 'parent'; + $scope.sortableOptions.containment = 'body'; + $scope.sortableOptions.containment = document.body; + $scope.sortableOptions.containment = false; + $scope.sortableOptions.cursor = 'move'; + $scope.sortableOptions.cursorAt = false; + $scope.sortableOptions.cursorAt = { left: 5 }; + $scope.sortableOptions.delay = 300; + $scope.sortableOptions.disabled = true; + $scope.sortableOptions.distance = 5; + $scope.sortableOptions.dropOnEmpty = false; + $scope.sortableOptions.forceHelperSize = true; + $scope.sortableOptions.forcePlaceholderSize = true; + $scope.sortableOptions.grid = false; + $scope.sortableOptions.grid = [20, 10]; + $scope.sortableOptions.handle = '.handle'; + $scope.sortableOptions.helper = 'clone'; + $scope.sortableOptions.helper = function(e: JQueryEventObject, item: ng.IAugmentedJQuery) { + return item.clone(); + }; + $scope.sortableOptions.items = '> li:not(.disabled)'; + $scope.sortableOptions.opacity = false; + $scope.sortableOptions.opacity = 0.5; + $scope.sortableOptions.placeholder = false; + $scope.sortableOptions.placeholder = 'sortable-placeholder'; + $scope.sortableOptions.revert = true; + $scope.sortableOptions.revert = 300; + $scope.sortableOptions.scroll = false; + $scope.sortableOptions.scrollSensitivity = 10; + $scope.sortableOptions.scrollSpeed = 40; + $scope.sortableOptions.tolerance = 'pointer'; + $scope.sortableOptions.zIndex = 9999; + + $scope.sortableOptions['ui-floating'] = undefined; + $scope.sortableOptions['ui-floating'] = null; + $scope.sortableOptions['ui-floating'] = false; + $scope.sortableOptions['ui-floating'] = true; + $scope.sortableOptions['ui-floating'] = "auto"; +}); diff --git a/angular-ui/angular-ui-sortable.d.ts b/angular-ui/angular-ui-sortable.d.ts new file mode 100644 index 000000000..a0c99f34f --- /dev/null +++ b/angular-ui/angular-ui-sortable.d.ts @@ -0,0 +1,210 @@ +// Type definitions for angular.ui.sortable module v0.13+ +// Project: https://github.com/angular-ui/ui-sortable +// Definitions by: Thodoris Greasidis +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ng.ui { + + interface UISortableOptions extends SortableOptions { + 'ui-floating'?: string|boolean; + } + + interface UISortableProperties { + /** + * Holds the index of the drop target that the dragged item was dropped. + */ + dropindex: number; + + /** + * Holds the ui-sortable element that the dragged item was dropped on. + */ + droptarget: number; + + /** + * Holds the array that is specified by the `ng-model` attribute of the [`droptarget`](#droptarget) ui-sortable element. + */ + droptargetModel: Array; + + /** + * Holds the original index of the item dragged. + */ + index: number; + + /** + * Holds the JavaScript object that is used as the model of the dragged item, as specified by the ng-repeat of the [`source`](#source) ui-sortable element and the item's [`index`](#index). + */ + model: T; + + /** + * Holds the model of the dragged item only when a sorting happens between two connected ui-sortable elements. + * In other words: `'moved' in ui.item.sortable` will return false only when a sorting is withing the same ui-sortable element ([`source`](#source) equals to the [`droptarget`](#droptarget)). + */ + moved?: T; + + /** + * When sorting between two connected sortables, it will be set to true inside the `update` callback of the [`droptarget`](#droptarget). + */ + received: Boolean; + + /** + * Holds the ui-sortable element that the dragged item originated from. + */ + source: ng.IAugmentedJQuery + + /** + * Holds the array that is specified by the `ng-model` of the [`source`](#source) ui-sortable element. + */ + sourceModel: Array; + + /** + * Can be called inside the `update` callback, in order to prevent/revert a sorting. + * Should be used instead of the [jquery-ui-sortable cancel()](http://api.jqueryui.com/sortable/#method-cancel) method. + */ + cancel(): void; + + /** + * Returns whether the current sorting is marked as canceled, by an earlier call to [`ui.item.sortable.cancel()`](#cancel). + */ + isCanceled(): Boolean; + + /** + * Returns whether the [`helper`](http://api.jqueryui.com/sortable/#option-helper) element used for the current sorting, is one of the original ui-sortable list elements. + */ + isCustomHelperUsed(): Boolean; + } + + interface UISortableUIItem extends ng.IAugmentedJQuery { + sortable: UISortableProperties; + } + + interface UISortableUIParams extends SortableUIParams { + item: UISortableUIItem; + } + + // Base Sortable ////////////////////////////////////////////////// + + interface SortableCursorAtOptions { + top?: number; + left?: number; + right?: number; + bottom?: number; + } + + interface SortableHelperFunctionOption { + (event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery; + } + + interface SortableOptions extends SortableEvents { + /** + * jQuery, Element, Selector or string + * Default: "parent" + */ + appendTo?: any; + /** + * "X", "Y" or false + * Default: false + */ + axis?: string|boolean; + /** + * Selector + * Default: "input,textarea,button,select,option" + */ + cancel?: string; + /** + * Selector or false + * Default: false + */ + connectWith?: string|boolean; + /** + * Element, Selector, string or false + * Default: false + */ + containment?: any; + cursor?: string; + /** + * Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys SortableCursorAtOptions: { top, left, right, bottom } + * Default: false + */ + cursorAt?: SortableCursorAtOptions|boolean; + delay?: number; + disabled?: boolean; + distance?: number; + dropOnEmpty?: boolean; + forceHelperSize?: boolean; + forcePlaceholderSize?: boolean; + /** + * Array of numbers or false + * Default: false + */ + grid?: number[]|boolean; + /** + * Selector or Element + */ + handle?: any; + /** + * "original", "clone" or Function() + * Default: "original" + */ + helper?: string|SortableHelperFunctionOption; + /** + * Selector + */ + items?: string; + /** + * Number or false + * Default: false + */ + opacity?: number|boolean; + /** + * string or false + * Default: false + */ + placeholder?: string|boolean; + /** + * boolean or number + * Default: false + */ + revert?: number|boolean; + scroll?: boolean; + scrollSensitivity?: number; + scrollSpeed?: number; + /** + * "intersect" or "pointer" + * Default: "intersect" + */ + tolerance?: string; + zIndex?: number; + } + + interface SortableUIParams { + helper: ng.IAugmentedJQuery; + item: ng.IAugmentedJQuery; + offset: any; + position: any; + originalPosition: any; + sender: ng.IAugmentedJQuery; + placeholder: ng.IAugmentedJQuery; + } + + interface SortableEvent { + (event: JQueryEventObject, ui: UISortableUIParams): void; + } + + interface SortableEvents { + activate?: SortableEvent; + beforeStop?: SortableEvent; + change?: SortableEvent; + deactivate?: SortableEvent; + out?: SortableEvent; + over?: SortableEvent; + receive?: SortableEvent; + remove?: SortableEvent; + sort?: SortableEvent; + start?: SortableEvent; + stop?: SortableEvent; + update?: SortableEvent; + } + +} From edc17cd1b492cd1a702950ec943dd27608ce1824 Mon Sep 17 00:00:00 2001 From: "Martin D." Date: Sun, 8 Mar 2015 21:56:09 -0400 Subject: [PATCH 76/78] Case change and callbacks for addIceCandidate --- webrtc/RTCPeerConnection.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webrtc/RTCPeerConnection.d.ts b/webrtc/RTCPeerConnection.d.ts index fee9e95d4..9e96a86c8 100644 --- a/webrtc/RTCPeerConnection.d.ts +++ b/webrtc/RTCPeerConnection.d.ts @@ -71,8 +71,8 @@ interface RTCMediaConstraints { } interface RTCMediaOfferConstraints { - OfferToReceiveAudio: boolean; - OfferToReceiveVideo: boolean; + offerToReceiveAudio: boolean; + offerToReceiveVideo: boolean; } interface RTCSessionDescriptionInit { @@ -261,7 +261,9 @@ interface RTCPeerConnection { signalingState: string; // RTCSignalingState; see TODO(1) updateIce(configuration?: RTCConfiguration, constraints?: RTCMediaConstraints): void; - addIceCandidate(candidate: RTCIceCandidate): void; + addIceCandidate(candidate:RTCIceCandidate, + successCallback:() => void, + failureCallback:RTCPeerConnectionErrorCallback): void; iceGatheringState: string; // RTCIceGatheringState; see TODO(1) iceConnectionState: string; // RTCIceConnectionState; see TODO(1) getLocalStreams(): MediaStream[]; From 5fab3bdadc6b859cd3867ee5dc41499ec1498a17 Mon Sep 17 00:00:00 2001 From: "Martin D." Date: Sun, 8 Mar 2015 21:58:43 -0400 Subject: [PATCH 77/78] Case change --- webrtc/RTCPeerConnection-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/RTCPeerConnection-tests.ts b/webrtc/RTCPeerConnection-tests.ts index dd8174148..f25ad81df 100644 --- a/webrtc/RTCPeerConnection-tests.ts +++ b/webrtc/RTCPeerConnection-tests.ts @@ -4,7 +4,7 @@ var config: RTCConfiguration = { iceServers: [{ url: "stun.l.google.com:19302" }] }; var constraints: RTCMediaConstraints = - { mandatory: { OfferToReceiveAudio: true, OfferToReceiveVideo: true } }; + { mandatory: { offerToReceiveAudio: true, offerToReceiveVideo: true } }; var peerConnection: RTCPeerConnection = new RTCPeerConnection(config, constraints); From 8ed3342f84ced46482eb60c5dfda944d660a3811 Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Mon, 9 Mar 2015 08:51:46 +0100 Subject: [PATCH 78/78] Removed older versions on request. --- .../timezonecomplete-1.10.0-tests.ts | 219 --- timezonecomplete/timezonecomplete-1.10.0.d.ts | 1296 ---------------- .../timezonecomplete-1.12.0-tests.ts | 223 --- timezonecomplete/timezonecomplete-1.12.0.d.ts | 1310 ----------------- .../timezonecomplete-1.2.0-tests.ts | 169 --- timezonecomplete/timezonecomplete-1.2.0.d.ts | 681 --------- .../timezonecomplete-1.3.0-tests.ts | 174 --- timezonecomplete/timezonecomplete-1.3.0.d.ts | 702 --------- .../timezonecomplete-1.4.6-tests.ts | 183 --- timezonecomplete/timezonecomplete-1.4.6.d.ts | 1004 ------------- .../timezonecomplete-1.5.1-tests.ts | 195 --- timezonecomplete/timezonecomplete-1.5.1.d.ts | 1127 -------------- .../timezonecomplete-1.6.0-tests.ts | 197 --- timezonecomplete/timezonecomplete-1.6.0.d.ts | 1132 -------------- .../timezonecomplete-1.8.0-tests.ts | 203 --- timezonecomplete/timezonecomplete-1.8.0.d.ts | 1190 --------------- timezonecomplete/timezonecomplete-1.9.0.d.ts | 1207 --------------- .../timezonecomplete-tests-1.9.0.ts | 205 --- 18 files changed, 11417 deletions(-) delete mode 100644 timezonecomplete/timezonecomplete-1.10.0-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.10.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.12.0-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.12.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.2.0-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.2.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.3.0-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.3.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.4.6-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.4.6.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.5.1-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.5.1.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.6.0-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.6.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.8.0-tests.ts delete mode 100644 timezonecomplete/timezonecomplete-1.8.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-1.9.0.d.ts delete mode 100644 timezonecomplete/timezonecomplete-tests-1.9.0.ts diff --git a/timezonecomplete/timezonecomplete-1.10.0-tests.ts b/timezonecomplete/timezonecomplete-1.10.0-tests.ts deleted file mode 100644 index 06f29e3b3..000000000 --- a/timezonecomplete/timezonecomplete-1.10.0-tests.ts +++ /dev/null @@ -1,219 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.10.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month); -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = tc.hours(24); -var d6: tc.Duration = tc.minutes(24); -var d7: tc.Duration = tc.seconds(24); -var d8: tc.Duration = tc.milliseconds(24); -var d9: tc.Duration = new tc.Duration(24); -var d10: tc.Duration = new tc.Duration("00:01"); -var d11: tc.Duration = d6.clone(); -var d12: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -t = tc.local(); -t = tc.utc(); -t = tc.zone(2); -t = tc.zone("+01:00"); -t = tc.zone("Europe/Amsterdam", false); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -b = t.dst(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = tc.nowLocal(); -dt = tc.nowUtc(); -dt = tc.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); -dt = dt.startOfDay(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.10.0.d.ts b/timezonecomplete/timezonecomplete-1.10.0.d.ts deleted file mode 100644 index e34374003..000000000 --- a/timezonecomplete/timezonecomplete-1.10.0.d.ts +++ /dev/null @@ -1,1296 +0,0 @@ -// Type definitions for timezonecomplete 1.10.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.10.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import timeUnitToMilliseconds = basics.timeUnitToMilliseconds; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - export import now = datetime.now; - export import nowLocal = datetime.nowLocal; - export import nowUtc = datetime.nowUtc; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - export import hours = duration.hours; - export import minutes = duration.minutes; - export import seconds = duration.seconds; - export import milliseconds = duration.milliseconds; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - export import local = timezone.local; - export import utc = timezone.utc; - export import zone = timezone.zone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Approximate number of milliseconds for a time unit. - * A day is assumed to have 24 hours, a month is assumed to equal 30 days - * and a year is set to 365 days. - * - * @param unit Time unit e.g. TimeUnit.Month - * @returns The number of milliseconds. - */ - export function timeUnitToMilliseconds(unit: TimeUnit): number; - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import timesource = require("__timezonecomplete/timesource"); - import javascript = require("__timezonecomplete/javascript"); - import timezone = require("__timezonecomplete/timezone"); - /** - * Current date+time in local time - */ - export function nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - export function nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - export function now(timeZone?: timezone.TimeZone): DateTime; - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - static now(timeZone?: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * Chops off the time part, yields the same date at 00:00:00.000 - * @return a new DateTime - */ - startOfDay(): DateTime; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - import basics = require("__timezonecomplete/basics"); - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - export function hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - export function minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - export function seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - export function milliseconds(n: number): Duration; - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * Construct a duration from an amount and a time unit. - * @param amount Number of units - * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. - */ - constructor(amount: number, unit: basics.TimeUnit); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The local time zone for a given date as per OS settings. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ - export function local(): TimeZone; - /** - * Coordinated Universal Time zone. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ - export function utc(): TimeZone; - /** - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @returns a time zone with the given fixed offset - */ - export function zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - export function zone(name: string, dst?: boolean): TimeZone; - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Time zone with a fixed offset - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - static zone(s: string, dst?: boolean): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - * @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets - */ - constructor(name: string, dst?: boolean); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - dst(): boolean; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-1.12.0-tests.ts b/timezonecomplete/timezonecomplete-1.12.0-tests.ts deleted file mode 100644 index 8eb6015b7..000000000 --- a/timezonecomplete/timezonecomplete-1.12.0-tests.ts +++ /dev/null @@ -1,223 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.12.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month); -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = tc.hours(24); -var d6: tc.Duration = tc.minutes(24); -var d7: tc.Duration = tc.seconds(24); -var d8: tc.Duration = tc.milliseconds(24); -var d9: tc.Duration = new tc.Duration(24); -var d10: tc.Duration = new tc.Duration("00:01"); -var d11: tc.Duration = d6.clone(); -var d12: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -t = tc.local(); -t = tc.utc(); -t = tc.zone(2); -t = tc.zone("+01:00"); -t = tc.zone("Europe/Amsterdam", false); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -b = t.dst(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); -b = t.equals(t); -b = t.identical(t); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = tc.nowLocal(); -dt = tc.nowUtc(); -dt = tc.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); -dt = dt.startOfDay(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); -b = p.equals(p); -b = p.identical(p); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.12.0.d.ts b/timezonecomplete/timezonecomplete-1.12.0.d.ts deleted file mode 100644 index 97ce750e2..000000000 --- a/timezonecomplete/timezonecomplete-1.12.0.d.ts +++ /dev/null @@ -1,1310 +0,0 @@ -// Type definitions for timezonecomplete 1.12.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.12.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import timeUnitToMilliseconds = basics.timeUnitToMilliseconds; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - export import now = datetime.now; - export import nowLocal = datetime.nowLocal; - export import nowUtc = datetime.nowUtc; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - export import hours = duration.hours; - export import minutes = duration.minutes; - export import seconds = duration.seconds; - export import milliseconds = duration.milliseconds; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - export import local = timezone.local; - export import utc = timezone.utc; - export import zone = timezone.zone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Approximate number of milliseconds for a time unit. - * A day is assumed to have 24 hours, a month is assumed to equal 30 days - * and a year is set to 365 days. - * - * @param unit Time unit e.g. TimeUnit.Month - * @returns The number of milliseconds. - */ - export function timeUnitToMilliseconds(unit: TimeUnit): number; - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import timesource = require("__timezonecomplete/timesource"); - import javascript = require("__timezonecomplete/javascript"); - import timezone = require("__timezonecomplete/timezone"); - /** - * Current date+time in local time - */ - export function nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - export function nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - export function now(timeZone?: timezone.TimeZone): DateTime; - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone - * @param timeZone The desired time zone (optional, defaults to UTC). - */ - static now(timeZone?: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * Chops off the time part, yields the same date at 00:00:00.000 - * @return a new DateTime - */ - startOfDay(): DateTime; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same moment in time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - import basics = require("__timezonecomplete/basics"); - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - export function hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - export function minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - export function seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - export function milliseconds(n: number): Duration; - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours (may be fractional or negative) - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes (may be fractional or negative) - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds (may be fractional or negative) - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds (may be fractional or negative) - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * Construct a duration from an amount and a time unit. - * @param amount Number of units - * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. - */ - constructor(amount: number, unit: basics.TimeUnit); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - * Defaults to RegularLocalTime. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst?: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns true iff this period has the same effect as the given one. - * i.e. a period of 24 hours is equal to one of 1 day if they have the same UTC start moment - * and same dst. - */ - equals(other: Period): boolean; - /** - * Returns true iff this period was constructed with identical arguments to the other one. - */ - identical(other: Period): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The local time zone for a given date as per OS settings. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ - export function local(): TimeZone; - /** - * Coordinated Universal Time zone. Note that time zones are cached - * so you don't necessarily get a new object each time. - */ - export function utc(): TimeZone; - /** - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @returns a time zone with the given fixed offset - */ - export function zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - export function zone(name: string, dst?: boolean): TimeZone; - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Time zone with a fixed offset - * @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Time zone for an offset string or an IANA time zone string. Note that time zones are cached - * so you don't necessarily get a new object each time. - * @param s Empty string for no time zone (null is returned), - * "localtime" for local time, - * a TZ database time zone name (e.g. Europe/Amsterdam), - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - * @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for - * "localtime", timezonecomplete will adhere to the computer settings, the DST flag - * does not have any effect. - */ - static zone(s: string, dst?: boolean): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - * @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets - */ - constructor(name: string, dst?: boolean); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - dst(): boolean; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Returns true iff the constructor arguments were identical, so UTC !== GMT - */ - identical(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-1.2.0-tests.ts b/timezonecomplete/timezonecomplete-1.2.0-tests.ts deleted file mode 100644 index 3ed4db796..000000000 --- a/timezonecomplete/timezonecomplete-1.2.0-tests.ts +++ /dev/null @@ -1,169 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.2.0"); - -var b: boolean = tc.isLeapYear(2014); -var n: number = tc.daysInMonth(2014, 10); -var s: string = tc.isoString(2014, 6, 30, 22, 10, 11, 230); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.2.0.d.ts b/timezonecomplete/timezonecomplete-1.2.0.d.ts deleted file mode 100644 index 1a39be00e..000000000 --- a/timezonecomplete/timezonecomplete-1.2.0.d.ts +++ /dev/null @@ -1,681 +0,0 @@ -// Type definitions for timezonecomplete -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle 0.1.1 - -declare module 'timezonecomplete-1.2.0' { - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns an ISO time string. Note that months are 1-12. - */ - export function isoString(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): string; - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Positive number of milliseconds - * Stored positive because otherwise we constantly have to choose - * between Math.floor() and Math.ceil() - */ - /** - * Sign: 1 or -1 - */ - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - } - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Calculate timezone offset from a UTC time. - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: DateFunctions): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: DateFunctions): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } - /** - * Our very own DateTime class which is time zone-aware - * and which can be mocked for testing purposes - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): TimeZone; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * For unaware dates, an exception is thrown - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - */ - toDate(): Date; - /** - * Add a time duration. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * so in the presence of e.g. leap seconds there may be a - * shift in the seconds field if you add an hour. - * There is not DST handling and no leap second handling. - * @return this + duration - */ - add(duration: Duration): DateTime; - /** - * Add an amount of time to UTC, taking leap seconds etc into account. - * Adding e.g. 1 hour will increment the utcHour() field - * date by one. In case of DST changes, the local hour() field - * may not increase or increase by 2 hours. So if you add a month, the - * local time may vary by an hour. There will not be a shift - * in seconds due to leap seconds. - */ - add(amount: number, unit: TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the utcHour() field may - * increase by 1 or increase by 2. Adding a day will leave the time portion - * intact. However, adding an hour around a forward DST change adds two hours, - * since there is a zone time (2AM in Holland) that does not exist. - */ - addLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: DateTime, amount: number, unit: TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: DateTime): DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: DateTime, count?: number): DateTime; - /** - * Returns an ISO duration string - * P[n]Y[n]M[n]DT[n]H[n]M[n][.n]S or P[n]W - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam keeping regular intervals". - */ - toString(): string; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.3.0-tests.ts b/timezonecomplete/timezonecomplete-1.3.0-tests.ts deleted file mode 100644 index 08145d275..000000000 --- a/timezonecomplete/timezonecomplete-1.3.0-tests.ts +++ /dev/null @@ -1,174 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.3.0"); - -var b: boolean = tc.isLeapYear(2014); -var n: number = tc.daysInMonth(2014, 10); -var s: string = tc.isoString(2014, 6, 30, 22, 10, 11, 230); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.3.0.d.ts b/timezonecomplete/timezonecomplete-1.3.0.d.ts deleted file mode 100644 index 602a44084..000000000 --- a/timezonecomplete/timezonecomplete-1.3.0.d.ts +++ /dev/null @@ -1,702 +0,0 @@ -// Type definitions for timezonecomplete 1.3.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.3.0' { - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns an ISO time string. Note that months are 1-12. - */ - export function isoString(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): string; - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - } - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Calculate timezone offset from a UTC time. - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: DateFunctions): number; - /** - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: DateFunctions): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Our very own DateTime class which is time zone-aware - * and which can be mocked for testing purposes - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): TimeZone; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): WeekDay; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): WeekDay; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * For unaware dates, an exception is thrown - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - */ - toDate(): Date; - /** - * Add a time duration. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * so in the presence of e.g. leap seconds there may be a - * shift in the seconds field if you add an hour. - * There is not DST handling and no leap second handling. - * @return this + duration - */ - add(duration: Duration): DateTime; - /** - * Add an amount of time to UTC, taking leap seconds etc into account. - * Adding e.g. 1 hour will increment the utcHour() field - * date by one. In case of DST changes, the local hour() field - * may not increase or increase by 2 hours. So if you add a month, the - * local time may vary by an hour. There will not be a shift - * in seconds due to leap seconds. - */ - add(amount: number, unit: TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the utcHour() field may - * increase by 1 or increase by 2. Adding a day will leave the time portion - * intact. However, adding an hour around a forward DST change adds two hours, - * since there is a zone time (2AM in Holland) that does not exist. - */ - addLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: DateTime, amount: number, unit: TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: DateTime): DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: DateTime, count?: number): DateTime; - /** - * Returns an ISO duration string - * P[n]Y[n]M[n]DT[n]H[n]M[n][.n]S or P[n]W - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam keeping regular intervals". - */ - toString(): string; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.4.6-tests.ts b/timezonecomplete/timezonecomplete-1.4.6-tests.ts deleted file mode 100644 index de0b73048..000000000 --- a/timezonecomplete/timezonecomplete-1.4.6-tests.ts +++ /dev/null @@ -1,183 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.4.6"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.4.6.d.ts b/timezonecomplete/timezonecomplete-1.4.6.d.ts deleted file mode 100644 index afec37d0f..000000000 --- a/timezonecomplete/timezonecomplete-1.4.6.d.ts +++ /dev/null @@ -1,1004 +0,0 @@ -// Type definitions for timezonecomplete 1.4.6 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.4.6' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import dayOfYear = basics.dayOfYear; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.5.1-tests.ts b/timezonecomplete/timezonecomplete-1.5.1-tests.ts deleted file mode 100644 index c76db9836..000000000 --- a/timezonecomplete/timezonecomplete-1.5.1-tests.ts +++ /dev/null @@ -1,195 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.5.1"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.5.1.d.ts b/timezonecomplete/timezonecomplete-1.5.1.d.ts deleted file mode 100644 index bfe0a2bec..000000000 --- a/timezonecomplete/timezonecomplete-1.5.1.d.ts +++ /dev/null @@ -1,1127 +0,0 @@ -// Type definitions for timezonecomplete 1.5.1 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.5.1' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.6.0-tests.ts b/timezonecomplete/timezonecomplete-1.6.0-tests.ts deleted file mode 100644 index 7282083f5..000000000 --- a/timezonecomplete/timezonecomplete-1.6.0-tests.ts +++ /dev/null @@ -1,197 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.6.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.6.0.d.ts b/timezonecomplete/timezonecomplete-1.6.0.d.ts deleted file mode 100644 index 2b281d23d..000000000 --- a/timezonecomplete/timezonecomplete-1.6.0.d.ts +++ /dev/null @@ -1,1132 +0,0 @@ -// Type definitions for timezonecomplete 1.6.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.6.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - diff --git a/timezonecomplete/timezonecomplete-1.8.0-tests.ts b/timezonecomplete/timezonecomplete-1.8.0-tests.ts deleted file mode 100644 index 5ab586475..000000000 --- a/timezonecomplete/timezonecomplete-1.8.0-tests.ts +++ /dev/null @@ -1,203 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.8.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - - diff --git a/timezonecomplete/timezonecomplete-1.8.0.d.ts b/timezonecomplete/timezonecomplete-1.8.0.d.ts deleted file mode 100644 index c8ff2310b..000000000 --- a/timezonecomplete/timezonecomplete-1.8.0.d.ts +++ /dev/null @@ -1,1190 +0,0 @@ -// Type definitions for timezonecomplete 1.8.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.8.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-1.9.0.d.ts b/timezonecomplete/timezonecomplete-1.9.0.d.ts deleted file mode 100644 index 0490ee94d..000000000 --- a/timezonecomplete/timezonecomplete-1.9.0.d.ts +++ /dev/null @@ -1,1207 +0,0 @@ -// Type definitions for timezonecomplete 1.9.0 -// Project: https://github.com/SpiritIT/timezonecomplete -// Definitions by: Rogier Schouten -// Definitions: https://github.com/borisyankov/DefinitelyTyped -// Generated by dts-bundle v0.2.0 - -declare module 'timezonecomplete-1.9.0' { - import basics = require("__timezonecomplete/basics"); - export import TimeUnit = basics.TimeUnit; - export import WeekDay = basics.WeekDay; - export import timeUnitToMilliseconds = basics.timeUnitToMilliseconds; - export import isLeapYear = basics.isLeapYear; - export import daysInMonth = basics.daysInMonth; - export import daysInYear = basics.daysInYear; - export import firstWeekDayOfMonth = basics.firstWeekDayOfMonth; - export import lastWeekDayOfMonth = basics.lastWeekDayOfMonth; - export import weekDayOnOrAfter = basics.weekDayOnOrAfter; - export import weekDayOnOrBefore = basics.weekDayOnOrBefore; - export import weekNumber = basics.weekNumber; - export import weekOfMonth = basics.weekOfMonth; - export import dayOfYear = basics.dayOfYear; - export import secondOfDay = basics.secondOfDay; - import datetime = require("__timezonecomplete/datetime"); - export import DateTime = datetime.DateTime; - import duration = require("__timezonecomplete/duration"); - export import Duration = duration.Duration; - import javascript = require("__timezonecomplete/javascript"); - export import DateFunctions = javascript.DateFunctions; - import period = require("__timezonecomplete/period"); - export import Period = period.Period; - export import PeriodDst = period.PeriodDst; - export import periodDstToString = period.periodDstToString; - import timesource = require("__timezonecomplete/timesource"); - export import TimeSource = timesource.TimeSource; - export import RealTimeSource = timesource.RealTimeSource; - import timezone = require("__timezonecomplete/timezone"); - export import NormalizeOption = timezone.NormalizeOption; - export import TimeZoneKind = timezone.TimeZoneKind; - export import TimeZone = timezone.TimeZone; - import globals = require("__timezonecomplete/globals"); - export import min = globals.min; - export import max = globals.max; -} - -declare module '__timezonecomplete/basics' { - import javascript = require("__timezonecomplete/javascript"); - /** - * Day-of-week. Note the enum values correspond to JavaScript day-of-week: - * Sunday = 0, Monday = 1 etc - */ - export enum WeekDay { - Sunday = 0, - Monday = 1, - Tuesday = 2, - Wednesday = 3, - Thursday = 4, - Friday = 5, - Saturday = 6, - } - /** - * Time units - */ - export enum TimeUnit { - Second = 0, - Minute = 1, - Hour = 2, - Day = 3, - Week = 4, - Month = 5, - Year = 6, - } - /** - * Approximate number of milliseconds for a time unit. - * A day is assumed to have 24 hours, a month is assumed to equal 30 days - * and a year is set to 365 days. - * - * @param unit Time unit e.g. TimeUnit.Month - * @returns The number of milliseconds. - */ - export function timeUnitToMilliseconds(unit: TimeUnit): number; - /** - * @return True iff the given year is a leap year. - */ - export function isLeapYear(year: number): boolean; - /** - * The days in a given year - */ - export function daysInYear(year: number): number; - /** - * @param year The full year - * @param month The month 1-12 - * @return The number of days in the given month - */ - export function daysInMonth(year: number, month: number): number; - /** - * Returns the day of the year of the given date [0..365]. January first is 0. - * - * @param year The year e.g. 1986 - * @param month Month 1-12 - * @param day Day of month 1-31 - */ - export function dayOfYear(year: number, month: number, day: number): number; - /** - * Returns the last instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the last occurrence of the week day in the month - */ - export function lastWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the first instance of the given weekday in the given month - * - * @param year The year - * @param month the month 1-12 - * @param weekDay the desired week day - * - * @return the first occurrence of the week day in the month - */ - export function firstWeekDayOfMonth(year: number, month: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is >= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrAfter(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * Returns the day-of-month that is on the given weekday and which is <= the given day. - * Throws if the month has no such day. - */ - export function weekDayOnOrBefore(year: number, month: number, day: number, weekDay: WeekDay): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @param year The year - * @param month The month [1-12] - * @param day The day [1-31] - * @return Week number [1-5] - */ - export function weekOfMonth(year: number, month: number, day: number): number; - /** - * The ISO 8601 week number for the given date. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @param year Year e.g. 1988 - * @param month Month 1-12 - * @param day Day of month 1-31 - * - * @return Week number 1-53 - */ - export function weekNumber(year: number, month: number, day: number): number; - /** - * Convert a unix milli timestamp into a TimeT structure. - * This does NOT take leap seconds into account. - */ - export function unixToTimeNoLeapSecs(unixMillis: number): TimeStruct; - /** - * Convert a year, month, day etc into a unix milli timestamp. - * This does NOT take leap seconds into account. - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - export function timeToUnixNoLeapSecs(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, milli?: number): number; - /** - * Convert a TimeT structure into a unix milli timestamp. - * This does NOT take leap seconds into account. - */ - export function timeToUnixNoLeapSecs(tm: TimeStruct): number; - /** - * Return the day-of-week. - * This does NOT take leap seconds into account. - */ - export function weekDayNoLeapSecs(unixMillis: number): WeekDay; - /** - * N-th second in the day, counting from 0 - */ - export function secondOfDay(hour: number, minute: number, second: number): number; - /** - * Basic representation of a date and time - */ - export class TimeStruct { - /** - * Year, 1970-... - */ - year: number; - /** - * Month 1-12 - */ - month: number; - /** - * Day of month, 1-31 - */ - day: number; - /** - * Hour 0-23 - */ - hour: number; - /** - * Minute 0-59 - */ - minute: number; - /** - * Seconds, 0-59 - */ - second: number; - /** - * Milliseconds 0-999 - */ - milli: number; - /** - * Create a TimeStruct from a number of unix milliseconds - */ - static fromUnix(unixMillis: number): TimeStruct; - /** - * Create a TimeStruct from a JavaScript date - * - * @param d The date - * @param df Which functions to take (getX() or getUTCX()) - */ - static fromDate(d: Date, df: javascript.DateFunctions): TimeStruct; - /** - * Returns a TimeStruct from an ISO 8601 string WITHOUT time zone - */ - static fromString(s: string): TimeStruct; - /** - * Constructor - * - * @param year Year e.g. 1970 - * @param month Month 1-12 - * @param day Day 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 (no leap seconds) - * @param milli Millisecond 0-999 - */ - constructor(/** - * Year, 1970-... - */ - year?: number, /** - * Month 1-12 - */ - month?: number, /** - * Day of month, 1-31 - */ - day?: number, /** - * Hour 0-23 - */ - hour?: number, /** - * Minute 0-59 - */ - minute?: number, /** - * Seconds, 0-59 - */ - second?: number, /** - * Milliseconds 0-999 - */ - milli?: number); - /** - * Validate a TimeStruct, returns false if invalid. - */ - validate(): boolean; - /** - * The day-of-year 0-365 - */ - yearDay(): number; - /** - * Returns this time as a unix millisecond timestamp - * Does NOT take leap seconds into account. - */ - toUnixNoLeapSecs(): number; - /** - * Deep equals - */ - equals(other: TimeStruct): boolean; - /** - * < operator - */ - lessThan(other: TimeStruct): boolean; - clone(): TimeStruct; - valueOf(): number; - /** - * ISO 8601 string YYYY-MM-DDThh:mm:ss.nnn - */ - toString(): string; - inspect(): string; - } -} - -declare module '__timezonecomplete/datetime' { - import basics = require("__timezonecomplete/basics"); - import duration = require("__timezonecomplete/duration"); - import javascript = require("__timezonecomplete/javascript"); - import timesource = require("__timezonecomplete/timesource"); - import timezone = require("__timezonecomplete/timezone"); - /** - * DateTime class which is time zone-aware - * and which can be mocked for testing purposes. - */ - export class DateTime { - /** - * Actual time source in use. Setting this property allows to - * fake time in tests. DateTime.nowLocal() and DateTime.nowUtc() - * use this property for obtaining the current time. - */ - static timeSource: timesource.TimeSource; - /** - * Current date+time in local time (derived from DateTime.timeSource.now()). - */ - static nowLocal(): DateTime; - /** - * Current date+time in UTC time (derived from DateTime.timeSource.now()). - */ - static nowUtc(): DateTime; - /** - * Current date+time in the given time zone (derived from DateTime.timeSource.now()). - * @param timeZone The desired time zone. - */ - static now(timeZone: timezone.TimeZone): DateTime; - /** - * Constructor. Creates current time in local timezone. - */ - constructor(); - /** - * Constructor - * Non-existing local times are normalized by rounding up to the next DST offset. - * - * @param isoString String in ISO 8601 format. Instead of ISO time zone, - * it may include a space and then and IANA time zone. - * e.g. "2007-04-05T12:30:40.500" (no time zone, naive date) - * e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time) - * or "2007-04-05T12:30:40.500Z" (UTC) - * or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable) - * @param timeZone if given, the date in the string is assumed to be in this time zone. - * Note that it is NOT CONVERTED to the time zone. Useful - * for strings without a time zone - */ - constructor(isoString: string, timeZone?: timezone.TimeZone); - /** - * Constructor. You provide a date, then you say whether to take the - * date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods, - * and then you state which time zone that date is in. - * Non-existing local times are normalized by rounding up to the next DST offset. - * Note that the Date class has bugs and inconsistencies when constructing them with times around - * DST changes. - * - * @param date A date object. - * @param getters Specifies which set of Date getters contains the date in the given time zone: the - * Date.getXxx() methods or the Date.getUTCXxx() methods. - * @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates) - */ - constructor(date: Date, getFuncs: javascript.DateFunctions, timeZone?: timezone.TimeZone); - /** - * Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges. - * Use the add(duration) or sub(duration) for arithmetic. - * @param year The full year (e.g. 2014) - * @param month The month [1-12] (note this deviates from JavaScript Date) - * @param day The day of the month [1-31] - * @param hour The hour of the day [0-24) - * @param minute The minute of the hour [0-59] - * @param second The second of the minute [0-59] - * @param millisecond The millisecond of the second [0-999] - * @param timeZone The time zone, or null (for unaware dates) - */ - constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: timezone.TimeZone); - /** - * Constructor - * @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000 - * @param timeZone the time zone that the timestamp is assumed to be in (usually UTC). - */ - constructor(unixTimestamp: number, timeZone?: timezone.TimeZone); - /** - * @return a copy of this object - */ - clone(): DateTime; - /** - * @return The time zone that the date is in. May be null for unaware dates. - */ - zone(): timezone.TimeZone; - /** - * Zone name abbreviation at this time - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * @return The abbreviation - */ - zoneAbbreviation(dstDependent?: boolean): string; - /** - * @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates. - */ - offset(): number; - /** - * @return The full year e.g. 2014 - */ - year(): number; - /** - * @return The month 1-12 (note this deviates from JavaScript Date) - */ - month(): number; - /** - * @return The day of the month 1-31 - */ - day(): number; - /** - * @return The hour 0-23 - */ - hour(): number; - /** - * @return the minutes 0-59 - */ - minute(): number; - /** - * @return the seconds 0-59 - */ - second(): number; - /** - * @return the milliseconds 0-999 - */ - millisecond(): number; - /** - * @return the day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - weekDay(): basics.WeekDay; - /** - * Returns the day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - dayOfYear(): number; - /** - * The ISO 8601 week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - weekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - weekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - secondOfDay(): number; - /** - * @return Milliseconds since 1970-01-01T00:00:00.000Z - */ - unixUtcMillis(): number; - /** - * @return The full year e.g. 2014 - */ - utcYear(): number; - /** - * @return The UTC month 1-12 (note this deviates from JavaScript Date) - */ - utcMonth(): number; - /** - * @return The UTC day of the month 1-31 - */ - utcDay(): number; - /** - * @return The UTC hour 0-23 - */ - utcHour(): number; - /** - * @return The UTC minutes 0-59 - */ - utcMinute(): number; - /** - * @return The UTC seconds 0-59 - */ - utcSecond(): number; - /** - * Returns the UTC day number within the year: Jan 1st has number 0, - * Jan 2nd has number 1 etc. - * - * @return the day-of-year [0-366] - */ - utcDayOfYear(): number; - /** - * @return The UTC milliseconds 0-999 - */ - utcMillisecond(): number; - /** - * @return the UTC day-of-week (the enum values correspond to JavaScript - * week day numbers) - */ - utcWeekDay(): basics.WeekDay; - /** - * The ISO 8601 UTC week number. Week 1 is the week - * that has January 4th in it, and it starts on Monday. - * See https://en.wikipedia.org/wiki/ISO_week_date - * - * @return Week number [1-53] - */ - utcWeekNumber(): number; - /** - * The week of this month. There is no official standard for this, - * but we assume the same rules for the weekNumber (i.e. - * week 1 is the week that has the 4th day of the month in it) - * - * @return Week number [1-5] - */ - utcWeekOfMonth(): number; - /** - * Returns the number of seconds that have passed on the current day - * Does not consider leap seconds - * - * @return seconds [0-86399] - */ - utcSecondOfDay(): number; - /** - * Convert this date to the given time zone (in-place). - * Throws if this date does not have a time zone. - * @return this (for chaining) - */ - convert(zone?: timezone.TimeZone): DateTime; - /** - * Returns this date converted to the given time zone. - * Unaware dates can only be converted to unaware dates (clone) - * Converting an unaware date to an aware date throws an exception. Use the constructor - * if you really need to do that. - * - * @param zone The new time zone. This may be null to create unaware date. - * @return The converted date - */ - toZone(zone?: timezone.TimeZone): DateTime; - /** - * Convert to JavaScript date with the zone time in the getX() methods. - * Unless the timezone is local, the Date.getUTCX() methods will NOT be correct. - * This is because Date calculates getUTCX() from getX() applying local time zone. - */ - toDate(): Date; - /** - * Add a time duration relative to UTC. Note that this simply adds a number - * of milliseconds to UTC and converts back to zone(), - * There is not DST handling. - * @return this + duration - */ - add(duration: duration.Duration): DateTime; - /** - * Add an amount of time relative to UTC, as regularly as possible. - * - * Adding e.g. 1 hour will increment the utcHour() field, adding 1 month - * increments the utcMonth() field. - * Adding an amount of units leaves lower units intact. E.g. - * adding a month will leave the day() field untouched if possible. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - * - * In case of DST changes, the utc time fields are still untouched but local - * time fields may shift. - */ - add(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Add an amount of time to the zone time, as regularly as possible. - * - * Adding e.g. 1 hour will increment the hour() field of the zone - * date by one. In case of DST changes, the time fields may additionally - * increase by the DST offset, if a non-existing local time would - * be reached otherwise. - * - * Adding a unit of time will leave lower-unit fields intact, unless the result - * would be a non-existing time. Then an extra DST offset is added. - * - * Note adding Months or Years will clamp the date to the end-of-month if - * the start date was at the end of a month, i.e. contrary to JavaScript - * Date#setUTCMonth() it will not overflow into the next month - */ - addLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as add(-1*duration); - */ - sub(duration: duration.Duration): DateTime; - /** - * Same as add(-1*amount, unit); - */ - sub(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Same as addLocal(-1*amount, unit); - */ - subLocal(amount: number, unit: basics.TimeUnit): DateTime; - /** - * Time difference between two DateTimes - * @return this - other - */ - diff(other: DateTime): duration.Duration; - /** - * @return True iff (this < other) - */ - lessThan(other: DateTime): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time in UTC - */ - equals(other: DateTime): boolean; - /** - * @return True iff this and other represent the same time and - * have the same zone - */ - identical(other: DateTime): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: DateTime): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: DateTime): boolean; - /** - * @return The minimum of this and other - */ - min(other: DateTime): DateTime; - /** - * @return The maximum of this and other - */ - max(other: DateTime): DateTime; - /** - * Proper ISO 8601 format string with any IANA zone converted to ISO offset - * E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam - */ - toIsoString(): string; - /** - * Return a string representation of the DateTime according to the - * specified format. The format is implemented as the LDML standard - * (http://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns) - * - * @param formatString The format specification (e.g. "dd/MM/yyyy HH:mm:ss") - * @return The string representation of this DateTime - */ - format(formatString: string): string; - /** - * Modified ISO 8601 format string with IANA name if applicable. - * E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam" - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - /** - * Modified ISO 8601 format string in UTC without time zone info - */ - toUtcString(): string; - } -} - -declare module '__timezonecomplete/duration' { - import basics = require("__timezonecomplete/basics"); - /** - * Time duration. Create one e.g. like this: var d = Duration.hours(1). - * Note that time durations do not take leap seconds etc. into account: - * one hour is simply represented as 3600000 milliseconds. - */ - export class Duration { - /** - * Construct a time duration - * @param n Number of hours - * @return A duration of n hours - */ - static hours(n: number): Duration; - /** - * Construct a time duration - * @param n Number of minutes - * @return A duration of n minutes - */ - static minutes(n: number): Duration; - /** - * Construct a time duration - * @param n Number of seconds - * @return A duration of n seconds - */ - static seconds(n: number): Duration; - /** - * Construct a time duration - * @param n Number of milliseconds - * @return A duration of n milliseconds - */ - static milliseconds(n: number): Duration; - /** - * Construct a time duration of 0 - */ - constructor(); - /** - * Construct a time duration from a number of milliseconds - */ - constructor(milliseconds: number); - /** - * Construct a time duration from a string in format - * [-]h[:m[:s[.n]]] e.g. -01:00:30.501 - */ - constructor(input: string); - /** - * Construct a duration from an amount and a time unit. - * @param amount Number of units - * @param unit A time unit i.e. TimeUnit.Second, TimeUnit.Hour etc. - */ - constructor(amount: number, unit: basics.TimeUnit); - /** - * @return another instance of Duration with the same value. - */ - clone(): Duration; - /** - * The entire duration in milliseconds (negative or positive) - */ - milliseconds(): number; - /** - * The millisecond part of the duration (always positive) - * @return e.g. 400 for a -01:02:03.400 duration - */ - millisecond(): number; - /** - * The entire duration in seconds (negative or positive, fractional) - * @return e.g. 1.5 for a 1500 milliseconds duration - */ - seconds(): number; - /** - * The second part of the duration (always positive) - * @return e.g. 3 for a -01:02:03.400 duration - */ - second(): number; - /** - * The entire duration in minutes (negative or positive, fractional) - * @return e.g. 1.5 for a 90000 milliseconds duration - */ - minutes(): number; - /** - * The minute part of the duration (always positive) - * @return e.g. 2 for a -01:02:03.400 duration - */ - minute(): number; - /** - * The entire duration in hours (negative or positive, fractional) - * @return e.g. 1.5 for a 5400000 milliseconds duration - */ - hours(): number; - /** - * The hour part of the duration (always positive). - * Note that this part can exceed 23 hours, because for - * now, we do not have a days() function - * @return e.g. 25 for a -25:02:03.400 duration - */ - wholeHours(): number; - /** - * Sign - * @return "-" if the duration is negative - */ - sign(): string; - /** - * @return True iff (this < other) - */ - lessThan(other: Duration): boolean; - /** - * @return True iff (this <= other) - */ - lessEqual(other: Duration): boolean; - /** - * @return True iff this and other represent the same time duration - */ - equals(other: Duration): boolean; - /** - * @return True iff this > other - */ - greaterThan(other: Duration): boolean; - /** - * @return True iff this >= other - */ - greaterEqual(other: Duration): boolean; - /** - * @return The minimum (most negative) of this and other - */ - min(other: Duration): Duration; - /** - * @return The maximum (most positive) of this and other - */ - max(other: Duration): Duration; - /** - * Multiply with a fixed number. - * @return a new Duration of (this * value) - */ - multiply(value: number): Duration; - /** - * Divide by a fixed number. - * @return a new Duration of (this / value) - */ - divide(value: number): Duration; - /** - * Add a duration. - * @return a new Duration of (this + value) - */ - add(value: Duration): Duration; - /** - * Subtract a duration. - * @return a new Duration of (this - value) - */ - sub(value: Duration): Duration; - /** - * String in [-]hh:mm:ss.nnn notation. All fields are - * always present except the sign. - */ - toFullString(): string; - /** - * String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are - * added as necessary - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * The valueOf() method returns the primitive value of the specified object. - */ - valueOf(): any; - } -} - -declare module '__timezonecomplete/javascript' { - /** - * Indicates how a Date object should be interpreted. - * Either we can take getYear(), getMonth() etc for our field - * values, or we can take getUTCYear(), getUtcMonth() etc to do that. - */ - export enum DateFunctions { - /** - * Use the Date.getFullYear(), Date.getMonth(), ... functions. - */ - Get = 0, - /** - * Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions. - */ - GetUTC = 1, - } -} - -declare module '__timezonecomplete/period' { - import basics = require("__timezonecomplete/basics"); - import datetime = require("__timezonecomplete/datetime"); - /** - * Specifies how the period should repeat across the day - * during DST changes. - */ - export enum PeriodDst { - /** - * Keep repeating in similar intervals measured in UTC, - * unaffected by Daylight Saving Time. - * E.g. a repetition of one hour will take one real hour - * every time, even in a time zone with DST. - * Leap seconds, leap days and month length - * differences will still make the intervals different. - */ - RegularIntervals = 0, - /** - * Ensure that the time at which the intervals occur stay - * at the same place in the day, local time. So e.g. - * a period of one day, starting at 8:05AM Europe/Amsterdam time - * will always start at 8:05 Europe/Amsterdam. This means that - * in UTC time, some intervals will be 25 hours and some - * 23 hours during DST changes. - * Another example: an hourly interval will be hourly in local time, - * skipping an hour in UTC for a DST backward change. - */ - RegularLocalTime = 1, - } - /** - * Convert a PeriodDst to a string: "regular intervals" or "regular local time" - */ - export function periodDstToString(p: PeriodDst): string; - /** - * Repeating time period: consists of a starting point and - * a time length. This class accounts for leap seconds and leap days. - */ - export class Period { - /** - * Constructor - * LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour, - * then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not. - * This is due to the enormous processing power required by these cases. They are not - * implemented and you will get an assert. - * - * @param start The start of the period. If the period is in Months or Years, and - * the day is 29 or 30 or 31, the results are maximised to end-of-month. - * @param amount The amount of units. - * @param unit The unit. - * @param dst Specifies how to handle Daylight Saving Time. Not relevant - * if the time zone of the start datetime does not have DST. - */ - constructor(start: datetime.DateTime, amount: number, unit: basics.TimeUnit, dst: PeriodDst); - /** - * The start date - */ - start(): datetime.DateTime; - /** - * The amount of units - */ - amount(): number; - /** - * The unit - */ - unit(): basics.TimeUnit; - /** - * The dst handling mode - */ - dst(): PeriodDst; - /** - * The first occurrence of the period greater than - * the given date. The given date need not be at a period boundary. - * Pre: the fromdate and startdate must either both have timezones or not - * @param fromDate: the date after which to return the next date - * @return the first date matching the period after fromDate, given - * in the same zone as the fromDate. - */ - findFirst(fromDate: datetime.DateTime): datetime.DateTime; - /** - * Returns the next timestamp in the period. The given timestamp must - * be at a period boundary, otherwise the answer is incorrect. - * This function has MUCH better performance than findFirst. - * Returns the datetime "count" times away from the given datetime. - * @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one. - * @param count Optional, must be >= 1 and whole. - * @return (prev + count * period), in the same timezone as prev. - */ - findNext(prev: datetime.DateTime, count?: number): datetime.DateTime; - /** - * Checks whether the given date is on a period boundary - * (expensive!) - */ - isBoundary(occurrence: datetime.DateTime): boolean; - /** - * Returns an ISO duration string e.g. - * 2014-01-01T12:00:00.000+01:00/P1H - * 2014-01-01T12:00:00.000+01:00/PT1M (one minute) - * 2014-01-01T12:00:00.000+01:00/P1M (one month) - */ - toIsoString(): string; - /** - * A string representation e.g. - * "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam, keeping regular intervals". - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - } -} - -declare module '__timezonecomplete/timesource' { - /** - * For testing purposes, we often need to manipulate what the current - * time is. This is an interface for a custom time source object - * so in tests you can use a custom time source. - */ - export interface TimeSource { - /** - * Return the current date+time as a javascript Date object - */ - now(): Date; - } - /** - * Default time source, returns actual time - */ - export class RealTimeSource implements TimeSource { - now(): Date; - } -} - -declare module '__timezonecomplete/timezone' { - import javascript = require("__timezonecomplete/javascript"); - /** - * The type of time zone - */ - export enum TimeZoneKind { - /** - * Local time offset as determined by JavaScript Date class. - */ - Local = 0, - /** - * Fixed offset from UTC, without DST. - */ - Offset = 1, - /** - * IANA timezone managed through Olsen TZ database. Includes - * DST if applicable. - */ - Proper = 2, - } - /** - * Option for TimeZone#normalizeLocal() - */ - export enum NormalizeOption { - /** - * Normalize non-existing times by ADDING the DST offset - */ - Up = 0, - /** - * Normalize non-existing times by SUBTRACTING the DST offset - */ - Down = 1, - } - /** - * Time zone. The object is immutable because it is cached: - * requesting a time zone twice yields the very same object. - * Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(), - * i.e. offset 90 means +01:30. - * - * Time zones come in three flavors: the local time zone, as calculated by JavaScript Date, - * a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST - * applied depending on the time zone rules. - */ - export class TimeZone { - /** - * The local time zone for a given date. Note that - * the time zone varies with the date: amsterdam time for - * 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00 - */ - static local(): TimeZone; - /** - * The UTC time zone. - */ - static utc(): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30 - */ - static zone(offset: number): TimeZone; - /** - * Returns a time zone object from the cache. If it does not exist, it is created. - * @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam) - * or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see: - * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones - */ - static zone(s: string): TimeZone; - /** - * Do not use this constructor, use the static - * TimeZone.zone() method instead. - * @param name NORMALIZED name, assumed to be correct - */ - constructor(name: string); - /** - * The time zone identifier. Can be an offset "-01:30" or an - * IANA time zone name "Europe/Amsterdam", or "localtime" for - * the local time zone. - */ - name(): string; - /** - * The kind of time zone (Local/Offset/Proper) - */ - kind(): TimeZoneKind; - /** - * Equality operator. Maps zero offsets and different names for UTC onto - * each other. Other time zones are not mapped onto each other. - */ - equals(other: TimeZone): boolean; - /** - * Is this zone equivalent to UTC? - */ - isUtc(): boolean; - /** - * Does this zone have Daylight Saving Time at all? - */ - hasDst(): boolean; - /** - * Calculate timezone offset from a UTC time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Calculate timezone offset from a zone-local time (NOT a UTC time). - * @param year local full year - * @param month local month 1-12 (note this deviates from JavaScript date) - * @param day local day of month 1-31 - * @param hour local hour 0-23 - * @param minute local minute 0-59 - * @param second local second 0-59 - * @param millisecond local millisecond 0-999 - * @return the offset of this time zone with respect to UTC at the given time, in minutes. - */ - offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForUtcDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Note: will be removed in version 2.0.0 - * - * Convenience function, takes values from a Javascript Date - * Calls offsetForUtc() with the contents of the date - * - * @param date: the date - * @param funcs: the set of functions to use: get() or getUTC() - */ - offsetForZoneDate(date: Date, funcs: javascript.DateFunctions): number; - /** - * Zone abbreviation at given UTC timestamp e.g. CEST for Central European Summer Time. - * - * @param year Full year - * @param month Month 1-12 (note this deviates from JavaScript date) - * @param day Day of month 1-31 - * @param hour Hour 0-23 - * @param minute Minute 0-59 - * @param second Second 0-59 - * @param millisecond Millisecond 0-999 - * @param dstDependent (default true) set to false for a DST-agnostic abbreviation - * - * @return "local" for local timezone, the offset for an offset zone, or the abbreviation for a proper zone. - */ - abbreviationForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, dstDependent?: boolean): string; - /** - * Normalizes non-existing local times by adding a forward offset change. - * During a forward standard offset change or DST offset change, some amount of - * local time is skipped. Therefore, this amount of local time does not exist. - * This function adds the amount of forward change to any non-existing time. After all, - * this is probably what the user meant. - * - * @param localUnixMillis Unix timestamp in zone time - * @param opt (optional) Round up or down? Default: up - * - * @returns Unix timestamp in zone time, normalized. - */ - normalizeZoneTime(localUnixMillis: number, opt?: NormalizeOption): number; - /** - * The time zone identifier (normalized). - * Either "localtime", IANA name, or "+hh:mm" offset. - */ - toString(): string; - /** - * Used by util.inspect() - */ - inspect(): string; - /** - * Convert an offset number into an offset string - * @param offset The offset in minutes from UTC e.g. 90 minutes - * @return the offset in ISO notation "+01:30" for +90 minutes - */ - static offsetToString(offset: number): string; - /** - * String to offset conversion. - * @param s Formats: "-01:00", "-0100", "-01", "Z" - * @return offset w.r.t. UTC in minutes - */ - static stringToOffset(s: string): number; - } -} - -declare module '__timezonecomplete/globals' { - import datetime = require("__timezonecomplete/datetime"); - import duration = require("__timezonecomplete/duration"); - /** - * Returns the minimum of two DateTimes - */ - export function min(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the minimum of two Durations - */ - export function min(d1: duration.Duration, d2: duration.Duration): duration.Duration; - /** - * Returns the maximum of two DateTimes - */ - export function max(d1: datetime.DateTime, d2: datetime.DateTime): datetime.DateTime; - /** - * Returns the maximum of two Durations - */ - export function max(d1: duration.Duration, d2: duration.Duration): duration.Duration; -} - diff --git a/timezonecomplete/timezonecomplete-tests-1.9.0.ts b/timezonecomplete/timezonecomplete-tests-1.9.0.ts deleted file mode 100644 index 1e05cf7dc..000000000 --- a/timezonecomplete/timezonecomplete-tests-1.9.0.ts +++ /dev/null @@ -1,205 +0,0 @@ -/// - -import tc = require("timezonecomplete-1.9.0"); - -var b: boolean; -var n: number; -var s: string; -var w: tc.WeekDay; - -n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month); -b = tc.isLeapYear(2014); -n = tc.daysInMonth(2014, 10); -n = tc.daysInYear(2014); -n = tc.dayOfYear(2014, 1, 2); -w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday); -n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday); -n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday); -n = tc.secondOfDay(13, 59, 59); -n = tc.weekOfMonth(2014, 1, 1); - -// DURATION - -var d: tc.Duration; -var d1: tc.Duration = tc.Duration.hours(24); -var d2: tc.Duration = tc.Duration.minutes(24); -var d3: tc.Duration = tc.Duration.seconds(24); -var d4: tc.Duration = tc.Duration.milliseconds(24); -var d5: tc.Duration = new tc.Duration(24); -var d6: tc.Duration = new tc.Duration("00:01"); -var d7: tc.Duration = d6.clone(); -var d8: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second); - -n = d7.wholeHours(); -n = d7.hours(); -n = d7.minutes(); -n = d7.minute(); -n = d7.seconds(); -n = d7.second(); -n = d7.milliseconds(); -n = d7.millisecond(); -s = d7.sign(); -b = d7.lessThan(d6); -b = d7.greaterThan(d6); -d = d7.min(d6); -d = d7.max(d6); -d = d7.multiply(3); -d = d7.divide(0.3); -d = d7.add(d6); -d = d7.sub(d6); -s = d7.toString(); - -// TIMEZONE - -var t: tc.TimeZone; -var k: tc.TimeZoneKind; - -t = tc.TimeZone.local(); -t = tc.TimeZone.utc(); -t = tc.TimeZone.zone(2); -t = tc.TimeZone.zone("+01:00"); -s = t.name(); -k = t.kind(); -b = t.equals(t); -b = t.isUtc(); -n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123); -n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get); -n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC); -s = t.toString(); -s = tc.TimeZone.offsetToString(2); -n = tc.TimeZone.stringToOffset("+00:01"); - -// REALTIMESOURCE - -var date: Date = (new tc.RealTimeSource()).now(); - -// DATETIME - -var dt: tc.DateTime; - -var ts: tc.TimeSource = tc.DateTime.timeSource; - -dt = tc.DateTime.nowLocal(); -dt = tc.DateTime.nowUtc(); -dt = tc.DateTime.now(tc.TimeZone.local()); -dt = new tc.DateTime(); -dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC"); -dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc()); -dt = new tc.DateTime(date, tc.DateFunctions.Get); -dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc()); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123); -dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc()); -dt = new tc.DateTime(89949284); -dt = new tc.DateTime(89949284, tc.TimeZone.utc()); -dt = dt.clone(); -t = dt.zone(); -n = dt.offset(); -n = dt.year(); -n = dt.month(); -n = dt.day(); -n = dt.hour(); -n = dt.minute(); -n = dt.second(); -n = dt.weekNumber(); -n = dt.weekOfMonth(); -n = dt.secondOfDay(); -n = dt.dayOfYear(); -n = dt.millisecond(); -n = dt.unixUtcMillis(); -n = dt.utcYear(); -n = dt.utcMonth(); -n = dt.utcDay(); -n = dt.utcHour(); -n = dt.utcMinute(); -n = dt.utcSecond(); -n = dt.utcMillisecond(); -n = dt.utcWeekNumber(); -n = dt.utcWeekOfMonth(); -n = dt.utcSecondOfDay(); -n = dt.utcDayOfYear(); -s = dt.format("%Y-%m-%d"); -dt.convert(tc.TimeZone.local()); -dt = dt.toZone(tc.TimeZone.utc()); -date = dt.toDate(); -dt = dt.add(tc.Duration.seconds(2)); -dt = dt.add(2, tc.TimeUnit.Year); -dt = dt.add(2, tc.TimeUnit.Month); -dt = dt.add(2, tc.TimeUnit.Week); -dt = dt.add(2, tc.TimeUnit.Day); -dt = dt.add(2, tc.TimeUnit.Hour); -dt = dt.add(2, tc.TimeUnit.Minute); -dt = dt.add(2, tc.TimeUnit.Second); -dt = dt.addLocal(2, tc.TimeUnit.Second); -dt = dt.sub(tc.Duration.seconds(2)); -dt = dt.sub(2, tc.TimeUnit.Year); -dt = dt.sub(2, tc.TimeUnit.Month); -dt = dt.sub(2, tc.TimeUnit.Week); -dt = dt.sub(2, tc.TimeUnit.Day); -dt = dt.sub(2, tc.TimeUnit.Hour); -dt = dt.sub(2, tc.TimeUnit.Minute); -dt = dt.sub(2, tc.TimeUnit.Second); -dt = dt.subLocal(2, tc.TimeUnit.Second); -d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local())); -b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local())); -dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local())); -s = dt.toIsoString(); -s = dt.toString(); -s = dt.toUtcString(); - -var wd: tc.WeekDay; -wd = dt.weekDay(); -wd = dt.utcWeekDay(); - -// PERIOD - -s = tc.periodDstToString(tc.PeriodDst.RegularIntervals); -s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime); - -var p: tc.Period; - -p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime); -dt = p.start(); -n = p.amount(); -var tu: tc.TimeUnit = p.unit(); -var pd: tc.PeriodDst = p.dst(); -dt = p.findFirst(tc.DateTime.nowLocal()); -dt = p.findNext(dt); -s = p.toIsoString(); -s = p.toString(); -b = p.isBoundary(dt); - - -// GLOBALS -d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3)); -d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3)); - -dt = tc.min(new tc.DateTime(2), new tc.DateTime(3)); -dt = tc.max(new tc.DateTime(2), new tc.DateTime(3)); - - - - - - - - - - - - - - - - - - - - - -