From 53cb2ca2928aaa65c25734b8a974c9c336bfdfa6 Mon Sep 17 00:00:00 2001 From: Luke Venn Date: Thu, 21 Apr 2016 10:39:10 +0100 Subject: [PATCH 01/79] Added RegExp typing to 'path' argument descriptions --- nock/nock.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nock/nock.d.ts b/nock/nock.d.ts index 208aac9b31..3319456a5e 100644 --- a/nock/nock.d.ts +++ b/nock/nock.d.ts @@ -22,28 +22,45 @@ declare module "nock" { export interface Scope { get(path: string, data?: string): Scope; + get(path: RegExp, data?: string): Scope; post(path: string, data?: string): Scope; post(path: string, data?: Object): Scope; post(path: string, regex?: RegExp): Scope; + post(path: RegExp, data?: string): Scope; + post(path: RegExp, data?: Object): Scope; + post(path: RegExp, regex?: RegExp): Scope; patch(path: string, data?: string): Scope; patch(path: string, data?: Object): Scope; patch(path: string, regex?: RegExp): Scope; + patch(path: RegExp, data?: string): Scope; + patch(path: RegExp, data?: Object): Scope; + patch(path: RegExp, regex?: RegExp): Scope; put(path: string, data?: string): Scope; put(path: string, data?: Object): Scope; put(path: string, regex?: RegExp): Scope; + put(path: RegExp, data?: string): Scope; + put(path: RegExp, data?: Object): Scope; + put(path: RegExp, regex?: RegExp): Scope; head(path: string): Scope; + head(path: RegExp): Scope; delete(path: string, data?: string): Scope; delete(path: string, data?: Object): Scope; delete(path: string, regex?: RegExp): Scope; + delete(path: RegExp, data?: string): Scope; + delete(path: RegExp, data?: Object): Scope; + delete(path: RegExp, regex?: RegExp): Scope; merge(path: string, data?: string): Scope; merge(path: string, data?: Object): Scope; merge(path: string, regex?: RegExp): Scope; + merge(path: RegExp, data?: string): Scope; + merge(path: RegExp, data?: Object): Scope; + merge(path: RegExp, regex?: RegExp): Scope; query(params: any): Scope; query(acceptAnyParams: boolean): Scope; @@ -51,6 +68,9 @@ declare module "nock" { intercept(path: string, verb: string, body?: string, options?: any): Scope; intercept(path: string, verb: string, body?: Object, options?: any): Scope; intercept(path: string, verb: string, body?: RegExp, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: string, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: Object, options?: any): Scope; + intercept(path: RegExp, verb: string, body?: RegExp, options?: any): Scope; reply(responseCode: number, body?: string, headers?: Object): Scope; reply(responseCode: number, body?: Object, headers?: Object): Scope; From 65836b3ed7e704d57005cdd5e12b5e6e09afede5 Mon Sep 17 00:00:00 2001 From: ersimont Date: Sat, 16 Jul 2016 22:06:03 -0400 Subject: [PATCH 02/79] Update rosie.d.ts --- rosie/rosie.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rosie/rosie.d.ts b/rosie/rosie.d.ts index a92359c3d9..f7f679ebb2 100644 --- a/rosie/rosie.d.ts +++ b/rosie/rosie.d.ts @@ -134,11 +134,11 @@ declare namespace rosie { * Factory.define('Person').sequence('id'); * * @param {string} attr - * @param {Array.=} dependencies + * @param {Array.=} | Function dependencies or builder * @param {function(number): *=} builder * @return {Factory} */ - sequence(name: string, dependencies?: string[], builder?: Function) : IFactory; + sequence(name: string, dependenciesOrBuilder?: Function | string[], builder?: Function) : IFactory; /** * Sets a post-processor callback that will receive built objects and the From 6caec1ea7254ee001174587b58f5292760d38522 Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Sun, 24 Jul 2016 03:09:21 -0700 Subject: [PATCH 03/79] Including typings for globalize-compiler. --- .../globalize-compiler-tests.ts | 34 ++++++ globalize-compiler/globalize-compiler.d.ts | 105 ++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 globalize-compiler/globalize-compiler-tests.ts create mode 100644 globalize-compiler/globalize-compiler.d.ts diff --git a/globalize-compiler/globalize-compiler-tests.ts b/globalize-compiler/globalize-compiler-tests.ts new file mode 100644 index 0000000000..df725da90f --- /dev/null +++ b/globalize-compiler/globalize-compiler-tests.ts @@ -0,0 +1,34 @@ +/// + +import globalizeCompiler = require("globalize-compiler"); +const globalize: GlobalizeStatic = null; + +let extractsArray: GlobalizeCompiler.FormatterOrParserFunction[]; + +const templateFunction: (options: GlobalizeCompiler.CompileTemplateOptions) => string = + (options: GlobalizeCompiler.CompileTemplateOptions): string => { + const deps: string[] = options.dependencies; + const code: string = options.code; + return `${deps.join(';')}${code}`; + }; + +let compileOutput: string; +compileOutput = globalizeCompiler.compile(extractsArray); +compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x }); +compileOutput = globalizeCompiler.compile(extractsArray, { template: templateFunction }); +compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x }, { template: templateFunction }); + +let extractOutput: GlobalizeCompiler.ExtractFunction; +extractOutput = globalizeCompiler.extract("path"); +extractOutput = globalizeCompiler.extract({}); + +extractsArray = extractOutput(globalize); + +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en" }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", messages: {} }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", template: templateFunction }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", messages: {}, template: templateFunction }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {} }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, messages: {} }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, template: templateFunction }); +compileOutput = globalizeCompiler.compileExtracts({ extracts: extractOutput, defaultLocale: "en", cldr: {}, messages: {}, template: templateFunction }); diff --git a/globalize-compiler/globalize-compiler.d.ts b/globalize-compiler/globalize-compiler.d.ts new file mode 100644 index 0000000000..dfac538eec --- /dev/null +++ b/globalize-compiler/globalize-compiler.d.ts @@ -0,0 +1,105 @@ +// Type definitions for globalize-compiler v0.2.0 +// Project: https://github.com/jquery-support/globalize-compiler +// Definitions by: Ian Clanton-Thuon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace GlobalizeCompiler { + interface CompileTemplateOptions { + /** + * the source of the compiled formatters and parsers. + */ + code: string; + + /** + * a list of globalize runtime modules that the compiled code depends on, e.g. globalize-runtime/number. + */ + dependencies: string[]; + } + + interface CompileOptions { + /** + * A function that replaces the default template. + */ + template?: (options: CompileTemplateOptions) => string; + } + + interface FormatterOrParserFunction { + (...arguments: any[]): any; + } + + interface ExtractFunction { + /** + * @param {globalize} the globalize object. + * + * @returns an Array with the formatters and parsers created using the passed Globalize. + */ + (globalize: GlobalizeStatic): FormatterOrParserFunction[]; + } + + interface CompileExtractsAttributes extends CompileOptions { + /** + * an Array of extracts obtained by @see{GlobalizeCompilerStatic.extract} + */ + extracts: ExtractFunction; + + /** + * a locale to be used as Globalize.locale(defaultLocale) when generating the extracted formatters and parsers. + */ + defaultLocale: string; + + /** + * an Object with CLDR data (in the JSON format) or a Function taking one argument: locale, a String; returning + * an Object with the CLDR data for the passed locale. Defaults to the entire supplemental data plus the entire + * main data for the defaultLocale. + */ + cldr?: Object | ((locale: string) => Object); + + /** + * an Object with messages data (in the JSON format) or a Function taking one argument: locale, a String; returning + * an Object with the messages data for the passed locale. Defaults to {}. + */ + messages?: Object | ((locale: string) => Object); + } + + interface GlobalizeCompilerStatic { + /** + * Generates a JavaScript bundle containing the specified globalize formatters and parsers. + * + * @param {formattersAndParsers} an Array or an Object containing formatters and/or parsers. + * @param {options} compiler options. + * + * @returns a String with the generated JavaScript bundle (UMD wrapped) including the compiled formatters and + * parsers. + */ + compile(formattersAndParsers: FormatterOrParserFunction[] | { [key: string]: FormatterOrParserFunction }, + options?: CompileOptions): string; + + /** + * Creates an extract function from a source file. + * + * @param {input} a String with a filename, or a String with the file content, or an AST Object. + * + * @returns an extract. An extract is a Function taking one argument: Globalize, the Globalize Object; + * and returning an Array with the formatters and parsers created using the passed Globalize. + */ + extract(input: string | Object): ExtractFunction; + + /** + * Generates a JavaScript bundle containing the specified globalize formatters and parsers. + * + * @param {options} compiler attributes. + * + * @returns a String with the generated JavaScript bundle (UMD wrapped) including the compiled formatters and + * parsers. + */ + compileExtracts(attributes: CompileExtractsAttributes): string; + } +} + +declare module "globalize-compiler" { + var globalizeCompiler: GlobalizeCompiler.GlobalizeCompilerStatic; + + export = globalizeCompiler; +} From ec3c84142e19d300f36bc0e223ac88a187d07d1f Mon Sep 17 00:00:00 2001 From: "ianc@microsoft.com" Date: Tue, 26 Jul 2016 09:52:38 -0700 Subject: [PATCH 04/79] Updating typings for globalize-compiler to use the correct AST type. --- globalize-compiler/globalize-compiler-tests.ts | 4 +++- globalize-compiler/globalize-compiler.d.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/globalize-compiler/globalize-compiler-tests.ts b/globalize-compiler/globalize-compiler-tests.ts index df725da90f..f4fc934d1f 100644 --- a/globalize-compiler/globalize-compiler-tests.ts +++ b/globalize-compiler/globalize-compiler-tests.ts @@ -20,7 +20,9 @@ compileOutput = globalizeCompiler.compile({ x: () => "test", y: (x: string) => x let extractOutput: GlobalizeCompiler.ExtractFunction; extractOutput = globalizeCompiler.extract("path"); -extractOutput = globalizeCompiler.extract({}); + +const ast: ESTree.Program = undefined; +extractOutput = globalizeCompiler.extract(ast); extractsArray = extractOutput(globalize); diff --git a/globalize-compiler/globalize-compiler.d.ts b/globalize-compiler/globalize-compiler.d.ts index dfac538eec..3959924412 100644 --- a/globalize-compiler/globalize-compiler.d.ts +++ b/globalize-compiler/globalize-compiler.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// declare namespace GlobalizeCompiler { interface CompileTemplateOptions { @@ -84,7 +85,7 @@ declare namespace GlobalizeCompiler { * @returns an extract. An extract is a Function taking one argument: Globalize, the Globalize Object; * and returning an Array with the formatters and parsers created using the passed Globalize. */ - extract(input: string | Object): ExtractFunction; + extract(input: string | ESTree.Program): ExtractFunction; /** * Generates a JavaScript bundle containing the specified globalize formatters and parsers. From e5604f86ee04e132173dadc6a09d09a7995a10ed Mon Sep 17 00:00:00 2001 From: EvgeneOskin Date: Wed, 27 Jul 2016 16:00:08 +0600 Subject: [PATCH 05/79] Fix class hierarchy of OpenLayers events. --- openlayers/openlayers.d.ts | 42 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 243087c7b4..a70f3b115b 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -8,7 +8,7 @@ declare namespace olx { /** Attributions */ attributions?: Array - + /*** The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. */ crossOrigin?: string @@ -47,7 +47,7 @@ declare namespace olx { /*** The extent to zoom to. If undefined the validity extent of the view projection is used.*/ extent: ol.Extent; } - + interface AttributionOptions { /** HTML markup for this attribution. */ @@ -1220,7 +1220,7 @@ declare namespace ol { /** * Events emitted by ol.Collection instances are instances of this type. */ - class CollectionEvent { + class CollectionEvent extends ol.events.Event { /** * The element that is added to or removed from the collection. @@ -1279,7 +1279,7 @@ declare namespace ol { /** * Events emitted by ol.interaction.DragBox instances are instances of this type. */ - class DragBoxEvent { + class DragBoxEvent extends ol.events.Event { /** * The coordinate of the drag event. @@ -1935,7 +1935,7 @@ declare namespace ol { /** * Events emitted as map events are instances of this type. See ol.Map for which events trigger a map event. */ - class MapEvent { + class MapEvent extends ol.events.Event { /** * The frame state at the time of the event. @@ -2005,7 +2005,7 @@ declare namespace ol { /** * Events emitted by ol.Object instances are instances of this type. */ - class ObjectEvent { + class ObjectEvent extends ol.events.Event { /** * The name of the property whose value is changing. @@ -2045,7 +2045,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - on(type: string, listener: (event: MapBrowserEvent) => void, ref?: any): any; + on(type: string, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Listen for a certain type of event. @@ -2054,7 +2054,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - on(type: Array, listener: (event: MapBrowserEvent) => void, ref?: any): any; + on(type: Array, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Listen once for a certain type of event. @@ -2063,7 +2063,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - once(type: string, listener: (event: MapBrowserEvent) => void, ref?: any): any; + once(type: string, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Listen once for a certain type of event. @@ -2072,7 +2072,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - once(type: Array, listener: (event: MapBrowserEvent) => void, ref?: any): any; + once(type: Array, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Unlisten for a certain type of event. @@ -2081,7 +2081,7 @@ declare namespace ol { * @param ref The object to use as this in listener. * @returns Unique key for the listener. */ - un(type: Array, listener: (event: MapBrowserEvent) => void, ref?: any): any; + un(type: Array, listener: (event: ol.events.Event) => void, ref?: any): any; /** * Removes an event listener using the key returned by on() or once(). Note that using the ol.Observable.unByKey static function is to be preferred. @@ -2165,7 +2165,7 @@ declare namespace ol { /** * Events emitted by ol.interaction.Select instances are instances of this type. */ - class SelectEvent { + class SelectEvent extends ol.events.Event { /** * Deselected features array. @@ -2551,6 +2551,12 @@ declare namespace ol { function targetNotEditable(mapBrowserEvent: ol.MapBrowserEvent): boolean; } interface ConditionType { (mapBrowseEvent: ol.MapBrowserEvent): boolean; } + class Event { + target: any; + type: string; + preventDefault(): void; + stopPropagation(): void; + } } namespace extent { @@ -3601,7 +3607,7 @@ declare namespace ol { class DragAndDrop { } - class DragAndDropEvent { + class DragAndDropEvent extends ol.events.Event { } class DragBox { @@ -3623,7 +3629,7 @@ declare namespace ol { constructor(opt_options?: olx.interaction.DrawOptions) } - class DrawEvent { + class DrawEvent extends ol.events.Event { } class Interaction extends ol.Object { @@ -4129,7 +4135,7 @@ declare namespace ol { namespace render { - class Event { + class Event extends ol.events.Event { } class VectorContext { @@ -4167,7 +4173,7 @@ declare namespace ol { class ImageCanvas extends Image { } - class ImageEvent { + class ImageEvent extends ol.events.Event { } class ImageMapGuide extends Image { @@ -4216,7 +4222,7 @@ declare namespace ol { class TileDebug extends Tile { } - class TileEvent { + class TileEvent extends ol.events.Event { } class TileImage extends UrlTile { @@ -4301,7 +4307,7 @@ declare namespace ol { getFeaturesAtCoordinate(coordinate: ol.Coordinate): ol.Feature[]; } - class VectorEvent { + class VectorEvent extends ol.events.Event { } class VectorTile extends UrlTile { From fecf43607ba28189b1901be4309f438a6f6cce97 Mon Sep 17 00:00:00 2001 From: dmitryrogozhny Date: Thu, 28 Jul 2016 16:56:42 +0300 Subject: [PATCH 06/79] Changed AtomicBlockUtils and KeyBindingUtil from interfaces to classes with static functions (#10324) --- draft-js/draft-js.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/draft-js/draft-js.d.ts b/draft-js/draft-js.d.ts index 999741b426..bf10cd22c4 100644 --- a/draft-js/draft-js.d.ts +++ b/draft-js/draft-js.d.ts @@ -180,17 +180,17 @@ declare namespace Draft { namespace Utils { import DraftEditorCommand = Draft.Model.Constants.DraftEditorCommand; - interface KeyBindingUtil { + class KeyBindingUtil { /** * Check whether the ctrlKey modifier is *not* being used in conjunction with * the altKey modifier. If they are combined, the result is an `altGraph` * key modifier, which should not be handled by this set of key bindings. */ - isCtrlKeyCommand(e: SyntheticKeyboardEvent): boolean; + static isCtrlKeyCommand(e: SyntheticKeyboardEvent): boolean; - isOptionKeyCommand(e: SyntheticKeyboardEvent): boolean; + static isOptionKeyCommand(e: SyntheticKeyboardEvent): boolean; - hasCommandModifier(e: SyntheticKeyboardEvent): boolean; + static hasCommandModifier(e: SyntheticKeyboardEvent): boolean; } /** @@ -797,8 +797,8 @@ declare namespace Draft { type URI = any; - interface AtomicBlockUtils { - insertAtomicBlock(editorState: EditorState, entityKey: string, character: string): EditorState; + class AtomicBlockUtils { + static insertAtomicBlock(editorState: EditorState, entityKey: string, character: string): EditorState; } /** From c867637b9eb295d76f9458cf246bdbe952616adb Mon Sep 17 00:00:00 2001 From: Ian Clanton-Thuon Date: Thu, 28 Jul 2016 07:02:55 -0700 Subject: [PATCH 07/79] Fixing a few minor issues in webpack-stream. (#10253) --- webpack-stream/webpack-stream.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack-stream/webpack-stream.d.ts b/webpack-stream/webpack-stream.d.ts index 1a41fa491b..c98c0372dd 100644 --- a/webpack-stream/webpack-stream.d.ts +++ b/webpack-stream/webpack-stream.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Combokeys v3.20.0 +// Type definitions for webpack-stream v3.2.0 // Project: https://github.com/shama/webpack-stream // Definitions by: Ian Clanton-Thuon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 73291dad15cfd1ca7061f9a1ac26810a69961861 Mon Sep 17 00:00:00 2001 From: Andy Shu Xin Date: Thu, 28 Jul 2016 22:24:40 +0800 Subject: [PATCH 08/79] Document changes in 0.28 and 0.29 in React Native (#10309) * RN: Widen limit of refreshControl * RN: Update NavigationExperimental to 0.28 * RN: Define new method from 0.28 * RN: Promisify requestPermissions per 0.28 * RN: Remove onNavigate method See: https://github.com/facebook/react-native/commit/fb0007d85323909ab652bf97166744fa7e17daab#diff-04c37ff76f85aea35e8475617539b75fR94 * RN: Add onNavigateBack method See: https://github.com/facebook/react-native/commit/fb0007d85323909ab652bf97166744fa7e17daab#diff-04c37ff76f85aea35e8475617539b75fR94 * RN: Deprecate StatusBarIOS * RN: Update StyleSheet API per 0.29 * RN: Define KeyboardAvoidingView added in 0.29 * RN: Define saveToCameraRoll added in 0.29 * RN: Define cancellable from InteractionManager * RN: Add new possible values of flexDirection * RN: Define lineBreakMode * RN: Allow zIndex prop * RN: Allow dimension limits * RN: Specify type of refreshControl * RN: Mark properties as optional * RN: Clarify parameter naming * RN: Mark optional property as optional * RN: Definite explicit ref type * RN: Restore StyleSheet.create to restore compatibility --- react-native/react-native.d.ts | 235 +++++++++++++++++++++++++++------ 1 file changed, 195 insertions(+), 40 deletions(-) diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index 0c8e96599e..ff08bd0ff1 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -340,11 +340,15 @@ declare namespace __React { borderWidth?: number bottom?: number flex?: number - flexDirection?: "row" | "column" + flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" flexWrap?: "wrap" | "nowrap" height?: number justifyContent?: FlexJustifyType left?: number + minWidth?: number + maxWidth?: number + minHeight?: number + maxHeight?: number margin?: number marginBottom?: number marginHorizontal?: number @@ -363,6 +367,11 @@ declare namespace __React { right?: number top?: number width?: number + + /** + * @platform ios + */ + zIndex?: number } /** @@ -509,6 +518,12 @@ declare namespace __React { */ allowFontScaling?: boolean + /** + * Line Break mode. Works only with numberOfLines. + * clip is working only for iOS + */ + lineBreakMode?: 'head' | 'middle' | 'tail' | 'clip' + /** * Used to truncate the text with an elipsis after computing the text layout, including line wrapping, such that the total number of lines does not exceed this number. */ @@ -1279,6 +1294,23 @@ declare namespace __React { setPageWithoutAnimation: (selectedPage: number) => void } + export interface KeyboardAvoidingViewStatic extends React.ComponentClass { + + } + + export interface KeyboardAvoidingViewProps extends ViewProperties, React.Props { + + behavior?: 'height' | 'position' | 'padding' + + /** + * This is the distance between the top of the user screen and the react native view, + * may be non-zero in some use cases. + */ + keyboardVerticalOffset: number + + ref?: Ref + } + /** * //FIXME: No documentation extracted from code comment on WebView.ios.js */ @@ -1459,7 +1491,7 @@ declare namespace __React { * sets whether the webpage scales to fit the view and the user can change the scale */ scalesPageToFit?: boolean - + ref?: Ref } @@ -1728,7 +1760,7 @@ declare namespace __React { /** * @Deprecated since version 0.28.0 - */ + */ export interface ActivityIndicatorIOSStatic extends React.ComponentClass { } @@ -2134,7 +2166,7 @@ declare namespace __React { * Size of the refresh indicator, see RefreshControl.SIZE. */ size?: number - + /** * Progress view top offset * @platform android @@ -2155,7 +2187,7 @@ declare namespace __React { * Whether the view should be indicating an active refresh. */ refreshing?: boolean - + ref?: Ref } @@ -3354,7 +3386,99 @@ declare namespace __React { } export interface StyleSheetStatic extends React.ComponentClass { + + /** + * Creates a StyleSheet style reference from the given object. + */ create( styles: T ): T; + + /** + * Flattens an array of style objects, into one aggregated style object. + * Alternatively, this method can be used to lookup IDs, returned by + * StyleSheet.register. + * + * > **NOTE**: Exercise caution as abusing this can tax you in terms of + * > optimizations. + * > + * > IDs enable optimizations through the bridge and memory in general. Refering + * > to style objects directly will deprive you of these optimizations. + * + * Example: + * ``` + * var styles = StyleSheet.create({ + * listItem: { + * flex: 1, + * fontSize: 16, + * color: 'white' + * }, + * selectedListItem: { + * color: 'green' + * } + * }); + * + * StyleSheet.flatten([styles.listItem, styles.selectedListItem]) + * // returns { flex: 1, fontSize: 16, color: 'green' } + * ``` + * Alternative use: + * ``` + * StyleSheet.flatten(styles.listItem); + * // return { flex: 1, fontSize: 16, color: 'white' } + * // Simply styles.listItem would return its ID (number) + * ``` + * This method internally uses `StyleSheetRegistry.getStyleByID(style)` + * to resolve style objects represented by IDs. Thus, an array of style + * objects (instances of StyleSheet.create), are individually resolved to, + * their respective objects, merged as one and then returned. This also explains + * the alternative use. + */ + flatten(style: Object): Object + + /** + * This is defined as the width of a thin line on the platform. It can be + * used as the thickness of a border or division between two elements. + * Example: + * ``` + * { + * borderBottomColor: '#bbb', + * borderBottomWidth: StyleSheet.hairlineWidth + * } + * ``` + * + * This constant will always be a round number of pixels (so a line defined + * by it look crisp) and will try to match the standard width of a thin line + * on the underlying platform. However, you should not rely on it being a + * constant size, because on different platforms and screen densities its + * value may be calculated differently. + */ + hairlineWidth: number + + /** + * A very common pattern is to create overlays with position absolute and zero positioning, + * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated + * styles. + */ + absoluteFill: number + + + /** + * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be + * used to create a customized entry in a `StyleSheet`, e.g.: + * + * const styles = StyleSheet.create({ + * wrapper: { + * ...StyleSheet.absoluteFillObject, + * top: 10, + * backgroundColor: 'transparent', + * }, + * }); + */ + absoluteFillObject: { + position: string + left: number + right: number + top: number + bottom: number + } } /** @@ -3516,12 +3640,12 @@ declare namespace __React { * A Boolean value that indicates whether the tab bar is translucent */ translucent?: boolean - + /** * Color of text on unselected tabs */ unselectedTintColor?: string - + ref?: Ref } @@ -3606,6 +3730,21 @@ declare namespace __React { export interface DeviceEventEmitterStatic { addListener( type: string, onReceived: ( data: T ) => void ): DeviceEventSubscription; + + /** + * Removes the given listener for event of specific type. + * + * @param {string} eventType - Name of the event to emit + * @param {function} listener - Function to invoke when the specified event is + * emitted + * + * @example + * emitter.removeListener('someEvent', function(message) { + * console.log(message); + * }); // removes the listener if already registered + * + */ + removeListener( eventType: String, listener: Function): void } // Used by Dimensions below @@ -3666,9 +3805,11 @@ declare namespace __React { /** * Schedule a function to run after all interactions have completed. + * Returns a cancellable * @param fn */ - runAfterInteractions( fn: () => void | PromiseTask): Promise + runAfterInteractions( fn: () => void | PromiseTask): + {then: Function, done: Function, cancel: Function} /** * Notify manager that an interaction has started. @@ -3950,7 +4091,7 @@ declare namespace __React { * The frequency of the events can be contolled using the scrollEventThrottle prop. */ onScroll?: (event?: { nativeEvent: NativeScrollEvent }) => void - + /** * When true the scroll view stops on multiples of the scroll view's size * when scrolling. This can be used for horizontal pagination. The default @@ -3985,7 +4126,7 @@ declare namespace __React { * A RefreshControl component, used to provide pull-to-refresh * functionality for the ScrollView. */ - refreshControl?: RefreshControl + refreshControl?: React.ReactElement ref?: Ref } @@ -4055,7 +4196,7 @@ declare namespace __React { layoutMeasurement: NativeScrollSize; zoomScale: number; } - + // Deduced from // https://github.com/facebook/react-native/commit/052cd7eb8afa7a805ef13e940251be080499919c @@ -4075,18 +4216,18 @@ declare namespace __React { getOpenRowID(): string setOpenRowID(rowID: string): ListViewDataSource } - + export interface SwipeableListViewProps extends React.Props { dataSource: SwipeableListViewDataSource maxSwipeDistance?: number - + // Callback method to render the swipeable view renderRow: ( rowData: any, sectionID: string | number, rowID: string | number, highlightRow?: boolean ) => React.ReactElement - + // Callback method to render the view that will be unveiled on swipe renderQuickActions(rowData: Object, sectionID: string, rowID: string): React.ReactElement } - + export interface SwipeableListViewStatic extends React.ComponentClass { getNewDataSource(): SwipeableListViewDataSource } @@ -4399,9 +4540,27 @@ declare namespace __React { * assets-library tag * a tag not maching any of the above, which means the image data will be stored in memory (and consume memory as long as the process is alive) * + * @deprecated use saveToCameraRoll instead + * */ saveImageWithTag( tag: string ): Promise + /** + * Saves the photo or video to the camera roll / gallery. + * + * On Android, the tag must be a local image or video URI, such as `"file:///sdcard/img.png"`. + * + * On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs) + * or a local video file URI (remote or data URIs are not supported for saving video at this time). + * + * If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise + * it will be treated as a photo. To override the automatic choice, you can pass an optional + * `type` parameter that must be one of 'photo' or 'video'. + * + * Returns a Promise which will resolve with the new URI. + */ + saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise + /** * Invokes callback with photo identifier objects from the local camera roll of the device matching shape defined by getPhotosReturnChecker. * @@ -4858,7 +5017,7 @@ declare namespace __React { * Requests all notification permissions from iOS, prompting the user's * dialog box. */ - requestPermissions( permissions?: PushNotificationPermissions[] ): void + requestPermissions( permissions?: PushNotificationPermissions[] ): Promise /** * Unregister for all remote notifications received via Apple Push @@ -4970,17 +5129,10 @@ declare namespace __React { /** - * //FIXME: No documentation is available (although this is self explanatory) - * - * @see https://facebook.github.io/react-native/docs/statusbarios.html#content + * StatusBarIOS is being deprecated. + * @see https://github.com/facebook/react-native/commit/4de616b4c1a9d3556632a93504828f0539fa4fa5 */ export interface StatusBarIOSStatic { - - setStyle(style: StatusBarStyle, animated?: boolean): void - - setHidden(hidden: boolean, animation?: StatusBarAnimation): void - - setNetworkActivityIndicatorVisible(visible: boolean): void } type TimePickerAndroidOpenOptions = { @@ -5072,7 +5224,7 @@ declare namespace __React { * Default value is false. */ value?: boolean - + style?: ViewStyle ref?: Ref @@ -5494,26 +5646,25 @@ declare namespace __React { type: string; } - export interface NavigationState { + export interface NavigationRoute { key: string; } - export interface NavigationParentState extends NavigationState { + export interface NavigationState extends NavigationRoute { index: number; - children: NavigationState[]; + routes: NavigationRoute[]; } export type NavigationRenderer = ( - navigationState: NavigationParentState, + route: NavigationState, onNavigate: (action: NavigationAction) => boolean ) => JSX.Element; // Definitions for NavigationExperimental feature are deduced // from code examples export interface NavigationAnimatedViewStaticProps { - navigationState?: any + route?: any style?: ViewStyle - onNavigate?(action: Object): boolean renderOverlay?(props: Object): JSX.Element applyAnimation(pos: any, navState: Object): void // TODO: what's pos? renderScene?(props: Object): JSX.Element @@ -5521,24 +5672,25 @@ declare namespace __React { export interface NavigationAnimatedViewStatic extends React.ComponentClass { } - + export interface NavigationHeaderProps { renderTitleComponent?(props: Object): JSX.Element + onNavigateBack(): void } - + export interface NavigationHeaderStatic extends React.ComponentClass { Title: JSX.Element HEIGHT: number } - + export interface NavigationCardStackProps { direction?: 'horizontal' | 'vertical' style?: ViewStyle - navigationState?: any - onNavigate(action: Object): boolean + route?: any renderScene?(props: any /* undocumented on 0.27 */): JSX.Element + onNavigateBack(): void } - + export interface NavigationCardStackStatic extends React.ComponentClass { } @@ -5548,7 +5700,7 @@ declare namespace __React { Header: NavigationHeaderStatic; Reducer: NavigationReducerStatic; } - + export interface NavigationContainerProps { tabs: NavigationTab[]; index: number; @@ -5639,7 +5791,7 @@ declare namespace __React { export var StyleSheet: StyleSheetStatic export type StyleSheet = StyleSheetStatic - + export var SwipeableListView: SwipeableListViewStatic export type SwipeableListView = SwipeableListViewStatic @@ -5720,6 +5872,9 @@ declare namespace __React { export var IntentAndroid: IntentAndroidStatic export type IntentAndroid = IntentAndroidStatic + export var KeyboardAvoidingView: KeyboardAvoidingViewStatic + export type KeyboardAvoidingView = KeyboardAvoidingViewStatic + export var Linking: LinkingStatic export type Linking = LinkingStatic From d997f92b892040860145a9510504dff22f672a36 Mon Sep 17 00:00:00 2001 From: Nikita Kobzev Date: Thu, 28 Jul 2016 17:28:41 +0300 Subject: [PATCH 09/79] Added Headers constructor options to whatwg-fetch (#10313) --- whatwg-fetch/whatwg-fetch-tests.ts | 13 +++++++++++++ whatwg-fetch/whatwg-fetch.d.ts | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/whatwg-fetch/whatwg-fetch-tests.ts b/whatwg-fetch/whatwg-fetch-tests.ts index 8dbbd2964b..090e114b5d 100644 --- a/whatwg-fetch/whatwg-fetch-tests.ts +++ b/whatwg-fetch/whatwg-fetch-tests.ts @@ -1,5 +1,18 @@ /// +function test_HeadersCopiedFromHeaders() { + var source = new Headers(); + source.append('Content-Type', 'application/json'); + return new Headers(source); +} + +function test_HeadersCopiedFromHash() { + var source:HeadersMap = { + 'Content-Type': 'application/json' + }; + return new Headers(source); +} + function test_fetchUrlWithOptions() { var headers = new Headers(); headers.append("Content-Type", "application/json"); diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index 8997ab6917..5a428fb47b 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -41,7 +41,12 @@ type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cache" | "only-if-cached"; +declare interface HeadersMap { + [index: string]: string; +} + declare class Headers { + constructor(headers?:Headers|HeadersMap) append(name: string, value: string): void; delete(name: string):void; get(name: string): string; @@ -60,6 +65,7 @@ declare class Body { json(): Promise; text(): Promise; } + declare class Response extends Body { constructor(body?: BodyInit, init?: ResponseInit); static error(): Response; From 0bbf56537dd2bc7cbd74f80d1e14b50d8857d6bd Mon Sep 17 00:00:00 2001 From: Richard Natal Date: Thu, 28 Jul 2016 11:37:51 -0300 Subject: [PATCH 10/79] Impl: Updated definitions for oracledb (#10323) --- oracledb/oracledb-1.5.0-tests.ts | 32 ++ oracledb/oracledb-1.5.0.d.ts | 308 ++++++++++++++++++ oracledb/oracledb-tests.ts | 36 ++- oracledb/oracledb.d.ts | 516 ++++++++++++++++++++++++------- 4 files changed, 770 insertions(+), 122 deletions(-) create mode 100644 oracledb/oracledb-1.5.0-tests.ts create mode 100644 oracledb/oracledb-1.5.0.d.ts diff --git a/oracledb/oracledb-1.5.0-tests.ts b/oracledb/oracledb-1.5.0-tests.ts new file mode 100644 index 0000000000..19976034ea --- /dev/null +++ b/oracledb/oracledb-1.5.0-tests.ts @@ -0,0 +1,32 @@ +/// + +import * as OracleDB from 'oracledb' + +OracleDB.getConnection( + { + user: "hr", + password: "welcome", + connectString: "localhost/XE" + }, + function(err, connection) { + if (err) { + console.error(err.message) + return + } + connection.execute( + "SELECT department_id, department_name " + + "FROM departments " + + "WHERE manager_id < :id", + [110], // bind value for :id + function (err, result) { + if (err) { + console.error(err.message) + return + } + console.log(result.rows); + console.log(result.rows[0].department_id); // when outFormet is OBJECT + console.log(result.metaData[0].name); + } + ) + } +) diff --git a/oracledb/oracledb-1.5.0.d.ts b/oracledb/oracledb-1.5.0.d.ts new file mode 100644 index 0000000000..c57a8efaae --- /dev/null +++ b/oracledb/oracledb-1.5.0.d.ts @@ -0,0 +1,308 @@ +// Type definitions for oracledb v1.5.0 +// Project: https://github.com/oracle/node-oracledb +// Definitions by: Richard Natal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module 'oracledb' { + import * as stream from "stream"; + + export interface ILob { + chunkSize: number; + length: number; + pieceSize: number; + offset?: number; + type: string; + /** + * Release method on ILob class. + * @remarks The cleanup() called by Release() only frees OCI error handle and Lob + * locator. These calls acquire mutex on OCI environment handle very briefly. + */ + release?(): void; + /** + * Read method on ILob class. + * @param {(err : any, chunk: string | Buffer) => void} callback Callback to recive the data from lob. + * @remarks CLobs send strings while BLobs send Buffer object. + */ + read?(callback: (err: any, chunk: string | Buffer) => void): void; + /** + * Read method on ILob class. + * @param {Buffer} data Data write into Lob. + * @param {(err: any) => void} callback Callback executed when writ is finished or when some error occured. + * @remarks CLobs send strings while BLobs send Buffer object. + */ + write?(data: Buffer, callback: (err: any) => void): void; + } + + export interface Lob extends stream.Duplex { + iLob: ILob; + chunkSize: number; + length: number; + pieceSize: number; + type: string; + + /** + * Do not call this... used internally by node-oracledb + */ + constructor(iLob: ILob, opts: stream.DuplexOptions): Lob; + constructor(iLob: ILob): Lob; + + /** + * Closes the current LOB. + * @param {(err: any) => void} callback? When passed, is called after the release. + * @returns void + */ + close(callback: (err: any) => void): void; + close(): void; + } + + export interface IConnectionAttributes { + user?: string; + password?: string; + connectString: string; + stmtCacheSize?: number; + externalAuth?: boolean; + } + + export interface IPoolAttributes extends IConnectionAttributes { + poolMax?: number; + poolMin?: number; + poolIncrement?: number; + poolTimeout?: number; + } + + export interface IExecuteOptions { + /** Maximum number of rows that will be retrieved. Used when resultSet is false. */ + maxRows?: number; + /** Number of rows to be fetched in advance. */ + prefetchRows?: number; + /** Result format - ARRAY o OBJECT */ + outFormat?: number; + /** Should use ResultSet or not. */ + resultSet?: boolean; + /** Transaction should auto commit after each statement? */ + autoCommit?: boolean; + } + + export interface IExecuteReturn { + /** Number o rows affected by the statement (used for inserts / updates)*/ + rowsAffected?: number; + /** When the statement has out parameters, it comes here. */ + outBinds?: Array | Object; + /** Metadata information - just columns names for now. */ + metaData?: Array; + /** When not using ResultSet, query results comes here. */ + rows?: Array> | Array; + /** When using ResultSet, query results comes here. */ + resultSet?: IResultSet; + } + + export interface IMetaData { + /** Column name */ + name: string; + } + + export interface IResultSet { + /** Metadata information - just columns names for now. */ + metaData?: Array; + /** + * Closes the ResultSet. + * @param {(err:any)=>void} callback Callback called on finish or when some error occurs + * @returns void + * @remarks After using a resultSet, it must be closed to free the resources used by the driver. + */ + close(callback: (err: any) => void): void; + /** + * Fetch one row from ResultSet. + * @param {(err:any,row:Array|Object)=>void} callback Callback called when the row is available or when some error occurs. + * @returns void + */ + getRow(callback: (err: any, row: Array | Object) => void): void; + /** + * Fetch some rows from ResultSet. + * @param {number} rowCount Number of rows to be fetched. + * @param {(err:any,rows:Array>|Array)=>void} callback Callback called when the rows are available, or when some error occurs. + * @returns void + * @remarks When the number of rows passed to the callback is less than the rowCount, no more rows are available to be fetched. + */ + getRows(rowCount: number, callback: (err: any, rows: Array> | Array) => void): void; + } + + export interface IConnection { + /** Statement cache size in bytes (read-only)*/ + stmtCacheSize: number; + /** Client id (to be sent to database) (write-only)*/ + clientId: string; + /** Module (write-only) */ + module: string; + /** Action */ + action: string; + /** Oracle server version */ + oracleServerVersion: number; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {Object|Array} Binds Binds Object/Array + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + binds: Object | Array, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {Object|Array} Binds Binds Object/Array + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + binds: Object | Array, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Execute method on Connection class. + * @param {string} sql SQL Statement. + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * Release method on Connection class. + * @param {(err: any) => void} callback Callback function to be called when the connection has been released. + */ + release(callback: (err: any) => void): void; + + /** + * Send a commit requisition to the database. + * @param {(err: any) => void} callback Callback on commit done. + */ + commit(callback: (err: any) => void): void; + + /** + * Send a rollback requisition to database. + * @param {(err: any) => void} callback Callback on rollback done. + */ + rollback(callback: (err: any) => void): void; + + /** + * Send a break to the database. + * @param {(err: any) => void} callback Callback on break done. + */ + break(callback: (err: any) => void): void; + } + + export interface IConnectionPool { + poolMax: number; + poolMin: number; + poolIncrement: number; + poolTimeout: number; + connectionsOpen: number; + connectionsInUse: number; + stmtCacheSize: number; + /** + * Finalizes the connection pool. + * @param {(err:any)=>void} callback Callback called when the pool is terminated or when some error occurs + * @returns void + */ + terminate(callback: (err: any) => void): void; + /** + * Retrieve a connection from the pool. + * @param {(err:any,connection:IConnection)=>void} callback Callback called when the connection is available or when some error occurs. + * @returns void + * @see {@link https://jsao.io/2015/03/making-a-wrapper-module-for-the-node-js-driver-for-oracle-database/} + * @see {@link https://github.com/OraOpenSource/orawrap} + */ + getConnection(callback: (err: any, connection: IConnection) => void): void; + } + + export const DEFAULT: number; + /** Data type */ + export const STRING: number; + /** Data type */ + export const NUMBER: number; + /** Data type */ + export const DATE: number; + /** Data type */ + export const CURSOR: number; + /** Data type */ + export const BUFFER: number; + /** Data type */ + export const CLOB: number; + /** Data type */ + export const BLOB: number; + /** Bind direction */ + export const BIND_IN: number; + /** Bind direction */ + export const BIND_INOUT: number; + /** Bind direction */ + export const BIND_OUT: number; + /** outFormat */ + export const ARRAY: number; + /** outFormat */ + export const OBJECT: number; + + /** + * Do not use this method - used internally by node-oracledb. + */ + export function newLob(iLob: ILob): Lob; + + /** + * Creates a connection with the database. + * @param {IConnectionAttributes} connectionAttributes Parameters to stablish the connection. + * @param {(err:any,connection:IConnection)=>void} callback Callback to run when the connection gets stablished or when some error occurs. + * @returns void + */ + export function getConnection(connectionAttributes: IConnectionAttributes, callback: (err: any, connection: IConnection) => void): void; + + /** + * Creates a database managed connection pool. + * @param {IPoolAttributes} poolAttributes Parameters to stablish the connection pool. + * @param {(err:any,connection:IConnectionPool)=>void} callback Callback to run when the connection pool gets created or when some error occurs. + * @returns void + */ + export function createPool(poolAttributes: IPoolAttributes, callback: (err: any, connection: IConnectionPool) => void): void; + + /** Default maximum connections in created pools */ + export var poolMax: number; + /** Default minimum connections in created pools */ + export var poolMin: number; + /** Default number of connections to increment when available connections reach 0 in created pools. poolMax will be respected.*/ + export var poolIncrement: number; + /** Default timeout for unused connections in pool to be released. poolMin will be respected.*/ + export var poolTimeout: number; + /** Default size of statements cache. Used to speed up creating queries.*/ + export var stmtCacheSize: number; + /** Default number of rows that the driver will fetch in each query.*/ + export var prefetchRows: number; + /** Default transaction behaviour of auto commit for each statement. */ + export var autoCommit: boolean; + /** Default maximum number of rows to be fetched in statements not using ResultSets */ + export var maxRows: number; + /** Default format for returning rows. When ARRAY, it will return Array>. When OBJECT, it will return Array. */ + export var outFormat: number; + /** node-oracledb driver version. */ + export var version: number; + export var connectionClass: string; + /** Default authentication/authorization method. When true, the SO trusted user will be used. */ + export var externalAuth: boolean; + export var fetchAsString: any; + /** Default size in bytes that the driver will fetch from LOBs in advance. */ + export var lobPrefetchSize: number; + /** Version of OCI that is used. */ + export var oracleClientVersion: number; +} diff --git a/oracledb/oracledb-tests.ts b/oracledb/oracledb-tests.ts index 674775bd79..3757afd410 100644 --- a/oracledb/oracledb-tests.ts +++ b/oracledb/oracledb-tests.ts @@ -1,5 +1,4 @@ /// -/// import * as OracleDB from 'oracledb'; @@ -20,12 +19,39 @@ OracleDB.getConnection( [110], // bind value for :id function(err, result) { if (err) { - console.error(err.message); return; + console.error(err.message); + } else { + console.log(result.rows); + console.log(result.rows[0].department_id); // when outFormet is OBJECT + console.log(result.metaData[0].name); } - console.log(result.rows); - console.log(result.rows[0].department_id); // when outFormet is OBJECT - console.log(result.metaData[0].name); + connection.release(); } ); } ); + +OracleDB.getConnection( + { + user: "hr", + password: "welcome", + connectString: "localhost/XE" + } +).then((connection: OracleDB.IConnection) => { + return connection.execute( + "SELECT department_id, department_name " + + "FROM departments " + + "WHERE manager_id < :id", + [110] + ).then(result => { + console.log(result.rows); + console.log(result.rows[0].department_id); // when outFormet is OBJECT + console.log(result.metaData[0].name); + }).catch((err: any) => { + console.error(err.message); + }).then(() => { + return connection.release(); + }); +}).catch((err: any) => { + console.error(err.message); +}); diff --git a/oracledb/oracledb.d.ts b/oracledb/oracledb.d.ts index c57a8efaae..8101f8f471 100644 --- a/oracledb/oracledb.d.ts +++ b/oracledb/oracledb.d.ts @@ -1,4 +1,4 @@ -// Type definitions for oracledb v1.5.0 +// Type definitions for oracledb v1.10.0 // Project: https://github.com/oracle/node-oracledb // Definitions by: Richard Natal // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,6 +8,14 @@ declare module 'oracledb' { import * as stream from "stream"; + export type TRet = T | IPromise; + export type TFunc = (value: T) => TRet; + + export interface IPromise { + catch(onReject: TFunc) : IPromise; + then(onResolve?: TFunc, onReject?: TFunc) : IPromise; + } + export interface ILob { chunkSize: number; length: number; @@ -37,10 +45,21 @@ declare module 'oracledb' { export interface Lob extends stream.Duplex { iLob: ILob; + /** This corresponds to the size used by the Oracle LOB layer when accessing or modifying the LOB value. */ chunkSize: number; + /** Length of a queried LOB in bytes (for BLOBs) or characters (for CLOBs). */ length: number; + /** + * he number of bytes (for BLOBs) or characters (for CLOBs) to read for each Stream 'data' event of a queried LOB. + * The default value is chunkSize. + * For efficiency, it is recommended that pieceSize be a multiple of chunkSize. + * The maximum value for pieceSize is limited to the value of UINT_MAX. + */ pieceSize: number; - type: string; + /** + * This read-only attribute shows the type of Lob being used. It will have the value of one of the constants Oracledb.BLOB or Oracledb.CLOB. The value is derived from the bind type when using LOB bind variables, or from the column type when a LOB is returned by a query. + */ + type: number; /** * Do not call this... used internally by node-oracledb @@ -73,119 +92,187 @@ declare module 'oracledb' { } export interface IExecuteOptions { - /** Maximum number of rows that will be retrieved. Used when resultSet is false. */ - maxRows?: number; - /** Number of rows to be fetched in advance. */ - prefetchRows?: number; - /** Result format - ARRAY o OBJECT */ - outFormat?: number; - /** Should use ResultSet or not. */ - resultSet?: boolean; - /** Transaction should auto commit after each statement? */ + /** + * Transaction should auto commit after each statement? + * Overrides Oracledb autoCommit. + */ autoCommit?: boolean; + /** + * Determines whether additional metadata is available for queries and for REF CURSORs returned from PL/SQL blocks. + * Overrides Oracledb extendedMetaData. + */ + extendedMetaData?: boolean; + /** + * Object defining how query column data should be represented in JavaScript. + * The fetchInfo property can be used to indicate that number or date columns in a query should be returned as strings instead of their native format. The property can be used in conjunction with, or instead of, the global setting fetchAsString. + * For example: + * + * fetchInfo: + * { + * "HIRE_DATE": { type : oracledb.STRING }, // return the date as a string + * "COMMISSION_PCT": { type : oracledb.DEFAULT } // override Oracledb.fetchAsString + * } + * + * Each column is specified by name, using Oracle's standard naming convention. + * The valid values for type are STRING and DEFAULT. The former indicates that the given column should be returned as a string. The latter can be used to override any global mapping given by fetchAsString and allow the column data for this query to be returned in native format. + * The maximum length of a string created by type mapping is 200 bytes. However, if a database column that is already of type STRING is specified in fetchInfo, then the actual database metadata will be used to determine the maximum length. + * Columns fetched from REF CURSORS are not mapped by fetchInfo settings in the execute() call. Use the global fetchAsString instead. + */ + fetchInfo?: Object; + /** + * Maximum number of rows that will be retrieved. Used when resultSet is false. + * Overrides Oracledb maxRows. + */ + maxRows?: number; + /** + * Result format - ARRAY o OBJECT + * Overrides Oracledb outFormat. + */ + outFormat?: number; + /** + * Number of rows to be fetched in advance. + * Overrides Oracledb prefetchRows. + */ + prefetchRows?: number; + /** + * Determines whether query results should be returned as a ResultSet object or directly. The default is false. + */ + resultSet?: boolean; } export interface IExecuteReturn { - /** Number o rows affected by the statement (used for inserts / updates)*/ - rowsAffected?: number; - /** When the statement has out parameters, it comes here. */ - outBinds?: Array | Object; - /** Metadata information - just columns names for now. */ + /** Metadata information - column names is always given. If the Oracledb extendedMetaData or execute() option extendedMetaData are true then additional information is included. */ metaData?: Array; - /** When not using ResultSet, query results comes here. */ - rows?: Array> | Array; - /** When using ResultSet, query results comes here. */ + /** This is either an array or an object containing OUT and IN OUT bind values. If bindParams is passed as an array, then outBinds is returned as an array. If bindParams is passed as an object, then outBinds is returned as an object. */ + outBinds?: Array | Object; + /** For SELECT statements when the resultSet option is true, use the resultSet object to fetch rows. See ResultSet Class. */ resultSet?: IResultSet; + /** For SELECT statements where the resultSet option is false or unspecified, rows contains an array of fetched rows. It will be NULL if there is an error or the SQL statement was not a SELECT statement. By default, the rows are in an array of column value arrays, but this can be changed to arrays of objects by setting outFormat to OBJECT. If a single row is fetched, then rows is an array that contains one single row. The number of rows returned is limited to the maxRows configuration property of the Oracledb object, although this may be overridden in any execute() call. */ + rows?: Array> | Array; + /** For DML statements (including SELECT FOR UPDATE) this contains the number of rows affected, for example the number of rows inserted. For non-DML statements such as queries, or if no rows are affected, then rowsAffected will be zero. */ + rowsAffected?: number; } export interface IMetaData { - /** Column name */ + /** The column name follows Oracle's standard name-casing rules. It will commonly be uppercase, since most applications create tables using unquoted, case-insensitive names. */ name: string; + /** one of the Node-oracledb Type Constant values. */ + fetchType?: number; + /** one of the Node-oracledb Type Constant values. */ + dbType?: number; + /** the database byte size. This is only set for DB_TYPE_VARCHAR, DB_TYPE_CHAR and DB_TYPE_RAW column types. */ + byteSize?: number; + /** set only for DB_TYPE_NUMBER, DB_TYPE_TIMESTAMP, DB_TYPE_TIMESTAMP_TZ and DB_TYPE_TIMESTAMP_LTZ columns. */ + precision?: number; + /** set only for DB_TYPE_NUMBER columns. */ + scale: number; + /** indicates whether NULL values are permitted for this column. */ + nullable?: boolean; } export interface IResultSet { - /** Metadata information - just columns names for now. */ - metaData?: Array; /** - * Closes the ResultSet. - * @param {(err:any)=>void} callback Callback called on finish or when some error occurs + * Contains an array of objects with metadata about the query or REF CURSOR columns. + * Each column's name is always given. If the Oracledb extendedMetaData or execute() option extendedMetaData are true then additional information is included. + */ + metaData?: Array; + + /** + * Closes a ResultSet. Applications should always call this at the end of fetch or when no more rows are needed. + * @param {(err:any)=>void} callback Callback called on finish or when some error occurs. * @returns void - * @remarks After using a resultSet, it must be closed to free the resources used by the driver. + * @remarks Applications should always call this at the end of fetch or when no more rows are needed. */ close(callback: (err: any) => void): void; + /** - * Fetch one row from ResultSet. + * Closes a ResultSet. Applications should always call this at the end of fetch or when no more rows are needed. + * @returns A void Promise on finish or when some error occurs. + * @remarks Applications should always call this at the end of fetch or when no more rows are needed. + */ + close(): IPromise; + + /** + * This call fetches one row of the result set as an object or an array of column values, depending on the value of outFormat. + * At the end of fetching, the ResultSet should be freed by calling close(). * @param {(err:any,row:Array|Object)=>void} callback Callback called when the row is available or when some error occurs. * @returns void */ getRow(callback: (err: any, row: Array | Object) => void): void; + /** - * Fetch some rows from ResultSet. - * @param {number} rowCount Number of rows to be fetched. - * @param {(err:any,rows:Array>|Array)=>void} callback Callback called when the rows are available, or when some error occurs. - * @returns void - * @remarks When the number of rows passed to the callback is less than the rowCount, no more rows are available to be fetched. + * This call fetches one row of the result set as an object or an array of column values, depending on the value of outFormat. + * At the end of fetching, the ResultSet should be freed by calling close(). + * @returns Promise when the row is available or when some error occurs. */ - getRows(rowCount: number, callback: (err: any, rows: Array> | Array) => void): void; + getRow(): IPromise | Object>; + + /** + * This synchronous method converts a ResultSet into a stream. + * It can be used to make ResultSets from top-level queries or from REF CURSOR bind variables streamable. To make top-level queries streamable, the alternative connection.queryStream() method may be easier to use. + * @returns synchronous stream of result set. + */ + toQueryStream(): stream.Readable; } export interface IConnection { - /** Statement cache size in bytes (read-only)*/ - stmtCacheSize: number; - /** Client id (to be sent to database) (write-only)*/ - clientId: string; - /** Module (write-only) */ - module: string; - /** Action */ + /** + * The action attribute for end-to-end application tracing. + * This is a write-only property. Displaying a Connection object will show a value of null for this attribute. See End-to-end Tracing, Mid-tier Authentication, and Auditing. + */ action: string; - /** Oracle server version */ + /** + * The client identifier for end-to-end application tracing, use with mid-tier authentication, and with Virtual Private Databases. + * This is a write-only property. Displaying a Connection object will show a value of null for this attribute. See End-to-end Tracing, Mid-tier Authentication, and Auditing. + */ + clientId: string; + /** + * The module attribute for end-to-end application tracing. + * This is a write-only property. Displaying a Connection object will show a value of null for this attribute. See End-to-end Tracing, Mid-tier Authentication, and Auditing. + */ + module: string; + /** + * This readonly property gives a numeric representation of the Oracle database version. For version a.b.c.d.e, this property gives the number: (100000000 * a) + (1000000 * b) + (10000 * c) + (100 * d) + e + */ oracleServerVersion: number; + /** + * The number of statements to be cached in the statement cache of the connection. The default value is the stmtCacheSize property in effect in the Pool object when the connection is created in the pool. + */ + stmtCacheSize: number; /** - * Execute method on Connection class. - * @param {string} sql SQL Statement. - * @param {Object|Array} Binds Binds Object/Array - * @param {IExecuteOptions} options Options object - * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + * This call stops the currently running operation on the connection. + * If there is no operation in progress or the operation has completed by the time the break is issued, the break() is effectively a no-op. + * If the running asynchronous operation is interrupted, its callback will return an error. + * @param {(err: any) => void} callback Callback on break done. */ - execute(sql: string, - binds: Object | Array, - options: IExecuteOptions, - callback: (err: any, value: IExecuteReturn) => void): void; + break(callback: (err: any) => void): void; /** - * Execute method on Connection class. - * @param {string} sql SQL Statement. - * @param {Object|Array} Binds Binds Object/Array - * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + * This call stops the currently running operation on the connection. + * If there is no operation in progress or the operation has completed by the time the break is issued, the break() is effectively a no-op. + * If the running asynchronous operation is interrupted, its callback will return an error. + * @returns A void promise when break is done. */ - execute(sql: string, - binds: Object | Array, - callback: (err: any, value: IExecuteReturn) => void): void; + break(): IPromise; /** - * Execute method on Connection class. - * @param {string} sql SQL Statement. - * @param {IExecuteOptions} options Options object - * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + * Releases a connection. If the connection was obtained from the pool, the connection is returned to the pool and is available for reuse. + * Note: calling close() when connections are no longer required is strongly encouraged. Releasing helps avoid resource leakage and can improve system efficiency. + * When a connection is released, any ongoing transaction on the connection is rolled back. + * After releasing a connection to a pool, there is no guarantee a subsequent getConnection() call gets back the same database connection. The application must redo any ALTER SESSION statements on the new connection object, as required. + * @param {(err: any) => void} callback Callback on close done. */ - execute(sql: string, - options: IExecuteOptions, - callback: (err: any, value: IExecuteReturn) => void): void; + close(callback: (err: any) => void): void; /** - * Execute method on Connection class. - * @param {string} sql SQL Statement. - * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + * Releases a connection. If the connection was obtained from the pool, the connection is returned to the pool and is available for reuse. + * Note: calling close() when connections are no longer required is strongly encouraged. Releasing helps avoid resource leakage and can improve system efficiency. + * When a connection is released, any ongoing transaction on the connection is rolled back. + * After releasing a connection to a pool, there is no guarantee a subsequent getConnection() call gets back the same database connection. The application must redo any ALTER SESSION statements on the new connection object, as required. + * @returns A void Promise on close done. */ - execute(sql: string, - callback: (err: any, value: IExecuteReturn) => void): void; - - /** - * Release method on Connection class. - * @param {(err: any) => void} callback Callback function to be called when the connection has been released. - */ - release(callback: (err: any) => void): void; + close(): IPromise; /** * Send a commit requisition to the database. @@ -193,6 +280,99 @@ declare module 'oracledb' { */ commit(callback: (err: any) => void): void; + /** + * Send a commit requisition to the database. + * @returns A void Promise on commit done. + */ + commit(): IPromise; + + /** + * This call executes a SQL or PL/SQL statement. See SQL Execution for examples. + * The statement to be executed may contain IN binds, OUT or IN OUT bind values or variables, which are bound using either an object or an array. + * A callback function returns a result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements. + * @param {string} sql SQL Statement. + * @param {Object|Array} bindParams Binds Object/Array + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + bindParams: Object | Array, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * This call executes a SQL or PL/SQL statement. See SQL Execution for examples. + * The statement to be executed may contain IN binds, OUT or IN OUT bind values or variables, which are bound using either an object or an array. + * A callback function returns a result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements. + * @param {string} sql SQL Statement. + * @param {Object|Array} bindParams Binds Object/Array + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + bindParams: Object | Array, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * This call executes a SQL or PL/SQL statement. See SQL Execution for examples. + * The statement to be executed may contain IN binds, OUT or IN OUT bind values or variables, which are bound using either an object or an array. + * A callback function returns a result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements. + * @param {string} sql SQL Statement. + * @param {IExecuteOptions} options Options object + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + options: IExecuteOptions, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * This call executes a SQL or PL/SQL statement. See SQL Execution for examples. + * The statement to be executed may contain IN binds, OUT or IN OUT bind values or variables, which are bound using either an object or an array. + * A callback function returns a result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements. + * @param {string} sql SQL Statement. + * @param {(err: any, value: IExecuteReturn) => void} callback Callback function to receive the result. + */ + execute(sql: string, + callback: (err: any, value: IExecuteReturn) => void): void; + + /** + * This call executes a SQL or PL/SQL statement. See SQL Execution for examples. + * The statement to be executed may contain IN binds, OUT or IN OUT bind values or variables, which are bound using either an object or an array. + * @param {string} sql SQL Statement. + * @param {Object|Array} bindParams Binds Object/Array + * @param {IExecuteOptions} options Options object + * @returns A Promise of a result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements. + */ + execute(sql: string, + bindParams?: Object | Array, + options?: IExecuteOptions): IPromise; + + /** + * This function provides query streaming support. The parameters are the same as execute() except a callback is not used. Instead this function returns a stream used to fetch data. + * Each row is returned as a data event. Query metadata is available via a metadata event. The end event indicates the end of the query results. + * Query results must be fetched to completion to avoid resource leaks. + * The connection must remain open until the stream is completely read. + * For tuning purposes the oracledb.maxRows property can be used to size an internal buffer used by queryStream(). Note it does not limit the number of rows returned by the stream. The oracledb.prefetchRows value will also affect performance. + * @param {string} sql SQL Statement. + * @param {Object|Array} bindParams Binds Object/Array + * @param {IExecuteOptions} options Options object + * @returns Readable Stream for queries. + */ + queryStream(sql: string, + bindParams?: Object | Array, + options?: IExecuteOptions): stream.Readable; + + /** + * An alias for Connection.close(). + * @param {(err: any) => void} callback Callback on close done. + */ + release(callback: (err: any) => void): void; + + /** + * An alias for Connection.close(). + * @returns A void Promise on close done. + */ + release(): IPromise; + /** * Send a rollback requisition to database. * @param {(err: any) => void} callback Callback on rollback done. @@ -200,34 +380,94 @@ declare module 'oracledb' { rollback(callback: (err: any) => void): void; /** - * Send a break to the database. - * @param {(err: any) => void} callback Callback on break done. + * Send a rollback requisition to database. + * @returns A void Promise on rollback done. */ - break(callback: (err: any) => void): void; + rollback(): IPromise } export interface IConnectionPool { - poolMax: number; - poolMin: number; - poolIncrement: number; - poolTimeout: number; - connectionsOpen: number; + /** + * The number of currently active connections in the connection pool i.e. the number of connections currently checked-out using getConnection(). + */ connectionsInUse: number; + /** + * The number of currently open connections in the underlying connection pool. + */ + connectionsOpen: number; + /** + * The number of connections that are opened whenever a connection request exceeds the number of currently open connections. + */ + poolIncrement: number; + /** + * The maximum number of connections that can be open in the connection pool. + */ + poolMax: number; + /** + * The minimum number of connections a connection pool maintains, even when there is no activity to the target database. + */ + poolMin: number; + /** + * The time (in seconds) after which the pool terminates idle connections (unused in the pool). The number of connections does not drop below poolMin. + */ + poolTimeout: number; + /** + * Determines whether requests for connections from the pool are queued when the number of connections "checked out" from the pool has reached the maximum number specified by poolMax. + */ + queueRequests: number; + /** + * The time (in milliseconds) that a connection request should wait in the queue before the request is terminated. + */ + queueTimeout: number; + /** + * The number of statements to be cached in the statement cache of each connection. + */ stmtCacheSize: number; + /** * Finalizes the connection pool. * @param {(err:any)=>void} callback Callback called when the pool is terminated or when some error occurs * @returns void */ - terminate(callback: (err: any) => void): void; + close(callback: (err: any) => void): void; + /** - * Retrieve a connection from the pool. + * Finalizes the connection pool. + * @returns Promise to when the close finishes. + */ + close(): IPromise; + + /** + * This method obtains a connection from the connection pool. + * If a previously opened connection is available in the pool, that connection is returned. If all connections in the pool are in use, a new connection is created and returned to the caller, as long as the number of connections does not exceed the specified maximum for the pool. If the pool is at its maximum limit, the getConnection() call results in an error, such as ORA-24418: Cannot open further sessions. * @param {(err:any,connection:IConnection)=>void} callback Callback called when the connection is available or when some error occurs. * @returns void * @see {@link https://jsao.io/2015/03/making-a-wrapper-module-for-the-node-js-driver-for-oracle-database/} * @see {@link https://github.com/OraOpenSource/orawrap} */ getConnection(callback: (err: any, connection: IConnection) => void): void; + + /** + * This method obtains a connection from the connection pool. + * If a previously opened connection is available in the pool, that connection is returned. If all connections in the pool are in use, a new connection is created and returned to the caller, as long as the number of connections does not exceed the specified maximum for the pool. If the pool is at its maximum limit, the getConnection() call results in an error, such as ORA-24418: Cannot open further sessions. + * @returns An IConnection Promise to when the connection is available or when some error occurs. + * @see {@link https://jsao.io/2015/03/making-a-wrapper-module-for-the-node-js-driver-for-oracle-database/} + * @see {@link https://github.com/OraOpenSource/orawrap} + */ + getConnection(): IPromise; + + /** + * An alias for IConnectionPool.close(). + * @param {(err:any)=>void} callback Callback called when the pool is terminated or when some error occurs + * @returns void + */ + terminate(callback: (err: any) => void): void; + + /** + * An alias for IConnectionPool.close(). + * @returns Promise to when the close finishes. + */ + terminate(): IPromise; } export const DEFAULT: number; @@ -261,13 +501,62 @@ declare module 'oracledb' { */ export function newLob(iLob: ILob): Lob; + /** Default transaction behaviour of auto commit for each statement. */ + export var autoCommit: boolean; /** - * Creates a connection with the database. - * @param {IConnectionAttributes} connectionAttributes Parameters to stablish the connection. - * @param {(err:any,connection:IConnection)=>void} callback Callback to run when the connection gets stablished or when some error occurs. - * @returns void + * The user-chosen Connection class value defines a logical name for connections. Most single purpose applications should set connectionClass when using a connection pool or DRCP. + * When a pooled session has a connection class, Oracle ensures that the session is not shared outside of that connection class. */ - export function getConnection(connectionAttributes: IConnectionAttributes, callback: (err: any, connection: IConnection) => void): void; + export var connectionClass: string; + /** + * Determines whether additional metadata is available for queries and for REF CURSORs returned from PL/SQL blocks. + * The default value for extendedMetaData is false. With this value, the result.metaData result.resultSet.metaData objects only include column names. + */ + export var extendedMetaData: boolean; + /** Default authentication/authorization method. When true, the SO trusted user will be used. */ + export var externalAuth: boolean; + /** + * An array of node-oracledb types. When any column having the specified type is queried with execute(), the column data is returned as a string instead of the native representation. For column types not specified in fetchAsString, native types will be returned. + * By default all columns are returned as native types. + */ + export var fetchAsString: Array; + /** Default size in bytes that the driver will fetch from LOBs in advance. */ + export var lobPrefetchSize: number; + /** Default maximum number of rows to be fetched in statements not using ResultSets */ + export var maxRows: number; + /** Version of OCI that is used. */ + export var oracleClientVersion: number; + /** Default format for returning rows. When ARRAY, it will return Array>. When OBJECT, it will return Array. */ + export var outFormat: number; + /** Default number of connections to increment when available connections reach 0 in created pools. poolMax will be respected.*/ + export var poolIncrement: number; + /** Default maximum connections in created pools */ + export var poolMax: number; + /** Default minimum connections in created pools */ + export var poolMin: number; + /** Default timeout for unused connections in pool to be released. poolMin will be respected.*/ + export var poolTimeout: number; + /** Default number of rows that the driver will fetch in each query.*/ + export var prefetchRows: number; + /** + * Node-oracledb supports Promises on all methods. The standard Promise library is used in Node 0.12 and greater. Promise support is not enabled by default in Node 0.10. + */ + export var Promise: any; + /** + * If this property is true and the number of connections "checked out" from the pool has reached the number specified by poolMax, then new requests for connections are queued until in-use connections are released. + * If this property is false and a request for a connection is made from a pool where the number of "checked out" connections has reached poolMax, then an ORA-24418 error indicating that further sessions cannot be opened will be returned. + * The default value is true. + */ + export var queueRequests: boolean; + /** + * The number of milliseconds after which connection requests waiting in the connection request queue are terminated. If queueTimeout is 0, then queued connection requests are never terminated. + * The default value is 60000. + */ + export var queueTimeout: number; + /** Default size of statements cache. Used to speed up creating queries.*/ + export var stmtCacheSize: number; + /** node-oracledb driver version. */ + export var version: number; /** * Creates a database managed connection pool. @@ -277,32 +566,25 @@ declare module 'oracledb' { */ export function createPool(poolAttributes: IPoolAttributes, callback: (err: any, connection: IConnectionPool) => void): void; - /** Default maximum connections in created pools */ - export var poolMax: number; - /** Default minimum connections in created pools */ - export var poolMin: number; - /** Default number of connections to increment when available connections reach 0 in created pools. poolMax will be respected.*/ - export var poolIncrement: number; - /** Default timeout for unused connections in pool to be released. poolMin will be respected.*/ - export var poolTimeout: number; - /** Default size of statements cache. Used to speed up creating queries.*/ - export var stmtCacheSize: number; - /** Default number of rows that the driver will fetch in each query.*/ - export var prefetchRows: number; - /** Default transaction behaviour of auto commit for each statement. */ - export var autoCommit: boolean; - /** Default maximum number of rows to be fetched in statements not using ResultSets */ - export var maxRows: number; - /** Default format for returning rows. When ARRAY, it will return Array>. When OBJECT, it will return Array. */ - export var outFormat: number; - /** node-oracledb driver version. */ - export var version: number; - export var connectionClass: string; - /** Default authentication/authorization method. When true, the SO trusted user will be used. */ - export var externalAuth: boolean; - export var fetchAsString: any; - /** Default size in bytes that the driver will fetch from LOBs in advance. */ - export var lobPrefetchSize: number; - /** Version of OCI that is used. */ - export var oracleClientVersion: number; + /** + * Creates a database managed connection pool. + * @param {IPoolAttributes} poolAttributes Parameters to stablish the connection pool. + * @returns Promise {(connection:IConnectionPool)=>any} Promise with the connection pool. + */ + export function createPool(poolAttributes: IPoolAttributes): IPromise< IConnectionPool >; + + /** + * Creates a connection with the database. + * @param {IConnectionAttributes} connectionAttributes Parameters to stablish the connection. + * @param {(err:any,connection:IConnection)=>void} callback Callback to run when the connection gets stablished or when some error occurs. + * @returns void + */ + export function getConnection(connectionAttributes: IConnectionAttributes, callback: (err: any, connection: IConnection) => void): void; + + /** + * Creates a connection with the database. + * @param {IConnectionAttributes} connectionAttributes Parameters to stablish the connection. + * @returns {(connection:IConnection)=>any} Promise with the connection. + */ + export function getConnection(connectionAttributes: IConnectionAttributes): IPromise< IConnection >; } From 58b0deb938caada8ac8f6d9751df5f777f6a4149 Mon Sep 17 00:00:00 2001 From: Stephen Penney Date: Thu, 28 Jul 2016 15:43:23 +0100 Subject: [PATCH 11/79] Update select2 to have selectOnClose option (#10326) Option documented at https://select2.github.io/options.html#can-i-select-the-highlighted-result-when-the-dropdown-is-closed --- select2/select2.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/select2/select2.d.ts b/select2/select2.d.ts index 908fa7a6ae..c1d119df1e 100644 --- a/select2/select2.d.ts +++ b/select2/select2.d.ts @@ -79,6 +79,7 @@ interface Select2Options { templateSelection?: (object: Select2SelectionObject) => any; templateResult?: (object: Select2SelectionObject) => any; language?: string | string[] | {}; + selectOnClose?: boolean; } interface Select2JQueryEventObject extends JQueryEventObject { From 8fc71dfcc7218ad8fb98508d26635e73dec6d627 Mon Sep 17 00:00:00 2001 From: dmitryrogozhny Date: Thu, 28 Jul 2016 17:43:59 +0300 Subject: [PATCH 12/79] Added definition for react-file-input React component (#10325) * Added definition for react-file-input React component * Added newline at end of file --- react-file-input/react-file-input-tests.tsx | 27 +++++++++++++++++++++ react-file-input/react-file-input.d.ts | 24 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 react-file-input/react-file-input-tests.tsx create mode 100644 react-file-input/react-file-input.d.ts diff --git a/react-file-input/react-file-input-tests.tsx b/react-file-input/react-file-input-tests.tsx new file mode 100644 index 0000000000..208a8d29ed --- /dev/null +++ b/react-file-input/react-file-input-tests.tsx @@ -0,0 +1,27 @@ +/// +/// + +import * as React from "react"; +import FileInput = require('react-file-input'); + +class Form extends React.Component<{}, {}> { + handleChange = (event: React.SyntheticEvent) => { + const target: any = event.target; + console.log('Selected file:', target.files[0]); + } + + render(): React.ReactElement<{}> { + return ( +
+ + + ); + } +} diff --git a/react-file-input/react-file-input.d.ts b/react-file-input/react-file-input.d.ts new file mode 100644 index 0000000000..ca0cac594b --- /dev/null +++ b/react-file-input/react-file-input.d.ts @@ -0,0 +1,24 @@ +// Type definitions for react-file-input +// Project: https://www.npmjs.com/package/react-file-input +// Definitions by: Dmitry Rogozhny +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-file-input" { + import React = __React; + + interface FileInputProps { + name: string; + className: string; + accept: string; + placeholder: string; + disabled?: boolean; + onChange: (event: React.SyntheticEvent) => void; + } + + class FileInput extends React.Component { + } + + export = FileInput; +} From 48f8c2fbb030beb474234e77d3e9dc44eb1dee19 Mon Sep 17 00:00:00 2001 From: dmitryrogozhny Date: Thu, 28 Jul 2016 17:52:36 +0300 Subject: [PATCH 13/79] Added definitions for the react-file-reader-input react component. (#10327) --- .../react-file-reader-input-tests.tsx | 25 +++++++++++++++++++ .../react-file-reader-input.d.ts | 20 +++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 react-file-reader-input/react-file-reader-input-tests.tsx create mode 100644 react-file-reader-input/react-file-reader-input.d.ts diff --git a/react-file-reader-input/react-file-reader-input-tests.tsx b/react-file-reader-input/react-file-reader-input-tests.tsx new file mode 100644 index 0000000000..0f8b70a35a --- /dev/null +++ b/react-file-reader-input/react-file-reader-input-tests.tsx @@ -0,0 +1,25 @@ +/// +/// + +import * as React from "react"; +import FileReaderInput = require("react-file-reader-input"); + +class MyComponent extends React.Component<{}, {}> { + handleChange = (event: React.SyntheticEvent, results: any) => { + results.forEach((result: any) => { + const [event, file] = result; + console.log(`Selected file ${file.name}!`); + }); + } + + render(): React.ReactElement<{}> { + return ( +
+ + + + +
+ ); + } +} diff --git a/react-file-reader-input/react-file-reader-input.d.ts b/react-file-reader-input/react-file-reader-input.d.ts new file mode 100644 index 0000000000..094e690aa1 --- /dev/null +++ b/react-file-reader-input/react-file-reader-input.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-file-reader-input +// Project: https://www.npmjs.com/package/react-file-reader-input +// Definitions by: Dmitry Rogozhny +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-file-reader-input" { + import React = __React; + + interface FileInputProps { + as?: string; + onChange?: (event: React.SyntheticEvent, results: any) => void; + } + + class FileInput extends React.Component { + } + + export = FileInput; +} From f305105c139273a1d79048dcfce618ab75172cc7 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Fri, 29 Jul 2016 00:23:13 +0900 Subject: [PATCH 14/79] Sleep (#10333) --- sleep/sleep-tests.ts | 6 ++++++ sleep/sleep.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 sleep/sleep-tests.ts create mode 100644 sleep/sleep.d.ts diff --git a/sleep/sleep-tests.ts b/sleep/sleep-tests.ts new file mode 100644 index 0000000000..2d2c05c2ff --- /dev/null +++ b/sleep/sleep-tests.ts @@ -0,0 +1,6 @@ +/// + +import sleep = require("sleep"); + +sleep.sleep(1); +sleep.usleep(5000); \ No newline at end of file diff --git a/sleep/sleep.d.ts b/sleep/sleep.d.ts new file mode 100644 index 0000000000..5173e4b4ef --- /dev/null +++ b/sleep/sleep.d.ts @@ -0,0 +1,26 @@ +// Type definitions for node-scanf +// Project: https://github.com/ErikDubbelboer/node-sleep +// Definitions by: Jeongho Nam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace __node_sleep +{ + /** + * Sleep for n seconds. + * + * @param n Number of seconds to sleep. + */ + function sleep(n: number): void; + + /** + * Sleep for n microseconds. + * + * @param n Number of microseconds to sleep; 1 second is 1,000,000 microseconds. + */ + function usleep(n: number): void; +} + +declare module "sleep" +{ + export = __node_sleep; +} \ No newline at end of file From bf140ce89a657bc18596cc909c991e3688481c28 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Thu, 28 Jul 2016 17:24:22 +0200 Subject: [PATCH 15/79] Add Electron specific versions to process.versions (#10320) --- github-electron/github-electron-main-tests.ts | 2 ++ github-electron/github-electron.d.ts | 12 ++++++++++ node/node.d.ts | 22 ++++++++++--------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 9f79e6590f..0b928138e4 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -766,6 +766,8 @@ let image2 = nativeImage.createFromPath('/Users/somebody/images/icon.png'); // process // https://github.com/electron/electron/blob/master/docs/api/process.md +console.log(process.versions.electron); +console.log(process.versions.chrome); console.log(process.type); console.log(process.resourcesPath); console.log(process.mas); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 217e230d9c..0cd51c1601 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -5107,6 +5107,18 @@ interface File { // https://github.com/electron/electron/blob/master/docs/api/process.md declare namespace NodeJS { + + interface ProcessVersions { + /** + * Electron's version string. + */ + electron: string; + /** + * Chrome's version string. + */ + chrome: string; + } + interface Process { /** * Setting this to true can disable the support for asar archives in Node's built-in modules. diff --git a/node/node.d.ts b/node/node.d.ts index bad534cdd7..359f1679c5 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -301,6 +301,17 @@ declare namespace NodeJS { heapUsed: number; } + export interface ProcessVersions { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + modules: string; + openssl: string; + } + export interface Process extends EventEmitter { stdout: WritableStream; stderr: WritableStream; @@ -320,16 +331,7 @@ declare namespace NodeJS { setuid(id: number): void; setuid(id: string): void; version: string; - versions: { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - }; + versions: ProcessVersions; config: { target_defaults: { cflags: any[]; From 85ea13a9863bbe73e9f3c5d0313de822bfd1cc87 Mon Sep 17 00:00:00 2001 From: Eugene Oskin Date: Thu, 28 Jul 2016 21:26:00 +0600 Subject: [PATCH 16/79] Fix uuid.js definitions. (#10318) --- uuid/UUID-tests.ts | 4 ---- uuid/UUID.d.ts | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/uuid/UUID-tests.ts b/uuid/UUID-tests.ts index ce40ddee15..990354525c 100644 --- a/uuid/UUID-tests.ts +++ b/uuid/UUID-tests.ts @@ -1,9 +1,5 @@ /// - -import UUID = require("UUID"); - - const uuid1: string = UUID.generate() const uuid2: UUID.UUID = UUID.genV4() const uuid3: UUID.UUID = UUID.genV1() diff --git a/uuid/UUID.d.ts b/uuid/UUID.d.ts index 164cf503c8..4526506120 100644 --- a/uuid/UUID.d.ts +++ b/uuid/UUID.d.ts @@ -3,7 +3,7 @@ // Definitions by: Jason Jarrett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "UUID" { +declare module UUID { interface UUID { intFields: UUIDArray; From ea0b9196a6a66463de5ad3f6562195431d1a1780 Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Thu, 28 Jul 2016 17:26:20 +0200 Subject: [PATCH 17/79] protobufjs: updated Message interfaces (#10198) * protobufjs: updated Message interfaces * Added ProtoBuf.Util interface * Fixed load functions of ProtoBuf namespace Base on the protobuf.js API docmentation. * use {} instead of Object Fixed according to PR commit note. --- protobufjs/protobufjs-tests.ts | 5 ++- protobufjs/protobufjs.d.ts | 71 +++++++++++++++++++++++++--------- 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/protobufjs/protobufjs-tests.ts b/protobufjs/protobufjs-tests.ts index 94afba0a8e..fd29685f15 100644 --- a/protobufjs/protobufjs-tests.ts +++ b/protobufjs/protobufjs-tests.ts @@ -44,7 +44,7 @@ function testProtoBufJs() { assertIsNamespace(protoFile.ns, "protoFile.ns"); assertIsNamespace(protoFile.ptr, "protoFile.ptr"); - assertIsProtoBuf(protoFile.build(), "protoFile.build()"); + assertIsMetaMessage(protoFile.build(), "protoFile.build()"); assertIsProtoBuf(protoFile.result, "protoFile.result"); assertIsProtoBuilder(protoFile.create(), "protoFile.create()"); @@ -117,11 +117,12 @@ function assertIsProtoBuf(pb: ProtoBuf.ProtoBuf, name: string) { } } -function assertIsMetaMessage(mm: ProtoBuf.MetaMessage, name: string) { +function assertIsMetaMessage(mm: ProtoBuf.MetaMessage, name: string) { assert.ok("decode" in mm, name + " should contain property decode"); assert.ok("decodeDelimited" in mm, name + " should contain property decodeDelimited"); assert.ok("decode64" in mm, name + " should contain property decode64"); assert.ok("decodeHex" in mm, name + " should contain property decodeHex"); + assert.ok("decodeJSON" in mm, name + " should contain property decodeJSON"); } function assertIsDotProto(dp: ProtoBuf.DotProto, name: string) { diff --git a/protobufjs/protobufjs.d.ts b/protobufjs/protobufjs.d.ts index 77d457fbbf..fac34be103 100644 --- a/protobufjs/protobufjs.d.ts +++ b/protobufjs/protobufjs.d.ts @@ -1,8 +1,9 @@ -// Type definitions for ProtoBuf.js +// Type definitions for ProtoBuf.js 5.0.1 // Project: https://github.com/dcodeIO/ProtoBuf.js // Definitions by: Panu Horsmalahti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// /// declare namespace ProtoBuf { @@ -10,25 +11,24 @@ declare namespace ProtoBuf { // protobufjs/src/ProtoBuf.js var Builder: Builder; - var ByteBuffer: Buffer; var Long: LongStatic; var DotProto: DotProto; var Reflect: Reflect; + var Util: Util; // var Lang: Lang; TODO: implement interface Lang - // var Util: Util; TODO: implement interface Util - export function loadJson(json: string, builder?: ProtoBuilder, - filename?: string): ProtoBuilder; + export function loadJson(json: string, builder?: ProtoBuilder | string | {}, + filename?: string | {}): ProtoBuilder; - export function loadJsonFile(filename: string, + export function loadJsonFile(filename: string | {}, callback?: (error: any, builder: ProtoBuilder) => void, builder?: ProtoBuilder): ProtoBuilder; - export function loadProto(proto: string, builder?: ProtoBuilder, - filename?: string): ProtoBuilder; + export function loadProto(proto: string, builder?: ProtoBuilder | string | {}, + filename?: string | {}): ProtoBuilder; - export function loadProtoFile(filePath: string, + export function loadProtoFile(filePath: string | {}, callback?: (error: any, builder: ProtoBuilder) => void, builder?: ProtoBuilder): ProtoBuilder; @@ -117,6 +117,26 @@ declare namespace ProtoBuf { */ export interface Message { new(values?: {[key: string]: any}, var_args?: string[]): Message; + $add(key: string, value: any, noAssert?: boolean): Message; + $get(key: string): T; + $set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void; + add(key: string, value: any, noAssert?: boolean): Message; + calculate(): number; + encode(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer; + encode64(): string; + encodeAB(): ArrayBuffer; + encodeNB(): Buffer; + encodeHex(): string; + encodeJSON(): string; + encodeDelimited(buffer?: ByteBuffer | boolean, noVerify?: boolean): ByteBuffer; + get(key: string, noAssert?: boolean): T; + set(key: string | {[key: string]: any}, value?: any | boolean, noAssert?: boolean): void; + toArrayBuffer(): ArrayBuffer; + toBase64(): string; + toBuffer(): Buffer; + toHex(): string; + toRaw(binaryAsBase64?: boolean, longsAsStrings?: boolean): {[key: string]: any}; + toString(): string; [field: string]: any; } @@ -144,20 +164,22 @@ declare namespace ProtoBuf { define(pkg: string, options?: {[key: string]: any}): ProtoBuilder; create(defs?: {[key: string]: any}[]): ProtoBuilder; resolveAll(): void; - build(path?: string): ProtoBuf; + build(path?: string | [string]): MetaMessage; + build(path?: string | [string]): MetaMessage; lookup(path?: string): ReflectT; } export interface ProtoBuf { - [package: string]: {[key: string]: MetaMessage | any}; + [package: string]: {[key: string]: MetaMessage | any}; } - export interface MetaMessage { - new(values?: {[key: string]: any}, var_args?: string[]): Message; - decode(buffer?: Buffer, enc?: string): Message; - decodeDelimited(buffer?: Buffer, enc?: string): Message; - decode64(str: string): Message; - decodeHex(str: string): Message; + export interface MetaMessage { + new(values?: {[key: string]: any}, var_args?: string[]): T & Message; + decode(buffer: ArrayBuffer | ByteBuffer | Buffer | string, length?: number | string, enc?: string): T & Message; + decodeDelimited(buffer: ByteBuffer | ArrayBuffer | Buffer | string, enc?: string): T & Message; + decode64(str: string): T & Message; + decodeHex(str: string): T & Message; + decodeJSON(str: string): T & Message; } // ========== @@ -242,6 +264,16 @@ declare namespace ProtoBuf { options: {[key: string]: any}; } + // ========== + // protobufjs/src/ProtoBuf/Util.js + + export interface Util { + IS_NODE: boolean + fetch(path: string, callback?: (data: string) => any): string; + toCamelCase(str: string): string; + XHR(): XMLHttpRequest; + } + // ========== // protobufjs/src/ProtoBuf/Reflect.js @@ -288,9 +320,10 @@ declare namespace ProtoBuf { // new ProtoBuf.Reflect.Message.ExtensionField(); OneOf: ReflectOneOf; // NOTE: only for new ProtoBuf.Reflect.Message.OneOf(); extensions: number[]; - clazz(): MetaMessage; + clazz(): MetaMessage; isGroup: boolean; - build(rebuild?: boolean): MetaMessage|any; + build(rebuild?: boolean): MetaMessage|any; + build(rebuild?: boolean): MetaMessage|any; encode(message: Message, buffer: Buffer, noVerify?: boolean): Buffer; calculate(message: Message): number; decode(buffer: Buffer, length?: number, expectedGroupEndId?: number): Message; From 94fa3e9080c04024524307d8d1858b274176b470 Mon Sep 17 00:00:00 2001 From: Bruno Grieder Date: Thu, 28 Jul 2016 17:26:43 +0200 Subject: [PATCH 18/79] Multiple minor fixes (#10339) * better typing of onShouldStartLoadWithRequest in WebViewPropertiesIOS * Fixes to WebViewProperties * Missing methods in Navigator * Fix of Platform.select() * added support for interfacing with native-modules * added support for interfacing with native-modules * added dev variable * Update to header notes * Examples: alternative styles declaration --- react-native/react-native-tests.tsx | 26 +++++++++- react-native/react-native.d.ts | 77 ++++++++++++++++++++++++++--- 2 files changed, 94 insertions(+), 9 deletions(-) diff --git a/react-native/react-native-tests.tsx b/react-native/react-native-tests.tsx index d33918dbd6..c9d6ec779a 100644 --- a/react-native/react-native-tests.tsx +++ b/react-native/react-native-tests.tsx @@ -78,14 +78,36 @@ var styles = StyleSheet.create( } ) +//alternative declaration of styles (inline typings) +const stylesAlt = StyleSheet.create( + { + container: { + flex: 1, + justifyContent: 'center', + alignItems: 'center', + backgroundColor: '#F5FCFF', + } as React.ViewStyle, + welcome: { + fontSize: 20, + textAlign: 'center', + margin: 10, + } as React.TextStyle, + instructions: { + textAlign: 'center', + color: '#333333', + marginBottom: 5, + } as React.TextStyle + } +) + class Welcome extends React.Component { - + refs: { [key: string]: any rootView: View } - + testNativeMethods() { // this.setNativeProps({}); diff --git a/react-native/react-native.d.ts b/react-native/react-native.d.ts index ff08bd0ff1..cc71452ae4 100644 --- a/react-native/react-native.d.ts +++ b/react-native/react-native.d.ts @@ -8,9 +8,9 @@ // USING: these definitions are meant to be used with the TSC compiler target set to ES6 // // USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer +// Warning: the project currently uses and older version of react-native // -// CONTRIBUTING: please open pull requests and make sure that the changes do not break RNTSExplorer (they should not) -// Do not hesitate to open a pull request against RNTSExplorer to provide an example for a case not covered by the current App +// CONTRIBUTING: please open pull requests // // CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie // @@ -1339,6 +1339,17 @@ declare namespace __React { domStorageEnabled?: boolean } + export interface WebViewIOSLoadRequestEvent { + target: number + canGoBack: boolean + lockIdentifier: number + loading: boolean + title: string + canGoForward: boolean + navigationType: 'other' | 'click' + url: string + } + export interface WebViewPropertiesIOS { /** @@ -1368,7 +1379,7 @@ declare namespace __React { * Return true or false from this method to continue loading the * request. */ - onShouldStartLoadWithRequest?: () => boolean + onShouldStartLoadWithRequest?: (event: WebViewIOSLoadRequestEvent) => boolean scrollEnabled?: boolean } @@ -1463,12 +1474,12 @@ declare namespace __React { /** * view to show if there's an error */ - renderError?: () => ViewStatic + renderError?: () => React.ReactElement /** * loading indicator to show */ - renderLoading?: () => ViewStatic + renderLoading?: () => React.ReactElement scrollEnabled?: boolean @@ -3313,6 +3324,16 @@ declare namespace __React { */ popToTop(): void; + /** + * Replace the previous scene and pop to it. + */ + replacePreviousAndPop( route: Route ): void; + + /** + * Navigate to a new scene and reset route stack. + */ + resetTo( route: Route ): void; + } namespace NavigatorStatic { @@ -3720,8 +3741,10 @@ declare namespace __React { export interface PlatformStatic { OS: PlatformOSType, - // only documented in PlatformSpecificInformation.md - select({PlatformOSType: any}): any + /** + * @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content + */ + select( specifics: { ios?: T, android?: T} ): T; } export interface DeviceEventSubscriptionStatic { @@ -5721,6 +5744,27 @@ declare namespace __React { handleNavigation( action: NavigationAction ): boolean; } + // + // Interfacing with Native Modules + // https://facebook.github.io/react-native/docs/native-modules-ios.html + // + + export interface NativeEventSubscription { + /** + * Call this method to un-subscribe from a native-event + */ + remove(): void; + } + + /** + * Receive events from native-code + * @see https://facebook.github.io/react-native/docs/native-modules-ios.html#sending-events-to-javascript + */ + export interface NativeAppEventEmitterStatic { + addListener(event: string, handler: (data: any) => void): NativeEventSubscription; + } + + ////////////////////////////////////////////////////////////////////////// // // R E - E X P O R T S @@ -5923,6 +5967,16 @@ declare namespace __React { export type Easing = EasingStatic; export var Easing: EasingStatic; + //Native Modules written in ObjectiveC/Swift/Java exposed via the RCTBridge + //See https://facebook.github.io/react-native/docs/native-modules-ios.html + + /** + * Use: + * const MyModule = NativeModules.ModuleName + */ + export var NativeModules: any + export var NativeAppEventEmitter: NativeAppEventEmitterStatic + // // /TODO: BGR: These are leftovers of the initial port that must be revisited // @@ -5986,3 +6040,12 @@ declare module "react-native" { declare var global: __React.GlobalStatic declare function require( name: string ): any + +/** + * This variable is set to true when react-native is running in Dev mode + * Typical usage: + * if (__DEV__) console.log('Running in dev mode') + */ +declare var __DEV__: boolean + + From 2864d4666436b055aea2e46f53d5ee6bbabcba55 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Thu, 28 Jul 2016 11:31:34 -0400 Subject: [PATCH 19/79] webcomponents.js: Add typings for Element.createShadowRoot (#10330) * webcomponents.js: Add typings for Element.createShadowRoot createShadowRoot is deprecated in the official Shadow DOM spec, but is the way to attach a shadow root in the current released version of webcomponents.js. * webcomponents.js: remove spurious extra line * webcomponents.js: remove readonly modifier Not supported until TS2. * webcomponents.js: add Element.shadowRoot property --- webcomponents.js/webcomponents.js-tests.ts | 9 +++++++++ webcomponents.js/webcomponents.js.d.ts | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/webcomponents.js/webcomponents.js-tests.ts b/webcomponents.js/webcomponents.js-tests.ts index b5e67abb93..cb1ea0f2c4 100644 --- a/webcomponents.js/webcomponents.js-tests.ts +++ b/webcomponents.js/webcomponents.js-tests.ts @@ -36,6 +36,15 @@ window.HTMLImports.whenReady(() => { document.querySelectorAll(`link[type=${window.HTMLImports.IMPORT_LINK_TYPE}`); +/* + * Shadow DOM + */ + +var shadow = xFoo.createShadowRoot(); +xFoo.shadowRoot; +shadow.innerHTML; +shadow.host; + /* * Web Components */ diff --git a/webcomponents.js/webcomponents.js.d.ts b/webcomponents.js/webcomponents.js.d.ts index 7390cc5bc8..2f4ea424e4 100644 --- a/webcomponents.js/webcomponents.js.d.ts +++ b/webcomponents.js/webcomponents.js.d.ts @@ -31,6 +31,11 @@ declare namespace webcomponents { whenReady(callback: () => void): void; } + export interface ShadowRootPolyfill extends DocumentFragment { + innerHTML: string; + host: Element; + } + export interface Polyfill { flags: any; } @@ -41,6 +46,11 @@ declare module "webcomponents.js" { export = webcomponents; } +interface Element { + createShadowRoot(): webcomponents.ShadowRootPolyfill; + shadowRoot?: webcomponents.ShadowRootPolyfill; +} + interface Document { registerElement(name: string, prototype: webcomponents.CustomElementInit): webcomponents.CustomElementConstructor; } From 9a2c12b7dfaf33ff91c50a2484d6bbeef361efb1 Mon Sep 17 00:00:00 2001 From: coni2k Date: Thu, 28 Jul 2016 19:43:37 +0300 Subject: [PATCH 20/79] Fix initializeAdapterInstance return type As mentioned in its comments section, initializeAdapterInstance function should actually return an instance of an adapter. Currently it returns void. . Adapter interface was defined, with getRoutePrefix function . initializeAdapterInstance return type was changed from "void" to "Adapter" --- breeze/breeze.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/breeze/breeze.d.ts b/breeze/breeze.d.ts index 3fc54dc5d4..6a168cd3ba 100644 --- a/breeze/breeze.d.ts +++ b/breeze/breeze.d.ts @@ -1043,6 +1043,10 @@ declare namespace breeze.config { @return {an instance of the specified adapter} **/ export function getAdapterInstance(interfaceName: string, adapterName?: string): Object; + + export interface Adapter { + getRoutePrefix: Function + } /** Initializes a single adapter implementation. Initialization means either newing a instance of the specified interface and then calling "initialize" on it or simply calling "initialize" on the instance @@ -1052,7 +1056,7 @@ declare namespace breeze.config { @param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface. @return {an instance of the specified adapter} **/ - export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): void; + export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Adapter; export interface AdapterInstancesConfig { /** the name of a previously registered "ajax" adapter */ From fec5296038f58bb601a4576859b645d5374c4dc5 Mon Sep 17 00:00:00 2001 From: Serkan Holat Date: Thu, 28 Jul 2016 20:06:22 +0300 Subject: [PATCH 21/79] Update breeze.d.ts --- breeze/breeze.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/breeze/breeze.d.ts b/breeze/breeze.d.ts index 6a168cd3ba..8cc109d746 100644 --- a/breeze/breeze.d.ts +++ b/breeze/breeze.d.ts @@ -12,6 +12,7 @@ // Updated Jan 20 2015 for Breeze 1.5.2 and merging changes from DefinitelyTyped // Updated Feb 28 2015 add any/all clause on Predicate // Updated Jun 27 2016 - Marcel Good (www.ideablade.com) +// Updated Jul 28 2016 - Serkan "coni2k" Holat declare namespace breeze.core { From 6303ed1e73be8bbc13d60d7ce700326c6774eb76 Mon Sep 17 00:00:00 2001 From: David Newell Date: Thu, 28 Jul 2016 17:32:58 -0400 Subject: [PATCH 22/79] Adding a couple missing highcharts properites (#10340) * Adding a couple missing highcharts properites * Fixing indentation * Indentation --- highcharts/highcharts-tests.ts | 1 + highcharts/highcharts.d.ts | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts index 499dfc9494..d8b74de31e 100644 --- a/highcharts/highcharts-tests.ts +++ b/highcharts/highcharts-tests.ts @@ -2258,6 +2258,7 @@ function test_PointObject() { var point = $('#container').highcharts().get('point1'); var category = point.category; var percentage = point.percentage; + point.index; point.remove(); point.remove(false); point.remove(false, {duration: 50}); diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 45f69a0bda..a338f19757 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Highcharts 4.1.9 +// Type definitions for Highcharts 4.2.5 // Project: http://www.highcharts.com/ // Definitions by: Damiano Gambarotto , Dan Lewi Harkestad // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -4817,6 +4817,17 @@ interface HighchartsPlotOptions { */ interface HighchartsIndividualSeriesOptions { type?: string; + /** + * The main color or the series. In line type series it applies to the line and the point markers unless otherwise + * specified. In bar type series it applies to the bars unless a color is specified per point. The default + * value is pulled from the options.colors array. + */ + color?: string; + /** + * You can set the cursor to "pointer" if you have click events attached to the series, to signal to the user + * that the points and lines can be clicked. + */ + cursor?: string; /** * An array of data points for the series. For the area series type, points can be given in the following ways: * @@ -4867,6 +4878,11 @@ interface HighchartsIndividualSeriesOptions { * The name of the series as shown in the legend, tooltip etc. */ name?: string; + /** + * A pixel value specifying a fixed width for each column or bar. When null, the width is calculated from + * the pointPadding and groupPadding. + */ + pointWidth?: number; /** * This option allows grouping series in a stacked chart. The stack option can be a string or a number or anything * else, as long as the grouped series' stack options match each other. @@ -5472,12 +5488,12 @@ interface HighchartsOptions { * The X axis or category axis. Normally this is the horizontal axis, though if the chart is inverted this is the * vertical axis. In case of multiple axes, the xAxis node is an array of configuration objects. */ - xAxis?: HighchartsAxisOptions | HighchartsAxisOptions[]; + xAxis?: HighchartsAxisOptions[] | HighchartsAxisOptions; /** * The Y axis or value axis. Normally this is the vertical axis, though if the chart is inverted this is the * horizontal axis. In case of multiple axes, the yAxis node is an array of configuration objects. */ - yAxis?: HighchartsAxisOptions | HighchartsAxisOptions[]; + yAxis?: HighchartsAxisOptions[] | HighchartsAxisOptions; } interface HighchartsGlobalOptions extends HighchartsOptions { @@ -6098,6 +6114,7 @@ interface HighchartsPointObject { */ category: string | number; name: string; + index: number; /** * The percentage for points in a stacked series or pies. * @since 1.2.0 From 590086e16742ad6a912df468de3e5fe0b5215ba3 Mon Sep 17 00:00:00 2001 From: Francis O'Brien Date: Fri, 29 Jul 2016 01:08:50 +0200 Subject: [PATCH 23/79] Updated to match docs for version 0.9.3 (latest as of 07/19/16) This is very important because response.data now returns raw data instead of a json object, you need to use res.json() to get an object representation of the response. .json() was missing from the typings. Aditionally modified a few breaking changes to match the documentation at: https://github.com/vuejs/vue-resource/blob/master/docs/http.md --- vue-resource/vue-resource.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index 2276634e68..a5c61f6423 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -23,21 +23,22 @@ declare namespace vuejs { status: number; statusText: string; headers: Function; + text():string; + json():string; + blob():string; } interface HttpOptions { url?: string; method?: string; - data?: any; + body?: any; params?: any; headers?: any; - beforeSend?(request: any): any; + before?(request: any): any; + progress?(event: any): any; + credentials:boolean; emulateHTTP?: boolean; emulateJSON?: boolean; - xhr?: any; - upload?: any; - jsonp?: string; - timeout?: string; } interface $http { From 822fee5d45e0b167b468d17abd2fb79839a58096 Mon Sep 17 00:00:00 2001 From: itsFrank Date: Fri, 29 Jul 2016 01:17:21 +0200 Subject: [PATCH 24/79] Added tests for json, blob, and text --- vue-resource/vue-resource-tests.ts | 3 +++ vue-resource/vue-resource.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vue-resource/vue-resource-tests.ts b/vue-resource/vue-resource-tests.ts index 28ae5abe09..8c6167da60 100644 --- a/vue-resource/vue-resource-tests.ts +++ b/vue-resource/vue-resource-tests.ts @@ -29,6 +29,9 @@ class App extends Vue { response.headers('expires'); this.$set('someData', response.data); + this.$set('someJsonData', response.json()); + this.$set('someTextData', response.text()); + this.$set('someBlobData', response.blob()); }); var resource = this.$resource('someItem/{id}'); diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index a5c61f6423..beb617d14a 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -15,7 +15,7 @@ declare namespace vuejs { common?: { [key: string]: string }; custom?: { [key: string]: string }; [key: string]: any; - } + } interface HttpResponse { data: Object; @@ -36,7 +36,7 @@ declare namespace vuejs { headers?: any; before?(request: any): any; progress?(event: any): any; - credentials:boolean; + credentials?:boolean; emulateHTTP?: boolean; emulateJSON?: boolean; } From 094dfc6420d3118c9c691764a29b4fbbfc041af6 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 29 Jul 2016 04:59:34 +0200 Subject: [PATCH 25/79] Update to Electron 1.3.1 (#10336) * Update to Electron 1.3.1 * Update editing command docs * Fix argument types --- github-electron/github-electron-main-tests.ts | 1 - github-electron/github-electron.d.ts | 59 +++++++++++++------ 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 0b928138e4..c8d0c8df7c 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -284,7 +284,6 @@ app.on('ready', () => { app.commandLine.appendSwitch('remote-debugging-port', '8315'); app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1'); -app.commandLine.appendSwitch('v', -1); app.commandLine.appendSwitch('vmodule', 'console=0'); // systemPreferences diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 0cd51c1601..ce01bb23d5 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron v1.2.8 +// Type definitions for Electron v1.3.1 // Project: http://electron.atom.io/ // Definitions by: jedmao , rhysd , Milan Burda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -401,7 +401,7 @@ declare namespace Electron { * Note: This will not affect process.argv, and is mainly used by developers * to control some low-level Chromium behaviors. */ - appendSwitch(_switch: string, value?: string|number): void; + appendSwitch(_switch: string, value?: string): void; /** * Append an argument to Chromium's command line. The argument will quoted properly. * @@ -2799,7 +2799,7 @@ declare namespace Electron { /** * Sets the proxy settings. */ - setProxy(config: string, callback: Function): void; + setProxy(config: ProxyConfig, callback: Function): void; /** * Resolves the proxy information for url. */ @@ -2882,6 +2882,21 @@ declare namespace Electron { quotas?: ('temporary' | 'persistent' | 'syncable')[]; } + interface ProxyConfig { + /** + * The URL associated with the PAC file. + */ + pacScript: string; + /** + * Rules indicating which proxies to use. + */ + proxyRules: string; + /** + * Rules indicating which URLs should bypass the proxy settings. + */ + proxyBypassRules: string; + } + interface NetworkEmulationOptions { /** * Whether to emulate network outage. @@ -3386,10 +3401,10 @@ declare namespace Electron { */ setTitle(title: string): void; /** - * Sets whether the tray icon is highlighted when it is clicked. + * Sets when the tray's icon background becomes highlighted. * Note: This is only implemented on macOS. */ - setHighlightMode(highlight: boolean): void; + setHighlightMode(mode: 'selection' | 'always' | 'never'): void; /** * Displays a tray balloon. * Note: This is only implemented on Windows. @@ -3641,6 +3656,10 @@ declare namespace Electron { * passing empty string to callback will cancel the request. */ on(event: 'select-bluetooth-device', listener: (event: Event, deviceList: BluetoothDevice[], callback: (deviceId: string) => void) => void): this; + /** + * Emitted when a page's view is repainted. + */ + on(event: 'view-painted', listener: Function): this; on(event: string, listener: Function): this; /** * Loads the url in the window. @@ -3751,47 +3770,51 @@ declare namespace Electron { */ isAudioMuted(): boolean; /** - * Executes Edit -> Undo command in page. + * Executes the editing command undo in web page. */ undo(): void; /** - * Executes Edit -> Redo command in page. + * Executes the editing command redo in web page. */ redo(): void; /** - * Executes Edit -> Cut command in page. + * Executes the editing command cut in web page. */ cut(): void; /** - * Executes Edit -> Copy command in page. + * Executes the editing command copy in web page. */ copy(): void; /** - * Executes Edit -> Paste command in page. + * Copy the image at the given position to the clipboard. + */ + copyImageAt(x: number, y: number): void; + /** + * Executes the editing command paste in web page. */ paste(): void; /** - * Executes Edit -> Paste and Match Style in page. + * Executes the editing command pasteAndMatchStyle in web page. */ pasteAndMatchStyle(): void; /** - * Executes Edit -> Delete command in page. + * Executes the editing command delete in web page. */ delete(): void; /** - * Executes Edit -> Select All command in page. + * Executes the editing command selectAll in web page. */ selectAll(): void; /** - * Executes Edit -> Unselect command in page. + * Executes the editing command unselect in web page. */ unselect(): void; /** - * Executes Edit -> Replace command in page. + * Executes the editing command replace in web page. */ replace(text: string): void; /** - * Executes Edit -> Replace Misspelling command in page. + * Executes the editing command replaceMisspelling in web page. */ replaceMisspelling(text: string): void; /** @@ -4342,7 +4365,7 @@ declare namespace Electron { wheelTicksY?: number; accelerationRatioX?: number; accelerationRatioY?: number; - hasPreciseScrollingDeltas?: number; + hasPreciseScrollingDeltas?: boolean; canScroll?: boolean; } @@ -4619,7 +4642,7 @@ declare namespace Electron { /** * Navigates to the specified offset from the "current entry". */ - goToOffset(offset: boolean): void; + goToOffset(offset: number): void; /** * @returns Whether the renderer process has crashed. */ From 697f7c354cce5ee610715b3a297e9d404e38642a Mon Sep 17 00:00:00 2001 From: itsFrank Date: Fri, 29 Jul 2016 07:59:20 +0200 Subject: [PATCH 26/79] fixed version number --- vue-resource/vue-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index beb617d14a..161e27e3df 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vue-resoure 0.7.0 +// Type definitions for vue-resoure 0.9.3 // Project: https://github.com/vuejs/vue-resource // Definitions by: kaorun343 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 09dcd610f000be72bb48af0bc7c07b2784178e6f Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 29 Jul 2016 14:08:08 +0200 Subject: [PATCH 27/79] Define Point/Size/Rectangle properly + use consistently --- github-electron/github-electron-main-tests.ts | 2 +- github-electron/github-electron.d.ts | 79 +++++++++---------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index c8d0c8df7c..4453967cc4 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -137,7 +137,7 @@ app.on('ready', () => { mainWindow.webContents.capturePage(image => { console.log(image.toDataURL()); }); - mainWindow.webContents.capturePage({width: 100, height: 200}, image => { + mainWindow.webContents.capturePage({x: 0, y: 0, width: 100, height: 200}, image => { console.log(image.toPNG()); }); }); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index ce01bb23d5..98cf047493 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -25,6 +25,23 @@ declare namespace Electron { sender: EventEmitter; } + type Point = { + x: number; + y: number; + } + + type Size = { + width: number; + height: number; + } + + type Rectangle = { + x: number; + y: number; + width: number; + height: number; + } + // https://github.com/electron/electron/blob/master/docs/api/app.md /** @@ -844,7 +861,7 @@ declare namespace Electron { * * Note: This API is available only on macOS. */ - setAspectRatio(aspectRatio: number, extraSize?: Dimension): void; + setAspectRatio(aspectRatio: number, extraSize?: Size): void; /** * Resizes and moves the window to width, height, x, y. */ @@ -1112,7 +1129,7 @@ declare namespace Electron { * * Note: This API is available only on Windows. */ - setThumbnailClip(region: Bounds): void; + setThumbnailClip(region: Rectangle): void; /** * Same as webContents.showDefinitionForSelection(). * Note: This API is available only on macOS. @@ -1360,7 +1377,7 @@ declare namespace Electron { backgroundThrottling?: boolean; } - interface BrowserWindowOptions extends Rectangle { + interface BrowserWindowOptions { /** * Window’s width in pixels. * Default: 800. @@ -1570,13 +1587,6 @@ declare namespace Electron { type BrowserWindowTypeMac = 'desktop' | 'textured'; type BrowserWindowTypeWindows = 'toolbar'; - interface Rectangle { - x?: number; - y?: number; - width?: number; - height?: number; - } - // https://github.com/electron/electron/blob/master/docs/api/clipboard.md /** @@ -1853,7 +1863,7 @@ declare namespace Electron { * The suggested size that thumbnail should be scaled. * Default: {width: 150, height: 150} */ - thumbnailSize?: Dimension; + thumbnailSize?: Size; } interface DesktopCapturerSource { @@ -2452,7 +2462,7 @@ declare namespace Electron { /** * @returns {} The size of the image. */ - getSize(): Dimension; + getSize(): Size; /** * Marks the image as template image. */ @@ -2675,10 +2685,10 @@ declare namespace Electron { * Unique identifier associated with the display. */ id: number; - bounds: Bounds; - workArea: Bounds; - size: Dimension; - workAreaSize: Dimension; + bounds: Rectangle; + workArea: Rectangle; + size: Size; + workAreaSize: Size; /** * Output device’s pixel scale factor. */ @@ -2690,23 +2700,6 @@ declare namespace Electron { touchSupport: 'available' | 'unavailable' | 'unknown'; } - type Bounds = { - x: number; - y: number; - width: number; - height: number; - } - - type Dimension = { - width: number; - height: number; - } - - type Point = { - x: number; - y: number; - } - type DisplayMetrics = 'bounds' | 'workArea' | 'scaleFactor' | 'rotation'; /** @@ -2746,7 +2739,7 @@ declare namespace Electron { /** * @returns The display that most closely intersects the provided bounds. */ - getDisplayMatching(rect: Bounds): Display; + getDisplayMatching(rect: Rectangle): Display; } // https://github.com/electron/electron/blob/master/docs/api/session.md @@ -3318,17 +3311,17 @@ declare namespace Electron { * Emitted when the tray icon is clicked. * Note: The bounds payload is only implemented on macOS and Windows. */ - on(event: 'click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this; + on(event: 'click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this; /** * Emitted when the tray icon is right clicked. * Note: This is only implemented on macOS and Windows. */ - on(event: 'right-click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this; + on(event: 'right-click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this; /** * Emitted when the tray icon is double clicked. * Note: This is only implemented on macOS and Windows. */ - on(event: 'double-click', listener: (modifiers: Modifiers, bounds: Bounds) => void): this; + on(event: 'double-click', listener: (modifiers: Modifiers, bounds: Rectangle) => void): this; /** * Emitted when the tray balloon shows. * Note: This is only implemented on Windows. @@ -3428,7 +3421,7 @@ declare namespace Electron { /** * @returns The bounds of this tray icon. */ - getBounds(): Bounds; + getBounds(): Rectangle; } interface Modifiers { @@ -3985,7 +3978,7 @@ declare namespace Electron { * The dirtyRect is an object with x, y, width, height properties that describes which part of the page was repainted. * If onlyDirty is set to true, frameBuffer will only contain the repainted area. onlyDirty defaults to false. */ - dirtyRect?: Bounds + dirtyRect?: Rectangle ): void } @@ -4189,7 +4182,7 @@ declare namespace Electron { * Specify page size of the generated PDF. * Default: A4. */ - pageSize?: 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid' | Dimension; + pageSize?: 'A3' | 'A4' | 'A5' | 'Legal' | 'Letter' | 'Tabloid' | Size; /** * Whether to print CSS backgrounds. * Default: false. @@ -4294,7 +4287,7 @@ declare namespace Electron { /** * Coordinates of first match region. */ - selectionArea?: Bounds; + selectionArea?: Rectangle; } interface DeviceEmulationParameters { @@ -4306,7 +4299,7 @@ declare namespace Electron { /** * Set the emulated screen size (screenPosition == mobile) */ - screenSize?: Dimension; + screenSize?: Size; /** * Position the view on the screen (screenPosition == mobile) * Default: {x: 0, y: 0} @@ -4320,7 +4313,7 @@ declare namespace Electron { /** * Set the emulated view size (empty means no override). */ - viewSize?: Dimension; + viewSize?: Size; /** * Whether emulated view should be scaled down if necessary to fit into available space * Default: false From 49b81182471d3e8c72b5b8c10d677e09cf9bd751 Mon Sep 17 00:00:00 2001 From: Erik Timmers Date: Fri, 29 Jul 2016 15:23:54 +0200 Subject: [PATCH 28/79] Add `uniformLanguageTag` to angular-translate Fixes #6691. --- angular-translate/angular-translate.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index de7db4eb54..0187e33cab 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -95,6 +95,7 @@ declare namespace angular.translate { use(key: string): ITranslateProvider; storageKey(): string; storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here + uniformLanguageTag(options: string | Object): ITranslateProvider; useUrlLoader(url: string): ITranslateProvider; useStaticFilesLoader(options: IStaticFilesLoaderOptions | { files: IStaticFilesLoaderOptions[] }): ITranslateProvider; useLoader(loaderFactory: string, options?: any): ITranslateProvider; From 72031fce99f42fd9a1c6e2976435d30f621b025b Mon Sep 17 00:00:00 2001 From: York Yao Date: Fri, 29 Jul 2016 10:48:16 -0500 Subject: [PATCH 29/79] add definition of js-priority-queue (#10347) --- js-priority-queue/js-priority-queue-tests.ts | 26 ++++++++ js-priority-queue/js-priority-queue.d.ts | 64 ++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 js-priority-queue/js-priority-queue-tests.ts create mode 100644 js-priority-queue/js-priority-queue.d.ts diff --git a/js-priority-queue/js-priority-queue-tests.ts b/js-priority-queue/js-priority-queue-tests.ts new file mode 100644 index 0000000000..e63cd0a8b8 --- /dev/null +++ b/js-priority-queue/js-priority-queue-tests.ts @@ -0,0 +1,26 @@ +/// + +import * as PriorityQueue from "js-priority-queue"; + +{ + var queue = new PriorityQueue({ comparator: (a, b) => b - a }); + queue.queue(5); + queue.queue(3); + queue.queue(2); + var lowest = queue.dequeue(); // returns 5 +} +{ + var compareNumbers = (a: number, b: number) => a - b; + new PriorityQueue({ comparator: compareNumbers }); +} +{ + new PriorityQueue({ initialValues: [1, 2, 3] }) +} +{ + new PriorityQueue({ strategy: PriorityQueue.ArrayStrategy }); // Array + new PriorityQueue({ strategy: PriorityQueue.BinaryHeapStrategy }); // Default + new PriorityQueue({ strategy: PriorityQueue.BHeapStrategy }); // Slower +} +{ + var a: PriorityQueue.PriorityQueueOptions; +} diff --git a/js-priority-queue/js-priority-queue.d.ts b/js-priority-queue/js-priority-queue.d.ts new file mode 100644 index 0000000000..dda0c47097 --- /dev/null +++ b/js-priority-queue/js-priority-queue.d.ts @@ -0,0 +1,64 @@ +// Type definitions for js-priority-queue +// Project: https://github.com/adamhooper/js-priority-queue +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/* =================== USAGE =================== + import * as PriorityQueue from "js-priority-queue"; + var queue = new PriorityQueue({ comparator: (a, b) => b - a }); + queue.queue(5); + =============================================== */ + +declare module "js-priority-queue" { + class AbstractPriorityQueue { + /** + * Returns the number of elements in the queue + */ + public length: number; + /** + * Creates a priority queue + */ + constructor(options?: PriorityQueue.PriorityQueueOptions); + /** + * Inserts a new value in the queue + */ + public queue(value: T): void; + /** + * Returns the smallest item in the queue and leaves the queue unchanged + */ + public peek(): T; + /** + * Returns the smallest item in the queue and removes it from the queue + */ + public dequeue(): T; + /** + * Removes all values from the queue + */ + public clear(): void; + } + namespace PriorityQueue { + type PriorityQueueOptions = { + /** + * This is the argument we would pass to Array.prototype.sort + */ + comparator?: (a: T, b: T) => number; + /** + * You can also pass initial values, in any order. + * With lots of values, it's faster to load them all at once than one at a time. + */ + initialValues?: T[]; + /** + * According to JsPerf, the fastest strategy for most cases is BinaryHeapStrategy. + * Only use ArrayStrategy only if you're queuing items in a very particular order. + * Don't use BHeapStrategy, except as a lesson in how sometimes miracles in one programming language aren't great in other languages. + */ + strategy?: typeof AbstractPriorityQueue; + } + class ArrayStrategy extends AbstractPriorityQueue{ } + class BinaryHeapStrategy extends AbstractPriorityQueue{ } + class BHeapStrategy extends AbstractPriorityQueue{ } + + } + class PriorityQueue extends AbstractPriorityQueue { } + export = PriorityQueue; +} From e04d3b152eeb9c01628955bd0e997ce4b7501276 Mon Sep 17 00:00:00 2001 From: Afshin Darian Date: Fri, 29 Jul 2016 17:19:31 +0100 Subject: [PATCH 30/79] Update to v1.13.0 and bug fix: sanitize-html expects tag attributes to be called attribs. (#10360) --- sanitize-html/sanitize-html-tests.ts | 10 +++++++--- sanitize-html/sanitize-html.d.ts | 11 ++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sanitize-html/sanitize-html-tests.ts b/sanitize-html/sanitize-html-tests.ts index eabdcd5a40..8dddc010d2 100644 --- a/sanitize-html/sanitize-html-tests.ts +++ b/sanitize-html/sanitize-html-tests.ts @@ -10,11 +10,15 @@ let options: sanitize.IOptions = { }, transformTags: { 'a': sanitize.simpleTransform('a', { 'rel': 'nofollow' }), - 'img': 'canvas' + 'img': (tagName: string, attribs: sanitize.Attributes) => { + let img = { tagName, attribs }; + img.attribs['alt'] = 'transformed' ; + return img; + } }, exclusiveFilter: function(frame: sanitize.IFrame) { - return frame.tag === 'a' && !frame.text.trim(); - } + return frame.tag === 'a' && !frame.text.trim(); + } }; let unsafe = '
'; diff --git a/sanitize-html/sanitize-html.d.ts b/sanitize-html/sanitize-html.d.ts index 79ee44b15d..a2f27430fe 100644 --- a/sanitize-html/sanitize-html.d.ts +++ b/sanitize-html/sanitize-html.d.ts @@ -1,4 +1,4 @@ -// Type definitions for sanitize-html 1.12.0 +// Type definitions for sanitize-html 1.13.0 // Project: https://github.com/punkave/sanitize-html // Definitions by: Rogier Schouten , Afshin Darian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -11,10 +11,10 @@ declare namespace sanitize { type Attributes = { [attr: string]: string }; - type Tag = { tagName: string; attributes: Attributes; }; + type Tag = { tagName: string; attribs: Attributes; text?: string; }; - type Transformer = (tagName: string, attributes: Attributes) => Tag; + type Transformer = (tagName: string, attribs: Attributes) => Tag; interface IDefaults { @@ -28,7 +28,7 @@ declare namespace sanitize { interface IFrame { tag: string; - attributes: { [index: string]: string }; + attribs: { [index: string]: string }; text: string; tagPosition: number; } @@ -40,6 +40,7 @@ declare namespace sanitize { allowedSchemes?: string[]; allowedTags?: string[]; exclusiveFilter?: (frame: IFrame) => boolean; + nonTextTags?: string[]; selfClosing?: string[]; transformTags?: { [tagName: string]: string | Transformer }; } @@ -48,7 +49,7 @@ declare namespace sanitize { var defaults: IDefaults; - function simpleTransform(tagName: string, attributes: Attributes, merge?: boolean): Transformer; + function simpleTransform(tagName: string, attribs: Attributes, merge?: boolean): Transformer; } From 46ed88240c5954186ae49729ad740801d1825a35 Mon Sep 17 00:00:00 2001 From: Francis O'Brien Date: Fri, 29 Jul 2016 19:51:32 +0200 Subject: [PATCH 31/79] updated vue-resource (#10349) * Updated to match docs for version 0.9.3 (latest as of 07/19/16) This is very important because response.data now returns raw data instead of a json object, you need to use res.json() to get an object representation of the response. .json() was missing from the typings. Aditionally modified a few breaking changes to match the documentation at: https://github.com/vuejs/vue-resource/blob/master/docs/http.md * Added tests for json, blob, and text * fixed version number --- vue-resource/vue-resource-tests.ts | 3 +++ vue-resource/vue-resource.d.ts | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/vue-resource/vue-resource-tests.ts b/vue-resource/vue-resource-tests.ts index 28ae5abe09..8c6167da60 100644 --- a/vue-resource/vue-resource-tests.ts +++ b/vue-resource/vue-resource-tests.ts @@ -29,6 +29,9 @@ class App extends Vue { response.headers('expires'); this.$set('someData', response.data); + this.$set('someJsonData', response.json()); + this.$set('someTextData', response.text()); + this.$set('someBlobData', response.blob()); }); var resource = this.$resource('someItem/{id}'); diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index 2276634e68..161e27e3df 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vue-resoure 0.7.0 +// Type definitions for vue-resoure 0.9.3 // Project: https://github.com/vuejs/vue-resource // Definitions by: kaorun343 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,7 +15,7 @@ declare namespace vuejs { common?: { [key: string]: string }; custom?: { [key: string]: string }; [key: string]: any; - } + } interface HttpResponse { data: Object; @@ -23,21 +23,22 @@ declare namespace vuejs { status: number; statusText: string; headers: Function; + text():string; + json():string; + blob():string; } interface HttpOptions { url?: string; method?: string; - data?: any; + body?: any; params?: any; headers?: any; - beforeSend?(request: any): any; + before?(request: any): any; + progress?(event: any): any; + credentials?:boolean; emulateHTTP?: boolean; emulateJSON?: boolean; - xhr?: any; - upload?: any; - jsonp?: string; - timeout?: string; } interface $http { From ce71f72bcec4d09702b969d6743b52d9780a661f Mon Sep 17 00:00:00 2001 From: Johannes Schickling Date: Fri, 29 Jul 2016 23:55:36 +0200 Subject: [PATCH 32/79] Added basic type definitions for react-relay (#10353) * Added basic type definitions for react-relay * Fixed tests * fix formatting --- react-relay/react-relay-test.tsx | 46 +++++++++++++ react-relay/react-relay.d.ts | 112 +++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 react-relay/react-relay-test.tsx create mode 100644 react-relay/react-relay.d.ts diff --git a/react-relay/react-relay-test.tsx b/react-relay/react-relay-test.tsx new file mode 100644 index 0000000000..e6632e76f9 --- /dev/null +++ b/react-relay/react-relay-test.tsx @@ -0,0 +1,46 @@ +/// +/// + +import * as React from "react" +import * as Relay from "react-relay" + +interface Props { + text: string + userId: string +} + +interface Response { +} + +export default class AddTweetMutation extends Relay.Mutation { + + getMutation () { + return Relay.QL`mutation{addTweet}` + } + + getFatQuery () { + return Relay.QL` + fragment on AddTweetPayload { + tweetEdge + user + } + ` + } + + getConfigs () { + return [{ + type: "RANGE_ADD", + parentName: "user", + parentID: this.props.userId, + connectionName: "tweets", + edgeName: "tweetEdge", + rangeBehaviors: { + "": "append", + }, + }] + } + + getVariables () { + return this.props + } +} diff --git a/react-relay/react-relay.d.ts b/react-relay/react-relay.d.ts new file mode 100644 index 0000000000..1a0ae89069 --- /dev/null +++ b/react-relay/react-relay.d.ts @@ -0,0 +1,112 @@ +// Type definitions for react-relay 0.9.2 +// Project: https://github.com/facebook/relay +// Definitions by: Johannes Schickling +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-relay" { + import * as React from "react"; + + /** Fragments are a hash of functions */ + interface Fragments { + [query: string]: ((variables?: RelayVariables) => string) + } + + interface CreateContainerOpts { + initialVariables?: Object + fragments: Fragments + prepareVariables?(prevVariables: RelayVariables): RelayVariables + } + + interface RelayVariables { + [name: string]: any + } + + /** add static getFragment method to the component constructor */ + interface RelayContainerClass extends React.ComponentClass { + getFragment: ((q: string) => string) + } + + interface RelayQueryRequestResolve { + response: any + } + + interface RelayMutationRequest { + getQueryString(): string + getVariables(): RelayVariables + resolve(result: RelayQueryRequestResolve): any + reject(errors: any): any + } + + interface RelayQueryRequest { + resolve(result: RelayQueryRequestResolve): any + reject(errors: any): any + + getQueryString(): string + getVariables(): RelayVariables + getID(): string + getDebugName(): string + } + + interface RelayNetworkLayer { + supports(...options: string[]): boolean + } + + class DefaultNetworkLayer implements RelayNetworkLayer { + constructor(host: string, options: any) + supports(...options: string[]): boolean + } + + function createContainer(component: React.ComponentClass, params?: CreateContainerOpts): RelayContainerClass + function injectNetworkLayer(networkLayer: RelayNetworkLayer): any + function isContainer(component: React.ComponentClass): boolean + function QL(...args: any[]): string + + class Route { + constructor(params?: RelayVariables) + } + + /** + * Relay Mutation class, where T are the props it takes and S is the returned payload from Relay.Store.update. + * S is typically dynamic as it depends on the data the app is currently using, but it's possible to always + * return some data in the payload using REQUIRED_CHILDREN which is where specifying S is the most useful. + */ + class Mutation { + props: T + + constructor(props: T) + static getFragment(q: string): string + } + + interface Transaction { + getError(): Error + Status(): number + } + + interface StoreUpdateCallbacks { + onFailure?(transaction: Transaction): any + onSuccess?(response: T): any + } + + interface Store { + commitUpdate(mutation: Mutation, callbacks?: StoreUpdateCallbacks): any + } + + var Store: Store + + class RootContainer extends React.Component {} + + interface RootContainerProps extends React.Props{ + Component: RelayContainerClass + route: Route + renderLoading?(): JSX.Element + renderFetched?(data: any): JSX.Element + renderFailure?(error: Error, retry: Function): JSX.Element + } + + interface RelayProp { + variables: any + setVariables(variables: Object): void + } +} From ee86f2a645c6bcd816c8c3ea8d55d6cf4cf05ac1 Mon Sep 17 00:00:00 2001 From: IceCreamYou Date: Fri, 29 Jul 2016 19:00:42 -0700 Subject: [PATCH 33/79] Adding the mainloop.js folder --- mainloop.js/mainloop.js-tests.ts | 95 ++++++++++++++++++++++++++++++++ mainloop.js/mainloop.js.d.ts | 28 ++++++++++ 2 files changed, 123 insertions(+) create mode 100644 mainloop.js/mainloop.js-tests.ts create mode 100644 mainloop.js/mainloop.js.d.ts diff --git a/mainloop.js/mainloop.js-tests.ts b/mainloop.js/mainloop.js-tests.ts new file mode 100644 index 0000000000..86a4db6240 --- /dev/null +++ b/mainloop.js/mainloop.js-tests.ts @@ -0,0 +1,95 @@ +/// + +// To see what this test does, create an HTML file with these contents and open it: +/* + + + + + + + MainLoop.js test + + + + + + + + + + +*/ + +window.addEventListener('load', () => { + + let cx = window.innerWidth / 2 - 15, + cy = window.innerHeight / 2 - 15, + x = cx + 120, + y = cy, + lx = x, + ly = y, + theta = 0 + const radius = 120, + velocity = 0.1 * Math.PI / 180; + + const actor = document.createElement('div'); + actor.style.width = '30px'; + actor.style.height = '30px'; + actor.style.backgroundColor = 'red'; + actor.style.position = 'absolute'; + actor.style.left = x + 'px'; + actor.style.top = y + 'px'; + + document.body.appendChild(actor); + + const fpsCounter = document.createElement('div'); + fpsCounter.style.position = 'absolute'; + fpsCounter.style.left = '10px'; + fpsCounter.style.top = '10px'; + + document.body.appendChild(fpsCounter); + + document.body.addEventListener('click', (event) => { + cx = event.pageX; + cy = event.pageY; + }); + + MainLoop + .setBegin((timestamp, delta) => { + lx = x; + ly = y; + x = cx + Math.cos(theta) * radius; + y = cy + Math.sin(theta) * radius; + }) + .setDraw((interpolationPercentage) => { + actor.style.left = (lx + (x - lx) * interpolationPercentage) + 'px'; + actor.style.top = (ly + (y - ly) * interpolationPercentage) + 'px'; + }) + .setUpdate((delta) => { + theta += velocity * delta; + }) + .setEnd((fps, panic) => { + fpsCounter.textContent = Math.round(fps) + ' FPS'; + if (panic) { + console.info( + `Main loop panicked; tried to simulate too much time. Discarding ${MainLoop.resetFrameDelta()}ms` + ); + } + }) + .start(); + + document.body.addEventListener('keyup', (event) => { + if ((event.which || event.keyCode) === 80) { // Hit P to toggle Pause + if (MainLoop.isRunning()) { + MainLoop.stop(); + } + else { + MainLoop.start(); + } + } + }); + +}); diff --git a/mainloop.js/mainloop.js.d.ts b/mainloop.js/mainloop.js.d.ts new file mode 100644 index 0000000000..f34d6f035a --- /dev/null +++ b/mainloop.js/mainloop.js.d.ts @@ -0,0 +1,28 @@ +// Type definitions for MainLoop.js v1.0.3 +// Project: https://github.com/IceCreamYou/MainLoop.js +// Definitions by: Isaac Sukin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Interface for the MainLoop.js global. + * + * See the API documentation for a detailed explanation of these methods: + * http://icecreamyou.github.com/MainLoop.js/docs/#!/api/MainLoop + */ +interface MainLoop { + getFPS(): number; + getMaxAllowedFPS(): number; + getSimulationTimestep(): number; + isRunning(): boolean; + resetFrameDelta(): number; + setBegin(begin: (timestamp: number, delta: number) => void): MainLoop; + setDraw(draw: (interpolationPercentage: number) => void): MainLoop; + setUpdate(update: (delta: number) => void): MainLoop; + setEnd(end: (fps: number, panic: boolean) => void): MainLoop; + setMaxAllowedFPS(fps?: number): MainLoop; + setSimulationTimestep(timestep: number): MainLoop; + start(): MainLoop; + stop(): MainLoop; +} + +declare var MainLoop: MainLoop; From a1cbbf2ccdfe043878f5cd6c53bdaa608eec4626 Mon Sep 17 00:00:00 2001 From: Kamil Szostak Date: Fri, 29 Jul 2016 21:09:46 -0700 Subject: [PATCH 34/79] Fix application insights JS module initialization (#10364) --- applicationinsights-js/applicationinsights-js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applicationinsights-js/applicationinsights-js.d.ts b/applicationinsights-js/applicationinsights-js.d.ts index 9047f44b9f..ba154e5fe6 100644 --- a/applicationinsights-js/applicationinsights-js.d.ts +++ b/applicationinsights-js/applicationinsights-js.d.ts @@ -790,7 +790,7 @@ declare module Microsoft.ApplicationInsights { } declare module 'applicationinsights-js' { - export = appInsights; + export let AppInsights: Microsoft.ApplicationInsights.IAppInsights; } declare var appInsights: Microsoft.ApplicationInsights.IAppInsights; \ No newline at end of file From 4a71e458ac9d396a24e2273ec77b514125dae5f9 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Sat, 30 Jul 2016 07:10:57 +0300 Subject: [PATCH 35/79] Added new type definition for gulp-help-doc (#10366) * Added gulp-help-doc definitions * Fixed declaration and tests * Fixed declaration and tests * Definition fixed * Declaration fixed --- gulp-help-doc/gulp-help-doc-tests.ts | 27 ++++++++++++++ gulp-help-doc/gulp-help-doc.d.ts | 56 ++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 gulp-help-doc/gulp-help-doc-tests.ts create mode 100644 gulp-help-doc/gulp-help-doc.d.ts diff --git a/gulp-help-doc/gulp-help-doc-tests.ts b/gulp-help-doc/gulp-help-doc-tests.ts new file mode 100644 index 0000000000..f06c25e55c --- /dev/null +++ b/gulp-help-doc/gulp-help-doc-tests.ts @@ -0,0 +1,27 @@ +/// +/// +/// + +import gulp = require('gulp'); +import usage = require('gulp-help-doc'); + +/** + * Demo task + * + * @task {demo} + * @arg {env} environment + */ +gulp.task('demo', function() {}); + +let logger: { + output: string, + log(msg: string): any +} = { + output: '', + log: msg => logger.output += msg + '\n' +}; + +usage(gulp, { + logger: logger, + gulpfile: __filename +}).then(() => console.log(logger.output)); diff --git a/gulp-help-doc/gulp-help-doc.d.ts b/gulp-help-doc/gulp-help-doc.d.ts new file mode 100644 index 0000000000..80d4922774 --- /dev/null +++ b/gulp-help-doc/gulp-help-doc.d.ts @@ -0,0 +1,56 @@ +// Type definitions for gulp-help-doc +// Project: https://github.com/Mikhus/gulp-help-doc +// Definitions by: Mikhus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "gulp-help-doc" { + + import gulp = require('gulp'); + + namespace usage { + + interface UsageOptions { + /** + * Defines max line width for the printed output lines + * (by default is 80 characters long) + */ + lineWidth?: number, + + /** + * Defines max width of the column width tasks or args names + * (by default is 20 characters long) + */ + keysColumnWidth?: number, + + /** + * Defines number of empty characters for left-padding of the output + */ + padding?: number, + + /** + * Printing engine (by default is console). Accepted any device + * which has log() function defined to do output. + */ + logger?: { log: Function }, + + /** + * Path to a gulpfile (default is gulpfile.js) + * Normally, there is no need to change this option. It may be used + * for some special cases, like mocking gulpfile for testing. + */ + gulpfile?: string + } + + interface Usage { + (gulp: gulp.Gulp, options?: UsageOptions): Promise + } + + } + + var usage: usage.Usage; + + export = usage; +} From abda13b09931daeeea94216e3f112bec14961a70 Mon Sep 17 00:00:00 2001 From: Adam Juhasz Date: Fri, 29 Jul 2016 21:12:05 -0700 Subject: [PATCH 36/79] added LogisticRegressionClassifier definitions (#10307) --- natural/natural.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/natural/natural.d.ts b/natural/natural.d.ts index ff519eeccf..009a1c9911 100644 --- a/natural/natural.d.ts +++ b/natural/natural.d.ts @@ -80,6 +80,20 @@ declare module "natural" { static restore(classifier: any, stemmer?: Stemmer): BayesClassifier; } + interface LogisticRegressionClassifierCallback { (err: any, classifier: any): void } + class LogisticRegressionClassifier { + events: events.EventEmitter; + addDocument(text: string, stem: string): void; + addDocument(text: string[], stem: string): void; + train(): void; + classify(observation: string): string; + getClassifications(observation: string): string[]; + save(filename: string, callback: LogisticRegressionClassifierCallback): void; + static load(filename: string, stemmer: Stemmer, callback: LogisticRegressionClassifierCallback): void; + static restore(classifier: any, stemmer?: Stemmer): LogisticRegressionClassifier; + } + + interface Phonetic { compare(stringA: string, stringB: string): boolean; process(token: string, maxLength?: number): string; From 2a24bbb7ca4f13e52c7f6a0ab6144b565bf1ef55 Mon Sep 17 00:00:00 2001 From: Nick Zelei Date: Fri, 29 Jul 2016 23:12:55 -0500 Subject: [PATCH 37/79] Add definitions for utf8 module (#10329) * added utf8 module typings added utf8 module typings * added tests for utf8 added tests for utf8 * moved import to es6 compatible moved import to es6 compatible * updated var to const updated var to const * removed interface and moved into module removed interface and moved into module * update const with let as it can be changed update const with let as it can be changed --- utf8/utf8-tests.ts | 19 +++++++++++++++++++ utf8/utf8.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 utf8/utf8-tests.ts create mode 100644 utf8/utf8.d.ts diff --git a/utf8/utf8-tests.ts b/utf8/utf8-tests.ts new file mode 100644 index 0000000000..852311ea6c --- /dev/null +++ b/utf8/utf8-tests.ts @@ -0,0 +1,19 @@ +/// + +import * as utf8 from "utf8"; + +function test_encode(): void { + utf8.encode("\x49"); + utf8.encode("\uD800\uDC01"); +} + +function test_decode(): void { + utf8.decode("\xC2\x49"); + utf8.decode("\xF0\x90\x80\x81"); +} + +function test_version(): void { + if (typeof utf8.version === "string") { + console.log(utf8.version); + } +} diff --git a/utf8/utf8.d.ts b/utf8/utf8.d.ts new file mode 100644 index 0000000000..e9ee9d16b1 --- /dev/null +++ b/utf8/utf8.d.ts @@ -0,0 +1,24 @@ +// Type definitions for utf8 v2.1.1 +// Project: https://github.com/mathiasbynens/utf8.js +// Definitions by: Nick Zelei +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "utf8" { + /** + * A string representing the semantic version number. + */ + let version: string; + /** + * Encodes any given JavaScript string (string) as UTF-8, and returns the UTF-8-encoded version of the string. + * It throws an error if the input string contains a non-scalar value, i.e. a lone surrogate. + * @param {string} inputString + */ + function encode(inputString: string): string; + + /** + * Decodes any given UTF-8-encoded string (byteString) as UTF-8, and returns the UTF-8-decoded version of the string. + * It throws an error when malformed UTF-8 is detected. + * @param {string} byteString + */ + function decode(byteString: string): string; +} From 1837f78bed57e89c85e00eaf52172bec50a4efcf Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Sat, 30 Jul 2016 21:42:25 +0900 Subject: [PATCH 38/79] Add PureComponent definition (React 15.3) Observably, it's identical to a Component, just with a default invisible shouldComponentUpdate. --- react/react.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react/react.d.ts b/react/react.d.ts index 57ef054943..a6bdbdfca6 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -178,6 +178,8 @@ declare namespace __React { [key: string]: ReactInstance }; } + + class PureComponent extends Component {} interface ClassicComponent extends Component { replaceState(nextState: S, callback?: () => any): void; From 8c0b4317668eefede24c5d9bc6b1037854be678a Mon Sep 17 00:00:00 2001 From: Rand Scullard Date: Sat, 30 Jul 2016 11:33:20 -0400 Subject: [PATCH 39/79] react: Add SVG elements feFuncA and textPath. --- react/react.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react/react.d.ts b/react/react.d.ts index 57ef054943..d9a6a2d0e3 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -2485,6 +2485,7 @@ declare namespace JSX { feDiffuseLighting: React.SVGProps; feDisplacementMap: React.SVGProps; feFlood: React.SVGProps; + feFuncA: React.SVGProps; feGaussianBlur: React.SVGProps; feImage: React.SVGProps; feMerge: React.SVGProps; @@ -2511,6 +2512,7 @@ declare namespace JSX { stop: React.SVGProps; symbol: React.SVGProps; text: React.SVGProps; + textPath: React.SVGProps; tspan: React.SVGProps; use: React.SVGProps; } From f92a29148ac12f36c315a008dc1b3b57442f4671 Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Sat, 30 Jul 2016 17:41:50 +0200 Subject: [PATCH 40/79] Update THREE.js definitions to r79 --- threejs/tests/webgl/webgl_animation_cloth.ts | 2 +- .../webgl/webgl_animation_skinning_morph.ts | 2 +- .../tests/webgl/webgl_lights_hemisphere.ts | 8 +- threejs/three.d.ts | 848 ++++++++++-------- 4 files changed, 497 insertions(+), 363 deletions(-) diff --git a/threejs/tests/webgl/webgl_animation_cloth.ts b/threejs/tests/webgl/webgl_animation_cloth.ts index e58d460986..7bebdc3423 100644 --- a/threejs/tests/webgl/webgl_animation_cloth.ts +++ b/threejs/tests/webgl/webgl_animation_cloth.ts @@ -114,7 +114,7 @@ clothGeometry.dynamic = true; clothGeometry.computeFaceNormals(); - var uniforms = { texture: { type: "t", value: clothTexture } }; + var uniforms = { texture: { value: clothTexture } }; var vertexShader = document.getElementById('vertexShaderDepth').textContent; var fragmentShader = document.getElementById('fragmentShaderDepth').textContent; diff --git a/threejs/tests/webgl/webgl_animation_skinning_morph.ts b/threejs/tests/webgl/webgl_animation_skinning_morph.ts index 50976c4547..726a8f4b7f 100644 --- a/threejs/tests/webgl/webgl_animation_skinning_morph.ts +++ b/threejs/tests/webgl/webgl_animation_skinning_morph.ts @@ -182,7 +182,7 @@ scene.add( helper ); - var clipMorpher = THREE.AnimationClip.CreateFromMorphTargetSequence( 'facialExpressions', mesh.geometry.morphTargets, 3 ); + var clipMorpher = THREE.AnimationClip.CreateFromMorphTargetSequence( 'facialExpressions', mesh.geometry.morphTargets, 3, true ); var clipBones = geometry.animations[0]; mixer = new THREE.AnimationMixer( mesh ); diff --git a/threejs/tests/webgl/webgl_lights_hemisphere.ts b/threejs/tests/webgl/webgl_lights_hemisphere.ts index 892b3ed4cc..bed4d5e0b5 100644 --- a/threejs/tests/webgl/webgl_lights_hemisphere.ts +++ b/threejs/tests/webgl/webgl_lights_hemisphere.ts @@ -95,10 +95,10 @@ var vertexShader = document.getElementById( 'vertexShader' ).textContent; var fragmentShader = document.getElementById( 'fragmentShader' ).textContent; var uniforms = { - topColor: { type: "c", value: new THREE.Color( 0x0077ff ) }, - bottomColor: { type: "c", value: new THREE.Color( 0xffffff ) }, - offset: { type: "f", value: 33 }, - exponent: { type: "f", value: 0.6 } + topColor: { value: new THREE.Color( 0x0077ff ) }, + bottomColor: { value: new THREE.Color( 0xffffff ) }, + offset: { value: 33 }, + exponent: { value: 0.6 } }; uniforms.topColor.value.copy( hemiLight.color ); diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 389d247e53..477ed86787 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r75 +// Type definitions for three.js r79 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -158,6 +158,7 @@ declare namespace THREE { export const LuminanceFormat: PixelFormat; export const LuminanceAlphaFormat: PixelFormat; export const RGBEFormat: PixelFormat; + export const DepthFormat: PixelFormat; // Compressed texture formats // DDS / ST3C Compressed texture formats @@ -211,6 +212,11 @@ declare namespace THREE { export const RGBM16Encoding: TextureEncoding; export const RGBDEncoding: TextureEncoding; + // Depth packing strategies + export enum DepthPackingStrategies { } + export const BasicDepthPacking: DepthPackingStrategies; + export const RGBADepthPacking: DepthPackingStrategies; + // log handlers export function warn(message?: any, ...optionalParams: any[]): void; export function error(message?: any, ...optionalParams: any[]): void; @@ -218,40 +224,78 @@ declare namespace THREE { // Animation //////////////////////////////////////////////////////////////////////////////////////// + export class AnimationAction { + loop: boolean; + time: number; + timeScale: number; + weight: number; + repetitions: number; + paused: boolean; + enabled: boolean; + clampWhenFinished: boolean; + zeroSlopeAtStart: boolean; + zeroSlopeAtEnd: boolean; + + play(): AnimationAction; + stop(): AnimationAction; + reset(): AnimationAction; + isRunning(): boolean; + startAt(time: number): AnimationAction; + setLoop(mode: boolean, repetitions: number): AnimationAction; + setEffectiveWeight(weight: number): AnimationAction; + getEffectiveWeight(): number; + fadeIn(duration: number): AnimationAction; + fadeOut(duration: number): AnimationAction; + crossFadeFrom(fadeOutAction: AnimationAction,duration: number, warp: boolean): AnimationAction; + crossFadeTo(fadeInAction: AnimationAction,duration: number, warp: boolean): AnimationAction; + stopFading(): AnimationAction; + setEffectiveTimeScale(timeScale: number): AnimationAction; + getEffectiveTimeScale(): number; + setDuration(duration: number): AnimationAction; + syncWith(action: AnimationAction): AnimationAction; + halt(duration: number): AnimationAction; + warp(statTimeScale: number, endTimeScale: number, duration: number): AnimationAction; + stopWarping(): AnimationAction; + getMixer(): AnimationMixer; + getClip(): AnimationClip; + getRoot(): any; + } + export class AnimationClip { constructor( name?: string, duration?: number, tracks?: KeyframeTrack[] ); name: string; tracks: KeyframeTrack[]; duration: number; + uuid: string; results: any[]; resetDuration(): void; trim(): AnimationClip; optimize(): AnimationClip; - static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number ): AnimationClip; + static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip; static findByName( clipArray: AnimationClip, name: string ): AnimationClip; - static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number ): AnimationClip[]; + static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip[]; static parse( json: any ): AnimationClip; static parseAnimation( animation: any, bones: Bone[], nodeName: string ): AnimationClip; static toJSON(): any; } - export class AnimationMixer { + export class AnimationMixer extends EventDispatcher { constructor(root: any); time: number; timeScale: number; - clipAction(clip: AnimationClip, root?: any): any; // returns THREE.AnimationMixer._Action - existingAction(clip: AnimationClip, root?: any): any; /// returns THREE.AnimationMixer._Action + clipAction(clip: AnimationClip, root?: any): AnimationAction; + existingAction(clip: AnimationClip, root?: any): AnimationAction; stopAllAction(clip: AnimationClip, root?: any): AnimationMixer; update(deltaTime: number): AnimationMixer; getRoot(): any; uncacheClip(clip: AnimationClip): void; uncacheRoot(root: any): void; - uncazcheAction(clip: AnimationClip, root?: any): void; + uncacheAction(clip: AnimationClip, root?: any): void; } export class AnimationObjectGroup { @@ -367,6 +411,10 @@ declare namespace THREE { constructor(name: string, times: any[], values: any[]); } + export class ColorKeyframeTrack extends KeyframeTrack { + constructor(name: string, times: any[], values: any[], interpolation: InterpolationModes); + } + export class NumberKeyframeTrack extends KeyframeTrack { constructor(name: string, times: any[], values: any[], interpolation: InterpolationModes); } @@ -445,6 +493,14 @@ declare namespace THREE { constructor(left: number, right: number, top: number, bottom: number, near?: number, far?: number); zoom: number; + view: { + fullWidth: number, + fullHeight: number, + offsetX: number, + offsetY: number, + width: number, + height: number + }; /** * Camera frustum left plane. @@ -480,6 +536,8 @@ declare namespace THREE { * Updates the camera projection matrix. Must be called after change of parameters. */ updateProjectionMatrix(): void; + setViewOffset(fullWidth: number, fullHeight: number, offsetX: number, offsetY: number, width: number, height: number): void; + clearViewOffset(): void; clone(): OrthographicCamera; copy(source: OrthographicCamera): OrthographicCamera; toJSON(meta?: any): any; @@ -503,7 +561,6 @@ declare namespace THREE { */ constructor(fov?: number, aspect?: number, near?: number, far?: number); - focalLength: number; zoom: number; /** @@ -526,14 +583,23 @@ declare namespace THREE { */ far: number; - /** - * Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified. - * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html - * @param focalLength focal length - * @param frameHeight frame size. Default value is 24. - */ - setLens(focalLength: number, frameHeight?: number): void; + focus: number; + view: { + fullWidth: number, + fullHeight: number, + offsetX: number, + offsetY: number, + width: number, + height: number + }; + filmGauge: number; + filmAcces: number; + setFocalLength(focalLength: number): void; + getFocalLength(): number; + getEffectiveFOV(): number; + getFilmWidth(): number; + getFilmHeight(): number; /** * Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. * For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this: @@ -572,14 +638,17 @@ declare namespace THREE { * @param height height of subcamera */ setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; + clearViewOffset(): void; /** * Updates the camera projection matrix. Must be called after change of parameters. */ updateProjectionMatrix(): void; clone(): PerspectiveCamera; - copy(source: PerspectiveCamera): PerspectiveCamera; toJSON(meta?: any): any; + + // deprecated + setLens(focalLength: number, frameHeight?: number): void; } export class StereoCamera extends Camera { @@ -598,7 +667,7 @@ declare namespace THREE { * @see src/core/BufferAttribute.js */ export class BufferAttribute { - constructor(array: ArrayLike, itemSize: number); // array parameter should be TypedArray. + constructor(array: ArrayLike, itemSize: number, normalized?: boolean); // array parameter should be TypedArray. uuid: string; array: ArrayLike; @@ -606,6 +675,7 @@ declare namespace THREE { dynamic: boolean; updateRange: {offset:number, count:number}; version: number; + normalized: boolean; needsUpdate: boolean; count: number; @@ -682,7 +752,7 @@ declare namespace THREE { * * @see src/core/BufferGeometry.js */ - export class BufferGeometry { + export class BufferGeometry extends EventDispatcher { /** * This creates a new BufferGeometry. It also sets several properties to an default value. */ @@ -700,8 +770,6 @@ declare namespace THREE { index: BufferAttribute; attributes: BufferAttribute|InterleavedBufferAttribute[]; morphAttributes: any; - drawcalls: any; // deprecated, use groups - offsets: any; // deprecated, use groups groups: {start: number, count: number, materialIndex?: number}[]; boundingBox: Box3; boundingSphere: BoundingSphere; @@ -773,17 +841,14 @@ declare namespace THREE { */ dispose(): void; - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + // deprecated + drawcalls: any; + offsets: any; - addIndex(index: any): void; // deprecated, use setIndex() - addAttribute(name: any, array: any, itemSize: any): any; // deprecated - addDrawCall(start: any, count: any, indexOffset?: any): void; // deprecated, use addGroup() - clearDrawCalls(): void; // deprecated, use clearGroups() - computeFaceNormals(): void; // deprecated + addIndex(index: any): void; + addDrawCall(start: any, count: any, indexOffset?: any): void; + clearDrawCalls(): void; + addAttribute(name: any, array: any, itemSize: any): any; } /** @@ -849,7 +914,7 @@ declare namespace THREE { /** * @see src/core/DirectGeometry.js */ - export class DirectGeometry { + export class DirectGeometry extends EventDispatcher { constructor(); id: number; @@ -919,8 +984,6 @@ declare namespace THREE { */ constructor(); - apply(object: any): void; - /** * Adds a listener to an event type. * @param type The type of the listener that gets removed. @@ -947,6 +1010,9 @@ declare namespace THREE { * @param type The type of event that gets fired. */ dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + + // deprecated + apply(target: any): void; } export interface Event { @@ -1058,7 +1124,7 @@ declare namespace THREE { * * @see https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js */ - export class Geometry { + export class Geometry extends EventDispatcher { constructor(); /** @@ -1277,7 +1343,7 @@ declare namespace THREE { */ export class InstancedBufferAttribute extends BufferAttribute { constructor(data: ArrayLike, itemSize: number, meshPerAttribute?: number); - + meshPerAttribute: number; clone(): InstancedBufferAttribute; @@ -1292,7 +1358,7 @@ declare namespace THREE { groups: {start:number, count:number, instances:number}[]; maxInstancedCount: number; - + addGroup(start: number, count: number, instances: number): void; clone(): InstancedBufferGeometry; copy(source: InstancedBufferGeometry): InstancedBufferGeometry; @@ -1326,7 +1392,7 @@ declare namespace THREE { */ export class InstancedInterleavedBuffer extends InterleavedBuffer { constructor(array: ArrayLike, stride: number, meshPerAttribute?: number); - + meshPerAttribute: number; clone(): InstancedInterleavedBuffer; @@ -1337,13 +1403,15 @@ declare namespace THREE { * @see src/core/InterleavedBufferAttribute.js */ export class InterleavedBufferAttribute { - constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number); + constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized: boolean); uuid: string; data: InterleavedBuffer; itemSize: number; offset: number; count: number; + normalized: boolean; + array: any[]; getX(index: number): number; setX(index: number, x: number): InterleavedBufferAttribute; @@ -1365,7 +1433,7 @@ declare namespace THREE { /** * Base class for scene graph objects */ - export class Object3D { + export class Object3D extends EventDispatcher { constructor(); /** @@ -1409,7 +1477,6 @@ declare namespace THREE { * Object's local rotation (Euler angles), in radians. */ rotation: Euler; - eulerOrder: string; // deprecated, use rotation.order /** * Global rotation. @@ -1425,11 +1492,6 @@ declare namespace THREE { normalMatrix: Matrix3; - /** - * When this is set, then the rotationMatrix gets calculated every frame. - */ - rotationAutoUpdate: boolean; - /** * Local transform. */ @@ -1539,7 +1601,6 @@ declare namespace THREE { * @param distance The distance to translate. */ translateOnAxis(axis: Vector3, distance: number): Object3D; - translate(distance: number, axis: Vector3): Object3D; // deprecated, use translateOnAxis(axis, distance) /** * Translates object along x axis by distance. @@ -1636,13 +1697,10 @@ declare namespace THREE { */ copy(source: Object3D, recursive?: boolean): Object3D; - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; - - getChildByName(name: string): Object3D; // deprecated, use getObjectByName() + // deprecated + eulerOrder: string; + getChildByName(name: string): Object3D; + translate(distance: number, axis: Vector3): Object3D; } export interface Intersection { @@ -1672,7 +1730,7 @@ declare namespace THREE { params: RaycasterParameters; precision: number; linePrecision: number; - + set(origin: Vector3, direction: Vector3): void; setFromCamera(coords: { x: number; y: number;}, camera: Camera ): void; intersectObject(object: Object3D, recursive?: boolean): Intersection[]; @@ -1692,9 +1750,9 @@ declare namespace THREE { } export class Font { - constructor(data: any); + constructor(jsondata: string); - data: any; + data: string; generateShapes(text: string, size: number, divisions: number): any[]; } @@ -1793,6 +1851,8 @@ declare namespace THREE { clone(recursive?: boolean): HemisphereLight; } + export class DirectionalLightShadow extends LightShadow {} + export class HemisphereLight extends Light { constructor(skyColorHex?: number|string, groundColorHex?: number|string, intensity?: number); @@ -1871,13 +1931,18 @@ declare namespace THREE { exponent: number; decay: number; - shadow: LightShadow; + shadow: SpotLightShadow; power: number; + penumbra: number; clone(recursive?: boolean): SpotLight; copy(source: PointLight): SpotLight; } + export class SpotLightShadow extends LightShadow { + update(light: Light): void; + } + // Loaders ////////////////////////////////////////////////////////////////////////////////// /** @@ -1943,17 +2008,18 @@ declare namespace THREE { withCredentials: boolean; load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): any; - setPath(path: string): void; - setResponseType(responseType: string): void; - setWithCredentials(withCredentials: boolean): void; + setPath(path: string): XHRLoader; + setResponseType(responseType: string): XHRLoader; + setWithCredentials(withCredentials: boolean): XHRLoader; } export class FontLoader { - constructor(manager?: LoadingManager); + constructor(manager?: LoadingManager);F manager: LoadingManager; load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; + parse(json: string): Font; } /** @@ -1972,8 +2038,8 @@ declare namespace THREE { * @param url */ load(url: string, onLoad?: (image: HTMLImageElement) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): HTMLImageElement; - setCrossOrigin(crossOrigin: string): void; - setPath(value: any): void; + setCrossOrigin(crossOrigin: string): ImageLoader; + setPath(value: any): ImageLoader; } /** @@ -1984,7 +2050,6 @@ declare namespace THREE { manager: LoadingManager; withCredentials: boolean; - statusDomElement: HTMLElement; // readonly and deprecated load(url: string, onLoad?: (geometry: Geometry, materials: Material[]) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; setTexturePath( value: string ): void; @@ -2081,8 +2146,8 @@ declare namespace THREE { * @param url */ load(url: string, onLoad?: (texture: Texture) => void): Texture; - setCrossOrigin(crossOrigin: string): void; - setPath(path: string): void; + setCrossOrigin(crossOrigin: string): TextureLoader; + setPath(path: string): TextureLoader; } export class CubeTextureLoader { @@ -2093,8 +2158,8 @@ declare namespace THREE { path: string; load(urls: Array, onLoad?: (texture: CubeTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; - setPath(path: string): void; + setCrossOrigin(crossOrigin: string): CubeTextureLoader; + setPath(path: string): CubeTextureLoader; } export class BinaryTextureLoader { @@ -2113,7 +2178,13 @@ declare namespace THREE { path: string; load(url: string, onLoad: (texture: CompressedTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setPath(path: string): void; + setPath(path: string): CompressedTextureLoader; + } + + export class AudioLoader { + constructor(manager?: LoadingManager); + + load(url: string, onLoad: Function, onPrgress: Function, onError: Function): void; } export namespace Cache { @@ -2153,12 +2224,16 @@ declare namespace THREE { premultipliedAlpha?: boolean; overdraw?: number; visible?: boolean; + fog?: boolean; + lights?: boolean; + shading?: Shading; + vertexColors?: Colors; } /** * Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer. */ - export class Material { + export class Material extends EventDispatcher { constructor(); /** @@ -2229,6 +2304,9 @@ declare namespace THREE { */ depthWrite: boolean; + clippingPlanes: any; + clipShadows: boolean; + colorWrite: boolean; precision: any; @@ -2271,7 +2349,10 @@ declare namespace THREE { */ needsUpdate: boolean; - warpRGB: Color; // deprecated, returns a new Color intance + fog: boolean; + lights: boolean; + shading: Shading; + vertexColors: Colors; setValues(parameters: MaterialParameters): void; toJSON(meta?: any): any; @@ -2280,11 +2361,8 @@ declare namespace THREE { update(): void; dispose(): void; - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + // deprecated + warpRGB: Color; } export interface LineBasicMaterialParameters extends MaterialParameters { @@ -2292,9 +2370,6 @@ declare namespace THREE { linewidth?: number; linecap?: string; linejoin?: string; - blending?: Blending; - vertexColors?: Colors; - fog?: boolean; } export class LineBasicMaterial extends Material { @@ -2304,9 +2379,6 @@ declare namespace THREE { linewidth: number; linecap: string; linejoin: string; - blending: Blending; - vertexColors: Colors; - fog: boolean; setValues(parameters: LineBasicMaterialParameters): void; clone(): LineBasicMaterial; @@ -2319,9 +2391,6 @@ declare namespace THREE { scale?: number; dashSize?: number; gapSize?: number; - blending?: Blending; - vertexColors?: Colors; - fog?: boolean; } export class LineDashedMaterial extends Material { @@ -2332,9 +2401,6 @@ declare namespace THREE { scale: number; dashSize: number; gapSize: number; - blending: Blending; - vertexColors: Colors; - fog: boolean; setValues(parameters: LineDashedMaterialParameters): void; clone(): LineDashedMaterial; @@ -2357,15 +2423,12 @@ declare namespace THREE { reflectivity?: number; refractionRatio?: number; shading?: Shading; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; - fog?: boolean; } export class MeshBasicMaterial extends Material { @@ -2381,14 +2444,11 @@ declare namespace THREE { combine: Combine; reflectivity: number; refractionRatio: number; - fog: boolean; shading: Shading; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; @@ -2429,13 +2489,10 @@ declare namespace THREE { combine?: Combine; reflectivity?: number; refractionRatio?: number; - fog?: boolean; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; @@ -2445,7 +2502,7 @@ declare namespace THREE { constructor(parameters?: MeshLambertMaterialParameters); color: Color; - emissive: Color; + emissive: number|string; emissiveIntensity: number; emissiveMap: Texture; map: Texture; @@ -2459,13 +2516,10 @@ declare namespace THREE { combine: Combine; reflectivity: number; refractionRatio: number; - fog: boolean; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; morphNormals: boolean; @@ -2500,20 +2554,17 @@ declare namespace THREE { envMap?: Texture; envMapIntensity?: number; refractionRatio?: number; - shading?: Shading; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; - fog?: boolean; } export class MeshStandardMaterial extends Material { constructor(parameters?: MeshStandardMaterialParameters); + defines: any; color: Color; roughness: number; metalness: number; @@ -2538,40 +2589,17 @@ declare namespace THREE { envMap: Texture; envMapIntensity: number; refractionRatio: number; - shading: Shading; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; morphNormals: boolean; - fog: boolean; setValues(parameters: MeshStandardMaterialParameters): void; clone(): MeshStandardMaterial; copy(source: MeshStandardMaterial): MeshStandardMaterial; } - export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialParameters { - reflectivity?: number; - clearCoat?: number; - clearCoatRoughness?: number; - } - - export class MeshPhysicalMaterial extends MeshStandardMaterial { - constructor(parameters?: MeshPhysicalMaterialParameters); - - defines: any; - reflectivity: number; - clearCoat: number; - clearCoatRoughness: number; - - setValues(parameters: MeshPhysicalMaterialParameters): void; - clone(): MeshPhysicalMaterial; - copy(source: MeshPhysicalMaterial): MeshPhysicalMaterial; - } - export interface MeshNormalMaterialParameters extends MaterialParameters { /** Render geometry as wireframe. Default is false (i.e. render as smooth shaded). */ wireframe?: boolean; @@ -2619,17 +2647,13 @@ declare namespace THREE { combine?: Combine; reflectivity?: number; refractionRatio?: number; - shading?: Shading; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; - fog?: boolean; } export class MeshPhongMaterial extends Material { @@ -2659,14 +2683,10 @@ declare namespace THREE { combine: Combine; reflectivity: number; refractionRatio: number; - fog: boolean; - shading: Shading; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; morphNormals: boolean; @@ -2677,6 +2697,21 @@ declare namespace THREE { copy(source: MeshPhongMaterial): MeshPhongMaterial; } + export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialParameters { + reflectivity?: number; + clearCoat?: number; + clearCoatRoughness?: number; + } + + export class MeshPhysicalMaterial extends MeshStandardMaterial { + constructors(parameters: MeshPhysicalMaterialParameters); + + defines: any; + reflectivity: number; + clearCoat: number; + clearCoatRoughness: number; + } + // MultiMaterial does not inherit the Material class in the original code. However, it should treat as Material class. // See tests/canvas/canvas_materials.ts. export class MultiMaterial extends Material { @@ -2695,9 +2730,6 @@ declare namespace THREE { map?: Texture; size?: number; sizeAttenuation?: boolean; - blending?: Blending; - vertexColors?: Colors; - fog?: boolean; } export class PointsMaterial extends Material { @@ -2707,31 +2739,26 @@ declare namespace THREE { map: Texture; size: number; sizeAttenuation: boolean; - blending: Blending; - vertexColors: boolean; - fog: boolean; setValues(parameters: PointsMaterialParameters): void; clone(): PointsMaterial; copy(source: PointsMaterial): PointsMaterial; } - export class PointCloudMaterial extends PointsMaterial {} // deprecated, use PointsMaterial - export class ParticleBasicMaterial extends PointsMaterial {} // deprecated, use PointsMaterial - export class ParticleSystemMaterial extends PointsMaterial {} // deprecated, use PointsMaterial + export class PointCloudMaterial extends PointsMaterial {} // deprecated + export class ParticleBasicMaterial extends PointsMaterial {} // deprecated + export class ParticleSystemMaterial extends PointsMaterial {} // deprecated export interface ShaderMaterialParameters extends MaterialParameters { defines?: any; - uniforms?: any; + uniforms?: any; vertexShader?: string; fragmentShader?: string; - shading?: Shading; lineWidth?: number; wireframe?: boolean; wireframeLinewidth?: number; - fog?: boolean; lights?: boolean; - vertexColors?: Colors; + clipping?: boolean; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; @@ -2741,16 +2768,14 @@ declare namespace THREE { constructor(parameters?: ShaderMaterialParameters); defines: any; - uniforms: any; + uniforms: any; // type should be { [uniform: string]: { value: any }; }; but gives "Index signature is missing in type" error during compilation vertexShader: string; fragmentShader: string; - shading: Shading; linewidth: number; wireframe: boolean; wireframeLinewidth: number; - fog: boolean; lights: boolean; - vertexColors: Colors; + clipping: boolean; skinning: boolean; morphTargets: boolean; morphNormals: boolean; @@ -2773,7 +2798,6 @@ declare namespace THREE { color?: number|string; map?: Texture; rotation?: number; - fog?: boolean; } export class SpriteMaterial extends Material { @@ -2782,13 +2806,16 @@ declare namespace THREE { color: Color; map: Texture; rotation: number; - fog: boolean; setValues(parameters: SpriteMaterialParameters): void; clone(): SpriteMaterial; copy(source: SpriteMaterial): SpriteMaterial; } + export class ShadowMaterial extends ShaderMaterial { + constructor(parameters?: ShaderMaterialParameters); + } + // Math ////////////////////////////////////////////////////////////////////////////////// export class Box2 { @@ -2803,7 +2830,6 @@ declare namespace THREE { clone(): Box2; copy(box: Box2): Box2; makeEmpty(): Box2; - empty(): any; // deprecated, use isEmpty() isEmpty(): boolean; center(optionalTarget?: Vector2): Vector2; size(optionalTarget?: Vector2): Vector2; @@ -2821,6 +2847,7 @@ declare namespace THREE { translate(offset: Vector2): Box2; equals(box: Box2): boolean; + empty(): any; // deprecated, use isEmpty() isIntersectionBox(b: any): any; // deprecated, use intersectsBox() } @@ -2858,7 +2885,7 @@ declare namespace THREE { applyMatrix4(matrix: Matrix4): Box3; translate(offset: Vector3): Box3; equals(box: Box3): boolean; - + empty(): any; // deprecated, use isEmpty() isIntersectionBox(b: any): any; // deprecated, use intersectsBox() isIntersectionSphere(s: any): any; // deprecated, use intersectsSphere() @@ -2985,6 +3012,7 @@ declare namespace THREE { add(color: Color): Color; addColors(color1: Color, color2: Color): Color; addScalar(s: number): Color; + sub(color: Color): Color; multiply(color: Color): Color; multiplyScalar(s: number): Color; lerp(color: Color, alpha: number): Color; @@ -3145,7 +3173,7 @@ declare namespace THREE { export class Euler { constructor(x?: number, y?: number, z?: number, order?: string); - + x: number; y: number; z: number; @@ -3185,6 +3213,7 @@ declare namespace THREE { copy(frustum: Frustum): Frustum; setFromMatrix(m: Matrix4): Frustum; intersectsObject(object: Object3D): boolean; + intersectsObject(sprite: Sprite): boolean; intersectsSphere(sphere: Sphere): boolean; intersectsBox(box: Box3): boolean; containsPoint(point: Vector3): boolean; @@ -3215,6 +3244,9 @@ declare namespace THREE { * @see src/math/Math.js */ export namespace Math { + export const DEG2RAD: number; + export const RAD2DEG: number; + export function generateUUID(): string; /** @@ -3335,27 +3367,16 @@ declare namespace THREE { clone(): Matrix3; copy(m: Matrix3): Matrix3; setFromMatix4(m: Matrix4): Matrix3; - - /** - * @deprecated Use applyToVector3Array() - */ - multiplyVector3Array(a: any): any; applyToVector3Array(array: number[], offset?: number, length?: number): number[]; applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; multiplyScalar(s: number): Matrix3; determinant(): number; getInverse(matrix: Matrix3, throwOnDegenerate?: boolean): Matrix3; - /** - * @deprecated No longer takes a Matrix4 argument. - */ - getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; - /** * Transposes this matrix in place. */ transpose(): Matrix3; - flattenToArrayOffset(array: number[], offset: number): number[]; getNormalMatrix(matrix4: Matrix4): Matrix3; /** @@ -3365,10 +3386,11 @@ declare namespace THREE { fromArray(array: number[]): Matrix3; toArray(): number[]; - /** - * @deprecated Use vector.applyMatrix3( matrix ) - */ + // deprecated multiplyVector3(vector: Vector3): any; + multiplyVector3Array(a: any): any; + getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; + flattenToArrayOffset(array: number[], offset: number): number[]; } /** @@ -3408,7 +3430,6 @@ declare namespace THREE { identity(): Matrix4; clone(): Matrix4; copy(m: Matrix4): Matrix4; - extractPosition(m: Matrix4): Matrix4; // deprecated, use copyPosition() copyPosition(m: Matrix4): Matrix4; extractBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; makeBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; @@ -3418,7 +3439,6 @@ declare namespace THREE { */ extractRotation(m: Matrix4): Matrix4; makeRotationFromEuler(euler: Euler): Matrix4; - setRotationFromQuaternion(q: Quaternion): Matrix4; // deprecated, use makeRotationFromQuaternion() makeRotationFromQuaternion(q: Quaternion): Matrix4; /** * Constructs a rotation matrix, looking from eye towards center with defined up vector. @@ -3430,6 +3450,8 @@ declare namespace THREE { */ multiply(m: Matrix4): Matrix4; + premultiply(m: Matrix4): Matrix4; + /** * Sets this matrix to a x b. */ @@ -3445,7 +3467,6 @@ declare namespace THREE { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; - multiplyVector3Array(array: number[]): number[]; // deprecated, use applyToVector3Array() applyToVector3Array(array: number[], offset?: number, length?: number): number[]; applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; /** @@ -3459,16 +3480,13 @@ declare namespace THREE { */ transpose(): Matrix4; - /** - * Flattens this matrix into supplied flat array starting from offset position in the array. - */ - flattenToArrayOffset(array: number[], offset: number): number[]; + /** * Sets the position component for this matrix from vector v. */ setPosition(v: Vector3): Matrix4; - + /** * Sets this matrix to the inverse of matrix m. @@ -3551,26 +3569,15 @@ declare namespace THREE { fromArray(array: number[]): Matrix4; toArray(): number[]; - /** - * @deprecated Use Vector3.setFromMatrixPosition( matrix ) - */ - getPosition(): any; - /** - * @deprecated Use Vector3.applyMatrix4( matrix ) or Vector3.applyProjection( matrix ) - */ + // deprecated + extractPosition(m: Matrix4): Matrix4; + setRotationFromQuaternion(q: Quaternion): Matrix4; multiplyVector3(v: any): any; - /** - * @deprecated Use Vector3.applyMatrix4( matrix ) - */ multiplyVector4(v: any): any; - /** - * @deprecated Use Vector3.transformDirection( matrix ) - */ + multiplyVector3Array(array: number[]): number[]; rotateAxis(v: any): void; - /** - * @deprecated Use Vector3.applyMatrix( matrix ) - */ crossVector(v: any): void; + flattenToArrayOffset(array: number[], offset: number): number[]; } export class Plane { @@ -3599,13 +3606,14 @@ declare namespace THREE { translate(offset: Vector3): Plane; equals(plane: Plane): boolean; - isIntersectionLine(l: any): any; // deprecated, use instersectsLine() + // deprecated + isIntersectionLine(l: any): any; } export class Spherical { constructor(radius?: number, phi?: number, theta?: number); - set(radius: number, phi: number, theta: number): void; + set(radius: number, phi: number, theta: number): Spherical; clone(): Spherical; copy(other: Spherical): Spherical; makeSafe(): void; @@ -3690,6 +3698,7 @@ declare namespace THREE { * Multiplies this quaternion by b. */ multiply(q: Quaternion): Quaternion; + premultiply(q: Quaternion): Quaternion; /** * Sets this quaternion to a x b @@ -3697,7 +3706,6 @@ declare namespace THREE { */ multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion; - multiplyVector3(v: any): any; // deprecated, use vector.applyQuaternion( quaternion ) slerp(qb: Quaternion, t: number): Quaternion; equals(v: Quaternion): boolean; @@ -3714,8 +3722,11 @@ declare namespace THREE { * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/. */ static slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): Quaternion; - + static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number, t: number): Quaternion; + + // deprecated + multiplyVector3(v: any): any; } export class Ray { @@ -3744,10 +3755,11 @@ declare namespace THREE { intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; applyMatrix4(matrix4: Matrix4): Ray; equals(ray: Ray): boolean; - - isIntersectionSphere(s: any): any; // deprecated, use intersectsSphere() - isIntersectionPlane(p: any): any; // deprecated, use intersectsPlane() - isIntersectionBox(b: any): any; // deprecated, use intersectsBox() + + // deprecated + isIntersectionBox(b: any): any; + isIntersectionPlane(p: any): any; + isIntersectionSphere(s: any): any; } export class Sphere { @@ -3843,6 +3855,7 @@ declare namespace THREE { plane(optionalTarget?: Vector3): Plane; barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3; containsPoint(point: Vector3): boolean; + closestPointToPoint(): Vector3; equals(triangle: Triangle): boolean; static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3; @@ -4094,6 +4107,7 @@ declare namespace THREE { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector2): number; + distanceToManhattan(v: Vector2): number; /** * Normalizes this vector and multiplies it by l. @@ -4210,7 +4224,7 @@ declare namespace THREE { applyMatrix4(m: Matrix4): Vector3; applyProjection(m: Matrix4): Vector3; applyQuaternion(q: Quaternion): Vector3; - project(camera: Camera): Vector3; + project(camrea: Camera): Vector3; unproject(camera: Camera): Vector3; transformDirection(m: Matrix4): Vector3; divide(v: Vector3): Vector3; @@ -4292,15 +4306,12 @@ declare namespace THREE { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector3): number; + distanceToManhattan(v: Vector3): number; setFromSpherical(s: Spherical): Matrix3; - getPositionFromMatrix(m: Matrix4): Vector3; // deprecated, use setFromMatrixPosition() setFromMatrixPosition(m: Matrix4): Vector3; - getScaleFromMatrix(m: Matrix4): Vector3; // deprecated, use setFromMatrixScale() setFromMatrixScale(m: Matrix4): Vector3; - getColumnFromMatrixColumn(index: number, matrix: Matrix4): Vector3; // deprecated, use setFromMatrixColumn() setFromMatrixColumn(matrix: Matrix4, index: number): Vector3; - setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; // deprecated, now expects ( matrix, index ) /** * Checks for strict equality of this vector and v. @@ -4308,13 +4319,16 @@ declare namespace THREE { equals(v: Vector3): boolean; fromArray(xyz: number[], offset?: number): Vector3; - toArray(xyz?: number[], offset?: number): number[]; - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; + + // deprecated + getPositionFromMatrix(m: Matrix4): Vector3; + getScaleFromMatrix(m: Matrix4): Vector3; + getColumnFromMatrix(index: number, matrix: Matrix4): Vector3; } - export class Vertex extends Vector3 {} // deprecated, use Vector3 + export class Vertex extends Vector3 {} // deprecated /** * 4D vector. @@ -4338,7 +4352,7 @@ declare namespace THREE { * Sets all values of this vector. */ setScalar(scalar: number): Vector4; - + /** * Sets X component of this vector. */ @@ -4491,7 +4505,7 @@ declare namespace THREE { interpolate_(i1: number, t0: number, t: number, t1: number): any; } - + export class DiscreteInterpolant extends Interpolant { constructor(parameterPositions: any, samplesValues: any, sampleSize: number, resultBuffer?: any); @@ -4529,16 +4543,17 @@ declare namespace THREE { constructor(); levels: any[]; - objects: any[]; // deprecated, use .levels addLevel(object: Object3D, distance?: number): void; getObjectForDistance(distance: number): Object3D; raycast(raycaster: Raycaster, intersects: any): void; update(camera: Camera): void; - clone(): LOD; copy(source: LOD): LOD; toJSON(meta: any): any; + + // deprecated + objects: any[]; } export interface LensFlareProperty { @@ -4584,6 +4599,9 @@ declare namespace THREE { copy(source: Line): Line; } + export const LineStrip: number; // deprecated + export const LinePieces: number; // deprecated + export class LineSegments extends Line { constructor( geometry?: Geometry | BufferGeometry, @@ -4596,8 +4614,6 @@ declare namespace THREE { } enum LineMode {} - var LineStrip: LineMode; // deprecated - var LinePieces: LineMode; // deprecated export class Mesh extends Object3D { constructor(geometry?: Geometry, material?: Material); @@ -4646,8 +4662,8 @@ declare namespace THREE { copy(source: Points): Points; } - export class PointCloud extends Points {} // deprecated, use Points - export class ParticleSystem extends Points {} // deprecated, use Points + export class PointCloud extends Points {} // deprecated + export class ParticleSystem extends Points {} // deprecated export class Skeleton { constructor(bones: Bone[], boneInverses?: Matrix4[], useVertexTexture?: boolean); @@ -4700,15 +4716,16 @@ declare namespace THREE { copy(source: Sprite): Sprite; } - export class Particle extends Sprite {} // deprecated, use Sprite + export class Particle extends Sprite {} // deprecated // Renderers ////////////////////////////////////////////////////////////////////////////////// export interface Renderer { + domElement: HTMLCanvasElement; + render(scene: Scene, camera: Camera): void; setSize(width:number, height:number, updateStyle?:boolean): void; - domElement: HTMLCanvasElement; } export interface WebGLRendererParameters { @@ -4814,9 +4831,10 @@ declare namespace THREE { */ sortObjects: boolean; - extensions: WebGLExtensions; + clippingPlanes: any[]; + localClippingEnabled: boolean; - gammaFactor: number; // deprecated + extensions: WebGLExtensions; /** * Default is false. @@ -4848,11 +4866,6 @@ declare namespace THREE { */ maxMorphNormals: number; - /** - * Default is true. - */ - autoScaleCubemaps: boolean; - /** * An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields: */ @@ -4871,15 +4884,13 @@ declare namespace THREE { }; shadowMap: WebGLShadowMap; - shadowMapType: ShadowMapType; // deprecated, use shadowMap.type - shadowMapEnabled: boolean; // deprecated, use shadowMap.enabled - shadowMapCullFace: CullFace; // deprecated, use shadowMap.cullFace pixelRation: number; capabilities: WebGLCapabilities; properties: WebGLProperties; state: WebGLState; + allocTextureUnit: any; /** * Return the WebGL context. @@ -4892,7 +4903,7 @@ declare namespace THREE { getPrecision(): string; getPixelRatio(): number; setPixelRatio(value: number): void; - + getSize(): { width: number; height: number; }; /** @@ -4926,12 +4937,12 @@ declare namespace THREE { setClearColor(color: Color, alpha?: number): void; setClearColor(color: string, alpha?: number): void; setClearColor(color: number, alpha?: number): void; - + /** * Returns a float with the current clear alpha. Ranges from 0 to 1. */ getClearAlpha(): number; - + setClearAlpha(alpha: number): void; /** @@ -4971,24 +4982,31 @@ declare namespace THREE { * @param frontFace "ccw" or "cw */ setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void; - setTexture(texture: Texture, slot: number): void; + setTexture(texture: Texture, slot: number): void; // deprecated + setTexture2D(texture: Texture, slot: number): void; + setTextureCube(texture: Texture, slot: number): void; getCurrentRenderTarget(): RenderTarget; setRenderTarget(renderTarget: RenderTarget): void; readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; - supportsFloatTextures(): any; // deprecated - supportsHalfFloatTextures(): any; // deprecated - supportsStandardDerivatives(): any; // deprecated - supportsCompressedTextureS3TC(): any; // deprecated - supportsCompressedTexturePVRTC(): any; // deprecated - supportsBlendMinMax(): any; // deprecated - supportsVertexTextures(): any; // deprecated - supportsInstancedArrays(): any; // deprecated - enableScissorTest(boolean: any): any; // deprecated + // deprecated + gammaFactor: number; + shadowMapEnabled: boolean; + shadowMapType: ShadowMapType; + shadowMapCullFace: CullFace; + + supportsFloatTextures(): any; + supportsHalfFloatTextures(): any; + supportsStandardDerivatives(): any; + supportsCompressedTextureS3TC(): any; + supportsCompressedTexturePVRTC(): any; + supportsBlendMinMax(): any; + supportsVertexTextures(): any; + supportsInstancedArrays(): any; + enableScissorTest(boolean: any): any; } - export interface RenderTarget { - } + export interface RenderTarget {} // not defined in the code, used in LightShadow and WebGRenderer classes export interface WebGLRenderTargetOptions { wrapS?: Wrapping; @@ -5002,7 +5020,7 @@ declare namespace THREE { stencilBuffer?: boolean; // true; } - export class WebGLRenderTarget implements RenderTarget { + export class WebGLRenderTarget extends EventDispatcher { constructor(width: number, height: number, options?: WebGLRenderTargetOptions); uuid: string; @@ -5014,6 +5032,7 @@ declare namespace THREE { texture: Texture; depthBuffer: boolean; stencilBuffer: boolean; + depthTexture: Texture; wrapS: any; // deprecated, use texture.wrapS wrapT: any; // deprecated, use texture.wrapT magFilter: any; // deprecated, use texture.magFilter @@ -5029,12 +5048,6 @@ declare namespace THREE { clone(): WebGLRenderTarget; copy(source: WebGLRenderTarget): WebGLRenderTarget; dispose(): void; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; } export class WebGLRenderTargetCube extends WebGLRenderTarget { @@ -5057,6 +5070,10 @@ declare namespace THREE { beginnormal_vertex: string; bsdfs: string; bumpmap_pars_fragment: string; + clipping_planes_fragment: string; + clipping_planes_pars_fragment: string; + clipping_planes_pars_vertex: string; + clipping_planes_vertex: string; color_fragment: string; color_pars_fragment: string; color_pars_vertex: string; @@ -5068,8 +5085,6 @@ declare namespace THREE { defaultnormal_vertex: string; depth_frag: string; depth_vert: string; - depthRGBA_frag: string; - depthRGBA_vert: string; distanceRGBA_frag: string; distanceRGBA_vert: string; displacementmap_vertex: string; @@ -5094,10 +5109,8 @@ declare namespace THREE { lights_pars: string; lights_phong_fragment: string; lights_phong_pars_fragment: string; - lights_phong_pars_vertex: string; - lights_phong_vertex: string; - lights_standard_fragment: string; - lights_standard_pars_fragment: string; + lights_physical_fragment: string; + lights_physical_pars_fragment: string; lights_template: string; logdepthbuf_fragment: string; logdepthbuf_pars_fragment: string; @@ -5113,19 +5126,24 @@ declare namespace THREE { meshlambert_vert: string; meshphong_frag: string; meshphong_vert: string; - meshstandard_frag: string; - meshstandard_vert: string; + meshphysical_frag: string; + meshphysical_vert: string; metalnessmap_fragment: string; metalnessmap_pars_fragment: string; morphnormal_vertex: string; morphtarget_pars_vertex: string; morphtarget_vertex: string; + normal_flip: string; normal_frag: string; normal_fragment: string; normal_vert: string; normalmap_pars_fragment: string; + packing: string; points_frag: string; points_vert: string; + shadow_frag: string; + shadow_vert: string; + premultiplied_alpha_fragment: string; project_vertex: string; roughnessmap_fragment: string; @@ -5152,7 +5170,7 @@ declare namespace THREE { } export interface Shader { - uniforms: any; + uniforms: IUniform; vertexShader: string; fragmentShader: string; } @@ -5171,10 +5189,10 @@ declare namespace THREE { equirect: Shader; depthRGBA: Shader; distanceRGBA: Shader; + physical: Shader; }; export interface IUniform { - type: string; value: any; } @@ -5224,61 +5242,57 @@ declare namespace THREE { lights: { ambientLightColor: IUniform directionalLights: { - type: string; value: any[]; properties: { - direction: { type: string }; - color: { type: string }; - shadow: { type: string }; - shadowBias: { type: string }; - shadowRadius: { type: string }; - shadowMapSize: { type: string }; + direction: {}; + color: {}; + shadow: {}; + shadowBias: {}; + shadowRadius: {}; + shadowMapSize: {}; }; }; directionalShadowMap: IUniform; directionalShadowMatrix: IUniform; spotLights: { - type: string; value: any[]; properties: { - color: { type: string }; - position: { type: string }; - direction: { type: string }; - distance: { type: string }; - coneCos: { type: string }; - penumbraCos: { type: string }; - decay: { type: string }; - shadow: { type: string }; - shadowBias: { type: string }; - shadowRadius: { type: string }; - shadowMapSize: { type: string }; + color: {}; + position: {}; + direction: {}; + distance: {}; + coneCos: {}; + penumbraCos: {}; + decay: {}; + shadow: {}; + shadowBias: {}; + shadowRadius: {}; + shadowMapSize: {}; }; }; spotShadowMap: IUniform; spotShadowMatrix: IUniform; pointLights: { - type: string; value: any[]; properties: { - color: { type: string }; - position: { type: string }; - decay: { type: string }; - distance: { type: string }; - shadow: { type: string }; - shadowBias: { type: string }; - shadowRadius: { type: string }; - shadowMapSize: { type: string }; + color: {}; + position: {}; + decay: {}; + distance: {}; + shadow: {}; + shadowBias: {}; + shadowRadius: {}; + shadowMapSize: {}; }; }; pointShadowMap: IUniform; pointShadowMatrix: IUniform; hemisphereLigtts: { - type: string; value: any[]; properties: { - direction: { type: string }; - skycolor: { type: string }; - groundColor: { type: string }; + direction: {}; + skycolor: {}; + groundColor: {}; }; }; }; @@ -5297,11 +5311,12 @@ declare namespace THREE { export function clone(uniforms_src: any): any; } - export class Uniform { - constructor(type: string, value: string); + export class Uniform { + constructor(value: any); + constructor(type: string, value: any); // deprecated - type: string; - value: string; + type: string; // deprecated + value: any; dynamic: boolean; onUpdateCallback: Function; @@ -5313,10 +5328,20 @@ declare namespace THREE { constructor(_gl: WebGLRenderingContext, extensions: any, _infoRender: any); setMode(value: any): void; - render(start: any, count: any): void; + render(start: any, count: number): void; renderInstances(geometry: any): void; } + export class WebGLClipping { + uniform: { value: any, needsUpdate: boolean }; + numPlanes: number; + + init(planes: any[], enableLocalClipping: boolean, camera: Camera): boolean; + beginShadows(): void; + endShadows(): void; + setState(planes: any[], clipShadows: boolean, camera: Camera, cache: boolean, fromCache: boolean): void; + } + export interface WebGLCapabilitiesParameters { precision?: any; logarithmicDepthBuffer?: any; @@ -5339,7 +5364,8 @@ declare namespace THREE { floatFragmentTextures: any; floatVertexTextures: any; - getMaxPrecision(precision: any): any; + getMaxAnisotropy(): number; + getMaxPrecision(precision: string): string; } export class WebGLExtensions { @@ -5356,7 +5382,7 @@ declare namespace THREE { export class WebGLLights { constructor(gl: WebGLRenderingContext, properties: any, info: any); - + get(light: any): any; } @@ -5368,7 +5394,7 @@ declare namespace THREE { render(start: any, count: number): void; renderInstances(geometry: any, start: any, count: number): void; } - + export class WebGLObjects { constructor(gl: WebGLRenderingContext, properties: any, info: any); @@ -5379,7 +5405,7 @@ declare namespace THREE { export class WebGLProgram { constructor(renderer: WebGLRenderer, code: string, material: ShaderMaterial, parameters: WebGLRendererParameters); - + id: number; code: string; usedTimes: number; @@ -5389,7 +5415,7 @@ declare namespace THREE { uniforms: any; // deprecated, use getUniforms() attributes: any; // deprecated, use getAttributes() - getUniforms(): any; + getUniforms(): WebGLUniforms; getAttributes(): any; destroy(): void; } @@ -5399,12 +5425,37 @@ declare namespace THREE { programs: any[]; - getParameters(material: ShaderMaterial, lights: any, fog: any, object: any): any[]; + getParameters(material: ShaderMaterial, lights: any, fog: any, nClipPlanes: number, object: any): any; getProgramCode(material: ShaderMaterial, parameters: any): string; acquireProgram(material: ShaderMaterial, parameters: any, code: string): WebGLProgram; releaseProgram(program: WebGLProgram): void; } + export class WebGLTextures { + constructor(gl: any, extensions: any, state: any, properties:any, capabilities: any, paramThreeToGL: Function, info: any); + + setTexture2D(texture: any, slot: number): void; + setTextureCube(texture: any, slot: number): void; + setTextureCubeDynamic(texture: any, slot: number): void; + setupRenderTarget(renderTarget: any): void; + updateRenderTargetMipmap(renderTarget: any): void; + } + + export class WebGLUniforms { + constructor(gl: any, program: WebGLProgram, renderer: WebGLRenderer); + + renderer: WebGLRenderer; + + setValue(gl: any, value: any, renderer?: any): void; + set(gl: any, object: any, name: string): void; + setOptional(gl: any, object: any, name: string): void; + + static upload(gl: any, seq: any, values: any[], renderer: any): void; + static seqWithValue(seq: any, values: any[]): any[]; + static splitDynamic(seq: any, values: any[]): any[]; + static evalDynamic(seq: any, values: any[], object: any, camera: any): any[]; + } + export class WebGLProperties { constructor(); @@ -5418,20 +5469,30 @@ declare namespace THREE { } export class WebGLShadowMap { - constructor(_renderer: Renderer, _lights: any[], _objects: any[]); + constructor(_renderer: Renderer, _lights: any[], _objects: any[], capabilities: any); enabled: boolean; autoUpdate: boolean; needsUpdate: boolean; type: ShadowMapType; - cullFace: CullFace; + renderReverseSided: boolean; + renderSingleSided: boolean; render(scene: Scene, camera: Camera): void; - } + // deprecated + cullFace: any; + } + export class WebGLState { constructor(gl: any, extensions: any, paramThreeToGL: Function); + buffers: { + color: WebGLColorBuffer, + depth: WebGLDepthBuffer, + stencil: WebGLStencilBuffer, + }; + init(): void; initAttributes(): void; enableAttribute(attribute: string): void; @@ -5441,15 +5502,16 @@ declare namespace THREE { disable(id: string): void; getCompressedTextureFormats(): any[]; setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number): void; - setDepthFunc(func: Function): void; + setColorWrite(colorWrite: number): void; setDepthTest(depthTest: number): void; setDepthWrite(depthWrite: number): void; - setColorWrite(colorWrite: number): void; - setStencilFunc(stencilFunc: Function, stencilRef: any, stencilMask: any): void; - setStencilOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; + setDepthFunc(depthFunc: Function): void; setStencilTest(stencilTest: boolean): void; setStencilWrite(stencilWrite: any): void; + setStencilFunc(stencilFunc: Function, stencilRef: any, stencilMask: number): void; + setStencilOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; setFlipSided(flipSided: number): void; + setCullFace(cullFace: CullFace) setLineWidth(width: number): void; setPolygonOffset(polygonoffset: number, factor: number, units: number): void; setScissorTest(scissorTest: boolean): void; @@ -5466,10 +5528,42 @@ declare namespace THREE { reset(): void; } + export class WebGLColorBuffer { + constructor(gl: any, state: any); + + setMask(colorMask: number): void; + setLocked(lock: boolean): void; + setClear(r: number, g: number, b: number, a: number): void; + reset(): void; + } + + export class WebGLDepthBuffer { + constructor(gl: any, state: any); + + setTest(depthTest: boolean): void; + sertMask(depthMask: number): void; + setFunc(depthFunc: Function): void; + setLocked(lock: boolean): void; + setClear(depth: any): void; + reset(): void; + } + + export class WebGLStencilBuffer { + constructor(gl: any, state: any); + + setTest(stencilTest: boolean): void; + sertMask(stencilMask: number): void; + setFunc(stencilFunc: Function, stencilRef: any, stencilMask: number): void; + setOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; + setLocked(lock: boolean): void; + setClear(stencil: any): void; + reset(): void; + } + // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// export class LensFlarePlugin { constructor(renderer: WebGLRenderer, flares: any[]); - + render(scene: Scene, camera: Camera, viewportWidth: number, viewportHeight: number): void; } @@ -5480,7 +5574,7 @@ declare namespace THREE { } // Scenes ///////////////////////////////////////////////////////////////////// - + /** * Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras. */ @@ -5497,6 +5591,7 @@ declare namespace THREE { */ overrideMaterial: Material; autoUpdate: boolean; + background: any; copy(source: Scene, recursive?: boolean): Scene; } @@ -5555,7 +5650,7 @@ declare namespace THREE { // Textures ///////////////////////////////////////////////////////////////////// export let TextureIdCount: number; - export class Texture { + export class Texture extends EventDispatcher { constructor( image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, mapping?: Mapping, @@ -5565,14 +5660,15 @@ declare namespace THREE { minFilter?: TextureFilter, format?: PixelFormat, type?: TextureDataType, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); id: number; uuid: string; name: string; sourceFile: string; - image: any; // HTMLImageElement or ImageData ; + image: any; // HTMLImageElement or ImageData or { width: number, height: number } in some children; mipmaps: ImageData[]; mapping: Mapping; wrapS: Wrapping; @@ -5600,12 +5696,22 @@ declare namespace THREE { toJSON(meta: any): any; dispose(): void; transformUv(uv: Vector): void; + } - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + export class DepthTexture extends Texture { + constructor( + width: number, + heighht: number, + type?: TextureDataType, + mapping?: Mapping, + wrapS?: Wrapping, + wrapT?: Wrapping, + magFilter?: TextureFilter, + minFilter?: TextureFilter, + anisotropy?: number + ); + + image: { width: number, height: number }; } export class CanvasTexture extends Texture { @@ -5635,7 +5741,8 @@ declare namespace THREE { minFilter?: TextureFilter, format?: PixelFormat, type?: TextureDataType, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); images: any; // returns and sets the value of Texture.image in the codde ? @@ -5655,7 +5762,8 @@ declare namespace THREE { wrapT?: Wrapping, magFilter?: TextureFilter, minFilter?: TextureFilter, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); image: { width: number; height: number; }; @@ -5676,7 +5784,8 @@ declare namespace THREE { wrapT: Wrapping, magFilter: TextureFilter, minFilter: TextureFilter, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); image: { data: ImageData; width: number; height: number; }; @@ -5725,8 +5834,8 @@ declare namespace THREE { export namespace ShapeUtils { export function area(contour: number[]): number; - export function triangulate(contour: Vector2[], indices: boolean): Vector2[][] | number[][]; - export function triangulateShape(contour: Vector2[], holes: Vector2[][]): Vector2[][]; + export function triangulate(contour: number[], indices: boolean): number[]; + export function triangulateShape(contour: number[], holes: any[]): number[]; export function isClockWise(pts: number[]): boolean; export function b2(t: number, p0: number, p1: number, p2: number): number; export function b3(t: number, p0: number, p1: number, p2: number, p3: number): number; @@ -5747,26 +5856,28 @@ declare namespace THREE { hasPlaybackControl: boolean; isPlaying: boolean; sourceType: string; - filter: any; + filters: any[]; getOutput(): GainNode; - load(file: string): Audio; setNodeSource(audioNode: AudioBufferSourceNode): Audio; setBuffer(audioBuffer: AudioBuffer): Audio; - play(): void; - pause(): void; - stop(): void; - connect(): void; - disconnect(): void; - setFilter(value: any): void; + play(): Audio; + pause(): Audio; + stop(): Audio; + connect(): Audio; + disconnect(): Audio; + getFilters(): any[]; + setFilter(value: any[]): Audio; getFilter(): any; - setPlaybackRate(value: number): void; + setFilter(filter: any): Audio; + setPlaybackRate(value: number): Audio; getPlaybackRate(): number; onEnded(): void; - setLoop(value: boolean): void; getLoop(): boolean; - setVolume(value: number): void; + setLoop(value: boolean): void; getVolume(): number; + setVolume(value: number): Audio; + load(file: string): Audio; // deprecated, use the AudioLoader class } export class AudioAnalyser { @@ -5775,9 +5886,15 @@ declare namespace THREE { analyser: any; data: Uint8Array; - getData(): Uint8Array; + getFrequencyData(): Uint8Array; + getAverageFrequency(): number; + + // deprecated + getData(file: any): any; } + export const AudioContext: AudioContext; + export class AudioBuffer { constructor(context: any); @@ -5896,7 +6013,10 @@ declare namespace THREE { closePath(): void; getPoint(t: number): T; getLength(): number; + updateArcLengths(): void; getCurveLengths(): number[]; + getSpacedPoints(divisions?: number): T[]; + getPoints(divisions?: number): T[]; createPointsGeometry(divisions: number): Geometry; createSpacedPointsGeometry(divisions: number): Geometry; createGeometry(points: T[]): Geometry; @@ -5923,7 +6043,7 @@ declare namespace THREE { export class Path extends CurvePath { constructor(points?: Vector2[]); - actions: PathAction[]; + currentPoint: Vector2; fromPoints(vectors: Vector2[]): void; moveTo(x: number, y: number): void; @@ -5935,8 +6055,19 @@ declare namespace THREE { absarc(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; ellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number): void; absellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number): void; - getSpacedPoints(divisions?: number): Vector2[]; - getPoints(divisions?: number, closedPath?: boolean): Vector2[]; + } + + export class ShapePath { + constructor(); + + subPaths: any[]; + currentPath: any; + + moveTo(x: number, y: number): void; + lineTo(x: number, y: number): void; + quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): void; + bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): void; + splineThru(pts: Vector2[]): void; toShapes(isCCW: boolean, noHoles: any): Shape[]; } @@ -5969,7 +6100,7 @@ declare namespace THREE { export class ClosedSplineCurve3 extends CatmullRomCurve3 {} // deprecated, use CatmullRomCurve3 export class SplineCurve3 extends CatmullRomCurve3 {} // will be deprecated, use CatmullRomCurve3 - + export class CubicBezierCurve extends Curve { constructor(v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2); @@ -5989,7 +6120,7 @@ declare namespace THREE { getPoint(t: number): Vector3; } - + export class EllipseCurve extends Curve { constructor(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number); @@ -6021,7 +6152,7 @@ declare namespace THREE { getPoint(t: number): Vector3; } - + export class QuadraticBezierCurve extends Curve { constructor( v0: Vector2, v1: Vector2, v2: Vector2 ); @@ -6045,7 +6176,7 @@ declare namespace THREE { points: Vector2[]; } - + // Extras / Geometries ///////////////////////////////////////////////////////////////////// export class BoxBufferGeometry extends BufferGeometry { @@ -6149,6 +6280,14 @@ declare namespace THREE { }; } + export class ConeBufferGeometry extends BufferGeometry { + constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); + } + + export class ConeGeometry extends CylinderGeometry { + constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); + } + export class DodecahedronGeometry extends Geometry { constructor(radius: number, detail: number); @@ -6458,7 +6597,7 @@ declare namespace THREE { } export class BoxHelper extends LineSegments { - constructor(object?: Object3D); + constructor(object?: Object3D, color?: Color); update(object?: Object3D): void; } @@ -6477,7 +6616,6 @@ declare namespace THREE { light: Light; lightPlane: Line; - targetLine: Line; dispose(): void; update(): void; @@ -6497,12 +6635,9 @@ declare namespace THREE { } export class GridHelper extends LineSegments { - constructor(size: number, step: number); + constructor(size: number, divisions: number, color1?: Color|number, color2?: Color|number); - color1: Color; - color2: Color; - - setColors(colorCenterLine: number, colorGrid: number): void; + setColors(color1?: Color|number, color2?: Color|number): void; // deprecated } export class HemisphereLightHelper extends Object3D { @@ -6536,10 +6671,9 @@ declare namespace THREE { } export class SpotLightHelper extends Object3D { - constructor(light: Light, sphereSize: number, arrowLength: number); + constructor(light: Light); light: Light; - cone: Mesh; dispose(): void; update(): void; From d5285fd288470deb3e0f6824db7e1d8ac52b3f87 Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Sat, 30 Jul 2016 17:41:50 +0200 Subject: [PATCH 41/79] Update THREE.js definitions to r79 --- threejs/tests/webgl/webgl_animation_cloth.ts | 2 +- .../webgl/webgl_animation_skinning_morph.ts | 2 +- .../tests/webgl/webgl_lights_hemisphere.ts | 8 +- threejs/three.d.ts | 846 ++++++++++-------- 4 files changed, 496 insertions(+), 362 deletions(-) diff --git a/threejs/tests/webgl/webgl_animation_cloth.ts b/threejs/tests/webgl/webgl_animation_cloth.ts index e58d460986..7bebdc3423 100644 --- a/threejs/tests/webgl/webgl_animation_cloth.ts +++ b/threejs/tests/webgl/webgl_animation_cloth.ts @@ -114,7 +114,7 @@ clothGeometry.dynamic = true; clothGeometry.computeFaceNormals(); - var uniforms = { texture: { type: "t", value: clothTexture } }; + var uniforms = { texture: { value: clothTexture } }; var vertexShader = document.getElementById('vertexShaderDepth').textContent; var fragmentShader = document.getElementById('fragmentShaderDepth').textContent; diff --git a/threejs/tests/webgl/webgl_animation_skinning_morph.ts b/threejs/tests/webgl/webgl_animation_skinning_morph.ts index 50976c4547..726a8f4b7f 100644 --- a/threejs/tests/webgl/webgl_animation_skinning_morph.ts +++ b/threejs/tests/webgl/webgl_animation_skinning_morph.ts @@ -182,7 +182,7 @@ scene.add( helper ); - var clipMorpher = THREE.AnimationClip.CreateFromMorphTargetSequence( 'facialExpressions', mesh.geometry.morphTargets, 3 ); + var clipMorpher = THREE.AnimationClip.CreateFromMorphTargetSequence( 'facialExpressions', mesh.geometry.morphTargets, 3, true ); var clipBones = geometry.animations[0]; mixer = new THREE.AnimationMixer( mesh ); diff --git a/threejs/tests/webgl/webgl_lights_hemisphere.ts b/threejs/tests/webgl/webgl_lights_hemisphere.ts index 892b3ed4cc..bed4d5e0b5 100644 --- a/threejs/tests/webgl/webgl_lights_hemisphere.ts +++ b/threejs/tests/webgl/webgl_lights_hemisphere.ts @@ -95,10 +95,10 @@ var vertexShader = document.getElementById( 'vertexShader' ).textContent; var fragmentShader = document.getElementById( 'fragmentShader' ).textContent; var uniforms = { - topColor: { type: "c", value: new THREE.Color( 0x0077ff ) }, - bottomColor: { type: "c", value: new THREE.Color( 0xffffff ) }, - offset: { type: "f", value: 33 }, - exponent: { type: "f", value: 0.6 } + topColor: { value: new THREE.Color( 0x0077ff ) }, + bottomColor: { value: new THREE.Color( 0xffffff ) }, + offset: { value: 33 }, + exponent: { value: 0.6 } }; uniforms.topColor.value.copy( hemiLight.color ); diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 389d247e53..b1b7a70015 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r75 +// Type definitions for three.js r79 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -158,6 +158,7 @@ declare namespace THREE { export const LuminanceFormat: PixelFormat; export const LuminanceAlphaFormat: PixelFormat; export const RGBEFormat: PixelFormat; + export const DepthFormat: PixelFormat; // Compressed texture formats // DDS / ST3C Compressed texture formats @@ -211,6 +212,11 @@ declare namespace THREE { export const RGBM16Encoding: TextureEncoding; export const RGBDEncoding: TextureEncoding; + // Depth packing strategies + export enum DepthPackingStrategies { } + export const BasicDepthPacking: DepthPackingStrategies; + export const RGBADepthPacking: DepthPackingStrategies; + // log handlers export function warn(message?: any, ...optionalParams: any[]): void; export function error(message?: any, ...optionalParams: any[]): void; @@ -218,40 +224,78 @@ declare namespace THREE { // Animation //////////////////////////////////////////////////////////////////////////////////////// + export class AnimationAction { + loop: boolean; + time: number; + timeScale: number; + weight: number; + repetitions: number; + paused: boolean; + enabled: boolean; + clampWhenFinished: boolean; + zeroSlopeAtStart: boolean; + zeroSlopeAtEnd: boolean; + + play(): AnimationAction; + stop(): AnimationAction; + reset(): AnimationAction; + isRunning(): boolean; + startAt(time: number): AnimationAction; + setLoop(mode: boolean, repetitions: number): AnimationAction; + setEffectiveWeight(weight: number): AnimationAction; + getEffectiveWeight(): number; + fadeIn(duration: number): AnimationAction; + fadeOut(duration: number): AnimationAction; + crossFadeFrom(fadeOutAction: AnimationAction,duration: number, warp: boolean): AnimationAction; + crossFadeTo(fadeInAction: AnimationAction,duration: number, warp: boolean): AnimationAction; + stopFading(): AnimationAction; + setEffectiveTimeScale(timeScale: number): AnimationAction; + getEffectiveTimeScale(): number; + setDuration(duration: number): AnimationAction; + syncWith(action: AnimationAction): AnimationAction; + halt(duration: number): AnimationAction; + warp(statTimeScale: number, endTimeScale: number, duration: number): AnimationAction; + stopWarping(): AnimationAction; + getMixer(): AnimationMixer; + getClip(): AnimationClip; + getRoot(): any; + } + export class AnimationClip { constructor( name?: string, duration?: number, tracks?: KeyframeTrack[] ); name: string; tracks: KeyframeTrack[]; duration: number; + uuid: string; results: any[]; resetDuration(): void; trim(): AnimationClip; optimize(): AnimationClip; - static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number ): AnimationClip; + static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip; static findByName( clipArray: AnimationClip, name: string ): AnimationClip; - static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number ): AnimationClip[]; + static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip[]; static parse( json: any ): AnimationClip; static parseAnimation( animation: any, bones: Bone[], nodeName: string ): AnimationClip; static toJSON(): any; } - export class AnimationMixer { + export class AnimationMixer extends EventDispatcher { constructor(root: any); time: number; timeScale: number; - clipAction(clip: AnimationClip, root?: any): any; // returns THREE.AnimationMixer._Action - existingAction(clip: AnimationClip, root?: any): any; /// returns THREE.AnimationMixer._Action + clipAction(clip: AnimationClip, root?: any): AnimationAction; + existingAction(clip: AnimationClip, root?: any): AnimationAction; stopAllAction(clip: AnimationClip, root?: any): AnimationMixer; update(deltaTime: number): AnimationMixer; getRoot(): any; uncacheClip(clip: AnimationClip): void; uncacheRoot(root: any): void; - uncazcheAction(clip: AnimationClip, root?: any): void; + uncacheAction(clip: AnimationClip, root?: any): void; } export class AnimationObjectGroup { @@ -367,6 +411,10 @@ declare namespace THREE { constructor(name: string, times: any[], values: any[]); } + export class ColorKeyframeTrack extends KeyframeTrack { + constructor(name: string, times: any[], values: any[], interpolation: InterpolationModes); + } + export class NumberKeyframeTrack extends KeyframeTrack { constructor(name: string, times: any[], values: any[], interpolation: InterpolationModes); } @@ -445,6 +493,14 @@ declare namespace THREE { constructor(left: number, right: number, top: number, bottom: number, near?: number, far?: number); zoom: number; + view: { + fullWidth: number, + fullHeight: number, + offsetX: number, + offsetY: number, + width: number, + height: number + }; /** * Camera frustum left plane. @@ -480,6 +536,8 @@ declare namespace THREE { * Updates the camera projection matrix. Must be called after change of parameters. */ updateProjectionMatrix(): void; + setViewOffset(fullWidth: number, fullHeight: number, offsetX: number, offsetY: number, width: number, height: number): void; + clearViewOffset(): void; clone(): OrthographicCamera; copy(source: OrthographicCamera): OrthographicCamera; toJSON(meta?: any): any; @@ -503,7 +561,6 @@ declare namespace THREE { */ constructor(fov?: number, aspect?: number, near?: number, far?: number); - focalLength: number; zoom: number; /** @@ -526,14 +583,23 @@ declare namespace THREE { */ far: number; - /** - * Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified. - * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html - * @param focalLength focal length - * @param frameHeight frame size. Default value is 24. - */ - setLens(focalLength: number, frameHeight?: number): void; + focus: number; + view: { + fullWidth: number, + fullHeight: number, + offsetX: number, + offsetY: number, + width: number, + height: number + }; + filmGauge: number; + filmAcces: number; + setFocalLength(focalLength: number): void; + getFocalLength(): number; + getEffectiveFOV(): number; + getFilmWidth(): number; + getFilmHeight(): number; /** * Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. * For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this: @@ -572,14 +638,17 @@ declare namespace THREE { * @param height height of subcamera */ setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; + clearViewOffset(): void; /** * Updates the camera projection matrix. Must be called after change of parameters. */ updateProjectionMatrix(): void; clone(): PerspectiveCamera; - copy(source: PerspectiveCamera): PerspectiveCamera; toJSON(meta?: any): any; + + // deprecated + setLens(focalLength: number, frameHeight?: number): void; } export class StereoCamera extends Camera { @@ -598,7 +667,7 @@ declare namespace THREE { * @see src/core/BufferAttribute.js */ export class BufferAttribute { - constructor(array: ArrayLike, itemSize: number); // array parameter should be TypedArray. + constructor(array: ArrayLike, itemSize: number, normalized?: boolean); // array parameter should be TypedArray. uuid: string; array: ArrayLike; @@ -606,6 +675,7 @@ declare namespace THREE { dynamic: boolean; updateRange: {offset:number, count:number}; version: number; + normalized: boolean; needsUpdate: boolean; count: number; @@ -682,7 +752,7 @@ declare namespace THREE { * * @see src/core/BufferGeometry.js */ - export class BufferGeometry { + export class BufferGeometry extends EventDispatcher { /** * This creates a new BufferGeometry. It also sets several properties to an default value. */ @@ -700,8 +770,6 @@ declare namespace THREE { index: BufferAttribute; attributes: BufferAttribute|InterleavedBufferAttribute[]; morphAttributes: any; - drawcalls: any; // deprecated, use groups - offsets: any; // deprecated, use groups groups: {start: number, count: number, materialIndex?: number}[]; boundingBox: Box3; boundingSphere: BoundingSphere; @@ -773,17 +841,14 @@ declare namespace THREE { */ dispose(): void; - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + // deprecated + drawcalls: any; + offsets: any; - addIndex(index: any): void; // deprecated, use setIndex() - addAttribute(name: any, array: any, itemSize: any): any; // deprecated - addDrawCall(start: any, count: any, indexOffset?: any): void; // deprecated, use addGroup() - clearDrawCalls(): void; // deprecated, use clearGroups() - computeFaceNormals(): void; // deprecated + addIndex(index: any): void; + addDrawCall(start: any, count: any, indexOffset?: any): void; + clearDrawCalls(): void; + addAttribute(name: any, array: any, itemSize: any): any; } /** @@ -849,7 +914,7 @@ declare namespace THREE { /** * @see src/core/DirectGeometry.js */ - export class DirectGeometry { + export class DirectGeometry extends EventDispatcher { constructor(); id: number; @@ -919,8 +984,6 @@ declare namespace THREE { */ constructor(); - apply(object: any): void; - /** * Adds a listener to an event type. * @param type The type of the listener that gets removed. @@ -947,6 +1010,9 @@ declare namespace THREE { * @param type The type of event that gets fired. */ dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + + // deprecated + apply(target: any): void; } export interface Event { @@ -1058,7 +1124,7 @@ declare namespace THREE { * * @see https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js */ - export class Geometry { + export class Geometry extends EventDispatcher { constructor(); /** @@ -1277,7 +1343,7 @@ declare namespace THREE { */ export class InstancedBufferAttribute extends BufferAttribute { constructor(data: ArrayLike, itemSize: number, meshPerAttribute?: number); - + meshPerAttribute: number; clone(): InstancedBufferAttribute; @@ -1292,7 +1358,7 @@ declare namespace THREE { groups: {start:number, count:number, instances:number}[]; maxInstancedCount: number; - + addGroup(start: number, count: number, instances: number): void; clone(): InstancedBufferGeometry; copy(source: InstancedBufferGeometry): InstancedBufferGeometry; @@ -1326,7 +1392,7 @@ declare namespace THREE { */ export class InstancedInterleavedBuffer extends InterleavedBuffer { constructor(array: ArrayLike, stride: number, meshPerAttribute?: number); - + meshPerAttribute: number; clone(): InstancedInterleavedBuffer; @@ -1337,13 +1403,15 @@ declare namespace THREE { * @see src/core/InterleavedBufferAttribute.js */ export class InterleavedBufferAttribute { - constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number); + constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized: boolean); uuid: string; data: InterleavedBuffer; itemSize: number; offset: number; count: number; + normalized: boolean; + array: any[]; getX(index: number): number; setX(index: number, x: number): InterleavedBufferAttribute; @@ -1365,7 +1433,7 @@ declare namespace THREE { /** * Base class for scene graph objects */ - export class Object3D { + export class Object3D extends EventDispatcher { constructor(); /** @@ -1409,7 +1477,6 @@ declare namespace THREE { * Object's local rotation (Euler angles), in radians. */ rotation: Euler; - eulerOrder: string; // deprecated, use rotation.order /** * Global rotation. @@ -1425,11 +1492,6 @@ declare namespace THREE { normalMatrix: Matrix3; - /** - * When this is set, then the rotationMatrix gets calculated every frame. - */ - rotationAutoUpdate: boolean; - /** * Local transform. */ @@ -1539,7 +1601,6 @@ declare namespace THREE { * @param distance The distance to translate. */ translateOnAxis(axis: Vector3, distance: number): Object3D; - translate(distance: number, axis: Vector3): Object3D; // deprecated, use translateOnAxis(axis, distance) /** * Translates object along x axis by distance. @@ -1636,13 +1697,10 @@ declare namespace THREE { */ copy(source: Object3D, recursive?: boolean): Object3D; - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; - - getChildByName(name: string): Object3D; // deprecated, use getObjectByName() + // deprecated + eulerOrder: string; + getChildByName(name: string): Object3D; + translate(distance: number, axis: Vector3): Object3D; } export interface Intersection { @@ -1672,7 +1730,7 @@ declare namespace THREE { params: RaycasterParameters; precision: number; linePrecision: number; - + set(origin: Vector3, direction: Vector3): void; setFromCamera(coords: { x: number; y: number;}, camera: Camera ): void; intersectObject(object: Object3D, recursive?: boolean): Intersection[]; @@ -1692,9 +1750,9 @@ declare namespace THREE { } export class Font { - constructor(data: any); + constructor(jsondata: string); - data: any; + data: string; generateShapes(text: string, size: number, divisions: number): any[]; } @@ -1793,6 +1851,8 @@ declare namespace THREE { clone(recursive?: boolean): HemisphereLight; } + export class DirectionalLightShadow extends LightShadow {} + export class HemisphereLight extends Light { constructor(skyColorHex?: number|string, groundColorHex?: number|string, intensity?: number); @@ -1871,13 +1931,18 @@ declare namespace THREE { exponent: number; decay: number; - shadow: LightShadow; + shadow: SpotLightShadow; power: number; + penumbra: number; clone(recursive?: boolean): SpotLight; copy(source: PointLight): SpotLight; } + export class SpotLightShadow extends LightShadow { + update(light: Light): void; + } + // Loaders ////////////////////////////////////////////////////////////////////////////////// /** @@ -1943,9 +2008,9 @@ declare namespace THREE { withCredentials: boolean; load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): any; - setPath(path: string): void; - setResponseType(responseType: string): void; - setWithCredentials(withCredentials: boolean): void; + setPath(path: string): XHRLoader; + setResponseType(responseType: string): XHRLoader; + setWithCredentials(withCredentials: boolean): XHRLoader; } export class FontLoader { @@ -1954,6 +2019,7 @@ declare namespace THREE { manager: LoadingManager; load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; + parse(json: string): Font; } /** @@ -1972,8 +2038,8 @@ declare namespace THREE { * @param url */ load(url: string, onLoad?: (image: HTMLImageElement) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): HTMLImageElement; - setCrossOrigin(crossOrigin: string): void; - setPath(value: any): void; + setCrossOrigin(crossOrigin: string): ImageLoader; + setPath(value: any): ImageLoader; } /** @@ -1984,7 +2050,6 @@ declare namespace THREE { manager: LoadingManager; withCredentials: boolean; - statusDomElement: HTMLElement; // readonly and deprecated load(url: string, onLoad?: (geometry: Geometry, materials: Material[]) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; setTexturePath( value: string ): void; @@ -2081,8 +2146,8 @@ declare namespace THREE { * @param url */ load(url: string, onLoad?: (texture: Texture) => void): Texture; - setCrossOrigin(crossOrigin: string): void; - setPath(path: string): void; + setCrossOrigin(crossOrigin: string): TextureLoader; + setPath(path: string): TextureLoader; } export class CubeTextureLoader { @@ -2093,8 +2158,8 @@ declare namespace THREE { path: string; load(urls: Array, onLoad?: (texture: CubeTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; - setPath(path: string): void; + setCrossOrigin(crossOrigin: string): CubeTextureLoader; + setPath(path: string): CubeTextureLoader; } export class BinaryTextureLoader { @@ -2113,7 +2178,13 @@ declare namespace THREE { path: string; load(url: string, onLoad: (texture: CompressedTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setPath(path: string): void; + setPath(path: string): CompressedTextureLoader; + } + + export class AudioLoader { + constructor(manager?: LoadingManager); + + load(url: string, onLoad: Function, onPrgress: Function, onError: Function): void; } export namespace Cache { @@ -2153,12 +2224,16 @@ declare namespace THREE { premultipliedAlpha?: boolean; overdraw?: number; visible?: boolean; + fog?: boolean; + lights?: boolean; + shading?: Shading; + vertexColors?: Colors; } /** * Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer. */ - export class Material { + export class Material extends EventDispatcher { constructor(); /** @@ -2229,6 +2304,9 @@ declare namespace THREE { */ depthWrite: boolean; + clippingPlanes: any; + clipShadows: boolean; + colorWrite: boolean; precision: any; @@ -2271,7 +2349,10 @@ declare namespace THREE { */ needsUpdate: boolean; - warpRGB: Color; // deprecated, returns a new Color intance + fog: boolean; + lights: boolean; + shading: Shading; + vertexColors: Colors; setValues(parameters: MaterialParameters): void; toJSON(meta?: any): any; @@ -2280,11 +2361,8 @@ declare namespace THREE { update(): void; dispose(): void; - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + // deprecated + warpRGB: Color; } export interface LineBasicMaterialParameters extends MaterialParameters { @@ -2292,9 +2370,6 @@ declare namespace THREE { linewidth?: number; linecap?: string; linejoin?: string; - blending?: Blending; - vertexColors?: Colors; - fog?: boolean; } export class LineBasicMaterial extends Material { @@ -2304,9 +2379,6 @@ declare namespace THREE { linewidth: number; linecap: string; linejoin: string; - blending: Blending; - vertexColors: Colors; - fog: boolean; setValues(parameters: LineBasicMaterialParameters): void; clone(): LineBasicMaterial; @@ -2319,9 +2391,6 @@ declare namespace THREE { scale?: number; dashSize?: number; gapSize?: number; - blending?: Blending; - vertexColors?: Colors; - fog?: boolean; } export class LineDashedMaterial extends Material { @@ -2332,9 +2401,6 @@ declare namespace THREE { scale: number; dashSize: number; gapSize: number; - blending: Blending; - vertexColors: Colors; - fog: boolean; setValues(parameters: LineDashedMaterialParameters): void; clone(): LineDashedMaterial; @@ -2357,15 +2423,12 @@ declare namespace THREE { reflectivity?: number; refractionRatio?: number; shading?: Shading; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; - fog?: boolean; } export class MeshBasicMaterial extends Material { @@ -2381,14 +2444,11 @@ declare namespace THREE { combine: Combine; reflectivity: number; refractionRatio: number; - fog: boolean; shading: Shading; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; @@ -2429,13 +2489,10 @@ declare namespace THREE { combine?: Combine; reflectivity?: number; refractionRatio?: number; - fog?: boolean; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; @@ -2445,7 +2502,7 @@ declare namespace THREE { constructor(parameters?: MeshLambertMaterialParameters); color: Color; - emissive: Color; + emissive: number|string; emissiveIntensity: number; emissiveMap: Texture; map: Texture; @@ -2459,13 +2516,10 @@ declare namespace THREE { combine: Combine; reflectivity: number; refractionRatio: number; - fog: boolean; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; morphNormals: boolean; @@ -2500,20 +2554,17 @@ declare namespace THREE { envMap?: Texture; envMapIntensity?: number; refractionRatio?: number; - shading?: Shading; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; - fog?: boolean; } export class MeshStandardMaterial extends Material { constructor(parameters?: MeshStandardMaterialParameters); + defines: any; color: Color; roughness: number; metalness: number; @@ -2538,40 +2589,17 @@ declare namespace THREE { envMap: Texture; envMapIntensity: number; refractionRatio: number; - shading: Shading; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; morphNormals: boolean; - fog: boolean; setValues(parameters: MeshStandardMaterialParameters): void; clone(): MeshStandardMaterial; copy(source: MeshStandardMaterial): MeshStandardMaterial; } - export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialParameters { - reflectivity?: number; - clearCoat?: number; - clearCoatRoughness?: number; - } - - export class MeshPhysicalMaterial extends MeshStandardMaterial { - constructor(parameters?: MeshPhysicalMaterialParameters); - - defines: any; - reflectivity: number; - clearCoat: number; - clearCoatRoughness: number; - - setValues(parameters: MeshPhysicalMaterialParameters): void; - clone(): MeshPhysicalMaterial; - copy(source: MeshPhysicalMaterial): MeshPhysicalMaterial; - } - export interface MeshNormalMaterialParameters extends MaterialParameters { /** Render geometry as wireframe. Default is false (i.e. render as smooth shaded). */ wireframe?: boolean; @@ -2619,17 +2647,13 @@ declare namespace THREE { combine?: Combine; reflectivity?: number; refractionRatio?: number; - shading?: Shading; - blending?: Blending; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; - vertexColors?: Colors; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; - fog?: boolean; } export class MeshPhongMaterial extends Material { @@ -2659,14 +2683,10 @@ declare namespace THREE { combine: Combine; reflectivity: number; refractionRatio: number; - fog: boolean; - shading: Shading; - blending: Blending; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; - vertexColors: Colors; skinning: boolean; morphTargets: boolean; morphNormals: boolean; @@ -2677,6 +2697,21 @@ declare namespace THREE { copy(source: MeshPhongMaterial): MeshPhongMaterial; } + export interface MeshPhysicalMaterialParameters extends MeshStandardMaterialParameters { + reflectivity?: number; + clearCoat?: number; + clearCoatRoughness?: number; + } + + export class MeshPhysicalMaterial extends MeshStandardMaterial { + constructor(parameters: MeshPhysicalMaterialParameters); + + defines: any; + reflectivity: number; + clearCoat: number; + clearCoatRoughness: number; + } + // MultiMaterial does not inherit the Material class in the original code. However, it should treat as Material class. // See tests/canvas/canvas_materials.ts. export class MultiMaterial extends Material { @@ -2695,9 +2730,6 @@ declare namespace THREE { map?: Texture; size?: number; sizeAttenuation?: boolean; - blending?: Blending; - vertexColors?: Colors; - fog?: boolean; } export class PointsMaterial extends Material { @@ -2707,31 +2739,26 @@ declare namespace THREE { map: Texture; size: number; sizeAttenuation: boolean; - blending: Blending; - vertexColors: boolean; - fog: boolean; setValues(parameters: PointsMaterialParameters): void; clone(): PointsMaterial; copy(source: PointsMaterial): PointsMaterial; } - export class PointCloudMaterial extends PointsMaterial {} // deprecated, use PointsMaterial - export class ParticleBasicMaterial extends PointsMaterial {} // deprecated, use PointsMaterial - export class ParticleSystemMaterial extends PointsMaterial {} // deprecated, use PointsMaterial + export class PointCloudMaterial extends PointsMaterial {} // deprecated + export class ParticleBasicMaterial extends PointsMaterial {} // deprecated + export class ParticleSystemMaterial extends PointsMaterial {} // deprecated export interface ShaderMaterialParameters extends MaterialParameters { defines?: any; - uniforms?: any; + uniforms?: any; vertexShader?: string; fragmentShader?: string; - shading?: Shading; lineWidth?: number; wireframe?: boolean; wireframeLinewidth?: number; - fog?: boolean; lights?: boolean; - vertexColors?: Colors; + clipping?: boolean; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; @@ -2741,16 +2768,14 @@ declare namespace THREE { constructor(parameters?: ShaderMaterialParameters); defines: any; - uniforms: any; + uniforms: any; // type should be { [uniform: string]: { value: any }; }; but gives "Index signature is missing in type" error during compilation vertexShader: string; fragmentShader: string; - shading: Shading; linewidth: number; wireframe: boolean; wireframeLinewidth: number; - fog: boolean; lights: boolean; - vertexColors: Colors; + clipping: boolean; skinning: boolean; morphTargets: boolean; morphNormals: boolean; @@ -2773,7 +2798,6 @@ declare namespace THREE { color?: number|string; map?: Texture; rotation?: number; - fog?: boolean; } export class SpriteMaterial extends Material { @@ -2782,13 +2806,16 @@ declare namespace THREE { color: Color; map: Texture; rotation: number; - fog: boolean; setValues(parameters: SpriteMaterialParameters): void; clone(): SpriteMaterial; copy(source: SpriteMaterial): SpriteMaterial; } + export class ShadowMaterial extends ShaderMaterial { + constructor(parameters?: ShaderMaterialParameters); + } + // Math ////////////////////////////////////////////////////////////////////////////////// export class Box2 { @@ -2803,7 +2830,6 @@ declare namespace THREE { clone(): Box2; copy(box: Box2): Box2; makeEmpty(): Box2; - empty(): any; // deprecated, use isEmpty() isEmpty(): boolean; center(optionalTarget?: Vector2): Vector2; size(optionalTarget?: Vector2): Vector2; @@ -2821,6 +2847,7 @@ declare namespace THREE { translate(offset: Vector2): Box2; equals(box: Box2): boolean; + empty(): any; // deprecated, use isEmpty() isIntersectionBox(b: any): any; // deprecated, use intersectsBox() } @@ -2858,7 +2885,7 @@ declare namespace THREE { applyMatrix4(matrix: Matrix4): Box3; translate(offset: Vector3): Box3; equals(box: Box3): boolean; - + empty(): any; // deprecated, use isEmpty() isIntersectionBox(b: any): any; // deprecated, use intersectsBox() isIntersectionSphere(s: any): any; // deprecated, use intersectsSphere() @@ -2985,6 +3012,7 @@ declare namespace THREE { add(color: Color): Color; addColors(color1: Color, color2: Color): Color; addScalar(s: number): Color; + sub(color: Color): Color; multiply(color: Color): Color; multiplyScalar(s: number): Color; lerp(color: Color, alpha: number): Color; @@ -3145,7 +3173,7 @@ declare namespace THREE { export class Euler { constructor(x?: number, y?: number, z?: number, order?: string); - + x: number; y: number; z: number; @@ -3185,6 +3213,7 @@ declare namespace THREE { copy(frustum: Frustum): Frustum; setFromMatrix(m: Matrix4): Frustum; intersectsObject(object: Object3D): boolean; + intersectsObject(sprite: Sprite): boolean; intersectsSphere(sphere: Sphere): boolean; intersectsBox(box: Box3): boolean; containsPoint(point: Vector3): boolean; @@ -3215,6 +3244,9 @@ declare namespace THREE { * @see src/math/Math.js */ export namespace Math { + export const DEG2RAD: number; + export const RAD2DEG: number; + export function generateUUID(): string; /** @@ -3335,27 +3367,16 @@ declare namespace THREE { clone(): Matrix3; copy(m: Matrix3): Matrix3; setFromMatix4(m: Matrix4): Matrix3; - - /** - * @deprecated Use applyToVector3Array() - */ - multiplyVector3Array(a: any): any; applyToVector3Array(array: number[], offset?: number, length?: number): number[]; applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; multiplyScalar(s: number): Matrix3; determinant(): number; getInverse(matrix: Matrix3, throwOnDegenerate?: boolean): Matrix3; - /** - * @deprecated No longer takes a Matrix4 argument. - */ - getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; - /** * Transposes this matrix in place. */ transpose(): Matrix3; - flattenToArrayOffset(array: number[], offset: number): number[]; getNormalMatrix(matrix4: Matrix4): Matrix3; /** @@ -3365,10 +3386,11 @@ declare namespace THREE { fromArray(array: number[]): Matrix3; toArray(): number[]; - /** - * @deprecated Use vector.applyMatrix3( matrix ) - */ + // deprecated multiplyVector3(vector: Vector3): any; + multiplyVector3Array(a: any): any; + getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; + flattenToArrayOffset(array: number[], offset: number): number[]; } /** @@ -3408,7 +3430,6 @@ declare namespace THREE { identity(): Matrix4; clone(): Matrix4; copy(m: Matrix4): Matrix4; - extractPosition(m: Matrix4): Matrix4; // deprecated, use copyPosition() copyPosition(m: Matrix4): Matrix4; extractBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; makeBasis( xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; @@ -3418,7 +3439,6 @@ declare namespace THREE { */ extractRotation(m: Matrix4): Matrix4; makeRotationFromEuler(euler: Euler): Matrix4; - setRotationFromQuaternion(q: Quaternion): Matrix4; // deprecated, use makeRotationFromQuaternion() makeRotationFromQuaternion(q: Quaternion): Matrix4; /** * Constructs a rotation matrix, looking from eye towards center with defined up vector. @@ -3430,6 +3450,8 @@ declare namespace THREE { */ multiply(m: Matrix4): Matrix4; + premultiply(m: Matrix4): Matrix4; + /** * Sets this matrix to a x b. */ @@ -3445,7 +3467,6 @@ declare namespace THREE { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; - multiplyVector3Array(array: number[]): number[]; // deprecated, use applyToVector3Array() applyToVector3Array(array: number[], offset?: number, length?: number): number[]; applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; /** @@ -3459,16 +3480,13 @@ declare namespace THREE { */ transpose(): Matrix4; - /** - * Flattens this matrix into supplied flat array starting from offset position in the array. - */ - flattenToArrayOffset(array: number[], offset: number): number[]; + /** * Sets the position component for this matrix from vector v. */ setPosition(v: Vector3): Matrix4; - + /** * Sets this matrix to the inverse of matrix m. @@ -3551,26 +3569,15 @@ declare namespace THREE { fromArray(array: number[]): Matrix4; toArray(): number[]; - /** - * @deprecated Use Vector3.setFromMatrixPosition( matrix ) - */ - getPosition(): any; - /** - * @deprecated Use Vector3.applyMatrix4( matrix ) or Vector3.applyProjection( matrix ) - */ + // deprecated + extractPosition(m: Matrix4): Matrix4; + setRotationFromQuaternion(q: Quaternion): Matrix4; multiplyVector3(v: any): any; - /** - * @deprecated Use Vector3.applyMatrix4( matrix ) - */ multiplyVector4(v: any): any; - /** - * @deprecated Use Vector3.transformDirection( matrix ) - */ + multiplyVector3Array(array: number[]): number[]; rotateAxis(v: any): void; - /** - * @deprecated Use Vector3.applyMatrix( matrix ) - */ crossVector(v: any): void; + flattenToArrayOffset(array: number[], offset: number): number[]; } export class Plane { @@ -3599,13 +3606,14 @@ declare namespace THREE { translate(offset: Vector3): Plane; equals(plane: Plane): boolean; - isIntersectionLine(l: any): any; // deprecated, use instersectsLine() + // deprecated + isIntersectionLine(l: any): any; } export class Spherical { constructor(radius?: number, phi?: number, theta?: number); - set(radius: number, phi: number, theta: number): void; + set(radius: number, phi: number, theta: number): Spherical; clone(): Spherical; copy(other: Spherical): Spherical; makeSafe(): void; @@ -3690,6 +3698,7 @@ declare namespace THREE { * Multiplies this quaternion by b. */ multiply(q: Quaternion): Quaternion; + premultiply(q: Quaternion): Quaternion; /** * Sets this quaternion to a x b @@ -3697,7 +3706,6 @@ declare namespace THREE { */ multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion; - multiplyVector3(v: any): any; // deprecated, use vector.applyQuaternion( quaternion ) slerp(qb: Quaternion, t: number): Quaternion; equals(v: Quaternion): boolean; @@ -3714,8 +3722,11 @@ declare namespace THREE { * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/. */ static slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): Quaternion; - + static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number, t: number): Quaternion; + + // deprecated + multiplyVector3(v: any): any; } export class Ray { @@ -3744,10 +3755,11 @@ declare namespace THREE { intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; applyMatrix4(matrix4: Matrix4): Ray; equals(ray: Ray): boolean; - - isIntersectionSphere(s: any): any; // deprecated, use intersectsSphere() - isIntersectionPlane(p: any): any; // deprecated, use intersectsPlane() - isIntersectionBox(b: any): any; // deprecated, use intersectsBox() + + // deprecated + isIntersectionBox(b: any): any; + isIntersectionPlane(p: any): any; + isIntersectionSphere(s: any): any; } export class Sphere { @@ -3843,6 +3855,7 @@ declare namespace THREE { plane(optionalTarget?: Vector3): Plane; barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3; containsPoint(point: Vector3): boolean; + closestPointToPoint(): Vector3; equals(triangle: Triangle): boolean; static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3; @@ -4094,6 +4107,7 @@ declare namespace THREE { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector2): number; + distanceToManhattan(v: Vector2): number; /** * Normalizes this vector and multiplies it by l. @@ -4210,7 +4224,7 @@ declare namespace THREE { applyMatrix4(m: Matrix4): Vector3; applyProjection(m: Matrix4): Vector3; applyQuaternion(q: Quaternion): Vector3; - project(camera: Camera): Vector3; + project(camrea: Camera): Vector3; unproject(camera: Camera): Vector3; transformDirection(m: Matrix4): Vector3; divide(v: Vector3): Vector3; @@ -4292,15 +4306,12 @@ declare namespace THREE { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector3): number; + distanceToManhattan(v: Vector3): number; setFromSpherical(s: Spherical): Matrix3; - getPositionFromMatrix(m: Matrix4): Vector3; // deprecated, use setFromMatrixPosition() setFromMatrixPosition(m: Matrix4): Vector3; - getScaleFromMatrix(m: Matrix4): Vector3; // deprecated, use setFromMatrixScale() setFromMatrixScale(m: Matrix4): Vector3; - getColumnFromMatrixColumn(index: number, matrix: Matrix4): Vector3; // deprecated, use setFromMatrixColumn() setFromMatrixColumn(matrix: Matrix4, index: number): Vector3; - setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; // deprecated, now expects ( matrix, index ) /** * Checks for strict equality of this vector and v. @@ -4308,13 +4319,16 @@ declare namespace THREE { equals(v: Vector3): boolean; fromArray(xyz: number[], offset?: number): Vector3; - toArray(xyz?: number[], offset?: number): number[]; - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; + + // deprecated + getPositionFromMatrix(m: Matrix4): Vector3; + getScaleFromMatrix(m: Matrix4): Vector3; + getColumnFromMatrix(index: number, matrix: Matrix4): Vector3; } - export class Vertex extends Vector3 {} // deprecated, use Vector3 + export class Vertex extends Vector3 {} // deprecated /** * 4D vector. @@ -4338,7 +4352,7 @@ declare namespace THREE { * Sets all values of this vector. */ setScalar(scalar: number): Vector4; - + /** * Sets X component of this vector. */ @@ -4491,7 +4505,7 @@ declare namespace THREE { interpolate_(i1: number, t0: number, t: number, t1: number): any; } - + export class DiscreteInterpolant extends Interpolant { constructor(parameterPositions: any, samplesValues: any, sampleSize: number, resultBuffer?: any); @@ -4529,16 +4543,17 @@ declare namespace THREE { constructor(); levels: any[]; - objects: any[]; // deprecated, use .levels addLevel(object: Object3D, distance?: number): void; getObjectForDistance(distance: number): Object3D; raycast(raycaster: Raycaster, intersects: any): void; update(camera: Camera): void; - clone(): LOD; copy(source: LOD): LOD; toJSON(meta: any): any; + + // deprecated + objects: any[]; } export interface LensFlareProperty { @@ -4584,6 +4599,9 @@ declare namespace THREE { copy(source: Line): Line; } + export const LineStrip: number; // deprecated + export const LinePieces: number; // deprecated + export class LineSegments extends Line { constructor( geometry?: Geometry | BufferGeometry, @@ -4596,8 +4614,6 @@ declare namespace THREE { } enum LineMode {} - var LineStrip: LineMode; // deprecated - var LinePieces: LineMode; // deprecated export class Mesh extends Object3D { constructor(geometry?: Geometry, material?: Material); @@ -4646,8 +4662,8 @@ declare namespace THREE { copy(source: Points): Points; } - export class PointCloud extends Points {} // deprecated, use Points - export class ParticleSystem extends Points {} // deprecated, use Points + export class PointCloud extends Points {} // deprecated + export class ParticleSystem extends Points {} // deprecated export class Skeleton { constructor(bones: Bone[], boneInverses?: Matrix4[], useVertexTexture?: boolean); @@ -4700,15 +4716,16 @@ declare namespace THREE { copy(source: Sprite): Sprite; } - export class Particle extends Sprite {} // deprecated, use Sprite + export class Particle extends Sprite {} // deprecated // Renderers ////////////////////////////////////////////////////////////////////////////////// export interface Renderer { + domElement: HTMLCanvasElement; + render(scene: Scene, camera: Camera): void; setSize(width:number, height:number, updateStyle?:boolean): void; - domElement: HTMLCanvasElement; } export interface WebGLRendererParameters { @@ -4814,9 +4831,10 @@ declare namespace THREE { */ sortObjects: boolean; - extensions: WebGLExtensions; + clippingPlanes: any[]; + localClippingEnabled: boolean; - gammaFactor: number; // deprecated + extensions: WebGLExtensions; /** * Default is false. @@ -4848,11 +4866,6 @@ declare namespace THREE { */ maxMorphNormals: number; - /** - * Default is true. - */ - autoScaleCubemaps: boolean; - /** * An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields: */ @@ -4871,15 +4884,13 @@ declare namespace THREE { }; shadowMap: WebGLShadowMap; - shadowMapType: ShadowMapType; // deprecated, use shadowMap.type - shadowMapEnabled: boolean; // deprecated, use shadowMap.enabled - shadowMapCullFace: CullFace; // deprecated, use shadowMap.cullFace pixelRation: number; capabilities: WebGLCapabilities; properties: WebGLProperties; state: WebGLState; + allocTextureUnit: any; /** * Return the WebGL context. @@ -4892,7 +4903,7 @@ declare namespace THREE { getPrecision(): string; getPixelRatio(): number; setPixelRatio(value: number): void; - + getSize(): { width: number; height: number; }; /** @@ -4926,12 +4937,12 @@ declare namespace THREE { setClearColor(color: Color, alpha?: number): void; setClearColor(color: string, alpha?: number): void; setClearColor(color: number, alpha?: number): void; - + /** * Returns a float with the current clear alpha. Ranges from 0 to 1. */ getClearAlpha(): number; - + setClearAlpha(alpha: number): void; /** @@ -4971,24 +4982,31 @@ declare namespace THREE { * @param frontFace "ccw" or "cw */ setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void; - setTexture(texture: Texture, slot: number): void; + setTexture(texture: Texture, slot: number): void; // deprecated + setTexture2D(texture: Texture, slot: number): void; + setTextureCube(texture: Texture, slot: number): void; getCurrentRenderTarget(): RenderTarget; setRenderTarget(renderTarget: RenderTarget): void; readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; - supportsFloatTextures(): any; // deprecated - supportsHalfFloatTextures(): any; // deprecated - supportsStandardDerivatives(): any; // deprecated - supportsCompressedTextureS3TC(): any; // deprecated - supportsCompressedTexturePVRTC(): any; // deprecated - supportsBlendMinMax(): any; // deprecated - supportsVertexTextures(): any; // deprecated - supportsInstancedArrays(): any; // deprecated - enableScissorTest(boolean: any): any; // deprecated + // deprecated + gammaFactor: number; + shadowMapEnabled: boolean; + shadowMapType: ShadowMapType; + shadowMapCullFace: CullFace; + + supportsFloatTextures(): any; + supportsHalfFloatTextures(): any; + supportsStandardDerivatives(): any; + supportsCompressedTextureS3TC(): any; + supportsCompressedTexturePVRTC(): any; + supportsBlendMinMax(): any; + supportsVertexTextures(): any; + supportsInstancedArrays(): any; + enableScissorTest(boolean: any): any; } - export interface RenderTarget { - } + export interface RenderTarget {} // not defined in the code, used in LightShadow and WebGRenderer classes export interface WebGLRenderTargetOptions { wrapS?: Wrapping; @@ -5002,7 +5020,7 @@ declare namespace THREE { stencilBuffer?: boolean; // true; } - export class WebGLRenderTarget implements RenderTarget { + export class WebGLRenderTarget extends EventDispatcher { constructor(width: number, height: number, options?: WebGLRenderTargetOptions); uuid: string; @@ -5014,6 +5032,7 @@ declare namespace THREE { texture: Texture; depthBuffer: boolean; stencilBuffer: boolean; + depthTexture: Texture; wrapS: any; // deprecated, use texture.wrapS wrapT: any; // deprecated, use texture.wrapT magFilter: any; // deprecated, use texture.magFilter @@ -5029,12 +5048,6 @@ declare namespace THREE { clone(): WebGLRenderTarget; copy(source: WebGLRenderTarget): WebGLRenderTarget; dispose(): void; - - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; } export class WebGLRenderTargetCube extends WebGLRenderTarget { @@ -5057,6 +5070,10 @@ declare namespace THREE { beginnormal_vertex: string; bsdfs: string; bumpmap_pars_fragment: string; + clipping_planes_fragment: string; + clipping_planes_pars_fragment: string; + clipping_planes_pars_vertex: string; + clipping_planes_vertex: string; color_fragment: string; color_pars_fragment: string; color_pars_vertex: string; @@ -5068,8 +5085,6 @@ declare namespace THREE { defaultnormal_vertex: string; depth_frag: string; depth_vert: string; - depthRGBA_frag: string; - depthRGBA_vert: string; distanceRGBA_frag: string; distanceRGBA_vert: string; displacementmap_vertex: string; @@ -5094,10 +5109,8 @@ declare namespace THREE { lights_pars: string; lights_phong_fragment: string; lights_phong_pars_fragment: string; - lights_phong_pars_vertex: string; - lights_phong_vertex: string; - lights_standard_fragment: string; - lights_standard_pars_fragment: string; + lights_physical_fragment: string; + lights_physical_pars_fragment: string; lights_template: string; logdepthbuf_fragment: string; logdepthbuf_pars_fragment: string; @@ -5113,19 +5126,24 @@ declare namespace THREE { meshlambert_vert: string; meshphong_frag: string; meshphong_vert: string; - meshstandard_frag: string; - meshstandard_vert: string; + meshphysical_frag: string; + meshphysical_vert: string; metalnessmap_fragment: string; metalnessmap_pars_fragment: string; morphnormal_vertex: string; morphtarget_pars_vertex: string; morphtarget_vertex: string; + normal_flip: string; normal_frag: string; normal_fragment: string; normal_vert: string; normalmap_pars_fragment: string; + packing: string; points_frag: string; points_vert: string; + shadow_frag: string; + shadow_vert: string; + premultiplied_alpha_fragment: string; project_vertex: string; roughnessmap_fragment: string; @@ -5152,7 +5170,7 @@ declare namespace THREE { } export interface Shader { - uniforms: any; + uniforms: IUniform; vertexShader: string; fragmentShader: string; } @@ -5171,10 +5189,10 @@ declare namespace THREE { equirect: Shader; depthRGBA: Shader; distanceRGBA: Shader; + physical: Shader; }; export interface IUniform { - type: string; value: any; } @@ -5224,61 +5242,57 @@ declare namespace THREE { lights: { ambientLightColor: IUniform directionalLights: { - type: string; value: any[]; properties: { - direction: { type: string }; - color: { type: string }; - shadow: { type: string }; - shadowBias: { type: string }; - shadowRadius: { type: string }; - shadowMapSize: { type: string }; + direction: {}; + color: {}; + shadow: {}; + shadowBias: {}; + shadowRadius: {}; + shadowMapSize: {}; }; }; directionalShadowMap: IUniform; directionalShadowMatrix: IUniform; spotLights: { - type: string; value: any[]; properties: { - color: { type: string }; - position: { type: string }; - direction: { type: string }; - distance: { type: string }; - coneCos: { type: string }; - penumbraCos: { type: string }; - decay: { type: string }; - shadow: { type: string }; - shadowBias: { type: string }; - shadowRadius: { type: string }; - shadowMapSize: { type: string }; + color: {}; + position: {}; + direction: {}; + distance: {}; + coneCos: {}; + penumbraCos: {}; + decay: {}; + shadow: {}; + shadowBias: {}; + shadowRadius: {}; + shadowMapSize: {}; }; }; spotShadowMap: IUniform; spotShadowMatrix: IUniform; pointLights: { - type: string; value: any[]; properties: { - color: { type: string }; - position: { type: string }; - decay: { type: string }; - distance: { type: string }; - shadow: { type: string }; - shadowBias: { type: string }; - shadowRadius: { type: string }; - shadowMapSize: { type: string }; + color: {}; + position: {}; + decay: {}; + distance: {}; + shadow: {}; + shadowBias: {}; + shadowRadius: {}; + shadowMapSize: {}; }; }; pointShadowMap: IUniform; pointShadowMatrix: IUniform; hemisphereLigtts: { - type: string; value: any[]; properties: { - direction: { type: string }; - skycolor: { type: string }; - groundColor: { type: string }; + direction: {}; + skycolor: {}; + groundColor: {}; }; }; }; @@ -5297,11 +5311,12 @@ declare namespace THREE { export function clone(uniforms_src: any): any; } - export class Uniform { - constructor(type: string, value: string); + export class Uniform { + constructor(value: any); + constructor(type: string, value: any); // deprecated - type: string; - value: string; + type: string; // deprecated + value: any; dynamic: boolean; onUpdateCallback: Function; @@ -5313,10 +5328,20 @@ declare namespace THREE { constructor(_gl: WebGLRenderingContext, extensions: any, _infoRender: any); setMode(value: any): void; - render(start: any, count: any): void; + render(start: any, count: number): void; renderInstances(geometry: any): void; } + export class WebGLClipping { + uniform: { value: any, needsUpdate: boolean }; + numPlanes: number; + + init(planes: any[], enableLocalClipping: boolean, camera: Camera): boolean; + beginShadows(): void; + endShadows(): void; + setState(planes: any[], clipShadows: boolean, camera: Camera, cache: boolean, fromCache: boolean): void; + } + export interface WebGLCapabilitiesParameters { precision?: any; logarithmicDepthBuffer?: any; @@ -5339,7 +5364,8 @@ declare namespace THREE { floatFragmentTextures: any; floatVertexTextures: any; - getMaxPrecision(precision: any): any; + getMaxAnisotropy(): number; + getMaxPrecision(precision: string): string; } export class WebGLExtensions { @@ -5356,7 +5382,7 @@ declare namespace THREE { export class WebGLLights { constructor(gl: WebGLRenderingContext, properties: any, info: any); - + get(light: any): any; } @@ -5368,7 +5394,7 @@ declare namespace THREE { render(start: any, count: number): void; renderInstances(geometry: any, start: any, count: number): void; } - + export class WebGLObjects { constructor(gl: WebGLRenderingContext, properties: any, info: any); @@ -5379,7 +5405,7 @@ declare namespace THREE { export class WebGLProgram { constructor(renderer: WebGLRenderer, code: string, material: ShaderMaterial, parameters: WebGLRendererParameters); - + id: number; code: string; usedTimes: number; @@ -5389,7 +5415,7 @@ declare namespace THREE { uniforms: any; // deprecated, use getUniforms() attributes: any; // deprecated, use getAttributes() - getUniforms(): any; + getUniforms(): WebGLUniforms; getAttributes(): any; destroy(): void; } @@ -5399,12 +5425,37 @@ declare namespace THREE { programs: any[]; - getParameters(material: ShaderMaterial, lights: any, fog: any, object: any): any[]; + getParameters(material: ShaderMaterial, lights: any, fog: any, nClipPlanes: number, object: any): any; getProgramCode(material: ShaderMaterial, parameters: any): string; acquireProgram(material: ShaderMaterial, parameters: any, code: string): WebGLProgram; releaseProgram(program: WebGLProgram): void; } + export class WebGLTextures { + constructor(gl: any, extensions: any, state: any, properties:any, capabilities: any, paramThreeToGL: Function, info: any); + + setTexture2D(texture: any, slot: number): void; + setTextureCube(texture: any, slot: number): void; + setTextureCubeDynamic(texture: any, slot: number): void; + setupRenderTarget(renderTarget: any): void; + updateRenderTargetMipmap(renderTarget: any): void; + } + + export class WebGLUniforms { + constructor(gl: any, program: WebGLProgram, renderer: WebGLRenderer); + + renderer: WebGLRenderer; + + setValue(gl: any, value: any, renderer?: any): void; + set(gl: any, object: any, name: string): void; + setOptional(gl: any, object: any, name: string): void; + + static upload(gl: any, seq: any, values: any[], renderer: any): void; + static seqWithValue(seq: any, values: any[]): any[]; + static splitDynamic(seq: any, values: any[]): any[]; + static evalDynamic(seq: any, values: any[], object: any, camera: any): any[]; + } + export class WebGLProperties { constructor(); @@ -5418,20 +5469,30 @@ declare namespace THREE { } export class WebGLShadowMap { - constructor(_renderer: Renderer, _lights: any[], _objects: any[]); + constructor(_renderer: Renderer, _lights: any[], _objects: any[], capabilities: any); enabled: boolean; autoUpdate: boolean; needsUpdate: boolean; type: ShadowMapType; - cullFace: CullFace; + renderReverseSided: boolean; + renderSingleSided: boolean; render(scene: Scene, camera: Camera): void; - } + // deprecated + cullFace: any; + } + export class WebGLState { constructor(gl: any, extensions: any, paramThreeToGL: Function); + buffers: { + color: WebGLColorBuffer, + depth: WebGLDepthBuffer, + stencil: WebGLStencilBuffer, + }; + init(): void; initAttributes(): void; enableAttribute(attribute: string): void; @@ -5441,15 +5502,16 @@ declare namespace THREE { disable(id: string): void; getCompressedTextureFormats(): any[]; setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number): void; - setDepthFunc(func: Function): void; + setColorWrite(colorWrite: number): void; setDepthTest(depthTest: number): void; setDepthWrite(depthWrite: number): void; - setColorWrite(colorWrite: number): void; - setStencilFunc(stencilFunc: Function, stencilRef: any, stencilMask: any): void; - setStencilOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; + setDepthFunc(depthFunc: Function): void; setStencilTest(stencilTest: boolean): void; setStencilWrite(stencilWrite: any): void; + setStencilFunc(stencilFunc: Function, stencilRef: any, stencilMask: number): void; + setStencilOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; setFlipSided(flipSided: number): void; + setCullFace(cullFace: CullFace): void; setLineWidth(width: number): void; setPolygonOffset(polygonoffset: number, factor: number, units: number): void; setScissorTest(scissorTest: boolean): void; @@ -5466,10 +5528,42 @@ declare namespace THREE { reset(): void; } + export class WebGLColorBuffer { + constructor(gl: any, state: any); + + setMask(colorMask: number): void; + setLocked(lock: boolean): void; + setClear(r: number, g: number, b: number, a: number): void; + reset(): void; + } + + export class WebGLDepthBuffer { + constructor(gl: any, state: any); + + setTest(depthTest: boolean): void; + sertMask(depthMask: number): void; + setFunc(depthFunc: Function): void; + setLocked(lock: boolean): void; + setClear(depth: any): void; + reset(): void; + } + + export class WebGLStencilBuffer { + constructor(gl: any, state: any); + + setTest(stencilTest: boolean): void; + sertMask(stencilMask: number): void; + setFunc(stencilFunc: Function, stencilRef: any, stencilMask: number): void; + setOp(stencilFail: any, stencilZFail: any, stencilZPass: any): void; + setLocked(lock: boolean): void; + setClear(stencil: any): void; + reset(): void; + } + // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// export class LensFlarePlugin { constructor(renderer: WebGLRenderer, flares: any[]); - + render(scene: Scene, camera: Camera, viewportWidth: number, viewportHeight: number): void; } @@ -5480,7 +5574,7 @@ declare namespace THREE { } // Scenes ///////////////////////////////////////////////////////////////////// - + /** * Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras. */ @@ -5497,6 +5591,7 @@ declare namespace THREE { */ overrideMaterial: Material; autoUpdate: boolean; + background: any; copy(source: Scene, recursive?: boolean): Scene; } @@ -5555,7 +5650,7 @@ declare namespace THREE { // Textures ///////////////////////////////////////////////////////////////////// export let TextureIdCount: number; - export class Texture { + export class Texture extends EventDispatcher { constructor( image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, mapping?: Mapping, @@ -5565,14 +5660,15 @@ declare namespace THREE { minFilter?: TextureFilter, format?: PixelFormat, type?: TextureDataType, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); id: number; uuid: string; name: string; sourceFile: string; - image: any; // HTMLImageElement or ImageData ; + image: any; // HTMLImageElement or ImageData or { width: number, height: number } in some children; mipmaps: ImageData[]; mapping: Mapping; wrapS: Wrapping; @@ -5600,12 +5696,22 @@ declare namespace THREE { toJSON(meta: any): any; dispose(): void; transformUv(uv: Vector): void; + } - // EventDispatcher mixins - addEventListener(type: string, listener: (event: Event) => void ): void; - hasEventListener(type: string, listener: (event: Event) => void): void; - removeEventListener(type: string, listener: (event: Event) => void): void; - dispatchEvent(event: { type: string; [attachment: string]: any; }): void; + export class DepthTexture extends Texture { + constructor( + width: number, + heighht: number, + type?: TextureDataType, + mapping?: Mapping, + wrapS?: Wrapping, + wrapT?: Wrapping, + magFilter?: TextureFilter, + minFilter?: TextureFilter, + anisotropy?: number + ); + + image: { width: number, height: number }; } export class CanvasTexture extends Texture { @@ -5635,7 +5741,8 @@ declare namespace THREE { minFilter?: TextureFilter, format?: PixelFormat, type?: TextureDataType, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); images: any; // returns and sets the value of Texture.image in the codde ? @@ -5655,7 +5762,8 @@ declare namespace THREE { wrapT?: Wrapping, magFilter?: TextureFilter, minFilter?: TextureFilter, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); image: { width: number; height: number; }; @@ -5676,7 +5784,8 @@ declare namespace THREE { wrapT: Wrapping, magFilter: TextureFilter, minFilter: TextureFilter, - anisotropy?: number + anisotropy?: number, + encoding?: TextureEncoding ); image: { data: ImageData; width: number; height: number; }; @@ -5725,8 +5834,8 @@ declare namespace THREE { export namespace ShapeUtils { export function area(contour: number[]): number; - export function triangulate(contour: Vector2[], indices: boolean): Vector2[][] | number[][]; - export function triangulateShape(contour: Vector2[], holes: Vector2[][]): Vector2[][]; + export function triangulate(contour: number[], indices: boolean): number[]; + export function triangulateShape(contour: number[], holes: any[]): number[]; export function isClockWise(pts: number[]): boolean; export function b2(t: number, p0: number, p1: number, p2: number): number; export function b3(t: number, p0: number, p1: number, p2: number, p3: number): number; @@ -5747,26 +5856,28 @@ declare namespace THREE { hasPlaybackControl: boolean; isPlaying: boolean; sourceType: string; - filter: any; + filters: any[]; getOutput(): GainNode; - load(file: string): Audio; setNodeSource(audioNode: AudioBufferSourceNode): Audio; setBuffer(audioBuffer: AudioBuffer): Audio; - play(): void; - pause(): void; - stop(): void; - connect(): void; - disconnect(): void; - setFilter(value: any): void; + play(): Audio; + pause(): Audio; + stop(): Audio; + connect(): Audio; + disconnect(): Audio; + getFilters(): any[]; + setFilter(value: any[]): Audio; getFilter(): any; - setPlaybackRate(value: number): void; + setFilter(filter: any): Audio; + setPlaybackRate(value: number): Audio; getPlaybackRate(): number; onEnded(): void; - setLoop(value: boolean): void; getLoop(): boolean; - setVolume(value: number): void; + setLoop(value: boolean): void; getVolume(): number; + setVolume(value: number): Audio; + load(file: string): Audio; // deprecated, use the AudioLoader class } export class AudioAnalyser { @@ -5775,9 +5886,15 @@ declare namespace THREE { analyser: any; data: Uint8Array; - getData(): Uint8Array; + getFrequencyData(): Uint8Array; + getAverageFrequency(): number; + + // deprecated + getData(file: any): any; } + export const AudioContext: AudioContext; + export class AudioBuffer { constructor(context: any); @@ -5896,7 +6013,10 @@ declare namespace THREE { closePath(): void; getPoint(t: number): T; getLength(): number; + updateArcLengths(): void; getCurveLengths(): number[]; + getSpacedPoints(divisions?: number): T[]; + getPoints(divisions?: number): T[]; createPointsGeometry(divisions: number): Geometry; createSpacedPointsGeometry(divisions: number): Geometry; createGeometry(points: T[]): Geometry; @@ -5923,7 +6043,7 @@ declare namespace THREE { export class Path extends CurvePath { constructor(points?: Vector2[]); - actions: PathAction[]; + currentPoint: Vector2; fromPoints(vectors: Vector2[]): void; moveTo(x: number, y: number): void; @@ -5935,8 +6055,19 @@ declare namespace THREE { absarc(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; ellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number): void; absellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number): void; - getSpacedPoints(divisions?: number): Vector2[]; - getPoints(divisions?: number, closedPath?: boolean): Vector2[]; + } + + export class ShapePath { + constructor(); + + subPaths: any[]; + currentPath: any; + + moveTo(x: number, y: number): void; + lineTo(x: number, y: number): void; + quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): void; + bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): void; + splineThru(pts: Vector2[]): void; toShapes(isCCW: boolean, noHoles: any): Shape[]; } @@ -5969,7 +6100,7 @@ declare namespace THREE { export class ClosedSplineCurve3 extends CatmullRomCurve3 {} // deprecated, use CatmullRomCurve3 export class SplineCurve3 extends CatmullRomCurve3 {} // will be deprecated, use CatmullRomCurve3 - + export class CubicBezierCurve extends Curve { constructor(v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2); @@ -5989,7 +6120,7 @@ declare namespace THREE { getPoint(t: number): Vector3; } - + export class EllipseCurve extends Curve { constructor(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean, aRotation: number); @@ -6021,7 +6152,7 @@ declare namespace THREE { getPoint(t: number): Vector3; } - + export class QuadraticBezierCurve extends Curve { constructor( v0: Vector2, v1: Vector2, v2: Vector2 ); @@ -6045,7 +6176,7 @@ declare namespace THREE { points: Vector2[]; } - + // Extras / Geometries ///////////////////////////////////////////////////////////////////// export class BoxBufferGeometry extends BufferGeometry { @@ -6149,6 +6280,14 @@ declare namespace THREE { }; } + export class ConeBufferGeometry extends BufferGeometry { + constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); + } + + export class ConeGeometry extends CylinderGeometry { + constructor(radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); + } + export class DodecahedronGeometry extends Geometry { constructor(radius: number, detail: number); @@ -6458,7 +6597,7 @@ declare namespace THREE { } export class BoxHelper extends LineSegments { - constructor(object?: Object3D); + constructor(object?: Object3D, color?: Color); update(object?: Object3D): void; } @@ -6477,7 +6616,6 @@ declare namespace THREE { light: Light; lightPlane: Line; - targetLine: Line; dispose(): void; update(): void; @@ -6497,12 +6635,9 @@ declare namespace THREE { } export class GridHelper extends LineSegments { - constructor(size: number, step: number); + constructor(size: number, divisions: number, color1?: Color|number, color2?: Color|number); - color1: Color; - color2: Color; - - setColors(colorCenterLine: number, colorGrid: number): void; + setColors(color1?: Color|number, color2?: Color|number): void; // deprecated } export class HemisphereLightHelper extends Object3D { @@ -6536,10 +6671,9 @@ declare namespace THREE { } export class SpotLightHelper extends Object3D { - constructor(light: Light, sphereSize: number, arrowLength: number); + constructor(light: Light); light: Light; - cone: Mesh; dispose(): void; update(): void; From 35cdb75d2937b293e1ecff89de9d15e724530aec Mon Sep 17 00:00:00 2001 From: midknight41 Date: Sun, 31 Jul 2016 13:47:55 +0000 Subject: [PATCH 42/79] fixed SES, SWF, and added Lambda --- aws-sdk/aws-sdk.d.ts | 2997 +++++++++++++++++++++++------------------- 1 file changed, 1621 insertions(+), 1376 deletions(-) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index a5341fcb45..a633b96206 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -9,1496 +9,1741 @@ declare module "aws-sdk" { - export var config: ClientConfig; + export var config: ClientConfig; - export function Config(json: any): void; + export function Config(json: any): void; - export class Credentials { - constructor(accessKeyId: string, secretAccessKey: string, sessionToken?: string); - accessKeyId: string; - } + export class Credentials { + constructor(accessKeyId: string, secretAccessKey: string, sessionToken?: string); + accessKeyId: string; + } - export class EnvironmentCredentials extends Credentials { - constructor(profile: string); - } + export class EnvironmentCredentials extends Credentials { + constructor(profile: string); + } - export interface Logger { - write?: (chunk: any, encoding?: string, callback?: () => void) => void; - log?: (...messages: any[]) => void; - } + export interface Logger { + write?: (chunk: any, encoding?: string, callback?: () => void) => void; + log?: (...messages: any[]) => void; + } - export interface HttpOptions { - proxy?: string; - agent?: any; - timeout?: number; - xhrAsync?: boolean; - xhrWithCredentials?: boolean; - } + export interface HttpOptions { + proxy?: string; + agent?: any; + timeout?: number; + xhrAsync?: boolean; + xhrWithCredentials?: boolean; + } - export class Endpoint { - constructor(endpoint:string); + export class Endpoint { + constructor(endpoint: string); - host:string; - hostname:string; - href:string; - port:number; - protocol:string; - } + host: string; + hostname: string; + href: string; + port: number; + protocol: string; + } - export interface Services { - autoscaling?: any; - cloudformation?: any; - cloudfront?: any; - cloudsearch?: any; - cloudsearchdomain?: any; - cloudtrail?: any; - cloudwatch?: any; - cloudwatchlogs?: any; - cognitoidentity?: any; - cognitosync?: any; - datapipeline?: any; - directconnect?: any; - dynamodb?: any; - ec2?: any; - ecs?: any; - elasticache?: any; - elasticbeanstalk?: any; - elastictranscoder?: any; - elb?: any; - emr?: any; - glacier?: any; - httpOptions?: HttpOptions; - iam?: any; - importexport?: any; - kinesis?: any; - opsworks?: any; - rds?: any; - redshift?: any; - route53?: any; - route53domains?: any; - s3?: any; - ses?: any; - simpledb?: any; - sns?: any; - sqs?: any; - storagegateway?: any; - sts?: any; - support?: any; - swf?: any; - } + interface AwsError extends Error { + stack: string; + } - export interface ClientConfigPartial extends Services { - credentials?: Credentials; - region?: string; - accessKeyId?: string; - secretAccessKey?: string; - computeChecksums?: boolean; - convertResponseTypes?: boolean; - logger?: Logger; - maxRedirects?: number; - maxRetries?: number; - paramValidation?: boolean; - s3ForcePathStyle?: boolean; - apiVersion?: any; - apiVersions?: Services; - signatureVersion?: string; - sslEnabled?: boolean; - systemClockOffset?: number; - } + export interface Services { + autoscaling?: any; + cloudformation?: any; + cloudfront?: any; + cloudsearch?: any; + cloudsearchdomain?: any; + cloudtrail?: any; + cloudwatch?: any; + cloudwatchlogs?: any; + cognitoidentity?: any; + cognitosync?: any; + datapipeline?: any; + directconnect?: any; + dynamodb?: any; + ec2?: any; + ecs?: any; + elasticache?: any; + elasticbeanstalk?: any; + elastictranscoder?: any; + elb?: any; + emr?: any; + glacier?: any; + httpOptions?: HttpOptions; + iam?: any; + importexport?: any; + kinesis?: any; + opsworks?: any; + rds?: any; + redshift?: any; + route53?: any; + route53domains?: any; + s3?: any; + ses?: any; + simpledb?: any; + sns?: any; + sqs?: any; + storagegateway?: any; + sts?: any; + support?: any; + swf?: any; + } - export interface ClientConfig extends ClientConfigPartial { - update?: (options: ClientConfigPartial, allUnknownKeys?: boolean) => void; - getCredentials?: (callback: (err?: any) => void) => void ; - loadFromPath?: (path: string) => void; - credentials: Credentials; - region: string; - } + export interface ClientConfigPartial extends Services { + credentials?: Credentials; + region?: string; + accessKeyId?: string; + secretAccessKey?: string; + computeChecksums?: boolean; + convertResponseTypes?: boolean; + logger?: Logger; + maxRedirects?: number; + maxRetries?: number; + paramValidation?: boolean; + s3ForcePathStyle?: boolean; + apiVersion?: any; + apiVersions?: Services; + signatureVersion?: string; + sslEnabled?: boolean; + systemClockOffset?: number; + } - export class SQS { - constructor(options?: any); - endpoint:Endpoint; + export interface ClientConfig extends ClientConfigPartial { + update?: (options: ClientConfigPartial, allUnknownKeys?: boolean) => void; + getCredentials?: (callback: (err?: any) => void) => void; + loadFromPath?: (path: string) => void; + credentials: Credentials; + region: string; + } - addPermission(params: SQS.AddPermissionParams, callback: (err:Error, data:any) => void): void; - changeMessageVisibility(params: SQS.ChangeMessageVisibilityParams, callback: (err:Error, data:any) => void): void; - changeMessageVisibilityBatch(params: SQS.ChangeMessageVisibilityBatchParams, callback: (err:Error, data:SQS.ChangeMessageVisibilityBatchResponse) => void): void; - createQueue(params: SQS.CreateQueueParams, callback: (err: Error, data: SQS.CreateQueueResult) => void): void; - deleteMessage(params: SQS.DeleteMessageParams, callback: (err: Error, data: any) => void): void; - deleteMessageBatch(params: SQS.DeleteMessageBatchParams, callback: (err: Error, data: SQS.DeleteMessageBatchResult) => void): void; - deleteQueue(params: { QueueUrl: string; }, callback: (err: Error, data: any) => void): void; - getQueueAttributes(params: SQS.GetQueueAttributesParams, callback: (err: Error, data: SQS.GetQueueAttributesResult) => void): void; - getQueueUrl(params: SQS.GetQueueUrlParams, callback: (err: Error, data: { QueueUrl: string; }) => void): void; - listDeadLetterSourceQueues(params: {QueueUrl:string}, callback: (err: Error, data: {queueUrls: string[]}) => void): void; - listQueues(params: {QueueNamePrefix?:string}, callback: (err: Error, data: {QueueUrls: string[]}) => void): void; - purgeQueue(params: {QueueUrl: string}, callback: (err: Error, data: any) => void): void; - receiveMessage(params: SQS.ReceiveMessageParams, callback: (err: Error, data: SQS.ReceiveMessageResult) => void): void; - removePermission(params: {QueueUrl: string, Label: string}, callback: (err: Error, data: any) => void): void; - sendMessage(params: SQS.SendMessageParams, callback: (err: Error, data: SQS.SendMessageResult) => void): void; - sendMessageBatch(params: SQS.SendMessageBatchParams, callback: (err: Error, data: SQS.SendMessageBatchResult) => void): void; - setQueueAttributes(params: SQS.SetQueueAttributesParams, callback: (err: Error, data: any) => void): void; - } + export class Lambda { + constructor(options?: any); + endpoint: Endpoint; - export class SES { - constructor(options?: any); - public client: Ses.Client; - } + addPermission(params: Lambda.AddPermissionParams, callback: (err: AwsError, data: any) => void): void; + createAlias(params: Lambda.CreateAliasParams, callback: (err: AwsError, data: any) => void): void; + createEventSourceMapping(params: Lambda.CreateEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; + createFunction(params: Lambda.CreateFunctionParams, callback: (err: AwsError, data: any) => void): void; + deleteAlias(params: Lambda.DeleteAliasParams, callback: (err: AwsError, data: any) => void): void; + deleteEventSourceMapping(params: Lambda.DeleteEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; + deleteFunction(params: Lambda.DeleteFunctionParams, callback: (err: AwsError, data: any) => void): void; + getAlias(params: Lambda.GetAliasParams, callback: (err: AwsError, data: any) => void): void; + getEventSourceMapping(params: Lambda.GetEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; + getFunction(params: Lambda.GetFunctionParams, callback: (err: AwsError, data: any) => void): void; + getFunctionConfiguration(params: Lambda.GetFunctionConfigurationParams, callback: (err: AwsError, data: any) => void): void; + getPolicy(params: Lambda.GetPolicyParams, callback: (err: AwsError, data: any) => void): void; + invoke(params: Lambda.InvokeParams, callback: (err: AwsError, data: any) => void): void; + listAliases(params: Lambda.ListAliasesParams, callback: (err: AwsError, data: any) => void): void; + listEventSourceMappings(params: Lambda.ListEventSourceMappingsParams, callback: (err: AwsError, data: any) => void): void; + listFunctions(params: Lambda.ListFunctionsParams, callback: (err: AwsError, data: any) => void): void; + listVersionsByFunction(params: Lambda.ListVersionsByFunctionParams, callback: (err: AwsError, data: any) => void): void; + publishVersion(params: Lambda.PublishVersionParams, callback: (err: AwsError, data: any) => void): void; + removePermission(params: Lambda.RemovePermissionParams, callback: (err: AwsError, data: any) => void): void; + updateAlias(params: Lambda.UpdateAliasParams, callback: (err: AwsError, data: any) => void): void; + updateEventSourceMapping(params: Lambda.UpdateEventSourceMappingParams, callback: (err: AwsError, data: any) => void): void; + updateFunctionCode(params: Lambda.UpdateFunctionCodeParams, callback: (err: AwsError, data: any) => void): void; + updateFunctionConfiguration(params: Lambda.UpdateFunctionConfigurationParams, callback: (err: AwsError, data: any) => void): void; + } - export class SNS { - constructor(options?: any); - publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void; - } + export class SQS { + constructor(options?: any); + endpoint: Endpoint; - export class SimpleWorkflow { - constructor(options?: any); - public client: Swf.Client; - } + addPermission(params: SQS.AddPermissionParams, callback: (err: AwsError, data: any) => void): void; + changeMessageVisibility(params: SQS.ChangeMessageVisibilityParams, callback: (err: AwsError, data: any) => void): void; + changeMessageVisibilityBatch(params: SQS.ChangeMessageVisibilityBatchParams, callback: (err: AwsError, data: SQS.ChangeMessageVisibilityBatchResponse) => void): void; + createQueue(params: SQS.CreateQueueParams, callback: (err: AwsError, data: SQS.CreateQueueResult) => void): void; + deleteMessage(params: SQS.DeleteMessageParams, callback: (err: AwsError, data: any) => void): void; + deleteMessageBatch(params: SQS.DeleteMessageBatchParams, callback: (err: AwsError, data: SQS.DeleteMessageBatchResult) => void): void; + deleteQueue(params: { QueueUrl: string; }, callback: (err: AwsError, data: any) => void): void; + getQueueAttributes(params: SQS.GetQueueAttributesParams, callback: (err: AwsError, data: SQS.GetQueueAttributesResult) => void): void; + getQueueUrl(params: SQS.GetQueueUrlParams, callback: (err: AwsError, data: { QueueUrl: string; }) => void): void; + listDeadLetterSourceQueues(params: { QueueUrl: string }, callback: (err: AwsError, data: { queueUrls: string[] }) => void): void; + listQueues(params: { QueueNamePrefix?: string }, callback: (err: AwsError, data: { QueueUrls: string[] }) => void): void; + purgeQueue(params: { QueueUrl: string }, callback: (err: AwsError, data: any) => void): void; + receiveMessage(params: SQS.ReceiveMessageParams, callback: (err: AwsError, data: SQS.ReceiveMessageResult) => void): void; + removePermission(params: { QueueUrl: string, Label: string }, callback: (err: AwsError, data: any) => void): void; + sendMessage(params: SQS.SendMessageParams, callback: (err: AwsError, data: SQS.SendMessageResult) => void): void; + sendMessageBatch(params: SQS.SendMessageBatchParams, callback: (err: AwsError, data: SQS.SendMessageBatchResult) => void): void; + setQueueAttributes(params: SQS.SetQueueAttributesParams, callback: (err: AwsError, data: any) => void): void; + } - export class S3 { - constructor(options?: any); - getObject(params: s3.GetObjectRequest, callback: (err: Error, data: any) => void): void; - putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void; - deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void; - headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; - getSignedUrl(operation: string, params: any): string; - getSignedUrl(operation: string, params: any, callback: (err: Error, url: string) => void): void; - upload(params?: s3.PutObjectRequest, options?: s3.UploadOptions, callback?: (err: Error, data: any) => void): void; - } + export class SES { + constructor(options?: any); + endpoint: Endpoint; - export class STS{ - constructor(options?: any); + sendEmail(params: any, callback: (err: any, data: SES.SendEmailResult) => void): void; + } + + export class SNS { + constructor(options?: any); + endpoint: Endpoint; + + publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void; + } + + export class SWF { + constructor(options?: any); + endpoint: Endpoint; + + countClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + countOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + countPendingActivityTasks(params: any, callback: (err: any, data: any) => void): void; + countPendingDecisionTasks(params: any, callback: (err: any, data: any) => void): void; + deprecateActivityType(params: any, callback: (err: any, data: any) => void): void; + deprecateDomain(params: any, callback: (err: any, data: any) => void): void; + deprecateWorkflowType(params: any, callback: (err: any, data: any) => void): void; + describeActivityType(params: any, callback: (err: any, data: any) => void): void; + describeDomain(params: any, callback: (err: any, data: any) => void): void; + describeWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + describeWorkflowType(params: any, callback: (err: any, data: any) => void): void; + getWorkflowExecutionHistory(params: any, callback: (err: any, data: any) => void): void; + listActivityTypes(params: any, callback: (err: any, data: any) => void): void; + listClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + listDomains(params: any, callback: (err: any, data: any) => void): void; + listOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + listWorkflowTypes(params: any, callback: (err: any, data: any) => void): void; + pollForActivityTask(params: any, callback: (err: any, data: Swf.ActivityTask) => void): void; + pollForDecisionTask(params: any, callback: (err: any, data: Swf.DecisionTask) => void): void; + recordActivityTaskHeartbeat(params: any, callback: (err: any, data: any) => void): void; + registerActivityType(params: any, callback: (err: any, data: any) => void): void; + registerDomain(params: any, callback: (err: any, data: any) => void): void; + registerWorkflowType(params: any, callback: (err: any, data: any) => void): void; + requestCancelWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + respondActivityTaskCanceled(params: Swf.RespondActivityTaskCanceledRequest, callback: (err: any, data: any) => void): void; + respondActivityTaskCompleted(params: Swf.RespondActivityTaskCompletedRequest, callback: (err: any, data: any) => void): void; + respondActivityTaskFailed(params: Swf.RespondActivityTaskFailedRequest, callback: (err: any, data: any) => void): void; + respondDecisionTaskCompleted(params: Swf.RespondDecisionTaskCompletedRequest, callback: (err: any, data: any) => void): void; + signalWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + startWorkflowExecution(params: any, callback: (err: any, data: Swf.StartWorkflowExecutionResult) => void): void; + terminateWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + + } + + export class S3 { + constructor(options?: any); + endpoint: Endpoint; + + getObject(params: s3.GetObjectRequest, callback: (err: Error, data: any) => void): void; + putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void; + deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void; + headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void; + getSignedUrl(operation: string, params: any): string; + getSignedUrl(operation: string, params: any, callback: (err: Error, url: string) => void): void; + upload(params?: s3.PutObjectRequest, options?: s3.UploadOptions, callback?: (err: Error, data: any) => void): void; + } + + export class STS { + constructor(options?: any); + endpoint: Endpoint; /** * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) that you can use to access AWS resources that you might not normally have access to. */ - assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: sts.AssumeRoleCallbackData) => void): void; + assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: sts.AssumeRoleCallbackData) => void): void; /** * Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response. */ - assumeRoleWithSAML(params: sts.AssumeRoleWithSAMLParams, callback: (err: any, data: any) => void): void; + assumeRoleWithSAML(params: sts.AssumeRoleWithSAMLParams, callback: (err: any, data: any) => void): void; /** * Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider, such as Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity provider. */ - assumeRoleWithWebIdentity(params: sts.AssumeRoleWithWebIdentityParams, callback: (err: any, data: any) => void): void; + assumeRoleWithWebIdentity(params: sts.AssumeRoleWithWebIdentityParams, callback: (err: any, data: any) => void): void; /** * Creates a credentials object from STS response data containing credentials information. */ - credentialsFrom(params: sts.CredentialsFromParams, callback: (err: any, data: any) => void): void; + credentialsFrom(params: sts.CredentialsFromParams, callback: (err: any, data: any) => void): void; /** * Decodes additional information about the authorization status of a request from an encoded message returned in response to an AWS request. */ - decodeAuthorizationMessage(params: sts.DecodeAuthorizationMessageParams, callback: (err: any, data: any) => void): void; + decodeAuthorizationMessage(params: sts.DecodeAuthorizationMessageParams, callback: (err: any, data: any) => void): void; /** * Returns details about the IAM identity whose credentials are used to call the API. */ - getCallerIdentity(params: {}, callback: (err: any, data: any) => void): void; + getCallerIdentity(params: {}, callback: (err: any, data: any) => void): void; /** * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) for a federated user. */ - getFederationToken(params: sts.GetFederationTokenParams, callback: (err: any, data: any) => void): void; + getFederationToken(params: sts.GetFederationTokenParams, callback: (err: any, data: any) => void): void; /** * Returns a set of temporary credentials for an AWS account or IAM user. */ - getSessionToken(params: sts.GetSessionTokenParams, callback: (err: any, data: any) => void): void; + getSessionToken(params: sts.GetSessionTokenParams, callback: (err: any, data: any) => void): void; - } + } - export class ECS { - constructor(options?: any); - /** - * Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount, Amazon ECS spawns another instantiation of the task in the specified cluster. To update an existing service, see UpdateService. - */ - createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void; + export class ECS { + constructor(options?: any); + endpoint: Endpoint; + /** + * Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount, Amazon ECS spawns another instantiation of the task in the specified cluster. To update an existing service, see UpdateService. + */ + createService(params: ecs.CreateServicesParams, callback: (err: any, data: any) => void): void; /** * Describes one or more of your clusters. */ - describeClusters(params: ecs.DescribeClustersParams, callback: (err: any, data: any) => void): void; + describeClusters(params: ecs.DescribeClustersParams, callback: (err: any, data: any) => void): void; /** * Describes the specified services running in your cluster. */ - describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void; + describeServices(params: ecs.DescribeServicesParams, callback: (err: any, data: any) => void): void; /** * Describes a specified task or tasks. */ - describeTasks(params: ecs.DescribeTasksParams, callback: (err: any, data: any) => void): void; + describeTasks(params: ecs.DescribeTasksParams, callback: (err: any, data: any) => void): void; /** * Describes a task definition. You can specify a family and revision to find information about a specific task definition, or you can simply specify the family to find the latest ACTIVE revision in that family. */ - describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void; + describeTaskDefinition(params: ecs.DescribeTaskDefinitionParams, callback: (err: any, data: any) => void): void; /** * Registers a new task definition from the supplied family and containerDefinitions. Optionally, you can add data volumes to your containers with the volumes parameter. For more information about task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon EC2 Container Service Developer Guide. */ - registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void; + registerTaskDefinition(params: ecs.RegisterTaskDefinitionParams, callback: (err: any, data: any) => void): void; /** * Modifies the desired count, deployment configuration, or task definition used in a service. */ - updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void; - } - - export class DynamoDB { - constructor(options?: any); - } - - // ========================================================== - - export module DynamoDB { - - interface _DDBDC_Generic { - TableName: string; - ExpressionAttributeNames?: string[]; - ReturnConsumedCapacity?: "INDEXES" | "TOTAL" | "NONE"; - } - - type _DDBDC_ComparisonOperator = "EQ" | "NE" | "IN" | "LE" | "LT" | "GE" | "GT" | "BETWEEN" | "NOT_NULL" | "NULL" | "CONTAINS" | "NOT_CONTAINS" | "BEGINS_WITH" - type _DDBDC_Keys = { [someKey: string]: any }; - type _DDBDC_KeyComparison = { - [someKey: string]: { - AttributeValueList: any[]; - ComparisonOperator: _DDBDC_ComparisonOperator; - } - }; - - interface _DDBDC_Reader extends _DDBDC_Generic { - ConsistentRead?: boolean; - ProjectionExpression?: string; - AttributesToGet?: string[]; - } - - interface _DDBDC_Writer extends _DDBDC_Generic { - ExpressionAttributeValues?: _DDBDC_Keys; - ReturnItemCollectionMetrics?: "SIZE" | "NONE"; - ReturnValues?: "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW"; - ConditionExpression?: string; - ConditionalOperator?: "AND" | "OR"; - Expected?: { - [someKey: string]: { - AttributeValueList: any[]; - ComparisonOperator: _DDBDC_ComparisonOperator; - Exists: boolean; - Value: any; - } - } - } - - interface UpdateParam extends _DDBDC_Writer { - Key: _DDBDC_Keys; - AttributeUpdates: { - [someKey: string]: { - Action: "PUT" | "ADD" | "DELETE"; - Value: any - } - } - } - - interface QueryParam extends _DDBDC_Reader { - ConditionalOperator?: "AND" | "OR"; - ExclusiveStartKey?: _DDBDC_Keys; - ExpressionAttributeValues?: _DDBDC_Keys; - FilterExpression?: string; - IndexName?: string; - KeyConditionExpression?: string; - KeyConditions?: _DDBDC_KeyComparison; - Limit?: number; - QueryFilter?: _DDBDC_KeyComparison; - ScanIndexForward?: boolean; - Select?: "ALL_ATTRIBUTES" | "ALL_PROJECTED_ATTRIBUTES" | "SPECIFIC_ATTRIBUTES" | "COUNT"; - } - - interface ScanParam extends QueryParam { - Segment?: number; - ScanFilter?: _DDBDC_KeyComparison; - TotalSegments?: number; - } - - interface GetParam extends _DDBDC_Reader { - Key: _DDBDC_Keys; - } - - interface PutParam extends _DDBDC_Writer { - Item: _DDBDC_Keys; - } - - interface DeleteParam extends _DDBDC_Writer { - Key: _DDBDC_Keys; - } - - export class DocumentClient { - constructor(options?: any); - get(params: GetParam, next: (err: any, data: any) => void): void; - put(params: PutParam, next: (err: any, data: any) => void): void; - delete(params: DeleteParam, next: (err: any, data: any) => void): void; - query(params: QueryParam, next: (err: any, data: any) => void): void; - scan(params: ScanParam, next: (err: any, data: any) => void): void; - update(params: UpdateParam, next: (err: any, data: any) => void): void; - createSet(list: any[], options?: { validate?: boolean }): { values: any[], type: string }; - batchGet(params: any, next: (err: any, data: any) => void): void; - batchWrite(params: any, next: (err: any, data: any) => void): void; - } - - } - -// =========================================================== - - export module SQS { - - export interface SqsOptions { - params?: any; - endpoint?: string; - accessKeyId?: string; - secretAccessKey?: string; - sessionToken?: Credentials; - credentials?: Credentials; - credentialProvider?: any; - region?: string; - maxRetries?: number; - maxRedirects?: number; - sslEnabled?: boolean; - paramValidation?: boolean; - computeChecksums?: boolean; - convertResponseTypes?: boolean; - correctClockSkew?: boolean; - s3ForcePathStyle?: boolean; - s3BucketEndpoint?: boolean; - httpOptions?: HttpOptions; - apiVersion?: string; - apiVersions?: { [serviceName:string]: string}; - logger?: Logger; - systemClockOffset?: number; - signatureVersion?: string; - signatureCache?: boolean; - } - - export interface AddPermissionParams { - QueueUrl: string; - Label: string; - AWSAccountIds:string[]; - Actions:string[]; - } - - export interface ChangeMessageVisibilityParams { - QueueUrl: string, - ReceiptHandle: string, - VisibilityTimeout: number - } - - export interface ChangeMessageVisibilityBatchParams { - QueueUrl: string, - Entries: { Id: string; ReceiptHandle: string; VisibilityTimeout?: number; }[] - } - - export interface ChangeMessageVisibilityBatchResponse { - Successful: { Id:string }[]; - Failed: BatchResultErrorEntry[]; - } - - export interface SendMessageParams { - QueueUrl?: string; - MessageBody: string; - DelaySeconds?: number; - MessageAttributes?: { [name:string]: MessageAttribute; } - } - - export interface ReceiveMessageParams { - QueueUrl: string; - MaxNumberOfMessages?: number; - VisibilityTimeout?: number; - AttributeNames?: string[]; - MessageAttributeNames?: string[]; - WaitTimeSeconds?:number; - } - - export interface DeleteMessageBatchParams { - QueueUrl: string; - Entries: DeleteMessageBatchRequestEntry[]; - } - - export interface DeleteMessageBatchRequestEntry { - Id: string; - ReceiptHandle: string; - } - - export interface DeleteMessageParams { - QueueUrl: string; - ReceiptHandle: string; - } - - export interface SendMessageBatchParams { - QueueUrl: string; - Entries: SendMessageBatchRequestEntry[]; - } - - export interface SendMessageBatchRequestEntry { - Id: string; - MessageBody: string; - DelaySeconds?: number; - MessageAttributes?: { [name:string]: MessageAttribute; } - } - - export interface CreateQueueParams { - QueueName: string; - Attributes: QueueAttributes; - } - - export interface QueueAttributes { - [name:string]: any; - DelaySeconds?: number; - MaximumMessageSize?: number; - MessageRetentionPeriod?: number; - Policy?: any; - ReceiveMessageWaitTimeSeconds?: number; - VisibilityTimeout?: number; - RedrivePolicy?: any; - } - - export interface GetQueueAttributesParams { - QueueUrl: string; - AttributeNames: string[]; - } - - export interface GetQueueAttributesResult { - Attributes: {[name:string]: string}; - } - - export interface GetQueueUrlParams { - QueueName: string; - QueueOwnerAWSAccountId?: string; - } - - export interface SendMessageResult { - MessageId: string; - MD5OfMessageBody: string; - MD5OfMessageAttributes: string; - } - - export interface ReceiveMessageResult { - Messages: Message[]; - } - - export interface Message { - MessageId: string; - ReceiptHandle: string; - MD5OfBody: string; - Body: string; - Attributes: { [name:string]:any }; - MD5OfMessageAttributes:string; - MessageAttributes: { [name:string]: MessageAttribute; } - } - - export interface MessageAttribute { - StringValue?: string; - BinaryValue?: any; //(Buffer, Typed Array, Blob, String) - StringListValues?: string[]; - BinaryListValues?: any[]; - DataType: string; - } - - export interface DeleteMessageBatchResult { - Successful: DeleteMessageBatchResultEntry[]; - Failed: BatchResultErrorEntry[]; - } - - export interface DeleteMessageBatchResultEntry { - Id: string; - } - - export interface BatchResultErrorEntry { - Id: string; - Code: string; - Message?: string; - SenderFault: boolean; - } - - export interface SendMessageBatchResult { - Successful: SendMessageBatchResultEntry[]; - Failed: BatchResultErrorEntry[]; - } - - export interface SendMessageBatchResultEntry { - Id: string; - MessageId: string; - MD5OfMessageBody: string; - MD5OfMessageAttributes:string; - } - - export interface CreateQueueResult { - QueueUrl: string; - } - - export interface SetQueueAttributesParams { - QueueUrl: string; - Attributes: QueueAttributes; - } - - } - - export module Ses { - - export interface Client { - config: ClientConfig; - - sendEmail(params: any, callback: (err: any, data: SendEmailResult) => void): void; - } - - export interface SendEmailRequest { - Source: string; - Destination: Destination; - Message: Message; - ReplyToAddresses: string[]; - ReturnPath: string; - } - - export class Destination { - ToAddresses: string[]; - CcAddresses: string[]; - BccAddresses: string[]; - } - - export class Message { - Subject: Content; - Body: Body; - } - - export class Content { - Data: string; - Charset: string; - } - - export class Body { - Text: Content; - Html: Content; - } - - export class SendEmailResult { - MessageId: string; - } - - } - - export module Swf { - - export class Client { - //constructor(options?: any); - public config: ClientConfig; - - countClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - countOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - countPendingActivityTasks(params: any, callback: (err: any, data: any) => void): void; - countPendingDecisionTasks(params: any, callback: (err: any, data: any) => void): void; - deprecateActivityType(params: any, callback: (err: any, data: any) => void): void; - deprecateDomain(params: any, callback: (err: any, data: any) => void): void; - deprecateWorkflowType(params: any, callback: (err: any, data: any) => void): void; - describeActivityType(params: any, callback: (err: any, data: any) => void): void; - describeDomain(params: any, callback: (err: any, data: any) => void): void; - describeWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - describeWorkflowType(params: any, callback: (err: any, data: any) => void): void; - getWorkflowExecutionHistory(params: any, callback: (err: any, data: any) => void): void; - listActivityTypes(params: any, callback: (err: any, data: any) => void): void; - listClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - listDomains(params: any, callback: (err: any, data: any) => void): void; - listOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; - listWorkflowTypes(params: any, callback: (err: any, data: any) => void): void; - pollForActivityTask(params: any, callback: (err: any, data: ActivityTask) => void): void; - pollForDecisionTask(params: any, callback: (err: any, data: DecisionTask) => void): void; - recordActivityTaskHeartbeat(params: any, callback: (err: any, data: any) => void): void; - registerActivityType(params: any, callback: (err: any, data: any) => void): void; - registerDomain(params: any, callback: (err: any, data: any) => void): void; - registerWorkflowType(params: any, callback: (err: any, data: any) => void): void; - requestCancelWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - respondActivityTaskCanceled(params: RespondActivityTaskCanceledRequest, callback: (err: any, data: any) => void): void; - respondActivityTaskCompleted(params: RespondActivityTaskCompletedRequest, callback: (err: any, data: any) => void): void; - respondActivityTaskFailed(params: RespondActivityTaskFailedRequest, callback: (err: any, data: any) => void): void; - respondDecisionTaskCompleted(params: RespondDecisionTaskCompletedRequest, callback: (err: any, data: any) => void): void; - signalWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - startWorkflowExecution(params: any, callback: (err: any, data: StartWorkflowExecutionResult) => void): void; - terminateWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; - } - - export interface PollForActivityTaskRequest { - domain?: string; - taskList?: TaskList; - identity?: string; - } - - export interface TaskList { - name?: string; - } - - export interface PollForDecisionTaskRequest { - domain?: string; - taskList?: TaskList; - identity?: string; - nextPageToken?: string; - maximumPageSize?: number; - reverseOrder?: Boolean; - } - - export interface StartWorkflowExecutionRequest { - domain?: string; - workflowId?: string; - workflowType?: WorkflowType; - taskList?: TaskList; - input?: string; - executionStartToCloseTimeout?: string; - tagList?: string[]; - taskStartToCloseTimeout?: string; - childPolicy?: string; - } - - export interface WorkflowType { - name?: string; - version?: string; - } - - export interface RespondDecisionTaskCompletedRequest { - taskToken?: string; - decisions?: Decision[]; - executionContext?: string; - } - - export interface Decision { - decisionType?: string; - scheduleActivityTaskDecisionAttributes?: ScheduleActivityTaskDecisionAttributes; - requestCancelActivityTaskDecisionAttributes?: RequestCancelActivityTaskDecisionAttributes; - completeWorkflowExecutionDecisionAttributes?: CompleteWorkflowExecutionDecisionAttributes; - failWorkflowExecutionDecisionAttributes?: FailWorkflowExecutionDecisionAttributes; - cancelWorkflowExecutionDecisionAttributes?: CancelWorkflowExecutionDecisionAttributes; - continueAsNewWorkflowExecutionDecisionAttributes?: ContinueAsNewWorkflowExecutionDecisionAttributes; - recordMarkerDecisionAttributes?: RecordMarkerDecisionAttributes; - startTimerDecisionAttributes?: StartTimerDecisionAttributes; - cancelTimerDecisionAttributes?: CancelTimerDecisionAttributes; - signalExternalWorkflowExecutionDecisionAttributes?: SignalExternalWorkflowExecutionDecisionAttributes; - requestCancelExternalWorkflowExecutionDecisionAttributes?: RequestCancelExternalWorkflowExecutionDecisionAttributes; - startChildWorkflowExecutionDecisionAttributes?: StartChildWorkflowExecutionDecisionAttributes; - } - - export interface ScheduleActivityTaskDecisionAttributes { - activityType?: ActivityType; - activityId?: string; - control?: string; - input?: string; - scheduleToCloseTimeout?: string; - taskList?: TaskList; - scheduleToStartTimeout?: string; - startToCloseTimeout?: string; - heartbeatTimeout?: string; - } - - export interface ActivityType { - name?: string; - version?: string; - } - - export interface RequestCancelActivityTaskDecisionAttributes { - activityId?: string; - } - - export interface CompleteWorkflowExecutionDecisionAttributes { - result?: string; - } - - export interface FailWorkflowExecutionDecisionAttributes { - reason?: string; - details?: string; - } - - export interface CancelWorkflowExecutionDecisionAttributes { - details?: string; - } - - export interface ContinueAsNewWorkflowExecutionDecisionAttributes { - input?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - taskStartToCloseTimeout?: string; - childPolicy?: string; - tagList?: string[]; - workflowTypeVersion?: string; - } - - export interface RecordMarkerDecisionAttributes { - markerName?: string; - details?: string; - } - - export interface StartTimerDecisionAttributes { - timerId?: string; - control?: string; - startToFireTimeout?: string; - } - - export interface CancelTimerDecisionAttributes { - timerId?: string; - } - - export interface SignalExternalWorkflowExecutionDecisionAttributes { - workflowId?: string; - runId?: string; - signalName?: string; - input?: string; - control?: string; - } - - export interface RequestCancelExternalWorkflowExecutionDecisionAttributes { - workflowId?: string; - runId?: string; - control?: string; - } - - export interface StartChildWorkflowExecutionDecisionAttributes { - workflowType?: WorkflowType; - workflowId?: string; - control?: string; - input?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - taskStartToCloseTimeout?: string; - childPolicy?: string; - tagList?: string[]; - } - - export interface RespondActivityTaskCompletedRequest { - taskToken?: string; - result?: string; - } - - export interface RespondActivityTaskFailedRequest { - taskToken?: string; - reason?: string; - details?: string; - } - - export interface RespondActivityTaskCanceledRequest { - taskToken?: string; - details?: string; - } - - export interface DecisionTask { - taskToken?: string; - startedEventId?: number; - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - events?: HistoryEvent[]; - nextPageToken?: string; - previousStartedEventId?: number; - } - - export interface WorkflowExecution { - workflowId?: string; - runId?: string; - } - - export interface HistoryEvent { - eventTimestamp?: any; - eventType?: string; - eventId?: number; - workflowExecutionStartedEventAttributes?: WorkflowExecutionStartedEventAttributes; - workflowExecutionCompletedEventAttributes?: WorkflowExecutionCompletedEventAttributes; - completeWorkflowExecutionFailedEventAttributes?: CompleteWorkflowExecutionFailedEventAttributes; - workflowExecutionFailedEventAttributes?: WorkflowExecutionFailedEventAttributes; - failWorkflowExecutionFailedEventAttributes?: FailWorkflowExecutionFailedEventAttributes; - workflowExecutionTimedOutEventAttributes?: WorkflowExecutionTimedOutEventAttributes; - workflowExecutionCanceledEventAttributes?: WorkflowExecutionCanceledEventAttributes; - cancelWorkflowExecutionFailedEventAttributes?: CancelWorkflowExecutionFailedEventAttributes; - workflowExecutionContinuedAsNewEventAttributes?: WorkflowExecutionContinuedAsNewEventAttributes; - continueAsNewWorkflowExecutionFailedEventAttributes?: ContinueAsNewWorkflowExecutionFailedEventAttributes; - workflowExecutionTerminatedEventAttributes?: WorkflowExecutionTerminatedEventAttributes; - workflowExecutionCancelRequestedEventAttributes?: WorkflowExecutionCancelRequestedEventAttributes; - decisionTaskScheduledEventAttributes?: DecisionTaskScheduledEventAttributes; - decisionTaskStartedEventAttributes?: DecisionTaskStartedEventAttributes; - decisionTaskCompletedEventAttributes?: DecisionTaskCompletedEventAttributes; - decisionTaskTimedOutEventAttributes?: DecisionTaskTimedOutEventAttributes; - activityTaskScheduledEventAttributes?: ActivityTaskScheduledEventAttributes; - activityTaskStartedEventAttributes?: ActivityTaskStartedEventAttributes; - activityTaskCompletedEventAttributes?: ActivityTaskCompletedEventAttributes; - activityTaskFailedEventAttributes?: ActivityTaskFailedEventAttributes; - activityTaskTimedOutEventAttributes?: ActivityTaskTimedOutEventAttributes; - activityTaskCanceledEventAttributes?: ActivityTaskCanceledEventAttributes; - activityTaskCancelRequestedEventAttributes?: ActivityTaskCancelRequestedEventAttributes; - workflowExecutionSignaledEventAttributes?: WorkflowExecutionSignaledEventAttributes; - markerRecordedEventAttributes?: MarkerRecordedEventAttributes; - timerStartedEventAttributes?: TimerStartedEventAttributes; - timerFiredEventAttributes?: TimerFiredEventAttributes; - timerCanceledEventAttributes?: TimerCanceledEventAttributes; - startChildWorkflowExecutionInitiatedEventAttributes?: StartChildWorkflowExecutionInitiatedEventAttributes; - childWorkflowExecutionStartedEventAttributes?: ChildWorkflowExecutionStartedEventAttributes; - childWorkflowExecutionCompletedEventAttributes?: ChildWorkflowExecutionCompletedEventAttributes; - childWorkflowExecutionFailedEventAttributes?: ChildWorkflowExecutionFailedEventAttributes; - childWorkflowExecutionTimedOutEventAttributes?: ChildWorkflowExecutionTimedOutEventAttributes; - childWorkflowExecutionCanceledEventAttributes?: ChildWorkflowExecutionCanceledEventAttributes; - childWorkflowExecutionTerminatedEventAttributes?: ChildWorkflowExecutionTerminatedEventAttributes; - signalExternalWorkflowExecutionInitiatedEventAttributes?: SignalExternalWorkflowExecutionInitiatedEventAttributes; - externalWorkflowExecutionSignaledEventAttributes?: ExternalWorkflowExecutionSignaledEventAttributes; - signalExternalWorkflowExecutionFailedEventAttributes?: SignalExternalWorkflowExecutionFailedEventAttributes; - externalWorkflowExecutionCancelRequestedEventAttributes?: ExternalWorkflowExecutionCancelRequestedEventAttributes; - requestCancelExternalWorkflowExecutionInitiatedEventAttributes?: RequestCancelExternalWorkflowExecutionInitiatedEventAttributes; - requestCancelExternalWorkflowExecutionFailedEventAttributes?: RequestCancelExternalWorkflowExecutionFailedEventAttributes; - scheduleActivityTaskFailedEventAttributes?: ScheduleActivityTaskFailedEventAttributes; - requestCancelActivityTaskFailedEventAttributes?: RequestCancelActivityTaskFailedEventAttributes; - startTimerFailedEventAttributes?: StartTimerFailedEventAttributes; - cancelTimerFailedEventAttributes?: CancelTimerFailedEventAttributes; - startChildWorkflowExecutionFailedEventAttributes?: StartChildWorkflowExecutionFailedEventAttributes; - } - - export interface WorkflowExecutionStartedEventAttributes { - input?: string; - executionStartToCloseTimeout?: string; - taskStartToCloseTimeout?: string; - childPolicy?: string; - taskList?: TaskList; - workflowType?: WorkflowType; - tagList?: string[]; - continuedExecutionRunId?: string; - parentWorkflowExecution?: WorkflowExecution; - parentInitiatedEventId?: number; - } - - export interface WorkflowExecutionCompletedEventAttributes { - result?: string; - decisionTaskCompletedEventId?: number; - } - - export interface CompleteWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionFailedEventAttributes { - reason?: string; - details?: string; - decisionTaskCompletedEventId?: number; - } - - export interface FailWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionTimedOutEventAttributes { - timeoutType?: string; - childPolicy?: string; - } - - export interface WorkflowExecutionCanceledEventAttributes { - details?: string; - decisionTaskCompletedEventId?: number; - } - - export interface CancelWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionContinuedAsNewEventAttributes { - input?: string; - decisionTaskCompletedEventId?: number; - newExecutionRunId?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - taskStartToCloseTimeout?: string; - childPolicy?: string; - tagList?: string[]; - workflowType?: WorkflowType; - } - - export interface ContinueAsNewWorkflowExecutionFailedEventAttributes { - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface WorkflowExecutionTerminatedEventAttributes { - reason?: string; - details?: string; - childPolicy?: string; - cause?: string; - } - - export interface WorkflowExecutionCancelRequestedEventAttributes { - externalWorkflowExecution?: WorkflowExecution; - externalInitiatedEventId?: number; - cause?: string; - } - - export interface DecisionTaskScheduledEventAttributes { - taskList?: TaskList; - startToCloseTimeout?: string; - } - - export interface DecisionTaskStartedEventAttributes { - identity?: string; - scheduledEventId?: number; - } - - export interface DecisionTaskCompletedEventAttributes { - executionContext?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface DecisionTaskTimedOutEventAttributes { - timeoutType?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface ActivityTaskScheduledEventAttributes { - activityType?: ActivityType; - activityId?: string; - input?: string; - control?: string; - scheduleToStartTimeout?: string; - scheduleToCloseTimeout?: string; - startToCloseTimeout?: string; - taskList?: TaskList; - decisionTaskCompletedEventId?: number; - heartbeatTimeout?: string; - } - - export interface ActivityTaskStartedEventAttributes { - identity?: string; - scheduledEventId?: number; - } - - export interface ActivityTaskCompletedEventAttributes { - result?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface ActivityTaskFailedEventAttributes { - reason?: string; - details?: string; - scheduledEventId?: number; - startedEventId?: number; - } - - export interface ActivityTaskTimedOutEventAttributes { - timeoutType?: string; - scheduledEventId?: number; - startedEventId?: number; - details?: string; - } - - export interface ActivityTaskCanceledEventAttributes { - details?: string; - scheduledEventId?: number; - startedEventId?: number; - latestCancelRequestedEventId?: number; - } - - export interface ActivityTaskCancelRequestedEventAttributes { - decisionTaskCompletedEventId?: number; - activityId?: string; - } - - export interface WorkflowExecutionSignaledEventAttributes { - signalName?: string; - input?: string; - externalWorkflowExecution?: WorkflowExecution; - externalInitiatedEventId?: number; - } - - export interface MarkerRecordedEventAttributes { - markerName?: string; - details?: string; - decisionTaskCompletedEventId?: number; - } - - export interface TimerStartedEventAttributes { - timerId?: string; - control?: string; - startToFireTimeout?: string; - decisionTaskCompletedEventId?: number; - } - - export interface TimerFiredEventAttributes { - timerId?: string; - startedEventId?: number; - } - - export interface TimerCanceledEventAttributes { - timerId?: string; - startedEventId?: number; - decisionTaskCompletedEventId?: number; - } - - export interface StartChildWorkflowExecutionInitiatedEventAttributes { - workflowId?: string; - workflowType?: WorkflowType; - control?: string; - input?: string; - executionStartToCloseTimeout?: string; - taskList?: TaskList; - decisionTaskCompletedEventId?: number; - childPolicy?: string; - taskStartToCloseTimeout?: string; - tagList?: string[]; - } - - export interface ChildWorkflowExecutionStartedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - initiatedEventId?: number; - } - - export interface ChildWorkflowExecutionCompletedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - result?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionFailedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - reason?: string; - details?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionTimedOutEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - timeoutType?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionCanceledEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - details?: string; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface ChildWorkflowExecutionTerminatedEventAttributes { - workflowExecution?: WorkflowExecution; - workflowType?: WorkflowType; - initiatedEventId?: number; - startedEventId?: number; - } - - export interface SignalExternalWorkflowExecutionInitiatedEventAttributes { - workflowId?: string; - runId?: string; - signalName?: string; - input?: string; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ExternalWorkflowExecutionSignaledEventAttributes { - workflowExecution?: WorkflowExecution; - initiatedEventId?: number; - } - - export interface SignalExternalWorkflowExecutionFailedEventAttributes { - workflowId?: string; - runId?: string; - cause?: string; - initiatedEventId?: number; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ExternalWorkflowExecutionCancelRequestedEventAttributes { - workflowExecution?: WorkflowExecution; - initiatedEventId?: number; - } - - export interface RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { - workflowId?: string; - runId?: string; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface RequestCancelExternalWorkflowExecutionFailedEventAttributes { - workflowId?: string; - runId?: string; - cause?: string; - initiatedEventId?: number; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ScheduleActivityTaskFailedEventAttributes { - activityType?: ActivityType; - activityId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface RequestCancelActivityTaskFailedEventAttributes { - activityId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface StartTimerFailedEventAttributes { - timerId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface CancelTimerFailedEventAttributes { - timerId?: string; - cause?: string; - decisionTaskCompletedEventId?: number; - } - - export interface StartChildWorkflowExecutionFailedEventAttributes { - workflowType?: WorkflowType; - cause?: string; - workflowId?: string; - initiatedEventId?: number; - decisionTaskCompletedEventId?: number; - control?: string; - } - - export interface ActivityTask { - taskToken?: string; - activityId?: string; - startedEventId?: number; - workflowExecution?: WorkflowExecution; - activityType?: ActivityType; - input?: string; - } - - export interface PollForActivityTaskResult { - activityTask?: ActivityTask; - } - - export interface PollForDecisionTaskResult { - decisionTask?: DecisionTask; - } - - export interface StartWorkflowExecutionResult { - run?: Run; - } - - export interface Run { - runId?: string; - } - - } - - export module Sns { - - export interface Client { - config: ClientConfig; - - publish(params: PublishRequest, callback: (err: any, data: PublishResult) => void): void; - createTopic(params: CreateTopicRequest, callback: (err: any, data: CreateTopicResult) => void): void; - deleteTopic(params: DeleteTopicRequest, callback: (err: any, data: any) => void): void; - } - - export interface PublishRequest { - TopicArn?: string; - TargetArn?: string; - MessageAttributes?: { [name: string]: MessageAttribute; }; - Message?: string; - MessageStructure?: string; - Subject?: string; - } - - export interface MessageAttribute { - DataType: string; - StringValue?: string; - BinaryValue: any; // (Buffer, Typed Array, Blob, String) - } - - export interface PublishResult { - MessageId?: string; - } - - export interface CreateTopicRequest { - Name?: string; - } - - export interface CreateTopicResult { - TopicArn?: string; - } - - export interface DeleteTopicRequest { - TopicArn?: string; - } - - } - - export module s3 { - export interface PutObjectRequest { - ACL?: string; - Body?: any; - Bucket: string; - CacheControl?: string; - ContentDisposition?: string; - ContentEncoding?: string; - ContentLanguage?: string; - ContentLength?: string; - ContentMD5?: string; - ContentType?: string; - Expires?: any; - GrantFullControl?: string; - GrantRead?: string; - GrantReadACP?: string; - GrantWriteACP?: string; - Key: string; - Metadata?: { [key: string]:string; }; - ServerSideEncryption?: string; - StorageClass?: string; - WebsiteRedirectLocation?: string; + updateService(params: ecs.UpdateServiceParams, callback: (err: any, data: any) => void): void; + } + + export class DynamoDB { + constructor(options?: any); + endpoint: Endpoint; + + } + + // ========================================================== + + export module DynamoDB { + + interface _DDBDC_Generic { + TableName: string; + ExpressionAttributeNames?: string[]; + ReturnConsumedCapacity?: "INDEXES" | "TOTAL" | "NONE"; + } + + type _DDBDC_ComparisonOperator = "EQ" | "NE" | "IN" | "LE" | "LT" | "GE" | "GT" | "BETWEEN" | "NOT_NULL" | "NULL" | "CONTAINS" | "NOT_CONTAINS" | "BEGINS_WITH" + type _DDBDC_Keys = { [someKey: string]: any }; + type _DDBDC_KeyComparison = { + [someKey: string]: { + AttributeValueList: any[]; + ComparisonOperator: _DDBDC_ComparisonOperator; + } + }; + + interface _DDBDC_Reader extends _DDBDC_Generic { + ConsistentRead?: boolean; + ProjectionExpression?: string; + AttributesToGet?: string[]; + } + + interface _DDBDC_Writer extends _DDBDC_Generic { + ExpressionAttributeValues?: _DDBDC_Keys; + ReturnItemCollectionMetrics?: "SIZE" | "NONE"; + ReturnValues?: "NONE" | "ALL_OLD" | "UPDATED_OLD" | "ALL_NEW" | "UPDATED_NEW"; + ConditionExpression?: string; + ConditionalOperator?: "AND" | "OR"; + Expected?: { + [someKey: string]: { + AttributeValueList: any[]; + ComparisonOperator: _DDBDC_ComparisonOperator; + Exists: boolean; + Value: any; } + } + } - export interface GetObjectRequest { - Bucket: string; - IfMatch?: string; - IfModifiedSince?: any; - IfNoneMatch?: string; - IfUnmodifiedSince?: any; - Key: string; - Range?: string; - ResponseCacheControl?: string; - ResponseContentDisposition?: string; - ResponseContentEncoding?: string; - ResponseContentLanguage?: string; - ResponseContentType?: string; - ResponseExpires?: any; - VersionId?: string; + interface UpdateParam extends _DDBDC_Writer { + Key: _DDBDC_Keys; + AttributeUpdates: { + [someKey: string]: { + Action: "PUT" | "ADD" | "DELETE"; + Value: any } + } + } - export interface DeleteObjectRequest { - Bucket: string; - Key: string; - MFA?: string; - RequestPayer?: string; - VersionId?: string; - } + interface QueryParam extends _DDBDC_Reader { + ConditionalOperator?: "AND" | "OR"; + ExclusiveStartKey?: _DDBDC_Keys; + ExpressionAttributeValues?: _DDBDC_Keys; + FilterExpression?: string; + IndexName?: string; + KeyConditionExpression?: string; + KeyConditions?: _DDBDC_KeyComparison; + Limit?: number; + QueryFilter?: _DDBDC_KeyComparison; + ScanIndexForward?: boolean; + Select?: "ALL_ATTRIBUTES" | "ALL_PROJECTED_ATTRIBUTES" | "SPECIFIC_ATTRIBUTES" | "COUNT"; + } - export interface HeadObjectRequest { - Bucket: string; - Key: string; - IfMatch?: string; - IfModifiedSince?: Date; - IfNoneMatch?: string; - IfUnmodifiedSince?: Date; - Range?: string; - RequestPayer?: string; - SSECustomerAlgorithm?: string; - SSECustomerKey?: Buffer | string; - SSECustomerKeyMD5?: string; - VersionId?: string; - } + interface ScanParam extends QueryParam { + Segment?: number; + ScanFilter?: _DDBDC_KeyComparison; + TotalSegments?: number; + } - export interface UploadOptions { - partSize?: number; - queueSize?: number; - } - } + interface GetParam extends _DDBDC_Reader { + Key: _DDBDC_Keys; + } - export module ecs { - export interface CreateServicesParams { - desiredCount: number; - serviceName: string; - taskDefinition: string; - clientToken?: string; - cluster?: string; - deploymentConfiguration?: { - maximumPercent?: number; - minimumHealthyPercent?: number; - }; - loadBalancers?: { - containerName?: string; - containerPort?: number; - loadBalancerName?: string; - }[]; - role?: string; - } + interface PutParam extends _DDBDC_Writer { + Item: _DDBDC_Keys; + } - export interface DescribeServicesParams { + interface DeleteParam extends _DDBDC_Writer { + Key: _DDBDC_Keys; + } + + export class DocumentClient { + constructor(options?: any); + get(params: GetParam, next: (err: any, data: any) => void): void; + put(params: PutParam, next: (err: any, data: any) => void): void; + delete(params: DeleteParam, next: (err: any, data: any) => void): void; + query(params: QueryParam, next: (err: any, data: any) => void): void; + scan(params: ScanParam, next: (err: any, data: any) => void): void; + update(params: UpdateParam, next: (err: any, data: any) => void): void; + createSet(list: any[], options?: { validate?: boolean }): { values: any[], type: string }; + batchGet(params: any, next: (err: any, data: any) => void): void; + batchWrite(params: any, next: (err: any, data: any) => void): void; + } + + } + + // =========================================================== + + export module Lambda { + + export interface AddPermissionParams { + Action: string; + FunctionName: string; + Principal: string; + StatementId: string; + Qualifier?: string; + SourceAccount?: string; + SourceArn?: string; + } + + export interface CreateAliasParams { + FunctionName: string; + FunctionVersion: string; + Name: string; + Description?: string; + } + + export interface CreateEventSourceMappingParams { + EventSourceArn: string; + FunctionName: string; + StartingPosition: string; /* TRIM_HORIZON | LATEST */ + BatchSize?: number; + Enabled?: boolean + } + + export interface CreateFunctionParams { + Code: { + S3Bucket?: string; + S3Key?: string; + S3ObjectVersion?: string; + ZipFile?: any; // new Buffer('...') || string; + }, + FunctionName: string; + Handler: string; + Role: string; + Runtime: string; /* 'nodejs | java8 | python2.7', */ + Description?: string; + MemorySize?: number; + Publish?: boolean; + Timeout?: number; + VpcConfig?: { + SecurityGroupIds?: string[]; + SubnetIds?: string[]; + } + } + + export interface DeleteAliasParams { + FunctionName: string; + Name: string; + } + + export interface DeleteEventSourceMappingParams { + UUID: string; + } + + export interface DeleteFunctionParams { + FunctionName: string; + Qualifier?: string; + } + export interface GetAliasParams { + FunctionName: string; + Name: string; + } + + export interface GetEventSourceMappingParams { + UUID: string; + } + + export interface GetFunctionParams { + FunctionName: string; + Qualifier?: string; + } + + export interface GetFunctionConfigurationParams { + FunctionName: string; + Qualifier?: string; + } + + export interface GetPolicyParams { + FunctionName: string; + Qualifier?: string; + } + + export interface InvokeParams { + FunctionName: string; + ClientContext?: string; + InvocationType?: string;/* 'Event | RequestResponse | DryRun' */ + LogType?: string; /* 'None | Tail' */ + Payload?: any; /* new Buffer('...') || string */ + Qualifier?: string; + } + + export interface ListAliasesParams { + FunctionName: string; + FunctionVersion?: string; + Marker?: string; + MaxItems?: number + } + + export interface ListEventSourceMappingsParams { + EventSourceArn?: string; + FunctionName?: string; + Marker?: string; + MaxItems?: number + } + + export interface ListFunctionsParams { + Marker?: string; + MaxItems?: number + } + + export interface ListVersionsByFunctionParams { + FunctionName: string; + Marker?: string; + MaxItems?: number + } + + export interface PublishVersionParams { + FunctionName: string; + CodeSha256?: string; + Description?: string; + } + + export interface RemovePermissionParams { + FunctionName: string; + StatementId: string; + Qualifier?: string; + } + + export interface UpdateAliasParams { + FunctionName: string; + Name: string; + Description?: string; + FunctionVersion?: string; + } + + export interface UpdateEventSourceMappingParams { + UUID: string; + BatchSize?: number; + Enabled?: boolean; + FunctionName?: string; + } + + export interface UpdateFunctionCodeParams { + FunctionName: string; + Publish?: boolean; + S3Bucket?: string; + S3Key?: string; + S3ObjectVersion?: string; + ZipFile?: any; /* new Buffer('...') || string; */ + + } + + export interface UpdateFunctionConfigurationParams { + FunctionName: string; + Description?: string; + Handler?: string; + MemorySize?: number; + Role?: string; + Timeout?: number; + VpcConfig?: { + SecurityGroupIds?: string[]; + SubnetIds?: string[]; + } + } + } + + export module SQS { + + export interface SqsOptions { + params?: any; + endpoint?: string; + accessKeyId?: string; + secretAccessKey?: string; + sessionToken?: Credentials; + credentials?: Credentials; + credentialProvider?: any; + region?: string; + maxRetries?: number; + maxRedirects?: number; + sslEnabled?: boolean; + paramValidation?: boolean; + computeChecksums?: boolean; + convertResponseTypes?: boolean; + correctClockSkew?: boolean; + s3ForcePathStyle?: boolean; + s3BucketEndpoint?: boolean; + httpOptions?: HttpOptions; + apiVersion?: string; + apiVersions?: { [serviceName: string]: string }; + logger?: Logger; + systemClockOffset?: number; + signatureVersion?: string; + signatureCache?: boolean; + } + + export interface AddPermissionParams { + QueueUrl: string; + Label: string; + AWSAccountIds: string[]; + Actions: string[]; + } + + export interface ChangeMessageVisibilityParams { + QueueUrl: string, + ReceiptHandle: string, + VisibilityTimeout: number + } + + export interface ChangeMessageVisibilityBatchParams { + QueueUrl: string, + Entries: { Id: string; ReceiptHandle: string; VisibilityTimeout?: number; }[] + } + + export interface ChangeMessageVisibilityBatchResponse { + Successful: { Id: string }[]; + Failed: BatchResultErrorEntry[]; + } + + export interface SendMessageParams { + QueueUrl?: string; + MessageBody: string; + DelaySeconds?: number; + MessageAttributes?: { [name: string]: MessageAttribute; } + } + + export interface ReceiveMessageParams { + QueueUrl: string; + MaxNumberOfMessages?: number; + VisibilityTimeout?: number; + AttributeNames?: string[]; + MessageAttributeNames?: string[]; + WaitTimeSeconds?: number; + } + + export interface DeleteMessageBatchParams { + QueueUrl: string; + Entries: DeleteMessageBatchRequestEntry[]; + } + + export interface DeleteMessageBatchRequestEntry { + Id: string; + ReceiptHandle: string; + } + + export interface DeleteMessageParams { + QueueUrl: string; + ReceiptHandle: string; + } + + export interface SendMessageBatchParams { + QueueUrl: string; + Entries: SendMessageBatchRequestEntry[]; + } + + export interface SendMessageBatchRequestEntry { + Id: string; + MessageBody: string; + DelaySeconds?: number; + MessageAttributes?: { [name: string]: MessageAttribute; } + } + + export interface CreateQueueParams { + QueueName: string; + Attributes: QueueAttributes; + } + + export interface QueueAttributes { + [name: string]: any; + DelaySeconds?: number; + MaximumMessageSize?: number; + MessageRetentionPeriod?: number; + Policy?: any; + ReceiveMessageWaitTimeSeconds?: number; + VisibilityTimeout?: number; + RedrivePolicy?: any; + } + + export interface GetQueueAttributesParams { + QueueUrl: string; + AttributeNames: string[]; + } + + export interface GetQueueAttributesResult { + Attributes: { [name: string]: string }; + } + + export interface GetQueueUrlParams { + QueueName: string; + QueueOwnerAWSAccountId?: string; + } + + export interface SendMessageResult { + MessageId: string; + MD5OfMessageBody: string; + MD5OfMessageAttributes: string; + } + + export interface ReceiveMessageResult { + Messages: Message[]; + } + + export interface Message { + MessageId: string; + ReceiptHandle: string; + MD5OfBody: string; + Body: string; + Attributes: { [name: string]: any }; + MD5OfMessageAttributes: string; + MessageAttributes: { [name: string]: MessageAttribute; } + } + + export interface MessageAttribute { + StringValue?: string; + BinaryValue?: any; //(Buffer, Typed Array, Blob, String) + StringListValues?: string[]; + BinaryListValues?: any[]; + DataType: string; + } + + export interface DeleteMessageBatchResult { + Successful: DeleteMessageBatchResultEntry[]; + Failed: BatchResultErrorEntry[]; + } + + export interface DeleteMessageBatchResultEntry { + Id: string; + } + + export interface BatchResultErrorEntry { + Id: string; + Code: string; + Message?: string; + SenderFault: boolean; + } + + export interface SendMessageBatchResult { + Successful: SendMessageBatchResultEntry[]; + Failed: BatchResultErrorEntry[]; + } + + export interface SendMessageBatchResultEntry { + Id: string; + MessageId: string; + MD5OfMessageBody: string; + MD5OfMessageAttributes: string; + } + + export interface CreateQueueResult { + QueueUrl: string; + } + + export interface SetQueueAttributesParams { + QueueUrl: string; + Attributes: QueueAttributes; + } + + } + + export module SES { + + export interface Client { + config: ClientConfig; + + sendEmail(params: any, callback: (err: any, data: SendEmailResult) => void): void; + } + + export interface SendEmailRequest { + Source: string; + Destination: Destination; + Message: Message; + ReplyToAddresses: string[]; + ReturnPath: string; + } + + export class Destination { + ToAddresses: string[]; + CcAddresses: string[]; + BccAddresses: string[]; + } + + export class Message { + Subject: Content; + Body: Body; + } + + export class Content { + Data: string; + Charset: string; + } + + export class Body { + Text: Content; + Html: Content; + } + + export class SendEmailResult { + MessageId: string; + } + + } + + export module Swf { + + export interface Client { + //constructor(options?: any); + config: ClientConfig; + + countClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + countOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + countPendingActivityTasks(params: any, callback: (err: any, data: any) => void): void; + countPendingDecisionTasks(params: any, callback: (err: any, data: any) => void): void; + deprecateActivityType(params: any, callback: (err: any, data: any) => void): void; + deprecateDomain(params: any, callback: (err: any, data: any) => void): void; + deprecateWorkflowType(params: any, callback: (err: any, data: any) => void): void; + describeActivityType(params: any, callback: (err: any, data: any) => void): void; + describeDomain(params: any, callback: (err: any, data: any) => void): void; + describeWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + describeWorkflowType(params: any, callback: (err: any, data: any) => void): void; + getWorkflowExecutionHistory(params: any, callback: (err: any, data: any) => void): void; + listActivityTypes(params: any, callback: (err: any, data: any) => void): void; + listClosedWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + listDomains(params: any, callback: (err: any, data: any) => void): void; + listOpenWorkflowExecutions(params: any, callback: (err: any, data: any) => void): void; + listWorkflowTypes(params: any, callback: (err: any, data: any) => void): void; + pollForActivityTask(params: any, callback: (err: any, data: ActivityTask) => void): void; + pollForDecisionTask(params: any, callback: (err: any, data: DecisionTask) => void): void; + recordActivityTaskHeartbeat(params: any, callback: (err: any, data: any) => void): void; + registerActivityType(params: any, callback: (err: any, data: any) => void): void; + registerDomain(params: any, callback: (err: any, data: any) => void): void; + registerWorkflowType(params: any, callback: (err: any, data: any) => void): void; + requestCancelWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + respondActivityTaskCanceled(params: RespondActivityTaskCanceledRequest, callback: (err: any, data: any) => void): void; + respondActivityTaskCompleted(params: RespondActivityTaskCompletedRequest, callback: (err: any, data: any) => void): void; + respondActivityTaskFailed(params: RespondActivityTaskFailedRequest, callback: (err: any, data: any) => void): void; + respondDecisionTaskCompleted(params: RespondDecisionTaskCompletedRequest, callback: (err: any, data: any) => void): void; + signalWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + startWorkflowExecution(params: any, callback: (err: any, data: StartWorkflowExecutionResult) => void): void; + terminateWorkflowExecution(params: any, callback: (err: any, data: any) => void): void; + } + + export interface PollForActivityTaskRequest { + domain?: string; + taskList?: TaskList; + identity?: string; + } + + export interface TaskList { + name?: string; + } + + export interface PollForDecisionTaskRequest { + domain?: string; + taskList?: TaskList; + identity?: string; + nextPageToken?: string; + maximumPageSize?: number; + reverseOrder?: Boolean; + } + + export interface StartWorkflowExecutionRequest { + domain?: string; + workflowId?: string; + workflowType?: WorkflowType; + taskList?: TaskList; + input?: string; + executionStartToCloseTimeout?: string; + tagList?: string[]; + taskStartToCloseTimeout?: string; + childPolicy?: string; + } + + export interface WorkflowType { + name?: string; + version?: string; + } + + export interface RespondDecisionTaskCompletedRequest { + taskToken?: string; + decisions?: Decision[]; + executionContext?: string; + } + + export interface Decision { + decisionType?: string; + scheduleActivityTaskDecisionAttributes?: ScheduleActivityTaskDecisionAttributes; + requestCancelActivityTaskDecisionAttributes?: RequestCancelActivityTaskDecisionAttributes; + completeWorkflowExecutionDecisionAttributes?: CompleteWorkflowExecutionDecisionAttributes; + failWorkflowExecutionDecisionAttributes?: FailWorkflowExecutionDecisionAttributes; + cancelWorkflowExecutionDecisionAttributes?: CancelWorkflowExecutionDecisionAttributes; + continueAsNewWorkflowExecutionDecisionAttributes?: ContinueAsNewWorkflowExecutionDecisionAttributes; + recordMarkerDecisionAttributes?: RecordMarkerDecisionAttributes; + startTimerDecisionAttributes?: StartTimerDecisionAttributes; + cancelTimerDecisionAttributes?: CancelTimerDecisionAttributes; + signalExternalWorkflowExecutionDecisionAttributes?: SignalExternalWorkflowExecutionDecisionAttributes; + requestCancelExternalWorkflowExecutionDecisionAttributes?: RequestCancelExternalWorkflowExecutionDecisionAttributes; + startChildWorkflowExecutionDecisionAttributes?: StartChildWorkflowExecutionDecisionAttributes; + } + + export interface ScheduleActivityTaskDecisionAttributes { + activityType?: ActivityType; + activityId?: string; + control?: string; + input?: string; + scheduleToCloseTimeout?: string; + taskList?: TaskList; + scheduleToStartTimeout?: string; + startToCloseTimeout?: string; + heartbeatTimeout?: string; + } + + export interface ActivityType { + name?: string; + version?: string; + } + + export interface RequestCancelActivityTaskDecisionAttributes { + activityId?: string; + } + + export interface CompleteWorkflowExecutionDecisionAttributes { + result?: string; + } + + export interface FailWorkflowExecutionDecisionAttributes { + reason?: string; + details?: string; + } + + export interface CancelWorkflowExecutionDecisionAttributes { + details?: string; + } + + export interface ContinueAsNewWorkflowExecutionDecisionAttributes { + input?: string; + executionStartToCloseTimeout?: string; + taskList?: TaskList; + taskStartToCloseTimeout?: string; + childPolicy?: string; + tagList?: string[]; + workflowTypeVersion?: string; + } + + export interface RecordMarkerDecisionAttributes { + markerName?: string; + details?: string; + } + + export interface StartTimerDecisionAttributes { + timerId?: string; + control?: string; + startToFireTimeout?: string; + } + + export interface CancelTimerDecisionAttributes { + timerId?: string; + } + + export interface SignalExternalWorkflowExecutionDecisionAttributes { + workflowId?: string; + runId?: string; + signalName?: string; + input?: string; + control?: string; + } + + export interface RequestCancelExternalWorkflowExecutionDecisionAttributes { + workflowId?: string; + runId?: string; + control?: string; + } + + export interface StartChildWorkflowExecutionDecisionAttributes { + workflowType?: WorkflowType; + workflowId?: string; + control?: string; + input?: string; + executionStartToCloseTimeout?: string; + taskList?: TaskList; + taskStartToCloseTimeout?: string; + childPolicy?: string; + tagList?: string[]; + } + + export interface RespondActivityTaskCompletedRequest { + taskToken?: string; + result?: string; + } + + export interface RespondActivityTaskFailedRequest { + taskToken?: string; + reason?: string; + details?: string; + } + + export interface RespondActivityTaskCanceledRequest { + taskToken?: string; + details?: string; + } + + export interface DecisionTask { + taskToken?: string; + startedEventId?: number; + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + events?: HistoryEvent[]; + nextPageToken?: string; + previousStartedEventId?: number; + } + + export interface WorkflowExecution { + workflowId?: string; + runId?: string; + } + + export interface HistoryEvent { + eventTimestamp?: any; + eventType?: string; + eventId?: number; + workflowExecutionStartedEventAttributes?: WorkflowExecutionStartedEventAttributes; + workflowExecutionCompletedEventAttributes?: WorkflowExecutionCompletedEventAttributes; + completeWorkflowExecutionFailedEventAttributes?: CompleteWorkflowExecutionFailedEventAttributes; + workflowExecutionFailedEventAttributes?: WorkflowExecutionFailedEventAttributes; + failWorkflowExecutionFailedEventAttributes?: FailWorkflowExecutionFailedEventAttributes; + workflowExecutionTimedOutEventAttributes?: WorkflowExecutionTimedOutEventAttributes; + workflowExecutionCanceledEventAttributes?: WorkflowExecutionCanceledEventAttributes; + cancelWorkflowExecutionFailedEventAttributes?: CancelWorkflowExecutionFailedEventAttributes; + workflowExecutionContinuedAsNewEventAttributes?: WorkflowExecutionContinuedAsNewEventAttributes; + continueAsNewWorkflowExecutionFailedEventAttributes?: ContinueAsNewWorkflowExecutionFailedEventAttributes; + workflowExecutionTerminatedEventAttributes?: WorkflowExecutionTerminatedEventAttributes; + workflowExecutionCancelRequestedEventAttributes?: WorkflowExecutionCancelRequestedEventAttributes; + decisionTaskScheduledEventAttributes?: DecisionTaskScheduledEventAttributes; + decisionTaskStartedEventAttributes?: DecisionTaskStartedEventAttributes; + decisionTaskCompletedEventAttributes?: DecisionTaskCompletedEventAttributes; + decisionTaskTimedOutEventAttributes?: DecisionTaskTimedOutEventAttributes; + activityTaskScheduledEventAttributes?: ActivityTaskScheduledEventAttributes; + activityTaskStartedEventAttributes?: ActivityTaskStartedEventAttributes; + activityTaskCompletedEventAttributes?: ActivityTaskCompletedEventAttributes; + activityTaskFailedEventAttributes?: ActivityTaskFailedEventAttributes; + activityTaskTimedOutEventAttributes?: ActivityTaskTimedOutEventAttributes; + activityTaskCanceledEventAttributes?: ActivityTaskCanceledEventAttributes; + activityTaskCancelRequestedEventAttributes?: ActivityTaskCancelRequestedEventAttributes; + workflowExecutionSignaledEventAttributes?: WorkflowExecutionSignaledEventAttributes; + markerRecordedEventAttributes?: MarkerRecordedEventAttributes; + timerStartedEventAttributes?: TimerStartedEventAttributes; + timerFiredEventAttributes?: TimerFiredEventAttributes; + timerCanceledEventAttributes?: TimerCanceledEventAttributes; + startChildWorkflowExecutionInitiatedEventAttributes?: StartChildWorkflowExecutionInitiatedEventAttributes; + childWorkflowExecutionStartedEventAttributes?: ChildWorkflowExecutionStartedEventAttributes; + childWorkflowExecutionCompletedEventAttributes?: ChildWorkflowExecutionCompletedEventAttributes; + childWorkflowExecutionFailedEventAttributes?: ChildWorkflowExecutionFailedEventAttributes; + childWorkflowExecutionTimedOutEventAttributes?: ChildWorkflowExecutionTimedOutEventAttributes; + childWorkflowExecutionCanceledEventAttributes?: ChildWorkflowExecutionCanceledEventAttributes; + childWorkflowExecutionTerminatedEventAttributes?: ChildWorkflowExecutionTerminatedEventAttributes; + signalExternalWorkflowExecutionInitiatedEventAttributes?: SignalExternalWorkflowExecutionInitiatedEventAttributes; + externalWorkflowExecutionSignaledEventAttributes?: ExternalWorkflowExecutionSignaledEventAttributes; + signalExternalWorkflowExecutionFailedEventAttributes?: SignalExternalWorkflowExecutionFailedEventAttributes; + externalWorkflowExecutionCancelRequestedEventAttributes?: ExternalWorkflowExecutionCancelRequestedEventAttributes; + requestCancelExternalWorkflowExecutionInitiatedEventAttributes?: RequestCancelExternalWorkflowExecutionInitiatedEventAttributes; + requestCancelExternalWorkflowExecutionFailedEventAttributes?: RequestCancelExternalWorkflowExecutionFailedEventAttributes; + scheduleActivityTaskFailedEventAttributes?: ScheduleActivityTaskFailedEventAttributes; + requestCancelActivityTaskFailedEventAttributes?: RequestCancelActivityTaskFailedEventAttributes; + startTimerFailedEventAttributes?: StartTimerFailedEventAttributes; + cancelTimerFailedEventAttributes?: CancelTimerFailedEventAttributes; + startChildWorkflowExecutionFailedEventAttributes?: StartChildWorkflowExecutionFailedEventAttributes; + } + + export interface WorkflowExecutionStartedEventAttributes { + input?: string; + executionStartToCloseTimeout?: string; + taskStartToCloseTimeout?: string; + childPolicy?: string; + taskList?: TaskList; + workflowType?: WorkflowType; + tagList?: string[]; + continuedExecutionRunId?: string; + parentWorkflowExecution?: WorkflowExecution; + parentInitiatedEventId?: number; + } + + export interface WorkflowExecutionCompletedEventAttributes { + result?: string; + decisionTaskCompletedEventId?: number; + } + + export interface CompleteWorkflowExecutionFailedEventAttributes { + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface WorkflowExecutionFailedEventAttributes { + reason?: string; + details?: string; + decisionTaskCompletedEventId?: number; + } + + export interface FailWorkflowExecutionFailedEventAttributes { + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface WorkflowExecutionTimedOutEventAttributes { + timeoutType?: string; + childPolicy?: string; + } + + export interface WorkflowExecutionCanceledEventAttributes { + details?: string; + decisionTaskCompletedEventId?: number; + } + + export interface CancelWorkflowExecutionFailedEventAttributes { + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface WorkflowExecutionContinuedAsNewEventAttributes { + input?: string; + decisionTaskCompletedEventId?: number; + newExecutionRunId?: string; + executionStartToCloseTimeout?: string; + taskList?: TaskList; + taskStartToCloseTimeout?: string; + childPolicy?: string; + tagList?: string[]; + workflowType?: WorkflowType; + } + + export interface ContinueAsNewWorkflowExecutionFailedEventAttributes { + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface WorkflowExecutionTerminatedEventAttributes { + reason?: string; + details?: string; + childPolicy?: string; + cause?: string; + } + + export interface WorkflowExecutionCancelRequestedEventAttributes { + externalWorkflowExecution?: WorkflowExecution; + externalInitiatedEventId?: number; + cause?: string; + } + + export interface DecisionTaskScheduledEventAttributes { + taskList?: TaskList; + startToCloseTimeout?: string; + } + + export interface DecisionTaskStartedEventAttributes { + identity?: string; + scheduledEventId?: number; + } + + export interface DecisionTaskCompletedEventAttributes { + executionContext?: string; + scheduledEventId?: number; + startedEventId?: number; + } + + export interface DecisionTaskTimedOutEventAttributes { + timeoutType?: string; + scheduledEventId?: number; + startedEventId?: number; + } + + export interface ActivityTaskScheduledEventAttributes { + activityType?: ActivityType; + activityId?: string; + input?: string; + control?: string; + scheduleToStartTimeout?: string; + scheduleToCloseTimeout?: string; + startToCloseTimeout?: string; + taskList?: TaskList; + decisionTaskCompletedEventId?: number; + heartbeatTimeout?: string; + } + + export interface ActivityTaskStartedEventAttributes { + identity?: string; + scheduledEventId?: number; + } + + export interface ActivityTaskCompletedEventAttributes { + result?: string; + scheduledEventId?: number; + startedEventId?: number; + } + + export interface ActivityTaskFailedEventAttributes { + reason?: string; + details?: string; + scheduledEventId?: number; + startedEventId?: number; + } + + export interface ActivityTaskTimedOutEventAttributes { + timeoutType?: string; + scheduledEventId?: number; + startedEventId?: number; + details?: string; + } + + export interface ActivityTaskCanceledEventAttributes { + details?: string; + scheduledEventId?: number; + startedEventId?: number; + latestCancelRequestedEventId?: number; + } + + export interface ActivityTaskCancelRequestedEventAttributes { + decisionTaskCompletedEventId?: number; + activityId?: string; + } + + export interface WorkflowExecutionSignaledEventAttributes { + signalName?: string; + input?: string; + externalWorkflowExecution?: WorkflowExecution; + externalInitiatedEventId?: number; + } + + export interface MarkerRecordedEventAttributes { + markerName?: string; + details?: string; + decisionTaskCompletedEventId?: number; + } + + export interface TimerStartedEventAttributes { + timerId?: string; + control?: string; + startToFireTimeout?: string; + decisionTaskCompletedEventId?: number; + } + + export interface TimerFiredEventAttributes { + timerId?: string; + startedEventId?: number; + } + + export interface TimerCanceledEventAttributes { + timerId?: string; + startedEventId?: number; + decisionTaskCompletedEventId?: number; + } + + export interface StartChildWorkflowExecutionInitiatedEventAttributes { + workflowId?: string; + workflowType?: WorkflowType; + control?: string; + input?: string; + executionStartToCloseTimeout?: string; + taskList?: TaskList; + decisionTaskCompletedEventId?: number; + childPolicy?: string; + taskStartToCloseTimeout?: string; + tagList?: string[]; + } + + export interface ChildWorkflowExecutionStartedEventAttributes { + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + initiatedEventId?: number; + } + + export interface ChildWorkflowExecutionCompletedEventAttributes { + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + result?: string; + initiatedEventId?: number; + startedEventId?: number; + } + + export interface ChildWorkflowExecutionFailedEventAttributes { + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + reason?: string; + details?: string; + initiatedEventId?: number; + startedEventId?: number; + } + + export interface ChildWorkflowExecutionTimedOutEventAttributes { + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + timeoutType?: string; + initiatedEventId?: number; + startedEventId?: number; + } + + export interface ChildWorkflowExecutionCanceledEventAttributes { + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + details?: string; + initiatedEventId?: number; + startedEventId?: number; + } + + export interface ChildWorkflowExecutionTerminatedEventAttributes { + workflowExecution?: WorkflowExecution; + workflowType?: WorkflowType; + initiatedEventId?: number; + startedEventId?: number; + } + + export interface SignalExternalWorkflowExecutionInitiatedEventAttributes { + workflowId?: string; + runId?: string; + signalName?: string; + input?: string; + decisionTaskCompletedEventId?: number; + control?: string; + } + + export interface ExternalWorkflowExecutionSignaledEventAttributes { + workflowExecution?: WorkflowExecution; + initiatedEventId?: number; + } + + export interface SignalExternalWorkflowExecutionFailedEventAttributes { + workflowId?: string; + runId?: string; + cause?: string; + initiatedEventId?: number; + decisionTaskCompletedEventId?: number; + control?: string; + } + + export interface ExternalWorkflowExecutionCancelRequestedEventAttributes { + workflowExecution?: WorkflowExecution; + initiatedEventId?: number; + } + + export interface RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { + workflowId?: string; + runId?: string; + decisionTaskCompletedEventId?: number; + control?: string; + } + + export interface RequestCancelExternalWorkflowExecutionFailedEventAttributes { + workflowId?: string; + runId?: string; + cause?: string; + initiatedEventId?: number; + decisionTaskCompletedEventId?: number; + control?: string; + } + + export interface ScheduleActivityTaskFailedEventAttributes { + activityType?: ActivityType; + activityId?: string; + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface RequestCancelActivityTaskFailedEventAttributes { + activityId?: string; + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface StartTimerFailedEventAttributes { + timerId?: string; + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface CancelTimerFailedEventAttributes { + timerId?: string; + cause?: string; + decisionTaskCompletedEventId?: number; + } + + export interface StartChildWorkflowExecutionFailedEventAttributes { + workflowType?: WorkflowType; + cause?: string; + workflowId?: string; + initiatedEventId?: number; + decisionTaskCompletedEventId?: number; + control?: string; + } + + export interface ActivityTask { + taskToken?: string; + activityId?: string; + startedEventId?: number; + workflowExecution?: WorkflowExecution; + activityType?: ActivityType; + input?: string; + } + + export interface PollForActivityTaskResult { + activityTask?: ActivityTask; + } + + export interface PollForDecisionTaskResult { + decisionTask?: DecisionTask; + } + + export interface StartWorkflowExecutionResult { + run?: Run; + } + + export interface Run { + runId?: string; + } + + } + + export module Sns { + + export interface Client { + config: ClientConfig; + + publish(params: PublishRequest, callback: (err: any, data: PublishResult) => void): void; + createTopic(params: CreateTopicRequest, callback: (err: any, data: CreateTopicResult) => void): void; + deleteTopic(params: DeleteTopicRequest, callback: (err: any, data: any) => void): void; + } + + export interface PublishRequest { + TopicArn?: string; + TargetArn?: string; + MessageAttributes?: { [name: string]: MessageAttribute; }; + Message?: string; + MessageStructure?: string; + Subject?: string; + } + + export interface MessageAttribute { + DataType: string; + StringValue?: string; + BinaryValue: any; // (Buffer, Typed Array, Blob, String) + } + + export interface PublishResult { + MessageId?: string; + } + + export interface CreateTopicRequest { + Name?: string; + } + + export interface CreateTopicResult { + TopicArn?: string; + } + + export interface DeleteTopicRequest { + TopicArn?: string; + } + + } + + export module s3 { + export interface PutObjectRequest { + ACL?: string; + Body?: any; + Bucket: string; + CacheControl?: string; + ContentDisposition?: string; + ContentEncoding?: string; + ContentLanguage?: string; + ContentLength?: string; + ContentMD5?: string; + ContentType?: string; + Expires?: any; + GrantFullControl?: string; + GrantRead?: string; + GrantReadACP?: string; + GrantWriteACP?: string; + Key: string; + Metadata?: { [key: string]: string; }; + ServerSideEncryption?: string; + StorageClass?: string; + WebsiteRedirectLocation?: string; + } + + export interface GetObjectRequest { + Bucket: string; + IfMatch?: string; + IfModifiedSince?: any; + IfNoneMatch?: string; + IfUnmodifiedSince?: any; + Key: string; + Range?: string; + ResponseCacheControl?: string; + ResponseContentDisposition?: string; + ResponseContentEncoding?: string; + ResponseContentLanguage?: string; + ResponseContentType?: string; + ResponseExpires?: any; + VersionId?: string; + } + + export interface DeleteObjectRequest { + Bucket: string; + Key: string; + MFA?: string; + RequestPayer?: string; + VersionId?: string; + } + + export interface HeadObjectRequest { + Bucket: string; + Key: string; + IfMatch?: string; + IfModifiedSince?: Date; + IfNoneMatch?: string; + IfUnmodifiedSince?: Date; + Range?: string; + RequestPayer?: string; + SSECustomerAlgorithm?: string; + SSECustomerKey?: Buffer | string; + SSECustomerKeyMD5?: string; + VersionId?: string; + } + + export interface UploadOptions { + partSize?: number; + queueSize?: number; + } + } + + export module ecs { + export interface CreateServicesParams { + desiredCount: number; + serviceName: string; + taskDefinition: string; + clientToken?: string; + cluster?: string; + deploymentConfiguration?: { + maximumPercent?: number; + minimumHealthyPercent?: number; + }; + loadBalancers?: { + containerName?: string; + containerPort?: number; + loadBalancerName?: string; + }[]; + role?: string; + } + + export interface DescribeServicesParams { /** * A list of services to describe. */ - services: string[]; + services: string[]; /** * The name of the cluster that hosts the service to describe. If you do not specify a cluster, the default cluster is assumed. */ - cluster?: string; - } + cluster?: string; + } - export interface DescribeClustersParams { + export interface DescribeClustersParams { /** * A space-separated list of cluster names or full cluster Amazon Resource Name (ARN) entries. If you do not specify a cluster, the default cluster is assumed. */ - clusters?: string[]; - } + clusters?: string[]; + } - export interface DescribeTasksParams { + export interface DescribeTasksParams { /** * A space-separated list of task IDs or full Amazon Resource Name (ARN) entries. */ - tasks: string[]; + tasks: string[]; /** * The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to describe. If you do not specify a cluster, the default cluster is assumed. */ - cluster?: string; - } + cluster?: string; + } - export interface DescribeTaskDefinitionParams { + export interface DescribeTaskDefinitionParams { /** * The `family` for the latest `ACTIVE` revision, `family` and `revision` (`family:revision`) for a specific revision in the family, or full Amazon Resource Name (ARN) of the task definition to describe. */ - taskDefinition: string; - } + taskDefinition: string; + } - export interface RegisterTaskDefinitionParams { - containerDefinitions: { - command?: string[], - cpu?: number, - disableNetworking?: boolean, - dnsSearchDomains?: string[], - dnsServers?: string[], - dockerLabels?: any, - dockerSecurityOptions?: string[], - entryPoint?: string[], - environment?: any[], - essential?: boolean, - extraHosts?: { - hostName: string, - ipAddress: string - }[]; - hostname?: string, - image?: string, - links?: string[], - logConfiguration?: { - logDriver: string, - options: any - }[], - memory?: number, - mountPoints?: { - containerPath: string, - readOnly: boolean, - sourceVolume: string - }[]; - name?: string, - portMappings?: { - containerPort?: number, - hostPort?: number, - protocol: string - }[]; - privileged?: boolean, - readonlyRootFilesystem?: boolean, - ulimits?: { - hardLimit: number, - name: string, - softLimit: number - }[]; - user?: string, - volumesFrom?: { - readOnly?: boolean, - sourceContainer?: string - }[], - workingDirectory?: string - }[]; - family: string; - volumes?: { - host: { - sourcePath: string - }, - name: string - }[]; - } + export interface RegisterTaskDefinitionParams { + containerDefinitions: { + command?: string[], + cpu?: number, + disableNetworking?: boolean, + dnsSearchDomains?: string[], + dnsServers?: string[], + dockerLabels?: any, + dockerSecurityOptions?: string[], + entryPoint?: string[], + environment?: any[], + essential?: boolean, + extraHosts?: { + hostName: string, + ipAddress: string + }[]; + hostname?: string, + image?: string, + links?: string[], + logConfiguration?: { + logDriver: string, + options: any + }[], + memory?: number, + mountPoints?: { + containerPath: string, + readOnly: boolean, + sourceVolume: string + }[]; + name?: string, + portMappings?: { + containerPort?: number, + hostPort?: number, + protocol: string + }[]; + privileged?: boolean, + readonlyRootFilesystem?: boolean, + ulimits?: { + hardLimit: number, + name: string, + softLimit: number + }[]; + user?: string, + volumesFrom?: { + readOnly?: boolean, + sourceContainer?: string + }[], + workingDirectory?: string + }[]; + family: string; + volumes?: { + host: { + sourcePath: string + }, + name: string + }[]; + } - export interface UpdateServiceParams { - service: string; - cluster?: string; - deploymentConfiguration?: { - maximumPercent: number; - minimumHealthyPercent: number; - }; - desiredCount?: number; - taskDefinition: string; - } - } + export interface UpdateServiceParams { + service: string; + cluster?: string; + deploymentConfiguration?: { + maximumPercent: number; + minimumHealthyPercent: number; + }; + desiredCount?: number; + taskDefinition: string; + } + } - export module sts { - export interface AssumeRoleParams { - RoleArn: string; - RoleSessionName: string; - DurationSeconds?: number; - ExternalId?: string; - Policy?: string; - SerialNumber?: string; - TokenCode?: string; - } + export module sts { + export interface AssumeRoleParams { + RoleArn: string; + RoleSessionName: string; + DurationSeconds?: number; + ExternalId?: string; + Policy?: string; + SerialNumber?: string; + TokenCode?: string; + } - export interface AssumeRoleCallbackData{ - Credentials: TemporaryCredentials; - AssumedRoleUser: AssumedRoleUser; - PackedPolicySize: number; - } + export interface AssumeRoleCallbackData { + Credentials: TemporaryCredentials; + AssumedRoleUser: AssumedRoleUser; + PackedPolicySize: number; + } - export interface TemporaryCredentials{ - AccessKeyId: string; - SecretAccessKey: string; - SessionToken: string; - Expiration: Date; - } + export interface TemporaryCredentials { + AccessKeyId: string; + SecretAccessKey: string; + SessionToken: string; + Expiration: Date; + } - export interface AssumedRoleUser{ - AssumedRoleId: string; - Arn: string; - } + export interface AssumedRoleUser { + AssumedRoleId: string; + Arn: string; + } - export interface AssumeRoleWithSAMLParams { - PrincipalArn: string; - RoleArn: string; - SAMLAssertion: string; - DurationSeconds?: number; - Policy?: string; - } + export interface AssumeRoleWithSAMLParams { + PrincipalArn: string; + RoleArn: string; + SAMLAssertion: string; + DurationSeconds?: number; + Policy?: string; + } - export interface AssumeRoleWithWebIdentityParams { - RoleArn: string; - RoleSessionName: string; - WebIdentityToken: string; - DurationSeconds?: number; - Policy?: string; - ProviderId?: string; - } + export interface AssumeRoleWithWebIdentityParams { + RoleArn: string; + RoleSessionName: string; + WebIdentityToken: string; + DurationSeconds?: number; + Policy?: string; + ProviderId?: string; + } - export interface CredentialsFromParams { + export interface CredentialsFromParams { /** * Data retrieved from a call to AWS.STS.getFederatedToken, getSessionToken(), assumeRole(), or assumeRoleWithWebIdentity(). */ - Data: any; + Data: any; /** * An optional credentials object to fill instead of creating a new object. Useful when modifying an existing credentials object from a refresh call. */ - Credentials?: Credentials - } + Credentials?: Credentials + } - export interface DecodeAuthorizationMessageParams { - EncodedMessage: string; - } + export interface DecodeAuthorizationMessageParams { + EncodedMessage: string; + } - export interface GetFederationTokenParams { - Name: string; - DurationSeconds?: number, - Policy?: string - } + export interface GetFederationTokenParams { + Name: string; + DurationSeconds?: number, + Policy?: string + } - export interface GetSessionTokenParams { - DurationSeconds: number, - SerialNumber: string; - TokenCode: string; - } - } + export interface GetSessionTokenParams { + DurationSeconds: number, + SerialNumber: string; + TokenCode: string; + } + } } From d681a05fa258766416fb98159a5189921ec3ad64 Mon Sep 17 00:00:00 2001 From: Hagai Cohen Date: Sun, 31 Jul 2016 23:24:40 +0300 Subject: [PATCH 43/79] autobahn: updated IPublishOptions * added missing acknowledge option --- autobahn/autobahn.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/autobahn/autobahn.d.ts b/autobahn/autobahn.d.ts index 7fd344f727..bb7a0c86ae 100644 --- a/autobahn/autobahn.d.ts +++ b/autobahn/autobahn.d.ts @@ -163,6 +163,7 @@ declare namespace autobahn { } interface IPublishOptions { + acknowledge?: boolean; exclude?: number[]; eligible?: number[]; disclose_me?: Boolean; From f714aefb78c3e5e24d171dd3ec74fffc81696b3f Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Fri, 29 Jul 2016 16:35:37 +0930 Subject: [PATCH 44/79] Add more to jqgrid.d.ts (ordered properties/functions the same as documentation at http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jqgriddocs Add test code to jqgrid-tests.ts --- jqgrid/jqgrid-tests.ts | 24 ++- jqgrid/jqgrid.d.ts | 398 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 397 insertions(+), 25 deletions(-) diff --git a/jqgrid/jqgrid-tests.ts b/jqgrid/jqgrid-tests.ts index 6f112d2976..b9012185bc 100644 --- a/jqgrid/jqgrid-tests.ts +++ b/jqgrid/jqgrid-tests.ts @@ -2,5 +2,25 @@ // Definitions by: Lokesh Peta // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// -/// \ No newline at end of file +/// +/// + +var mydata: any[] = []; + +$('#jqGrid') + .jqGrid({ + datatype: 'local', + data: mydata, + loadonce: true, + gridview: true, + height: 400, + shrinkToFit: true, + width: null, + colModel: [ + { label: 'Name', name: 'id', width: 75, key: true, align: 'left' }, + { label: 'Description', name: 'description', width: 100 } + ], + viewrecords: true, // show the current page, data rang and total records on the toolbar + caption: 'Matches', + onSelectRow(id: any, status: any, e: Event) { } + }); diff --git a/jqgrid/jqgrid.d.ts b/jqgrid/jqgrid.d.ts index 82807282a0..6b7d4cb2e0 100644 --- a/jqgrid/jqgrid.d.ts +++ b/jqgrid/jqgrid.d.ts @@ -4,44 +4,337 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// + +// http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options interface JQueryJqGridColumn { - name: string; - index: string; + + /** + * Defines the alignment of the cell in the Body layer, not in header cell. Possible values: left, center, right + */ + align?: "left" | "center" | "right"; + + /** + * This function add attributes to the cell during the creation of the data - i.e dynamically. + * By example all valid attributes for the table cell can be used or a style attribute with different properties. + * @param rowId the id of the row + * @param val the value which will be added in the cell + * @param rowObject the raw object of the data row - i.e if datatype is json - array, if datatype is xml xml node. + * @param cm all the properties of this column listed in the colModel + * @param rdata the data row which will be inserted in the row. This parameter is array of type name:value, where name is the name in colModel + * @returns {} + */ + cellattr?: (rowId: any, val: any, rowObject: any, cm: any, rdata: any) => string; + + /** + * This option allow to add classes to the column. If more than one class will be used a space should be set. + * By example classes:'class1 class2' will set a class1 and class2 to every cell on that column. + * In the grid css there is a predefined class ui-ellipsis which allow to attach ellipsis to a particular row. + * Also this will work in FireFox too. + */ + classes?: string; + + /** + * Governs format of sorttype:date (when datetype is set to local) and editrules {date:true} fields. + * Determines the expected date format for that column. Uses a PHP-like date formatting. Currently "/", "-", and "." are supported as date separators. Valid formats are: + * y,Y,yyyy for four digits year + * YY, yy for two digits year + * m,mm for months + * d,dd for days. + */ + datefmt?: string; + + /** + * Defines if the field is editable. This option is used in cell, inline and form modules. + */ + editable?: boolean; + + /** + * The predefined types (string) or custom function name that controls the format of this field + * @param cellvalue is the value to be formatted + * @param options is an object containing the following element: rowId - is the id of the row colModel is the object of the properties for this column getted from colModel array of jqGrid + * @param rowObject is a row data represented in the format determined from datatype option. If we have datatype: xml/xmlstring - the rowObject is xml node,provided according to the rules from xmlReader If we have datatype: json/jsonstring - the rowObject is array, provided according to the rules from jsonReader + * @returns {} the formatted value + */ + formatter?: "integer" | "number" | "currency" | "date" | "email" | "link" | "showlink" | "checkbox" | "select" | "actions" | ((cellvalue: any, options: { rowId: any, colModel: any }, rowObject: any) => any); + + /** + * Defines if this column is hidden at initialization. + */ hidden?: boolean; - sortable?: boolean; + + /** + * Set the index name when sorting. Passed as sidx parameter. + */ + index?: string; + + /** + * Overwrite the id (defined in readers) from server. Can be set as id for the unique row id. Only one column can have this property. + * This option have higher priority as those from the readers. + * If there are more than one key set the grid finds the first one and the second is ignored. + */ + key?: boolean; + + /** + * When colNames array is empty, defines the heading for this column. + * If both the colNames array and this setting are empty, the heading for this column comes from the name property. + */ + label?: string; + + /** + * Set the unique name in the grid for the column. + * This property is required. + * As well as other words used as property/event names, the reserved words (which cannot be used for names) include subgrid, cb and rn. + */ + name: string; + + /** + * When used in search modules, disables or enables searching on that column + */ search?: boolean; + + /** + * Defines is this can be sorted + */ + sortable?: boolean; + + /** + * Set the initial width of the column, in pixels. This value currently can not be set as percentage + */ width?: number; - formatter?: (cellvalue: any, options: any, rowObject: any) => any; } interface IJqGridJsonReader { + /** + * tells jqGrid that the information for the data in the row is repeatable - i.e. the elements have the same tag cell described in cell element. Setting this option to false instructs jqGrid to search elements in the json data by name. + * This is the name from colModel or the name described with the jsonmap option in colModel + */ repeatitems: boolean; - root(obj: any): any; - page(obj: any): any; - total(obj: any): number; - records(obj: {data: any[]}): number; + + /** + * Name of the root property + * @param obj + * @returns {} + */ + root: string | ((obj: any) => any); + + /** + * current page of the query + * @param obj + * @returns {} + */ + page: string | ((obj: any) => number); + + /** + * total pages for the query + * @param obj + * @returns {} + */ + total: string | ((obj: any) => number); + + /** + * total number of records for the query + * @param obj + * @returns {} + */ + records: string | ((obj: {data: any[]}) => number); } interface JQueryJqGridOptions { - datatype?: string; - mtype?: string; + /** + * When set to true encodes (html encode) the incoming (from server) and posted data (from editing modules). + */ autoencode?: boolean; - pager?: string; - rowNum?: number; - rowList?: number[]; - colNames?: string[]; + + /** + * When set to true, the grid width is recalculated automatically to the width of the parent element. + * This is done only initially when the grid is created. + * In order to resize the grid when the parent element changes width you should apply custom code and use the setGridWidth method for this purpose + */ + autoWidth?: boolean; + + /** + * Defines the caption for the grid. This caption appears in the caption layer, which is above the header layer + */ + caption?: string; + + /** + * Array which describes the parameters of the columns. This is the most important part of the grid. + */ colModel?: JQueryJqGridColumn[]; - sortname?: string; - sortorder?: string; - multiselect?: boolean; - multiboxonly?: boolean; + + /** + * An array in which we place the names of the columns. + * This is the text that appears in the head of the grid (header layer). The names are separated with commas. + * Note that the number of elements in this array should be equal of the number elements in the colModel array. + */ + colNames?: string[]; + + /** + * An array that stores the local data passed to the grid. You can directly point to this variable in case you want to load an array data. + * It can replace the addRowData method which is slow on relative big data + */ + data?: any[]; + + /** + * Defines in what format to expect the data that fills the grid. + * Valid options are xml (we expect data in xml format), xmlstring (we expect xml data as string), json (we expect data in JSON format), + * jsonstring (we expect JSON data as a string), local (we expect data defined at client side (array data)), + * javascript (we expect javascript as data), function (custom defined function for retrieving data), + * or clientSide to manually load data via the data array + */ + datatype?: "xml" | "xmlstring" | "json" | "jsonstring" | "local" | "javascript" | Function | "clientSide"; + + /** + * If set to true, and a column's width is changed, the adjacent column (to the right) will resize so that the overall grid width is maintained + * (e.g., reducing the width of column 2 by 30px will increase the size of column 3 by 30px). In this case there is no horizontal scrollbar. + * Note: This option is not compatible with shrinkToFit option - i.e if shrinkToFit is set to false, forceFit is ignored. + */ forceFit?: boolean; - height?: number; - width?: number; - shrinkToFit?: boolean; - url?: string; + /** + * What will be the result if we insert all the data at once? + * Yes, this can be done with a help of gridview option (set it to true). + * The result is a grid that is 5 to 10 times faster. Of course, when this option is set to true we have some limitations. + * If set to true we can not use treeGrid, subGrid, or the afterInsertRow event. + * If you do not use these three options in the grid you can set this option to true and enjoy the speed. + */ + gridview?: boolean; + + /** + * The height of the grid. + * Can be set as number (in this case we mean pixels) or as percentage (only 100% is accepted) or value of auto is acceptable. + */ + height?: number | string | "auto"; + + /** + * If this flag is set to true, the grid loads the data from the server only once (using the appropriate datatype). + * After the first request, the datatype parameter is automatically changed to local and all further manipulations are done on the client side. + * The functions of the pager (if present) are disabled. + */ + loadonce?: boolean; + + /** + * An array which describes the structure of the expected json data. + */ jsonReader?: IJqGridJsonReader; - gridComplete?:()=>void; + + /** + * Defines the type of request to make ("POST" or "GET") + */ + mtype?: "GET" | "POST"; + + /** + * This option works only when the multiselect option is set to true. + * When multiselect is set to true, clicking anywhere on a row selects that row; + * when multiboxonly is also set to true, the multiselection is done only when the checkbox is clicked (Yahoo style). + * Clicking in any other row (suppose the checkbox is not clicked) deselects all rows and selects the current row. + */ + multiboxonly?: boolean; + + /** + * If this flag is set to true a multi selection of rows is enabled. A new column at left side containing checkboxes is added. + * Can be used with any datatype option + */ + multiselect?: boolean; + + /** + * Defines that we want to use a pager bar to navigate through the records. + * This must be a valid HTML element; in our example we gave the div the id of "pager", but any name is acceptable. + * Note that the navigation layer (the "pager" div) can be positioned anywhere you want, determined by your HTML; + * in our example we specified that the pager will appear after the body layer. + * The valid settings can be (in the context of our example) pager, #pager, jQuery('#pager'). + * I recommend to use the second one - #pager + */ + pager?: string; + + /** + * An array to construct a select box element in the pager in which we can change the number of the visible rows. + * When changed during the execution, this parameter replaces the rowNum parameter that is passed to the url. + * If the array is empty, this element does not appear in the pager. Typically you can set this like [10,20,30]. + * If the rowNum parameter is set to 30 then the selected value in the select box is 30 + */ + rowList?: number[]; + + /** + * Sets how many records we want to view in the grid. This parameter is passed to the url for use by the server routine retrieving the data. + * Note that if you set this parameter to 10 (i.e. retrieve 10 records) and your server return 15 then only 10 records will be loaded + */ + rowNum?: number; + + /** + * This option, if set, defines how the the width of the columns of the grid should be re-calculated, taking into consideration the width of the grid. + * If this value is true, and the width of the columns is also set, then every column is scaled in proportion to its width. + * For example, if we define two columns with widths 80 and 120 pixels, but want the grid to have a width of 300 pixels, + * then the columns will stretch to fit the entire grid, and the extra width assigned to them will depend on the width of the columns themselves and the extra width available. + * The re-calculation is done as follows: the first column gets the width (300(new width)/200(sum of all widths))*80(first column width) = 120 pixels, + * and the second column gets the width (300(new width)/200(sum of all widths))*120(second column width) = 180 pixels. + * Now the widths of the columns sum up to 300 pixels, which is the width of the grid. + * If the value is false and the value in width option is set, then no re-sizing happens whatsoever. + * So in this example, if shrinkToFit is set to false, column one will have a width of 80 pixels, + * column two will have a width of 120 pixels and the grid will retain the width of 300 pixels. + * If the value of shrinkToFit is an integer, the width is calculated according to it. + */ + shrinkToFit?: boolean | number; + + /** + * The column according to which the data is to be sorted when it is initially loaded from the server + * (note that you will have to use datatypes xml or json to load remote data). This parameter is appended to the url. + * If this value is set and the index (name) matches the name from colModel, + * then an icon indicating that the grid is sorted according to this column is added to the column header. + * This icon also indicates the sorting order - descending or ascending (see the parameter sortorder). Also see prmNames + */ + sortname?: string; + + /** + * The initial sorting order (ascending or descending) when we fetch data from the server using datatypes xml or json. + * This parameter is appended to the url - see prnNames. The two allowed values are - asc or desc. + */ + sortorder?: "asc" | "desc"; + + /** + * The url of the file that returns the data needed to populate the grid. May be set to clientArray to manualy post data to server + */ + url?: string | "clientArray"; + + /** + * If true, jqGrid displays the beginning and ending record number in the grid, out of the total number of records in the query. + * This information is shown in the pager bar (bottom right by default)in this format: "View X to Y out of Z". + * If this value is true, there are other parameters that can be adjusted, including emptyrecords and recordtext. + */ + viewrecords?: boolean; + + /** + * If this option is not set, the width of the grid is the sum of the widths of the columns defined in the colModel (in pixels). + * If this option is set, the initial width of each column is set according to the value of the shrinkToFit option. + */ + width?: number; + + // events + + /** + * This fires after all the data is loaded into the grid and all other processes are complete. + * Also the event fires independent from the datatype parameter and after sorting paging and etc. + * @returns {} + */ + gridComplete?: () => void; + + /** + * Raised immediately after row was right clicked + * @param rowid is the id of the row + * @param iRow is the index of the row (do not mix this with the rowid) + * @param iCol is the index of the cell + * @param e is the event object + * @returns {} + */ + onRightClickRow?: (rowid: any, iRow: number, iCol: number, e: Event) => void; + + /** + * Raised immediately after row was clicked. + * @param id is the id of the row + * @param status is the status of the selection + * @param e is the event object. Can be used when multiselect is set to true. true if the row is selected, false if the row is deselected. + * @returns {} + */ + onSelectRow?: (id: string, status: any, e: Event) => void; } interface JQueryJqGridStatic { @@ -60,5 +353,64 @@ interface JQueryStatic { interface JQuery { jqGrid?: JQueryJqGridStatic; + /** + * Populates a grid with the passed data (an array) + * @param data + * @returns {} + */ + addJSONData(data: any[]): void; + + /** + * Edits the row specified by rowid. + * keys is a boolean value, indicating if to use the Enter key to accept the value ane Esc to cancel the edit, or not. + * @param rowid the id of the row to edit + * @param keys when set to true we can use [Enter] key to save the row and [Esc] to cancel editing + * @returns {} + */ + editRow(rowid: any, keys?: boolean): void; + + /** + * Returns the value of the requested parameter. name is the name from the options array. If the name is not set, the entry options are returned. + * @param name + * @returns {} + */ + getGridParam(name: string): any; + + /** + * This method restores the data to original values before the editing of the row + * @param rowId the row to restore + * @param afterRestoreFunc if defined this function is called in after the row is restored. + * @returns {} + */ + restoreRow(rowId: any, afterRestoreFunc?: (response: any) => void): void; + + /** + * Saves the edited row. + * @param rowid the id of the row to save + * @param successfunc + * @param url if defined, this parameter replaces the editurl parameter from the options array. If set to 'clientArray', the data is not posted to the server but rather is saved only to the grid (presumably for later manual saving). + * @param extraparam an array of type name: value. When set these values are posted along with the other values to the server. + * @returns {} + */ + saveRow(rowid: string, successfunc?: (response: any) => boolean, url?: string, extraparam?: any): void; + + /** + * Saves the edited row. + * @param rowid the id of the row to save + * @param successfunc + * @param url + * @param extraparam + * @returns {} + */ + saveRow(rowid: string, successfunc?: boolean, url?: string, extraparam?: any): void; + + /** + * Sets a particular parameter. + * Note - for some parameters to take effect a trigger("reloadGrid") should be executed. + * Note that with this method we can override events. + * The name (in the name:value pair) is the name from options array + * @param obj + * @returns {} + */ setGridParam(obj: any): void; } \ No newline at end of file From 97b469d815ef40b7065046fd8100bb43635a5063 Mon Sep 17 00:00:00 2001 From: Ben Gesoff Date: Mon, 1 Aug 2016 12:37:26 +0100 Subject: [PATCH 45/79] Add setUseDefaultStyles to react-tabs --- react-tabs/react-tabs.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/react-tabs/react-tabs.d.ts b/react-tabs/react-tabs.d.ts index cb292a8f72..758db0d75c 100644 --- a/react-tabs/react-tabs.d.ts +++ b/react-tabs/react-tabs.d.ts @@ -15,7 +15,9 @@ declare namespace ReactTabs { onSelect?: (index: number, last: number) => void; } - interface Tabs extends __React.ComponentClass {} + interface Tabs extends __React.ComponentClass { + setUseDefaultStyles: (use: boolean) => void; + } interface TabListProps { className?: string; From fdbef699911e58faa604a0552f8052a1b89ff98b Mon Sep 17 00:00:00 2001 From: Arsenij Date: Thu, 7 Jul 2016 11:44:17 +0200 Subject: [PATCH 46/79] Added type definition for json-merge-patch https://github.com/pierreinglebert/json-merge-patch --- json-merge-patch/json-merge-patch-tests.ts | 225 +++++++++++++++++++++ json-merge-patch/json-merge-patch.d.ts | 11 + 2 files changed, 236 insertions(+) create mode 100644 json-merge-patch/json-merge-patch-tests.ts create mode 100644 json-merge-patch/json-merge-patch.d.ts diff --git a/json-merge-patch/json-merge-patch-tests.ts b/json-merge-patch/json-merge-patch-tests.ts new file mode 100644 index 0000000000..36d0d34a8a --- /dev/null +++ b/json-merge-patch/json-merge-patch-tests.ts @@ -0,0 +1,225 @@ +/// + +import * as jmp from "json-merge-patch"; + +var merge = jmp.merge; +var apply = jmp.apply; +var generate = jmp.generate; +var assert = {deepEqual: function (a: Object, b: Object) { + return JSON.stringify(a) === JSON.stringify(b); +}}; + +assert.deepEqual( + merge({a: 'b'}, {b: 'c'}), + {a: 'b', b: 'c'} +); + +assert.deepEqual( + merge({a: 'b'}, {a: 'c'}), + {a: 'c'} +); + +assert.deepEqual( + merge({a: 'b', b: 'd'}, {a: 'c'}), + {a: 'c', b: 'd'} +); + +assert.deepEqual( + merge({a: null}, {b: 'c'}), + {a: null, b: 'c'} +); + +assert.deepEqual( + merge({a: null}, {a: 'b'}), + {a: 'b'} +); + +assert.deepEqual( + merge({a: 'b'}, {a: null}), + {a: null} +); + +assert.deepEqual( + merge([], {a: 'b'}), + {a: 'b'} +); + +assert.deepEqual( + merge({a: 'b'}, []), + [] +); + +assert.deepEqual( + merge({a: {b: {c: 'd'}}, d: 'e'}, {a: {b: 'a'}}), + {a: {b: 'a'}, d: 'e'} +); + +assert.deepEqual( + merge({a: {b: {c: 'd'}, d: 'e'}}, {a: {b: {c: 'e'}}}), + {a: {b: {c: 'e'}, d: 'e'}} +); + +assert.deepEqual( + merge({a: 'b'}, null), + null +); + +assert.deepEqual( + generate({a: 'b'}, {a: 'c'}), + {a: 'c'} +); + +assert.deepEqual( + generate({a: 'b'}, { a: 'b', b: 'c'}), + {b: 'c'} +); + +assert.deepEqual( + generate({a: 'b'}, {}), + {a: null} +); + +assert.deepEqual( + generate({a: 'b', b: 'c'}, {b: 'c'}), + {a: null} +); + +assert.deepEqual( + generate({a: ['b']}, {a: 'c'}), + {a: 'c'} +); + +assert.deepEqual( + generate({a: 'c'}, {a: ['b']}), + {a: ['b']} +); + +assert.deepEqual( + generate({a: [{b: 'c'}]}, {a: [1]}), + {a: [1]} +); + +assert.deepEqual( + generate(['a', 'b'], ['c', 'd']), + ['c', 'd'] +); + +assert.deepEqual( + generate(['a', 'b'], ['a']), + ['a'] +); + +assert.deepEqual( + generate({a: 'b'}, ['c']), + ['c'] +); + +assert.deepEqual( + generate({a: 'foo'}, null), + null +); + +assert.deepEqual( + generate({a: 'foo'}, 'bar'), + 'bar' +); + +assert.deepEqual( + generate({e: null}, {e: null, a: 1}), + {a: 1} +); + +assert.deepEqual( + generate({}, {a: {bb: {}}}), + {a: {bb: {}}} +); + +assert.deepEqual( + generate({a: 'a'}, {a: 'a'}), + undefined +); + +assert.deepEqual( + generate({a: {b: 'c'}}, {a: {b: 'c'}}), + undefined +); + +assert.deepEqual( + generate([1,2,3], [1,2,3]), + undefined +); + +assert.deepEqual( + apply({a: 'b'}, {a: 'c'}), + {a: 'c'} +); + +assert.deepEqual( + apply({a: 'b'}, {b: 'c'}), + {a: 'b', b: 'c'} +); + +assert.deepEqual( + apply({a: 'b'}, {a: null}), + {} +); + +assert.deepEqual( + apply({a: 'b', b: 'c'}, {a: null}), + {b: 'c'} +); + +assert.deepEqual( + apply({a: ['b']}, {a: 'c'}), + {a: 'c'} +); + +assert.deepEqual( + apply({a: 'c'}, {a: ['b']}), + {a: ['b']} +); + +assert.deepEqual( + apply({a: {b: 'c'}}, {a: {b: 'd', c: null}}), + {a: {b: 'd'}} +); + +assert.deepEqual( + apply({a: [{b: 'c'}]}, {a: [1]}), + {a: [1]} +); + +assert.deepEqual( + apply(['a', 'b'], ['c', 'd']), + ['c', 'd'] +); + +assert.deepEqual( + apply({a: 'b'}, ['c']), + ['c'] +); + +assert.deepEqual( + apply({a: 'foo'}, null), + null +); + +assert.deepEqual( + apply({a: 'foo'}, 'bar'), + 'bar' +); + +assert.deepEqual( + apply({e: null}, {a: 1}), + {e: null, a: 1} +); + +assert.deepEqual( + apply([1, 2], {a: 'b', c: null}), + {a: 'b'} +); + +assert.deepEqual( + apply({}, {a: {bb: {ccc: null}}}), + {a: {bb: {}}} +); \ No newline at end of file diff --git a/json-merge-patch/json-merge-patch.d.ts b/json-merge-patch/json-merge-patch.d.ts new file mode 100644 index 0000000000..bbf7c1d810 --- /dev/null +++ b/json-merge-patch/json-merge-patch.d.ts @@ -0,0 +1,11 @@ +// Type definitions for json-merge-patch +// Project: https://github.com/pierreinglebert/json-merge-patch +// Definitions by: Arsenij Schuetzer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module "json-merge-patch" { + function apply(target: Object, patch: Object): Object; + function generate(before: Object, after: Object): Object; + function merge(patch1: Object, patch2: Object): Object; +} \ No newline at end of file From 6ae1c56196c8018da94cfd0ebb75dd1d5f05466d Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Mon, 1 Aug 2016 14:09:57 +0200 Subject: [PATCH 47/79] update: Update semver definitions to support v5.3.0 --- semver/semver-tests.ts | 2 ++ semver/semver.d.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/semver/semver-tests.ts b/semver/semver-tests.ts index 2078be5555..d777573857 100644 --- a/semver/semver-tests.ts +++ b/semver/semver-tests.ts @@ -27,6 +27,7 @@ str = mod.inc(str, str, loose); num = mod.major(str, loose); num = mod.minor(str, loose); num = mod.patch(str, loose); +strArr = mod.prerelease(str, loose); // Comparison bool = mod.gt(v1, v2, loose); @@ -44,6 +45,7 @@ diff = mod.diff(v1, v2, loose); str = mod.validRange(str, loose); bool = mod.satisfies(version, str, loose); str = mod.maxSatisfying(versions, str, loose); +str = mod.minSatisfying(versions, str, loose); bool = mod.gtr(version, str, loose); bool = mod.ltr(version, str, loose); bool = mod.outside(version, str, str, loose); diff --git a/semver/semver.d.ts b/semver/semver.d.ts index 20298004d5..a1ace1a134 100644 --- a/semver/semver.d.ts +++ b/semver/semver.d.ts @@ -1,4 +1,4 @@ -// Type definitions for semver v4.3.4 +// Type definitions for semver v5.3.0 // Project: https://github.com/npm/node-semver // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/semver @@ -28,6 +28,10 @@ declare namespace SemVerModule { * Return the patch version number. */ function patch(v: string, loose?: boolean): number; + /** + * Returns an array of prerelease components, or null if none exist. + */ + function prerelease(v: string, loose?: boolean): string[]; // Comparison /** @@ -84,6 +88,10 @@ declare namespace SemVerModule { * Return the highest version in the list that satisfies the range, or null if none of them do. */ function maxSatisfying(versions: string[], range: string, loose?: boolean): string; + /** + * Return the lowest version in the list that satisfies the range, or null if none of them do. + */ + function minSatisfying(versions: string[], range: string, loose?: boolean): string; /** * Return true if version is greater than all the versions possible in the range. */ From 2c40635c34f2b2b887bdb0bc5a85bc7bb3807c31 Mon Sep 17 00:00:00 2001 From: itsFrank Date: Mon, 1 Aug 2016 16:42:12 +0200 Subject: [PATCH 48/79] Fixed blob and json being of type string --- vue-resource/vue-resource.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index 161e27e3df..4226112aa9 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -24,8 +24,8 @@ declare namespace vuejs { statusText: string; headers: Function; text():string; - json():string; - blob():string; + json():any; + blob():Blob; } interface HttpOptions { From 4fe110cb4ea8fed75354d19cfce754691e3f51e0 Mon Sep 17 00:00:00 2001 From: itsFrank Date: Mon, 1 Aug 2016 16:44:08 +0200 Subject: [PATCH 49/79] Fixed json and blob typed string --- vue-resource/vue-resource.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index 4226112aa9..b265858f2d 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -1,6 +1,7 @@ // Type definitions for vue-resoure 0.9.3 // Project: https://github.com/vuejs/vue-resource // Definitions by: kaorun343 +// Updated to 0.9.3 by: itsFrank // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 84c572013395357ecaf1d5caf0c953543bb47bfb Mon Sep 17 00:00:00 2001 From: itsFrank Date: Mon, 1 Aug 2016 16:54:46 +0200 Subject: [PATCH 50/79] Fixed header --- vue-resource/vue-resource.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/vue-resource/vue-resource.d.ts b/vue-resource/vue-resource.d.ts index b265858f2d..4226112aa9 100644 --- a/vue-resource/vue-resource.d.ts +++ b/vue-resource/vue-resource.d.ts @@ -1,7 +1,6 @@ // Type definitions for vue-resoure 0.9.3 // Project: https://github.com/vuejs/vue-resource // Definitions by: kaorun343 -// Updated to 0.9.3 by: itsFrank // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 538d534a4fe133147b32613a9a086835ec246735 Mon Sep 17 00:00:00 2001 From: Luke Venn Date: Mon, 1 Aug 2016 17:12:48 +0100 Subject: [PATCH 51/79] Added missing https AgentOptions to node 4 and 6 definitions --- node/node-4.d.ts | 8 ++++++++ node/node.d.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/node/node-4.d.ts b/node/node-4.d.ts index e0847bb5bc..02b37f8cb2 100644 --- a/node/node-4.d.ts +++ b/node/node-4.d.ts @@ -885,6 +885,14 @@ declare module "https" { export interface Agent extends http.Agent { } export interface AgentOptions extends http.AgentOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: string; + rejectUnauthorized?: boolean; + secureProtocol?: string; maxCachedSessions?: number; } diff --git a/node/node.d.ts b/node/node.d.ts index 359f1679c5..1835318391 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -918,6 +918,14 @@ declare module "https" { export interface Agent extends http.Agent { } export interface AgentOptions extends http.AgentOptions { + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + ciphers?: string; + rejectUnauthorized?: boolean; + secureProtocol?: string; maxCachedSessions?: number; } From a38b3f7c249746c951399ae36c74e42f8303c53d Mon Sep 17 00:00:00 2001 From: Pouya Kary Date: Mon, 1 Aug 2016 20:58:32 +0430 Subject: [PATCH 52/79] definition for window size added --- window-size/window-size.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 window-size/window-size.d.ts diff --git a/window-size/window-size.d.ts b/window-size/window-size.d.ts new file mode 100644 index 0000000000..3abb7c0668 --- /dev/null +++ b/window-size/window-size.d.ts @@ -0,0 +1,12 @@ +// Type definitions for window-size 0.2.0 +// Project: https://github.com/jonschlinkert/window-size +// Definitions by: Pouya Kary +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "window-size" { + /** Height of the terminal window.*/ + export const height: number; + + /** Width of the terminal window.*/ + export const width: number; +} \ No newline at end of file From c02b783e4b722aa7cc7639322cd013328258f37e Mon Sep 17 00:00:00 2001 From: Pouya Kary Date: Mon, 1 Aug 2016 21:15:43 +0430 Subject: [PATCH 53/79] fixed the problem with URL --- window-size/window-size.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window-size/window-size.d.ts b/window-size/window-size.d.ts index 3abb7c0668..c97e4c81b6 100644 --- a/window-size/window-size.d.ts +++ b/window-size/window-size.d.ts @@ -1,6 +1,6 @@ // Type definitions for window-size 0.2.0 // Project: https://github.com/jonschlinkert/window-size -// Definitions by: Pouya Kary +// Definitions by: Pouya Kary // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "window-size" { From a5bf4368e27d6ba6f6ba31152c2cc076826481c6 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 1 Aug 2016 12:46:21 -0400 Subject: [PATCH 54/79] Allow `Object` type as argument to `Stringifier.write` When using the stringifier in NodeJS streaming mode, it is perfectly acceptable to send in an `Object` as well; this is actually my favorite use case for this library. --- csv-stringify/csv-stringify.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csv-stringify/csv-stringify.d.ts b/csv-stringify/csv-stringify.d.ts index a1cc16a15b..77264e48bf 100644 --- a/csv-stringify/csv-stringify.d.ts +++ b/csv-stringify/csv-stringify.d.ts @@ -59,7 +59,7 @@ declare module "csv-stringify" { interface Stringifier extends NodeJS.ReadWriteStream { // Stringifier stream takes array of strings - write(line: string[]): boolean; + write(line: string[] | Object): boolean; // repeat declarations from NodeJS.WritableStream to avoid compile error write(buffer: Buffer, cb?: Function): boolean; From e4933ee6fd02ce5cd53abcb260bb1e6972fb1123 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Mon, 1 Aug 2016 20:08:53 +0200 Subject: [PATCH 55/79] Add setNonce to $mdThemeProvider to allow the user to define a nonce attribute Allow the user to define a nonce attribute for generated theme style tags. See https://github.com/angular/material/issues/7780 --- angular-material/angular-material.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 5e780fe005..c19dae9dbd 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -247,6 +247,7 @@ declare namespace angular.material { extendPalette(name: string, palette: IPalette): IPalette; setDefaultTheme(theme: string): void; alwaysWatchTheme(alwaysWatch: boolean): void; + setNonce(nonce: string): void; } interface IDateLocaleProvider { From e700347ea604ab9f878ab347f47ff4e01d971486 Mon Sep 17 00:00:00 2001 From: Eric Brody Date: Mon, 1 Aug 2016 14:49:54 -0400 Subject: [PATCH 56/79] Adding access to two semi-private methods - These methods are required for a workaround for interface claiming that must be run on Mac. See https://github.com/nonolith/node-usb/issues/61#issuecomment-69195175 --- node-usb/node-usb-tests.ts | 3 +++ node-usb/node-usb.d.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/node-usb/node-usb-tests.ts b/node-usb/node-usb-tests.ts index 8ae22cf0cc..9abef86ee8 100644 --- a/node-usb/node-usb-tests.ts +++ b/node-usb/node-usb-tests.ts @@ -9,6 +9,9 @@ device.busNumber = 1; device.deviceAddress = 1; device.portNumbers = [1, 2, 3]; +device.__open(); +device.__claimInterface(0); + device.open(true); device.close(); const xferDevice: usb.Device = device.controlTransfer(1, 1, 1, 1, 1, (error: string, buf: Buffer): usb.Device => new usb.Device()); diff --git a/node-usb/node-usb.d.ts b/node-usb/node-usb.d.ts index 0a52bdf127..b8d1611a51 100644 --- a/node-usb/node-usb.d.ts +++ b/node-usb/node-usb.d.ts @@ -16,6 +16,9 @@ declare module "usb" { public configDescriptor: ConfigDescriptor; public interfaces: Array; + __open(): void; + __claimInterface(addr: number): void; + open(defaultConfig?: boolean): void; close(): void; interface(addr: number): Interface; From 3888e997f4144f1023cfba592ebb483974bd8dce Mon Sep 17 00:00:00 2001 From: Florent Poujol Date: Mon, 1 Aug 2016 22:36:42 +0200 Subject: [PATCH 57/79] Fix typo in PerspectiveCamera class. --- 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 5e46891808..167e6f7fb3 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -593,7 +593,7 @@ declare namespace THREE { height: number }; filmGauge: number; - filmAcces: number; + filmOffset: number; setFocalLength(focalLength: number): void; getFocalLength(): number; From 7605b76d91192f9b4e9c57a973d216d3d8392fcf Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 1 Aug 2016 17:14:11 -0400 Subject: [PATCH 58/79] amend comment for Stringifier.write Change comment on `Stringifier.write` to reflect that argument is of type `string[] | Object` --- csv-stringify/csv-stringify.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/csv-stringify/csv-stringify.d.ts b/csv-stringify/csv-stringify.d.ts index 77264e48bf..1effe84f61 100644 --- a/csv-stringify/csv-stringify.d.ts +++ b/csv-stringify/csv-stringify.d.ts @@ -58,7 +58,7 @@ declare module "csv-stringify" { interface Stringifier extends NodeJS.ReadWriteStream { - // Stringifier stream takes array of strings + // Stringifier stream takes array of strings or Object write(line: string[] | Object): boolean; // repeat declarations from NodeJS.WritableStream to avoid compile error From 7924aabc0d99c7a1cfef66906a8e6b09f24552e4 Mon Sep 17 00:00:00 2001 From: brett Date: Tue, 2 Aug 2016 23:37:50 +1000 Subject: [PATCH 59/79] added missing property to angularjs IFormController $name (#10352) --- angularjs/angular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index bb028f3425..b6742bfd9c 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -387,6 +387,7 @@ declare namespace angular { $invalid: boolean; $submitted: boolean; $error: any; + $name: string; $pending: any; $addControl(control: INgModelController | IFormController): void; $removeControl(control: INgModelController | IFormController): void; From 25b78b03bc815ea2d19b2e1a100988a8303f931e Mon Sep 17 00:00:00 2001 From: Isman Usoh Date: Tue, 2 Aug 2016 22:07:49 +0700 Subject: [PATCH 60/79] add lodash version (#10308) * add lodash version * Update lodash-3.10.d.ts --- lodash/lodash-3.10.d.ts | 2 +- lodash/lodash.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash/lodash-3.10.d.ts b/lodash/lodash-3.10.d.ts index eca84d937f..aea06a8362 100644 --- a/lodash/lodash-3.10.d.ts +++ b/lodash/lodash-3.10.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Lo-Dash +// Type definitions for Lo-Dash 3.10 // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 35c6611596..52f274fd3c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Lo-Dash +// Type definitions for Lo-Dash 4.14 // Project: http://lodash.com/ // Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From d45a96f558aeb806cf7377d4006330fe423e1f3f Mon Sep 17 00:00:00 2001 From: Faisal Hakim Date: Tue, 2 Aug 2016 22:12:56 +0700 Subject: [PATCH 61/79] update credential.d.ts --- credential/credential-tests.ts | 29 +++++++++++++++++++++-------- credential/credential.d.ts | 32 +++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/credential/credential-tests.ts b/credential/credential-tests.ts index 6013436b05..307201c76e 100644 --- a/credential/credential-tests.ts +++ b/credential/credential-tests.ts @@ -1,16 +1,29 @@ /// +// all from current main repo examples + import * as credential from 'credential'; -credential.hash('password', function(err: Error, hash: string) { - if (err) console.error(err); - else console.log(hash); +var pw = credential(); +var newPassword = 'I have a really great password.'; + +pw.hash(newPassword, function (err, hash) { + if (err) { throw err; } + console.log('Store the password hash.', hash); }); -const hash = '{}'; -const password = 'test'; +var storedHash = { + "hash": "gNofnhlBl36AdRyktwATxKoqWKa6hsIEzwCmW/YXN//7PtiJwCRbepV9fUKu0L9TJELCKoDiBy6rGM8ov7lg2yLY", + "salt": "yyN3KUzlr4KrKWMM2K3d2Ddxf8OTq+vkKG+mtnmQVIibxSJz8drfzkYzqcH0EM+PVKR/1nClRr/CPDuJsq+FOcIw", + "keyLength": 66, + "hashMethod": "pbkdf2", + "iterations": 181019 +}; +var userInput = 'I have a really great password.'; -credential.verify(hash, password, function(err: Error, isValid: boolean) { - if (err) console.error(err); - else console.log(isValid ? 'Password match' : 'Incorrect password'); +pw.verify(storedHash, userInput, function (err, isValid) { + var msg: string; + if (err) { throw err; } + msg = isValid ? 'Passwords match!' : 'Wrong password.'; + console.log(msg); }); diff --git a/credential/credential.d.ts b/credential/credential.d.ts index 2934a090d4..af16e0e412 100644 --- a/credential/credential.d.ts +++ b/credential/credential.d.ts @@ -4,15 +4,33 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'credential' { + interface defaultOptions { + keyLength: number; + work: number; + hashMethod: string; + } - type HashCallback = (err: Error, hash: string) => void; - type VerifyCallback = (err: Error, isValid: boolean) => void; + interface hashObject { + hash: string; + salt: string; + keyLength: number; + hashMethod: string; + iterations: number; + } - namespace credential { - function hash(password: string, callback: HashCallback): void; - function verify(hash: string, password: string, callback: VerifyCallback): void; - } + type HashCallback = (err: Error, hash: hashObject) => void; + type VerifyCallback = (err: Error, isValid: boolean) => void; - export = credential; + function credential(defaultOptions?: defaultOptions): { + hash(password: string, callback: HashCallback): void; + hash(password: string): Promise; + // iterations(work: number, base): number; + verify(hash: hashObject | string, password: string, callback: VerifyCallback): void; + verify(hash: hashObject | string, password: string): Promise; + expired(hash: string, days: number): boolean; + } + namespace credential { } + + export = credential; } From f567f32c90b45a5e72c13c643588fa4f8bd2cead Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Wed, 3 Aug 2016 01:16:14 +1000 Subject: [PATCH 62/79] Add webpack-fail-plugin v1.0.5 (#10369) --- .../webpack-fail-plugin-tests.ts | 9 +++++++++ webpack-fail-plugin/webpack-fail-plugin.d.ts | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 webpack-fail-plugin/webpack-fail-plugin-tests.ts create mode 100644 webpack-fail-plugin/webpack-fail-plugin.d.ts diff --git a/webpack-fail-plugin/webpack-fail-plugin-tests.ts b/webpack-fail-plugin/webpack-fail-plugin-tests.ts new file mode 100644 index 0000000000..4b7ab67b22 --- /dev/null +++ b/webpack-fail-plugin/webpack-fail-plugin-tests.ts @@ -0,0 +1,9 @@ +/// +import * as Webpack from "webpack"; +import FailPlugin = require("webpack-fail-plugin"); + +const config: Webpack.Configuration = { + plugins: [ + FailPlugin + ] +} diff --git a/webpack-fail-plugin/webpack-fail-plugin.d.ts b/webpack-fail-plugin/webpack-fail-plugin.d.ts new file mode 100644 index 0000000000..abfaea11d6 --- /dev/null +++ b/webpack-fail-plugin/webpack-fail-plugin.d.ts @@ -0,0 +1,17 @@ +// Type definitions for webpack-fail-plugin v1.0.5 +// Project: https://github.com/TiddoLangerak/webpack-fail-plugin +// Definitions by: Simon Hartcher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "webpack-fail-plugin" { + import {Plugin} from "webpack"; + + /** + * Webpack plugin that will make the process return status code 1 when it finishes with errors in single-run mode. + */ + function WebpackFailPlugin(): Plugin; + + export = WebpackFailPlugin; +} From 9038485f53df7d3241fac74562aacfcee42b8857 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Wed, 3 Aug 2016 01:16:35 +1000 Subject: [PATCH 63/79] Add webpack-merge (#10370) --- webpack-merge/webpack-merge-tests.ts | 14 ++++++++++++++ webpack-merge/webpack-merge.d.ts | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 webpack-merge/webpack-merge-tests.ts create mode 100644 webpack-merge/webpack-merge.d.ts diff --git a/webpack-merge/webpack-merge-tests.ts b/webpack-merge/webpack-merge-tests.ts new file mode 100644 index 0000000000..1d39e0e7ab --- /dev/null +++ b/webpack-merge/webpack-merge-tests.ts @@ -0,0 +1,14 @@ +/// + +import merge = require("webpack-merge"); +import {Configuration} from "webpack"; + +const a: Configuration = { + entry: "test.js" +} +const b: Configuration = { + devtool: "source-map" +} + +const c = merge(a, b); +const d = merge.smart(a, b); diff --git a/webpack-merge/webpack-merge.d.ts b/webpack-merge/webpack-merge.d.ts new file mode 100644 index 0000000000..3d2683fa85 --- /dev/null +++ b/webpack-merge/webpack-merge.d.ts @@ -0,0 +1,25 @@ +// Type definitions for webpack-merge +// Project: https://github.com/survivejs/webpack-merge +// Definitions by: Simon Hartcher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "webpack-merge" { + import {Configuration} from "webpack"; + + interface WebpackMerge { + /** + * Merge multiple webpack configurations into one. + */ + (...configs: Configuration[]): Configuration; + + /** + * Merge multiple webpack configurations into one, with smart merging of loaders. + */ + smart(...configs: Configuration[]): Configuration; + } + + const merge: WebpackMerge; + export = merge; +} From 765713065a68e28e8c821e9fda71544f9dd4443d Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Wed, 3 Aug 2016 01:17:05 +1000 Subject: [PATCH 64/79] Add webpack-validator v2.2.6 (#10371) --- webpack-validator/webpack-validator-tests.ts | 17 ++++++++++++ webpack-validator/webpack-validator.d.ts | 27 ++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 webpack-validator/webpack-validator-tests.ts create mode 100644 webpack-validator/webpack-validator.d.ts diff --git a/webpack-validator/webpack-validator-tests.ts b/webpack-validator/webpack-validator-tests.ts new file mode 100644 index 0000000000..f64b478b2e --- /dev/null +++ b/webpack-validator/webpack-validator-tests.ts @@ -0,0 +1,17 @@ +/// + +import {Configuration} from "webpack"; +import validate = require("webpack-validator"); + +const a: Configuration = { + entry: "test" +} + +const b = validate(a); +const c = validate(b, { + "no-root-files-node-modules-nameclash": true +}); +const d = validate(b, { + "loader-enforce-include-or-exclude": false, + "loader-prefer-include": true +}); diff --git a/webpack-validator/webpack-validator.d.ts b/webpack-validator/webpack-validator.d.ts new file mode 100644 index 0000000000..3c03627bb3 --- /dev/null +++ b/webpack-validator/webpack-validator.d.ts @@ -0,0 +1,27 @@ +// Type definitions for webpack-validator v2.2.6 +// Project: https://github.com/js-dxtools/webpack-validator +// Definitions by: Simon Hartcher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "webpack-validator" { + import {Configuration} from "webpack"; + + interface ValidationOptions { + "no-root-files-node-modules-nameclash"?: boolean; + "loader-enforce-include-or-exclude"?: boolean; + "loader-prefer-include"?: boolean; + } + + /** + * Validate your webpack configs with joi + */ + function Validate(config: Configuration): Configuration; + /** + * Validate your webpack configs with joi + */ + function Validate(config: Configuration, options: ValidationOptions): Configuration; + + export = Validate; +} From f166c407576c7d963ab3cfc75d81481ce3902ae9 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Wed, 3 Aug 2016 01:17:20 +1000 Subject: [PATCH 65/79] Add html-webpack-plugin v2.22.2 (#10373) --- .../html-webpack-plugin-tests.ts | 18 ++++ html-webpack-plugin/html-webpack-plugin.d.ts | 89 +++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 html-webpack-plugin/html-webpack-plugin-tests.ts create mode 100644 html-webpack-plugin/html-webpack-plugin.d.ts diff --git a/html-webpack-plugin/html-webpack-plugin-tests.ts b/html-webpack-plugin/html-webpack-plugin-tests.ts new file mode 100644 index 0000000000..9aac8c9b98 --- /dev/null +++ b/html-webpack-plugin/html-webpack-plugin-tests.ts @@ -0,0 +1,18 @@ +/// + +import {Configuration} from "webpack"; +import HtmlWebpackPlugin = require("html-webpack-plugin"); + +const a: Configuration = { + plugins: [ + new HtmlWebpackPlugin() + ] +}; + +const b: Configuration = { + plugins: [ + new HtmlWebpackPlugin({ + title: "test" + }) + ] +}; diff --git a/html-webpack-plugin/html-webpack-plugin.d.ts b/html-webpack-plugin/html-webpack-plugin.d.ts new file mode 100644 index 0000000000..59917abf62 --- /dev/null +++ b/html-webpack-plugin/html-webpack-plugin.d.ts @@ -0,0 +1,89 @@ +// Type definitions for html-webpack-plugin v2.22.2 +// Project: https://github.com/ampedandwired/html-webpack-plugin +// Definitions by: Simon Hartcher +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "html-webpack-plugin" { + import {Plugin} from "webpack"; + + interface HtmlWebpackPluginConfiguration { + /** + * The title to use for the generated HTML document. + */ + title?: string; + + /** + * The file to write the HTML to. Defaults to index.html. You can specify a subdirectory here too (eg: `assets/admin.html`). + */ + filename?: string; + + /** + * Webpack require path to the template. Please see the docs for details. + */ + template?: string; + + /** + * `true | 'head' | 'body' | false` + * + * Inject all assets into the given template or templateContent - When passing true or 'body' all javascript resources will be placed at the bottom of the body element. 'head' will place the scripts in the head element. + */ + inject?: boolean | "head" | "body"; + + /** + * Adds the given favicon path to the output html. + */ + favicon?: string; + + /** + * Pass a html-minifier options object to minify the output. + * + * https://github.com/kangax/html-minifier#options-quick-reference + */ + minify?: any; + + /** + * `true | false` if `true` then append a unique webpack compilation hash to all included scripts and css files. This is useful for cache busting. + */ + hash?: boolean; + + /** + * `true | false` if `true` (default) try to emit the file only if it was changed. + */ + cache?: boolean; + + /** + * `true | false` if `true` (default) errors details will be written into the html page. + */ + showErrors?: boolean; + + /** + * Allows you to add only some chunks (e.g. only the unit-test chunk) + */ + chunks?: string[]; + + /** + * Allows to control how chunks should be sorted before they are included to the html. Allowed values: `'none' | 'auto' | 'dependency' | {function}` - default: `'auto'` + */ + chunksSortMode?: "none" | "auto" | "dependency" | Function; + + /** + * Allows you to skip some chunks (e.g. don't add the unit-test chunk) + */ + excludeChunks?: string[]; + + /** + * `true | false` If `true` render the link tags as self-closing, XHTML compliant. Default is `false` + */ + xhtml?: boolean; + } + + interface HtmlWebpackPlugin { + new (): Plugin; + new (options: HtmlWebpackPluginConfiguration): Plugin; + } + + const htmlWebpackPlugin: HtmlWebpackPlugin; + export = htmlWebpackPlugin; +} From 8171ee74e130b49b4fb657405b900f00647e1e84 Mon Sep 17 00:00:00 2001 From: Daniel Schuba Date: Tue, 2 Aug 2016 17:32:21 +0200 Subject: [PATCH 66/79] Fixed return type (#10393) --- jquery.colorbox/jquery.colorbox.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.colorbox/jquery.colorbox.d.ts b/jquery.colorbox/jquery.colorbox.d.ts index 4af0e7e87f..5437c0bf18 100644 --- a/jquery.colorbox/jquery.colorbox.d.ts +++ b/jquery.colorbox/jquery.colorbox.d.ts @@ -252,7 +252,7 @@ interface ColorboxStatic { /** * This method allows you to call Colorbox without having to assign it to an element. */ - (settings: ColorboxSettings); + (settings: ColorboxSettings): any; /** * This method moves to the next item in a group and are the same as pressing the 'next' or 'previous' buttons. */ From ef65481e145220f2617746618450e01deea3c1c4 Mon Sep 17 00:00:00 2001 From: Zachary Maybury Date: Tue, 2 Aug 2016 11:36:57 -0400 Subject: [PATCH 67/79] Type definitions for Spectacle by Formidable Labs (#10407) --- spectacle/spectacle-tests.tsx | 114 ++++++++++++++++++++++++++ spectacle/spectacle.d.ts | 148 ++++++++++++++++++++++++++++++++++ 2 files changed, 262 insertions(+) create mode 100644 spectacle/spectacle-tests.tsx create mode 100644 spectacle/spectacle.d.ts diff --git a/spectacle/spectacle-tests.tsx b/spectacle/spectacle-tests.tsx new file mode 100644 index 0000000000..f8c84b6455 --- /dev/null +++ b/spectacle/spectacle-tests.tsx @@ -0,0 +1,114 @@ +/// +/// + +/** + * Spectacle Test Examples + * + */ + +import * as React from 'react'; +import { + Appear, + BlockQuote, + Cite, + Deck, + Fill, + Heading, + Layout, + Link, + ListItem, + List, + Quote, + Slide, + Spectacle, + Text +} from "spectacle"; + +export class SpectacleTest extends React.Component { + callback() { + alert('Callback: ' + JSON.stringify(arguments)); + } + + public render() { + return ( + + + + Spectacle + + + A ReactJS Presentation Library + + + Where You Can Write Your Decks In JSX + + + View on Github + + Hit Your Right Arrow To Begin! + + + + Wait what? + + + + + + Full Width + + + + + Adjustable Darkness + + + + + Background Imagery + + + + + Flexible Layouts + + + + Left + + + + + Right + + + + + +
+ Wonderfully formatted quotes + Ken Wheeler +
+
+ + + Smooth + + + Combinable Transitions + + + + + Inline style based theme system + Autofit text + Flexbox layout system + React-Router navigation + PDF export + And... + + +
+
); + } +} diff --git a/spectacle/spectacle.d.ts b/spectacle/spectacle.d.ts new file mode 100644 index 0000000000..05f8d9d528 --- /dev/null +++ b/spectacle/spectacle.d.ts @@ -0,0 +1,148 @@ +// Type definitions for Spectacle 1.1.1 +// Project: https://github.com/FormidableLabs/victory +// Definitions by: Zachary Maybury +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +declare module "spectacle" { + import * as React from "react"; + + /** + * Transition Types for Spectacle + */ + type transitionType = "slide"|"zoom"|"fade"|"spin"; + + /** + * Progress Types for Spectacle + */ + type progressType = "pacman"|"bar"|"number"|"none"; + + /** + * Alignment Types for Spectacle + */ + type alignType = + "flex-start flex-start"|"flex-start center"|"flex-start flex-end"| + "center flex-start"|"center center"|"center flex-end"| + "flex-end flex-start"|"flex-end center"|"flex-end flex-end"; + + /** + * Base props for many Spectacle components + */ + export interface BaseProps { + italic?:boolean, + bold?:boolean, + caps?:boolean, + margin?:number|string, + padding?:number|string, + textColor?:string, + textSize?:string, + textAlign?:string, + textFont?:string, + bgColor?:string, + bgImage?:string, + bgDarken?:number + } + + export interface SpectacleProps { + theme?:{ [key: string ]: string | number } + } + + export interface DeckProps { + transition?:transitionType[], + transitionDuration?:number, + progress?:progressType, + controls?:boolean + } + + export interface SlideProps extends BaseProps { + align?:alignType, + transition?:transitionType[], + transitionDuration?:number, + notes?:string, + id?:string + } + + export interface MarkdownProps { + source?:string, + mdastConfig?:{ [key: string ]: string | number } + } + + export interface CodePaneProps extends BaseProps { + lang?:string, + source?:string + } + + export interface HeadingProps extends BaseProps { + fit?:boolean, + lineHeight?:number + size?:number; + } + + export interface ImageProps extends BaseProps { + display?:string, + height?:number, + src?:string, + width?:number|string + } + + export interface LinkProps extends BaseProps { + href?:string + } + + export interface SProps extends BaseProps { + type?:string + } + + export interface TextProps extends BaseProps { + fit?:boolean, + lineHeight?:number + } + + export class Spectacle extends React.Component {} + + export class Deck extends React.Component {} + + export class Slide extends React.Component {} + + export class Layout extends React.Component {} + + export class Fit extends React.Component {} + + export class Fill extends React.Component {} + + export class Markdown extends React.Component {} + + export class Appear extends React.Component {} + + export class BlockQuote extends React.Component {} + + export class Quote extends React.Component {} + + export class Cite extends React.Component {} + + export class CodePane extends React.Component {} + + export class Code extends React.Component {} + + export class Heading extends React.Component {} + + export class Image extends React.Component {} + + export class Link extends React.Component {} + + export class List extends React.Component {} + + export class ListItem extends React.Component {} + + export class S extends React.Component {} + + export class Table extends React.Component {} + + export class TableRow extends React.Component {} + + export class TableHeaderItem extends React.Component {} + + export class TableItem extends React.Component {} + + export class Text extends React.Component {} +} \ No newline at end of file From 7fa8ea05993050fd3e58a82f9b7748ab539ae55d Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Wed, 3 Aug 2016 01:49:03 +1000 Subject: [PATCH 68/79] Modified pool options class to match sequelize params as describe here (#10413) http://docs.sequelizejs.com/en/latest/api/sequelize/ --- sequelize/sequelize.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 4324ab625d..4cf94ce77d 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -4986,17 +4986,17 @@ declare module "sequelize" { /** * Maximum connections of the pool */ - maxConnections?: number; + max?: number; /** * Minimum connections of the pool */ - minConnections?: number; + min?: number; /** * The maximum time, in milliseconds, that a connection can be idle before being released. */ - maxIdleTime?: number; + idle?: number; /** * A function that validates a connection. Called with client. The default function checks that client is an From a6191ce9e55e5dc996a552d49b4a9a2ce898263a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Morav=C4=8D=C3=ADk?= Date: Tue, 2 Aug 2016 17:49:44 +0200 Subject: [PATCH 69/79] THREE js cleanup, removal of BoundingSphere interface (#10416) * fixed typo * replaced some arrays with ArrayLike some math methods and objects are commonly used with geometry attributes which are TypedArrays * removed BoundingSphere interface geometry bounding spheres are THREE.Spheres and internally not only radius is used --- threejs/three.d.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 167e6f7fb3..15510a5821 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -772,7 +772,7 @@ declare namespace THREE { morphAttributes: any; groups: {start: number, count: number, materialIndex?: number}[]; boundingBox: Box3; - boundingSphere: BoundingSphere; + boundingSphere: Sphere; drawRange: { start: number, count: number }; getIndex(): BufferAttribute; @@ -932,7 +932,7 @@ declare namespace THREE { skinWeights: number[]; skinIndices: number[]; boundingBox: Box3; - boundingSphere: BoundingSphere; + boundingSphere: Sphere; verticesNeedUpdate: boolean; normalsNeedUpdate: boolean; colorsNeedUpdate: boolean; @@ -1105,10 +1105,6 @@ declare namespace THREE { normals: Vector3[]; } - export interface BoundingSphere { - radius: number; - } - export let GeometryIdCount: number; /** @@ -1208,7 +1204,7 @@ declare namespace THREE { /** * Bounding sphere. */ - boundingSphere: BoundingSphere; + boundingSphere: Sphere; /** * Set to true if the vertices array has been updated. @@ -2858,7 +2854,7 @@ declare namespace THREE { min: Vector3; set(min: Vector3, max: Vector3): Box3; - setFromArray(array: number[]): Box3; + setFromArray(array: ArrayLike): Box3; setFromPoints(points: Vector3[]): Box3; setFromCenterAndSize(center: Vector3, size: Vector3): Box3; setFromObject(object: Object3D): Box3; @@ -3366,8 +3362,8 @@ declare namespace THREE { identity(): Matrix3; clone(): Matrix3; copy(m: Matrix3): Matrix3; - setFromMatix4(m: Matrix4): Matrix3; - applyToVector3Array(array: number[], offset?: number, length?: number): number[]; + setFromMatrix4(m: Matrix4): Matrix3; + applyToVector3Array(array: ArrayLike, offset?: number, length?: number): ArrayLike; applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; multiplyScalar(s: number): Matrix3; determinant(): number; @@ -3467,7 +3463,7 @@ declare namespace THREE { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; - applyToVector3Array(array: number[], offset?: number, length?: number): number[]; + applyToVector3Array(array: ArrayLike, offset?: number, length?: number): ArrayLike; applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; /** * Computes determinant of this matrix. From dbfe1f60e469cdb0294733b276b67e34f9a50688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=9D=E9=BA=BB=E9=A3=9E=E6=9D=A5?= Date: Tue, 2 Aug 2016 23:50:09 +0800 Subject: [PATCH 70/79] nunjucks.configure first arguments: path can be array (#10417) --- nunjucks/nunjucks.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/nunjucks/nunjucks.d.ts b/nunjucks/nunjucks.d.ts index f0f9b081f3..46542bed93 100644 --- a/nunjucks/nunjucks.d.ts +++ b/nunjucks/nunjucks.d.ts @@ -34,6 +34,7 @@ declare namespace nunjucks { export function configure(options: ConfigureOptions): Environment; export function configure(path: string, options?: ConfigureOptions): Environment; + export function configure(path: string[], options?: ConfigureOptions): Environment; export interface ConfigureOptions { autoescape?: boolean; From fa5f6bf0cd0b34178dafacbcad1c8a69c060ee2d Mon Sep 17 00:00:00 2001 From: TonyYang Date: Tue, 2 Aug 2016 23:50:38 +0800 Subject: [PATCH 71/79] Update node.d.ts (#10418) It misses "finished" property, please refer official site: https://nodejs.org/api/http.html#http_response_finished --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index 1835318391..515d7e489a 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -607,6 +607,7 @@ declare module "http" { removeHeader(name: string): void; write(chunk: any, encoding?: string): any; addTrailers(headers: any): void; + finished: boolean; // Extended base methods end(): void; From 12ede35d5b3d5d5595ce6edf41f6f1a96ea33d1f Mon Sep 17 00:00:00 2001 From: jamescoward Date: Tue, 2 Aug 2016 16:51:23 +0100 Subject: [PATCH 72/79] Added simple User-Defined type guards (#10419) Added type guards to: angular.isArray() angular.isDate() angular.isFunction() angular.isNumber() angular.isObject() angular.isString() See: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards --- angularjs/angular.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index b6742bfd9c..e64496604f 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -118,14 +118,14 @@ declare namespace angular { fromJson(json: string): any; identity(arg?: T): T; injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; - isArray(value: any): boolean; - isDate(value: any): boolean; + isArray(value: any): value is Array; + isDate(value: any): value is Date; isDefined(value: any): boolean; isElement(value: any): boolean; - isFunction(value: any): boolean; - isNumber(value: any): boolean; - isObject(value: any): boolean; - isString(value: any): boolean; + isFunction(value: any): value is Function; + isNumber(value: any): value is number; + isObject(value: any): value is Object; + isString(value: any): value is string; isUndefined(value: any): boolean; lowercase(str: string): string; From 0ca14ec00c0f3d3e76c4a5d853796eb1f3595022 Mon Sep 17 00:00:00 2001 From: Oleksii Date: Tue, 2 Aug 2016 18:54:16 +0300 Subject: [PATCH 73/79] Add elastic.js type definitions. (#10423) * Add elastic.js type definitions. * Fix tests. * Fix tests. * Fix meta information format. --- elastic.js/elastic.js-tests.ts | 6 + elastic.js/elastic.js.d.ts | 8972 ++++++++++++++++++++++++++++++++ 2 files changed, 8978 insertions(+) create mode 100644 elastic.js/elastic.js-tests.ts create mode 100644 elastic.js/elastic.js.d.ts diff --git a/elastic.js/elastic.js-tests.ts b/elastic.js/elastic.js-tests.ts new file mode 100644 index 0000000000..24c9784f81 --- /dev/null +++ b/elastic.js/elastic.js-tests.ts @@ -0,0 +1,6 @@ +/// + +let body = new elasticjs.Request({}) + .query(new elasticjs.MatchQuery('title_field', 'testQuery')) + .facet(new elasticjs.TermsFacet('tags').field('tags')) + .toJSON(); diff --git a/elastic.js/elastic.js.d.ts b/elastic.js/elastic.js.d.ts new file mode 100644 index 0000000000..850d1ccdfa --- /dev/null +++ b/elastic.js/elastic.js.d.ts @@ -0,0 +1,8972 @@ +// Type definitions for elastic.js v1.2.0 +// Project: https://www.npmjs.com/package/elastic.js +// Definitions by: Oleksii Trekhleb +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module elasticjs { + + export interface Facet {} + export interface Geo {} + export interface Suggest {} + export interface Generator {} + export interface Query {} + export interface Filter {} + export interface Aggregation {} + export interface ScoreFunction {} + + export class AggregationMixin implements Aggregation { + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): AggregationMixin; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): AggregationMixin; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A container Filter that allows Boolean AND composition of Filters. + */ + export class AndFilter implements Filter { + + /* + A container Filter that allows Boolean AND composition of Filters. + */ + constructor(f: Filter | Filter[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): AndFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): AndFilter; + + /* + Sets the filters for the filter. If fltr is a single + Filter, it is added to the current filters. If fltr is an array + of Filters, then they replace all existing filters. + */ + filters(fltr: Filter | Filter[]): AndFilter; + + /* + Sets the filter name. + */ + name(name: string): AndFilter; + + /* + Returns the filter object. + */ + toJSON(): AndFilter; + + } + + + /* + A single-value metrics aggregation that computes the average of numeric + values that are extracted from the aggregated documents. These values can be + extracted either from specific numeric fields in the documents, or be + generated by a provided script. + */ + export class AvgAggregation implements Aggregation { + + /* + Aggregation that computes the average of numeric values that are extracted + from the aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): AvgAggregation; + + /* + The script language being used. + */ + lang(language: string): AvgAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): AvgAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): AvgAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): AvgAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A BoolFilter allows you to build Boolean filter constructs + from individual filters. Similar in concept to Boolean query, except that + the clauses are other filters. Can be placed within queries that accept a + filter. + */ + export class BoolFilter implements Filter { + + /* + A Filter that matches documents matching boolean combinations of other + filters. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): BoolFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): BoolFilter; + + /* + Adds filter to boolean container. Given filter "must" appear in + matching documents. If passed a single Filter it is added to the + list of existing filters. If passed an array of Filters, they + replace all existing filters. + */ + must(oFilter: Filter | Filter[]): BoolFilter; + + /* + Adds filter to boolean container. Given filter "must not" appear + in matching documents. If passed a single Filter it is added to + the list of existing filters. If passed an array of Filters, + they replace all existing filters. + */ + mustNot(oFilter: Filter | Filter[]): BoolFilter; + + /* + Sets the filter name. + */ + name(name: string): BoolFilter; + + /* + Adds filter to boolean container. Given filter "should" appear in + matching documents. If passed a single Filter it is added to + the list of existing filters. If passed an array of Filters, + they replace all existing filters. + */ + should(oFilter: Filter | Filter[]): BoolFilter; + + /* + Returns the filter object. + */ + toJSON(): BoolFilter; + + } + + + /* + A boolQuery allows you to build Boolean query constructs + from individual term or phrase queries. For example you might want to search + for documents containing the terms javascript and python. + */ + export class BoolQuery implements Query { + + /* + A Query that matches documents matching boolean combinations of other + queries, e.g. termQuerys, phraseQuerys or other boolQuerys. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets if the Query should be enhanced with a + MatchAllQuery in order to act as a pure exclude when + only negative (mustNot) clauses exist. Default: true. + */ + adjustPureNegative(trueFalse: string): BoolQuery; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): BoolQuery; + + /* + Enables or disables similarity coordinate scoring of documents + matching the Query. Default: false. + */ + disableCoord(trueFalse: string): BoolQuery; + + /* + Sets the number of optional clauses that must match. + + By default no optional clauses are necessary for a match + (unless there are no required clauses). If this method is used, + then the specified number of clauses is required. + + Use of this method is totally independent of specifying that + any specific clauses are required (or prohibited). This number will + only be compared against the number of matching optional clauses. + */ + minimumNumberShouldMatch(minMatch: number): BoolQuery; + + /* + Adds query to boolean container. Given query "must" appear in matching documents. + */ + must(oQuery: Object): BoolQuery; + + /* + Adds query to boolean container. Given query "must not" appear in matching documents. + */ + mustNot(oQuery: Object): BoolQuery; + + /* + Adds query to boolean container. Given query "should" appear in matching documents. + */ + should(oQuery: Object): BoolQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The boost_factor score allows you to multiply the score by the provided + boost_factor. This can sometimes be desired since boost value set on specific + queries gets normalized, while for this score function it does not. + */ + export class BoostFactorScoreFunction implements ScoreFunction { + + /* + Multiply the score by the provided boost_factor. + */ + constructor(boostVal: number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost factor. + */ + boost(b: number): BoostFactorScoreFunction; + + /* + Adds a filter whose matching documents will have the score function applied. + */ + filter(oFilter: Filter): BoostFactorScoreFunction; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The boosting query can be used to effectively demote results that match + a given query. Unlike the “NOT” clause in bool query, this still selects + documents that contain undesirable terms, but reduces their overall + score. + */ + export class BoostingQuery implements Query { + + /* + Constructs a query that can demote search results. A negative boost. + */ + constructor(positiveQry: Object, negativeQry: Object, negativeBoost: number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): BoostingQuery; + + /* + Sets the query used to match documents in the positive + query that will be negatively boosted. + */ + negative(oQuery: Object): BoostingQuery; + + /* + Sets the negative boost value. + */ + negativeBoost(boost: number): BoostingQuery; + + /* + Sets the "master" query that determines which results are returned. + */ + positive(oQuery: Object): BoostingQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A single-value metrics aggregation that calculates an approximate count of + distinct values. Values can be extracted either from specific fields in the + document or generated by a script. + */ + export class CardinalityAggregation implements Aggregation { + + /* + Aggregation that calculates an approximate count of distinct values. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): CardinalityAggregation; + + /* + The script language being used. + */ + lang(language: string): CardinalityAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): CardinalityAggregation; + + /* + Allows to trade memory for accuracy, and defines a unique count below which + counts are expected to be close to accurate. Above this value, counts might + become a bit more fuzzy. The maximum supported value is 40000, thresholds + above this number will have the same effect as a threshold of 40000. + Default value depends on the number of parent aggregations that multiple + create buckets (such as terms or histograms). + */ + precisionThreshold(num: number): CardinalityAggregation; + + /* + Set to false to disable rehashing of values. You must have computed a hash + on the client-side and stored it into your documents if you disable this. + */ + rehash(trueFalse: boolean): CardinalityAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): CardinalityAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A query that executes high-frequency terms in a optional sub-query to + prevent slow queries due to "common" terms like stopwords. + + This query basically builds two queries out of the terms in the query + string where low-frequency terms are added to a required boolean clause and + high-frequency terms are added to an optional boolean clause. The optional + clause is only executed if the required "low-frequency' clause matches. + + CommonTermsQuery has several advantages over stopword + filtering at index or query time since a term can be "classified" based on + the actual document frequency in the index and can prevent slow queries even + across domains without specialized stopword files. + */ + export class CommonTermsQuery implements Query { + + /* + A query that executes high-frequency terms in a optional sub-query. + */ + constructor(field: string, qstr: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the analyzer name used to analyze the Query object. + */ + analyzer(analyzer: string): CommonTermsQuery; + + /* + Sets the boost value for documents commoning the Query. + */ + boost(boost: Number): CommonTermsQuery; + + /* + Sets the maximum threshold/frequency to be considered a low + frequency term. Set to a value between 0 and 1. + */ + cutoffFrequency(freq: Number): CommonTermsQuery; + + /* + Enables or disables similarity coordinate scoring of documents + commoning the Query. Default: false. + */ + disableCoord(trueFalse: string): CommonTermsQuery; + + /* + Sets the field to query against. + */ + field(f: string): CommonTermsQuery; + + /* + Sets the boolean operator to be used for high frequency terms. + Default: AND + */ + highFreqOperator(op: string): CommonTermsQuery; + + /* + Sets the boolean operator to be used for low frequency terms. + Default: AND + */ + lowFreqOperator(op: string): CommonTermsQuery; + + /* + Sets the minimum number of low freq matches that need to match in + a document before that document is returned in the results. + */ + minimumShouldMatch(min: number): CommonTermsQuery; + + /* + Sets the minimum number of high freq matches that need to match in + a document before that document is returned in the results. + */ + minimumShouldMatchHighFreq(min: number): CommonTermsQuery; + + /* + Sets the minimum number of low freq matches that need to match in + a document before that document is returned in the results. + */ + minimumShouldMatchLowFreq(min: number): CommonTermsQuery; + + /* + Sets the query string. + */ + query(qstr: string): CommonTermsQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + export class CompletionSuggester implements Suggest { + + /* + A suggester that allows basic auto-complete functionality. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets analyzer used to analyze the suggest text. + */ + analyzer(analyzer: string): CompletionSuggester; + + /* + Maximum edit distance (fuzziness), defaults to 1. Automatically + enables fuzzy suggestions when set to any value. + */ + editDistance(d: number): CompletionSuggester; + + /* + Sets the field used to generate suggestions from. + */ + field(field: string): CompletionSuggester; + + /* + Enable fuzzy completions which means a can spell a word + incorrectly and still get a suggestion. + */ + fuzzy(trueFalse: boolean): CompletionSuggester; + + /* + Minimum length of the input before fuzzy suggestions are returned, defaults + to 3. Automatically enables fuzzy suggestions when set to any value. + */ + minLength(m: number): CompletionSuggester; + + /* + Minimum length of the input, which is not checked for fuzzy alternatives, defaults + to 1. Automatically enables fuzzy suggestions when set to any value. + */ + prefixLength(l: number): CompletionSuggester; + + /* + Sets the maximum number of suggestions to be retrieved from + each individual shard. + */ + shardSize(s: number): CompletionSuggester; + + /* + Sets the number of suggestions returned for each token. + */ + size(s: number): CompletionSuggester; + + /* + Sets the text to get suggestions for. If not set, the global + suggestion text will be used. + */ + text(txt: string): CompletionSuggester; + + /* + Retrieves the internal suggest object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets if transpositions should be counted as one or two changes, defaults + to true when fuzzy is enabled. Automatically enables fuzzy suggestions + when set to any value. + */ + transpositions(trueFalse: boolean): CompletionSuggester; + + /* + Sets all are measurements (like edit distance, transpositions and lengths) + in unicode code points (actual letters) instead of bytes. Automatically + enables fuzzy suggestions when set to any value. + */ + unicodeAware(trueFalse: boolean): CompletionSuggester; + + } + + + /* + A constant score query wraps another Query or + Filter and returns a constant score for each + result that is equal to the query boost. + + Note that lucene's query normalization (queryNorm) attempts + to make scores between different queries comparable. It does not + change the relevance of your query, but it might confuse you when + you look at the score of your documents and they are not equal to + the query boost value as expected. The scores were normalized by + queryNorm, but maintain the same relevance. + */ + export class ConstantScoreQuery implements Query { + + /* + Constructs a query where each documents returned by the internal + query or filter have a constant score equal to the boost factor. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): ConstantScoreQuery; + + /* + Enables caching of the filter. + */ + cache(trueFalse: boolean): ConstantScoreQuery; + + /* + Set the cache key. + */ + cacheKey(k: string): ConstantScoreQuery; + + /* + Adds the filter to apply a constant score to. + */ + filter(oFilter: Object): ConstantScoreQuery; + + /* + Adds the query to apply a constant score to. + */ + query(oQuery: Object): ConstantScoreQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A multi-bucket aggregation similar to the histogram except it can only be + applied on date values. Since dates are represented in elasticsearch + internally as long values, it is possible to use the normal histogram on + dates as well, though accuracy will be compromised. The reason for this is + in the fact that time based intervals are not fixed (think of leap years and + on the number of days in a month). For this reason, we need a special + support for time based data. From a functionality perspective, this + histogram supports the same features as the normal histogram. The main + difference is that the interval can be specified by date/time expressions. + */ + export class DateHistogramAggregation implements Aggregation { + + /* + Aggregation similar to the histogram except it can only be applied on + date values. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): DateHistogramAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): DateHistogramAggregation; + + /* + Set's the range/bounds for the histogram aggregation. Useful when you + want to include buckets that might be outside the bounds of indexed + documents. + */ + extendedBounds(min: string | number, max: string | number): DateHistogramAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): DateHistogramAggregation; + + /* + Sets the format expression for the terms. Use for number or date + formatting + */ + format(f: string): DateHistogramAggregation; + + /* + Sets the histogram interval. Buckets are generated based on this interval + value. + */ + interval(i: string): DateHistogramAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): DateHistogramAggregation; + + /* + The script language being used. + */ + lang(language: string): DateHistogramAggregation; + + /* + Only return terms that match more than a configured number of hits. + */ + minDocCount(num: number): DateHistogramAggregation; + + /* + Sets order for the aggregated values. + */ + order(order: string, direction: string): DateHistogramAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): DateHistogramAggregation; + + /* + Set the post-rouding offset. + */ + postOffset(offset: string): DateHistogramAggregation; + + /* + Set the post-rouding date time zone. + */ + postZone(tz: string): DateHistogramAggregation; + + /* + Set the pre-rouding offset. + */ + preOffset(offset: string): DateHistogramAggregation; + + /* + Set the pre-rouding date time zone. + */ + preZone(tz: string): DateHistogramAggregation; + + /* + Set to true to apply interval adjusts to day and above intervals. + */ + preZoneAdjustLargeInterval(trueFalse: boolean): DateHistogramAggregation; + + /* + Allows you generate or modify the terms using a script. + */ + script(scriptCode: string): DateHistogramAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): DateHistogramAggregation; + + /* + Set the date time zone. + */ + timeZone(tz: string): DateHistogramAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The DateHistogram facet works with time-based values by building a histogram across time + intervals of the value field. Each value is rounded into an interval (or + placed in a bucket), and statistics are provided per interval/bucket (count and total). + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class DateHistogramFacet implements Facet { + + /* + A facet which returns the N most frequent terms within a collection + or set of collections. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): DateHistogramFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): DateHistogramFacet; + + /* + The date histogram works on numeric values (since time is stored + in milliseconds since the epoch in UTC). + + But, sometimes, systems will store a different resolution (like seconds since UTC) + in a numeric field. The factor parameter can be used to change the value in the field + to milliseconds to actual do the relevant rounding, and then be applied again to get to + the original unit. + + For example, when storing in a numeric field seconds resolution, + the factor can be set to 1000. + */ + factor(f: number): DateHistogramFacet; + + /* + Sets the field to be used to construct the this facet. + */ + field(fieldName: string): DateHistogramFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): DateHistogramFacet; + + /* + Sets the bucket interval used to calculate the distribution. + */ + interval(timeInterval: string): DateHistogramFacet; + + /* + Allows you to specify a different key field to be used to group intervals. + */ + keyField(fieldName: string): DateHistogramFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): DateHistogramFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): DateHistogramFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): DateHistogramFacet; + + /* + Sets the type of ordering that will be performed on the date + buckets. Valid values are: + + + time - the default, sort by the buckets start time in milliseconds. + count - sort by the number of items in the bucket + total - sort by the sum/total of the items in the bucket + + */ + order(o: string): DateHistogramFacet; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): DateHistogramFacet; + + /* + Set's a specific post-rounding offset. Format is 1d, 1h, etc. + */ + postOffset(offset: string): DateHistogramFacet; + + /* + By default, time values are stored in UTC format. + + This method allows users to set a time zone value that is then used to compute + intervals after rounding on the interval value. The value is an offset from UTC. + The tz offset value is simply added to the resulting bucket's date value. + + For example, to use EST you would set the value to -5. + */ + postZone(tz: number): DateHistogramFacet; + + /* + Set's a specific pre-rounding offset. Format is 1d, 1h, etc. + */ + preOffset(offset: string): DateHistogramFacet; + + /* + By default, time values are stored in UTC format. + + This method allows users to set a time zone value that is then used to + compute intervals before rounding on the interval value. The value is an + offset from UTC. + + For example, to use EST you would set the value to -5. + */ + preZone(tz: number): DateHistogramFacet; + + /* + Enables large date interval conversions (day and up). + + Set to true to enable and then set the interval to an + interval greater than a day. + */ + preZoneAdjustLargeInterval(trueFalse: boolean): DateHistogramFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): DateHistogramFacet; + + /* + By default, time values are stored in UTC format. + + This method allows users to set a time zone value that is then used + to compute intervals before rounding on the interval value. Equalivent to + preZone. Use preZone if possible. The + value is an offset from UTC. + + For example, to use EST you would set the value to -5. + */ + timeZone(tz: number): DateHistogramFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Allows you to specify a different value field to aggrerate over. + */ + valueField(fieldName: string): DateHistogramFacet; + + /* + Allows you modify the value field using a script. The modified value + is then used to compute the statistical data. + */ + valueScript(scriptCode: string): DateHistogramFacet; + + } + + + /* + A range aggregation that is dedicated for date values. The main difference + between this aggregation and the normal range aggregation is that the from + and to values can be expressed in Date Math expressions, and it is also + possible to specify a date format by which the from and to response fields + will be returned. Note that this aggregration includes the from value and + excludes the to value for each range. + + Note that this aggregration includes the from value and excludes the to + value for each range. + */ + export class DateRangeAggregation implements Aggregation { + + /* + Aggregation that is dedicated for date value ranges. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): DateRangeAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): DateRangeAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): DateRangeAggregation; + + /* + Sets the date format expression. + */ + format(f: string): DateRangeAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): DateRangeAggregation; + + /* + The script language being used. + */ + lang(language: string): DateRangeAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): DateRangeAggregation; + + /* + Adds a range to the list of exsiting range expressions. + */ + range(from: string, to: string, key: string): DateRangeAggregation; + + /* + Allows you generate or modify the terms using a script. + */ + script(scriptCode: string): DateRangeAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): DateRangeAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Decay functions score a document with a function that decays depending on + the distance of a numeric field value of the document from a user given + origin. This is similar to a range query, but with smooth edges instead of + boxes. + + Supported decay functions are: linear, exp, and gauss. + */ + export class DecayScoreFunction implements ScoreFunction { + + /* + Score a document with a function that decays depending on the distance + of a numeric field value of the document from given origin. + */ + constructor(field: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the decay value which defines how documents are scored at the distance + given at scale. + */ + decay(d: number): DecayScoreFunction; + + /* + Use the exp decay function. Exponential decay. + */ + exp(): DecayScoreFunction; + + /* + Sets the fields to run the decay function against. + */ + field(f: string): DecayScoreFunction; + + /* + Adds a filter whose matching documents will have the score function applied. + */ + filter(oFilter: Filter): DecayScoreFunction; + + /* + Use the gauss decay function. Normal decay. + */ + gauss(): DecayScoreFunction; + + /* + Use the linear decay function. Linear decay. + */ + linear(): DecayScoreFunction; + + /* + Sets the decay offset. The decay function will only compute a the decay + function for documents with a distance greater that the defined offset. + The default is 0. + */ + offset(o: string): DecayScoreFunction; + + /* + Sets the origin which is the “central point” from which the distance is + calculated. + */ + origin(o: string): DecayScoreFunction; + + /* + Sets the scale/rate of decay. + */ + scale(s: string): DecayScoreFunction; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + DirectGenerator is a candidate generator for PhraseSuggester. + It generates terms based on edit distance and operators much like the + TermSuggester. + */ + export class DirectGenerator implements Generator { + + /* + A candidate generator that generates terms based on edit distance. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the accuracy. How similar the suggested terms at least + need to be compared to the original suggest text. + */ + accuracy(a: number): DirectGenerator; + + /* + Sets the field used to generate suggestions from. + */ + field(field: string): DirectGenerator; + + /* + Sets the maximum edit distance candidate suggestions can have + in order to be considered as a suggestion. + */ + maxEdits(max: number): DirectGenerator; + + /* + The factor that is used to multiply with the size in order + to inspect more candidate suggestions. + */ + maxInspections(max: number): DirectGenerator; + + /* + Sets a maximum threshold in number of documents a suggest text + token can exist in order to be corrected. + */ + maxTermFreq(max: number): DirectGenerator; + + /* + Sets a minimal threshold of the number of documents a suggested + term should appear in. + */ + minDocFreq(min: number): DirectGenerator; + + /* + Sets the minimum length a suggest text term must have in order + to be corrected. + */ + minWordLen(len: number): DirectGenerator; + + /* + Sets an analyzer that is applied to each of the generated tokens + before they are passed to the actual phrase scorer. + */ + postFilter(analyzer: string): DirectGenerator; + + /* + Sets an analyzer that is applied to each of the tokens passed to + this generator. The analyzer is applied to the original tokens, + not the generated tokens. + */ + preFilter(analyzer: string): DirectGenerator; + + /* + Sets the number of suggestions returned for each token. + */ + size(s: number): DirectGenerator; + + /* + Sets the sort mode. Valid values are: + + + score - Sort by score first, then document frequency, and then the term itself + frequency - Sort by document frequency first, then simlarity score and then the term itself + + */ + sort(s: string): DirectGenerator; + + /* + Sets what string distance implementation to use for comparing + how similar suggested terms are. Valid values are: + + + internal - based on damerau_levenshtein but but highly optimized for comparing string distance for terms inside the index + damerau_levenshtein - String distance algorithm based on Damerau-Levenshtein algorithm + levenstein - String distance algorithm based on Levenstein edit distance algorithm + jarowinkler - String distance algorithm based on Jaro-Winkler algorithm + ngram - String distance algorithm based on character n-grams + + */ + stringDistance(s: string): DirectGenerator; + + /* + Sets the suggest mode. Valid values are: + + + missing - Only suggest terms in the suggest text that aren't in the index + popular - Only suggest suggestions that occur in more docs then the original suggest text term + always - Suggest any matching suggestions based on terms in the suggest text + + */ + suggestMode(m: string): DirectGenerator; + + /* + Retrieves the internal generator object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + export class DirectSettingsMixin { + + + /* + Sets the accuracy. How similar the suggested terms at least + need to be compared to the original suggest text. + */ + accuracy(a: number): DirectSettingsMixin; + + /* + Sets the maximum edit distance candidate suggestions can have + in order to be considered as a suggestion. + */ + maxEdits(max: number): DirectSettingsMixin; + + /* + The factor that is used to multiply with the size in order + to inspect more candidate suggestions. + */ + maxInspections(max: number): DirectSettingsMixin; + + /* + Sets a maximum threshold in number of documents a suggest text + token can exist in order to be corrected. + */ + maxTermFreq(max: number): DirectSettingsMixin; + + /* + Sets a minimal threshold of the number of documents a suggested + term should appear in. + */ + minDocFreq(min: number): DirectSettingsMixin; + + /* + Sets the minimum length a suggest text term must have in order + to be corrected. + */ + minWordLen(len: number): DirectSettingsMixin; + + /* + Sets the number of minimal prefix characters that must match in + order be a candidate suggestion. + */ + prefixLen(len: number): DirectSettingsMixin; + + /* + Sets the sort mode. Valid values are: + + + score - Sort by score first, then document frequency, and then the term itself + frequency - Sort by document frequency first, then simlarity score and then the term itself + + */ + sort(s: string): DirectSettingsMixin; + + /* + Sets what string distance implementation to use for comparing + how similar suggested terms are. Valid values are: + + + internal - based on damerau_levenshtein but but highly optimized for comparing string distance for terms inside the index + damerau_levenshtein - String distance algorithm based on Damerau-Levenshtein algorithm + levenstein - String distance algorithm based on Levenstein edit distance algorithm + jarowinkler - String distance algorithm based on Jaro-Winkler algorithm + ngram - String distance algorithm based on character n-grams + + */ + stringDistance(s: string): DirectSettingsMixin; + + /* + Sets the suggest mode. Valid values are: + + + missing - Only suggest terms in the suggest text that aren't in the index + popular - Only suggest suggestions that occur in more docs then the original suggest text term + always - Suggest any matching suggestions based on terms in the suggest text + + */ + suggestMode(m: string): DirectSettingsMixin; + + } + + + /* + A query that generates the union of documents produced by its subqueries, and + that scores each document with the maximum score for that document as produced + by any subquery, plus a tie breaking increment for any additional matching + subqueries. + */ + export class DisMaxQuery implements Query { + + /* + A query that generates the union of documents produced by its subqueries such + as termQuerys, phraseQuerys, boolQuerys, etc. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): DisMaxQuery; + + /* + Updates the queries. If passed a single Query, it is added to the + list of existing queries. If passed an array of Queries, it + replaces all existing values. + */ + queries(qs: Query | Query[]): DisMaxQuery; + + /* + The tie breaker value. + + The tie breaker capability allows results that include the same term in multiple + fields to be judged better than results that include this term in only the best of those + multiple fields, without confusing this with the better case of two different terms in + the multiple fields. + + Default: 0.0. + */ + tieBreaker(tieBreaker: number): DisMaxQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + An existsFilter matches documents where the specified field is present + and the field contains a legitimate value. + */ + export class ExistsFilter implements Filter { + + /* + Filters documents where a specified field exists and contains a value. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): ExistsFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): ExistsFilter; + + /* + Sets the field to check for missing values. + */ + field(name: string): ExistsFilter; + + /* + Sets the filter name. + */ + name(name: string): ExistsFilter; + + /* + Returns the filter object. + */ + toJSON(): ExistsFilter; + + } + + + /* + A multi-value metrics aggregation that computes stats over numeric values + extracted from the aggregated documents. These values can be extracted either + from specific numeric fields in the documents, or be generated by a provided + script. + + The extended_stats aggregations is an extended version of the + StatsAggregation, where additional metrics are added such as + sum_of_squares, variance and std_deviation. + */ + export class ExtendedStatsAggregation implements Aggregation { + + /* + Aggregation that computes extra stats over numeric values extracted from + the aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): ExtendedStatsAggregation; + + /* + The script language being used. + */ + lang(language: string): ExtendedStatsAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): ExtendedStatsAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): ExtendedStatsAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): ExtendedStatsAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + export class FacetMixin { + + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): FacetMixin; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): FacetMixin; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): FacetMixin; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): FacetMixin; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): FacetMixin; + + /* + Computes values across the the specified scope + */ + scope(scope: string): FacetMixin; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Wrapper to allow SpanQuery objects participate in composite single-field + SpanQueries by 'lying' about their search field. That is, the masked + SpanQuery will function as normal, but when asked for the field it + queries against, it will return the value specified as the masked field vs. + the real field used in the wrapped span query. + */ + export class FieldMaskingSpanQuery implements Query { + + /* + Wraps a SpanQuery and hides the real field being searched across. + */ + constructor(spanQry: Query, field: number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): FieldMaskingSpanQuery; + + /* + Sets the value of the "masked" field. + */ + field(f: string): FieldMaskingSpanQuery; + + /* + Sets the span query to wrap. + */ + query(spanQuery: Query): FieldMaskingSpanQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Defines a single bucket of all the documents in the current document set + context that match a specified filter. Often this will be used to narrow down + the current aggregation context to a specific set of documents. + */ + export class FilterAggregation implements Aggregation { + + /* + Defines a single bucket of all the documents that match a given filter. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): FilterAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): FilterAggregation; + + /* + Sets the filter to be used for this aggregation. + */ + filter(oFilter: Filter): FilterAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Filter queries allow you to restrict the results returned by a query. There are + several different types of filters that can be applied + (see filter module). A filterQuery + takes a Query and a Filter object as arguments and constructs + a new Query that is then used for the search. + */ + export class FilteredQuery implements Query { + + /* + A query that applies a filter to the results of another query. + */ + constructor(someQuery: Object, someFilter: Object); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): FilteredQuery; + + /* + Enables caching of the filter. + */ + cache(trueFalse: boolean): FilteredQuery; + + /* + Set the cache key. + */ + cacheKey(k: string): FilteredQuery; + + /* + Adds the filter to apply a constant score to. + */ + filter(oFilter: Object): FilteredQuery; + + /* + Adds the query to apply a constant score to. + */ + query(oQuery: Object): FilteredQuery; + + /* + Sets the filter strategy. + + The strategy defines how the filter is applied during document collection. + Valid values are: + + + query_first - advance query scorer first then filter + random_access_random - random access filter + leap_frog - query scorer and filter "leap-frog", query goes first + leap_frog_filter_first - same as leap_frog, but filter goes first + random_access_N - replace N with integer, same as random access + except you can specify a custom threshold + + + This is an advanced setting, use with care. + */ + strategy(strategy: string): FilteredQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The FilterFacet allows you to specify any valid Filter and + have the number of matching hits returned as the value. + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class FilterFacet implements Facet { + + /* + A facet that return a count of the hits matching the given filter. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): FilterFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): FilterFacet; + + /* + Sets the filter to be used for this facet. + */ + filter(oFilter: Object): FilterFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): FilterFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): FilterFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): FilterFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): FilterFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + export class FilterMixin { + + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): FilterMixin; + + /* + Sets the cache key. + */ + cacheKey(key: string): FilterMixin; + + /* + Sets the filter name. + */ + name(name: string): FilterMixin; + + /* + Returns the filter object. + */ + toJSON(): FilterMixin; + + } + + + /* + The function_score allows you to modify the score of documents that are + retrieved by a query. This can be useful if, for example, a score function is + computationally expensive and it is sufficient to compute the score on a + filtered set of documents. + */ + export class FunctionScoreQuery implements Query { + + /* + A query that allows you to modify the score of matching documents. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): FunctionScoreQuery; + + /* + Set the setermines how the new calculated score is combined with the + score from the original query. Valid values are: multiply, replace, sum, + avg, max, and min. + */ + boostMode(mode: string): FunctionScoreQuery; + + /* + Set the source filter. + */ + filter(oFilter: Filter): FunctionScoreQuery; + + /* + Add a single score function to the list of existing functions. + */ + //function (func: ScoreFunction): FunctionScoreQuery; + + /* + Sets the score functions. Replaces any existing score functions. + */ + functions(funcs: ScoreFunction[]): FunctionScoreQuery; + + /* + Set the source query. + */ + query(oQuery: Query): FunctionScoreQuery; + + /* + Set the scoring mode which specifies how the computed scores are combined. + Valid values are: avg, max, min, sum, multiply, and first. + */ + scoreMode(mode: string): FunctionScoreQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The fuzzy_like_this_field query is the same as the fuzzy_like_this + query, except that it runs against a single field. It provides nicer query + DSL over the generic fuzzy_like_this query, and support typed fields + query (automatically wraps typed fields with type filter to match only on + the specific type). + + Fuzzifies ALL terms provided as strings and then picks the best n + differentiating terms. In effect this mixes the behaviour of FuzzyQuery and + MoreLikeThis but with special consideration of fuzzy scoring factors. This + generally produces good results for queries where users may provide details + in a number of fields and have no knowledge of boolean query syntax and + also want a degree of fuzzy matching and a fast query. + + For each source term the fuzzy variants are held in a BooleanQuery with + no coord factor (because we are not looking for matches on multiple variants + in any one doc). Additionally, a specialized TermQuery is used for variants + and does not use that variant term’s IDF because this would favour rarer + terms eg misspellings. Instead, all variants use the same IDF + ranking (the one for the source query term) and this is factored into the + variant’s boost. If the source query term does not exist in the index the + average IDF of the variants is used. + */ + export class FuzzyLikeThisFieldQuery implements Query { + + /* + Constructs a query where each documents returned are “like” provided text + */ + constructor(field: string, likeText: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + The analyzer that will be used to analyze the text. Defaults to the + analyzer associated with the field. + */ + analyzer(analyzerName: string): FuzzyLikeThisFieldQuery; + + /* + Sets the boost value of the Query. + */ + boost(boost: number): FuzzyLikeThisFieldQuery; + + /* + Should the Query fail when an unsupported field + is specified. Defaults to true. + */ + failOnUnsupportedField(trueFalse: boolean): FuzzyLikeThisFieldQuery; + + /* + The field to run the query against. + */ + field(f: string): FuzzyLikeThisFieldQuery; + + /* + Should term frequency be ignored. Defaults to false. + */ + ignoreTf(trueFalse: boolean): FuzzyLikeThisFieldQuery; + + /* + The text to find documents like + */ + likeText(s: string): FuzzyLikeThisFieldQuery; + + /* + The maximum number of query terms that will be included in any + generated query. Defaults to 25. + */ + maxQueryTerms(max: number): FuzzyLikeThisFieldQuery; + + /* + The minimum similarity of the term variants. Defaults to 0.5. + */ + minSimilarity(min: number): FuzzyLikeThisFieldQuery; + + /* + Length of required common prefix on variant terms. Defaults to 0.. + */ + prefixLength(len: number): FuzzyLikeThisFieldQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Fuzzy like this query find documents that are “like” provided text by + running it against one or more fields. + + Fuzzifies ALL terms provided as strings and then picks the best n + differentiating terms. In effect this mixes the behaviour of FuzzyQuery and + MoreLikeThis but with special consideration of fuzzy scoring factors. This + generally produces good results for queries where users may provide details + in a number of fields and have no knowledge of boolean query syntax and + also want a degree of fuzzy matching and a fast query. + + For each source term the fuzzy variants are held in a BooleanQuery with + no coord factor (because we are not looking for matches on multiple variants + in any one doc). Additionally, a specialized TermQuery is used for variants + and does not use that variant term’s IDF because this would favour rarer + terms eg misspellings. Instead, all variants use the same IDF + ranking (the one for the source query term) and this is factored into the + variant’s boost. If the source query term does not exist in the index the + average IDF of the variants is used. + */ + export class FuzzyLikeThisQuery implements Query { + + /* + Constructs a query where each documents returned are “like” provided text + */ + constructor(likeText: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + The analyzer that will be used to analyze the text. Defaults to the + analyzer associated with the field. + */ + analyzer(analyzerName: string): FuzzyLikeThisQuery; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): FuzzyLikeThisQuery; + + /* + Should the Query fail when an unsupported field + is specified. Defaults to true. + */ + failOnUnsupportedField(trueFalse: boolean): FuzzyLikeThisQuery; + + /* + The fields to run the query against. If you call with a single field, + it is added to the existing list of fields. If called with an array + of field names, it replaces any existing values with the new array. + */ + fields(f: string | string[]): FuzzyLikeThisQuery; + + /* + Should term frequency be ignored. Defaults to false. + */ + ignoreTf(trueFalse: boolean): FuzzyLikeThisQuery; + + /* + The text to find documents like + */ + likeText(s: string): FuzzyLikeThisQuery; + + /* + The maximum number of query terms that will be included in any + generated query. Defaults to 25. + */ + maxQueryTerms(max: number): FuzzyLikeThisQuery; + + /* + The minimum similarity of the term variants. Defaults to 0.5. + */ + minSimilarity(min: number): FuzzyLikeThisQuery; + + /* + Length of required common prefix on variant terms. Defaults to 0.. + */ + prefixLength(len: number): FuzzyLikeThisQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A fuzzy search query based on the Damerau-Levenshtein (optimal string + alignment) algorithm, though you can explicitly choose classic Levenshtein + by passing false to the transpositions parameter./p> + + fuzzy query on a numeric field will result in a range query “around” + the value using the min_similarity value. As an example, if you perform a + fuzzy query against a field value of "12" with a min similarity setting + of "2", the query will search for values between "10" and "14". + */ + export class FuzzyQuery implements Query { + + /* + Constructs a query where each documents returned are “like” provided text + */ + constructor(field: string, value: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value of the Query. + */ + boost(boost: number): FuzzyQuery; + + /* + The field to run the query against. + */ + field(f: string): FuzzyQuery; + + /* + The maximum number of query terms that will be included in any + generated query. Defaults to 50. + */ + maxExpansions(max: number): FuzzyQuery; + + /* + The minimum similarity of the term variants. Defaults to 0.5. + */ + minSimilarity(min: number): FuzzyQuery; + + /* + Length of required common prefix on variant terms. Defaults to 0. + */ + prefixLength(len: number): FuzzyQuery; + + /* + Sets rewrite method. Valid values are: + + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): FuzzyQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Set to false to use classic Levenshtein edit distance. + */ + transpositions(trueFalse: boolean): FuzzyQuery; + + /* + The query text to fuzzify. + */ + value(s: string): FuzzyQuery; + + } + + + /* + A filter that restricts matched results/docs to a geographic bounding box described by + the specified lon and lat coordinates. The format conforms with the GeoJSON specification. + */ + export class GeoBboxFilter implements Filter { + + /* + Filter results to those which are contained within the defined bounding box. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the bottom-right coordinate of the bounding box + */ + bottomRight(p: GeoPoint): GeoBboxFilter; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): GeoBboxFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): GeoBboxFilter; + + /* + Sets the fields to filter against. + */ + field(f: string): GeoBboxFilter; + + /* + Sets the filter name. + */ + name(name: string): GeoBboxFilter; + + /* + If the lat/long points should be normalized to lie within their + respective normalized ranges. + + Normalized ranges are: + lon = -180 (exclusive) to 180 (inclusive) range + lat = -90 to 90 (both inclusive) range + */ + normalize(trueFalse: string): GeoBboxFilter; + + /* + Returns the filter object. + */ + toJSON(): GeoBboxFilter; + + /* + Sets the top-left coordinate of the bounding box + */ + topLeft(p: GeoPoint): GeoBboxFilter; + + /* + Sets the type of the bounding box execution. Valid values are + "memory" and "indexed". Default is memory. + */ + type(type: string): GeoBboxFilter; + + } + + + /* + A multi-bucket aggregation that works on geo_point fields and conceptually + works very similar to the range aggregation. The user can define a point of + origin and a set of distance range buckets. The aggregation evaluate the + distance of each document value from the origin point and determines the + buckets it belongs to based on the ranges (a document belongs to a bucket + if the distance between the document and the origin falls within the distance + range of the bucket). + */ + export class GeoDistanceAggregation implements Aggregation { + + /* + Aggregation that works on geo_point fields and conceptually works very + similar to the range aggregation. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): GeoDistanceAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): GeoDistanceAggregation; + + /* + Sets the point of origin from where distances will be measured. Same as + origin. + */ + center(p: GeoPoint): GeoDistanceAggregation; + + /* + How to compute the distance. Valid values are: + plane, arc, sloppy_arc, and factor. + */ + distanceType(type: string): GeoDistanceAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): GeoDistanceAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): GeoDistanceAggregation; + + /* + Sets the point of origin from where distances will be measured. + */ + origin(p: GeoPoint): GeoDistanceAggregation; + + /* + Sets the point of origin from where distances will be measured. Same as + origin. + */ + point(p: GeoPoint): GeoDistanceAggregation; + + /* + Adds a range to the list of exsiting range expressions. + */ + range(from: string, to: string, key: string): GeoDistanceAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the distance unit. Valid values are: + in, yd, ft, km, NM, mm, cm, mi, and m. + */ + unit(unit: Number): GeoDistanceAggregation; + + } + + + /* + The geoDistanceFacet facet provides information over a range of distances from a + provided point. This includes the number of hits that fall within each range, + along with aggregate information (like total). + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class GeoDistanceFacet implements Facet { + + /* + A facet which provides information over a range of distances from a provided point. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Adds a new bounded range. + */ + addRange(from: Number, to: Number): GeoDistanceFacet; + + /* + Adds a new unbounded lower limit. + */ + addUnboundedFrom(from: Number): GeoDistanceFacet; + + /* + Adds a new unbounded upper limit. + */ + addUnboundedTo(to: Number): GeoDistanceFacet; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): GeoDistanceFacet; + + /* + How to compute the distance. Can either be arc (better precision) + or plane (faster). Defaults to arc. + */ + distanceType(type: string): GeoDistanceFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): GeoDistanceFacet; + + /* + Sets the document field containing the geo-coordinate to be used + to calculate the distance. Defaults to "location". + */ + field(fieldName: string): GeoDistanceFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): GeoDistanceFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): GeoDistanceFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): GeoDistanceFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): GeoDistanceFacet; + + /* + If the lat/long points should be normalized to lie within their + respective normalized ranges. + + Normalized ranges are: + lon = -180 (exclusive) to 180 (inclusive) range + lat = -90 to 90 (both inclusive) range + */ + normalize(trueFalse: string): GeoDistanceFacet; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): GeoDistanceFacet; + + /* + Sets the point of origin from where distances will be measured. + */ + point(p: GeoPoint): GeoDistanceFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): GeoDistanceFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the distance unit. Valid values are "mi" for miles or "km" + for kilometers. Defaults to "km". + */ + unit(unit: Number): GeoDistanceFacet; + + /* + Allows you to specify a different value field to aggrerate over. + */ + valueField(fieldName: string): GeoDistanceFacet; + + /* + Allows you modify the value field using a script. The modified value + is then used to compute the statistical data. + */ + valueScript(scriptCode: string): GeoDistanceFacet; + + } + + + /* + A filter that restricts matched results/docs to a given distance from the + point of origin. The format conforms with the GeoJSON specification. + */ + export class GeoDistanceFilter implements Filter { + + /* + Filter results to those which fall within the given distance of the point of origin. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): GeoDistanceFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): GeoDistanceFilter; + + /* + Sets the numeric distance to be used. The distance can be a + numeric value, and then the unit (either mi or km can be set) + controlling the unit. Or a single string with the unit as well. + */ + distance(numericDistance: Number): GeoDistanceFilter; + + /* + How to compute the distance. Can either be arc (better precision) + or plane (faster). Defaults to arc. + */ + distanceType(type: string): GeoDistanceFilter; + + /* + Sets the fields to filter against. + */ + field(f: string): GeoDistanceFilter; + + /* + Sets the filter name. + */ + name(name: string): GeoDistanceFilter; + + /* + If the lat/long points should be normalized to lie within their + respective normalized ranges. + + Normalized ranges are: + lon = -180 (exclusive) to 180 (inclusive) range + lat = -90 to 90 (both inclusive) range + */ + normalize(trueFalse: string): GeoDistanceFilter; + + /* + Will an optimization of using first a bounding box check will be + used. Defaults to memory which will do in memory checks. Can also + have values of indexed to use indexed value check, or none which + disables bounding box optimization. + */ + optimizeBbox(t: string): GeoDistanceFilter; + + /* + Sets the point of origin in which distance will be measured from + */ + point(p: GeoPoint): GeoDistanceFilter; + + /* + Returns the filter object. + */ + toJSON(): GeoDistanceFilter; + + /* + Sets the distance unit. Valid values are "mi" for miles or "km" + for kilometers. Defaults to "km". + */ + unit(unit: Number): GeoDistanceFilter; + + } + + + /* + A filter that restricts matched results/docs to a given distance range from the + point of origin. The format conforms with the GeoJSON specification. + */ + export class GeoDistanceRangeFilter implements Filter { + + /* + Filter results to those which fall within the given distance range of the point of origin. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): GeoDistanceRangeFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): GeoDistanceRangeFilter; + + /* + How to compute the distance. Can either be arc (better precision) + or plane (faster). Defaults to arc. + */ + distanceType(type: string): GeoDistanceRangeFilter; + + /* + Sets the fields to filter against. + */ + field(f: string): GeoDistanceRangeFilter; + + /* + Sets the start point of the distance range + */ + from(numericDistance: Number): GeoDistanceRangeFilter; + + /* + Greater than value. Same as setting from to the value, and + include_lower to false, + */ + gt(val: Number): GeoDistanceRangeFilter; + + /* + Greater than or equal to value. Same as setting from to the value, + and include_lower to true. + */ + gte(val: Number): GeoDistanceRangeFilter; + + /* + Should the first from (if set) be inclusive or not. + Defaults to true + */ + includeLower(trueFalse: boolean): GeoDistanceRangeFilter; + + /* + Should the last to (if set) be inclusive or not. Defaults to true. + */ + includeUpper(trueFalse: boolean): GeoDistanceRangeFilter; + + /* + Less than value. Same as setting to to the value, and include_upper + to false. + */ + lt(val: Number): GeoDistanceRangeFilter; + + /* + Less than or equal to value. Same as setting to to the value, + and include_upper to true. + */ + lte(val: Number): GeoDistanceRangeFilter; + + /* + Sets the filter name. + */ + name(name: string): GeoDistanceRangeFilter; + + /* + If the lat/long points should be normalized to lie within their + respective normalized ranges. + + Normalized ranges are: + lon = -180 (exclusive) to 180 (inclusive) range + lat = -90 to 90 (both inclusive) range + */ + normalize(trueFalse: string): GeoDistanceRangeFilter; + + /* + Will an optimization of using first a bounding box check will be + used. Defaults to memory which will do in memory checks. Can also + have values of indexed to use indexed value check, or none which + disables bounding box optimization. + */ + optimizeBbox(t: string): GeoDistanceRangeFilter; + + /* + Sets the point of origin in which distance will be measured from + */ + point(p: GeoPoint): GeoDistanceRangeFilter; + + /* + Sets the end point of the distance range + */ + to(numericDistance: Number): GeoDistanceRangeFilter; + + /* + Returns the filter object. + */ + toJSON(): GeoDistanceRangeFilter; + + /* + Sets the distance unit. Valid values are "mi" for miles or "km" + for kilometers. Defaults to "km". + */ + unit(unit: Number): GeoDistanceRangeFilter; + + } + + + /* + A multi-bucket aggregation that works on geo_point fields and groups points + into buckets that represent cells in a grid. The resulting grid can be sparse + and only contains cells that have matching data. Each cell is labeled using a + geohash which is of user-definable precision. + */ + export class GeoHashGridAggregation implements Aggregation { + + /* + Aggregation that works on geo_point fields and groups points into buckets + that represent cells in a grid. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): GeoHashGridAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): GeoHashGridAggregation; + + /* + Sets the geo field to perform calculations from. + */ + field(field: string): GeoHashGridAggregation; + + /* + Sets the Geo Hash precision. The precision value can be between 1 and 12 + where 12 is the highest precision. + */ + precision(p: number): GeoHashGridAggregation; + + /* + Determines how many geohash_grid the coordinating node will request from + each shard. + */ + shardSize(shardSize: number): GeoHashGridAggregation; + + /* + Sets the number of aggregation entries that will be returned. + */ + size(size: number): GeoHashGridAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A GeoPoint object that can be used in queries and filters that + take a GeoPoint. GeoPoint supports various input formats. + + See http://www.elasticsearch.org/guide/reference/mapping/geo-point-type.html + */ + export class GeoPoint implements Geo { + + /* + Defines a point + */ + constructor(p: any[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the GeoPoint from an array point. The array must contain only + 2 values. The first value is the lat and the 2nd value is the lon. + + Example: + [41.12, -71.34] + */ + array(a: any[]): GeoPoint; + + /* + Sets the GeoPoint as a GeoHash. The hash is a string of + alpha-numeric characters with a precision length that defaults to 12. + + Example: + "drm3btev3e86" + */ + geohash(hash: string, precision: number): GeoPoint; + + /* + Sets the GeoPoint as properties on an object. The object must have + a 'lat' and 'lon' or a 'geohash' property. + + Example: + {lat: 41.12, lon: -71.34} or {geohash: "drm3btev3e86"} + */ + properties(obj: Object): GeoPoint; + + /* + Sets the GeoPoint as a string. The format is "lat,lon". + + Example: + + "41.12,-71.34" + */ + string(s: string): GeoPoint; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A filter for locating documents that fall within a polygon of points. Simply provide a lon/lat + for each document as a Geo Point type. The format conforms with the GeoJSON specification. + */ + export class GeoPolygonFilter { + + /* + Filter results to those which are contained within the polygon of points. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): GeoPolygonFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): GeoPolygonFilter; + + /* + Sets the fields to filter against. + */ + field(f: string): GeoPolygonFilter; + + /* + Sets the filter name. + */ + name(name: string): GeoPolygonFilter; + + /* + If the lat/long points should be normalized to lie within their + respective normalized ranges. + + Normalized ranges are: + lon = -180 (exclusive) to 180 (inclusive) range + lat = -90 to 90 (both inclusive) range + */ + normalize(trueFalse: string): GeoPolygonFilter; + + /* + Sets a series of points that represent a polygon. If passed a + single GeoPoint object, it is added to the current + list of points. If passed an array of GeoPoint + objects it replaces all current values. + */ + points(pointsArray: any[]): GeoPolygonFilter; + + /* + Returns the filter object. + */ + toJSON(): GeoPolygonFilter; + + } + + + /* + Efficient filtering of documents containing shapes indexed using the + geo_shape type. + + Much like the geo_shape type, the geo_shape filter uses a grid square + representation of the filter shape to find those documents which have shapes + that relate to the filter shape in a specified way. In order to do this, the + field being queried must be of geo_shape type. The filter will use the same + PrefixTree configuration as defined for the field. + */ + export class GeoShapeFilter implements Filter { + + /* + A Filter to find documents with a geo_shapes matching a specific shape. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): GeoShapeFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): GeoShapeFilter; + + /* + Sets the field to filter against. + */ + field(f: string): GeoShapeFilter; + + /* + Sets the indexed shape. Use this if you already have shape definitions + already indexed. + */ + indexedShape(indexedShape: string): GeoShapeFilter; + + /* + Sets the filter name. + */ + name(name: string): GeoShapeFilter; + + /* + Sets the shape relation type. A relationship between a Query Shape + and indexed Shapes that will be used to determine if a Document + should be matched or not. Valid values are: intersects, disjoint, + and within. + */ + relation(indexedShape: string): GeoShapeFilter; + + /* + Sets the shape + */ + shape(shape: string): GeoShapeFilter; + + /* + Sets the spatial strategy. + Valid values are: + + + recursive - default, recursively traverse nodes in + the spatial prefix tree. This strategy has support for + searching non-point shapes. + term - uses a large TermsFilter on each node + in the spatial prefix tree. It only supports the search of + indexed Point shapes. + + + This is an advanced setting, use with care. + */ + strategy(strategy: string): GeoShapeFilter; + + /* + Returns the filter object. + */ + toJSON(): GeoShapeFilter; + + } + + + /* + Efficient querying of documents containing shapes indexed using the + geo_shape type. + + Much like the geo_shape type, the geo_shape query uses a grid square + representation of the query shape to find those documents which have shapes + that relate to the query shape in a specified way. In order to do this, the + field being queried must be of geo_shape type. The query will use the same + PrefixTree configuration as defined for the field. + */ + export class GeoShapeQuery implements Query { + + /* + A Query to find documents with a geo_shapes matching a specific shape. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: Number): GeoShapeQuery; + + /* + Sets the field to query against. + */ + field(f: string): GeoShapeQuery; + + /* + Sets the indexed shape. Use this if you already have shape definitions + already indexed. + */ + indexedShape(indexedShape: string): GeoShapeQuery; + + /* + Sets the shape relation type. A relationship between a Query Shape + and indexed Shapes that will be used to determine if a Document + should be matched or not. Valid values are: intersects, disjoint, + and within. + */ + relation(indexedShape: string): GeoShapeQuery; + + /* + Sets the shape + */ + shape(shape: string): GeoShapeQuery; + + /* + Sets the spatial strategy. + Valid values are: + + + recursive - default, recursively traverse nodes in + the spatial prefix tree. This strategy has support for + searching non-point shapes. + term - uses a large TermsFilter on each node + in the spatial prefix tree. It only supports the search of + indexed Point shapes. + + + This is an advanced setting, use with care. + */ + strategy(strategy: string): GeoShapeQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Defines a single bucket of all the documents within the search execution + context. This context is defined by the indices and the document types you’re + searching on, but is not influenced by the search query itself. + */ + export class GlobalAggregation implements Aggregation { + + /* + Defines a single bucket of all the documents within the search context. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): GlobalAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): GlobalAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The has_child filter results in parent documents that have child docs + matching the query being returned. + */ + export class HasChildFilter implements Filter { + + /* + Returns results that have child documents matching the filter. + */ + constructor(qry: Object, type: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): HasChildFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): HasChildFilter; + + /* + Sets the filter + */ + filter(f: Query): HasChildFilter; + + /* + Sets the filter name. + */ + name(name: string): HasChildFilter; + + /* + Sets the query + */ + query(q: Query): HasChildFilter; + + /* + Sets the scope of the filter. A scope allows to run facets on the + same scope name that will work against the child documents. + */ + scope(s: string): HasChildFilter; + + /* + Sets the cutoff value to short circuit processing. + */ + shortCircuitCutoff(cutoff: number): HasChildFilter; + + /* + Returns the filter object. + */ + toJSON(): HasChildFilter; + + /* + Sets the child document type to search against + */ + type(t: string): HasChildFilter; + + } + + + /* + The has_child query works the same as the has_child filter, + by automatically wrapping the filter with a constant_score. Results in + parent documents that have child docs matching the query being returned. + */ + export class HasChildQuery implements Query { + + /* + Returns results that have child documents matching the query. + */ + constructor(qry: Object, type: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): HasChildQuery; + + /* + Sets the query + */ + query(q: Object): HasChildQuery; + + /* + Sets the scope of the query. A scope allows to run facets on the + same scope name that will work against the child documents. + */ + scope(s: string): HasChildQuery; + + /* + Sets the scoring method. Valid values are: + + none - the default, no scoring + max - the highest score of all matched child documents is used + sum - the sum the all the matched child documents is used + avg - the average of all matched child documents is used + */ + scoreMode(s: string): HasChildQuery; + + /* + Sets the scoring method. Valid values are: + + none - the default, no scoring + max - the highest score of all matched child documents is used + sum - the sum the all the matched child documents is used + avg - the average of all matched child documents is used + */ + scoreType(s: string): HasChildQuery; + + /* + Sets the cutoff value to short circuit processing. + */ + shortCircuitCutoff(cutoff: number): HasChildQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the child document type to search against + */ + type(t: string): HasChildQuery; + + } + + + /* + The has_parent results in child documents that have parent docs matching + the query being returned. + */ + export class HasParentFilter implements Filter { + + /* + Returns results that have parent documents matching the filter. + */ + constructor(qry: Object, parentType: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): HasParentFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): HasParentFilter; + + /* + Sets the filter + */ + filter(f: Object): HasParentFilter; + + /* + Sets the filter name. + */ + name(name: string): HasParentFilter; + + /* + Sets the child document type to search against + */ + parentType(t: string): HasParentFilter; + + /* + Sets the query + */ + query(q: Object): HasParentFilter; + + /* + Sets the scope of the filter. A scope allows to run facets on the + same scope name that will work against the parent documents. + */ + scope(s: string): HasParentFilter; + + /* + Returns the filter object. + */ + toJSON(): HasParentFilter; + + } + + + /* + The has_parent query works the same as the has_parent filter, by + automatically wrapping the filter with a constant_score. Results in + child documents that have parent docs matching the query being returned. + */ + export class HasParentQuery implements Query { + + /* + Returns results that have parent documents matching the query. + */ + constructor(qry: Object, parentType: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): HasParentQuery; + + /* + Sets the child document type to search against + */ + parentType(t: string): HasParentQuery; + + /* + Sets the query + */ + query(q: Object): HasParentQuery; + + /* + Sets the scope of the query. A scope allows to run facets on the + same scope name that will work against the parent documents. + */ + scope(s: string): HasParentQuery; + + /* + Sets the scoring method. Valid values are: + + none - the default, no scoring + score - the score of the parent is used in all child documents. + */ + scoreMode(s: string): HasParentQuery; + + /* + Sets the scoring method. Valid values are: + + none - the default, no scoring + score - the score of the parent is used in all child documents. + */ + scoreType(s: string): HasParentQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Allows to highlight search results on one or more fields. In order to + perform highlighting, the actual content of the field is required. If the + field in question is stored (has store set to yes in the mapping), it will + be used, otherwise, the actual _source will be loaded and the relevant + field will be extracted from it. + + If no term_vector information is provided (by setting it to + with_positions_offsets in the mapping), then the plain highlighter will be + used. If it is provided, then the fast vector highlighter will be used. + When term vectors are available, highlighting will be performed faster at + the cost of bigger index size. + + See http://www.elasticsearch.org/guide/reference/api/search/highlighting.html + */ + export class Highlight { + + /* + Allows to highlight search results on one or more fields. + */ + constructor(fields: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Set's the boundary characters. When highlighting a field that is + mapped with term vectors, boundary_chars can be configured to + define what constitutes a boundary for highlighting. It’s a single + string with each boundary character defined in it. You can apply + the option to a specific field by passing the field name in to + the oField parameter. It defaults to ".,!? \t\n". + */ + boundaryChars(charStr: string, oField: string): Highlight; + + /* + Sets the max number of characters to scan while looking for the + start of a boundary character. You can apply the option to a + specific field by passing the field name in to the + oField parameter. Default: 20 + */ + boundaryMaxScan(cnt: number, oField: string): Highlight; + + /* + Sets highlight encoder. Valid values are: + + default - the default, no encoding + html - to encode html characters if you use html tags + */ + encoder(e: string): Highlight; + + /* + Allows you to set the fields that will be highlighted. You can + specify a single field or an array of fields. All fields are + added to the current list of fields. + */ + fields(vals: string | string[]): Highlight; + + /* + Sets the fragmenter type. You can apply the option + to a specific field by passing the field name in to the + oField parameter. Valid values for order are: + + simple - breaks text up into same-size fragments with no concerns + over spotting sentence boundaries. + span - breaks text up into same-size fragments but does not split + up Spans. + */ + fragmenter(f: string, oField: string): Highlight; + + /* + Sets the size of each highlight fragment in characters. + You can apply the option to a specific field by passing the field + name in to the oField parameter. Default: 100 + */ + fragmentSize(size: number, oField: string): Highlight; + + /* + Enables highlights in documents matched by a filter. + You can apply the option to a specific field by passing the field + name in to the oField parameter. Defaults to false. + */ + highlightFilter(trueFalse: boolean, oField: string): Highlight; + + /* + Sets the number of highlight fragments. + You can apply the option to a specific field by passing the field + name in to the oField parameter. Default: 5 + */ + numberOfFragments(cnt: number, oField: string): Highlight; + + /* + Sets arbitrary options that can be passed to the highlighter + implementation in use. + */ + options(opts: string, oField: Object): Highlight; + + /* + Sets the order of highlight fragments. You can apply the option + to a specific field by passing the field name in to the + oField parameter. Valid values for order are: + + score - the score calculated by Lucene's highlighting framework. + */ + order(o: string, oField: string): Highlight; + + /* + Sets the post tags for highlighted fragments. You can apply the + tags to a specific field by passing the field name in to the + oField parameter. + */ + postTags(tags: string | string[], oField: string): Highlight; + + /* + Sets the pre tags for highlighted fragments. You can apply the + tags to a specific field by passing the field name in to the + oField parameter. + */ + preTags(tags: string | string[], oField: string): Highlight; + + /* + When enabled it will cause a field to be highlighted only if a + query matched that field. false means that terms are highlighted + on all requested fields regardless if the query matches + specifically on them. You can apply the option to a specific + field by passing the field name in to the oField + parameter. Defaults to false. + */ + requireFieldMatch(trueFalse: boolean, oField: string): Highlight; + + /* + Sets the schema to be used for the tags. Valid values are: + + styled - 10 pre tags with css class of hltN, where N is 1-10 + */ + tagsSchema(s: string): Highlight; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the highligher type. You can apply the option + to a specific field by passing the field name in to the + oField parameter. Valid values for order are: + + fast-vector-highlighter - the fast vector based highligher + highlighter - the slower plain highligher + */ + type(t: string, oField: string): Highlight; + + } + + + /* + A multi-bucket values source based aggregation that can be applied on + numeric values extracted from the documents. It dynamically builds fixed + size (a.k.a. interval) buckets over the values. + */ + export class HistogramAggregation implements Aggregation { + + /* + Aggregation that can be applied on numeric values extracted from the + documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): HistogramAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): HistogramAggregation; + + /* + Set's the range/bounds for the histogram aggregation. Useful when you + want to include buckets that might be outside the bounds of indexed + documents. + */ + extendedBounds(min: number, max: number): HistogramAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): HistogramAggregation; + + /* + Sets the format expression for the terms. Use for number or date + formatting + */ + format(f: string): HistogramAggregation; + + /* + Sets the histogram interval. Buckets are generated based on this interval + value. + */ + interval(i: number): HistogramAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): HistogramAggregation; + + /* + The script language being used. + */ + lang(language: string): HistogramAggregation; + + /* + Only return terms that match more than a configured number of hits. + */ + minDocCount(num: number): HistogramAggregation; + + /* + Sets order for the aggregated values. + */ + order(order: string, direction: string): HistogramAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): HistogramAggregation; + + /* + Allows you generate or modify the terms using a script. + */ + script(scriptCode: string): HistogramAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): HistogramAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The histogram facet works with numeric data by building a histogram across intervals + of the field values. Each value is rounded into an interval (or placed in a + bucket), and statistics are provided per interval/bucket (count and total). + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class HistogramFacet implements Facet { + + /* + A facet which returns the N most frequent terms within a collection + or set of collections. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): HistogramFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): HistogramFacet; + + /* + Sets the field to be used to construct the this facet. + */ + field(fieldName: string): HistogramFacet; + + /* + Sets the "from", "start", or lower bounds bucket. For example if + you have a value of 1023, an interval of 100, and a from value of + 1500, it will be placed into the 1500 bucket vs. the normal bucket + of 1000. + */ + from(from: Number): HistogramFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): HistogramFacet; + + /* + Sets the bucket interval used to calculate the distribution. + */ + interval(numericInterval: Number): HistogramFacet; + + /* + Allows you to specify a different key field to be used to group intervals. + */ + keyField(fieldName: string): HistogramFacet; + + /* + Allows you modify the key field using a script. The modified value + is then used to generate the interval. + */ + keyScript(scriptCode: string): HistogramFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): HistogramFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): HistogramFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): HistogramFacet; + + /* + Sets the type of ordering that will be performed on the date + buckets. Valid values are: + + key - the default, sort by the bucket's key value + count - sort by the number of items in the bucket + total - sort by the sum/total of the items in the bucket + */ + order(o: string): HistogramFacet; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): HistogramFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): HistogramFacet; + + /* + Sets the bucket interval used to calculate the distribution based + on a time value such as "1d", "1w", etc. + */ + timeInterval(timeInterval: Number): HistogramFacet; + + /* + Sets the "to", "end", or upper bounds bucket. For example if + you have a value of 1023, an interval of 100, and a to value of + 900, it will be placed into the 900 bucket vs. the normal bucket + of 1000. + */ + to(to: Number): HistogramFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Allows you to specify a different value field to aggrerate over. + */ + valueField(fieldName: string): HistogramFacet; + + /* + Allows you modify the value field using a script. The modified value + is then used to compute the statistical data. + */ + valueScript(scriptCode: string): HistogramFacet; + + } + + + /* + Filters documents that only have the provided ids. Note, this filter + does not require the _id field to be indexed since it works using the + _uid field. + */ + export class IdsFilter implements Filter { + + /* + Matches documents with the specified id(s). + */ + constructor(ids: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): IdsFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): IdsFilter; + + /* + Sets the filter name. + */ + name(name: string): IdsFilter; + + /* + Returns the filter object. + */ + toJSON(): IdsFilter; + + /* + Sets the type as a single type or an array of types. If type is a + string, it is added to the list of existing types. If type is an + array, it is set as the types and overwrites an existing types. This + parameter is optional. + */ + type(type: string | string[]): IdsFilter; + + /* + Sets the values array or adds a new value. if val is a string, it + is added to the list of existing document ids. If val is an + array it is set as the document values and replaces any existing values. + */ + values(val: string | string[]): IdsFilter; + + } + + + /* + Filters documents that only have the provided ids. Note, this filter + does not require the _id field to be indexed since it works using the + _uid field. + */ + export class IdsQuery implements Query { + + /* + Matches documents with the specified id(s). + */ + constructor(ids: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): IdsQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the type as a single type or an array of types. If type is a + string, it is added to the list of existing types. If type is an + array, it is set as the types and overwrites an existing types. This + parameter is optional. + */ + type(type: string | string[]): IdsQuery; + + /* + Sets the values array or adds a new value. if val is a string, it + is added to the list of existing document ids. If val is an + array it is set as the document values and replaces any existing values. + */ + values(val: string | string[]): IdsQuery; + + } + + + /* + A shape which has already been indexed in another index and/or index + type. This is particularly useful for when you have a pre-defined list of + shapes which are useful to your application and you want to reference this + using a logical name (for example ‘New Zealand’) rather than having to + provide their coordinates each time. + */ + export class IndexedShape implements Geo { + + /* + Defines a shape that already exists in an index/type. + */ + constructor(type: string, id: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the document id of the indexed shape. + */ + id(id: string): IndexedShape; + + /* + Sets the index which the shape is indexed under. + Defaults to "shapes". + */ + index(idx: string): IndexedShape; + + /* + Sets the field name containing the indexed shape. + Defaults to "shape". + */ + shapeFieldName(field: string): IndexedShape; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the type which the shape is indexed under. + */ + type(t: string): IndexedShape; + + } + + + /* + The indices filter can be used when executed across multiple indices, + allowing to have a filter that executes only when executed on an index that + matches a specific list of indices, and another filter that executes when it + is executed on an index that does not match the listed indices. + */ + export class IndicesFilter implements Filter { + + /* + A configurable filter that is dependent on the index name. + */ + constructor(fltr: Object, indices: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): IndicesFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): IndicesFilter; + + /* + Sets the filter to be used when executing on one of the indicies + specified. + */ + filter(f: Object): IndicesFilter; + + /* + Sets the indicies the filter should match. When passed a string, + the index name is added to the current list of indices. When passed + an array, it overwites all current indices. + */ + indices(i: string | string[]): IndicesFilter; + + /* + Sets the filter name. + */ + name(name: string): IndicesFilter; + + /* + Sets the filter to be used on an index that does not match an index + name in the indices list. Can also be set to "none" to not match any + documents or "all" to match all documents. + */ + noMatchFilter(f: Filter | string): IndicesFilter; + + /* + Returns the filter object. + */ + toJSON(): IndicesFilter; + + } + + + /* + The indices query can be used when executed across multiple indices, + allowing to have a query that executes only when executed on an index that + matches a specific list of indices, and another query that executes when it + is executed on an index that does not match the listed indices. + */ + export class IndicesQuery implements Query { + + /* + A configurable query that is dependent on the index name. + */ + constructor(qry: Query, indices: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): IndicesQuery; + + /* + Sets the indicies the query should match. When passed a string, + the index name is added to the current list of indices. When passed + an array, it overwites all current indices. + */ + indices(i: string | string[]): IndicesQuery; + + /* + Sets the query to be used on an index that does not match an index + name in the indices list. Can also be set to "none" to not match any + documents or "all" to match all documents. + */ + noMatchQuery(q: Query | string): IndicesQuery; + + /* + Sets the query to be executed against the indices specified. + */ + query(q: Query): IndicesQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A dedicated range aggregation for IPv4 typed fields. + + Note that this aggregration includes the from value and excludes the to + value for each range. + */ + export class IPv4RangeAggregation implements Aggregation { + + /* + A dedicated range aggregation for IPv4 typed fields. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): IPv4RangeAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): IPv4RangeAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): IPv4RangeAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): IPv4RangeAggregation; + + /* + The script language being used. + */ + lang(language: string): IPv4RangeAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): IPv4RangeAggregation; + + /* + Adds a range to the list of exsiting range expressions. + */ + range(from: string, to: string, key: string): IPv4RangeAggregation; + + /* + Allows you generate or modify the terms using a script. + */ + script(scriptCode: string): IPv4RangeAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): IPv4RangeAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A limit filter limits the number of documents (per shard) to execute on. + */ + export class LimitFilter implements Filter { + + /* + Limits the number of documents to execute on. + */ + constructor(limit: number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): LimitFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): LimitFilter; + + /* + Sets the filter name. + */ + name(name: string): LimitFilter; + + /* + Returns the filter object. + */ + toJSON(): LimitFilter; + + /* + Sets the limit value. + */ + value(val: number): LimitFilter; + + } + + + /* + This filter can be used to match on all the documents + in a given set of collections and/or types. + */ + export class MatchAllFilter implements Filter { + + /* + A filter that matches on all documents + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): MatchAllFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): MatchAllFilter; + + /* + Sets the filter name. + */ + name(name: string): MatchAllFilter; + + /* + Returns the filter object. + */ + toJSON(): MatchAllFilter; + + } + + + /* + This query can be used to match all the documents + in a given set of collections and/or types. + */ + export class MatchAllQuery implements Query { + + /* + A query that returns all documents. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): MatchAllQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A MatchQuery is a type of Query that accepts + text/numerics/dates, analyzes it, generates a query based on the + MatchQuery type. + */ + export class MatchQuery implements Query { + + /* + A Query that appects text, analyzes it, generates internal query based + on the MatchQuery type. + */ + constructor(field: string, qstr: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the analyzer name used to analyze the Query object. + */ + analyzer(analyzer: string): MatchQuery; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: Number): MatchQuery; + + /* + Sets the maximum threshold/frequency to be considered a low + frequency term in a CommonTermsQuery. + Set to a value between 0 and 1. + */ + cutoffFrequency(freq: Number): MatchQuery; + + /* + Sets the fuzziness value for the Query. + */ + fuzziness(fuzz: number): MatchQuery; + + /* + Sets fuzzy rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + fuzzyRewrite(m: string): MatchQuery; + + /* + Set to false to use classic Levenshtein edit distance in the + fuzzy query. + */ + fuzzyTranspositions(trueFalse: boolean): MatchQuery; + + /* + Enables lenient parsing of the query string. + */ + lenient(trueFalse: boolean): MatchQuery; + + /* + Sets the max expansions of a fuzzy MatchQuery. + */ + maxExpansions(e: number): MatchQuery; + + /* + Sets a percent value controlling how many "should" clauses in the + resulting Query should match. + */ + minimumShouldMatch(minMatch: number): MatchQuery; + + /* + Sets default operator of the Query. Default: or. + */ + operator(op: string): MatchQuery; + + /* + Sets the prefix length for a fuzzy prefix MatchQuery. + */ + prefixLength(l: number): MatchQuery; + + /* + Sets the query string for the Query. + */ + query(qstr: string): MatchQuery; + + /* + Sets rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): MatchQuery; + + /* + Sets the default slop for phrases. If zero, then exact phrase matches + are required. Default: 0. + */ + slop(slop: number): MatchQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the type of the MatchQuery. Valid values are + boolean, phrase, and phrase_prefix. + */ + type(type: string): MatchQuery; + + /* + Sets what happens when no terms match. Valid values are + "all" or "none". + */ + zeroTermsQuery(q: string): MatchQuery; + + } + + + /* + A single-value metrics aggregation that keeps track and returns the + maximum value among the numeric values extracted from the aggregated + documents. These values can be extracted either from specific numeric fields + in the documents, or be generated by a provided script. + */ + export class MaxAggregation implements Aggregation { + + /* + Aggregation that keeps track and returns the maximum value among the + numeric values extracted from the aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): MaxAggregation; + + /* + The script language being used. + */ + lang(language: string): MaxAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): MaxAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): MaxAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): MaxAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + export class MetricsAggregationMixin implements Aggregation { + + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): MetricsAggregationMixin; + + /* + The script language being used. + */ + lang(language: string): MetricsAggregationMixin; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): MetricsAggregationMixin; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): MetricsAggregationMixin; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): MetricsAggregationMixin; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A single-value metrics aggregation that keeps track and returns the + minimum value among numeric values extracted from the aggregated documents. + These values can be extracted either from specific numeric fields in the + documents, or be generated by a provided script. + */ + export class MinAggregation implements Aggregation { + + /* + Aggregation that keeps track and returns the minimum value among numeric + values extracted from the aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): MinAggregation; + + /* + The script language being used. + */ + lang(language: string): MinAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): MinAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): MinAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): MinAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A field data based single bucket aggregation, that creates a bucket of all + documents in the current document set context that are missing a field value + (effectively, missing a field or having the configured NULL value set). + */ + export class MissingAggregation implements Aggregation { + + /* + Defines a bucket of all documents that are missing a field value. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): MissingAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): MissingAggregation; + + /* + Sets the field to gather missing terms from. + */ + field(field: string): MissingAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + An missingFilter matches documents where the specified field contains no legitimate value. + */ + export class MissingFilter implements Filter { + + /* + Filters documents where a specific field has no value present. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): MissingFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): MissingFilter; + + /* + Checks if the field doesn't exist. + */ + existence(trueFalse: boolean): MissingFilter; + + /* + Sets the field to check for missing values. + */ + field(name: string): MissingFilter; + + /* + Sets the filter name. + */ + name(name: string): MissingFilter; + + /* + Checks if the field has null values. + */ + nullValue(trueFalse: boolean): MissingFilter; + + /* + Returns the filter object. + */ + toJSON(): MissingFilter; + + } + + + /* + The more_like_this_field query is the same as the more_like_this query, + except it runs against a single field. + */ + export class MoreLikeThisFieldQuery implements Query { + + /* + Constructs a query where each documents returned are “like” provided text + */ + constructor(field: string, likeText: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + The analyzer that will be used to analyze the text. Defaults to the + analyzer associated with the field. + */ + analyzer(analyzerName: string): MoreLikeThisFieldQuery; + + /* + Sets the boost value of the Query. + */ + boost(boost: number): MoreLikeThisFieldQuery; + + /* + Sets the boost factor to use when boosting terms. + Defaults to 1. + */ + boostTerms(boost: number): MoreLikeThisFieldQuery; + + /* + Should the Query fail when an unsupported field + is specified. Defaults to true. + */ + failOnUnsupportedField(trueFalse: boolean): MoreLikeThisFieldQuery; + + /* + The field to run the query against. + */ + field(f: string): MoreLikeThisFieldQuery; + + /* + The text to find documents like + */ + likeText(s: string): MoreLikeThisFieldQuery; + + /* + The maximum frequency in which words may still appear. Words that + appear in more than this many docs will be ignored. + Defaults to unbounded. + */ + maxDocFreq(max: number): MoreLikeThisFieldQuery; + + /* + The maximum number of query terms that will be included in any + generated query. Defaults to 25. + */ + maxQueryTerms(max: number): MoreLikeThisFieldQuery; + + /* + The maximum word length above which words will be ignored. + Defaults to unbounded (0). + */ + maxWordLen(len: number): MoreLikeThisFieldQuery; + + /* + The frequency at which words will be ignored which do not occur in + at least this many docs. Defaults to 5. + */ + minDocFreq(min: number): MoreLikeThisFieldQuery; + + /* + The frequency below which terms will be ignored in the source doc. + The default frequency is 2. + */ + minTermFreq(freq: number): MoreLikeThisFieldQuery; + + /* + The minimum word length below which words will be ignored. + Defaults to 0. + */ + minWordLen(len: number): MoreLikeThisFieldQuery; + + /* + The percentage of terms to match on (float value). + Defaults to 0.3 (30 percent). + */ + percentTermsToMatch(percent: number): MoreLikeThisFieldQuery; + + /* + An array of stop words. Any word in this set is considered + “uninteresting” and ignored. Even if your Analyzer allows stopwords, + you might want to tell the MoreLikeThis code to ignore them, as for + the purposes of document similarity it seems reasonable to assume + that “a stop word is never interesting”. + */ + stopWords(stopWords: any[]): MoreLikeThisFieldQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + More like this query find documents that are “like” provided text by + running it against one or more fields. + */ + export class MoreLikeThisQuery implements Query { + + /* + Constructs a query where each documents returned are “like” provided text + */ + constructor(fields: string | string[], likeText: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + The analyzer that will be used to analyze the text. Defaults to the + analyzer associated with the field. + */ + analyzer(analyzerName: string): MoreLikeThisQuery; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): MoreLikeThisQuery; + + /* + Sets the boost factor to use when boosting terms. + Defaults to 1. + */ + boostTerms(boost: number): MoreLikeThisQuery; + + /* + Should the Query fail when an unsupported field + is specified. Defaults to true. + */ + failOnUnsupportedField(trueFalse: boolean): MoreLikeThisQuery; + + /* + The fields to run the query against. If you call with a single field, + it is added to the existing list of fields. If called with an array + of field names, it replaces any existing values with the new array. + */ + fields(f: string | string[]): MoreLikeThisQuery; + + /* + The text to find documents like + */ + likeText(s: string): MoreLikeThisQuery; + + /* + The maximum frequency in which words may still appear. Words that + appear in more than this many docs will be ignored. + Defaults to unbounded. + */ + maxDocFreq(max: number): MoreLikeThisQuery; + + /* + The maximum number of query terms that will be included in any + generated query. Defaults to 25. + */ + maxQueryTerms(max: number): MoreLikeThisQuery; + + /* + The maximum word length above which words will be ignored. + Defaults to unbounded (0). + */ + maxWordLen(len: number): MoreLikeThisQuery; + + /* + The frequency at which words will be ignored which do not occur in + at least this many docs. Defaults to 5. + */ + minDocFreq(min: number): MoreLikeThisQuery; + + /* + The frequency below which terms will be ignored in the source doc. + The default frequency is 2. + */ + minTermFreq(freq: number): MoreLikeThisQuery; + + /* + The minimum word length below which words will be ignored. + Defaults to 0. + */ + minWordLen(len: number): MoreLikeThisQuery; + + /* + The percentage of terms to match on (float value). + Defaults to 0.3 (30 percent). + */ + percentTermsToMatch(percent: number): MoreLikeThisQuery; + + /* + An array of stop words. Any word in this set is considered + “uninteresting” and ignored. Even if your Analyzer allows stopwords, + you might want to tell the MoreLikeThis code to ignore them, as for + the purposes of document similarity it seems reasonable to assume + that “a stop word is never interesting”. + */ + stopWords(stopWords: any[]): MoreLikeThisQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A MultiMatchQuery query builds further on top of the + MatchQuery by allowing multiple fields to be specified. + The idea here is to allow to more easily build a concise match type query + over multiple fields instead of using a relatively more expressive query + by using multiple match queries within a bool query. + */ + export class MultiMatchQuery implements Query { + + /* + A Query that allow to more easily build a MatchQuery + over multiple fields + */ + constructor(fields: string | string[], qstr: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the analyzer name used to analyze the Query object. + */ + analyzer(analyzer: string): MultiMatchQuery; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): MultiMatchQuery; + + /* + Sets the maximum threshold/frequency to be considered a low + frequency term in a CommonTermsQuery. + Set to a value between 0 and 1. + */ + cutoffFrequency(freq: Number): MultiMatchQuery; + + /* + Sets the fields to search across. If passed a single value it is + added to the existing list of fields. If passed an array of + values, they overwite all existing values. + */ + fields(f: string | string[]): MultiMatchQuery; + + /* + Sets the fuzziness value for the Query. + */ + fuzziness(fuzz: number): MultiMatchQuery; + + /* + Sets fuzzy rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + fuzzyRewrite(m: string): MultiMatchQuery; + + /* + Enables lenient parsing of the query string. + */ + lenient(trueFalse: boolean): MultiMatchQuery; + + /* + Sets the max expansions of a fuzzy Query. + */ + maxExpansions(e: number): MultiMatchQuery; + + /* + Sets a percent value controlling how many "should" clauses in the + resulting Query should match. + */ + minimumShouldMatch(minMatch: number): MultiMatchQuery; + + /* + Sets default operator of the Query. Default: or. + */ + operator(op: string): MultiMatchQuery; + + /* + Sets the prefix length for a fuzzy prefix Query. + */ + prefixLength(l: number): MultiMatchQuery; + + /* + Sets the query string for the Query. + */ + query(qstr: string): MultiMatchQuery; + + /* + Sets rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): MultiMatchQuery; + + /* + Sets the default slop for phrases. If zero, then exact phrase matches + are required. Default: 0. + */ + slop(slop: number): MultiMatchQuery; + + /* + The tie breaker value. The tie breaker capability allows results + that include the same term in multiple fields to be judged better than + results that include this term in only the best of those multiple + fields, without confusing this with the better case of two different + terms in the multiple fields. Default: 0.0. + */ + tieBreaker(tieBreaker: number): MultiMatchQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the type of the MultiMatchQuery. Valid values are + boolean, phrase, and phrase_prefix or phrasePrefix. + */ + type(type: string): MultiMatchQuery; + + /* + Sets whether or not queries against multiple fields should be combined using Lucene's + + DisjunctionMaxQuery + */ + useDisMax(trueFalse: string): MultiMatchQuery; + + /* + Sets what happens when no terms match. Valid values are + "all" or "none". + */ + zeroTermsQuery(q: string): MultiMatchQuery; + + } + + + /* + A special single bucket aggregation that enables aggregating nested + documents. + */ + export class NestedAggregation implements Aggregation { + + /* + A special single bucket aggregation that enables aggregating nested + documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): NestedAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): NestedAggregation; + + /* + Sets the nested path. + */ + path(path: string): NestedAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Nested filters allow you to search against content within objects that are + embedded inside of other objects. It is similar to XPath + expressions in XML both conceptually and syntactically. + + + The filter is executed against the nested objects / docs as if they were + indexed as separate docs and resulting in the root + parent doc (or parent nested mapping). + */ + export class NestedFilter implements Filter { + + /* + Constructs a filter that is capable of executing a filter against objects + nested within a document. + */ + constructor(path: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value of the nested Query. + */ + boost(boost: number): NestedFilter; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): NestedFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): NestedFilter; + + /* + Sets the nested filter to be executed. + */ + filter(oFilter: Object): NestedFilter; + + /* + If the nested query should be "joined" with the parent document. + Defaults to false. + */ + join(trueFalse: boolean): NestedFilter; + + /* + Sets the filter name. + */ + name(name: string): NestedFilter; + + /* + Sets the root context for the nested filter. + */ + path(p: string): NestedFilter; + + /* + Sets the nested query to be executed. + */ + query(oQuery: Query): NestedFilter; + + /* + Sets the scope of the filter. A scope allows to run facets on the + same scope name that will work against the nested documents. + */ + scope(s: string): NestedFilter; + + /* + Returns the filter object. + */ + toJSON(): NestedFilter; + + } + + + /* + Nested queries allow you to search against content within objects that are + embedded inside of other objects. It is similar to XPath expressions + in XML both conceptually and syntactically. + + The query is executed against the nested objects / docs as if they were + indexed as separate docs and resulting in the rootparent doc (or parent + nested mapping). + */ + export class NestedQuery implements Query { + + /* + Constructs a query that is capable of executing a search against objects + nested within a document. + */ + constructor(path: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): NestedQuery; + + /* + Sets the nested filter to be executed. + */ + filter(oFilter: Object): NestedQuery; + + /* + Sets the root context for the nested query. + */ + path(path: string): NestedQuery; + + /* + Sets the nested query to be executed. + */ + query(oQuery: Object): NestedQuery; + + /* + Sets the scope of the query. A scope allows to run facets on the + same scope name that will work against the nested documents. + */ + scope(s: string): NestedQuery; + + /* + Sets how the inner (nested) matches affect scoring on the parent document. + */ + scoreMode(mode: string): NestedQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A container Filter that excludes the documents matched by the + contained filter. + */ + export class NotFilter implements Filter { + + /* + Container filter that excludes the matched documents of the contained filter. + */ + constructor(oFilter: Object); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): NotFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): NotFilter; + + /* + Sets the filter + */ + filter(fltr: Object): NotFilter; + + /* + Sets the filter name. + */ + name(name: string): NotFilter; + + /* + Returns the filter object. + */ + toJSON(): NotFilter; + + } + + + /* + Filters documents with fields that have values within a certain numeric + range. Similar to range filter, except that it works only with numeric + values, and the filter execution works differently. + + The numeric range filter works by loading all the relevant field values + into memory, and checking for the relevant docs if they satisfy the range + requirements. This requires more memory since the numeric range data are + loaded to memory, but can provide a significant increase in performance. + + Note, if the relevant field values have already been loaded to memory, + for example because it was used in facets or was sorted on, then this + filter should be used. + */ + export class NumericRangeFilter implements Filter { + + /* + A Filter that only accepts numeric values within a specified range. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): NumericRangeFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): NumericRangeFilter; + + /* + Returns the field name used to create this object. + */ + field(field: string): NumericRangeFilter; + + /* + Sets the endpoint for the current range. + */ + from(startPoint: Number): NumericRangeFilter; + + /* + Greater than value. Same as setting from to the value, and + include_lower to false, + */ + gt(val: any): NumericRangeFilter; + + /* + Greater than or equal to value. Same as setting from to the value, + and include_lower to true. + */ + gte(val: any): NumericRangeFilter; + + /* + Should the first from (if set) be inclusive or not. + Defaults to true + */ + includeLower(trueFalse: boolean): NumericRangeFilter; + + /* + Should the last to (if set) be inclusive or not. Defaults to true. + */ + includeUpper(trueFalse: boolean): NumericRangeFilter; + + /* + Less than value. Same as setting to to the value, and include_upper + to false. + */ + lt(val: any): NumericRangeFilter; + + /* + Less than or equal to value. Same as setting to to the value, + and include_upper to true. + */ + lte(val: any): NumericRangeFilter; + + /* + Sets the filter name. + */ + name(name: string): NumericRangeFilter; + + /* + Sets the endpoint for the current range. + */ + to(endPoint: Number): NumericRangeFilter; + + /* + Returns the filter object. + */ + toJSON(): NumericRangeFilter; + + } + + + /* + A container filter that allows Boolean OR composition of filters. + */ + export class OrFilter implements Filter { + + /* + A container Filter that allows Boolean OR composition of filters. + */ + constructor(filters: Filter | Filter[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): OrFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): OrFilter; + + /* + Updates the filters. If passed a single Filter it is added to + the existing filters. If passed an array of Filters, they + replace all existing Filters. + */ + filters(fltr: Filter | Filter[]): OrFilter; + + /* + Sets the filter name. + */ + name(name: string): OrFilter; + + /* + Returns the filter object. + */ + toJSON(): OrFilter; + + } + + + /* + A multi-value metrics aggregation that calculates one or more percentiles + over numeric values extracted from the aggregated documents. These values can + be extracted either from specific numeric fields in the documents, or be + generated by a provided script. + */ + export class PercentilesAggregation implements Aggregation { + + /* + Aggregation that calculates one or more percentiles over numeric values + extracted from the aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Compression controls memory usage and approximation error. The compression + value limits the maximum number of nodes to 100 * compression. By + increasing the compression value, you can increase the accuracy of your + percentiles at the cost of more memory. Larger compression values also make + the algorithm slower since the underlying tree data structure grows in + size, resulting in more expensive operations. The default compression + value is 100. + */ + compression(c: number): PercentilesAggregation; + + /* + Sets the field to operate on. + */ + field(field: string): PercentilesAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): PercentilesAggregation; + + /* + The script language being used. + */ + lang(language: string): PercentilesAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): PercentilesAggregation; + + /* + Add a single percentile to the current list of percentiles. + */ + percent(percentile: number): PercentilesAggregation; + + /* + Sets the percentile bucket array. Overwrites all existing values. + */ + percents(percents: number[]): PercentilesAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): PercentilesAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): PercentilesAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + PhraseSuggester extends the PhraseSuggester and suggests + entire corrected phrases instead of individual tokens. The individual + phrase suggestions are weighted based on ngram-langugage models. In practice + it will be able to make better decision about which tokens to pick based on + co-occurence and frequencies. + */ + export class PhraseSuggester implements Suggest { + + /* + A suggester that suggests entire corrected phrases. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets analyzer used to analyze the suggest text. + */ + analyzer(analyzer: string): PhraseSuggester; + + /* + Sets the confidence level defines a factor applied to the input + phrases score which is used as a threshold for other suggest + candidates. Only candidates that score higher than the threshold + will be included in the result. + */ + confidence(c: number): PhraseSuggester; + + /* + Adds a direct generator. If passed a single Generator + it is added to the list of existing generators. If passed an + array of Generators, they replace all existing generators. + */ + directGenerator(oGenerator: Generator | Generator[]): PhraseSuggester; + + /* + Sets the field used to generate suggestions from. + */ + field(field: string): PhraseSuggester; + + /* + Forces the use of unigrams. + */ + forceUnigrams(trueFalse: boolean): PhraseSuggester; + + /* + Sets the max size of the n-grams (shingles) in the field. If + the field doesn't contain n-grams (shingles) this should be + omitted or set to 1. + */ + gramSize(s: number): PhraseSuggester; + + /* + Enables highlighting of suggestions + */ + highlight(preTag: string, postTag: string): PhraseSuggester; + + /* + A smoothing model that uses an additive smoothing model where a + constant (typically 1.0 or smaller) is added to all counts to + balance weights, The default alpha is 0.5. + */ + laplaceSmoothing(alpha: number): PhraseSuggester; + + /* + A smoothing model that takes the weighted mean of the unigrams, + bigrams and trigrams based on user supplied weights (lambdas). The + sum of tl, bl, and ul must equal 1. + */ + linearSmoothing(tl: number, bl: number, ul: number): PhraseSuggester; + + /* + Sets the maximum percentage of the terms that at most + considered to be misspellings in order to form a correction. + */ + maxErrors(c: number): PhraseSuggester; + + /* + Sets the likelihood of a term being a misspelled even if the + term exists in the dictionary. The default it 0.95 corresponding + to 5% or the real words are misspelled. + */ + realWordErrorLikelihood(l: number): PhraseSuggester; + + /* + Sets the separator that is used to separate terms in the bigram + field. If not set the whitespce character is used as a + separator. + */ + separator(sep: string): PhraseSuggester; + + /* + Sets the maximum number of suggestions to be retrieved from + each individual shard. + */ + shardSize(s: number): PhraseSuggester; + + /* + Sets the number of suggestions returned for each token. + */ + size(s: number): PhraseSuggester; + + /* + A simple backoff model that backs off to lower order n-gram + models if the higher order count is 0 and discounts the lower + order n-gram model by a constant factor. The default discount is + 0.4. + */ + stupidBackoffSmoothing(discount: number): PhraseSuggester; + + /* + Sets the text to get suggestions for. If not set, the global + suggestion text will be used. + */ + text(txt: string): PhraseSuggester; + + /* + Retrieves the internal suggest object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the token limit. + */ + tokenLimit(l: number): PhraseSuggester; + + } + + + /* + Filters documents that have fields containing terms with a specified prefix (not analyzed). Similar + to phrase query, except that it acts as a filter. Can be placed within queries that accept a filter. + */ + export class PrefixFilter implements Filter { + + /* + Filters documents that have fields containing terms with a specified prefix. + */ + constructor(fieldName: string, prefix: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): PrefixFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): PrefixFilter; + + /* + Returns the field name used to create this object. + */ + field(field: string): PrefixFilter; + + /* + Sets the filter name. + */ + name(name: string): PrefixFilter; + + /* + Sets the prefix to search for. + */ + prefix(value: string): PrefixFilter; + + /* + Returns the filter object. + */ + toJSON(): PrefixFilter; + + } + + + /* + Matches documents that have fields containing terms with a specified + prefix (not analyzed). The prefix query maps to Lucene PrefixQuery. + */ + export class PrefixQuery implements Query { + + /* + Matches documents containing the specified un-analyzed prefix. + */ + constructor(field: string, value: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value of the Query. + */ + boost(boost: number): PrefixQuery; + + /* + The field to run the query against. + */ + field(f: string): PrefixQuery; + + /* + Sets rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): PrefixQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + The prefix value. + */ + value(p: string): PrefixQuery; + + } + + + /* + The QueryFacet facet allows you to specify any valid Query and + have the number of matching hits returned as the value. + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class QueryFacet implements Facet { + + /* + A facet that return a count of the hits matching the given query. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): QueryFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): QueryFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): QueryFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): QueryFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): QueryFacet; + + /* + Sets the query to be used for this facet. + */ + query(oQuery: Object): QueryFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): QueryFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Wraps any query to be used as a filter. Can be placed within queries + that accept a filter. + + The result of the filter is not cached by default. Set the cache + parameter to true to cache the result of the filter. This is handy when the + same query is used on several (many) other queries. + + Note, the process of caching the first execution is higher when not + caching (since it needs to satisfy different queries). + */ + export class QueryFilter implements Filter { + + /* + Filters documents matching the wrapped query. + */ + constructor(qry: Object); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): QueryFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): QueryFilter; + + /* + Sets the filter name. + */ + name(name: string): QueryFilter; + + /* + Sets the query + */ + query(q: Object): QueryFilter; + + /* + Returns the filter object. + */ + toJSON(): QueryFilter; + + } + + export class QueryMixin { + + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): QueryMixin; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A query that is parsed using Lucene's default query parser. Although Lucene provides the + ability to create your own queries through its API, it also provides a rich query language + through the Query Parser, a lexer which interprets a string into a Lucene Query. + + See the Lucene Query Parser Syntax + for more information. + */ + export class QueryStringQuery implements Query { + + /* + A query that is parsed using Lucene's default query parser. + */ + constructor(qstr: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets whether or not wildcard characters (* and ?) are allowed as the + first character of the Query. Default: true. + */ + allowLeadingWildcard(trueFalse: boolean): QueryStringQuery; + + /* + Sets the analyzer name used to analyze the Query object. + */ + analyzer(analyzer: string): QueryStringQuery; + + /* + Sets whether or not we should attempt to analyzed wilcard terms in the + Query. By default, wildcard terms are not analyzed. + Analysis of wildcard characters is not perfect. Default: false. + */ + analyzeWildcard(trueFalse: boolean): QueryStringQuery; + + /* + Sets whether or not we should auto generate phrase queries *if* the + analyzer returns more than one term. Default: false. + */ + autoGeneratePhraseQueries(trueFalse: boolean): QueryStringQuery; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): QueryStringQuery; + + /* + Sets the default field/property this query should execute against. + */ + defaultField(fieldName: string): QueryStringQuery; + + /* + Set the default Boolean operator. This operator is used to join individual query + terms when no operator is explicity used in the query string (i.e., this AND that). + Defaults to OR. + */ + defaultOperator(op: string): QueryStringQuery; + + /* + Sets whether or not position increments will be used in the + Query. Default: true. + */ + enablePositionIncrements(trueFalse: boolean): QueryStringQuery; + + /* + If they query string should be escaped or not. + */ + escape(trueFalse: boolean): QueryStringQuery; + + /* + A set of fields/properties this query should execute against. + Pass a single value to add to the existing list of fields and + pass an array to overwrite all existing fields. For each field, + you can apply a field specific boost by appending a ^boost to the + field name. For example, title^10, to give the title field a + boost of 10. + */ + fields(fieldNames: any[]): QueryStringQuery; + + /* + Sets the max number of term expansions for fuzzy queries. + */ + fuzzyMaxExpansions(max: number): QueryStringQuery; + + /* + Set the minimum similarity for fuzzy queries. Default: 0.5. + */ + fuzzyMinSim(minSim: number): QueryStringQuery; + + /* + Sets the prefix length for fuzzy queries. Default: 0. + */ + fuzzyPrefixLength(fuzzLen: number): QueryStringQuery; + + /* + Sets fuzzy rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + fuzzyRewrite(m: string): QueryStringQuery; + + /* + Enables lenient parsing of the query string. + */ + lenient(trueFalse: boolean): QueryStringQuery; + + /* + Sets whether or not terms from wildcard, prefix, fuzzy, and + range queries should automatically be lowercased in the Query + since they are not analyzed. Default: true. + */ + lowercaseExpandedTerms(trueFalse: boolean): QueryStringQuery; + + /* + Sets a percent value controlling how many "should" clauses in the + resulting Query should match. + */ + minimumShouldMatch(minMatch: number): QueryStringQuery; + + /* + Sets the default slop for phrases. If zero, then exact phrase matches + are required. Default: 0. + */ + phraseSlop(slop: number): QueryStringQuery; + + /* + Sets the query string on this Query object. + */ + query(qstr: string): QueryStringQuery; + + /* + Sets the quote analyzer name used to analyze the query + when in quoted text. + */ + quoteAnalyzer(analyzer: string): QueryStringQuery; + + /* + Sets the suffix to automatically add to the field name when + performing a quoted search. + */ + quoteFieldSuffix(s: string): QueryStringQuery; + + /* + Sets rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): QueryStringQuery; + + /* + Sets the tie breaker value for a Query using + DisMax. The tie breaker capability allows results + that include the same term in multiple fields to be judged better than + results that include this term in only the best of those multiple + fields, without confusing this with the better case of two different + terms in the multiple fields. Default: 0.0. + */ + tieBreaker(tieBreaker: number): QueryStringQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets whether or not queries against multiple fields should be combined using Lucene's + + DisjunctionMaxQuery + */ + useDisMax(trueFalse: string): QueryStringQuery; + + } + + + /* + The random_score generates scores via a pseudo random number algorithm + that is initialized with a seed. + */ + export class RandomScoreFunction implements ScoreFunction { + + /* + Randomly score documents. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Adds a filter whose matching documents will have the score function applied. + */ + filter(oFilter: Filter): RandomScoreFunction; + + /* + Sets random seed value. + */ + seed(s: number): RandomScoreFunction; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A multi-bucket value source based aggregation that enables the user to + define a set of ranges - each representing a bucket. During the aggregation + process, the values extracted from each document will be checked against each + bucket range and "bucket" the relevant/matching document. + + Note that this aggregration includes the from value and excludes the to + value for each range. + */ + export class RangeAggregation implements Aggregation { + + /* + Aggregation that enables the user to define a set of ranges that each + represent a bucket. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): RangeAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): RangeAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): RangeAggregation; + + /* + Enable the response to be returned as a keyed object where the key is the + bucket interval. + */ + keyed(trueFalse: boolean): RangeAggregation; + + /* + The script language being used. + */ + lang(language: string): RangeAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): RangeAggregation; + + /* + Adds a range to the list of exsiting range expressions. + */ + range(from: string, to: string, key: string): RangeAggregation; + + /* + Allows you generate or modify the terms using a script. + */ + script(scriptCode: string): RangeAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): RangeAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A RangeFacet allows you to specify a set of ranges and get both the number of docs (count) that + fall within each range, and aggregated data based on the field, or another specified field. + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class RangeFacet implements Facet { + + /* + A facet which provides information over a range of numeric intervals. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Adds a new bounded range. + */ + addRange(from: Number, to: Number): RangeFacet; + + /* + Adds a new unbounded lower limit. + */ + addUnboundedFrom(from: Number): RangeFacet; + + /* + Adds a new unbounded upper limit. + */ + addUnboundedTo(to: Number): RangeFacet; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): RangeFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): RangeFacet; + + /* + Sets the document field to be used for the facet. + */ + field(fieldName: string): RangeFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): RangeFacet; + + /* + Allows you to specify an alternate key field to be used to compute the interval. + */ + keyField(fieldName: string): RangeFacet; + + /* + Allows you modify the key field using a script. The modified value + is then used to generate the interval. + */ + keyScript(scriptCode: string): RangeFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): RangeFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): RangeFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): RangeFacet; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): RangeFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): RangeFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Allows you to specify an alternate value field to be used to compute statistical information. + */ + valueField(fieldName: string): RangeFacet; + + /* + Allows you modify the value field using a script. The modified value + is then used to compute the statistical data. + */ + valueScript(scriptCode: string): RangeFacet; + + } + + + /* + Matches documents with fields that have terms within a certain range. + */ + export class RangeFilter implements Filter { + + /* + Filters documents with fields that have terms within a certain range. + */ + constructor(field: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): RangeFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): RangeFilter; + + /* + The field to run the filter against. + */ + field(f: string): RangeFilter; + + /* + The lower bound. Defaults to start from the first. + */ + from(f: any): RangeFilter; + + /* + Greater than value. Same as setting from to the value, and + include_lower to false, + */ + gt(val: any): RangeFilter; + + /* + Greater than or equal to value. Same as setting from to the value, + and include_lower to true. + */ + gte(val: any): RangeFilter; + + /* + Should the first from (if set) be inclusive or not. + Defaults to true + */ + includeLower(trueFalse: boolean): RangeFilter; + + /* + Should the last to (if set) be inclusive or not. Defaults to true. + */ + includeUpper(trueFalse: boolean): RangeFilter; + + /* + Less than value. Same as setting to to the value, and include_upper + to false. + */ + lt(val: any): RangeFilter; + + /* + Less than or equal to value. Same as setting to to the value, + and include_upper to true. + */ + lte(val: any): RangeFilter; + + /* + Sets the filter name. + */ + name(name: string): RangeFilter; + + /* + The upper bound. Defaults to unbounded. + */ + to(t: any): RangeFilter; + + /* + Returns the filter object. + */ + toJSON(): RangeFilter; + + } + + + /* + Matches documents with fields that have terms within a certain range. + The type of the Lucene query depends on the field type, for string fields, + the TermRangeQuery, while for number/date fields, the query is a + NumericRangeQuery. + */ + export class RangeQuery implements Query { + + /* + Matches documents with fields that have terms within a certain range. + */ + constructor(field: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value of the Query. + */ + boost(boost: number): RangeQuery; + + /* + The field to run the query against. + */ + field(f: string): RangeQuery; + + /* + The lower bound. Defaults to start from the first. + */ + from(f: any): RangeQuery; + + /* + Greater than value. Same as setting from to the value, and + include_lower to false, + */ + gt(val: any): RangeQuery; + + /* + Greater than or equal to value. Same as setting from to the value, + and include_lower to true. + */ + gte(val: any): RangeQuery; + + /* + Should the first from (if set) be inclusive or not. + Defaults to true + */ + includeLower(trueFalse: boolean): RangeQuery; + + /* + Should the last to (if set) be inclusive or not. Defaults to true. + */ + includeUpper(trueFalse: boolean): RangeQuery; + + /* + Less than value. Same as setting to to the value, and include_upper + to false. + */ + lt(val: any): RangeQuery; + + /* + Less than or equal to value. Same as setting to to the value, + and include_upper to true. + */ + lte(val: any): RangeQuery; + + /* + The upper bound. Defaults to unbounded. + */ + to(t: any): RangeQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Filters documents that have a field value matching a regular expression. + Based on Lucene 4.0 RegexpFilter which uses automaton to efficiently iterate + over index terms. + */ + export class RegexpFilter implements Filter { + + /* + Matches documents that have fields matching a regular expression. + */ + constructor(field: string, value: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): RegexpFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): RegexpFilter; + + /* + The field to run the filter against. + */ + field(f: string): RegexpFilter; + + /* + The regex flags to use. Valid flags are: + + INTERSECTION - Support for intersection notation + COMPLEMENT - Support for complement notation + EMPTY - Support for the empty language symbol: # + ANYSTRING - Support for the any string symbol: @ + INTERVAL - Support for numerical interval notation: + NONE - Disable support for all syntax options + ALL - Enables support for all syntax options + + Use multiple flags by separating with a "|" character. Example: + + INTERSECTION|COMPLEMENT|EMPTY + */ + flags(f: string): RegexpFilter; + + /* + The regex flags to use as a numeric value. Advanced use only, + it is probably better to stick with the flags option. + */ + flagsValue(v: string): RegexpFilter; + + /* + Sets the filter name. + */ + name(name: string): RegexpFilter; + + /* + Returns the filter object. + */ + toJSON(): RegexpFilter; + + /* + The regexp value. + */ + value(p: string): RegexpFilter; + + } + + + /* + Matches documents that have fields matching a regular expression. Based + on Lucene 4.0 RegexpQuery which uses automaton to efficiently iterate over + index terms. + */ + export class RegexpQuery implements Query { + + /* + Matches documents that have fields matching a regular expression. + */ + constructor(field: string, value: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value of the Query. + */ + boost(boost: number): RegexpQuery; + + /* + The field to run the query against. + */ + field(f: string): RegexpQuery; + + /* + The regex flags to use. Valid flags are: + + INTERSECTION - Support for intersection notation + COMPLEMENT - Support for complement notation + EMPTY - Support for the empty language symbol: # + ANYSTRING - Support for the any string symbol: @ + INTERVAL - Support for numerical interval notation: + NONE - Disable support for all syntax options + ALL - Enables support for all syntax options + + Use multiple flags by separating with a "|" character. Example: + + INTERSECTION|COMPLEMENT|EMPTY + */ + flags(f: string): RegexpQuery; + + /* + The regex flags to use as a numeric value. Advanced use only, + it is probably better to stick with the flags option. + */ + flagsValue(v: string): RegexpQuery; + + /* + Sets rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): RegexpQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + The regexp value. + */ + value(p: string): RegexpQuery; + + } + + + /* + The Request object provides methods generating an elasticsearch request body. + */ + export class Request { + + /* + Provides methods for generating request bodies. + */ + constructor(conf: Object); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add an aggregation. This method can be called multiple times + in order to set multiple nested aggregations that will be executed + at the same time as the search request. Alias for the aggregation method. + */ + agg(agg: Aggregation): Request; + + /* + Add an aggregation. This method can be called multiple times + in order to set multiple nested aggregations that will be executed + at the same time as the search request. + */ + aggregation(agg: Aggregation): Request; + + /* + Enable/Disable explanation of score for each search result. + */ + explain(trueFalse: boolean): Request; + + /* + Allows you to set the specified facet on this request object. Multiple facets can + be set, all of which will be returned when the search is executed. + */ + facet(facet: Facet): Request; + + /* + By default, searches return full documents, meaning every property or field. + This method allows you to specify which fields you want returned. + + Pass a single field name and it is appended to the current list of + fields. Pass an array of fields and it replaces all existing + fields. + */ + fields(s: string | string[]): Request; + + /* + Allows you to set a specified filter on this request object. + */ + filter(filter: Object): Request; + + /* + A search result set could be very large (think Google). Setting the + from parameter allows you to page through the result set + by making multiple request. This parameters specifies the starting + result/document number point. Combine with size() to achieve paging. + */ + from(f: any[]): Request; + + /* + Performs highlighting based on the Highlight + settings. + */ + highlight(h: Highlight): Request; + + /* + Boosts hits in the specified index by the given boost value. + */ + indexBoost(index: string, boost: number): Request; + + /* + Filters out search results will scores less than the specified minimum score. + */ + minScore(min: number): Request; + + /* + Allows you to set the specified query on this search object. This is the + query that will be used when the search is executed. + */ + query(someQuery: Query): Request; + + /* + Once a query executes, you can use rescore to run a secondary, more + expensive query to re-order the results. + */ + rescore(r: Rescore): Request; + + /* + Computes a document property dynamically based on the supplied ScriptField. + */ + scriptField(oScriptField: ScriptField): Request; + + /* + Sets the number of results/documents to be returned. This is set on a per page basis. + */ + size(s: number): Request; + + /* + Sets the sorting for the query. This accepts many input formats. + + + sort() - The current sorting values are returned. + sort(fieldName) - Adds the field to the current list of sorting values. + sort(fieldName, order) - Adds the field to the current list of + sorting with the specified order. Order must be asc or desc. + sort(ejs.Sort) - Adds the Sort value to the current list of sorting values. + sort(array) - Replaces all current sorting values with values + from the array. The array must contain only strings and Sort objects. + + + Multi-level sorting is supported so the order in which sort fields + are added to the query requests is relevant. + + It is recommended to use Sort objects when possible. + */ + sort(fieldName: string): Request; + + /* + Allows to control how the _source field is returned with every hit. + By default operations return the contents of the _source field + unless you have used the fields parameter or if the _source field + is disabled. Set the includes parameter to false to completely + disable returning the source field. + */ + source(includes: string | boolean | string[], excludes: string | string[]): Request; + + /* + Allows you to set the specified suggester on this request object. + Multiple suggesters can be set, all of which will be returned when + the search is executed. Global suggestion text can be set by + passing in a string vs. a Suggest object. + */ + suggest(s: string | Suggest): Request; + + /* + A timeout, bounding the request to be executed within the + specified time value and bail when expired. Defaults to no timeout. + + This option is valid during the following operations: + search and delete by query + */ + timeout(t: number): Request; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Enables score computation and tracking during sorting. Be default, + when sorting scores are not computed. + */ + trackScores(trueFalse: boolean): Request; + + /* + Enable/Disable returning version number for each search result. + */ + version(trueFalse: boolean): Request; + + } + + + /* + A method that allows to rescore queries with a typically more expensive. + */ + export class Rescore { + + /* + Defines an operation that rescores a query with another query. + */ + //constructor(windowSize: Number, windowSize: Query); + constructor(windowSize: Number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the weight assigned to the original query of the rescoring. + */ + queryWeight(weight: Number): Rescore; + + /* + Sets the query used by the rescoring. + */ + rescoreQuery(someQuery: Query): Rescore; + + /* + Sets the weight assigned to the query used to rescore the original query. + */ + rescoreQueryWeight(weight: Number): Rescore; + + /* + Sets the scoring mode. Valid values are: + + total - default mode, the scores combined + multiply - the scores multiplied + min - the lowest of the scores + max - the highest score + avg - the average of the scores + */ + scoreMode(s: string): Rescore; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the window_size parameter of the rescoring. + */ + windowSize(size: Number): Rescore; + + } + + export class ScoreFunctionMixin implements ScoreFunction { + + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Adds a filter whose matching documents will have the score function applied. + */ + filter(oFilter: Filter): ScoreFunctionMixin; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + ScriptField's allow you create dynamic fields on stored documents at query + time. For example, you might have a set of document thats containsthe fields + price and quantity. At query time, you could define a computed + property that dynamically creates a new field called totalin each document + based on the calculation price * quantity. + */ + export class ScriptField { + + /* + Computes dynamic document properties based on information from other fields. + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + If execeptions thrown from the script should be ignored or not. + Default: false + */ + ignoreFailure(trueFalse: boolean): ScriptField; + + /* + The script language being used. Currently supported values are + javascript and mvel. + */ + lang(language: string): ScriptField; + + /* + Allows you to set script parameters to be used during the execution of the script. + */ + params(oParams: Object): ScriptField; + + /* + Sets the script/code that will be used to perform the calculation. + */ + script(expression: string): ScriptField; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A filter allowing to define scripts as filters + */ + export class ScriptFilter implements Filter { + + /* + A filter allowing to define scripts as filters. + */ + constructor(script: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): ScriptFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): ScriptFilter; + + /* + Sets the script language. + */ + lang(lang: string): ScriptFilter; + + /* + Sets the filter name. + */ + name(name: string): ScriptFilter; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): ScriptFilter; + + /* + Sets the script. + */ + script(s: string): ScriptFilter; + + /* + Returns the filter object. + */ + toJSON(): ScriptFilter; + + } + + + /* + The script_score function allows you to wrap another query and customize + the scoring of it optionally with a computation derived from other numeric + field values in the doc using a script expression. + */ + export class ScriptScoreFunction implements ScoreFunction { + + /* + Modify a documents score using a script. + */ + constructor(); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Adds a filter whose matching documents will have the score function applied. + */ + filter(oFilter: Filter): ScriptScoreFunction; + + /* + The script language being used. + */ + lang(language: string): ScriptScoreFunction; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): ScriptScoreFunction; + + /* + Set the script that will modify the score. + */ + script(scriptCode: string): ScriptScoreFunction; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A Shape object that can be used in queries and filters that + take a Shape. Shape uses the GeoJSON format. + + See http://www.geojson.org/ + */ + export class Shape implements Geo { + + /* + Defines a shape + */ + constructor(type: string, coords: any[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the coordinates for the shape definition. Note, the coordinates + are not validated in this api. Please see GeoJSON and ElasticSearch + documentation for correct coordinate definitions. + */ + coordinates(c: any[]): Shape; + + /* + Sets the radius for parsing a circle Shape. + */ + radius(r: string): Shape; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the shape type. Can be set to one of: point, linestring, polygon, + multipoint, envelope, or multipolygon. + */ + type(t: string): Shape; + + } + + + /* + An aggregation that returns interesting or unusual occurrences of terms in + a set. + */ + export class SignificantTermsAggregation implements Aggregation { + + /* + An aggregation that returns interesting or unusual occurrences of terms in + a set. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): SignificantTermsAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): SignificantTermsAggregation; + + /* + Allows you to filter out unwanted facet entries using a regular + expression. You can also optionally pass in a set of flags to apply + to the regular expression. Valid flags are: CASE_INSENSITIVE, + MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL, + COMMENTS, and UNICODE_CHAR_CLASS. Separate multiple flags with a | + character. + */ + exclude(exclude: string, flags: string): SignificantTermsAggregation; + + /* + Sets the execution hint determines how the aggregation is computed. + Supported values are: map and ordinals. + */ + executionHint(h: string): SignificantTermsAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): SignificantTermsAggregation; + + /* + Sets the format expression for the terms. Use for number or date + formatting. + */ + format(f: string): SignificantTermsAggregation; + + /* + Allows you to allow only specific entries using a regular + expression. You can also optionally pass in a set of flags to apply + to the regular expression. Valid flags are: CASE_INSENSITIVE, + MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL, + COMMENTS, and UNICODE_CHAR_CLASS. Separate multiple flags with a | + character. + */ + include(include: string, flags: string): SignificantTermsAggregation; + + /* + Only return terms that match more than a configured number of hits. + */ + minDocCount(num: number): SignificantTermsAggregation; + + /* + Determines how many terms the coordinating node will request from + each shard. + */ + shardSize(shardSize: number): SignificantTermsAggregation; + + /* + Sets the number of aggregation entries that will be returned. + */ + size(size: number): SignificantTermsAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A Sort object that can be used in on the Request object to specify + various types of sorting. + + See http://www.elasticsearch.org/guide/reference/api/search/sort.html + */ + export class Sort { + + /* + Defines a sort value + */ + constructor(fieldName: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the sort order to ascending (asc). Same as calling + order('asc'). + */ + asc(): Sort; + + /* + Sets the sort order to descending (desc). Same as calling + order('desc'). + */ + desc(): Sort; + + /* + How to compute the distance. Can either be arc (better precision) + or plane (faster). Defaults to arc. + + Valid during sort types: geo distance + */ + distanceType(type: string): Sort; + + /* + Set's the field to sort on + */ + field(f: string): Sort; + + /* + Enables sorting based on a distance from a GeoPoint + */ + geoDistance(point: GeoPoint): Sort; + + /* + Sets if the sort should ignore unmapped fields vs throwing an error. + + Valid during sort types: field + */ + ignoreUnmapped(trueFalse: boolean): Sort; + + /* + Sets the script language. + + Valid during sort types: script + */ + lang(lang: string): Sort; + + /* + Sets the value to use for missing fields. Valid values are: + + _last - to put documents with the field missing last + _first - to put documents with the field missing first + {String} - any string value to use as the sort value. + + Valid during sort types: field + */ + missing(m: string): Sort; + + /* + Sets the sort mode. Valid values are: + + + min - sort by lowest value + max - sort by highest value + sum - sort by the sum of all values + avg - sort by the average of all values + + + Valid during sort types: field, geo distance + */ + mode(m: string): Sort; + + /* + Allows you to set a filter that nested objects must match + in order to be considered during sorting. + + Valid during sort types: field, geo distance + */ + nestedFilter(oFilter: Object): Sort; + + /* + Sets the path of the nested object. + + Valid during sort types: field, geo distance + */ + nestedPath(path: string): Sort; + + /* + If the lat/long points should be normalized to lie within their + respective normalized ranges. + + Normalized ranges are: + lon = -180 (exclusive) to 180 (inclusive) range + lat = -90 to 90 (both inclusive) range + + Valid during sort types: geo distance + */ + normalize(trueFalse: string): Sort; + + /* + Sets the sort order. Valid values are: + + asc - for ascending order + desc - for descending order + + Valid during sort types: field, geo distance, and script + */ + order(o: string): Sort; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + + Valid during sort types: script + */ + params(p: Object): Sort; + + /* + Sets the order with a boolean value. + + true = descending sort order + false = ascending sort order + + Valid during sort types: field, geo distance, and script + */ + reverse(trueFalse: boolean): Sort; + + /* + Enables sorting based on a script. + */ + script(scriptCode: string): Sort; + + /* + Retrieves the internal script object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the script sort type. Valid values are: + + + string - script return value is sorted as a string + number - script return value is sorted as a number + + + Valid during sort types: script + */ + type(type: string): Sort; + + /* + Sets the distance unit. Valid values are "mi" for miles or "km" + for kilometers. Defaults to "km". + + Valid during sort types: geo distance + */ + unit(unit: Number): Sort; + + } + + + /* + Matches spans near the beginning of a field. The spanFirstQuery allows you to search + for Spans that start and end within the first n positions of the document. + The span first query maps to Lucene SpanFirstQuery. + */ + export class SpanFirstQuery implements Query { + + /* + Matches spans near the beginning of a field. + */ + constructor(spanQry: Query, end: number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): SpanFirstQuery; + + /* + Sets the maximum end position permitted in a match. + */ + end(position: Number): SpanFirstQuery; + + /* + Sets the span query to match on. + */ + match(spanQuery: Object): SpanFirstQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Wraps lucene MultiTermQueries as a SpanQuery so it can be used in the + various Span* queries. Examples of valid MultiTermQueries are + Fuzzy, NumericRange, Prefix, Regex, Range, and Wildcard. + */ + export class SpanMultiTermQuery implements Query { + + /* + Use MultiTermQueries as a SpanQuery. + */ + constructor(qry: Query); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): SpanMultiTermQuery; + + /* + Sets the span query to match on. + */ + match(mtQuery: Object): SpanMultiTermQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A spanNearQuery will look to find a number of spanQuerys within a given + distance from each other. + */ + export class SpanNearQuery implements Query { + + /* + Matches spans which are near one another. + */ + constructor(clauses: Query | Query[], slop: number); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): SpanNearQuery; + + /* + Sets the clauses used. If passed a single SpanQuery, it is added + to the existing list of clauses. If passed an array of + SpanQueries, they replace any existing clauses. + */ + clauses(clauses: Query | Query[]): SpanNearQuery; + + /* + Sets whether or not payloads are being used. A payload is an arbitrary + byte array stored at a specific position (i.e. token/term). + */ + collectPayloads(trueFalse: boolean): SpanNearQuery; + + /* + Sets whether or not matches are required to be in-order. + */ + inOrder(trueFalse: boolean): SpanNearQuery; + + /* + Sets the maximum number of intervening unmatched positions. + */ + slop(distance: Number): SpanNearQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Removes matches which overlap with another span query. + The span not query maps to Lucene SpanNotQuery. + */ + export class SpanNotQuery implements Query { + + /* + Removes matches which overlap with another span query. + */ + constructor(includeQry: Query, excludeQry: Query); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): SpanNotQuery; + + /* + Sets the span query whose matches must not overlap those returned. + */ + exclude(spanQuery: Object): SpanNotQuery; + + /* + Set the span query whose matches are filtered. + */ + include(spanQuery: Object): SpanNotQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + The spanOrQuery takes an array of SpanQuerys and will match if any of the + underlying SpanQueries match. The span or query maps to Lucene SpanOrQuery. + */ + export class SpanOrQuery implements Query { + + /* + Matches the union of its span clauses. + */ + constructor(clauses: Object); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): SpanOrQuery; + + /* + Sets the clauses used. If passed a single SpanQuery, it is added + to the existing list of clauses. If passed an array of + SpanQueries, they replace any existing clauses. + */ + clauses(clauses: Query | Query[]): SpanOrQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A spanTermQuery is the basic unit of Lucene's Span Query which allows for nested, + positional restrictions when matching documents. The spanTermQuery simply matches + spans containing a term. It's essentially a termQuery with positional information asscoaited. + */ + export class SpanTermQuery implements Query { + + /* + Matches spans containing a term + */ + constructor(field: string, value: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): SpanTermQuery; + + /* + Sets the field to query against. + */ + field(f: string): SpanTermQuery; + + /* + Sets the term. + */ + term(t: string): SpanTermQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A statistical facet allows you to compute statistical data over a numeric fields. Statistical data includes + the count, total, sum of squares, mean (average), minimum, maximum, variance, and standard deviation. + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class StatisticalFacet implements Facet { + + /* + A facet which returns statistical information about a numeric field + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): StatisticalFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): StatisticalFacet; + + /* + Sets the field to be used to construct the this facet. + */ + field(fieldName: string): StatisticalFacet; + + /* + Aggregate statistical info across a set of fields. + */ + fields(aFieldName: any[]): StatisticalFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): StatisticalFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): StatisticalFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): StatisticalFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): StatisticalFacet; + + /* + Allows you to set script parameters to be used during the execution of the script. + */ + params(oParams: Object): StatisticalFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): StatisticalFacet; + + /* + Define a script to evaluate of which the result will be used to generate + the statistical information. + */ + script(code: string): StatisticalFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A multi-value metrics aggregation that computes stats over numeric values + extracted from the aggregated documents. These values can be extracted either + from specific numeric fields in the documents, or be generated by a provided + script. + + The stats that are returned consist of: min, max, sum, count and avg. + */ + export class StatsAggregation implements Aggregation { + + /* + Aggregation that computes stats over numeric values extracted from the + aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): StatsAggregation; + + /* + The script language being used. + */ + lang(language: string): StatsAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): StatsAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): StatsAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): StatsAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + export class SuggestContextMixin { + + + /* + Sets analyzer used to analyze the suggest text. + */ + analyzer(analyzer: string): SuggestContextMixin; + + /* + Sets the field used to generate suggestions from. + */ + field(field: string): SuggestContextMixin; + + /* + Sets the maximum number of suggestions to be retrieved from + each individual shard. + */ + shardSize(s: number): SuggestContextMixin; + + /* + Sets the number of suggestions returned for each token. + */ + size(s: number): SuggestContextMixin; + + } + + export class SuggesterMixin { + + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the text to get suggestions for. If not set, the global + suggestion text will be used. + */ + text(txt: string): SuggesterMixin; + + /* + Retrieves the internal suggest object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A single-value metrics aggregation that sums up numeric values that are + extracted from the aggregated documents. These values can be extracted either + from specific numeric fields in the documents, or be generated by a + provided script. + */ + export class SumAggregation implements Aggregation { + + /* + Aggregation that sums up numeric values that are extracted from the + aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): SumAggregation; + + /* + The script language being used. + */ + lang(language: string): SumAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): SumAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): SumAggregation; + + /* + Set to true to assume script values are sorted. + */ + scriptValuesSorted(trueFalse: boolean): SumAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Constructs a filter for docs matching any of the terms added to this + object. Unlike a RangeFilter this can be used for filtering on multiple + terms that are not necessarily in a sequence. + */ + export class TermFilter implements Filter { + + /* + Constructs a filter for docs matching the term added to this object. + */ + constructor(fieldName: string, term: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): TermFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): TermFilter; + + /* + Provides access to the filter fieldName used to construct the + termFilter object. + */ + field(f: string): TermFilter; + + /* + Sets the filter name. + */ + name(name: string): TermFilter; + + /* + Provides access to the filter term used to construct the + termFilter object. + */ + term(): TermFilter; + + /* + Returns the filter object. + */ + toJSON(): TermFilter; + + } + + + /* + A TermQuery can be used to return documents containing a given + keyword or term. For instance, you might want to retieve all the + documents/objects that contain the term Javascript. Term filters + often serve as the basis for more complex queries such as Boolean queries. + */ + export class TermQuery implements Query { + + /* + A Query that matches documents containing a term. This may be + combined with other terms with a BooleanQuery. + */ + constructor(field: string, term: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: Number): TermQuery; + + /* + Sets the fields to query against. + */ + field(f: string): TermQuery; + + /* + Sets the term. + */ + term(t: string): TermQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A multi-bucket value source based aggregation where buckets are dynamically + built - one per unique value. + */ + export class TermsAggregation implements Aggregation { + + /* + Defines an aggregation of unique values/terms. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. Alias for the + aggregation method. + */ + agg(agg: Aggregation): TermsAggregation; + + /* + Add a nested aggregation. This method can be called multiple times + in order to set multiple nested aggregations what will be executed + at the same time as the parent aggregation. + */ + aggregation(agg: Aggregation): TermsAggregation; + + /* + Allows you to filter out unwanted facet entries using a regular + expression. You can also optionally pass in a set of flags to apply + to the regular expression. Valid flags are: CASE_INSENSITIVE, + MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL, + COMMENTS, and UNICODE_CHAR_CLASS. Separate multiple flags with a | + character. + */ + exclude(exclude: string, flags: string): TermsAggregation; + + /* + Sets the execution hint determines how the aggregation is computed. + Supported values are: map and ordinals. + */ + executionHint(h: string): TermsAggregation; + + /* + Sets the field to gather terms from. + */ + field(field: string): TermsAggregation; + + /* + Sets the format expression for the terms. Use for number or date + formatting + */ + format(f: string): TermsAggregation; + + /* + Allows you to allow only specific entries using a regular + expression. You can also optionally pass in a set of flags to apply + to the regular expression. Valid flags are: CASE_INSENSITIVE, + MULTILINE, DOTALL, UNICODE_CASE, CANON_EQ, UNIX_LINES, LITERAL, + COMMENTS, and UNICODE_CHAR_CLASS. Separate multiple flags with a | + character. + */ + include(include: string, flags: string): TermsAggregation; + + /* + The script language being used. + */ + lang(language: string): TermsAggregation; + + /* + Only return terms that match more than a configured number of hits. + */ + minDocCount(num: number): TermsAggregation; + + /* + Sets order for the aggregated values. + */ + order(order: string, direction: string): TermsAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): TermsAggregation; + + /* + Allows you generate or modify the terms using a script. + */ + script(scriptCode: string): TermsAggregation; + + /* + Set to true to assume script values are unique. + */ + scriptValuesUnique(trueFalse: boolean): TermsAggregation; + + /* + Determines how many terms the coordinating node will request from + each shard. + */ + shardSize(shardSize: number): TermsAggregation; + + /* + Sets the number of aggregation entries that will be returned. + */ + size(size: number): TermsAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the type of the field value for use in scripts. Current values are: + string, double, float, long, integer, short, and byte. + */ + valueType(v: string): TermsAggregation; + + } + + + /* + A facet which returns the N most frequent terms within a collection + or set of collections. Term facets are useful for building constructs + which allow users to refine search results by filtering on terms returned + by the facet. + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + For more information on faceted navigation, see this Wikipedia article on + Faceted Classification + */ + export class TermsFacet implements Facet { + + /* + A facet which returns the N most frequent terms within a collection + or set of collections. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Allows you to return all terms, even if the frequency count is 0. This should not be + used on fields that contain a large number of unique terms because it could cause + out-of-memory errors. + */ + allTerms(trueFalse: string): TermsFacet; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): TermsFacet; + + /* + Allows you to filter out unwanted facet entries. When passed + a single term, it is appended to the list of currently excluded + terms. If passed an array, it overwrites all existing values. + */ + exclude(exclude: string | string[]): TermsFacet; + + /* + Sets the execution hint determines how the facet is computed. + Currently only supported value is "map". + */ + executionHint(h: Object): TermsFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): TermsFacet; + + /* + Sets the field to be used to construct the this facet. Set to + _index to return a facet count of hits per _index the search was + executed on. + */ + field(fieldName: string): TermsFacet; + + /* + Aggregate statistical info across a set of fields. + */ + fields(aFieldName: any[]): TermsFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): TermsFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): TermsFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): TermsFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): TermsFacet; + + /* + Sets the type of ordering that will be performed on the date + buckets. Valid values are: + + count - default, sort by the number of items in the bucket + term - sort by term value. + reverse_count - reverse sort of the number of items in the bucket + reverse_term - reverse sort of the term value. + */ + order(o: string): TermsFacet; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): TermsFacet; + + /* + Allows you to only include facet entries matching a specified regular expression. + */ + regex(exp: string): TermsFacet; + + /* + Allows you to set the regular expression flags to be used + with the regex + */ + regexFlags(flags: string): TermsFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): TermsFacet; + + /* + Allows you modify the term using a script. The modified value + is then used in the facet collection. + */ + script(scriptCode: string): TermsFacet; + + /* + Sets a script that will provide the terms for a given document. + */ + scriptField(script: string): TermsFacet; + + /* + Determines how many terms the coordinating node will request from + each shard. + */ + shardSize(shardSize: number): TermsFacet; + + /* + Sets the number of facet entries that will be returned for this facet. For instance, you + might ask for only the top 5 authors although there might be hundreds of + unique authors. + */ + size(facetSize: number): TermsFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Filters documents that have fields that match any of the provided + terms (not analyzed) + */ + export class TermsFilter implements Filter { + + /* + A Filter that matches documents containing provided terms. + */ + constructor(field: string, terms: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): TermsFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): TermsFilter; + + /* + Enable or disable caching of the lookup + */ + cacheLookup(trueFalse: boolean): TermsFilter; + + /* + Sets the way terms filter executes is by iterating over the terms + provided and finding matches docs (loading into a bitset) and + caching it. Valid values are: plain, bool, bool_nocache, and, + and_nocache, or, or_nocache. Defaults to plain. + */ + execution(e: string): TermsFilter; + + /* + Sets the fields to filter against. + */ + field(f: string): TermsFilter; + + /* + Sets the document id of the document containing the terms to use + when performing a terms lookup. + */ + id(id: string): TermsFilter; + + /* + Sets the index the document containing the terms is in when + performing a terms lookup. Defaults to the index currently + being searched. + */ + index(idx: string): TermsFilter; + + /* + Sets the filter name. + */ + name(name: string): TermsFilter; + + /* + Sets the path/field name where the terms in the source document + are located when performing a terms lookup. + */ + path(path: string): TermsFilter; + + /* + Sets the routing value for the source document when performing a + terms lookup. + */ + routing(path: string): TermsFilter; + + /* + Sets the terms. If t is a String, it is added to the existing + list of terms. If t is an array, the list of terms replaces the + existing terms. + */ + terms(t: string | string[]): TermsFilter; + + /* + Returns the filter object. + */ + toJSON(): TermsFilter; + + /* + Sets the type the document containing the terms when performing a + terms lookup. + */ + type(type: string): TermsFilter; + + } + + + /* + A query that match on any (configurable) of the provided terms. This is + a simpler syntax query for using a bool query with several term queries + in the should clauses. + */ + export class TermsQuery implements Query { + + /* + A Query that matches documents containing provided terms. + */ + constructor(field: string, terms: string | string[]); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): TermsQuery; + + /* + Enables or disables similarity coordinate scoring of documents + matching the Query. Default: false. + */ + disableCoord(trueFalse: string): TermsQuery; + + /* + Sets the fields to query against. + */ + field(f: string): TermsQuery; + + /* + Sets the minimum number of terms that need to match in a document + before that document is returned in the results. + */ + minimumShouldMatch(min: number): TermsQuery; + + /* + Sets the terms. If you t is a String, it is added to the existing + list of terms. If t is an array, the list of terms replaces the + existing terms. + */ + terms(t: string | string[]): TermsQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + A termsStatsFacet allows you to compute statistics over an aggregate key (term). Essentially this + facet provides the functionality of what is often refered to as a pivot table. + + Facets are similar to SQL GROUP BY statements but perform much + better. You can also construct several "groups" at once by simply + specifying multiple facets. + + + + Tip: + For more information on faceted navigation, see + this + Wikipedia article on Faceted Classification. + + + */ + export class TermStatsFacet implements Facet { + + /* + A facet which computes statistical data based on an aggregate key. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Allows you to return all terms, even if the frequency count is 0. This should not be + used on fields that contain a large number of unique terms because it could cause + out-of-memory errors. + */ + allTerms(trueFalse: string): TermStatsFacet; + + /* + Enables caching of the facetFilter + */ + cacheFilter(trueFalse: boolean): TermStatsFacet; + + /* + Allows you to reduce the documents used for computing facet results. + */ + facetFilter(oFilter: Object): TermStatsFacet; + + /* + Computes values across the entire index + */ + global(trueFalse: boolean): TermStatsFacet; + + /* + Sets the field which will be used to pivot on (group-by). + */ + keyField(fieldName: string): TermStatsFacet; + + /* + The script language being used. Currently supported values are + javascript, groovy, and mvel. + */ + lang(language: string): TermStatsFacet; + + /* + Sets the mode the facet will use. + + + collector + post + + */ + mode(m: string): TermStatsFacet; + + /* + Sets the path to the nested document if faceting against a + nested field. + */ + nested(path: string): TermStatsFacet; + + /* + Sets the type of ordering that will be performed on the date + buckets. Valid values are: + + count - default, sort by the number of items in the bucket + term - sort by term value. + reverse_count - reverse sort of the number of items in the bucket + reverse_term - reverse sort of the term value. + total - sorts by the total value of the bucket contents + reverse_total - reverse sort of the total value of bucket contents + min - the minimum value in the bucket + reverse_min - the reverse sort of the minimum value + max - the maximum value in the bucket + reverse_max - the reverse sort of the maximum value + mean - the mean value of the bucket contents + reverse_mean - the reverse sort of the mean value of bucket contents. + */ + order(o: string): TermStatsFacet; + + /* + Allows you to set script parameters to be used during the execution of the script. + */ + params(oParams: Object): TermStatsFacet; + + /* + Computes values across the the specified scope + */ + scope(scope: string): TermStatsFacet; + + /* + Sets a script that will provide the terms for a given document. + */ + scriptField(script: string): TermStatsFacet; + + /* + Sets the number of facet entries that will be returned for this facet. For instance, you + might ask for only the top 5 aggregate keys although there might be hundreds of + unique keys. Higher settings could cause memory strain. + */ + size(facetSize: number): TermStatsFacet; + + /* + Retrieves the internal facet object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the field for which statistical information will be generated. + */ + valueField(fieldName: string): TermStatsFacet; + + /* + Define a script to evaluate of which the result will be used to generate + the statistical information. + */ + valueScript(code: string): TermStatsFacet; + + } + + + /* + TermSuggester suggests terms based on edit distance. The provided suggest + text is analyzed before terms are suggested. The suggested terms are + provided per analyzed suggest text token. This leaves the suggest-selection + to the API consumer. For a higher level suggester, please use the + PhraseSuggester. + */ + export class TermSuggester implements Suggest { + + /* + A suggester that suggests terms based on edit distance. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the accuracy. How similar the suggested terms at least + need to be compared to the original suggest text. + */ + accuracy(a: number): TermSuggester; + + /* + Sets analyzer used to analyze the suggest text. + */ + analyzer(analyzer: string): TermSuggester; + + /* + Sets the field used to generate suggestions from. + */ + field(field: string): TermSuggester; + + /* + Sets the maximum edit distance candidate suggestions can have + in order to be considered as a suggestion. + */ + maxEdits(max: number): TermSuggester; + + /* + The factor that is used to multiply with the size in order + to inspect more candidate suggestions. + */ + maxInspections(max: number): TermSuggester; + + /* + Sets a maximum threshold in number of documents a suggest text + token can exist in order to be corrected. + */ + maxTermFreq(max: number): TermSuggester; + + /* + Sets a minimal threshold of the number of documents a suggested + term should appear in. + */ + minDocFreq(min: number): TermSuggester; + + /* + Sets the minimum length a suggest text term must have in order + to be corrected. + */ + minWordLen(len: number): TermSuggester; + + /* + Sets the maximum number of suggestions to be retrieved from + each individual shard. + */ + shardSize(s: number): TermSuggester; + + /* + Sets the number of suggestions returned for each token. + */ + size(s: number): TermSuggester; + + /* + Sets the sort mode. Valid values are: + + + score - Sort by score first, then document frequency, and then the term itself + frequency - Sort by document frequency first, then simlarity score and then the term itself + + */ + sort(s: string): TermSuggester; + + /* + Sets what string distance implementation to use for comparing + how similar suggested terms are. Valid values are: + + + internal - based on damerau_levenshtein but but highly optimized for comparing string distance for terms inside the index + damerau_levenshtein - String distance algorithm based on Damerau-Levenshtein algorithm + levenstein - String distance algorithm based on Levenstein edit distance algorithm + jarowinkler - String distance algorithm based on Jaro-Winkler algorithm + ngram - String distance algorithm based on character n-grams + + */ + stringDistance(s: string): TermSuggester; + + /* + Sets the suggest mode. Valid values are: + + + missing - Only suggest terms in the suggest text that aren't in the index + popular - Only suggest suggestions that occur in more docs then the original suggest text term + always - Suggest any matching suggestions based on terms in the suggest text + + */ + suggestMode(m: string): TermSuggester; + + /* + Sets the text to get suggestions for. If not set, the global + suggestion text will be used. + */ + text(txt: string): TermSuggester; + + /* + Retrieves the internal suggest object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + TThe top_children query runs the child query with an estimated hits size, + and out of the hit docs, aggregates it into parent docs. If there aren’t + enough parent docs matching the requested from/size search request, then it + is run again with a wider (more hits) search. + + The top_children also provide scoring capabilities, with the ability to + specify max, sum or avg as the score type. + */ + export class TopChildrenQuery implements Query { + + /* + Returns child documents matching the query aggregated into the parent docs. + */ + constructor(qry: Object, type: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: number): TopChildrenQuery; + + /* + Sets the factor which is the number of hits that are asked for in + the child query. Defaults to 5. + */ + factor(f: number): TopChildrenQuery; + + /* + Sets the incremental factor. The incremental factor is used when not + enough child documents are returned so the factor is multiplied by + the incremental factor to fetch more results. Defaults to 52 + */ + incrementalFactor(f: number): TopChildrenQuery; + + /* + Sets the query + */ + query(q: Object): TopChildrenQuery; + + /* + Sets the scope of the query. A scope allows to run facets on the + same scope name that will work against the child documents. + */ + scope(s: string): TopChildrenQuery; + + /* + Sets the scoring type. Valid values are max, sum, or avg. If + another value is passed it we silently ignore the value. + */ + score(s: string): TopChildrenQuery; + + /* + Sets the scoring type. Valid values are max, sum, total, or avg. + If another value is passed it we silently ignore the value. + */ + scoreMode(s: string): TopChildrenQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the child document type to search against + */ + type(t: string): TopChildrenQuery; + + } + + + /* + A Filter that filters results by a specified index type. + */ + export class TypeFilter implements Filter { + + /* + Filter results by a specified index type. + */ + constructor(type: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Enable or disable caching of the filter + */ + cache(trueFalse: boolean): TypeFilter; + + /* + Sets the cache key. + */ + cacheKey(key: string): TypeFilter; + + /* + Sets the filter name. + */ + name(name: string): TypeFilter; + + /* + Returns the filter object. + */ + toJSON(): TypeFilter; + + /* + Sets the type + */ + type(type: string): TypeFilter; + + } + + + /* + A single-value metrics aggregation that counts the number of values that + are extracted from the aggregated documents. These values can be extracted + either from specific fields in the documents, or be generated by a provided + script. Typically, this aggregator will be used in conjunction with other + single-value aggregations. + */ + export class ValueCountAggregation implements Aggregation { + + /* + Aggregation that counts the number of values that are extracted from the + aggregated documents. + */ + constructor(name: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the field to operate on. + */ + field(field: string): ValueCountAggregation; + + /* + The script language being used. + */ + lang(language: string): ValueCountAggregation; + + /* + Sets parameters that will be applied to the script. Overwrites + any existing params. + */ + params(p: Object): ValueCountAggregation; + + /* + Allows you generate or modify the terms/values using a script. + */ + script(scriptCode: string): ValueCountAggregation; + + /* + Set to true to assume script values are unique. + */ + scriptValuesUnique(trueFalse: boolean): ValueCountAggregation; + + /* + Retrieves the internal agg object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + } + + + /* + Matches documents that have fields matching a wildcard expression + (not analyzed). Supported wildcards are *, which matches any character + sequence (including the empty one), and ?, which matches any single + character. Note this query can be slow, as it needs to iterate over many + wildcards. In order to prevent extremely slow wildcard queries, a wildcard + wildcard should not start with one of the wildcards * or ?. The wildcard query + maps to Lucene WildcardQuery. + */ + export class WildcardQuery implements Query { + + /* + A Query that matches documents containing a wildcard. This may be + combined with other wildcards with a BooleanQuery. + */ + constructor(field: string, value: string); + + /* + The type of ejs object. For internal use only. + */ + _type(): String; + + /* + Sets the boost value for documents matching the Query. + */ + boost(boost: Number): WildcardQuery; + + /* + Sets the fields to query against. + */ + field(f: string): WildcardQuery; + + /* + Sets rewrite method. Valid values are: + + constant_score_auto - tries to pick the best constant-score rewrite + method based on term and document counts from the query + + scoring_boolean - translates each term into boolean should and + keeps the scores as computed by the query + + constant_score_boolean - same as scoring_boolean, expect no scores + are computed. + + constant_score_filter - first creates a private Filter, by visiting + each term in sequence and marking all docs for that term + + top_terms_boost_N - first translates each term into boolean should + and scores are only computed as the boost using the top N + scoring terms. Replace N with an integer value. + + top_terms_N - first translates each term into boolean should + and keeps the scores as computed by the query. Only the top N + scoring terms are used. Replace N with an integer value. + + Default is constant_score_auto. + + This is an advanced option, use with care. + */ + rewrite(m: string): WildcardQuery; + + /* + Retrieves the internal query object. This is typically used by + internal API functions so use with caution. + */ + toJSON(): String; + + /* + Sets the wildcard query value. + */ + value(v: string): WildcardQuery; + + } + +} From 2093695943eb91a82fe2602a7914ef24e000ba79 Mon Sep 17 00:00:00 2001 From: David Lee Date: Tue, 2 Aug 2016 11:51:39 -0500 Subject: [PATCH 74/79] clean re-insert of my changes, hopefully without the indentation baggage --- aws-sdk/aws-sdk.d.ts | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index a633b96206..f061353812 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -233,6 +233,8 @@ declare module "aws-sdk" { getSignedUrl(operation: string, params: any): string; getSignedUrl(operation: string, params: any, callback: (err: Error, url: string) => void): void; upload(params?: s3.PutObjectRequest, options?: s3.UploadOptions, callback?: (err: Error, data: any) => void): void; + listObjects(params: s3.ListObjectRequest, callback: (err: Error, data: s3.ListObjectResponse) => void): void; + listObjectsV2(params: s3.ListObjectV2Request, callback: (err: Error, data: s3.ListObjectV2Response) => void): void; } export class STS { @@ -1479,6 +1481,45 @@ declare module "aws-sdk" { } export module s3 { + interface Owner { + DisplayName: string; + ID: string; + } + + interface ObjectKeyPrefix { + Prefix: string; + } + + export interface ListObjectContent { + Key: string; + LastModified: Date; + ETag: string; + Size: number; + StorageClass: "STANDARD" | "REDUCED_REDUNDANCY" | "GLACIER"; + Owner?: Owner + } + + // This private interface contains the common parts between v1 and v2 of the API Request and is exposed via V1 and V2 subclasses + interface ListObjectRequestBase { + Bucket: string; + Delimiter?: string; + EncodingType?: 'url'; + MaxKeys?: number; + Prefix?: string; + } + + // This private interface contains the common parts between v1 and v2 of the API Response and is exposed via V1 and V2 subclasses + interface ListObjectResponseBase { + IsTruncated: boolean; + Contents: ListObjectContent[]; + Name: string; + Prefix?: string; + Delimiter?: string; + MaxKeys: number; + CommonPrefixes?: ObjectKeyPrefix[]; + EncodingType?: "url"; + } + export interface PutObjectRequest { ACL?: string; Body?: any; @@ -1546,6 +1587,28 @@ declare module "aws-sdk" { partSize?: number; queueSize?: number; } + + export interface ListObjectRequest extends ListObjectRequestBase { + Marker?: string; + } + + export interface ListObjectV2Request extends ListObjectRequestBase { + ContinuationToken?: string; + FetchOwner?: boolean; + StartAfter?: string; + } + + export interface ListObjectResponse extends ListObjectResponseBase { + Marker?: string; + NextMarker?: string; + } + + export interface ListObjectV2Response extends ListObjectResponseBase { + KeyCount: number; + ContinuationToken?: string; + NextContinuationToken?: string; + StartAfter?: string; + } } export module ecs { From 613673de3672114c562fdf9f142bfeefc29173c9 Mon Sep 17 00:00:00 2001 From: Rand Scullard Date: Tue, 2 Aug 2016 15:15:55 -0400 Subject: [PATCH 75/79] react: Add all remaining SVG elements except deprecated ones. --- react/react.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/react/react.d.ts b/react/react.d.ts index da99fc737a..82c427027b 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -2478,6 +2478,7 @@ declare namespace JSX { circle: React.SVGProps; clipPath: React.SVGProps; defs: React.SVGProps; + desc: React.SVGProps; ellipse: React.SVGProps; feBlend: React.SVGProps; feColorMatrix: React.SVGProps; @@ -2486,15 +2487,21 @@ declare namespace JSX { feConvolveMatrix: React.SVGProps; feDiffuseLighting: React.SVGProps; feDisplacementMap: React.SVGProps; + feDistantLight: React.SVGProps; feFlood: React.SVGProps; feFuncA: React.SVGProps; + feFuncB: React.SVGProps; + feFuncG: React.SVGProps; + feFuncR: React.SVGProps; feGaussianBlur: React.SVGProps; feImage: React.SVGProps; feMerge: React.SVGProps; feMergeNode: React.SVGProps; feMorphology: React.SVGProps; feOffset: React.SVGProps; + fePointLight: React.SVGProps; feSpecularLighting: React.SVGProps; + feSpotLight: React.SVGProps; feTile: React.SVGProps; feTurbulence: React.SVGProps; filter: React.SVGProps; @@ -2505,6 +2512,7 @@ declare namespace JSX { linearGradient: React.SVGProps; marker: React.SVGProps; mask: React.SVGProps; + metadata: React.SVGProps; path: React.SVGProps; pattern: React.SVGProps; polygon: React.SVGProps; @@ -2512,10 +2520,12 @@ declare namespace JSX { radialGradient: React.SVGProps; rect: React.SVGProps; stop: React.SVGProps; + switch: React.SVGProps; symbol: React.SVGProps; text: React.SVGProps; textPath: React.SVGProps; tspan: React.SVGProps; use: React.SVGProps; + view: React.SVGProps; } } From b1804143dc6d6d85f19bdc9e850d2e4cac531486 Mon Sep 17 00:00:00 2001 From: "E.G. Hornbostel" Date: Tue, 2 Aug 2016 12:39:27 -0700 Subject: [PATCH 76/79] Added SearchResponse for search methods. --- elasticsearch/elasticsearch.d.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/elasticsearch/elasticsearch.d.ts b/elasticsearch/elasticsearch.d.ts index d32b2a8845..bd9f820c5e 100644 --- a/elasticsearch/elasticsearch.d.ts +++ b/elasticsearch/elasticsearch.d.ts @@ -23,8 +23,8 @@ declare module Elasticsearch { ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void; scroll(params: ScrollParams): PromiseLike; scroll(params: ScrollParams, callback: (error: any, response: any) => void): void; - search(params: SearchParams): PromiseLike; - search(params: SearchParams, callback: (error: any, response: any) => void): void; + search(params: SearchParams): PromiseLike>; + search(params: SearchParams, callback: (error: any, response: SearchResponse) => void): void; suggest(params: SuggestParams): PromiseLike; suggest(params: SuggestParams, callback: (error: any, response: any) => void): void; update(params: UpdateDocumentParams): PromiseLike; @@ -219,6 +219,28 @@ declare module Elasticsearch { timeout?: Date | number; } + export interface SearchResponse { + took: number, + timed_out: boolean, + _shards: { + total: number, + successful: number, + failed: number + }, + hits: { + total: number, + max_score: number, + hits: { + _index: string, + _type: string, + _id: string, + _score: number, + _source: T + }[] + }, + aggregations: any + } + export interface MSearchParams extends GenericParams { index?: string | string[] | Boolean; type?: string | string[] | Boolean; From 39d97a1817b0cebad032e23a5f7ebce556e825f7 Mon Sep 17 00:00:00 2001 From: Vicky Lai Date: Thu, 28 Jul 2016 17:21:42 -0700 Subject: [PATCH 77/79] Fix value type for react-select --- react-select/react-select-tests.tsx | 19 +++++++++++++++++++ react-select/react-select.d.ts | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index 7b8027123d..de45b52d32 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -141,6 +141,25 @@ class SelectTest extends React.Component, {}> { } } +class SelectWithStringValueTest extends React.Component, {}> { + + render() { + const options: Option[] = [{ label: "Foo", value: "bar" }]; + const onChange = (value: any) => console.log(value); + + const selectProps: ReactSelectProps = { + name: "test-select-with-string-value", + value: "bar", + options: options, + onChange: onChange + }; + + return
+