mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge remote-tracking branch 'DefinitelyTyped/master'
This commit is contained in:
@@ -2,6 +2,7 @@ Please fill in this template.
|
||||
|
||||
- [ ] Use a meaningful title for the pull request. Include the name of the package modified.
|
||||
- [ ] Test the change in your own code. (Compile and run.)
|
||||
- [ ] Add or edit tests to reflect the change. (Run with `npm test`.)
|
||||
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).
|
||||
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).
|
||||
- [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).
|
||||
|
||||
@@ -173,6 +173,12 @@
|
||||
"typingsPackageName": "bignumber.js",
|
||||
"sourceRepoURL": "https://github.com/MikeMcl/bignumber.js/",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "bingmaps",
|
||||
"typingsPackageName": "bingmaps",
|
||||
"sourceRepoURL": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions",
|
||||
"asOfVersion": "2.0.15"
|
||||
},
|
||||
{
|
||||
"libraryName": "botvs",
|
||||
|
||||
Vendored
+5
-1
@@ -52,6 +52,10 @@ declare namespace AceAjax {
|
||||
export interface TokenInfo {
|
||||
|
||||
value: string;
|
||||
|
||||
index?: number;
|
||||
|
||||
start?: number;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
@@ -575,7 +579,7 @@ declare namespace AceAjax {
|
||||
* @param row The row number to retrieve from
|
||||
* @param column The column number to retrieve from
|
||||
**/
|
||||
getTokenAt(row: number, column: number): TokenInfo;
|
||||
getTokenAt(row: number, column: number): TokenInfo|null;
|
||||
|
||||
/**
|
||||
* Sets the undo manager.
|
||||
|
||||
Vendored
+3
-6
@@ -16,16 +16,13 @@
|
||||
declare var AFRAME: AFrame.AFrameGlobal;
|
||||
declare var hasNativeWebVRImplementation: boolean;
|
||||
|
||||
interface NodeSelector {
|
||||
querySelector(selectors: 'a-scene'): AFrame.Scene;
|
||||
interface Document {
|
||||
createElement(tagName: string): AFrame.Entity;
|
||||
querySelector(selectors: 'a-scene'): AFrame.Scene;
|
||||
querySelector<T extends AFrame.Entity<any>>(selectors: string): T;
|
||||
querySelectorAll(selectors: string): NodeListOf<AFrame.Entity<any> | Element>;
|
||||
}
|
||||
|
||||
interface Document {
|
||||
createElement(tagName: string): AFrame.Entity;
|
||||
}
|
||||
|
||||
// Interfaces
|
||||
declare namespace AFrame {
|
||||
interface ObjectMap<T = any> {
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for amqplib 0.5
|
||||
// Project: https://github.com/squaremo/amqp.node
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>, Nick Zelei <https://github.com/zelein>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+48
-2
@@ -141,6 +141,52 @@ export namespace Options {
|
||||
|
||||
export interface Message {
|
||||
content: Buffer;
|
||||
fields: any;
|
||||
properties: any;
|
||||
fields: MessageFields;
|
||||
properties: MessageProperties;
|
||||
}
|
||||
|
||||
export interface MessageFields {
|
||||
deliveryTag: number;
|
||||
redelivered: boolean;
|
||||
exchange: string;
|
||||
routingKey: string;
|
||||
messageCount: string;
|
||||
}
|
||||
|
||||
export interface MessageProperties {
|
||||
contentType: any | undefined;
|
||||
contentEncoding: any | undefined;
|
||||
headers: MessagePropertyHeaders;
|
||||
deliveryMode: any | undefined;
|
||||
priority: any | undefined;
|
||||
correlationId: any | undefined;
|
||||
replyTo: any | undefined;
|
||||
expiration: any | undefined;
|
||||
messageId: any | undefined;
|
||||
timestamp: any | undefined;
|
||||
type: any | undefined;
|
||||
userId: any | undefined;
|
||||
appId: any | undefined;
|
||||
clusterId: any | undefined;
|
||||
}
|
||||
|
||||
export interface MessagePropertyHeaders {
|
||||
"x-first-death-exchange"?: string;
|
||||
"x-first-death-queue"?: string;
|
||||
"x-first-death-reason"?: string;
|
||||
"x-death"?: XDeath[];
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface XDeath {
|
||||
count: number;
|
||||
reason: "rejected" | "expired" | "maxlen";
|
||||
queue: string;
|
||||
time: {
|
||||
"!": "timestamp";
|
||||
value: number;
|
||||
};
|
||||
exchange: string;
|
||||
"original-expiration"?: any;
|
||||
"routing-keys": string[];
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ $routeProvider
|
||||
}
|
||||
})
|
||||
.otherwise({ redirectTo: '/' })
|
||||
.otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" });
|
||||
.otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" })
|
||||
.otherwise("/");
|
||||
|
||||
|
||||
var current: ng.route.ICurrentRoute;
|
||||
|
||||
Vendored
+1
-1
@@ -138,7 +138,7 @@ declare module 'angular' {
|
||||
*
|
||||
* @params Mapping information to be assigned to $route.current.
|
||||
*/
|
||||
otherwise(params: IRoute): IRouteProvider;
|
||||
otherwise(params: IRoute | string): IRouteProvider;
|
||||
/**
|
||||
* Adds a new route definition to the $route service.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import arrayUnique = require("array-unique");
|
||||
|
||||
arrayUnique([1, 1, 2, 3, 3]);
|
||||
|
||||
arrayUnique(["foo", "foo", "bar", "foo"]);
|
||||
|
||||
arrayUnique.immutable([1, 1, 2, 3, 3]);
|
||||
|
||||
arrayUnique.immutable(["foo", "foo", "bar", "foo"]);
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for array-unique 0.3
|
||||
// Project: https://github.com/jonschlinkert/array-unique
|
||||
// Definitions by: Michaël St-Georges <https://github.com/CSLTech>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function arrayUnique<T>(arr: T[]): T[];
|
||||
|
||||
declare namespace arrayUnique {
|
||||
function immutable<T>(arr: ReadonlyArray<T>): T[];
|
||||
}
|
||||
|
||||
export = arrayUnique;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"array-unique-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/sporto/assets-webpack-plugin
|
||||
// Definitions by: Michael Strobel <https://github.com/kryops>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
|
||||
Vendored
+19
-41
@@ -7,6 +7,7 @@
|
||||
export as namespace async;
|
||||
|
||||
export interface Dictionary<T> { [key: string]: T; }
|
||||
export type IterableCollection<T> = T[] | IterableIterator<T> | Dictionary<T>
|
||||
|
||||
export interface ErrorCallback<T> { (err?: T): void; }
|
||||
export interface AsyncBooleanResultCallback<E> { (err?: E, truthValue?: boolean): void; }
|
||||
@@ -36,11 +37,9 @@ export interface AsyncQueue<T> {
|
||||
running(): number;
|
||||
idle(): boolean;
|
||||
concurrency: number;
|
||||
push<E>(task: T, callback?: ErrorCallback<E>): void;
|
||||
push<E>(task: T | T[], callback?: ErrorCallback<E>): void;
|
||||
push<R,E>(task: T, callback?: AsyncResultCallback<R, E>): void;
|
||||
push<E>(task: T[], callback?: ErrorCallback<E>): void;
|
||||
unshift<E>(task: T, callback?: ErrorCallback<E>): void;
|
||||
unshift<E>(task: T[], callback?: ErrorCallback<E>): void;
|
||||
unshift<E>(task: T | T[], callback?: ErrorCallback<E>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
@@ -62,8 +61,7 @@ export interface AsyncPriorityQueue<T> {
|
||||
concurrency: number;
|
||||
started: boolean;
|
||||
paused: boolean;
|
||||
push<R,E>(task: T, priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
push<R,E>(task: T[], priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
push<R,E>(task: T | T[], priority: number, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
@@ -86,7 +84,6 @@ export interface AsyncCargo {
|
||||
length(): number;
|
||||
payload?: number;
|
||||
push(task: any, callback? : Function): void;
|
||||
push(task: any[], callback? : Function): void;
|
||||
saturated(): void;
|
||||
empty(): void;
|
||||
drain(): void;
|
||||
@@ -97,39 +94,28 @@ export interface AsyncCargo {
|
||||
}
|
||||
|
||||
// Collections
|
||||
export function each<T, E>(arr: T[] | IterableIterator<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function each<T, E>(arr: Dictionary<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function each<T, E>(arr: IterableCollection<T>, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export const eachSeries: typeof each;
|
||||
export function eachLimit<T, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function eachLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function eachLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export const forEach: typeof each;
|
||||
export const forEachSeries: typeof each;
|
||||
export const forEachLimit: typeof eachLimit;
|
||||
export function forEachOf<T, E>(obj: T[] | IterableIterator<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function forEachOf<T, E>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function forEachOf<T, E>(obj: IterableCollection<T>, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export const forEachOfSeries: typeof forEachOf;
|
||||
export function forEachOfLimit<T, E>(obj: T[] | IterableIterator<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function forEachOfLimit<T, E>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export function forEachOfLimit<T, E>(obj: IterableCollection<T>, limit: number, iterator: AsyncForEachOfIterator<T, E>, callback?: ErrorCallback<E>): void;
|
||||
export const eachOf: typeof forEachOf;
|
||||
export const eachOfSeries: typeof forEachOf;
|
||||
export const eachOfLimit: typeof forEachOfLimit;
|
||||
export function map<T, R, E>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function map<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export const mapSeries: typeof map;
|
||||
export function mapLimit<T, R, E>(
|
||||
arr: T[] | Dictionary<T> | IterableIterator<T>,
|
||||
limit: number,
|
||||
iterator: AsyncResultIterator<T, R, E>,
|
||||
callback?: AsyncResultArrayCallback<R, E>
|
||||
): void;
|
||||
export function mapLimit<T, R, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R, E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function mapValuesLimit<T, R, E>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
|
||||
export function mapValues<T, R, E>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R, E>) => void, callback: AsyncResultObjectCallback<R, E>): void;
|
||||
export const mapValuesSeries: typeof mapValues;
|
||||
export function filter<T, E>(arr: T[] | IterableIterator<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export function filter<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export function filter<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export const filterSeries: typeof filter;
|
||||
export function filterLimit<T, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export function filterLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export function filterLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export const select: typeof filter;
|
||||
export const selectSeries: typeof filter;
|
||||
export const selectLimit: typeof filterLimit;
|
||||
@@ -141,36 +127,28 @@ export const inject: typeof reduce;
|
||||
export const foldl: typeof reduce;
|
||||
export const reduceRight: typeof reduce;
|
||||
export const foldr: typeof reduce;
|
||||
export function detect<T, E>(arr: T[] | IterableIterator<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
|
||||
export function detect<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
|
||||
export function detect<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
|
||||
export const detectSeries: typeof detect;
|
||||
export function detectLimit<T, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
|
||||
export function detectLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
|
||||
export function detectLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncResultCallback<T, E>): void;
|
||||
export const find: typeof detect;
|
||||
export const findSeries: typeof detect;
|
||||
export const findLimit: typeof detectLimit;
|
||||
export function sortBy<T, V, E>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, V, E>, callback?: AsyncResultArrayCallback<T, E>): void;
|
||||
export function some<T, E>(arr: T[] | IterableIterator<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function some<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function some<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export const someSeries: typeof some;
|
||||
export function someLimit<T, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function someLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function someLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export const any: typeof some;
|
||||
export const anySeries: typeof someSeries;
|
||||
export const anyLimit: typeof someLimit;
|
||||
export function every<T, E>(arr: T[] | IterableIterator<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function every<T, E>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function every<T, E>(arr: IterableCollection<T>, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export const everySeries: typeof every;
|
||||
export function everyLimit<T, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function everyLimit<T, E>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export function everyLimit<T, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncBooleanIterator<T, E>, callback?: AsyncBooleanResultCallback<E>): void;
|
||||
export const all: typeof every;
|
||||
export const allSeries: typeof every;
|
||||
export const allLimit: typeof everyLimit;
|
||||
|
||||
export function concat<T, R, E>(arr: T[] | IterableIterator<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function concat<T, R, E>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function concatLimit<T, R, E>(arr: T[] | IterableIterator<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function concatLimit<T, R, E>(arr: Dictionary<T>, limit: number,iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function concat<T, R, E>(arr: IterableCollection<T>, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export function concatLimit<T, R, E>(arr: IterableCollection<T>, limit: number, iterator: AsyncResultIterator<T, R[], E>, callback?: AsyncResultArrayCallback<R, E>): void;
|
||||
export const concatSeries: typeof concat;
|
||||
|
||||
// Control Flow
|
||||
|
||||
@@ -719,6 +719,9 @@ function testDisplayMarker() {
|
||||
|
||||
// DisplayMarkerLayer =========================================================
|
||||
function testDisplayMarkerLayer() {
|
||||
// Properties
|
||||
str = displayMarkerLayer.id;
|
||||
|
||||
// Lifecycle
|
||||
displayMarkerLayer.destroy();
|
||||
displayMarkerLayer.clear();
|
||||
@@ -1275,6 +1278,9 @@ function testMarker() {
|
||||
|
||||
// MarkerLayer ================================================================
|
||||
function testMarkerLayer() {
|
||||
// Properties
|
||||
str = markerLayer.id;
|
||||
|
||||
// Lifecycle
|
||||
markerLayer = markerLayer.copy();
|
||||
bool = markerLayer.destroy();
|
||||
|
||||
Vendored
+54
-45
@@ -9,7 +9,6 @@
|
||||
// NOTE: only those classes exported within this file should be retain that status below.
|
||||
// https://github.com/atom/atom/blob/v1.24.0/exports/atom.js
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="node" />
|
||||
|
||||
import { ReadStream, WriteStream } from "fs";
|
||||
@@ -40,58 +39,58 @@ export function watchPath(rootPath: string, options: {}, eventCallback: (events:
|
||||
export interface AtomEnvironment {
|
||||
// Properties
|
||||
/** A CommandRegistry instance. */
|
||||
commands: CommandRegistry;
|
||||
readonly commands: CommandRegistry;
|
||||
|
||||
/** A Config instance. */
|
||||
config: Config;
|
||||
readonly config: Config;
|
||||
|
||||
/** A Clipboard instance. */
|
||||
clipboard: Clipboard;
|
||||
readonly clipboard: Clipboard;
|
||||
|
||||
/** A ContextMenuManager instance. */
|
||||
contextMenu: ContextMenuManager;
|
||||
readonly contextMenu: ContextMenuManager;
|
||||
|
||||
/** A MenuManager instance. */
|
||||
menu: MenuManager;
|
||||
readonly menu: MenuManager;
|
||||
|
||||
/** A KeymapManager instance. */
|
||||
keymaps: KeymapManager;
|
||||
readonly keymaps: KeymapManager;
|
||||
|
||||
/** A TooltipManager instance. */
|
||||
tooltips: TooltipManager;
|
||||
readonly tooltips: TooltipManager;
|
||||
|
||||
/** A NotificationManager instance. */
|
||||
notifications: NotificationManager;
|
||||
readonly notifications: NotificationManager;
|
||||
|
||||
/** A Project instance. */
|
||||
project: Project;
|
||||
readonly project: Project;
|
||||
|
||||
/** A GrammarRegistry instance. */
|
||||
grammars: GrammarRegistry;
|
||||
readonly grammars: GrammarRegistry;
|
||||
|
||||
/** A HistoryManager instance. */
|
||||
history: HistoryManager;
|
||||
readonly history: HistoryManager;
|
||||
|
||||
/** A PackageManager instance. */
|
||||
packages: PackageManager;
|
||||
readonly packages: PackageManager;
|
||||
|
||||
/** A ThemeManager instance. */
|
||||
themes: ThemeManager;
|
||||
readonly themes: ThemeManager;
|
||||
|
||||
/** A StyleManager instance. */
|
||||
styles: StyleManager;
|
||||
readonly styles: StyleManager;
|
||||
|
||||
/** A DeserializerManager instance. */
|
||||
deserializers: DeserializerManager;
|
||||
readonly deserializers: DeserializerManager;
|
||||
|
||||
/** A ViewRegistry instance. */
|
||||
views: ViewRegistry;
|
||||
readonly views: ViewRegistry;
|
||||
|
||||
/** A Workspace instance. */
|
||||
workspace: Workspace;
|
||||
readonly workspace: Workspace;
|
||||
|
||||
/** A TextEditorRegistry instance. */
|
||||
textEditors: TextEditorRegistry;
|
||||
readonly textEditors: TextEditorRegistry;
|
||||
|
||||
// Event Subscription
|
||||
/** Invoke the given callback whenever ::beep is called. */
|
||||
@@ -447,7 +446,7 @@ export interface Config {
|
||||
*/
|
||||
export interface Decoration {
|
||||
/** The identifier for this Decoration. */
|
||||
id: number;
|
||||
readonly id: number;
|
||||
|
||||
// Construction and Destruction
|
||||
/**
|
||||
@@ -654,6 +653,9 @@ export interface DisplayMarker {
|
||||
* This API is experimental and subject to change on any release.
|
||||
*/
|
||||
export interface DisplayMarkerLayer {
|
||||
/** The identifier for the underlying MarkerLayer. */
|
||||
readonly id: string;
|
||||
|
||||
// Lifecycle
|
||||
/** Destroy this layer. */
|
||||
destroy(): void;
|
||||
@@ -837,7 +839,7 @@ export interface LayerDecoration {
|
||||
*/
|
||||
export interface Marker {
|
||||
/** The identifier for this Marker. */
|
||||
id: number;
|
||||
readonly id: number;
|
||||
|
||||
// Lifecycle
|
||||
/**
|
||||
@@ -949,6 +951,9 @@ export interface Marker {
|
||||
|
||||
/** Experimental: A container for a related set of markers. */
|
||||
export interface MarkerLayer {
|
||||
/** The identifier for this MarkerLayer. */
|
||||
readonly id: string;
|
||||
|
||||
// Lifecycle
|
||||
/** Create a copy of this layer with markers in the same state and locations. */
|
||||
copy(): MarkerLayer;
|
||||
@@ -1031,7 +1036,7 @@ export class Notification {
|
||||
/** A notification manager used to create Notifications to be shown to the user. */
|
||||
export interface NotificationManager {
|
||||
// Properties
|
||||
notifications: Notification[];
|
||||
readonly notifications: Notification[];
|
||||
|
||||
// Events
|
||||
/** Invoke the given callback after a notification has been added. */
|
||||
@@ -1267,8 +1272,8 @@ export class Range {
|
||||
* including cursor and selection positions, folds, and soft wraps.
|
||||
*/
|
||||
export class TextEditor {
|
||||
id: number;
|
||||
buffer: TextBuffer;
|
||||
readonly id: number;
|
||||
readonly buffer: TextBuffer;
|
||||
|
||||
// NOTE: undocumented within the public API. Don't go down the rabbit hole.
|
||||
constructor(options?: object);
|
||||
@@ -2519,6 +2524,10 @@ export interface TextEditorRegistry {
|
||||
observe(callback: (editor: TextEditor) => void): Disposable;
|
||||
}
|
||||
|
||||
export interface JQueryCompatible<Element extends Node = HTMLElement> extends Iterable<Element> {
|
||||
jquery: string;
|
||||
}
|
||||
|
||||
export type TooltipPlacement =
|
||||
|"top"|"bottom"|"left"|"right"
|
||||
|"auto"|"auto top"|"auto bottom"|"auto left"|"auto right";
|
||||
@@ -2526,7 +2535,7 @@ export type TooltipPlacement =
|
||||
/** Associates tooltips with HTML elements or selectors. */
|
||||
export interface TooltipManager {
|
||||
/** Add a tooltip to the given element. */
|
||||
add(target: HTMLElement, options: {
|
||||
add(target: HTMLElement | JQueryCompatible, options: {
|
||||
item?: object,
|
||||
} | {
|
||||
title?: string|(() => string),
|
||||
@@ -2975,7 +2984,7 @@ export interface WorkspaceCenter {
|
||||
* Node's ChildProcess.
|
||||
*/
|
||||
export class BufferedProcess {
|
||||
process?: ChildProcess;
|
||||
readonly process?: ChildProcess;
|
||||
|
||||
constructor(options: ProcessOptions);
|
||||
|
||||
@@ -4043,10 +4052,10 @@ export interface MenuManager {
|
||||
*/
|
||||
export interface Package {
|
||||
/** The name of the Package. */
|
||||
name: string;
|
||||
readonly name: string;
|
||||
|
||||
/** The path to the Package on disk. */
|
||||
path: string;
|
||||
readonly path: string;
|
||||
|
||||
// Event Subscription
|
||||
/** Invoke the given callback when all packages have been activated. */
|
||||
@@ -4368,7 +4377,7 @@ export interface Pane {
|
||||
*/
|
||||
export interface Panel<T = object> {
|
||||
/** Whether or not the Panel is visible. */
|
||||
visible: boolean;
|
||||
readonly visible: boolean;
|
||||
|
||||
// Construction and Destruction
|
||||
/** Destroy and remove this panel from the UI. */
|
||||
@@ -4489,7 +4498,7 @@ export interface Project {
|
||||
* syntax tree to a token including all scope names for the entire path.
|
||||
*/
|
||||
export interface ScopeDescriptor {
|
||||
scopes: string[];
|
||||
readonly scopes: string[];
|
||||
|
||||
/** Returns all scopes for this descriptor. */
|
||||
getScopesArray(): string[];
|
||||
@@ -4885,13 +4894,13 @@ export class Task {
|
||||
*/
|
||||
export class TextBuffer {
|
||||
/** The unique identifier for this buffer. */
|
||||
id: string;
|
||||
readonly id: string;
|
||||
|
||||
/** The number of retainers for the buffer. */
|
||||
refcount: number;
|
||||
readonly refcount: number;
|
||||
|
||||
/** Whether or not the bufffer has been destroyed. */
|
||||
destroyed: boolean;
|
||||
readonly destroyed: boolean;
|
||||
|
||||
/** Create a new buffer backed by the given file path. */
|
||||
static load(filePath: string, params?: BufferLoadOptions): Promise<TextBuffer>;
|
||||
@@ -6744,11 +6753,11 @@ export interface TokenizeLineResult {
|
||||
* jQuery, which is an expensive dependency we want to eliminate.
|
||||
*/
|
||||
export interface Tooltip {
|
||||
options: TooltipOptions;
|
||||
enabled: boolean;
|
||||
timeout: number;
|
||||
hoverState: "in"|"out"|null;
|
||||
element: JQuery|HTMLElement;
|
||||
readonly options: TooltipOptions;
|
||||
readonly enabled: boolean;
|
||||
readonly timeout: number;
|
||||
readonly hoverState: "in"|"out"|null;
|
||||
readonly element: HTMLElement;
|
||||
|
||||
getTitle(): string;
|
||||
getTooltipElement(): HTMLElement;
|
||||
@@ -6765,11 +6774,11 @@ export interface ViewModel {
|
||||
}
|
||||
|
||||
export interface WindowLoadSettings {
|
||||
appVersion: string;
|
||||
atomHome: string;
|
||||
devMode: boolean;
|
||||
resourcePath: string;
|
||||
safeMode: boolean;
|
||||
env?: { [key: string]: string|undefined };
|
||||
profileStartup?: boolean;
|
||||
readonly appVersion: string;
|
||||
readonly atomHome: string;
|
||||
readonly devMode: boolean;
|
||||
readonly resourcePath: string;
|
||||
readonly safeMode: boolean;
|
||||
readonly env?: { [key: string]: string|undefined };
|
||||
readonly profileStartup?: boolean;
|
||||
}
|
||||
|
||||
Vendored
-112
@@ -1,112 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
/** Options used to customize the autosuggest functionality. */
|
||||
export interface IAutosuggestOptions {
|
||||
/** Specifies if street address suggestions should be returned. Default: true */
|
||||
addressSuggestions?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies if the user’s location should be auto detected using their IP address, if no location information is provided
|
||||
* in the userLocation property. Default: true
|
||||
*/
|
||||
autoDetectLocation?: boolean;
|
||||
|
||||
/**
|
||||
* A bounding box that is used to help influence the results such that locations that are in or near this bounding box
|
||||
* are given more weight than they would normally.
|
||||
*/
|
||||
bounds?: LocationRect;
|
||||
|
||||
/**
|
||||
* A reference to a map instance. If the useMapView property is set to true, the bounding box of the map view will be used
|
||||
* to influence the weight of suggestions.
|
||||
*/
|
||||
map?: Map;
|
||||
|
||||
/** The maximum number of results to return. Can be any value between 1 and 10. Default: 5 */
|
||||
maxResults?: number;
|
||||
|
||||
/** Specifies if place suggestions (city, landmark, etc.) should be returned. Default: true */
|
||||
placeSuggestions?: boolean;
|
||||
|
||||
/**
|
||||
* Indicates if the maps bounding box should be used to influence the suggested results. Ignored if the bounds property is
|
||||
* set. Default: true
|
||||
*/
|
||||
useMapView?: boolean;
|
||||
|
||||
/** A coordinate indicating where the user is located. This will influence the results to be more relevant to the user. */
|
||||
userLocation?: Location;
|
||||
}
|
||||
|
||||
/** Represents the suggestion result from the Autosuggest manager. */
|
||||
export interface ISuggestionResult {
|
||||
/** A structured address object for the result. */
|
||||
address: IAddress;
|
||||
|
||||
/** A LocationRect that can be used to set the map view over the result. */
|
||||
bestView: LocationRect;
|
||||
|
||||
/** Unique entity id to be used for searching the entity. */
|
||||
entityId: string;
|
||||
|
||||
/** The type of the result; Address, Place */
|
||||
entityType: string;
|
||||
|
||||
/** The sub type of result; Address, RoadBlock, PopulatedPlace, CountryRegion, etc. */
|
||||
entitySubType: string;
|
||||
|
||||
/** A nicely formatted suggestion string for the result based on market. */
|
||||
formattedSuggestion: string;
|
||||
|
||||
/**
|
||||
* The coordinate of the result. This value is only returned for place (city, landmarks) results and not for addresses.
|
||||
* Street addresses will need to be geocoded to get their location.
|
||||
*/
|
||||
location: Location;
|
||||
|
||||
/** A secondary title that provides additional context to the title value of the suggestion. **/
|
||||
subtitle: string;
|
||||
|
||||
/** The display title for the result (i.e. “Redmond”). */
|
||||
title: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The AutosuggestManager is the primary class in the Autosuggest module that powers the autosuggest functionality.
|
||||
* @requires The Microsoft.Maps.Autosuggest module.
|
||||
*/
|
||||
export class AutosuggestManager {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Autosuggest module.
|
||||
* @param options The options to use with the autosuggest manager.
|
||||
*/
|
||||
constructor(options?: IAutosuggestOptions);
|
||||
|
||||
/**
|
||||
* Attaches the Autosuggest functionality to an input box.
|
||||
* @param suggestionBoxId The HTML element identifier of the input box.
|
||||
* @param suggestionContainerId The Id of container where suggestions will be displayed.
|
||||
* @param selectedSuggestionCallback A reference to a callback function that will be called when a user selects a suggestion from the Autosuggest UI.
|
||||
*/
|
||||
public attachAutosuggest(suggestionBoxId: string, suggestionContainerId: string, selectedSuggestionCallback: (result: ISuggestionResult) => void) : void;
|
||||
|
||||
/** Detaches the autosuggest functionality from the input box, freeing any resources it has or events it has tied to. */
|
||||
public detachAutosuggest(): void;
|
||||
|
||||
/** Disposes the Autosuggest object, freeing any resources it has or events it has tied to. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets the options currently used by the autosuggest manager.
|
||||
* @returns The options currently used by the autosuggest manager.
|
||||
*/
|
||||
public getOptions(): IAutosuggestOptions;
|
||||
|
||||
/**
|
||||
* Sets the options currently used by the autosuggest manager.
|
||||
* @param options The options to use with the autosuggest manager.
|
||||
*/
|
||||
public setOptions(options?: IAutosuggestOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
-142
@@ -1,142 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
/** The options used to customize how the ClusterLayer functions. */
|
||||
export interface IClusterLayerOptions {
|
||||
/**
|
||||
* A callback function that is fired after the clustering for a map view has completed. This is useful if you want to generate a list of locations based on what is in the current view.
|
||||
*/
|
||||
callback?: () => void;
|
||||
|
||||
/**
|
||||
* A callback function that allows you to process a clustered pushpin before it is added to a layer. This is useful if you want to add events or set style options on the clustered pushpin.
|
||||
*/
|
||||
clusteredPinCallback?: (pin: ClusterPushpin) => void;
|
||||
|
||||
/**
|
||||
* Indicates if the layer should cluster the locations or not. Default: true
|
||||
*/
|
||||
clusteringEnabled?: boolean;
|
||||
|
||||
/**
|
||||
* Defines how clusters are positioned on the map. Default: MeanAverage
|
||||
*/
|
||||
clusterPlacementType?: ClusterPlacementType;
|
||||
|
||||
/**
|
||||
* The width and height of the gird cells used for clustering in pixels. Default: 45
|
||||
*/
|
||||
gridSize?: number;
|
||||
|
||||
/**
|
||||
* Offsets the placement of clustered pushpins by a set number of pixels. This option is only available when the placement type is set to GridCenter.
|
||||
* This is useful if you have multiple cluster layers on the map and you want to offset the clustered pushpins between the layers so that they are visible,
|
||||
* otherwise the clusters from the different layers would overlap completely.
|
||||
*/
|
||||
layerOffset?: Point;
|
||||
|
||||
/**
|
||||
* A boolean indicating if the layer is visible or not.
|
||||
*/
|
||||
visible?: boolean;
|
||||
|
||||
/**
|
||||
* The z-index of the layer.
|
||||
*/
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to specify how a clustered pushpin should be positioned relative to the pushpins it contains.
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
*/
|
||||
export enum ClusterPlacementType {
|
||||
/**
|
||||
* Mean Average placement calculates the average position of a group of coordinates. This method creates a more realistic representation of the data,
|
||||
* however requires more processing power and increases the chances of pushpins overlapping.
|
||||
*/
|
||||
MeanAverage,
|
||||
|
||||
/**
|
||||
* This method is the simplest way to represent a cluster. It places the cluster at the first location in the cluster. This method may not accurately
|
||||
* represent the data but requires little processing power.
|
||||
*/
|
||||
FirstLocation
|
||||
}
|
||||
|
||||
/**
|
||||
* This class extends the Pushpin class and has all the same methods and properties plus the following properties.
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
*/
|
||||
export class ClusterPushpin extends Pushpin {
|
||||
/** An array of all the pushpins that are in the cluster. */
|
||||
containedPushpins: Pushpin[];
|
||||
|
||||
/**
|
||||
* The grid cell key that can be used retrieve the clustered pushpin(s) from the clustering layer. This is useful when creating a clickable list that
|
||||
* link items in the list to clusters or pushpins on the map. Your list just needs to store the gridKey value.
|
||||
*/
|
||||
gridKey: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows you to easily add in client side clustering to your application. Client Side Clustering is a method where pushpins that are close
|
||||
* together are grouped and represented as a single pushpin, often using a different icon to indicate the cluster. This is a great way to improve both
|
||||
* the user experience and performance of the map.
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
*/
|
||||
export class ClusterLayer implements IDataLayer {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
* @param pushpins An array of pushpins to cluster in the layer.
|
||||
* @param options The options used to customize how the ClusterLayer functions.
|
||||
*/
|
||||
constructor(pushpins: Pushpin[], options?: IClusterLayerOptions);
|
||||
|
||||
/** Clears all the data in the cluster layer. */
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Gets all the pushpins that are in the current map view. If clustering is disabled, all pushpins in the clustering layer are returned.
|
||||
* @returns All the pushpins that are in the current map view. If clustering is disabled, all pushpins in the clustering layer are returned.
|
||||
*/
|
||||
public getDisplayedPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Gets the current options used by the cluster layer.
|
||||
* @returns The current options used by the cluster layer.
|
||||
*/
|
||||
public getOptions(): IClusterLayerOptions;
|
||||
|
||||
/**
|
||||
* Gets all pushpins that are in the layers.
|
||||
* @returns An array of all the pushpins that are in the layers.
|
||||
*/
|
||||
public getPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Gets the original pushpins that are in the specified grid cell.
|
||||
* @param The gridKey index to retrieve the pushpins for.
|
||||
* @returns The original pushpins that are in the specified grid cell.
|
||||
*/
|
||||
public getPushpinsByGridKey(gridKey: number): Pushpin[];
|
||||
|
||||
/**
|
||||
* Gets the pushpin in the specified cluster grid cell which can be either a ClusterPushpin if there are multiple pushpins in a cell or a single Pushpin.
|
||||
* @param The gridKey index to retrieve the pushpins for.
|
||||
* @returns The pushpin in the specified cluster grid cell which can be either a ClusterPushpin if there are multiple pushpins in a cell or a single Pushpin.
|
||||
*/
|
||||
public getClusterPushpinByGridKey(gridKey: number): ClusterPushpin | Pushpin;
|
||||
|
||||
/**
|
||||
* Sets the clustering options to use in the layer.
|
||||
* @params options The clustering options to use in the layer.
|
||||
*/
|
||||
public setOptions(options: IClusterLayerOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the array of pushpins that are used in the clustering layer.
|
||||
* @param pushpins An array of pushpins that are to be used by the clustering layer.
|
||||
*/
|
||||
public setPushpins(pushpins: Pushpin[]): void;
|
||||
}
|
||||
}
|
||||
Vendored
-87
@@ -1,87 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/**
|
||||
* The contour layer options
|
||||
*/
|
||||
interface IContourLayerOptions {
|
||||
/** The z-index of this layer */
|
||||
zIndex?: number;
|
||||
|
||||
/** Whether the layer is visible */
|
||||
visible?: boolean;
|
||||
|
||||
/** A callback function which defines the color of the contour line fill. */
|
||||
colorCallback?: (contourValue: number | string) => string | Color;
|
||||
|
||||
/** The polygon options that apply to all contour lines of this layer */
|
||||
polygonOptions?: IPolygonOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* The contour line of a contour layer
|
||||
*/
|
||||
export class ContourLine extends Polygon {
|
||||
/** The contour lines that are directly nested inside this contour line */
|
||||
public innerContourLines: ContourLine[];
|
||||
|
||||
/** The outer/parent contour line of this contour */
|
||||
public outerContourLine: ContourLine;
|
||||
|
||||
/** The data value associated with this contour line */
|
||||
public contourValue: number | string;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param boundary The boundary of this contour line
|
||||
* @param contourValue The value associated with this contour line
|
||||
*/
|
||||
constructor(boundary: Location[], contourValue?: number | string);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contour layer class.
|
||||
*/
|
||||
export class ContourLayer extends Layer {
|
||||
/**
|
||||
* @constructor
|
||||
* @param contourLines The contour lines that compose this layer.
|
||||
* @param options The contour layer options.
|
||||
*/
|
||||
constructor(contourLines: ContourLine[], options?: IContourLayerOptions);
|
||||
|
||||
/**
|
||||
* Clears all data on the contour layer.
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Gets the contour lines of this layer.
|
||||
* @returns The contour lines of this layer.
|
||||
*/
|
||||
public getContourLines(): ContourLine[];
|
||||
|
||||
/**
|
||||
* Gets the polygons that were generated from the contour lines in this layer.
|
||||
* @returns The polygons that were generated from the contour lines in this layer.
|
||||
*/
|
||||
public getContourPolygons(): Polygon[];
|
||||
|
||||
/**
|
||||
* Retrieves the options of this contour layer.
|
||||
* @returns The options of this contour layer.
|
||||
*/
|
||||
public getOptions(): IContourLayerOptions;
|
||||
|
||||
/**
|
||||
* Sets the contour lines used to calculate the polygon areas of this layer.
|
||||
* @param contourLines The contour lines used to calculate the polygon areas of this layer.
|
||||
*/
|
||||
public setContourLines(contourLines: ContourLine[]): void;
|
||||
|
||||
/**
|
||||
* Sets the options of the contour layer.
|
||||
* @param options The new options to update the layer.
|
||||
*/
|
||||
public setOptions(options: IContourLayerOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
-148
@@ -1,148 +0,0 @@
|
||||
/// <reference path="SpatialMath.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/**
|
||||
* Specifies the shape of data bin rendered in the layer.
|
||||
*/
|
||||
export enum DataBinType {
|
||||
/* Renders data bins as circles in a square grid. */
|
||||
circle,
|
||||
|
||||
/* Renders data bins as hexagons with a flat top edge. */
|
||||
hexagon,
|
||||
|
||||
/* Renders data bins as circles in a hexagonal grid. */
|
||||
hexCircle,
|
||||
|
||||
/* Renders data bins as hexagons with a pointy top corner. */
|
||||
pointyHexagon,
|
||||
|
||||
/* Renders data bins as a square grid. */
|
||||
square
|
||||
}
|
||||
|
||||
/**
|
||||
* A set options the define how a data binning layer is rendered.
|
||||
*/
|
||||
export interface IDataBinningOptions {
|
||||
/* The name of a property in the Pushpin.metadata object on which to perform calculations (average, count, sum) against the pushpins in each data bin. */
|
||||
aggregationProperty?: string;
|
||||
|
||||
/*
|
||||
* A callback function which defines the color a data bin polygon should be. This callback recieves data bin information
|
||||
* along with the min and max calculated metrics for the data set. If set, this callback function must return a color value.
|
||||
*/
|
||||
colorCallback?: (binInfo: IDataBinInfo, min: IDataBinMetrics, max: IDataBinMetrics) => string | Color;
|
||||
|
||||
/* The shape of the data bin to generate. Default: hexagon */
|
||||
dataBinType?: DataBinType;
|
||||
|
||||
/* The distance units of the radius option. Default: meters */
|
||||
distanceUnits?: SpatialMath.DistanceUnits;
|
||||
|
||||
/* The default options used for rendering the data bin polygons. */
|
||||
polygonOptions?: IPolygonOptions;
|
||||
|
||||
/*
|
||||
* A spatial distance which will be converted into a pixel distance at the equater and used to generate symetrically sized data bins
|
||||
* that have the apprimate spatial distance radius. Default: 1000
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/*
|
||||
* A callback function which defines how much to scale a data bins size. This callback recieves data bin information
|
||||
* along with the min and max calculated metrics for the data set. If set, this callback function must return a number between 0 and 1.
|
||||
*/
|
||||
scaleCallback?: (binInfo: IDataBinInfo, min: IDataBinMetrics, max: IDataBinMetrics) => number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of values calculated from the pushpins in a data bin.
|
||||
*/
|
||||
export interface IDataBinMetrics {
|
||||
|
||||
/* The average value of the aggregation property of the pushpins in a data bin. */
|
||||
average?: number;
|
||||
|
||||
/* The number of pushpins in a data bin. */
|
||||
count?: number;
|
||||
|
||||
/* The number of pushpins in the data bin who's aggregation property has a value. */
|
||||
countNotBlank?: number;
|
||||
|
||||
/* The number of pushpins in the data bin who's aggregation property is a valid number. */
|
||||
countNumbers?: number;
|
||||
|
||||
/* The sum of the aggregation property of the pushpins in a data bin. */
|
||||
sum?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of a calculated data bin.
|
||||
*/
|
||||
export interface IDataBinInfo {
|
||||
/* An array of all the pushpins that are in the data bin. */
|
||||
containedPushpins: Microsoft.Maps.Pushpin[];
|
||||
|
||||
/* A set of calculated metric values determined using the aggregationProperty value of all the pushpins contained in the data bin. */
|
||||
metrics: IDataBinMetrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* A polygon which represents a data bin on the map and contains the data bin information.
|
||||
*/
|
||||
|
||||
export class DataBinPolygon extends Polygon {
|
||||
/* Information about the data bin; the contained pushpins and calculated metrics. */
|
||||
public dataBinInfo: IDataBinInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides a data binning visualization for the map. It takes in an array of pushpins, groups them into
|
||||
* symmetrical shapes that fit together in a grid such as hexagons. Aggregation of data values are done and can be
|
||||
* used to customize how the data bins are rendered on the map (i.e. scale / color) .
|
||||
*/
|
||||
export class DataBinningLayer extends Layer {
|
||||
/**
|
||||
* Initializes the data binning layer.
|
||||
* @param pushpins The array of pushpins that are used to generate the data bins.
|
||||
* @param options The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
constructor(pushpins?: Pushpin[], options?: IDataBinningOptions);
|
||||
|
||||
/**
|
||||
* Gets the options used for calculating and rendering the data bins.
|
||||
* @returns The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
public getOptions(): IDataBinningOptions;
|
||||
|
||||
/**
|
||||
* Gets all pushpins that are in the layers.
|
||||
* @returns All pushpins that are in the layers.
|
||||
*/
|
||||
public getPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Sets the array of pushpins that are used to generate the data bins.
|
||||
* @param pushpins The array of pushpins that are used to generate the data bins.
|
||||
*/
|
||||
public setPushpins(pushpins: Pushpin[]): void;
|
||||
|
||||
/**
|
||||
* Clears all the data in the data binning layer.
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Cleans up any resources this object is consuming.
|
||||
*/
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Sets the options used for calculating and rendering the data bins.
|
||||
* @param options The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
public setOptions(options: IDataBinningOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
-611
@@ -1,611 +0,0 @@
|
||||
declare module Microsoft.Maps.Directions {
|
||||
/////////////////////////////////////
|
||||
/// Enumerations
|
||||
////////////////////////////////////
|
||||
|
||||
/** Distance units for calculating the directions in. */
|
||||
export enum DistanceUnit {
|
||||
|
||||
/** A distance in Kilometers. */
|
||||
km,
|
||||
|
||||
/** A distance in Miles. */
|
||||
miles
|
||||
}
|
||||
|
||||
/** Defines the type of route to calculate. */
|
||||
export enum RouteMode {
|
||||
/** Driving directions are calculated. */
|
||||
driving,
|
||||
|
||||
/** Transit directions are calculated. */
|
||||
transit,
|
||||
|
||||
/** Walking directions are calculated. */
|
||||
walking
|
||||
}
|
||||
|
||||
/** Defines features to avoid when calculating the route. */
|
||||
export enum RouteAvoidance {
|
||||
/** Calculate the best route using any travel option available. */
|
||||
none = 0,
|
||||
|
||||
/** Reduce the use of limited access highways when calculating the route. */
|
||||
minimizeHighways = 1,
|
||||
|
||||
/** Reduce the use of roads with tolls when calculating the route. */
|
||||
minimizeToll = 2,
|
||||
|
||||
/** Avoid using limited access highways when calculating the route. */
|
||||
avoidHighways = 4,
|
||||
|
||||
/** Avoid using roads with tolls when calculating the route. */
|
||||
avoidToll = 8,
|
||||
|
||||
/** Avoid using express trains when calculating the route. This option only affects routes with a transitRouteMode that have the culture set to ja-jp. */
|
||||
avoidExpressTrain = 16,
|
||||
|
||||
/** Avoid using airlines when calculating the route. This option only affects routes with a transitRouteMode that have the culture set to ja-jp. */
|
||||
avoidAirline = 32,
|
||||
|
||||
/** Avoid using bullet trains when calculating the route. This option only affects routes with a transitRouteMode that have the culture set to ja-jp. */
|
||||
avoidBulletTrain = 64
|
||||
}
|
||||
|
||||
/** Response codes for a route calculation request. */
|
||||
export enum RouteResponseCode {
|
||||
/** The route was successfully calculated. */
|
||||
success = 0,
|
||||
|
||||
/** An unknown error has occurred. */
|
||||
unknownError = 1,
|
||||
|
||||
/** A nearby road cannot be found for one or more of the route waypoints. */
|
||||
cannotFindNearbyRoad = 2,
|
||||
|
||||
/**
|
||||
* The distance between two route waypoints, or the total length of the route exceeds the limit of the route mode.
|
||||
* Modify the waypoint locations so that they are closer together.
|
||||
*/
|
||||
tooFar = 3,
|
||||
|
||||
/**
|
||||
* A route cannot be calculated for the specified waypoints. For example, this code is returned when a route between
|
||||
* “Seattle, WA” and “Honolulu, HI” is requested.
|
||||
*/
|
||||
noSolution = 4,
|
||||
|
||||
/** There is no route data for the specified waypoints. */
|
||||
dataSourceNotFound = 5,
|
||||
|
||||
/** There are no transit options available for the specified time. */
|
||||
noAvailableTransitTrip = 7,
|
||||
|
||||
/** The transit stops are so close that walking is always a better option. */
|
||||
transitStopsTooClose = 8,
|
||||
|
||||
/** The transit stops are so close that walking is a better option. */
|
||||
walkingBestAlternative = 9,
|
||||
|
||||
/**
|
||||
* There is no transit data available for the route or for one or more of the specified waypoints,
|
||||
* or the waypoints are in different transit areas that do not overlap.
|
||||
*/
|
||||
outOfTransitBounds = 10,
|
||||
|
||||
/** The directions calculation request has timed out. */
|
||||
timeOut = 11,
|
||||
|
||||
/**
|
||||
* One or more waypoints need to be disambiguated. This error does not occur if the
|
||||
* autoDisplayDisambiguation directions render option is set to true.
|
||||
*/
|
||||
waypointDisambiguation = 12,
|
||||
|
||||
/** One or more waypoints do not have an address or location specified. */
|
||||
hasEmptyWaypoint = 13,
|
||||
|
||||
/** The maximum number of waypoints, which is 25, has been exceeded. */
|
||||
exceedMaxWaypointLimit = 14,
|
||||
|
||||
/** At least two waypoints are required to calculate a route. */
|
||||
atleastTwoWaypointRequired = 15,
|
||||
|
||||
/** The first or last waypoint is a via point, which is not allowed. */
|
||||
firstOrLastStoppointIsVia = 16,
|
||||
|
||||
/** The search service failed to return results. */
|
||||
searchServiceFailed = 17,
|
||||
|
||||
/** The credentials passed to the Directions module are invalid. */
|
||||
invalidCredentials = 18
|
||||
}
|
||||
|
||||
/** Defines optimization options for calculating directions. */
|
||||
export enum RouteOptimization {
|
||||
/** Calculate a route the shortest time. */
|
||||
shortestTime = 0,
|
||||
|
||||
/** Calculate a route with the shortest distance. */
|
||||
shortestDistance = 1,
|
||||
|
||||
/** The route is calculated to minimize the time and uses current traffic information. */
|
||||
timeWithTraffic = 2,
|
||||
|
||||
/** The route is calculated to minimize the time and avoid road closures. Traffic information is not used in the calculation. */
|
||||
timeAvoidClosure = 3,
|
||||
|
||||
/** Minimize the cost when calculating directions. This option only affects routes with a transitRouteMode that have the culture set to ja-jp.*/
|
||||
minimizeMoney = 4,
|
||||
|
||||
/** Minimize transit transfers when calculating directions. This option only affects routes with a transitRouteMode that have the culture set to ja-jp.*/
|
||||
minimizeTransfers = 5,
|
||||
|
||||
/** Minimize the amount of walking when calculating directions. This option only affects routes with a transitRouteMode that have the culture set to ja-jp.*/
|
||||
minimizeWalking = 6
|
||||
}
|
||||
|
||||
/** An enumeration that specifies the releance of a dateTime when calculating a route. */
|
||||
export enum TimeType {
|
||||
/** The dateTime parameter contains the desired arrival time for a transit request. */
|
||||
arrival,
|
||||
|
||||
/** The dateTime parameter contains the desired departure time for a transit request. */
|
||||
departure,
|
||||
|
||||
/** The dateTime parameter should be ignored and the first available transit taken. */
|
||||
firstAvailable,
|
||||
|
||||
/** The dateTime parameter contains the latest departure time available for a transit request. */
|
||||
lastAvailable
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Interfaces
|
||||
////////////////////////////////////
|
||||
|
||||
/** Contains the arguments for directions events. */
|
||||
export interface IDirectionsEventArgs {
|
||||
/** The calculated route (or routes, if the route mode is transit). */
|
||||
route: IRoute[];
|
||||
|
||||
/** The route summary (or summaries) of the route(s) defined in the route property. */
|
||||
routeSummary: IRouteSummary[];
|
||||
}
|
||||
|
||||
/** Contains arguments for directions error events. */
|
||||
export interface IDirectionsErrorEventArgs {
|
||||
/** The code which identifies the error that occurred. */
|
||||
responseCode: RouteResponseCode;
|
||||
|
||||
/** The error message. */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents one direction in a set of route directions. */
|
||||
export interface IDirectionsStep {
|
||||
/** The child direction items for this directions step. */
|
||||
childItineraryItems: IDirectionsStep[];
|
||||
|
||||
/** The location of the start of the direction. */
|
||||
coordinate: Location;
|
||||
|
||||
/** The total distance of the step in the unit specified in the distanceUnit property of the DirectionsRequestOptions. */
|
||||
distance: string;
|
||||
|
||||
/** The total time, in seconds, of the direction step. */
|
||||
durationInSeconds: number;
|
||||
|
||||
/** The HTML formatted route instruction associated with the step. */
|
||||
formattedText: string;
|
||||
|
||||
/** A boolean indicating whether the maneuver image is a road shield image. */
|
||||
isImageRoadShield: boolean;
|
||||
|
||||
/** The name of the maneuver image. */
|
||||
maneuverImageName: string;
|
||||
|
||||
/** An array of strings, where each string is a hint to help determine when to move to the next direction step. Not all direction steps have hints. */
|
||||
postIntersectionHints: string[];
|
||||
|
||||
/** An array of strings, where each string is a hint to help determine when you have arrived at this direction step. Not all direction steps have hints. */
|
||||
preIntersectionHints: string[];
|
||||
|
||||
/** The name of the transit stop where this step originates. */
|
||||
startStopName: string;
|
||||
|
||||
/** The transit line associated with this step. */
|
||||
transitLine: ITransitLine;
|
||||
|
||||
/** The URL of the image to use for transit direction steps. */
|
||||
transitStepIcon: string;
|
||||
|
||||
/** The ID of the transit stop. */
|
||||
transitStopId: string;
|
||||
|
||||
/** The name of the transit line end. */
|
||||
transitTerminus: string;
|
||||
}
|
||||
|
||||
/** Represents a route. */
|
||||
export interface IRoute {
|
||||
/** The legs of the route. Each route leg represents the route between two waypoints. */
|
||||
routeLegs: IRouteLeg[];
|
||||
|
||||
/** An array of locations that makes up the path of the route. */
|
||||
routePath: Location[];
|
||||
}
|
||||
|
||||
/** Represents a leg of a route. A route leg is the part of the route between two stop waypoints. */
|
||||
export interface IRouteLeg {
|
||||
/** The end time of the route leg. This property only applies when the routeMode of the DirectionsRequestOptions is set to transit. */
|
||||
endTime: Date;
|
||||
|
||||
/** The location of the last waypoint of this leg. */
|
||||
endWaypointLocation: Location;
|
||||
|
||||
/** The directions steps associated with this route leg. */
|
||||
itineraryItems: IDirectionsStep[];
|
||||
|
||||
/** The index of the route to which this route leg belongs. */
|
||||
originalRouteIndex: number;
|
||||
|
||||
/** The start time of the route leg. This property only applies when the routeMode of the DirectionsRequestOptions is set to transit. */
|
||||
startTime: Date;
|
||||
|
||||
/** The location of the first waypoint of this route leg. */
|
||||
startWaypointLocation: Location;
|
||||
|
||||
/** The sub legs of this route leg. A sub leg of a route is the part of the route between a stop point and a via point or between two via points.*/
|
||||
subLegs: IRouteSubLeg[];
|
||||
|
||||
/** The summary which describes this route leg. */
|
||||
summary: IRouteSummary;
|
||||
}
|
||||
|
||||
/** Represents a route sub leg. A route sub leg is the part of the route between a stop point and a via point or between two via points. */
|
||||
export interface IRouteSubLeg {
|
||||
/** The location of the last waypoint of the sub leg. */
|
||||
actualEnd: Location;
|
||||
|
||||
/** The location of the first waypoint of the sub leg. */
|
||||
actualStart: Location;
|
||||
|
||||
/** The description of the last waypoint of the sub leg. */
|
||||
endDescription: string;
|
||||
|
||||
/** The description of the first waypoint of the sub leg. */
|
||||
startDescription: string;
|
||||
}
|
||||
|
||||
/** Represents a route summary. */
|
||||
export interface IRouteSummary {
|
||||
/** The total travel distance of the route */
|
||||
distance: number;
|
||||
|
||||
/** The cost of the route. This property is only returned if the routeMode of the IDirectionsRequestOptions is set to transit and the map culture is set to ja-jp. */
|
||||
monetaryCost: number;
|
||||
|
||||
/** The location of the northeast corner of bounding box that defines the best map view of the route. */
|
||||
northEast: Location;
|
||||
|
||||
/** The location of the southwest corner of bounding box that defines the best map view of the route. */
|
||||
southWest: Location;
|
||||
|
||||
/** The total travel time, in seconds, for the route. */
|
||||
time: number;
|
||||
|
||||
/**
|
||||
* The total travel time, in seconds, taking into account traffic delays, for the route.
|
||||
* This property is 0 if the avoidTraffic property of the IDirectionsRequestOptions is set to false.
|
||||
*/
|
||||
timeWithTraffic: number;
|
||||
}
|
||||
|
||||
/** Contains information about a transit line. */
|
||||
export interface ITransitLine {
|
||||
/** The short name for the transit line. */
|
||||
abbreviatedName: string;
|
||||
|
||||
/** The ID of the agency that owns the transit line. */
|
||||
agencyId: number;
|
||||
|
||||
/** The name of the agency that owns the transit line. */
|
||||
agencyName: string;
|
||||
|
||||
/** The URL of the website of the agency that owns the transit line. */
|
||||
agencyUrl: string;
|
||||
|
||||
/** Phone number for the transit agency. */
|
||||
phoneNumber: string;
|
||||
|
||||
/** Information about the provider of this transit line data. */
|
||||
providerInfo: string;
|
||||
|
||||
/** The uri for the transit agencies website. */
|
||||
uri: string;
|
||||
|
||||
/** The full name of this transit line. */
|
||||
verboseName: string;
|
||||
}
|
||||
|
||||
/** Options that can be used to define a waypoint. */
|
||||
export interface IWaypointOptions {
|
||||
/**
|
||||
* The address string of the waypoint. For example, the following strings are valid for this parameter: "Seattle", "1 Microsoft Way, Redmond, WA". Either the address or location property must be specified.
|
||||
*/
|
||||
address?: string;
|
||||
|
||||
/**
|
||||
* A boolean indicating whether the waypoint is a via point. A via point is a point along the route that is not a stop point. Set this property to
|
||||
* true if you just want the route to pass through this location. Default: false
|
||||
*/
|
||||
isViaPoint?: boolean;
|
||||
|
||||
/** The location of the waypoint. Either the address or location property must be specified. */
|
||||
location?: Location;
|
||||
}
|
||||
|
||||
/** Contains options for the directions to calculate. */
|
||||
export interface IDirectionsRequestOptions {
|
||||
/** The unit to use when displaying direction distances. */
|
||||
distanceUnit?: DistanceUnit;
|
||||
|
||||
/** The number of routes to calculate. */
|
||||
maxRoutes?: number;
|
||||
|
||||
/** The features to avoid when calculating the route. */
|
||||
routeAvoidance?: RouteAvoidance[];
|
||||
|
||||
/** A boolean indicating whether the route line on the map can be dragged with the mouse cursor. */
|
||||
routeDraggable?: boolean;
|
||||
|
||||
/** If multiple routes are returned, the index of the route and directions to display. */
|
||||
routeIndex?: number;
|
||||
|
||||
/** The type of directions to calculate. */
|
||||
routeMode?: RouteMode;
|
||||
|
||||
/** The optimization setting for the route calculation. */
|
||||
routeOptimization?: RouteOptimization;
|
||||
|
||||
/** The type of the time specified. The default value is departure. */
|
||||
timeType?: TimeType;
|
||||
|
||||
/** The time to use when calculating the route. If this property is set to null, the current time is used */
|
||||
time?: Date;
|
||||
}
|
||||
|
||||
/** Represents render options for a route. */
|
||||
export interface IDirectionsRenderOptions {
|
||||
/** A boolean indicating whether to automatically set the map view to the best map view of the calculated route. Default: true */
|
||||
autoUpdateMapView?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display the disclaimer about the accuracy of the directions. Default: true */
|
||||
displayDisclaimer?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display the icons for each direction maneuver. Default: true */
|
||||
displayManeuverIcons?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display direction hints that describe when a direction step was missed. Default: true */
|
||||
displayPostItineraryItemHints?: boolean;
|
||||
|
||||
/**
|
||||
* A boolean indicating whether to display direction hints that describe what to look for before you come to the next
|
||||
* direction step. The default value is true.
|
||||
*/
|
||||
displayPreItineraryItemHints?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display the route selector control. Default: true */
|
||||
displayRouteSelector?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display direction warnings. Default: true */
|
||||
displayStepWarnings?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display a warning about walking directions. Default: true */
|
||||
displayWalkingWarning?: boolean;
|
||||
|
||||
/** The polyline options that define how to draw the route line on the map, if the RouteMode is driving. */
|
||||
drivingPolylineOptions?: IPolylineOptions;
|
||||
|
||||
/** The pushpin options that define how the first waypoint should be rendered. */
|
||||
firstWaypointPushpinOptions?: IPushpinOptions;
|
||||
|
||||
/** The DOM element inside which the directions itinerary will be rendered. */
|
||||
itineraryContainer?: HTMLElement;
|
||||
|
||||
/** The pushpin options that define how the last waypoint should be rendered. */
|
||||
lastWaypointPushpinOptions?: IPushpinOptions;
|
||||
|
||||
/** A boolean indicating whether to show the input panel. Default: false */
|
||||
showInputPanel?: boolean;
|
||||
|
||||
/** The options that define how to draw the route line on the map, if the RouteMode is transit. */
|
||||
transitPolylineOptions?: IPolylineOptions;
|
||||
|
||||
/** The options that define how to draw the route line on the map, if the RouteMode is walking. */
|
||||
walkingPolylineOptions?: IPolylineOptions;
|
||||
|
||||
/** The options that define the pushpin to use for all route waypoints by default. The first and last waypoints in the route will be overriden by firstWaypointPushpinOptions and lastWaypointPushpinOptions if set. */
|
||||
waypointPushpinOptions?: IPushpinOptions;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Classes
|
||||
////////////////////////////////////
|
||||
|
||||
/** An object used to define a start, end or stop location along a route. */
|
||||
export class Waypoint {
|
||||
/**
|
||||
* @constructor
|
||||
* @param options: Options used to define the Waypoint.
|
||||
*/
|
||||
constructor(options: IWaypointOptions);
|
||||
|
||||
/** Releases any resources associated with the waypoint. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets the address associated with the waypoint.
|
||||
* @returns The address associated with the waypoint.
|
||||
*/
|
||||
public getAddress(): string;
|
||||
|
||||
/**
|
||||
* Gets the location of the waypoint.
|
||||
* @returns The location of the waypoint.
|
||||
*/
|
||||
public getLocation(): Location;
|
||||
|
||||
/**
|
||||
* Gets a boolean value indicating whether the waypoint is a via point.
|
||||
* @returns A boolean value indicating whether the waypoint is a via point.
|
||||
*/
|
||||
public isViapoint(): boolean;
|
||||
|
||||
/**
|
||||
* Sets options for the waypoint. For these options to take effect, you must recalculate the route.
|
||||
* @param options Options used to define the Waypoint.
|
||||
*/
|
||||
public setOptions(options: IWaypointOptions): void;
|
||||
}
|
||||
|
||||
/** The main class in the Directions module that process direction calculations and rendering. */
|
||||
export class DirectionsManager {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param map A map to calculate directions for.
|
||||
* @param waypoints An array of waypoints to be added to the route.
|
||||
*/
|
||||
constructor(map: Map, waypoints?: Waypoint[]);
|
||||
|
||||
/**
|
||||
* Adds a waypoint to the route at the given index, if specified. If an index is not specified, the waypoint is added as the last waypoint in the route. The maximum number of walking or driving waypoints is 25. The maximum number of transit waypoints is 2. Up to 10 via points are allowed between two stop waypoints. To recalculate the route, use calculateDirections.
|
||||
* @param waypoint The waypoint to be added to the directions manager.
|
||||
* @param index An index at which the waypoint is to be added.
|
||||
*/
|
||||
public addWaypoint(waypoint: Waypoint, index?: number): void;
|
||||
|
||||
/**
|
||||
* Calculates directions based on request and render options set
|
||||
*/
|
||||
public calculateDirections(): void;
|
||||
|
||||
/** Clears the directions request and render options and removes all waypoints */
|
||||
public clearAll(): void;
|
||||
|
||||
/**
|
||||
* Clears the directions displayed and removes the route line from the map.
|
||||
* This method does not remove waypoints from the route and retains all calculated direction information and option settings.
|
||||
*/
|
||||
public clearDisplay(): void;
|
||||
|
||||
/** Deletes the DirectionsManager object and releases any associated resources. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets all the waypoints in the directions manager.
|
||||
* @returns All the waypoints in the directions manager.
|
||||
*/
|
||||
public getAllWaypoints(): Waypoint[];
|
||||
|
||||
/**
|
||||
* Gets the currently displayed route information.
|
||||
* @returns The currently displayed route information.
|
||||
*/
|
||||
public getCurrentRoute(): IRoute;
|
||||
|
||||
/**
|
||||
* Gets the route render options.
|
||||
* @returns The route render options
|
||||
*/
|
||||
public getRenderOptions(): IDirectionsRenderOptions;
|
||||
|
||||
/**
|
||||
* Gets the directions request options.
|
||||
* @returns The directions request options.
|
||||
*/
|
||||
public getRequestOptions(): IDirectionsRequestOptions;
|
||||
|
||||
/**
|
||||
* Gets the current calculated route(s)
|
||||
* @returns The current calculated route(s). If the route was not successfully calculated, null is returned.
|
||||
*/
|
||||
public getRouteResult(): IRoute[];
|
||||
|
||||
/**
|
||||
* Removes the given waypoint or the waypoint identified by the given index from the route.
|
||||
* @param waypointOrIndex A Waypoint object to be removed or the index of the waypoint to be removed
|
||||
*/
|
||||
public removeWaypoint(waypointOrIndex: Waypoint | number): void;
|
||||
|
||||
/**
|
||||
* Sets the specified render options for the route.
|
||||
* @param options The options that customize the rendering of the calculated route.
|
||||
*/
|
||||
public setRenderOptions(options: IDirectionsRenderOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the specified route calculation options.
|
||||
* @param options The route calculation options.
|
||||
*/
|
||||
public setRequestOptions(options: IDirectionsRequestOptions): void;
|
||||
|
||||
/**
|
||||
* Displays an input panel for calculating directions in the specified container. Provides autosuggest for location inputs.
|
||||
* @param inputContainerId The id name of the HTML container in which to render the directions input panel.
|
||||
*/
|
||||
public showInputPanel(inputContainerId: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/** A static class that manages events within the map SDK. */
|
||||
module Events {
|
||||
/////////////////////////////////////
|
||||
/// addHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target. Use the return object to remove the handler using the removeHandler method.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* • directionsError
|
||||
* • directionsUpdated
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addHandler(target: Directions.DirectionsManager, eventName: string, handler: (eventArg?: Directions.IDirectionsEventArgs | Directions.IDirectionsErrorEventArgs) => void): IHandlerId;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addOne Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, but only triggers the handler the first once after being attached.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* • directionsError
|
||||
* • directionsUpdated
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
*/
|
||||
export function addOne(target: Directions.DirectionsManager, eventName: string, handler: (eventArg?: Directions.IDirectionsEventArgs | Directions.IDirectionsErrorEventArgs) => void): void;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addThrottledHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, where the minimum interval between events (in milliseconds) is specified as a parameter.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* • directionsError
|
||||
* • directionsUpdated
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @param throttleInterval throttle interval (in ms)
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addThrottledHandler(target: Directions.DirectionsManager, eventName: string, handler: (eventArg?: Directions.IDirectionsEventArgs | Directions.IDirectionsErrorEventArgs) => void, throttleInterval: number): IHandlerId;
|
||||
}
|
||||
}
|
||||
Vendored
-234
@@ -1,234 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
/** An object that contains the event arguments for when the drawing mode changes in the drawing tools. **/
|
||||
export interface IDrawingModeChangedData {
|
||||
|
||||
/** The shape being modified by the drawing tools. **/
|
||||
shape: IPrimitive;
|
||||
|
||||
/** The new drawing mode. **/
|
||||
mode: DrawingTools.DrawingMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DrawingManager class manages the ability to draw and edit multiple shapes on the map. Shapes managed by this class are rendered on a separate drawing layer.
|
||||
* User can use a mouse or a touch screen to draw on the map. When they are done, pressing the escape button or any button on the toolbar will exit the current drawing mode.
|
||||
* This class does not have a publicly accessible constructor and can only be accessed using the showDrawingManager of the DrawingTools class.
|
||||
*/
|
||||
export interface DrawingManager {
|
||||
/**
|
||||
* Adds a shapes to the layer, at the specified index if specified.
|
||||
• @param data The shape(s) to be added to the layer.
|
||||
• @param index The index at which to insert the shape into the layer.
|
||||
*/
|
||||
add(data: IPrimitive | IPrimitive[], index?: number): void;
|
||||
|
||||
/**
|
||||
* Disposes the drawing manager instance.
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
/**
|
||||
* Resets the drawing manager and clears all shapes in the drawing layer.
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
* Gets the current drawing mode of the drawing manager.
|
||||
* @returns The current drawing mode of the drawing manager.
|
||||
*/
|
||||
getDrawingMode(): DrawingTools.DrawingMode;
|
||||
|
||||
/**
|
||||
* Gets an array of shapes that are in the layer. This can be used to iterate over the individual shapes.
|
||||
* @returns An array of shapes that are in the layer. This can be used to iterate over the individual shapes.
|
||||
*/
|
||||
getPrimitives(): IPrimitive[];
|
||||
|
||||
/**
|
||||
* Returns the index of the shape in the drawing layer.
|
||||
* @param primitive The shape to find the index of.
|
||||
* @param fromIndex The index to start the search from.
|
||||
* @returns The index of the shape in the drawing layer. Returns -1 if shape is not found.
|
||||
*/
|
||||
indexOf(primitive: IPrimitive, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Removes a shape from the layer and returns it.
|
||||
* @param primitive The shape to remove from the layer.
|
||||
* @returns The shape that was removed from the layer.
|
||||
*/
|
||||
remove(primitive: IPrimitive): IPrimitive;
|
||||
|
||||
/**
|
||||
* Removes a shape from the layer at the specified index.
|
||||
* @param index The index of the shape to remove from the layer.
|
||||
* @returns The shape that was removed from the layer.
|
||||
*/
|
||||
removeAt(index: number): IPrimitive;
|
||||
|
||||
/**
|
||||
* Sets the drawing mode of the drawing manager.
|
||||
* @param mode The drawing mode to set the DrawingManager to.
|
||||
*/
|
||||
setDrawingMode(mode: DrawingTools.DrawingMode): void;
|
||||
|
||||
/**
|
||||
* Replaces all shapes in the layer with the new array of shapes that have been provided.
|
||||
* @param primitives An array of shapes to add to the drawing layer.
|
||||
*/
|
||||
setPrimitives(primitives: IPrimitive[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a set of tools for drawing and editing shapes on top of the map.
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
*/
|
||||
export class DrawingTools {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
* @param map A map instanct to attach the drawing tools to.
|
||||
*/
|
||||
constructor(map: Map);
|
||||
|
||||
/**
|
||||
* Initializes the drawing layer and instructs it to create a new shape of a given type.
|
||||
* @param shapeType The type of new shape to create.
|
||||
* @param created A callback function that is fired after the initial shape is created.
|
||||
*/
|
||||
public create(shapeType: DrawingTools.ShapeType, created?: (shape: IPrimitive) => void): void;
|
||||
|
||||
/** Disposes the instance of the DrawingTools class. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Adds a shape to the drawing layer and puts it into edit mode.
|
||||
* @param shape A shape to put into editting mode.
|
||||
*/
|
||||
public edit(shape: IPrimitive): void;
|
||||
|
||||
/**
|
||||
* Finishes any shape create / edit operation currently in progress, and returns the shape that was created or editted through a specified callback function.
|
||||
* @param finished A callback function to return the completed shape with.
|
||||
*/
|
||||
public finish(finished?: (shape: IPrimitive) => void): void;
|
||||
|
||||
/**
|
||||
* Creates a drawing manager which allows multi-shape editing and displays the toolbar.
|
||||
* @param callback A callback function that is triggered after the DrawingTools have loaded.
|
||||
*/
|
||||
public showDrawingManager(callback?: (manager: DrawingManager) => void): void;
|
||||
}
|
||||
|
||||
export module Events {
|
||||
/////////////////////////////////////
|
||||
/// addHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target. Use the return object to remove the handler using the removeHandler method.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* drawingChanged, drawingChanging, drawingEnded, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addHandler(target: DrawingTools, eventName: string, handler: (eventArg?: IPrimitive | IDrawingModeChangedData) => void): IHandlerId;
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target. Use the return object to remove the handler using the removeHandler method.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* disposed, drawingChanged, drawingChanging, drawingEnded, drawingErased, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addHandler(target: DrawingManager, eventName: string, handler: (eventArg?: IPrimitive | DrawingTools.DrawingMode) => void): IHandlerId;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addOne Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, but only triggers the handler the first once after being attached.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* drawingChanged, drawingChanging, drawingEnded, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
*/
|
||||
export function addOne(target: DrawingTools, eventName: string, handler: (eventArg?: IPrimitive | IDrawingModeChangedData) => void): void;
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, but only triggers the handler the first once after being attached.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* disposed, drawingChanged, drawingChanging, drawingEnded, drawingErased, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
*/
|
||||
export function addOne(target: DrawingManager, eventName: string, handler: (eventArg?: IPrimitive | DrawingTools.DrawingMode) => void): void;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addThrottledHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, where the minimum interval between events (in milliseconds) is specified as a parameter.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* drawingChanged, drawingChanging, drawingEnded, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addThrottledHandler(target: DrawingTools, eventName: string, handler: (eventArg?: IPrimitive | IDrawingModeChangedData) => void): IHandlerId;
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, where the minimum interval between events (in milliseconds) is specified as a parameter.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* disposed, drawingChanged, drawingChanging, drawingEnded, drawingErased, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @param throttleInterval throttle interval (in ms)
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addThrottledHandler(target: DrawingManager, eventName: string, handler: (eventArg?: IPrimitive | DrawingTools.DrawingMode) => void, throttleInterval: number): IHandlerId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module Microsoft.Maps.DrawingTools {
|
||||
/**
|
||||
* The different drawing modes that the drawing manager can be set to.
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
*/
|
||||
export enum DrawingMode {
|
||||
/** Edit an existing shape. Click on a shape to edit it. */
|
||||
edit,
|
||||
|
||||
/** Erase and existing shape. Click on the shapes to erase them. */
|
||||
erase,
|
||||
|
||||
/** Sets the drawing manager into an idle mode. */
|
||||
none,
|
||||
|
||||
/** Allow the user to draw a polygon. */
|
||||
polygon,
|
||||
|
||||
/** Allow the user to draw a polyline. */
|
||||
polyline,
|
||||
|
||||
/** Allow the user to draw a pushpin. */
|
||||
pushpin
|
||||
}
|
||||
|
||||
/**
|
||||
* The different types of shapes that are created or edited by the drawing tools.
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
*/
|
||||
export enum ShapeType {
|
||||
/** A polygon shape type. */
|
||||
polygon,
|
||||
|
||||
/** A polyline shape type. */
|
||||
polyline
|
||||
}
|
||||
}
|
||||
Vendored
-68
@@ -1,68 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/** GeoJSON object definition */
|
||||
export interface IGeoJsonObject {
|
||||
/**
|
||||
* Type of the object
|
||||
* could be one of the following:
|
||||
* Point
|
||||
* LineString
|
||||
* Polygon
|
||||
* MultiPoint
|
||||
* MultiLineString
|
||||
* MultiPolygon
|
||||
* GeometryCollection
|
||||
* Feature
|
||||
* FeatureCollection
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/** Geometric coordinates of the object */
|
||||
coordinates?: number[] | number[][] | number[][][] | number[][][][];
|
||||
|
||||
/** Additional properties of the object as a key,value pair */
|
||||
properties?: any;
|
||||
|
||||
/** Set of features (only applicable if the type is 'featurecollection') */
|
||||
features?: IGeoJsonObject[];
|
||||
|
||||
/** Set of geometries (only applicable if the type is 'geometrycollection') */
|
||||
geometries?: IGeoJsonObject[];
|
||||
|
||||
/** Geometry (only applicable if the type is 'feature') */
|
||||
geometry?: IGeoJsonObject;
|
||||
|
||||
/** identifier of a feature (only applicable if the type is 'feature') */
|
||||
id?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class responsible for reading/writing geo data in GeoJson format
|
||||
* @requires The Microsoft.Maps.GeoJson module.
|
||||
*/
|
||||
export module GeoJson {
|
||||
/**
|
||||
* Reads the data from a given url and returns the shapes.
|
||||
* @param url GeoJson download url.
|
||||
* @param callback Callback function that needs to be called once the data is downloaded and parsed.
|
||||
* @param jsonpQueryParam The name of the url query param to make a jsonp request.
|
||||
* @param styles Styles that needs to be applied.
|
||||
*/
|
||||
export function readFromUrl(url: string, callback: (data: IPrimitive | IPrimitive[]) => void, jsonpQueryParam?: string, styles?: IStylesOptions): void;
|
||||
|
||||
/**
|
||||
* Reads the data in geoJson format and returns the shapes.
|
||||
* @param geoJson GeoJson data object that needs to be parsed into shapes.
|
||||
* @param styles Styles that needs to be applied.
|
||||
* @returns An array of shapes.
|
||||
*/
|
||||
export function read(geoJson: IGeoJsonObject | string, styles?: IStylesOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Writes the data into geoJson format.
|
||||
* @param data Data that needs to be serialized.
|
||||
* @returns A geoJson formatted string.
|
||||
*/
|
||||
export function write(data: IPrimitive | IPrimitive[]): IGeoJsonObject;
|
||||
}
|
||||
}
|
||||
Vendored
-106
@@ -1,106 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
/** A standard dictionary object (associative array). */
|
||||
export interface IDictionary<T> {
|
||||
[K: string]: T;
|
||||
}
|
||||
|
||||
/** Options for customizing how the heat map is rendered. */
|
||||
export interface IHeatMapLayerOptions {
|
||||
/**
|
||||
* The temperature gradient that is used to colorize the map. Default gradient:
|
||||
* {
|
||||
* '0.00': 'rgb(255,0,255)', // Magenta
|
||||
* '0.25': 'rgb(0,0,255)', // Blue
|
||||
* '0.50': 'rgb(0,255,0)', // Green
|
||||
* '0.75': 'rgb(255,255,0)', // Yellow
|
||||
* '1.00': 'rgb(255,0,0)' // Red
|
||||
* }
|
||||
*/
|
||||
colorGradient?: IDictionary<string>;
|
||||
|
||||
/**
|
||||
* The intensity of each heat point. This is a decimal value between 0 and 1. This is used to specify how "hot" a single data point should be. Default: 0.5
|
||||
*/
|
||||
intensity?: number;
|
||||
|
||||
/**
|
||||
* The opacity of the HeatMapLayer canvas. Value should be a decimal between 0 and 1. Default: 1
|
||||
*/
|
||||
opacity?: number;
|
||||
|
||||
/**
|
||||
* The radius to draw each data point on the map. Default: 10
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/**
|
||||
* The distance units of the radius. Possible values are:
|
||||
*
|
||||
* • 'pixels' (defualt)
|
||||
* • 'meters'
|
||||
*
|
||||
* When set to pixels the size of each data point will always be the same radius, regardless of zoom level. When set to meters, the size of the data points
|
||||
* will scale based on zoom level so as to ensure that the radius is spatially accurate.
|
||||
*/
|
||||
unit?: 'meters' | 'pixel';
|
||||
|
||||
/** A boolean indicating if the heat map layer is visible or not. **/
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for rendering data as a heat map layer.
|
||||
* @requires The Microsoft.Maps.Heatmap module.
|
||||
*/
|
||||
export class HeatMapLayer implements IDataLayer {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Heatmap module.
|
||||
* @param locations Set of locations to visualize as a heat map.
|
||||
* @param options Options for customizing how the heat map is rendered.
|
||||
*/
|
||||
constructor(locations: (Location | Pushpin)[], options?: IHeatMapLayerOptions);
|
||||
|
||||
/** Clears all data in the heat map layer. */
|
||||
public clear(): void;
|
||||
|
||||
/** Disposes the heat map layer. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets a boolean indicating if the heat map layer is visible or not.
|
||||
* @returns A boolean indicating if the heat map layer is visible or not.
|
||||
*/
|
||||
public getVisible(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Hides the heat map layer.
|
||||
*/
|
||||
public hide(): void;
|
||||
|
||||
/**
|
||||
* Specifies the locations to use when generating the heat map.
|
||||
* @param locations Set of locations.
|
||||
*/
|
||||
public setLocations(locations: (Location | Pushpin)[]): void;
|
||||
|
||||
/**
|
||||
* Sets the options to use with the heat map layer.
|
||||
* @param options Set of heat map layer options.
|
||||
*/
|
||||
public setOptions(options: IHeatMapLayerOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the visibility of the heat map layer.
|
||||
* @param visible A boolean indicating if the heat map layer is visible or not.
|
||||
*/
|
||||
public setVisible(visible: boolean): void;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Shows the heat map layer.
|
||||
*/
|
||||
public show(): void;
|
||||
}
|
||||
}
|
||||
Vendored
-228
@@ -1,228 +0,0 @@
|
||||
/**
|
||||
* Provides an easy method for geocoding address and searching for points of interest from JavaScript.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
declare module Microsoft.Maps.Search {
|
||||
/**
|
||||
* Defines the match precision of a geocdoed result.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export enum LocationPrecision {
|
||||
/** The geocode result was matched to a point on a road using interpolation. */
|
||||
interpolated,
|
||||
|
||||
/**
|
||||
* The geocode result was matched to a point on a road using interpolation with an additional offset to shift the
|
||||
* Location to the side of the street.
|
||||
*/
|
||||
InterpolatedOffset,
|
||||
|
||||
/** The geocode result was matched to the center of a parcel (property boundary). */
|
||||
parcel,
|
||||
|
||||
/** The geocode result was matched to the rooftop of a building. */
|
||||
rooftop
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the geocoding level of the location match found by the geocoder.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export enum MatchCode {
|
||||
/** No match was found. */
|
||||
none,
|
||||
|
||||
/** The match was good. */
|
||||
good,
|
||||
|
||||
/** The match was ambiguous. Multiple results were returned. */
|
||||
ambiguous,
|
||||
|
||||
/** The match was found by a broader search. */
|
||||
upHierarchy,
|
||||
|
||||
/** The match was found, but possibly using a modified query. */
|
||||
modified
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the confidence of the location match found by the geocoding service.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export enum MatchConfidence {
|
||||
/** The confidence of the match is high. */
|
||||
high,
|
||||
|
||||
/** The confidence of the match is medium. */
|
||||
medium,
|
||||
|
||||
/** The confidence of the match is low. */
|
||||
low,
|
||||
|
||||
/** The confidence of the match is unknown. */
|
||||
unknown
|
||||
}
|
||||
|
||||
/** A object that represents a geocoded location. */
|
||||
export interface IGeocodeLocation {
|
||||
/** The map location of this geocode location match. */
|
||||
location: Location;
|
||||
|
||||
/** The name of this geocode location match. */
|
||||
name: string;
|
||||
|
||||
/** The precision of this geocode location match. */
|
||||
precision: string | LocationPrecision;
|
||||
}
|
||||
|
||||
/** An object that represents an place result. */
|
||||
export interface IPlaceResult {
|
||||
/** The geocoded address of the place result. */
|
||||
address: IAddress;
|
||||
|
||||
/** The location rectangle that defines the boundaries of the best map view of the place result. */
|
||||
bestView: LocationRect;
|
||||
|
||||
/** The classification of the geographic entity returned, such as PopulatedPlace. */
|
||||
entityType: string;
|
||||
|
||||
/** The geocoded location of the best result. */
|
||||
location: Location;
|
||||
|
||||
/** The geocoded locations. */
|
||||
locations: IGeocodeLocation[];
|
||||
|
||||
/** The match code of the best result. */
|
||||
matchCode: string | MatchCode;
|
||||
|
||||
/** The match confidence of the best result. */
|
||||
matchConfidence: string | MatchConfidence;
|
||||
|
||||
/** The name of the place result, if one exists. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** An object that represents a geocode result returned by REST service. */
|
||||
export interface IGeocodeResult {
|
||||
/** An array of geocode results. */
|
||||
results: IPlaceResult[];
|
||||
}
|
||||
|
||||
/** The options for a geocode request. */
|
||||
export interface IGeocodeRequestOptions {
|
||||
/**
|
||||
* A location rectangle that defines the boundaries of the area in which to search for
|
||||
* location results. The default is the bounds of the map view associated with this
|
||||
* instance of the SearchManager, which is usually the current map view.
|
||||
*/
|
||||
bounds?: LocationRect;
|
||||
|
||||
/**
|
||||
* The name of the function to call when a successful result is returned from the
|
||||
* geocode request. The callback function must accept two parameters: result, which is
|
||||
* a GeocodeResult type, and a userData object.
|
||||
*/
|
||||
callback: (geocodeResult: IGeocodeResult, userData: any) => void;
|
||||
|
||||
/** The maximum number of results to return. Required. The maximum number than can be returned is 20. */
|
||||
count?: number;
|
||||
|
||||
/**
|
||||
* The name of the function to call when the request is returned with an error. The
|
||||
* error callback function must accept an IGeocodeRequestOptions object.
|
||||
*/
|
||||
errorCallback?: (geocodeRequestOptions: IGeocodeRequestOptions) => void;
|
||||
|
||||
/** Specifies to include the two-letter ISO country code. */
|
||||
includeCountryIso2?: boolean;
|
||||
|
||||
/** Specifies to include the neighborhood in the response when it is available. */
|
||||
includeNeighborhood?: boolean;
|
||||
|
||||
/** A number indicating how long to wait, in seconds, for the geocode request to return. The default value is 5 seconds. */
|
||||
timeout?: number;
|
||||
|
||||
/** An object containing any data that needs to be passed to the callback when the request is completed. */
|
||||
userData?: any;
|
||||
|
||||
/** A string containing the address or place to be matched to a location on the map. */
|
||||
where: string;
|
||||
}
|
||||
|
||||
/** The options for a reverse geocode request. */
|
||||
export interface ReverseGeocodeRequestOptions {
|
||||
/**
|
||||
* A reference to a function to call when a successful result is returned from the geocode request. The callback function
|
||||
* will receive a PlaceResult object as an argument.
|
||||
*/
|
||||
callback: (placeResult: IPlaceResult, userData: any) => void;
|
||||
|
||||
/**
|
||||
* A reference to a function to call when the request is returned with an error. The error callback function will receive
|
||||
* an object containing the geocode request options used in the request.
|
||||
*/
|
||||
errorCallback?: (reverseGeocodeRequestOptions: ReverseGeocodeRequestOptions) => void;
|
||||
|
||||
/** Specifies to include the two-letter ISO country code. Default: false */
|
||||
includeCountryIso2?: boolean;
|
||||
|
||||
/**
|
||||
* An array of entity types selected from the following options.
|
||||
* • Address
|
||||
* • Neighborhood
|
||||
* • PopulatedPlace
|
||||
* • Postcode1
|
||||
* • AdminDivision1
|
||||
* • AdminDivision2
|
||||
* • CountryRegion
|
||||
* These entity types are ordered from the most specific entity to the least specific entity. When entities of more than one entity type are found, only the most specific
|
||||
* entity is returned. For example, if you specify Address and AdminDistrict1 as entity types and entities were found for both types, only the Address entity information is
|
||||
* returned in the response. One exception to this rule is when both PopulatedPlace and Neighborhood entity types are specified and information is found for both. In this case,
|
||||
* the information for both entity types is returned. Also, more than one Neighborhood may be returned because the area covered by two different neighborhoods can overlap.
|
||||
*/
|
||||
includeEntityTypes?: string[];
|
||||
|
||||
/**
|
||||
* Specifies to include the neighborhood in the response when it is available. Note: This feature isn’t
|
||||
* available in all locations.
|
||||
*/
|
||||
includeNeighborhood?: boolean;
|
||||
|
||||
/** The location to use to match to geographic entities and addresses. */
|
||||
location: Location;
|
||||
|
||||
/** A number indicating how long to wait, in seconds, for the reverse geocode request to return. The default value is 5 seconds. */
|
||||
timeout?: number;
|
||||
|
||||
/** An object containing any data that needs to be passed to the callback when the request is completed. */
|
||||
userData?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class that contains methods for returning search and location results.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export class SearchManager {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
* @param map A Map object
|
||||
*/
|
||||
constructor(map: Map);
|
||||
|
||||
/**
|
||||
* Matches the address or place query in the specified request
|
||||
* options to a location and returns the results to the request
|
||||
* options callback function.
|
||||
* @param request Options for sending geocode request
|
||||
*/
|
||||
public geocode(request: IGeocodeRequestOptions): void;
|
||||
|
||||
/**
|
||||
* Matches the specified location to an address and returns the
|
||||
* address results to the specified request options callback function.
|
||||
* @param request Options for sending reverse geocode request
|
||||
*/
|
||||
public reverseGeocode(request: ReverseGeocodeRequestOptions): void;
|
||||
}
|
||||
}
|
||||
-440
@@ -1,440 +0,0 @@
|
||||
/**
|
||||
* This module wraps the Query and GeoData REST API’s in the Bing Spatial Dara Services and expose them as an easy to use JavaScript library.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialDataService {
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// GeoData API
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/** Represents the options for requests boundary data from the GeoData API in the Bing Spatial Data Services. */
|
||||
export interface IGetBoundaryRequestOptions {
|
||||
/**
|
||||
* The level of detail for the boundary polygons returned. An integer between 0 and 3, where 0 specifies the coarsest level of boundary detail and 3
|
||||
* specifies the best. Default: 0
|
||||
*/
|
||||
lod?: number;
|
||||
|
||||
/**
|
||||
* The entity type to return. Default: CountryRegion
|
||||
* Supported entity types:
|
||||
* AdminDivision1, AdminDivision2, CountryRegion, eighborhood, PopulatedPlace, Postcode1, Postcode2, Postcode3, Postcode4
|
||||
* Note: Not all entity types are available in all areas.
|
||||
*/
|
||||
entityType?: string;
|
||||
|
||||
/**
|
||||
* Specifies the preferred language to use for any metadata text about the entity or polygons. Defaults to the culture used by the map control, which
|
||||
* usually automatically detected based on user's browser settings. Setting this property will override the default value.
|
||||
*/
|
||||
culture?: string;
|
||||
|
||||
/**
|
||||
* Specifies whether the response should include all of the boundary polygons for the requested entity or just return a single polygon that represents
|
||||
* the main outline of the entity. Default: false
|
||||
*/
|
||||
getAllPolygons?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies whether the response should include metadata about the entity, such as AreaSqKm and others. Default: false
|
||||
*/
|
||||
getEntityMetadata?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies the user’s home country or region.Defaults to the region setting of the user who loads the map.
|
||||
* Warning: Setting this property will override the default value, which is the region the user is actually in, and will allow the user to see boundaries
|
||||
* which may not align with the views of their region.This could result in geopolitically sensitive borders being returned.
|
||||
*/
|
||||
userRegion?: string;
|
||||
}
|
||||
|
||||
/** Represents the primitive object for a boundary returned by the GeoData API. */
|
||||
export interface IGeoDataPrimitive {
|
||||
/** A unique ID associated with this polygon primitive. */
|
||||
PrimitiveID: string;
|
||||
|
||||
/**
|
||||
* A comma-delimited sequence starting with the version number of the polygon set followed by a list of compressed polygon
|
||||
* "rings" (closed paths represented by sequences of latitude and-longitude points).
|
||||
*/
|
||||
Shape: string;
|
||||
|
||||
/** The number of vertex points used to define the polygon. */
|
||||
NumPoints: string;
|
||||
|
||||
/**
|
||||
* An ID identifying the data provider that supplied the data. This ID number will reference one of the sources listed in the
|
||||
* array of CopyrightSources in the Copyright property of the GeoDataResultSet object.
|
||||
*/
|
||||
SourceID: string;
|
||||
}
|
||||
|
||||
/** Represents the copyright source object for a boundary returned by the GeoData API. */
|
||||
export interface ICopyrightSource {
|
||||
/** The copyright string from the source. */
|
||||
Copyright: string;
|
||||
|
||||
/** An ID identifying the data provider that supplied the data. */
|
||||
SourceID: string;
|
||||
|
||||
/** The name of the data provider represented by this Source element. */
|
||||
SourceName: string;
|
||||
}
|
||||
|
||||
/** Represents the copyright object for a boundary returned by the GeoData API. */
|
||||
export interface ICopyright {
|
||||
/** The copyright URL for the GeoData service. */
|
||||
CopyrightURL: string;
|
||||
|
||||
/** A collection of CopyrightSource objects that give information about the sources of the polygon data that is returned. */
|
||||
Sources: ICopyrightSource[];
|
||||
}
|
||||
|
||||
/** Represents the name object for a boundary returned by the GeoData API. */
|
||||
export interface IName {
|
||||
/** The name of boundary. Example: "United States" */
|
||||
EntityName: string;
|
||||
|
||||
/** The culture of the region. */
|
||||
Culture: string;
|
||||
|
||||
/** An ID identifying the data provider that supplied the data. */
|
||||
SourceID: string;
|
||||
}
|
||||
|
||||
/** Represents the metadata object for a boundary returned by the GeoData API. Not all properties will be returned for all results. */
|
||||
export interface IMetadata {
|
||||
/** The approximate total surface area (in square kilometers) covered by all the polygons that comprise this entity. */
|
||||
AreaSqKm: string;
|
||||
|
||||
/**
|
||||
* An area on the Earth that provides the best map view for this entity. This area is defined as a bounding box in the format of a
|
||||
* “MULTIPOINT ((WestLongitude SouthLatitude), (EastLongitude NorthLatitude))”.
|
||||
*/
|
||||
BestMapViewBox: string;
|
||||
|
||||
/** The culture associated with this entity. Example: en */
|
||||
OfficialCulture: string;
|
||||
|
||||
/** The approximate population within this entity. Example: PopClass20000to99999 */
|
||||
PopulationClass: string;
|
||||
|
||||
/** The regional culture associated with this entity. */
|
||||
RegionalCulture: string;
|
||||
}
|
||||
|
||||
/** Represents a single result object returned by the GeoData API. */
|
||||
export interface IGeoDataResult {
|
||||
/** Copyright information for the returned boundary data. */
|
||||
Copyright: ICopyright;
|
||||
|
||||
/** A unique ID number associated with this entity. */
|
||||
EntityID: string;
|
||||
|
||||
/**
|
||||
* A collection of metadata information associated with the entity. The getEntityMetadata option of the request must be set
|
||||
* to true. Note, not all boundaries will return this metadata.
|
||||
*/
|
||||
EntityMetadata: IMetadata;
|
||||
|
||||
/** Information about the name of the boundary location. */
|
||||
Name: IName;
|
||||
|
||||
/** A Polygon object that has been generated from the data in the Primitives property. */
|
||||
Polygons: Polygon[];
|
||||
|
||||
/** An array of objects that contain the polygon information for the boundary. */
|
||||
Primitives: IGeoDataPrimitive[];
|
||||
}
|
||||
|
||||
/** Represents the set of results returned by the GeoData API. */
|
||||
export interface IGeoDataResultSet {
|
||||
/** Copyright information for the GeoData API. */
|
||||
Copyright: string;
|
||||
|
||||
/** The location provided in the query that generated this result. */
|
||||
location: string | Location;
|
||||
|
||||
/** Results of the boundary data. */
|
||||
results: IGeoDataResult[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a static class that provides the ability to request polygons that describe the boundaries of a geographic entities, such as an AdminDivision1
|
||||
* (such as a state or province) or a Postcode1 (such as a zip code) that contain a given point (latitude and longitude) or address. This uses the GeoData
|
||||
* API in the Bing Spatial Data Services.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export module GeoDataAPIManager {
|
||||
/**
|
||||
* Gets a boundary for the specified request. If the specified location value is a string, it will be geocoded and the coordinates of the result will
|
||||
* be used to find a boundary of the specified entityType that intersects with this coordinate.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param locations The locations to retrieve boundaries for. If the specified location value is a string, it will be geocoded and the coordinates of
|
||||
* the result will be used to find a boundary of the specified entityType that intersects with this coordinate.
|
||||
* @param request The request options for retrieving a boundary.
|
||||
* @param credentials A bing maps key or a map instance which can be used to provide credentials to access the data source. Note that the map will need
|
||||
* to be loaded with a bing maps key that has access to the data source.
|
||||
* @param callback A callback function to return the results to. If an array of locations are specified the callback function will be triggered for each location in the array.
|
||||
*/
|
||||
export function getBoundary(locations: string | Location | (string | Location)[], request: IGetBoundaryRequestOptions, credentials: string | Map, callback: (results: IGeoDataResultSet) => void): void;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Query API
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* An enumeration that defines how to compare the filters value against the corresponding property value.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export enum FilterCompareOperator {
|
||||
/** Determines if a string value ends with a specified string value. */
|
||||
endsWith,
|
||||
|
||||
/** Determines if two values are equal. */
|
||||
equals,
|
||||
|
||||
/** Determines if a first value is greater than a second value. */
|
||||
greaterThan,
|
||||
|
||||
/** Determines if a first value is greater than or equal to a second value. */
|
||||
greaterThanOrEqual,
|
||||
|
||||
/** Determines if a value is within an array. */
|
||||
isIn,
|
||||
|
||||
/** Determines if a first value is less than a second value. */
|
||||
lessThan,
|
||||
|
||||
/** Determines if a first value is less than or equal a second value. */
|
||||
lessThanOrEqual,
|
||||
|
||||
/** Determines if a string value does not end with a specified string value. */
|
||||
notEndsWith,
|
||||
|
||||
/** Determines if two values are not equal. */
|
||||
notEquals,
|
||||
|
||||
/** Determines if a string value does not start with a specified string value. */
|
||||
notStartsWith,
|
||||
|
||||
/** Determines if a string value starts with a specified string value. */
|
||||
startsWith
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration that defines how two or more filters are linked together.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export enum FilterLogicalOperator {
|
||||
/** Connects two or more filters that both must be true. */
|
||||
and,
|
||||
|
||||
/** Connects two or more filters where one of them must be true. */
|
||||
or
|
||||
}
|
||||
|
||||
/**
|
||||
* A Fitler object that defines the logic behind a filter expression that can be executed against a JSON object or generate
|
||||
* a filter string that can be used with the Bing Spatial Data Services.
|
||||
*/
|
||||
export interface IFilter {
|
||||
/**
|
||||
* Executes the filter logic against a JSON object and returns a boolean indicating if the object meets the requirements of the Filter.
|
||||
* @returns A boolean indicating if the specified object meets the requirements of the Filter.
|
||||
*/
|
||||
execute(object: any): boolean;
|
||||
|
||||
/**
|
||||
* Converts the filter logic into a string format that is compatible with the Bing Spatial Data Services.
|
||||
* @returns A filter string that is formatted such that it is compatible with the Bing Spatial Data Services.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Fitler class defines the logic behind a filter expression that can be executed against a JSON object or generate
|
||||
* a filter string that can be used with the Bing Spatial Data Services.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export class Filter implements IFilter {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param propertyName The name of the property in the object to test against. Can also provide child properties i.e. 'root.child'.
|
||||
* @param operator The operator to use when comparing the specified property to value to the provided value.
|
||||
* @param value A value to compare against.
|
||||
*/
|
||||
constructor(propertyName: string, operator: string | FilterCompareOperator, value: any);
|
||||
|
||||
/**
|
||||
* Executes the filter logic against a JSON object and returns a boolean indicating if the object meets the requirements of the Filter.
|
||||
* @returns A boolean indicating if the specified object meets the requirements of the Filter.
|
||||
*/
|
||||
public execute(object: any): boolean;
|
||||
|
||||
/**
|
||||
* Converts the filter logic into a string format that is compatible with the Bing Spatial Data Services.
|
||||
* @returns A filter string that is formatted such that it is compatible with the Bing Spatial Data Services.
|
||||
*/
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class that groups two or more logical filters or filter groups together. It can be executed against a JSON or generate
|
||||
* a filter string that can be used with the Bing Spatial Data Services.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export class FilterGroup implements IFilter {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param filters An array consisting of Filter or FilterGroup objects to combine.
|
||||
* @param operator The logical operator for combining the filters together.
|
||||
* @param not A boolean is the logical inverse should of the filter should be used.
|
||||
*/
|
||||
constructor(filters: IFilter[], operator: FilterLogicalOperator, not?: boolean)
|
||||
|
||||
/**
|
||||
* Executes the filter logic against a JSON object and returns a boolean indicating if the object meets the requirements of the Filter.
|
||||
* @returns A boolean indicating if the specified object meets the requirements of the Filter.
|
||||
*/
|
||||
public execute(object: any): boolean;
|
||||
|
||||
/**
|
||||
* Converts the filter logic into a string format that is compatible with the Bing Spatial Data Services.
|
||||
* @returns A filter string that is formatted such that it is compatible with the Bing Spatial Data Services.
|
||||
*/
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
/** Options for find near route query API. */
|
||||
export interface ISpatialFilterOptions {
|
||||
/**
|
||||
* One of the following values:
|
||||
* • nearby – Searches in a radius around a location.
|
||||
* • nearRoute – Searches for results that are within 1 mile of a route.
|
||||
* • intersects – Searches for results that intersect with the specified geometry.
|
||||
* Note: Note that the NavteqNA and NavteqEU data sources only support nearby queries.
|
||||
*/
|
||||
spatialFilterType: string;
|
||||
|
||||
/** Location at which the filter should be applied (only for nearby filter). */
|
||||
location?: string | Location;
|
||||
|
||||
/**
|
||||
* Radius to use when performing a nearby search. The distance in kilometers and must be between 0.16 and 1000 kilometers
|
||||
* (only for nearby filter).
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/** Start location of the route (only for nearroute filter). */
|
||||
start?: string | Location;
|
||||
|
||||
/** End location of the route (only for nearroute filter). */
|
||||
end?: string | Location;
|
||||
|
||||
/** Intersection object. Can be a well known text string or a LocationRect object (only for intersects filter). */
|
||||
intersects?: string | LocationRect | IPrimitive;
|
||||
}
|
||||
|
||||
/** Options for find near route query API. */
|
||||
export interface IFindNearRouteOptions extends ISpatialFilterOptions {
|
||||
/**
|
||||
* One of the following values:
|
||||
* • Driving [default]
|
||||
* • Walking
|
||||
*/
|
||||
travelMode?: string;
|
||||
|
||||
/**
|
||||
* An integer value between 0 and 359 that represents degrees from north
|
||||
* where north is 0 degrees and the heading is specified clockwise from north.
|
||||
* For example, setting the heading of 270 degrees creates a route that initially heads west
|
||||
*/
|
||||
heading?: number;
|
||||
|
||||
/**
|
||||
* An integer distance specified in meters.
|
||||
* Use this parameter to make sure that the moving vehicle has enough distance
|
||||
* to make the first turn
|
||||
*/
|
||||
distanceBeforeFirstTurn?: number;
|
||||
|
||||
/**
|
||||
* A list of values that limit the use of highways and toll roads in the route.
|
||||
* Use one of the following values:
|
||||
* • highways - Avoids the use of highways in the route.
|
||||
* • tolls - Avoids the use of toll roads in the route.
|
||||
* • minimizeHighways - Minimizes (tries to avoid) the use of highways in the route.
|
||||
* • minimizeTolls - Minimizes (tries to avoid) the use of toll roads in the route.
|
||||
*/
|
||||
avoid?: string[];
|
||||
|
||||
/**
|
||||
* One of the following values:
|
||||
* • distance - The route is calculated to minimize the distance.Traffic information is not used.
|
||||
* • time[default] - The route is calculated to minimize the time.Traffic information is not used.
|
||||
* • timeWithTraffic - The route is calculated to minimize the time and uses current traffic information.
|
||||
*/
|
||||
optimize?: string;
|
||||
}
|
||||
|
||||
/** Set of options that can be specified for query APIs. */
|
||||
export interface IQueryAPIOptions {
|
||||
/** A queryurl containing the access id, data source name and the entity type name. */
|
||||
queryUrl: string;
|
||||
|
||||
/** Specifies a conditional expression for a list of properties and values. */
|
||||
filter?: IFilter;
|
||||
|
||||
/** Specifies whether or not to return a count of the results in the response. Default: false */
|
||||
inlineCount?: boolean;
|
||||
|
||||
/** Specifies to query the staged version of the data source instead of the published version. Default: false */
|
||||
isStaging?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies one or more properties to use to sort the results of a query.
|
||||
* You can specify up to three (3) properties. Results are sorted in ascending order.
|
||||
* Note: You cannot use the latitude and longitude properties to sort results. You can use the elevation property.
|
||||
*/
|
||||
orderBy?: string[];
|
||||
|
||||
/**
|
||||
* Specifies the data source properties to return in the response. If the $select query option is not specified or
|
||||
* if it is set to "" ($select=), all data source properties are returned. Default: "*,_distance"
|
||||
*/
|
||||
select?: string[];
|
||||
|
||||
/** Specifies to not return a specified number of query results. */
|
||||
skip?: number;
|
||||
|
||||
/** Spatial filter options to apply. */
|
||||
spatialFilter?: ISpatialFilterOptions | IFindNearRouteOptions;
|
||||
|
||||
/** Specifies the maximum number of results to return in the query response. Default: 25 */
|
||||
top?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a static class that provides that ability to query data sources that are hosted by the Bing Spatial Data Services using the Query API.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export module QueryAPIManager {
|
||||
/**
|
||||
* Perform a search
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param queryOptions - Options for the query
|
||||
* @param credentials - Credentials for the query
|
||||
* @param callback - The function to call once the results are retrieved
|
||||
* @param styles - (Optional) Styles of the data that needs to be rendered on map
|
||||
*/
|
||||
export function search(queryOptions: IQueryAPIOptions,
|
||||
credentials: string | Map,
|
||||
callback: (data: IPrimitive[], inlineCount?: number) => void,
|
||||
styles?: IStylesOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
-530
@@ -1,530 +0,0 @@
|
||||
//////////////////////////////////////////////
|
||||
/// Core Library
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* This module provides a bunch of useful spatial math calculations.
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialMath {
|
||||
|
||||
/**
|
||||
* Distance Unit enumerator
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
**/
|
||||
export enum DistanceUnits {
|
||||
/** A distance in meters */
|
||||
Meters,
|
||||
|
||||
/** A distance in kilometers */
|
||||
Kilometers,
|
||||
|
||||
/** A distance in miles */
|
||||
Miles,
|
||||
|
||||
/** A distance in Feet */
|
||||
Feet,
|
||||
|
||||
/** A distance in Yards */
|
||||
Yards,
|
||||
|
||||
/** A distance in Nautical Miles */
|
||||
NauticalMiles
|
||||
}
|
||||
|
||||
/**
|
||||
* Area units enumerator
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
**/
|
||||
export enum AreaUnits {
|
||||
/** Area in square meters */
|
||||
SquareMeters,
|
||||
|
||||
/** Area in square kilometers */
|
||||
SquareKilometers,
|
||||
|
||||
/** Area in square miles */
|
||||
SquareMiles,
|
||||
|
||||
/** Area in square Feet */
|
||||
SquareFeet,
|
||||
|
||||
/** Area in square Yards */
|
||||
SquareYards,
|
||||
|
||||
/** Area in Acres */
|
||||
Acres,
|
||||
|
||||
/** Area in Hectares */
|
||||
Hectares
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Core Calculations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Converts an area from one area units to another.
|
||||
* @param area A number that represents an area to convert.
|
||||
* @param fromUnits The area units the original area is in.
|
||||
* @param toUnits The area units to convert to.
|
||||
* @returns An area in the new units.
|
||||
**/
|
||||
export function convertArea(area: number, fromUnits: AreaUnits, toUnits: AreaUnits): number;
|
||||
|
||||
/**
|
||||
* Converts a distance from one distance units to another.
|
||||
* @param distance A number that represents a distance to convert.
|
||||
* @param fromUnits The distance units the original distance is in.
|
||||
* @param toUnits The disired distance units to convert to.
|
||||
* @returns A distance in the new units.
|
||||
**/
|
||||
export function convertDistance(distance: number, fromUnits: DistanceUnits, toUnits: DistanceUnits): number;
|
||||
|
||||
/**
|
||||
* Calculates an array of locations that form a cardinal spline between the specified array of locations.
|
||||
* @param locations The array of locations to calculate the spline through.
|
||||
* @param tension A number that indicates the tightness of the curve. Can be any number, although a value between 0 and 1 is usually used. Default: 0.5
|
||||
* @param nodeSize Number of nodes to insert between each Location. Default: 15
|
||||
* @param close A boolean indicating if the spline should be a closed ring or not. Default: false
|
||||
* @returns An array of locations that form a cardinal spline between the specified array of locations.
|
||||
*/
|
||||
export function getCardinalSpline(locations: Location[], tension ?: number, nodeSize ?: number, close ?: boolean): Location[];
|
||||
|
||||
/**
|
||||
* Calculates a destination Location based on a starting Location, a heading, a distance, and a distance unit type.
|
||||
* @param origin Location that the destination is relative to.
|
||||
* @param bearing A heading angle between 0 - 360 degrees. 0 - North, 90 - East, 180 - South, 270 - West.
|
||||
* @param distance Distance that destination is away.
|
||||
* @param units Unit of distance measurement. Default is Meters.
|
||||
* @returns A Location that is the specified distance away from the origin.
|
||||
**/
|
||||
export function getDestination(origin: Location, bearing: number, distance: number, units?: DistanceUnits): Location;
|
||||
|
||||
/**
|
||||
* Calculate the distance between two Location objects on the surface of the earth using the Haversine formula.
|
||||
* @param origin First Location to calculate distance between.
|
||||
* @param destination Second Location to calculate distance between.
|
||||
* @param units Unit of distance measurement. Default is Meters.
|
||||
* @param highAccuracy When set enabled, will use the slower but more accurate Vincenty formula for calculating distances, rather than the Haversine formula.
|
||||
* @returns The shortest distance between two Locations in the specifed units.
|
||||
**/
|
||||
export function getDistanceTo(origin: Location, destination: Location, units?: DistanceUnits, highAccuracy?: boolean): number;
|
||||
|
||||
/**
|
||||
* Retrieves the radius of the earth in a specific distance unit for WGS84.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @returns A number that represents the radius of the earth in a specific distance unit.
|
||||
**/
|
||||
export function getEarthRadius(units?: DistanceUnits): number;
|
||||
|
||||
/**
|
||||
* Takes an array of Locations objects and fills in the space between them with accurately positioned Locations to form an approximated Geodesic path.
|
||||
* @param path Array of Location objects that form a path to fill in.
|
||||
* @param nodeSize Number of nodes to insert between each Location. Default: 15
|
||||
* @returns An array of Location objects that form a geodesic paths.
|
||||
**/
|
||||
export function getGeodesicPath(path: Location[], nodeSize?: number): Location[];
|
||||
|
||||
/**
|
||||
* Calculates the heading from one Location object to another.
|
||||
* @param origin Point of origin.
|
||||
* @param destination Destination to calculate relative heading to.
|
||||
* @returns A heading in degrees between 0 and 360. 0 degrees points due North.
|
||||
**/
|
||||
export function getHeading(origin: Location, destination: Location): number;
|
||||
|
||||
/**
|
||||
* Calculates the distance between all Location objects in an array.
|
||||
* @param path The array of Location objects that make up the path to calculate the length of.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @param highAccuracy If set to true, uses the more accurate Vincenty algorithm for calcuating distances. Otherwise the faster Haversine formula is used.
|
||||
* @returns The distance between all Locations in between all Location objects in an array on the surface of a earth in the specifed units.
|
||||
**/
|
||||
export function getLengthOfPath(path: Location[], units?: DistanceUnits, highAccuracy?: boolean): number;
|
||||
|
||||
/**
|
||||
* Calculates the Location object on a path that is a specified distance away from the start of the path. If the specified distance is longer
|
||||
* than the length of the path, the last Location of the path will be returned.
|
||||
* @param path A polyline or array of Location coordinates that form a path.
|
||||
* @param distance The distance along the path (from the start) to calculate the location for.
|
||||
* @param units Unit of distance measurement. Default is Meters.
|
||||
* @returns A Location object that is the specified distance away from the start of the path when following the path.
|
||||
**/
|
||||
export function getLocationAlongPath(path: Polyline | Location[], distance: number, units?: DistanceUnits): Location;
|
||||
|
||||
/**
|
||||
* Calculates an array of Location objects that are an equal distance away from a central point to create a regular polygon.
|
||||
* @param origin Center of the regular polygon.
|
||||
* @param radius Radius of the regular polygon.
|
||||
* @param numberOfPoints Number of points the polygon should have.
|
||||
* @param units Unit of distance measurement for radius. Default is Meters.
|
||||
* @param offset An offset to rotate the polygon clockwise in degrees. When 0 the first Location will align with North.
|
||||
* @returns An array of Location objects that form a regular polygon.
|
||||
**/
|
||||
export function getRegularPolygon(origin: Location, radius: number, numberOfPoints: number, units?: DistanceUnits, offset?: number): Location[];
|
||||
|
||||
/**
|
||||
* Calculates a Location object that is a fractional distance between two Location objects.
|
||||
* @param origin First Location to calculate mid-point between.
|
||||
* @param destination Second Location to calculate mid-point between.
|
||||
* @param fraction The fractional parameter to calculate a mid-point for. Default 0.5.
|
||||
* @returns A Location that lies a fraction of the distance between two Location objects, relative to the first Location object.
|
||||
**/
|
||||
export function interpolate(origin: Location, destination: Location, fraction?: number): Location;
|
||||
|
||||
/**
|
||||
* Takes a LocationRect and converts it to a polygon.
|
||||
* @param bounds The LocationRect to convert to a Polygon.
|
||||
* @returns A polygon representation of the LocationRect.
|
||||
**/
|
||||
export function locationRectToPolygon(bounds: LocationRect): Polygon;
|
||||
|
||||
/**
|
||||
* Takes a Location object and converts it into a Degree Minute Seconds string in the format. For example: 40° 26′ 46″ N 79° 58′ 56″ W
|
||||
* @param loc The Location object to convert into a Degree Minute Seconds string.
|
||||
* @returns A string in Degree Minute Seconds format or null if invalid Location object is provided.
|
||||
*/
|
||||
export function toDegMinSec(loc: Location): string;
|
||||
|
||||
/**
|
||||
* Tries to parse the given string that is in Degree Minute Seconds format. For Example: 35° 26′ 31″ E or 40° 26′ 46″ N 79° 58′ 56″ W
|
||||
* @param input A string in Degree Minute Seconds format to parse.
|
||||
* @returns Returns a decimal degree value if only a single angle is provided. If two angles provided in the string, then a
|
||||
* Location object is returned. If string is in an invalid format, null is returned.
|
||||
*/
|
||||
export function tryParseDegMinSec(input: string): number | Location;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Tile Calculations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A colleciton of mathematical algorithms based on the tile pyramid used by Bign Maps.
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialMath.Tiles {
|
||||
//Based on https://msdn.microsoft.com/en-us/library/bb259689.aspx
|
||||
|
||||
/**
|
||||
* Calculates the full width of the map in pixels at a specific zoom level from -180 degrees to 180 degrees.
|
||||
* @param zoom Zoom level to calculate width at.
|
||||
* @param tileWidth Width of tile.
|
||||
* @returns Width of map in pixels.
|
||||
**/
|
||||
export function mapSize(zoom: number): number;
|
||||
|
||||
/**
|
||||
* Calculates the Ground resolution at a specific degree of latitude in the specified units per pixel.
|
||||
* @param latitude Degree of latitude to calculate resolution at.
|
||||
* @param zoom Zoom level to calculate resolution at.
|
||||
* @param units Distance unit type to calculate resolution in.
|
||||
* @returns Ground resolution in distance unit per pixels.
|
||||
**/
|
||||
export function groundResolution(latitude: number, zoom: number, units?: SpatialMath.DistanceUnits): number;
|
||||
|
||||
/**
|
||||
* Converts a Pixel coordinate into a Geospatial Location at a specified zoom level.
|
||||
* Global Pixel coordinates are relative to the top left corner of the map (90, -180)
|
||||
* @param point Pixel coordinate.
|
||||
* @param zoom Zoom level.
|
||||
* @returns A Location that is at the specified pixel location at a specified zoom level.
|
||||
**/
|
||||
export function globalPixelToLocation(point: Point, zoom: number): Location;
|
||||
|
||||
/**
|
||||
* Converts a point from latitude/longitude WGS-84 Location (in degrees)
|
||||
* into pixel XY coordinates at a specified level of detail.
|
||||
* @param loc Location to convert to a global pixel.
|
||||
* @param zoom Level of detail, from 1 (lowest detail) to 23 (highest detail).
|
||||
* @returns Point object containing the the global pixel location of a Location.
|
||||
**/
|
||||
export function locationToGlobalPixel(loc: Location, zoom: number): Point;
|
||||
|
||||
/**
|
||||
* Calculates the PyramidTileId that a global pixel intersects with at a specific zoom level.
|
||||
* @param pixel The pixel coordinate to calculate the tile for.
|
||||
* @param zoom The zoom level to calculate the tile for.
|
||||
* @returns A PyramidTileId that a global pixel intersects with at a specific zoom level.
|
||||
**/
|
||||
export function globalPixelToTile(pixel: Point, zoom: number): PyramidTileId;
|
||||
|
||||
/**
|
||||
* Converts a PyramidTileId into a global pixel coordinates of the upper-left pixel of the specified tile.
|
||||
* @param tile A PyramidTileId to calculate the upper-left pixel for.
|
||||
* @returns Global pixel coordinate of the top left corner of a tile.
|
||||
**/
|
||||
export function tileToGlobalPixel(tile: PyramidTileId): Point;
|
||||
|
||||
/**
|
||||
* Calculates the PyramidTileId that a Location object intersects with at a specific zoom level.
|
||||
* @param loc The location to calulate the tile for.
|
||||
* @param zoom The zoom level to use to calculate the tile.
|
||||
* @returns A PyramidTileId that a Location object intersects with at a specific zoom level.
|
||||
**/
|
||||
export function locationToTile(loc: Location, zoom: number): PyramidTileId;
|
||||
|
||||
/**
|
||||
* Calculates all the PyramidTileId's that are within a LocationRect at a specific zoom level.
|
||||
* @param bounds A LocationRect to search for tiles in.
|
||||
* @param zoom The zoom level to calculate tiles for.
|
||||
* @returns A list of PyramidTileId's that are within the specified LocationRect and zoom level.
|
||||
**/
|
||||
export function getTilesInBounds(bounds: LocationRect, zoom: number): PyramidTileId[];
|
||||
|
||||
/**
|
||||
* Calculates the LocationRect (bounding box) of a PyramidTileId.
|
||||
* @param tile A PyramidTileId to calculate the LocationRect of.
|
||||
* @returns The bounding box of a tile.
|
||||
**/
|
||||
export function tileToLocationRect(tile: PyramidTileId): LocationRect;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Geometry Calculations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A colleciton of geometry calculations that can be performed against Bing Maps shapes.
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialMath.Geometry {
|
||||
|
||||
/** Defines how the end of a line should be buffered. */
|
||||
export enum BufferEndCap {
|
||||
/** Adds a rounded end to a buffered line. */
|
||||
Round,
|
||||
|
||||
/** Adds a flat end to a buffered line that touches the end of the line. */
|
||||
Flat,
|
||||
|
||||
/** Adds a square end to a buffered line that has a buffer area at the end of the line. */
|
||||
Square
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the area of a shape.
|
||||
* @param shape The shape to calculate the area of.
|
||||
* @param areaUnits The unit of measurement to calculate the area in.
|
||||
* @returns The area of a shape in the specified unit of measurement.
|
||||
*/
|
||||
export function area(shape: IPrimitive | IPrimitive[], areaUnits?: AreaUnits): number;
|
||||
|
||||
/**
|
||||
* Calculates a bounding box that encloses a set of shapes and/or locations.
|
||||
* @param shapes The shape(s) to calculate the bounding box for.
|
||||
* @returns A location rect that encloses the shapes and/or locations.
|
||||
*/
|
||||
export function bounds(shapes: Location | IPrimitive | (Location | IPrimitive)[]): LocationRect;
|
||||
|
||||
/**
|
||||
* Calcuates a shape with an updated boundary that has been inflated/deflated by a speicifed distance.
|
||||
* @param shape The shape to buffer.
|
||||
* @param distance The distance to buffer the shape by.
|
||||
* @param units The distance units to buffer the shape by.
|
||||
* @param endCapType The type of end cap to use for the joints of the buffer, default value is round.
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns A buffered version of the shape.
|
||||
*/
|
||||
export function buffer(shape: Location | IPrimitive | (Location | IPrimitive)[], distance: number, units?: DistanceUnits, endCapType?: BufferEndCap, options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Calculates the center of a shape.
|
||||
* @param shape The shape to calculate the center of.
|
||||
* @returns The center of the specified shape.
|
||||
*/
|
||||
export function centroid(shape: IPrimitive | IPrimitive[]): Location;
|
||||
|
||||
/**
|
||||
* Calculates an approximate concave hull that best fits the data.
|
||||
* A concave hull is a shape that represents that a possible concave geometry that encloses all shapes in the specified data set.
|
||||
* If a single unique Location is in the data set, a Pushpin is returned. If only two unique Locations are provided, or if all Locations form a line, a Polyline is returned.
|
||||
* If 3 or more unique Locations are in the data set a Polygon, or array of Polygons will be returned.
|
||||
* @param shapes Shape(s) whose Location(s) or Location(s) are to be used to generate a concave hull.
|
||||
* @param allowMultiPolygons A boolean indicating if the resulting concave hull can be a MultiPolygon. Default: false
|
||||
* @param allowHoles A boolean indicating if the polygons in the resulting concave hull can have holes in them. Default: false
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns An approximate concave hull that best fits the data.
|
||||
* If a single unique Location is in the data set, a Pushpin is returned. If only two unique Locations are provided, or if all Locations form a line, a Polyline is returned.
|
||||
* If 3 or more unique Locations are in the data set a Polygon, or array of Polygons will be returned.
|
||||
*/
|
||||
export function concaveHull(shapes: Location | IPrimitive | (Location | IPrimitive)[], allowMultiPolygons?: boolean, allowHoles?: boolean, options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Given two shapes, determines if the first one contains the second one
|
||||
* (or, the second shape is a subset of the first shape) or not.
|
||||
* @param shapeA The first shape to test against the second.
|
||||
* @param shapeB The second shape to test against the first.
|
||||
* @returns A boolean indicating if the first shape contains the second shape.
|
||||
*/
|
||||
export function contains(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): boolean;
|
||||
|
||||
/**
|
||||
* Calculates a convex hull. A convex hull is a shape that represents that minimum convex geometry that encloses all shapes in the specified data set.
|
||||
* @param shapes Shape(s) whose Location(s) or Location(s) are to be used to generate a convex hull.
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns An array of locations that form a convex hull that encloses all locations of the shapes provided in an array.
|
||||
*/
|
||||
export function convexHull(shapes: Location | IPrimitive | (Location | IPrimitive)[], options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Creates Delaunay Triangles from the Location objects of the provided shapes.
|
||||
* @param shapes Location(s) of shape(s) or Location(s) to generate a Delaunay Triangles from.
|
||||
* @param options A set of polyline or polygon options to apply to the generated shape.
|
||||
* @returns An array of shapes that form the polygon triangles of the delaunay triangles.
|
||||
*/
|
||||
export function delaunayTriangles(shapes: Location | IPrimitive | (Location | IPrimitive)[], options?: IPolygonOptions): Polygon[];
|
||||
|
||||
/**
|
||||
* Returns an object that represents area of an initial shape subtracted by the overlapping area of a second shape.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape to subtract from the first.
|
||||
* @returns A set of shapes that represent the area of the first shape that is not overlapped by the second shape.
|
||||
*/
|
||||
export function difference(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Calculates the approximate shortest distance between any two shapes.
|
||||
* @param shapeA The first shape to calculate the distance from.
|
||||
* @param shapeB The second shape to calculate the distance to.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @param highAccuracy If set to true, uses the more accurate Vincenty algorithm for calcuating distances. Otherwise the faster Haversine formula is used.
|
||||
* @returns The shorested distance between the shapes in the specified units.
|
||||
*/
|
||||
export function distance(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[], units?: DistanceUnits, highAccuracy?: boolean): number;
|
||||
|
||||
/**
|
||||
* Returns an object that represents the area where two shapes intersect.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns A set of shapes that represents the area where two shapes intersect.
|
||||
*/
|
||||
export function intersection(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Determines if two shapes intersect or not.
|
||||
* @param shapeA The first shape to test against the second.
|
||||
* @param shapeB The second shape to test against the first.
|
||||
* @returns A boolean indicating if the two shapes intersect.
|
||||
*/
|
||||
export function intersects(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): boolean;
|
||||
|
||||
/**
|
||||
* Tests to see if the shape is valid and meets the requirements of an SQL Geography type and other OGC compliant systems. Polylines & Polygons can't be self intersecting. For Polygons,
|
||||
* coordinates in an exterior rings have a counter-clockwise orientation, while holes have a clockwise orientation.
|
||||
* @param shape The shape to test for validity.
|
||||
* @returns Returns a boolean indicting if the specified shape(s) is valid or not.
|
||||
*/
|
||||
export function isValid(shape: IPrimitive | IPrimitive[]): boolean;
|
||||
|
||||
/**
|
||||
* Calculates the distance between all Locations in a shape. If the shape is a polygon, the length of the perimeter of all rings is calculated.
|
||||
* @param shape The shape to calculate the length of.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @param highAccuracy If set to true, uses the more accurate Vincenty algorithm for calcuating distances. Otherwise the faster Haversine formula is used.
|
||||
* @returns The distance between all Locations in a polyline or the perimeter of a ploygon on the surface of a earth in the specifed units.
|
||||
*/
|
||||
export function calculateLength(shape: IPrimitive | IPrimitive[], units ?: DistanceUnits, highAccuracy ?: boolean): number;
|
||||
|
||||
/**
|
||||
* Takes a shape and returns a copy of it that meets the requirements of an SQL Geography type and other OGC compliant systems. Polylines & Polygons can't be self intersecting. For Polygons,
|
||||
* coordinates in an exterior rings have a counter-clockwise orientation, while holes have a clockwise orientation.
|
||||
* @param shape The shape to make valid.
|
||||
* @returns Valiated version of the provided shape. May be a different shape type than what was provided. i.e. A polygon may be broken up into an array of polygons (MultiPolygon).
|
||||
*/
|
||||
export function makeValid(shape: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Calculates the nearest Location objects between to shapes that lie on the shapes.
|
||||
* If the shapes do not overlap, this calculates a location on each shape that is closest to the other shape.
|
||||
* If the shapes overlap, a location that is within the intersection area of the shapes will be added twice to an array, once for each shape, and returned.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns An array of two Location objects that represent the nearest points between two shapes.
|
||||
* The Location objects are in the same order as the input shapes.
|
||||
* Returns null if nearest points were unable to be computed.
|
||||
*/
|
||||
export function nearestLocations(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): Location[];
|
||||
|
||||
/**
|
||||
* Reduces the resolution of a shape using the Douglas-Peucker algorithm.
|
||||
* @param shape The shape to reduce the resolution of.
|
||||
* @param tolerance A tolerance distance in meters used by the reduction algorithms.
|
||||
* @returns A version of the specified shape that has been reduced.
|
||||
*/
|
||||
export function reduce(shape: IPrimitive | IPrimitive[], tolerance: number): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Rotates a shape around a given Location for the specified angle of rotation. If an origin is not provided, the centroid of the shape is used.
|
||||
* @param shape The shape to be rotated.
|
||||
* @param angle The amount to rotate the shape in degrees.
|
||||
* @param origin The location to rotate the shape around. Defaults to the centroid of the shape.
|
||||
*/
|
||||
export function rotate(shape: IPrimitive | IPrimitive[], angle: number, origin?: Location): void;
|
||||
|
||||
/**
|
||||
* Calculates the shortest path that between two shapes and returns a Polyline.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @param options A set of polyline options to apply to the generated polyline.
|
||||
* @returns A polyline that represents the shortest path between two shapes.
|
||||
*/
|
||||
export function shortestLineTo(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[], options?: IPolylineOptions): Polyline;
|
||||
|
||||
/**
|
||||
* Snaps the locations of one shape that are within the specified tolerance distance away from another shape.
|
||||
* @param locs The locations to snap to the shape.
|
||||
* @param shape The shape to snap the locations to.
|
||||
* @param tolerance A maximum distance (in the specified units) that the snapped location can be from the input location. Default: Infinity
|
||||
* @param toleranceUnits The distance units of the tolerance value. Default: Meters
|
||||
* @returns A snapped location if only one location is provided, otherwise returns an array of snapped locations.
|
||||
*/
|
||||
export function snapLocationsToShape(locs: Location | Location[], shape: IPrimitive | IPrimitive[], tolerance?: number, toleranceUnits?: DistanceUnits): Location | Location[];
|
||||
|
||||
/**
|
||||
* Snaps the locations of one shape that are within the specified tolerance distance away from another shape.
|
||||
* @param shapeToSnap The shape to snap the locations of.
|
||||
* @param shape The shape to snap the locations to.
|
||||
* @param tolerance A maximum distance (in the specified units) that the snapped location can be from the input location. Default: Infinity
|
||||
* @param toleranceUnits The distance units of the tolerance value. Default: Meters
|
||||
*/
|
||||
export function snapShapeToShape(shapeToSnap: IPrimitive | IPrimitive[], shape: IPrimitive | IPrimitive[], tolerance?: number, toleranceUnits?: DistanceUnits): void;
|
||||
|
||||
/**
|
||||
* Returns an object that represents all points that are either in one shape instance or another, but not those points that lie in both instances.
|
||||
* "Sym" stands for Symmetric. symDifference is an OGC standard name for this calculation used in most spatial math libraries, including SQL.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns A shape that represents the symetric difference between two shapes.
|
||||
*/
|
||||
export function symDifference(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Returns an object that represents the union of two shapes. If shapes don't overlap, an array of each individual shapes will be returned.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns A shape that represents the union of two shapes.
|
||||
*/
|
||||
export function union(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Performs a union operation on a set of shapes.
|
||||
* If a shape doesn't overlap with the rest, the returned result will be an array of shapes containing this shape and the union of the rest.
|
||||
* @param shapes An array of shapes to union together.
|
||||
* @returns A shape that represents the union of all specified shapes.
|
||||
*/
|
||||
export function unionAggregate(shapes: IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Creates a Voronoi diagram from the Location objects of the provided shapes. The diagram is returned as an array of Polygons.
|
||||
* If a clip region is specified, the diagram will be clipped accordingly.
|
||||
* @param shapes Location(s) of shape(s) or Location(s) to generate a Voronoi diagram.
|
||||
* @param clipRegion A region to clip the voronoi diagram to.
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns An array of polygons that form a Voronoi diagram.
|
||||
*/
|
||||
export function voronoiDiagram(shapes: Location | IPrimitive | (Location | IPrimitive)[], clipRegion?: LocationRect | Polygon, options?: IPolygonOptions): Polygon[];
|
||||
}
|
||||
Vendored
-68
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Adds a traffic incident and flow data to the map.
|
||||
* @requires The Microsoft.Maps.Traffic module.
|
||||
*/
|
||||
declare module Microsoft.Maps.Traffic {
|
||||
/** Options that can be customized in the Traffic manager. */
|
||||
export interface ITrafficOptions {
|
||||
/** Displays the traffic flow layer. */
|
||||
flowVisible?: boolean;
|
||||
|
||||
/** Displays all traffic incidents. */
|
||||
incidentsVisible?: boolean;
|
||||
|
||||
/** Displays the traffic legend. */
|
||||
legendVisible?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the opacity of the traffic flow tile layer. Must be a number between 0 and 1. The default is 1 unless the map
|
||||
* mode is set to lite, in which case the default is set to 0.7.
|
||||
*/
|
||||
opacity?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The TrafficManager class provides the ability to show traffic flow and incident data on top of the map. When creating an
|
||||
* instance of the TrafficManager class the map must be passed as an argument to the constructor.
|
||||
* @requires The Microsoft.Maps.Traffic module.
|
||||
*/
|
||||
export class TrafficManager {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Traffic module.
|
||||
* @param map A map instnce to attach the traffic manager to.
|
||||
*/
|
||||
constructor(map: Map);
|
||||
|
||||
/** Hides all traffic data. */
|
||||
public hide(): void;
|
||||
|
||||
/** Hides the traffic flow layer. */
|
||||
public hideFlow(): void;
|
||||
|
||||
/** Hides all traffic incidents. */
|
||||
public hideIncidents(): void;
|
||||
|
||||
/** Hides the traffic legend. */
|
||||
public hideLegend(): void;
|
||||
|
||||
/**
|
||||
* Sets the options for the traffic manager.
|
||||
* @param options The options for the traffic manager.
|
||||
*/
|
||||
public setOptions(options: ITrafficOptions): void;
|
||||
|
||||
/** Displays all traffic data. */
|
||||
public show(): void;
|
||||
|
||||
/** Displays the traffic flow layer. */
|
||||
public showFlow(): void;
|
||||
|
||||
/** Displays all traffic incidents. */
|
||||
public showIncidents(): void;
|
||||
|
||||
/** Displays the traffic legend. */
|
||||
public showLegend(): void;
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
declare module Microsoft.Maps {
|
||||
/**
|
||||
* Class responsible for readon/writing geo data in well known text format
|
||||
* @requires The Microsoft.Maps.WellKnownText module.
|
||||
*/
|
||||
export module WellKnownText {
|
||||
/**
|
||||
* Reads the data in wellknowntext format and returns the shapes. Multi-Geometry type shapes are returned as an array of shapes.
|
||||
* @param wkt The well known text string that needs to be parsed into shapes.
|
||||
* @param styles Styles to apply to the shapes.
|
||||
* @returns One of more shapes.
|
||||
*/
|
||||
export function read(wkt: string, styles?: IStylesOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Writes the data into wellknowntext format.
|
||||
* @param data The data that needs to be serialized.
|
||||
* @returns Well known text formatted string.
|
||||
*/
|
||||
export function write(data: IPrimitive | IPrimitive[]): string;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
namespace BingMapsTests {
|
||||
|
||||
// An interactive set of Bing Maps AJAX control usages can be found at http://www.bingmapsportal.com/isdk/ajaxv7
|
||||
// A full API description can be found at http://msdn.microsoft.com/en-us/library/gg427610.aspx
|
||||
export class TestFixture {
|
||||
|
||||
public createMap(
|
||||
// This key can be acquired at http://www.microsoft.com/maps/create-a-bing-maps-key.aspx
|
||||
bingMapsApiKey: string,
|
||||
// This is the HTML container that the map will be drawn inside of
|
||||
target: HTMLElement,
|
||||
// These positions will be placed as pushpins onto the map
|
||||
mapPositions: Array<Position>,
|
||||
// This will fire if the geolocation fails and will pass the original target (parameter 2)
|
||||
onFailure: (element: HTMLElement) => any) {
|
||||
|
||||
var self = this;
|
||||
var map: Microsoft.Maps.Map;
|
||||
|
||||
navigator.geolocation.getCurrentPosition((position: Position) => {
|
||||
|
||||
var locations: Array<Microsoft.Maps.Location> = new Array<Microsoft.Maps.Location>();
|
||||
var options: Microsoft.Maps.IMapLoadOptions;
|
||||
|
||||
function loadMap() {
|
||||
options = {
|
||||
credentials: bingMapsApiKey,
|
||||
enableClickableLogo: false,
|
||||
showDashboard: false,
|
||||
showScalebar: false,
|
||||
center: self.toLocation(position),
|
||||
zoom: 16,
|
||||
mapTypeId: Microsoft.Maps.MapTypeId.road
|
||||
};
|
||||
|
||||
target.innerHTML = "";
|
||||
|
||||
map = new Microsoft.Maps.Map(target, options);
|
||||
|
||||
for (var i = 0; i < mapPositions.length; ++i) {
|
||||
|
||||
var mapPosition: Position = mapPositions[i];
|
||||
var location: Microsoft.Maps.Location = self.createPushpin(map, mapPosition);
|
||||
|
||||
locations.push(location);
|
||||
}
|
||||
|
||||
// Sets the view of the map to the smallest size that contains all of the
|
||||
// specified locations (in this case the pusphin locations)
|
||||
map.setView({ bounds: Microsoft.Maps.LocationRect.fromLocations(locations) });
|
||||
}
|
||||
|
||||
if ((<any>window).Windows != undefined) {
|
||||
// Running in Win8 app
|
||||
Microsoft.Maps.loadModule("Microsoft.Maps.Map", { callback: loadMap });
|
||||
} else {
|
||||
// Running anywhere else
|
||||
loadMap();
|
||||
}
|
||||
}, () => onFailure(target), { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });
|
||||
|
||||
}
|
||||
|
||||
// Converts a standard HTML geolocation Position to a Location
|
||||
private toLocation(position: Position): Microsoft.Maps.Location {
|
||||
return new Microsoft.Maps.Location(position.coords.latitude, position.coords.longitude);
|
||||
}
|
||||
|
||||
// Creates a pushpin on a specified map and returns the Location for potentially setting the map view
|
||||
private createPushpin(map: Microsoft.Maps.Map, position: Position): Microsoft.Maps.Location {
|
||||
|
||||
var location: Microsoft.Maps.Location;
|
||||
var pushpin: Microsoft.Maps.Pushpin;
|
||||
|
||||
location = this.toLocation(position);
|
||||
pushpin = new Microsoft.Maps.Pushpin(location, null);
|
||||
|
||||
map.entities.push(pushpin);
|
||||
|
||||
return location;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-2850
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -85,7 +85,7 @@ export class ECPair {
|
||||
|
||||
static fromPublicKeyBuffer(buffer: Buffer, network: Network): ECPair;
|
||||
|
||||
static fromWIF(string: string, network: Network): ECPair;
|
||||
static fromWIF(string: string, network?: Network): ECPair;
|
||||
|
||||
static makeRandom(options?: { compressed?: boolean, network?: Network, rng?: Rng }): ECPair;
|
||||
}
|
||||
|
||||
+40
-36
@@ -1,10 +1,10 @@
|
||||
import Boom = require('boom');
|
||||
import * as Boom from 'boom';
|
||||
|
||||
// 4xx and data type
|
||||
|
||||
const badRequestError = Boom.badRequest('message', {some: 'data'});
|
||||
badRequestError.data.some;
|
||||
const badRequestError2: Boom.Boom = Boom.badImplementation('message');
|
||||
const badRequestError2: Boom = Boom.badImplementation('message');
|
||||
|
||||
const unauthorizedError1 = Boom.unauthorized('message', 'scheme', {some: 'attribute'});
|
||||
unauthorizedError1.output.payload.attributes === { some: 'attribute', error: 'message' };
|
||||
@@ -24,127 +24,131 @@ unauthorizedError4.output.headers === { 'WWW-Authenticate': 'scheme some="attrib
|
||||
|
||||
const paymentRequiredError = Boom.paymentRequired('message', {some: 'data'});
|
||||
paymentRequiredError.data.some;
|
||||
const paymentRequiredError2: Boom.Boom = Boom.paymentRequired('message');
|
||||
const paymentRequiredError2: Boom = Boom.paymentRequired('message');
|
||||
|
||||
const forbiddenError = Boom.forbidden('message', {some: 'data'});
|
||||
forbiddenError.data.some;
|
||||
const forbiddenError2: Boom.Boom = Boom.forbidden('message');
|
||||
const forbiddenError2: Boom = Boom.forbidden('message');
|
||||
|
||||
const notFoundError = Boom.notFound('message', {some: 'data'});
|
||||
notFoundError.data.some;
|
||||
const notFoundError2: Boom.Boom = Boom.notFound('message');
|
||||
const notFoundError2: Boom = Boom.notFound('message');
|
||||
|
||||
const methodNotAllowedError = Boom.methodNotAllowed('message', {some: 'data'});
|
||||
methodNotAllowedError.data.some;
|
||||
const methodNotAllowedError2: Boom.Boom = Boom.methodNotAllowed('message');
|
||||
const methodNotAllowedError2: Boom = Boom.methodNotAllowed('message');
|
||||
|
||||
const notAcceptableError = Boom.notAcceptable('message', {some: 'data'});
|
||||
notAcceptableError.data.some;
|
||||
const notAcceptableError2: Boom.Boom = Boom.notAcceptable('message');
|
||||
const notAcceptableError2: Boom = Boom.notAcceptable('message');
|
||||
|
||||
const proxyAuthRequiredError = Boom.proxyAuthRequired('message', {some: 'data'});
|
||||
proxyAuthRequiredError.data.some;
|
||||
const proxyAuthRequiredError2: Boom.Boom = Boom.proxyAuthRequired('message');
|
||||
const proxyAuthRequiredError2: Boom = Boom.proxyAuthRequired('message');
|
||||
|
||||
const clientTimeoutError = Boom.clientTimeout('message', {some: 'data'});
|
||||
clientTimeoutError.data.some;
|
||||
const clientTimeoutError2: Boom.Boom = Boom.clientTimeout('message');
|
||||
const clientTimeoutError2: Boom = Boom.clientTimeout('message');
|
||||
|
||||
const conflictError = Boom.conflict('message', {some: 'data'});
|
||||
conflictError.data.some;
|
||||
|
||||
const resourceGoneError = Boom.resourceGone('message', {some: 'data'});
|
||||
resourceGoneError.data.some;
|
||||
const resourceGoneError2: Boom.Boom = Boom.resourceGone('message');
|
||||
const resourceGoneError2: Boom = Boom.resourceGone('message');
|
||||
|
||||
const lengthRequiredError = Boom.lengthRequired('message', {some: 'data'});
|
||||
lengthRequiredError.data.some;
|
||||
const lengthRequiredError2: Boom.Boom = Boom.lengthRequired('message');
|
||||
const lengthRequiredError2: Boom = Boom.lengthRequired('message');
|
||||
|
||||
const preconditionFailedError = Boom.preconditionFailed('message', {some: 'data'});
|
||||
preconditionFailedError.data.some;
|
||||
const preconditionFailedError2: Boom.Boom = Boom.preconditionFailed('message');
|
||||
const preconditionFailedError2: Boom = Boom.preconditionFailed('message');
|
||||
|
||||
const entityTooLargeError = Boom.entityTooLarge('message', {some: 'data'});
|
||||
entityTooLargeError.data.some;
|
||||
const entityTooLargeError2: Boom.Boom = Boom.lengthRequired('message');
|
||||
const entityTooLargeError2: Boom = Boom.lengthRequired('message');
|
||||
|
||||
const uriTooLongError = Boom.uriTooLong('message', {some: 'data'});
|
||||
uriTooLongError.data.some;
|
||||
const uriTooLongError2: Boom.Boom = Boom.uriTooLong('message');
|
||||
const uriTooLongError2: Boom = Boom.uriTooLong('message');
|
||||
|
||||
const unsupportedMediaTypeError = Boom.unsupportedMediaType('message', {some: 'data'});
|
||||
unsupportedMediaTypeError.data.some;
|
||||
const unsupportedMediaTypeError2: Boom.Boom = Boom.unsupportedMediaType('message');
|
||||
const unsupportedMediaTypeError2: Boom = Boom.unsupportedMediaType('message');
|
||||
|
||||
const rangeNotSatisfiableError = Boom.rangeNotSatisfiable('message', {some: 'data'});
|
||||
rangeNotSatisfiableError.data.some;
|
||||
const rangeNotSatisfiableError2: Boom.Boom = Boom.rangeNotSatisfiable('message');
|
||||
const rangeNotSatisfiableError2: Boom = Boom.rangeNotSatisfiable('message');
|
||||
|
||||
const expectationFailedError = Boom.expectationFailed('message', {some: 'data'});
|
||||
expectationFailedError.data.some;
|
||||
const expectationFailedError2: Boom.Boom = Boom.expectationFailed('message');
|
||||
const expectationFailedError2: Boom = Boom.expectationFailed('message');
|
||||
|
||||
const teapotError = Boom.teapot('message', {some: 'data'});
|
||||
teapotError.data.some;
|
||||
const teapotError2: Boom.Boom = Boom.teapot('message');
|
||||
const teapotError2: Boom = Boom.teapot('message');
|
||||
|
||||
const badDataError = Boom.badData('message', {some: 'data'});
|
||||
badDataError.data.some;
|
||||
const badDataError2: Boom.Boom = Boom.badData('message');
|
||||
const badDataError2: Boom = Boom.badData('message');
|
||||
|
||||
const lockedError = Boom.locked('message', {some: 'data'});
|
||||
lockedError.data.some;
|
||||
const lockedError2: Boom.Boom = Boom.locked('message');
|
||||
const lockedError2: Boom = Boom.locked('message');
|
||||
|
||||
const failedDependencyError = Boom.failedDependency('message', {some: 'data'});
|
||||
failedDependencyError.data.some;
|
||||
const failedDependencyError2: Boom = Boom.failedDependency('message');
|
||||
|
||||
const preconditionRequiredError = Boom.preconditionRequired('message', {some: 'data'});
|
||||
preconditionRequiredError.data.some;
|
||||
const preconditionRequiredError2: Boom.Boom = Boom.preconditionRequired('message');
|
||||
const preconditionRequiredError2: Boom = Boom.preconditionRequired('message');
|
||||
|
||||
const tooManyRequestsError = Boom.tooManyRequests('message', {some: 'data'});
|
||||
tooManyRequestsError.data.some;
|
||||
const tooManyRequestsError2: Boom.Boom = Boom.tooManyRequests('message');
|
||||
const tooManyRequestsError2: Boom = Boom.tooManyRequests('message');
|
||||
|
||||
const illegalError = Boom.illegal('message', {some: 'data'});
|
||||
illegalError.data.some;
|
||||
const illegalError2: Boom.Boom = Boom.illegal('message');
|
||||
const illegalError2: Boom = Boom.illegal('message');
|
||||
|
||||
// 5xx and data type
|
||||
|
||||
const badImplementationError = Boom.badImplementation('message', {some: 'data'});
|
||||
badImplementationError.data.some;
|
||||
const badImplementationError2: Boom.Boom = Boom.badImplementation('message');
|
||||
const badImplementationError2: Boom = Boom.badImplementation('message');
|
||||
|
||||
const internalError = Boom.internal('message', {some: 'data'});
|
||||
internalError.data.some;
|
||||
const internalError2: Boom.Boom = Boom.internal('message');
|
||||
const internalError2: Boom = Boom.internal('message');
|
||||
|
||||
const notImplementedError = Boom.notImplemented('message', {some: 'data'});
|
||||
notImplementedError.data.some;
|
||||
const notImplementedError2: Boom.Boom = Boom.notImplemented('message');
|
||||
const notImplementedError2: Boom = Boom.notImplemented('message');
|
||||
|
||||
const badGatewayError = Boom.badGateway('message', {some: 'data'});
|
||||
badGatewayError.data.some;
|
||||
const badGatewayError2: Boom.Boom = Boom.badGateway('message');
|
||||
const badGatewayError2: Boom = Boom.badGateway('message');
|
||||
|
||||
const serverUnavailableError = Boom.serverUnavailable('message', {some: 'data'});
|
||||
serverUnavailableError.data.some;
|
||||
const serverUnavailableError2: Boom.Boom = Boom.serverUnavailable('message');
|
||||
const serverUnavailableError2: Boom = Boom.serverUnavailable('message');
|
||||
|
||||
const gatewayTimeoutError = Boom.gatewayTimeout('message', {some: 'data'});
|
||||
gatewayTimeoutError.data.some;
|
||||
const gatewayTimeoutError2: Boom.Boom = Boom.gatewayTimeout('message');
|
||||
const gatewayTimeoutError2: Boom = Boom.gatewayTimeout('message');
|
||||
|
||||
// boomify
|
||||
const boomifiedError = Boom.boomify(new Error('test'), { statusCode: 400, message: 'some message' });
|
||||
|
||||
// isBoom
|
||||
|
||||
const isBoomError = new Boom.Boom('test')
|
||||
const isBoomError = new Boom('test')
|
||||
|
||||
Boom.isBoom(isBoomError);
|
||||
|
||||
const maybeBoom = <any>new Boom.Boom('test');
|
||||
const maybeBoom = <any>new Boom('test');
|
||||
if(Boom.isBoom(maybeBoom)) {
|
||||
// isBoom is a type guard that allows accessing these properties:
|
||||
maybeBoom.output.headers;
|
||||
@@ -152,7 +156,7 @@ if(Boom.isBoom(maybeBoom)) {
|
||||
|
||||
// constructor
|
||||
|
||||
const constructorError: Boom.Boom = new Boom.Boom('test');
|
||||
const constructorError: Boom = new Boom('test');
|
||||
|
||||
constructorError.message;
|
||||
|
||||
@@ -180,11 +184,11 @@ interface CustomPayload extends Boom.Payload {
|
||||
* Test assignment of custom error data:
|
||||
*/
|
||||
const errorWithData = Boom.badImplementation('', { custom1: 'test', customType: 'Custom1', isCustom: true } as CustomData1);
|
||||
const errorWithNoExplicitDataType: Boom.Boom = errorWithData; // can assign to error without explicit data type
|
||||
const errorWithExplicitType: Boom.Boom<CustomData> = errorWithData; // can assign to union data type
|
||||
const errorWithConcreteCustomData: Boom.Boom<CustomData1> = errorWithData; // can assign to concrete data type
|
||||
const errorWithNoExplicitDataType: Boom = errorWithData; // can assign to error without explicit data type
|
||||
const errorWithExplicitType: Boom<CustomData> = errorWithData; // can assign to union data type
|
||||
const errorWithConcreteCustomData: Boom<CustomData1> = errorWithData; // can assign to concrete data type
|
||||
// assignment to CustomData2 would not be possible
|
||||
// const errorWithConcreteCustomData2: Boom.Boom<CustomData2> = errorWithData;
|
||||
// const errorWithConcreteCustomData2: Boom<CustomData2> = errorWithData;
|
||||
|
||||
// Some complex error data types for testing purposes:
|
||||
interface CustomDataBase {
|
||||
|
||||
Vendored
+54
-47
@@ -1,23 +1,22 @@
|
||||
// Type definitions for boom 7.1.1
|
||||
// Type definitions for boom 7.2.0
|
||||
// Project: https://github.com/hapijs/boom
|
||||
// Definitions by: Igor Rogatty <https://github.com/rogatty>
|
||||
// AJP <https://github.com/AJamesPhillips>
|
||||
// Jinesh Shah <https://github.com/jineshshah36>
|
||||
// Timon van Spronsen <https://github.com/TimonVS>
|
||||
// Daniel Machado <https://github.com/danielmachado>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export = Boom;
|
||||
|
||||
declare namespace Boom {
|
||||
|
||||
/**
|
||||
export = Boom;
|
||||
/**
|
||||
* boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties:
|
||||
* @see {@link https://github.com/hapijs/boom#boom}
|
||||
*/
|
||||
export class Boom<Data = any> extends Error {
|
||||
declare class Boom<Data = any> extends Error {
|
||||
|
||||
/** Creates a new Boom object using the provided message and then calling boomify() to decorate the error with the Boom properties. */
|
||||
constructor(message?: string | Error, options?: Options<Data>);
|
||||
constructor(message?: string | Error, options?: Boom.Options<Data>);
|
||||
/** isBoom - if true, indicates this is a Boom object instance. */
|
||||
isBoom: boolean;
|
||||
/** isServer - convenience bool indicating status code >= 500. */
|
||||
@@ -25,7 +24,7 @@ declare namespace Boom {
|
||||
/** message - the error message. */
|
||||
message: string;
|
||||
/** output - the formatted response. Can be directly manipulated after object construction to return a custom error response. Allowed root keys: */
|
||||
output: Output;
|
||||
output: Boom.Output;
|
||||
/** reformat() - rebuilds error.output using the other object properties. */
|
||||
reformat: () => string;
|
||||
/** "If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object." mentioned in @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */
|
||||
@@ -33,7 +32,7 @@ declare namespace Boom {
|
||||
/** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */
|
||||
data: Data;
|
||||
}
|
||||
|
||||
declare namespace Boom {
|
||||
interface Options<Data> {
|
||||
/** statusCode - the HTTP status code. Defaults to 500 if no status code is already set. */
|
||||
statusCode?: number;
|
||||
@@ -49,7 +48,7 @@ declare namespace Boom {
|
||||
override?: boolean;
|
||||
}
|
||||
|
||||
export interface Output {
|
||||
interface Output {
|
||||
/** statusCode - the HTTP status code (typically 4xx or 5xx). */
|
||||
statusCode: number;
|
||||
/** headers - an object containing any HTTP headers where each key is a header name and value is the header content. (Limited value type to string https://github.com/hapijs/boom/issues/151 ) */
|
||||
@@ -58,7 +57,7 @@ declare namespace Boom {
|
||||
payload: Payload;
|
||||
}
|
||||
|
||||
export interface Payload {
|
||||
interface Payload {
|
||||
/** statusCode - the HTTP status code, derived from error.output.statusCode. */
|
||||
statusCode: number;
|
||||
/** error - the HTTP status message (e.g. 'Bad Request', 'Internal Server Error') derived from statusCode. */
|
||||
@@ -80,13 +79,13 @@ declare namespace Boom {
|
||||
* @param options optional additional options
|
||||
* @see {@link https://github.com/hapijs/boom#boomifyerror-options}
|
||||
*/
|
||||
export function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): Boom<null>;
|
||||
function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): Boom<null>;
|
||||
|
||||
/**
|
||||
* Identifies whether an error is a Boom object. Same as calling instanceof Boom.
|
||||
* @param error the error object to identify.
|
||||
*/
|
||||
export function isBoom(error: Error): error is Boom
|
||||
function isBoom(error: Error): error is Boom
|
||||
|
||||
// 4xx
|
||||
/**
|
||||
@@ -95,7 +94,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boombadrequestmessage-data}
|
||||
*/
|
||||
export function badRequest<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function badRequest<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 401 Unauthorized error
|
||||
@@ -106,10 +105,10 @@ declare namespace Boom {
|
||||
* @param attributes an object of values to use while setting the 'WWW-Authenticate' header. This value is only used when scheme is a string, otherwise it is ignored. Every key/value pair will be included in the 'WWW-Authenticate' in the format of 'key="value"' as well as in the response payload under the attributes key. Alternatively value can be a string which is use to set the value of the scheme, for example setting the token value for negotiate header. If string is used message parameter must be null. null and undefined will be replaced with an empty string. If attributes is set, message will be used as the 'error' segment of the 'WWW-Authenticate' header. If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object.
|
||||
* @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes}
|
||||
*/
|
||||
export function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): Boom<null>;
|
||||
export function unauthorized(message?: string, scheme?: string[]): Boom<null>;
|
||||
export function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): Boom<null>;
|
||||
export function unauthorized(message?: null, scheme?: string[]): Boom<null>;
|
||||
function unauthorized(message?: string, scheme?: string, attributes?: {[index: string]: string}): Boom<null>;
|
||||
function unauthorized(message?: string, scheme?: string[]): Boom<null>;
|
||||
function unauthorized(message?: null, scheme?: string, attributes?: {[index: string]: string} | string): Boom<null>;
|
||||
function unauthorized(message?: null, scheme?: string[]): Boom<null>;
|
||||
|
||||
/**
|
||||
* Returns a 402 Payment Required error
|
||||
@@ -117,7 +116,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boompaymentrequiredmessage-data}
|
||||
*/
|
||||
export function paymentRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function paymentRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 403 Forbidden error
|
||||
@@ -125,7 +124,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomforbiddenmessage-data}
|
||||
*/
|
||||
export function forbidden<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function forbidden<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 404 Not Found error
|
||||
@@ -133,7 +132,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomnotfoundmessage-data}
|
||||
*/
|
||||
export function notFound<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function notFound<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 405 Method Not Allowed error
|
||||
@@ -142,7 +141,7 @@ declare namespace Boom {
|
||||
* @param allow optional string or array of strings (to be combined and separated by ', ') which is set to the 'Allow' header.
|
||||
* @see {@link https://github.com/hapijs/boom#boommethodnotallowedmessage-data-allow}
|
||||
*/
|
||||
export function methodNotAllowed<Data = null>(message?: string, data?: Data, allow?: string | string[]): Boom<Data>;
|
||||
function methodNotAllowed<Data = null>(message?: string, data?: Data, allow?: string | string[]): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 406 Not Acceptable error
|
||||
@@ -150,7 +149,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomnotacceptablemessage-data}
|
||||
*/
|
||||
export function notAcceptable<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function notAcceptable<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 407 Proxy Authentication Required error
|
||||
@@ -158,7 +157,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomproxyauthrequiredmessage-data}
|
||||
*/
|
||||
export function proxyAuthRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function proxyAuthRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 408 Request Time-out error
|
||||
@@ -166,7 +165,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomclienttimeoutmessage-data}
|
||||
*/
|
||||
export function clientTimeout<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function clientTimeout<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 409 Conflict error
|
||||
@@ -174,7 +173,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomconflictmessage-data}
|
||||
*/
|
||||
export function conflict<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function conflict<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 410 Gone error
|
||||
@@ -182,7 +181,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomresourcegonemessage-data}
|
||||
*/
|
||||
export function resourceGone<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function resourceGone<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 411 Length Required error
|
||||
@@ -190,7 +189,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomlengthrequiredmessage-data}
|
||||
*/
|
||||
export function lengthRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function lengthRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 412 Precondition Failed error
|
||||
@@ -198,7 +197,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boompreconditionfailedmessage-data}
|
||||
*/
|
||||
export function preconditionFailed<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function preconditionFailed<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 413 Request Entity Too Large error
|
||||
@@ -206,7 +205,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomentitytoolargemessage-data}
|
||||
*/
|
||||
export function entityTooLarge<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function entityTooLarge<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 414 Request-URI Too Large error
|
||||
@@ -214,7 +213,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomuritoolongmessage-data}
|
||||
*/
|
||||
export function uriTooLong<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function uriTooLong<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 415 Unsupported Media Type error
|
||||
@@ -222,7 +221,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomunsupportedmediatypemessage-data}
|
||||
*/
|
||||
export function unsupportedMediaType<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function unsupportedMediaType<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 416 Requested Range Not Satisfiable error
|
||||
@@ -230,7 +229,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomrangenotsatisfiablemessage-data}
|
||||
*/
|
||||
export function rangeNotSatisfiable<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function rangeNotSatisfiable<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 417 Expectation Failed error
|
||||
@@ -238,7 +237,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomexpectationfailedmessage-data}
|
||||
*/
|
||||
export function expectationFailed<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function expectationFailed<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 418 I'm a Teapot error
|
||||
@@ -246,7 +245,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomteapotmessage-data}
|
||||
*/
|
||||
export function teapot<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function teapot<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 422 Unprocessable Entity error
|
||||
@@ -254,7 +253,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boombaddatamessage-data}
|
||||
*/
|
||||
export function badData<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function badData<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 423 Locked error
|
||||
@@ -262,7 +261,15 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomlockedmessage-data}
|
||||
*/
|
||||
export function locked<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function locked<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 424 Failed Dependency error
|
||||
* @param message optional message.
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomfaileddependencymessage-data}
|
||||
*/
|
||||
function failedDependency<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 428 Precondition Required error
|
||||
@@ -270,7 +277,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boompreconditionrequiredmessage-data}
|
||||
*/
|
||||
export function preconditionRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function preconditionRequired<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 429 Too Many Requests error
|
||||
@@ -278,7 +285,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomtoomanyrequestsmessage-data}
|
||||
*/
|
||||
export function tooManyRequests<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function tooManyRequests<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 451 Unavailable For Legal Reasons error
|
||||
@@ -286,7 +293,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomillegalmessage-data}
|
||||
*/
|
||||
export function illegal<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function illegal<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
// 5xx
|
||||
/**
|
||||
@@ -296,7 +303,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal}
|
||||
*/
|
||||
export function badImplementation<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function badImplementation<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 500 Internal Server Error error
|
||||
@@ -305,7 +312,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boombadimplementationmessage-data---alias-internal}
|
||||
*/
|
||||
export function internal<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function internal<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 501 Not Implemented error with your error message to the user
|
||||
@@ -313,7 +320,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomnotimplementedmessage-data}
|
||||
*/
|
||||
export function notImplemented<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function notImplemented<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 502 Bad Gateway error with your error message to the user
|
||||
@@ -321,7 +328,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boombadgatewaymessage-data}
|
||||
*/
|
||||
export function badGateway<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function badGateway<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 503 Service Unavailable error with your error message to the user
|
||||
@@ -329,7 +336,7 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomserverunavailablemessage-data}
|
||||
*/
|
||||
export function serverUnavailable<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function serverUnavailable<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 504 Gateway Time-out error with your error message to the user
|
||||
@@ -337,5 +344,5 @@ declare namespace Boom {
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomgatewaytimeoutmessage-data}
|
||||
*/
|
||||
export function gatewayTimeout<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
function gatewayTimeout<Data = null>(message?: string, data?: Data): Boom<Data>;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -48,6 +48,7 @@ declare namespace Boom {
|
||||
export function expectationFailed(message?: string, data?: any): BoomError;
|
||||
export function badData(message?: string, data?: any): BoomError;
|
||||
export function locked(message?: string, data?: any): BoomError;
|
||||
export function failedDependency(message?: string, data?: any): BoomError;
|
||||
export function preconditionRequired(message?: string, data?: any): BoomError;
|
||||
export function tooManyRequests(message?: string, data?: any): BoomError;
|
||||
export function illegal(message?: string, data?: any): BoomError;
|
||||
|
||||
@@ -98,6 +98,10 @@ const lockedError = Boom.locked('message', {some: 'data'});
|
||||
lockedError.data.some;
|
||||
const lockedError2: Boom.BoomError = Boom.locked('message');
|
||||
|
||||
const failedDependencyError = Boom.failedDependency('message', {some: 'data'});
|
||||
failedDependencyError.data.some;
|
||||
const failedDependencyError2: Boom.BoomError = Boom.failedDependency('message');
|
||||
|
||||
const preconditionRequiredError = Boom.preconditionRequired('message', {some: 'data'});
|
||||
preconditionRequiredError.data.some;
|
||||
const preconditionRequiredError2: Boom.BoomError = Boom.preconditionRequired('message');
|
||||
|
||||
Vendored
+9
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Igor Rogatty <https://github.com/rogatty>
|
||||
// AJP <https://github.com/AJamesPhillips>
|
||||
// Jinesh Shah <https://github.com/jineshshah36>
|
||||
// Daniel Machado <https://github.com/danielmachado>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -258,6 +259,14 @@ declare namespace Boom {
|
||||
*/
|
||||
export function locked<Data = null>(message?: string, data?: Data): BoomError<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 424 Failed Dependency error
|
||||
* @param message optional message.
|
||||
* @param data optional additional error data.
|
||||
* @see {@link https://github.com/hapijs/boom#boomfaileddependencymessage-data}
|
||||
*/
|
||||
export function failedDependency<Data = null>(message?: string, data?: Data): BoomError<Data>;
|
||||
|
||||
/**
|
||||
* Returns a 428 Precondition Required error
|
||||
* @param message optional message.
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
function BootstrapDialogOptionsTests() {
|
||||
const options1: BootstrapDialog.DialogOptions = { };
|
||||
const options2: BootstrapDialog.DialogOptions = {
|
||||
animate: false,
|
||||
buttons: [{id: "btn-1"}],
|
||||
callback: (result: boolean) => { },
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
data: {name: "value"},
|
||||
draggable: false,
|
||||
description: "",
|
||||
buttonLabel: "",
|
||||
message: "",
|
||||
onhide: (dialog: BootstrapDialog.DialogContext) => { },
|
||||
onhidden: (dialog: BootstrapDialog.DialogContext) => { },
|
||||
onshow: (dialog: BootstrapDialog.DialogContext) => { },
|
||||
onshown: (dialog: BootstrapDialog.DialogContext) => { },
|
||||
size: BootstrapDialog.SIZE_LARGE,
|
||||
title: "",
|
||||
type: BootstrapDialog.TYPE_DEFAULT,
|
||||
btnCancelLabel: "",
|
||||
btnOKClass: "",
|
||||
btnOKLabel: "",
|
||||
cssClass: "",
|
||||
spinicon: "",
|
||||
autodestroy: false,
|
||||
nl2br: false,
|
||||
};
|
||||
options2.onhide = (dialog: BootstrapDialog.DialogContext): void => { };
|
||||
options2.onhide = (dialog: BootstrapDialog.DialogContext): boolean => false;
|
||||
options2.message = "";
|
||||
options2.message = $("#element");
|
||||
options2.message = (dialog?: BootstrapDialog.DialogContext): string => {
|
||||
return "";
|
||||
};
|
||||
options2.message = (dialog?: BootstrapDialog.DialogContext): JQuery => {
|
||||
return $("#element");
|
||||
};
|
||||
// BootstrapDialog.SIZE_xxx constants.
|
||||
options2.size = BootstrapDialog.SIZE_LARGE;
|
||||
options2.size = BootstrapDialog.SIZE_NORMAL;
|
||||
options2.size = BootstrapDialog.SIZE_SMALL;
|
||||
options2.size = BootstrapDialog.SIZE_WIDE;
|
||||
options2.title = "";
|
||||
options2.title = $("#element");
|
||||
// BootstrapDialog.TYPE_xxx constants.
|
||||
options2.type = BootstrapDialog.TYPE_DANGER;
|
||||
options2.type = BootstrapDialog.TYPE_DEFAULT;
|
||||
options2.type = BootstrapDialog.TYPE_INFO;
|
||||
options2.type = BootstrapDialog.TYPE_PRIMARY;
|
||||
options2.type = BootstrapDialog.TYPE_SUCCESS;
|
||||
options2.type = BootstrapDialog.TYPE_WARNING;
|
||||
}
|
||||
|
||||
function BootstrapDialogStaticTests() {
|
||||
BootstrapDialog.alert("");
|
||||
BootstrapDialog.alert("", () => { });
|
||||
BootstrapDialog.confirm("");
|
||||
BootstrapDialog.confirm("", (result: boolean) => { });
|
||||
const instance1: BootstrapDialog.DialogInstance = BootstrapDialog.show({});
|
||||
// BUTTON_SIZES
|
||||
BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_NORMAL] = '';
|
||||
const buttonSize: string = BootstrapDialog.BUTTON_SIZES[BootstrapDialog.SIZE_NORMAL];
|
||||
// Buttons order
|
||||
BootstrapDialog.BUTTONS_ORDER_CANCEL_OK = "";
|
||||
BootstrapDialog.BUTTONS_ORDER_OK_CANCEL = "";
|
||||
// DEFAULT_TEXTS
|
||||
BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DEFAULT] = 'Information';
|
||||
const defaultText: string = BootstrapDialog.DEFAULT_TEXTS[BootstrapDialog.TYPE_DEFAULT];
|
||||
// Miscellaneous
|
||||
BootstrapDialog.ICON_SPINNER = "";
|
||||
BootstrapDialog.NAMESPACE = "";
|
||||
}
|
||||
|
||||
function BootstrapDialogContextTests() {
|
||||
const dialog1: BootstrapDialog.DialogContext = BootstrapDialog({});
|
||||
dialog1.close();
|
||||
dialog1.enableButtons(false);
|
||||
const button: JQuery = dialog1.getButton("");
|
||||
const value: any = dialog1.getData("name");
|
||||
const modal: JQuery = dialog1.getModal();
|
||||
const content: JQuery = dialog1.getModalContent();
|
||||
const dialog: JQuery = dialog1.getModalDialog();
|
||||
const header: JQuery = dialog1.getModalHeader();
|
||||
const footer: JQuery = dialog1.getModalFooter();
|
||||
const body: JQuery = dialog1.getModalBody();
|
||||
const title: string = dialog1.getTitle();
|
||||
dialog1.open();
|
||||
dialog1.realize();
|
||||
dialog1.setClosable(false);
|
||||
dialog1.setData("name", "value");
|
||||
dialog1.setData("", null);
|
||||
dialog1.setMessage("");
|
||||
dialog1.setTitle("");
|
||||
dialog1.setType(BootstrapDialog.TYPE_DEFAULT);
|
||||
}
|
||||
|
||||
function BootstrapDialogInstanceTests() {
|
||||
const instance1: BootstrapDialog.DialogInstance = BootstrapDialog.show({});
|
||||
const modal: JQuery = instance1.$modal;
|
||||
const modalBody: JQuery = instance1.$modalBody;
|
||||
const modalContent: JQuery = instance1.$modalContent;
|
||||
const modalDialog: JQuery = instance1.$modalDialog;
|
||||
const modalHeader: JQuery = instance1.$modalHeader;
|
||||
const modalFooter: JQuery = instance1.$modalFooter;
|
||||
const options: BootstrapDialog.DialogOptions = instance1.options;
|
||||
const opened: boolean = instance1.opened;
|
||||
}
|
||||
|
||||
function BootstrapDialogButtonTests() {
|
||||
const button1: BootstrapDialog.DialogButton = { };
|
||||
const button2: BootstrapDialog.DialogButton = {
|
||||
id: "",
|
||||
label: "",
|
||||
hotkey: 0,
|
||||
icon: "",
|
||||
cssClass: "",
|
||||
data: {name: "value"},
|
||||
autospin: false,
|
||||
action: (dialog: BootstrapDialog.DialogContext) => { },
|
||||
};
|
||||
}
|
||||
Vendored
+197
@@ -0,0 +1,197 @@
|
||||
// Type definitions for bootstrap3-dialog 1.35
|
||||
// Project: http://nakupanda.github.io/bootstrap3-dialog
|
||||
// Definitions by: Dante <https://github.com/nakupanda>
|
||||
// Craig Boland <https://github.com/cnboland>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare namespace BootstrapDialog {
|
||||
interface DialogStatic {
|
||||
BUTTON_SIZES: any;
|
||||
BUTTONS_ORDER_CANCEL_OK: string;
|
||||
BUTTONS_ORDER_OK_CANCEL: string;
|
||||
DEFAULT_TEXTS: any; /** For text localization. */
|
||||
ICON_SPINNER: string;
|
||||
NAMESPACE: string;
|
||||
|
||||
SIZE_NORMAL: string;
|
||||
SIZE_SMALL: string;
|
||||
SIZE_WIDE: string;
|
||||
SIZE_LARGE: string;
|
||||
|
||||
TYPE_DEFAULT: string;
|
||||
TYPE_INFO: string;
|
||||
TYPE_PRIMARY: string;
|
||||
TYPE_SUCCESS: string;
|
||||
TYPE_WARNING: string;
|
||||
TYPE_DANGER: string;
|
||||
|
||||
(options: DialogOptions): DialogContext;
|
||||
alert(message: string, closeCallback?: () => void): void;
|
||||
confirm(message: string, closeCallback?: (result: boolean) => void): void;
|
||||
show(options: DialogOptions): DialogInstance;
|
||||
}
|
||||
|
||||
interface DialogOptions {
|
||||
/** Dialog header type. See BootstrapDialog.TYPE_xxx constants. */
|
||||
type?: string;
|
||||
/** Text size. See BootstrapDialog.SIZE_xxx constants. By default - SIZE_NORMAL */
|
||||
size?: string;
|
||||
/** Dialog title. Either string or JQuery element. */
|
||||
title?: string | JQuery;
|
||||
/** Dialog message. Either string, JQuery element, or function that returns either string or JQuery element. */
|
||||
message?: string | JQuery | ((dialog?: DialogContext) => string | JQuery);
|
||||
/**
|
||||
* When set to true, you can close the dialog by:
|
||||
* - Clicking the close icon in dialog header.
|
||||
* - Clicking outside the dialog.
|
||||
* - ESC key.
|
||||
*
|
||||
* FALSE by default.
|
||||
*/
|
||||
closable?: boolean;
|
||||
/** Whether dialog will close by clicking outside of it. */
|
||||
closeByBackdrop?: boolean;
|
||||
/** Whether dialog will close by ESC. */
|
||||
closeByKeyboard?: boolean;
|
||||
/** Whether fade-out background while showing the dialog. TRUE by default. */
|
||||
animate?: boolean;
|
||||
/** Data to be bound to the dialog. */
|
||||
data?: any;
|
||||
/** Whether dialog could be dragged by its header. Cursor could be changed (see doc)! FALSE by default. */
|
||||
draggable?: boolean;
|
||||
/**
|
||||
* If provided, 'aria-describedby' attribute will be added to the dialog with the description string as its value. This can improve accessibility, as the description can be read by screen
|
||||
* readers.
|
||||
*/
|
||||
description?: string;
|
||||
/** Default button title. OK by default. */
|
||||
buttonLabel?: string;
|
||||
buttons?: DialogButton[];
|
||||
/** Result will be true if button was click, while it will be false if users close the dialog directly. */
|
||||
callback?: (result: boolean) => void;
|
||||
/** If provided, it will be invoked when the dialog is popping up. */
|
||||
onshow?(dialog?: DialogContext): void;
|
||||
/** If provided, it will be invoked when the dialog is popped up. */
|
||||
onshown?(dialog?: DialogContext): void;
|
||||
/**
|
||||
* If provided, it will be invoked when the dialog is popping down.
|
||||
* Return FALSE to don`t close the dialog. Don`t return anything by default.
|
||||
*/
|
||||
onhide?(dialog?: DialogContext): any;
|
||||
/** If provided, it will be invoked when the dialog is popped down. */
|
||||
onhidden?(dialog?: DialogContext): void;
|
||||
|
||||
/** 'Cancel' by default. */
|
||||
btnCancelLabel?: string;
|
||||
/** 'OK' by default. */
|
||||
btnOKLabel?: string;
|
||||
/** If you didn't specify it, dialog type will be used. */
|
||||
btnOKClass?: string;
|
||||
/** Additional css classes that will be added to your dialog. */
|
||||
cssClass?: string;
|
||||
/** Icon class name, for example 'glyphicon glyphicon-check'. */
|
||||
spinicon?: string;
|
||||
/**
|
||||
* When it's true, all modal stuff will be removed from the DOM tree after the dialog is popped down,
|
||||
* set it to false if you need your dialog (same instance) pups up and down again and again.
|
||||
* Default is true.
|
||||
*/
|
||||
autodestroy?: boolean;
|
||||
/**
|
||||
* Automatically convert line breaking character to <br /> if it's set to true,
|
||||
* everything keeps original if it's false.
|
||||
*/
|
||||
nl2br?: boolean;
|
||||
}
|
||||
|
||||
interface DialogInstance {
|
||||
$modal: JQuery;
|
||||
$modalBody: JQuery;
|
||||
$modalContent: JQuery;
|
||||
$modalDialog: JQuery;
|
||||
$modalHeader: JQuery;
|
||||
$modalFooter: JQuery;
|
||||
options: DialogOptions;
|
||||
opened: boolean;
|
||||
}
|
||||
|
||||
interface DialogButton {
|
||||
/** If id is set, you can use dialogInstance.getButton(id) to get the button later. */
|
||||
id?: string;
|
||||
label?: string;
|
||||
/** Hotkey char code */
|
||||
hotkey?: number;
|
||||
/** If set, the specified icon will be added to the button. */
|
||||
icon?: string;
|
||||
/** Additional css class to be added to the button. */
|
||||
cssClass?: string;
|
||||
/** Object containing data attributes to be added to the button. */
|
||||
data?: any;
|
||||
/** If it's true, after clicked the button a spinning icon appears. */
|
||||
autospin?: boolean;
|
||||
/**
|
||||
* If provided, the callback will be invoked after the button is clicked, and the dialog instance
|
||||
* will be passed to the callback function.
|
||||
*/
|
||||
action?: (dialog: DialogContext) => void;
|
||||
}
|
||||
|
||||
interface DialogButtonInstance {
|
||||
toggleEnable(enabled: boolean): void;
|
||||
/** Equals to $button.toggleEnable(true); */
|
||||
enable(): void;
|
||||
/** Equals to $button.toggleEnable(false); */
|
||||
disable(): void;
|
||||
toggleSpin(spin: boolean): void;
|
||||
/** Equals to $button.toggleSpin(true); */
|
||||
spin(): void;
|
||||
/** Equals to $button.toggleSpin(false); */
|
||||
stopSpin(): void;
|
||||
}
|
||||
|
||||
interface DialogContext {
|
||||
/** Open the dialog. Usage: dialogInstance.open() */
|
||||
open(): void;
|
||||
/** Close the dialog. Usage: dialogInstance.close() */
|
||||
close(): void;
|
||||
/**
|
||||
* Calling dialog.open() will automatically get this method called first, but if you want to do something on your dialog
|
||||
* before it's shown, you can manually call dialog.realize() before calling dialog.open().
|
||||
*/
|
||||
realize(): void;
|
||||
getTitle(): string;
|
||||
setTitle(title: string): void;
|
||||
setMessage(message: string): void;
|
||||
/** Bind data entry to dialog instance, value can be any types that javascript supports. */
|
||||
setData(dataName: string, value: any): void;
|
||||
/** Get data entry according to the given key, returns null if no data entry found. */
|
||||
getData(dataName: string): any;
|
||||
getButton(buttonId: string): JQuery;
|
||||
/**
|
||||
* When set to true (default), dialog can be closed by clicking close icon in dialog header,
|
||||
* or by clicking outside the dialog, or, ESC key is pressed.
|
||||
*/
|
||||
setClosable(closable: boolean): void;
|
||||
/** See BootstrapDialog.TYPE_xxx constants. */
|
||||
setType(dialogType: string): void;
|
||||
/** Disable all buttons in dialog footer when it's false, enable all when it's true. */
|
||||
enableButtons(enable: boolean): void;
|
||||
/** Return the raw modal, equivalent to $('<div class='modal fade'...></div>') */
|
||||
getModal(): JQuery;
|
||||
/** Return the raw modal content. */
|
||||
getModalContent(): JQuery;
|
||||
/** Return the raw modal dialog. */
|
||||
getModalDialog(): JQuery;
|
||||
/** Return the raw modal header. */
|
||||
getModalHeader(): JQuery;
|
||||
/** Return the raw modal footer. */
|
||||
getModalFooter(): JQuery;
|
||||
/** Return the raw modal body. */
|
||||
getModalBody(): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
declare const BootstrapDialog: BootstrapDialog.DialogStatic;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bootstrap3-dialog-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -12,7 +12,7 @@ class BraftEditorTest extends React.Component<BraftEditor.editorProps> {
|
||||
height: 500,
|
||||
initialContent: this.state.content,
|
||||
onChange: this.handleChange,
|
||||
onHTMLChange: this.handleHTMLChange
|
||||
onHTMLChange: this.handleHTMLChange,
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
|
||||
Vendored
+2
-2
@@ -15,8 +15,8 @@ declare namespace BraftEditor {
|
||||
}
|
||||
interface editorProps {
|
||||
editorState?: any;
|
||||
contentFormat?: RawDraftContentState;
|
||||
initialContent?: RawDraftContentState | null;
|
||||
contentFormat?: 'raw' | 'html';
|
||||
initialContent?: string | null;
|
||||
onChange?: (content: RawDraftContentState) => void;
|
||||
onRawChange?: (content: RawDraftContentState) => void;
|
||||
onHTMLChange?: (content: string) => void;
|
||||
|
||||
Vendored
+3
@@ -5,6 +5,7 @@
|
||||
// Marshall Cottrell <https://github.com/marshall007>
|
||||
// Weeco <https://github.com/weeco>
|
||||
// Gabriel Terwesten <https://github.com/blaugold>
|
||||
// Oleg Repin <https://github.com/iamolegga>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -51,6 +52,8 @@ declare namespace Bull {
|
||||
settings?: AdvancedSettings;
|
||||
|
||||
limiter?: RateLimiter;
|
||||
|
||||
defaultJobOptions?: JobOptions;
|
||||
}
|
||||
|
||||
interface AdvancedSettings {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/Urthen/case-sensitive-paths-webpack-plugin#readme
|
||||
// Definitions by: Andrew Makarov <https://github.com/r3nya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
|
||||
Vendored
+2
@@ -198,6 +198,8 @@ declare namespace Chart {
|
||||
cutoutPercentage?: number;
|
||||
circumference?: number;
|
||||
rotation?: number;
|
||||
// Plugins can require any options
|
||||
plugins?: { [plugin: string]: any };
|
||||
}
|
||||
|
||||
interface ChartFontOptions {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { Color } from "chroma-js";
|
||||
import chroma = require("chroma-js");
|
||||
|
||||
function test_chroma() {
|
||||
chroma('hotpink');
|
||||
chroma('#ff3399');
|
||||
@@ -187,3 +190,9 @@ function test_types() {
|
||||
const color: chroma.Color = chroma('orange');
|
||||
const scale: chroma.Scale = chroma.scale('RdYlBu');
|
||||
}
|
||||
|
||||
// the following should actually, pass, but TS can't disambiguate between a parameter
|
||||
// which is passed as undefined/null or not passed at all
|
||||
// const scaleColors1: Color[] = chroma.scale(['black', 'white']).colors(12);
|
||||
const scaleColors2: Color[] = chroma.scale(['black', 'white']).colors(12, null);
|
||||
const scaleColors3: Color[] = chroma.scale(['black', 'white']).colors(12, undefined);
|
||||
|
||||
Vendored
+4
-4
@@ -303,10 +303,10 @@ declare namespace chroma {
|
||||
* You can call scale.colors(n) to quickly grab `c` equi-distant colors from a color scale. If called with no
|
||||
* arguments, scale.colors returns the original array of colors used to create the scale.
|
||||
*/
|
||||
colors(c?: number, format?: 'hex' | 'name'): string[];
|
||||
colors(c?: number, format?: null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[];
|
||||
colors(c?: number, format?: 'luminance' | 'temperature'): number[];
|
||||
colors<K extends keyof ColorSpaces>(c?: number, format?: K): Array<ColorSpaces[K]>;
|
||||
colors(c: number | undefined, format: undefined | null | 'alpha' | 'darken' | 'brighten' | 'saturate' | 'desaturate'): Color[];
|
||||
colors(c: number | undefined, format: 'luminance' | 'temperature'): number[];
|
||||
colors<K extends keyof ColorSpaces>(c: number | undefined, format: K): Array<ColorSpaces[K]>;
|
||||
colors(c: number | undefined, format?: 'hex' | 'name'): string[];
|
||||
|
||||
/**
|
||||
* If you want the scale function to return a distinct set of colors instead of a continuous gradient, you can
|
||||
|
||||
Vendored
+1
-1
@@ -5041,7 +5041,7 @@ declare namespace chrome.runtime {
|
||||
|
||||
export interface PortDisconnectEvent extends chrome.events.Event<(port: Port) => void> {}
|
||||
|
||||
export interface PortMessageEvent extends chrome.events.Event<(message: Object, port: Port) => void> {}
|
||||
export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> {}
|
||||
|
||||
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> {}
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/johnagan/clean-webpack-plugin
|
||||
// Definitions by: Jed Fox <https://github.com/j-f1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ client.getAccount("abcdef", (error: Error, account: coinbase.Account): void => {
|
||||
});
|
||||
});
|
||||
|
||||
client.getBuyPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.MoneyHash): void => undefined);
|
||||
client.getBuyPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.Price): void => undefined);
|
||||
|
||||
client.getCurrencies((error: Error, result: coinbase.Currency[]): void => undefined);
|
||||
|
||||
@@ -95,10 +95,10 @@ client.getPaymentMethod("foo", (error: Error, result: coinbase.PaymentMethod): v
|
||||
|
||||
client.getPaymentMethods((error: Error, result: coinbase.PaymentMethod[]): void => undefined);
|
||||
|
||||
client.getSellPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.MoneyHash): void => undefined);
|
||||
client.getSellPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.Price): void => undefined);
|
||||
|
||||
client.getSpotPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.MoneyHash): void => undefined);
|
||||
client.getSpotPrice({ currencyPair: "USD-BTC", date: "2017-22-01" }, (error: Error, result: coinbase.MoneyHash): void => undefined);
|
||||
client.getSpotPrice({ currencyPair: "USD-BTC" }, (error: Error, result: coinbase.Price): void => undefined);
|
||||
client.getSpotPrice({ currencyPair: "USD-BTC", date: "2017-22-01" }, (error: Error, result: coinbase.Price): void => undefined);
|
||||
|
||||
client.getTime((error: Error, result: coinbase.Time): void => undefined);
|
||||
|
||||
|
||||
Vendored
+30
-3
@@ -294,6 +294,33 @@ export interface MoneyHash {
|
||||
currency: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Price response
|
||||
*/
|
||||
export interface Price {
|
||||
data: {
|
||||
/**
|
||||
* Currency e.g. "BTC" (see Client#getCurrencies() for available strings)
|
||||
*/
|
||||
base: string;
|
||||
/**
|
||||
* Amount as floating-point in a string
|
||||
*/
|
||||
amount: string;
|
||||
/**
|
||||
* Currency e.g. "EUR" (see Client#getCurrencies() for available strings)
|
||||
*/
|
||||
currency: string;
|
||||
};
|
||||
warnings?: [
|
||||
{
|
||||
id: string
|
||||
message: string
|
||||
url: string
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export type ResourceType = "account" | "transaction" | "address" | "user" | "buy" | "sell" | "deposit" | "withdrawal" | "payment_method";
|
||||
|
||||
/**
|
||||
@@ -1308,7 +1335,7 @@ export class Client {
|
||||
* If you need more accurate price estimate for a specific payment method or amount, @see Account#buy() and `quote: true` option.
|
||||
* Scope: none
|
||||
*/
|
||||
getBuyPrice(opts: GetBuyPriceOpts, cb: (error: Error, result: MoneyHash) => void): void;
|
||||
getBuyPrice(opts: GetBuyPriceOpts, cb: (error: Error, result: Price) => void): void;
|
||||
|
||||
/**
|
||||
* Get the total price to sell one bitcoin or ether. Note that exchange rates fluctuates so the price is only correct for seconds at the time.
|
||||
@@ -1316,7 +1343,7 @@ export class Client {
|
||||
* estimate for a specific payment method or amount, see sell bitcoin endpoint and quote: true option.
|
||||
* Scope: none
|
||||
*/
|
||||
getSellPrice(opts: GetSellPriceOpts, cb: (error: Error, result: MoneyHash) => void): void;
|
||||
getSellPrice(opts: GetSellPriceOpts, cb: (error: Error, result: Price) => void): void;
|
||||
|
||||
/**
|
||||
* Get the current market price for bitcoin. This is usually somewhere in between the buy and sell price.
|
||||
@@ -1324,7 +1351,7 @@ export class Client {
|
||||
* You can also get historic prices with date parameter.
|
||||
* Scope: none
|
||||
*/
|
||||
getSpotPrice(opts: GetSpotPriceOpts, cb: (error: Error, result: MoneyHash) => void): void;
|
||||
getSpotPrice(opts: GetSpotPriceOpts, cb: (error: Error, result: Price) => void): void;
|
||||
|
||||
/**
|
||||
* Get the API server time.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/webpack-contrib/compression-webpack-plugin
|
||||
// Definitions by: Anton Kandybo <https://github.com/dublicator>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import express = require('express');
|
||||
import compress = require('compression');
|
||||
|
||||
@@ -7,3 +6,15 @@ app.use(compress());
|
||||
app.use(compress({
|
||||
threshold: 512
|
||||
}));
|
||||
app.use(compress({
|
||||
threshold: 512,
|
||||
filter: (req, res) => {
|
||||
if (req.headers['x-no-compression']) {
|
||||
// don't compress responses with this request header
|
||||
return false;
|
||||
}
|
||||
|
||||
// fallback to standard filter function
|
||||
return compress.filter(req, res);
|
||||
}
|
||||
}));
|
||||
Vendored
+17
-5
@@ -1,13 +1,26 @@
|
||||
// Type definitions for compression
|
||||
// Project: https://github.com/expressjs/compression
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo>
|
||||
// Rob van der Burgt <https://github.com/rburgt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
declare function e(options?: e.CompressionOptions): express.RequestHandler;
|
||||
|
||||
declare namespace e {
|
||||
interface CompressionOptions {
|
||||
/**
|
||||
* Default filter, used for extending filter given in CompressionOptions
|
||||
* See https://github.com/expressjs/compression#filter-1 regarding the usage
|
||||
*/
|
||||
export function filter(req: express.Request, res: express.Response): boolean;
|
||||
|
||||
interface CompressionFilter {
|
||||
(req: express.Request, res: express.Response): boolean;
|
||||
}
|
||||
|
||||
interface CompressionOptions {
|
||||
/**
|
||||
* See https://github.com/expressjs/compression#chunksize regarding the usage.
|
||||
*/
|
||||
@@ -31,7 +44,7 @@ declare namespace e {
|
||||
/**
|
||||
* See https://github.com/expressjs/compression#threshold regarding the usage.
|
||||
*/
|
||||
threshold?: number|string;
|
||||
threshold?: number | string;
|
||||
|
||||
/**
|
||||
* See https://github.com/expressjs/compression#windowbits regarding the usage.
|
||||
@@ -41,8 +54,8 @@ declare namespace e {
|
||||
/**
|
||||
* See https://github.com/expressjs/compression#filter regarding the usage.
|
||||
*/
|
||||
filter?: Function;
|
||||
|
||||
filter?: CompressionFilter;
|
||||
|
||||
/**
|
||||
* See https://nodejs.org/api/zlib.html#zlib_class_options regarding the usage.
|
||||
*/
|
||||
@@ -55,5 +68,4 @@ declare namespace e {
|
||||
}
|
||||
}
|
||||
|
||||
declare function e(options?: e.CompressionOptions): express.RequestHandler;
|
||||
export = e;
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/kevlened/copy-webpack-plugin
|
||||
// Definitions by: flying-sheep <https://github.com/flying-sheep>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack'
|
||||
import { IOptions } from 'minimatch'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import csv2json = require("csv2json");
|
||||
import fs = require("fs");
|
||||
|
||||
fs.createReadStream('data.csv')
|
||||
.pipe(csv2json({
|
||||
separator: ';'
|
||||
}))
|
||||
.pipe(fs.createWriteStream('data.json'));
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for csv2json 1.4
|
||||
// Project: https://github.com/julien-f/csv2json
|
||||
// Definitions by: Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Writable } from "stream";
|
||||
|
||||
declare namespace csv2json {
|
||||
interface Options {
|
||||
dynamicTyping?: boolean;
|
||||
separator?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function csv2json(options?: csv2json.Options): Writable;
|
||||
|
||||
export = csv2json;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"csv2json-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -63,6 +63,8 @@ let contGen: d3Contour.Contours = d3Contour.contours();
|
||||
|
||||
// size(...) -------------------------------------------------------------------
|
||||
|
||||
const multiPolygon: d3Contour.ContourMultiPolygon = contGen.contour(values, 5);
|
||||
|
||||
// set with chainability
|
||||
contGen = contGen.size([n, m]);
|
||||
|
||||
@@ -111,7 +113,11 @@ interface CustomDatum {
|
||||
|
||||
// Get contour generator -------------------------------------------------------
|
||||
|
||||
const contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity();
|
||||
// test generic parameter defaults for ContourDensity and contourDensity
|
||||
const contDensDefault: d3Contour.ContourDensity = d3Contour.contourDensity();
|
||||
// tslint:disable-next-line: use-default-type-parameter
|
||||
const contDensDefaultCopy: d3Contour.ContourDensity<[number, number]> = contDensDefault;
|
||||
// test with explicit generic parameter
|
||||
let contDensCustom: d3Contour.ContourDensity<CustomDatum> = d3Contour.contourDensity<CustomDatum>();
|
||||
|
||||
// Configure contour generator =================================================
|
||||
|
||||
Vendored
+23
-13
@@ -1,10 +1,10 @@
|
||||
// Type definitions for d3-contour 1.1
|
||||
// Type definitions for d3-contour 1.2
|
||||
// Project: https://d3js.org/d3-contour/
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Hugues Stefanski <https://github.com/Ledragon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// Last module patch version validated against: 1.1.0
|
||||
// Last module patch version validated against: 1.2.0
|
||||
|
||||
import { MultiPolygon } from 'geojson';
|
||||
import { ThresholdArrayGenerator, ThresholdCountGenerator } from 'd3-array';
|
||||
@@ -41,6 +41,17 @@ export interface Contours {
|
||||
*/
|
||||
(values: number[]): ContourMultiPolygon[];
|
||||
|
||||
/**
|
||||
* Computes a single contour, returning a GeoJSON MultiPolygon geometry object.
|
||||
* This geometry object represents the area where the input values are greater than or equal to the given threshold value;
|
||||
* the threshold value for the geometry object is exposed as geometry.value.
|
||||
*
|
||||
* @param values Array of input values. The input values must be an array of length n×m where [n, m] is the contour generator’s size;
|
||||
* furthermore, each values[i + jn] must represent the value at the position ⟨i, j⟩.
|
||||
* @param threshold Threshold value.
|
||||
*/
|
||||
contour(values: number[], threshold: number): ContourMultiPolygon;
|
||||
|
||||
/**
|
||||
* Return the expected size of the input values grid, which defaults to [1,1].
|
||||
*/
|
||||
@@ -109,8 +120,13 @@ export function contours(): Contours;
|
||||
|
||||
/**
|
||||
* A contour generator for density estimates.
|
||||
*
|
||||
* The generic refers to the data type of an element in the data array
|
||||
* used with the density contour generator. If omitted, the default setting assumes that,
|
||||
* the elements of the data array used with the density contour generator are two-element arrays.
|
||||
* The first element corresponds to the x-dimension, the second to the y-dimension.
|
||||
*/
|
||||
export interface ContourDensity<Datum> {
|
||||
export interface ContourDensity<Datum = [number, number]> {
|
||||
/**
|
||||
* Estimates the density contours for the given array of data, returning an array of GeoJSON MultiPolygon geometry objects.
|
||||
* Each geometry object represents the area where the estimated number of points per square pixel is greater than or equal to
|
||||
@@ -227,21 +243,15 @@ export interface ContourDensity<Datum> {
|
||||
bandwidth(bandwidth: number): this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new contour generator for density estimates with the default settings.
|
||||
*
|
||||
* The default settings assume that, the elements of the data array used
|
||||
* with the density contour generator are two-element arrays. The first element
|
||||
* corresponds to the x-dimension, the second to the y-dimension.
|
||||
*/
|
||||
export function contourDensity(): ContourDensity<[number, number]>;
|
||||
/**
|
||||
* Construct a new contour generator for density estimates.
|
||||
*
|
||||
* The generic refers to the data type of an element in the data array
|
||||
* used with the density contour generator.
|
||||
* used with the density contour generator. If omitted, the default setting assumes that,
|
||||
* the elements of the data array used with the density contour generator are two-element arrays.
|
||||
* The first element corresponds to the x-dimension, the second to the y-dimension.
|
||||
*
|
||||
* Important: ensure that the x- and y-accessor functions are configured to
|
||||
* match the data type used for the generic Datum.
|
||||
*/
|
||||
export function contourDensity<Datum>(): ContourDensity<Datum>;
|
||||
export function contourDensity<Datum = [number, number]>(): ContourDensity<Datum>;
|
||||
|
||||
@@ -67,7 +67,8 @@ let containerAccessor: (this: SVGCircleElement, d: CircleDatum, i: number, group
|
||||
containerAccessor = function(d, i, group) {
|
||||
console.log('Node Id of circle: ', d.nodeId);
|
||||
// console.log(this.a); // fails, a is not a property of SVGCircleElement
|
||||
return this.ownerSVGElement; // this-type is SVGCircleElement
|
||||
/* tslint:disable-next-line:no-unnecessary-type-assertion */
|
||||
return this.ownerSVGElement!; // this-type is SVGCircleElement
|
||||
};
|
||||
|
||||
// Test chainability
|
||||
@@ -75,7 +76,8 @@ circleDrag = circleDrag
|
||||
.container(function(d, i, group) { // container accessor function setter
|
||||
console.log('Node Id of circle: ', d.nodeId); // CircleDatum type
|
||||
// console.log(this.a); // fails, a is not a property of SVGCircleElement
|
||||
return this.ownerSVGElement; // this-type is SVGCircleElement
|
||||
/* tslint:disable-next-line:no-unnecessary-type-assertion */
|
||||
return this.ownerSVGElement!; // this-type is SVGCircleElement
|
||||
});
|
||||
|
||||
// Test chainability
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import Tracer = require('datadog-tracer');
|
||||
|
||||
const tracer = new Tracer({
|
||||
service: 'test'
|
||||
});
|
||||
|
||||
tracer.on('error', (e: any) => {
|
||||
void(0);
|
||||
});
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for datadog-tracer 0.4
|
||||
// Project: https://github.com/rochdev/datadog-tracer-js#readme
|
||||
// Definitions by: Dinesh Saravanan Kumaraswamy <https://github.com/dineshsaravanan>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import * as opentracing from "opentracing";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
export as namespace Tracer;
|
||||
export = Tracer;
|
||||
|
||||
interface TracerOptions {
|
||||
service: string;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
protocol?: string;
|
||||
endpoint?: string;
|
||||
}
|
||||
|
||||
declare class Tracer extends opentracing.Tracer {
|
||||
constructor(tracerOptions: TracerOptions);
|
||||
|
||||
on(method: "error", cb?: (e: any) => void): void;
|
||||
addEventListener(method: "error", cb?: (e: any) => void): void;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"opentracing": "^0.14.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"datadog-tracer-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-1
@@ -176,6 +176,7 @@ declare namespace dc {
|
||||
legend: IGetSet<Legend, T>;
|
||||
options(optionsObject: any): T;
|
||||
renderlet(fn: (chart: T) => any): T;
|
||||
useViewBoxResizing: IGetSet<boolean, T>;
|
||||
|
||||
on(event: "renderlet", fn: (chart: T, filter: any) => any): T;
|
||||
on(event: "pretransition", fn: (chart: T, filter: any) => any): T;
|
||||
@@ -484,4 +485,4 @@ declare namespace dc {
|
||||
boxPlot(parent: string, chartGroup?: string): BoxPlot;
|
||||
selectMenu(parent: string, chartGroup?: string): SelectMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Dispatcher, DispatcherInterface, DispatcherContext, Store } from '../index';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
declare class BaseStore<S = {}> extends EventEmitter implements Store<S> {
|
||||
constructor(dispatcher: DispatcherInterface);
|
||||
initialize?(): void;
|
||||
getContext(): DispatcherContext;
|
||||
addChangeListener(callback: () => void): void;
|
||||
removeChangeListener(callback: () => void): void;
|
||||
shouldDehydrate(): boolean;
|
||||
emitChange(): void;
|
||||
}
|
||||
|
||||
export = BaseStore;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { StoreClass, Store } from '../index';
|
||||
|
||||
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
|
||||
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
|
||||
|
||||
interface StoreOptions {
|
||||
storeName: string;
|
||||
handlers: { [event: string]: string };
|
||||
statics?: { [prop: string]: any };
|
||||
mixins?: object[];
|
||||
initialize?(): void;
|
||||
dehydrate?(): any;
|
||||
rehydrate?(state: any): void;
|
||||
}
|
||||
|
||||
// see: https://github.com/yahoo/fluxible/blob/dispatchr-v1.2.0/packages/dispatchr/addons/createStore.js#L9
|
||||
type StoreThis<T extends StoreOptions> = Omit<T, 'statics'|'storeName'|'handlers'|'mixins'> & Store;
|
||||
|
||||
declare function createStore<T extends StoreOptions>(options: T & ThisType<StoreThis<T>>): StoreClass;
|
||||
export = createStore;
|
||||
@@ -0,0 +1,46 @@
|
||||
import { createDispatcher, Store } from 'dispatchr';
|
||||
import createStore = require('dispatchr/addons/createStore');
|
||||
import BaseStore = require('dispatchr/addons/BaseStore');
|
||||
|
||||
const TestStore = createStore({
|
||||
storeName: 'TestStore',
|
||||
|
||||
handlers: {
|
||||
ACTION_NAME: 'actionHandler'
|
||||
},
|
||||
|
||||
statics: {
|
||||
staticMethod() {}
|
||||
},
|
||||
|
||||
initialize() { },
|
||||
|
||||
actionHandler() {
|
||||
this.emitChange();
|
||||
this.additionalMethod();
|
||||
},
|
||||
|
||||
additionalMethod() {}
|
||||
});
|
||||
|
||||
class ExtendedStore extends BaseStore {
|
||||
static handlers = {
|
||||
ACTION_NAME: 'actionHandler'
|
||||
};
|
||||
|
||||
actionHandler() {
|
||||
this.emitChange();
|
||||
}
|
||||
}
|
||||
|
||||
const dispatcher = createDispatcher({
|
||||
errorHandler(e, context) {
|
||||
e.meta;
|
||||
e.type;
|
||||
e.message;
|
||||
},
|
||||
stores: [TestStore]
|
||||
});
|
||||
|
||||
const context = dispatcher.createContext({});
|
||||
context.dispatch('ACTION_NAME', {});
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// Type definitions for dispatchr 1.2
|
||||
// Project: https://github.com/yahoo/fluxible#readme
|
||||
// Definitions by: Ragg <https://github.com/Ragg->
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.5
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export interface DispatcherState {
|
||||
stores: { [storeName: string]: any };
|
||||
}
|
||||
|
||||
export interface DispatcherOption {
|
||||
stores?: StoreClass[];
|
||||
errorHandler?: (e: DispatcherError, context: DispatcherContext) => void;
|
||||
}
|
||||
|
||||
export interface StoreClass {
|
||||
storeName: string;
|
||||
new(): Store;
|
||||
}
|
||||
|
||||
export interface Store<S = {}> extends EventEmitter {
|
||||
dehydrate?(): S;
|
||||
rehydrate?(state: S): void;
|
||||
shouldDehydrate?(): boolean;
|
||||
emitChange(): void;
|
||||
}
|
||||
|
||||
export interface Dispatcher {
|
||||
createContext(context: object): DispatcherContext;
|
||||
registerStore(store: StoreClass): void;
|
||||
isRegistered(store: StoreClass | string): boolean;
|
||||
getStoreName(store: StoreClass | string): string;
|
||||
}
|
||||
|
||||
export interface DispatcherInterface {
|
||||
getContext(): DispatcherContext;
|
||||
getStore: DispatcherContext['getStore'];
|
||||
waitFor: DispatcherContext['waitFor'];
|
||||
}
|
||||
|
||||
export interface DispatcherContext {
|
||||
getStore(name: string): Store;
|
||||
getStore<T extends StoreClass>(name: T): T;
|
||||
|
||||
dispatch(actionName: string, payload: any): void;
|
||||
|
||||
dehydrate(): DispatcherState;
|
||||
rehydrate(dispatcherState: DispatcherState): void;
|
||||
|
||||
waitFor(stores: ReadonlyArray<string|StoreClass>, callback: () => void): void;
|
||||
dispatcherInterface: DispatcherInterface;
|
||||
}
|
||||
|
||||
export interface DispatcherError {
|
||||
message: string;
|
||||
type: string;
|
||||
meta: {
|
||||
actionName?: string,
|
||||
payload?: any,
|
||||
error: Error
|
||||
};
|
||||
}
|
||||
|
||||
export function createDispatcher(options: DispatcherOption): Dispatcher;
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"addons/createStore.d.ts",
|
||||
"addons/BaseStore.d.ts",
|
||||
"dispatchr-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ declare namespace dragula {
|
||||
interface DragulaOptions {
|
||||
containers?: Element[];
|
||||
isContainer?: (el?: Element) => boolean;
|
||||
moves?: (el?: Element, container?: Element, handle?: Element) => boolean;
|
||||
moves?: (el?: Element, container?: Element, handle?: Element, sibling?: Element) => boolean;
|
||||
accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean;
|
||||
invalid?: (el?: Element, target?: Element) => boolean;
|
||||
direction?: string;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/darrenscerri/duplicate-package-checker-webpack-plugin#readme
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
/*!
|
||||
* Dynamsoft WebTwain PDF Addon
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2018, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
* Version: 13.4
|
||||
*/
|
||||
|
||||
declare enum EnumDWT_ConverMode {
|
||||
CM_DEFAULT = 0,
|
||||
TWPT_CM_RENDERALLGRAY = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
interface PDF {
|
||||
/**
|
||||
* Download and install pdf rasterizer add-on on the local system.
|
||||
* @method Dynamsoft.WebTwain#Download
|
||||
* @param {string} remoteFile specifies the value of which frame to get.
|
||||
* @param {function} optionalAsyncSuccessFunc optional.
|
||||
* The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
|
||||
* @param {function} optionalAsyncFailureFunc optional.
|
||||
* The function to call when the download fails. Please refer to the function prototype OnFailure.
|
||||
* @return {bool}
|
||||
*/
|
||||
Download(remoteFile: string,
|
||||
optionalAsyncSuccessFunc?: () => void,
|
||||
optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
|
||||
|
||||
/**
|
||||
* Input the password to decrypt PDF files using PDF Rasterizer add-on.
|
||||
* @method Dynamsoft.WebTwain#SetPassword
|
||||
* @param {string} password Specifies the PDF password.
|
||||
* @return {bool}
|
||||
*/
|
||||
SetPassword(password: string): boolean;
|
||||
|
||||
/**
|
||||
* Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN.
|
||||
* @method Dynamsoft.WebTwain#SetConvertMode
|
||||
* @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode.
|
||||
* @return {bool}
|
||||
*/
|
||||
SetConvertMode(convertMode: EnumDWT_ConverMode): boolean;
|
||||
|
||||
/**
|
||||
* Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN.
|
||||
* @method Dynamsoft.WebTwain#ReadRect
|
||||
* @param {float} fResolution Specifies the resolution for convert image from PDF file.
|
||||
* @return {bool}
|
||||
*/
|
||||
SetResolution(fResolution: number): boolean;
|
||||
|
||||
/**
|
||||
* Judges whether the local PDF is text-based or not.
|
||||
* @method Dynamsoft.WebTwain#ReadRect
|
||||
* @param {string} localFile specifies the local path of the target PDF.
|
||||
* @return {bool}
|
||||
*/
|
||||
IsTextBasedPDF(localFile: string): boolean;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
PDF: PDF;
|
||||
}
|
||||
|
||||
interface WebTwain {
|
||||
Addon: WebTwainAddon;
|
||||
}
|
||||
@@ -103,8 +103,8 @@ function downloadImage() {
|
||||
function loadPDF() {
|
||||
const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
|
||||
if (DWObject) {
|
||||
DWObject.Addon.PDF.SetResolution(200);
|
||||
DWObject.Addon.PDF.SetConvertMode(1);
|
||||
DWObject.Addon.PDF.SetResolution(200);
|
||||
DWObject.Addon.PDF.SetConvertMode(1);
|
||||
DWObject.IfShowFileDialog = true;
|
||||
DWObject.LoadImageEx(" ", 5);
|
||||
}
|
||||
|
||||
Vendored
+4
-70
@@ -1,7 +1,8 @@
|
||||
// Type definitions for dwt 13.3
|
||||
// Type definitions for dwt 13.4
|
||||
// Project: http://www.dynamsoft.com/Products/WebTWAIN_Overview.aspx
|
||||
// Definitions by: Xiao Ling <https://github.com/yushulx>
|
||||
// Josh Hall <https://github.com/jbh>
|
||||
// Lincoln Hu <https://github.com/lincoln2018>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -10,68 +11,11 @@
|
||||
* Product: Dynamsoft Web Twain
|
||||
* Web Site: http://www.dynamsoft.com
|
||||
*
|
||||
* Copyright 2017, Dynamsoft Corporation
|
||||
* Copyright 2018, Dynamsoft Corporation
|
||||
* Author: Dynamsoft Support Team
|
||||
* Version: 13.3
|
||||
* Version: 13.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dynamsoft WebTwain Addon PDF
|
||||
*/
|
||||
declare enum EnumDWT_ConverMode {
|
||||
CM_DEFAULT = 0,
|
||||
TWPT_CM_RENDERALLGRAY = 1
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
interface PDF {
|
||||
/**
|
||||
* Download and install pdf rasterizer add-on on the local system.
|
||||
* @method Dynamsoft.WebTwain#Download
|
||||
* @param {string} remoteFile specifies the value of which frame to get.
|
||||
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
|
||||
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
|
||||
* @return {bool}
|
||||
*/
|
||||
Download(remoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
|
||||
|
||||
/**
|
||||
* Input the password to decrypt PDF files using PDF Rasterizer add-on.
|
||||
* @method Dynamsoft.WebTwain#SetPassword
|
||||
* @param {string} password Specifies the PDF password.
|
||||
* @return {bool}
|
||||
*/
|
||||
SetPassword(password: string): boolean;
|
||||
|
||||
/**
|
||||
* Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN.
|
||||
* @method Dynamsoft.WebTwain#SetConvertMode
|
||||
* @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode.
|
||||
* @return {bool}
|
||||
*/
|
||||
SetConvertMode(convertMode: EnumDWT_ConverMode): boolean;
|
||||
|
||||
/**
|
||||
* Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN.
|
||||
* @method Dynamsoft.WebTwain#ReadRect
|
||||
* @param {float} fResolution Specifies the resolution for convert image from PDF file.
|
||||
* @return {bool}
|
||||
*/
|
||||
SetResolution(fResolution: number): boolean;
|
||||
|
||||
/**
|
||||
* Judges whether the local PDF is text-based or not.
|
||||
* @method Dynamsoft.WebTwain#ReadRect
|
||||
* @param {string} localFile specifies the local path of the target PDF.
|
||||
* @return {bool}
|
||||
*/
|
||||
IsTextBasedPDF(localFile: string): boolean;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @namespace Dynamsoft
|
||||
*/
|
||||
@@ -1318,21 +1262,11 @@ interface Container {
|
||||
Height: string | number;
|
||||
}
|
||||
|
||||
interface WebTwainAddon {
|
||||
PDF: PDF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
// properties (get/set) / sync functions
|
||||
interface WebTwain {
|
||||
/**
|
||||
* Returns addon.
|
||||
* @type {WebTwainAddon}
|
||||
*/
|
||||
Addon: WebTwainAddon;
|
||||
|
||||
/**
|
||||
* Returns or sets whether multi-page selection is supported.
|
||||
* @type {bool}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"addon.pdf.d.ts",
|
||||
"dwt-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -266,6 +266,30 @@ client.search({
|
||||
}
|
||||
});
|
||||
|
||||
client.updateByQuery({
|
||||
index: 'myIndex',
|
||||
type: 'mytype',
|
||||
}, (error, response) => {
|
||||
const {
|
||||
took,
|
||||
timed_out,
|
||||
updated,
|
||||
deleted,
|
||||
batches,
|
||||
version_conflicts,
|
||||
noops,
|
||||
retries,
|
||||
throttled_millis,
|
||||
throttled_until_millis,
|
||||
total,
|
||||
failures
|
||||
} = response;
|
||||
|
||||
const { bulk, search } = retries;
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
client.indices.updateAliases({
|
||||
body: {
|
||||
actions: [
|
||||
|
||||
Vendored
+21
-2
@@ -89,8 +89,8 @@ export class Client {
|
||||
termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void;
|
||||
update(params: UpdateDocumentParams): Promise<any>;
|
||||
update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams): Promise<any>;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams): Promise<UpdateDocumentByQueryResponse>;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: UpdateDocumentByQueryResponse) => void): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
@@ -785,6 +785,25 @@ export interface UpdateDocumentByQueryParams extends GenericParams {
|
||||
type: NameList;
|
||||
}
|
||||
|
||||
export interface UpdateDocumentByQueryResponse {
|
||||
took: number;
|
||||
timed_out: boolean;
|
||||
updated: number;
|
||||
deleted: number;
|
||||
batches: number;
|
||||
version_conflicts: number;
|
||||
noops: number;
|
||||
retries: {
|
||||
bulk: number;
|
||||
search: number;
|
||||
};
|
||||
throttled_millis: number;
|
||||
requests_per_second: number;
|
||||
throttled_until_millis: number;
|
||||
total: number;
|
||||
failures: any[];
|
||||
}
|
||||
|
||||
export interface Cat {
|
||||
aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void;
|
||||
aliases(params: CatAliasesParams): Promise<any>;
|
||||
|
||||
Vendored
+4
-1
@@ -23,6 +23,9 @@ declare module 'ember-data' {
|
||||
type AttributesFor<Model> = keyof Model; // TODO: filter to attr properties only (TS 2.8)
|
||||
type RelationshipsFor<Model> = keyof Model; // TODO: filter to hasMany/belongsTo properties only (TS 2.8)
|
||||
|
||||
export interface ChangedAttributes {
|
||||
[key: string]: [any, any] | undefined;
|
||||
}
|
||||
interface AttributeMeta<Model extends DS.Model> {
|
||||
type: keyof TransformRegistry;
|
||||
options: object;
|
||||
@@ -500,7 +503,7 @@ declare module 'ember-data' {
|
||||
* Returns an object, whose keys are changed properties, and value is
|
||||
* an [oldProp, newProp] array.
|
||||
*/
|
||||
changedAttributes(): {};
|
||||
changedAttributes(): ChangedAttributes;
|
||||
/**
|
||||
* If the model `hasDirtyAttributes` this function will discard any unsaved
|
||||
* changes. If the model `isNew` it will be removed from the store.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
import DS, { ChangedAttributes } from 'ember-data';
|
||||
import { assertType } from "./lib/assert";
|
||||
|
||||
const Person = DS.Model.extend({
|
||||
@@ -30,3 +30,7 @@ assertType<Date>(user.get('createdAt'));
|
||||
|
||||
user.serialize();
|
||||
user.serialize({ includeId: true });
|
||||
user.serialize({ includeId: true });
|
||||
|
||||
const attributes = user.changedAttributes();
|
||||
assertType<ChangedAttributes>(attributes);
|
||||
|
||||
Vendored
+5
@@ -2078,6 +2078,7 @@ declare module 'ember' {
|
||||
* Transition the application into another route. The route may
|
||||
* be either a single route or route path:
|
||||
*/
|
||||
transitionTo(name: string, options?: {}): Transition;
|
||||
transitionTo(name: string, ...models: any[]): Transition;
|
||||
transitionTo(name: string, options: {}): Transition;
|
||||
}
|
||||
@@ -3305,6 +3306,7 @@ declare module 'ember' {
|
||||
* @param options optional hash with a queryParams property containing a
|
||||
* mapping of query parameters
|
||||
*/
|
||||
isActive(routeName: string, options?: { queryParams: object }): boolean;
|
||||
isActive(routeName: string, models: RouteModel, options?: { queryParams: object }): boolean;
|
||||
isActive(routeName: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): boolean;
|
||||
isActive(routeName: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): boolean;
|
||||
@@ -3322,6 +3324,7 @@ declare module 'ember' {
|
||||
* containing a mapping of query parameters
|
||||
* @returns the Transition object associated with this attempted transition
|
||||
*/
|
||||
replaceWith(routeNameOrUrl: string, options?: { queryParams: object }): Ember.Transition;
|
||||
replaceWith(routeNameOrUrl: string, models: RouteModel, options?: { queryParams: object }): Ember.Transition;
|
||||
replaceWith(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): Ember.Transition;
|
||||
replaceWith(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): Ember.Transition;
|
||||
@@ -3339,6 +3342,7 @@ declare module 'ember' {
|
||||
* containing a mapping of query parameters
|
||||
* @returns the Transition object associated with this attempted transition
|
||||
*/
|
||||
transitionTo(routeNameOrUrl: string, options?: { queryParam: object }): Ember.Transition;
|
||||
transitionTo(routeNameOrUrl: string, models: RouteModel, options?: { queryParams: object }): Ember.Transition;
|
||||
transitionTo(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): Ember.Transition;
|
||||
transitionTo(routeNameOrUrl: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): Ember.Transition;
|
||||
@@ -3355,6 +3359,7 @@ declare module 'ember' {
|
||||
* a mapping of query parameters
|
||||
* @returns the string representing the generated URL
|
||||
*/
|
||||
urlFor(routeName: string, options?: { queryParams: object }): string;
|
||||
urlFor(routeName: string, models: RouteModel, options?: { queryParams: object }): string;
|
||||
urlFor(routeName: string, modelsA: RouteModel, modelsB: RouteModel, options?: { queryParams: object }): string;
|
||||
urlFor(routeName: string, modelsA: RouteModel, modelsB: RouteModel, modelsC: RouteModel, options?: { queryParams: object }): string;
|
||||
|
||||
@@ -22,3 +22,21 @@ AppRouter.map(function() {
|
||||
this.mount('my-engine');
|
||||
this.mount('my-engine', { as: 'some-other-engine', path: '/some-other-engine'});
|
||||
});
|
||||
|
||||
const RouterServiceConsumer = Ember.Service.extend({
|
||||
router: Ember.inject.service('router'),
|
||||
transitionWithoutModel() {
|
||||
Ember.get(this, 'router')
|
||||
.transitionTo('some-route');
|
||||
},
|
||||
transitionWithModel() {
|
||||
const model = Ember.Object.create();
|
||||
Ember.get(this, 'router')
|
||||
.transitionTo('some.other.route', model);
|
||||
},
|
||||
transitionWithModelAndOptions() {
|
||||
const model = Ember.Object.create();
|
||||
Ember.get(this, 'router')
|
||||
.transitionTo('index', model, { queryParams: { search: 'ember' }});
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+2
-1
@@ -1,7 +1,8 @@
|
||||
// Type definitions for enhanced-resolve v3.0.0
|
||||
// Project: https://github.com/webpack/enhanced-resolve.git
|
||||
// Definitions by: e-cloud <https://github.com/e-cloud>, Onigoetz <https://github.com/onigoetz>
|
||||
// Definitions by: e-cloud <https://github.com/e-cloud>, Onigoetz <https://github.com/onigoetz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="tapable" />
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"tapable": ["tapable/v0"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
Vendored
+1
-1
@@ -500,7 +500,7 @@ interface PromiseConstructor {
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* a resolve callback used to resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import EventEmitter = require("event-emitter-es6");
|
||||
|
||||
const ee = new EventEmitter();
|
||||
const ee1 = new EventEmitter({ emitDelay: 50 });
|
||||
const ee2 = new EventEmitter({ strictMode: true });
|
||||
const ee3 = new EventEmitter({ strictMode: false, emitDelay: 5 });
|
||||
const ee4 = new EventEmitter({});
|
||||
|
||||
ee.on("test", () => {});
|
||||
ee.once("test", () => {});
|
||||
ee.off("test", () => {});
|
||||
ee.off("test");
|
||||
ee.emit("test");
|
||||
ee.emit("test", 1, 2, 3, "a", "b", "c");
|
||||
ee.emitSync("test");
|
||||
ee.emitSync("test", 1, 2, 3, "a", "b", "c");
|
||||
ee.destroy();
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
// Type definitions for event-emitter-es6 1.1
|
||||
// Project: https://github.com/insane-jo/event-emitter#readme
|
||||
// Definitions by: Anton Strömkvist <https://github.com/ahstro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Options {
|
||||
emitDelay?: number;
|
||||
strictMode?: boolean;
|
||||
}
|
||||
|
||||
type Listener = (...args: any[]) => void;
|
||||
|
||||
declare class EventEmitter {
|
||||
constructor(options?: Options);
|
||||
on(type: string, listener: Listener): void;
|
||||
once(type: string, listener: Listener): void;
|
||||
off(type: string, listener?: Listener): void;
|
||||
emit(type: string, ...eventArgs: any[]): void;
|
||||
emitSync(type: string, ...eventArgs: any[]): void;
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export = EventEmitter;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"event-emitter-es6-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,33 @@
|
||||
import * as DataFormatter from "excel-style-dataformatter";
|
||||
import * as enLocales from "excel-style-dataformatter/lib/locales/en-US";
|
||||
import * as ruLocales from "excel-style-dataformatter/lib/locales/ru";
|
||||
|
||||
const localesOptions: DataFormatter.LocalesOptions = {
|
||||
name: "test",
|
||||
months: ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'],
|
||||
monthsShort: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
|
||||
days: ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'],
|
||||
daysShort: ['su', 'mo', 'tu', 'we', 'th', 'fr', 'sa'],
|
||||
thousandSeparator: ',',
|
||||
decimalSeparator: '.',
|
||||
formats: {
|
||||
'Test format 1': '#.#',
|
||||
'Test format 2': '$ #,##0.00;[Red]$ -#,##0.00',
|
||||
}
|
||||
};
|
||||
const formatterOptions: DataFormatter.FormatterOptions = {
|
||||
debug: true,
|
||||
UTCOffset: 100,
|
||||
locale: "test",
|
||||
transformCode: (code: string): string => {
|
||||
return code + "string";
|
||||
},
|
||||
locales: [localesOptions, ruLocales]
|
||||
};
|
||||
const dataFormatter1 = new DataFormatter(formatterOptions);
|
||||
const dataFormatter2 = new DataFormatter();
|
||||
dataFormatter2.defineLocales([enLocales, ruLocales]);
|
||||
dataFormatter2.setLocale("ru");
|
||||
dataFormatter2.setUTCOffset(null);
|
||||
dataFormatter2.setUTCOffset(100);
|
||||
const result: DataFormatter.FormatResult = dataFormatter2.format("testValue", "testType", "testFormat");
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// Type definitions for excel-style-dataformatter 2.0
|
||||
// Project: https://github.com/fakundo/Excel-Style-Javascript-DataFormatter
|
||||
// Definitions by: SanderDeWaal1992 <https://github.com/SanderDeWaal1992>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class DataFormatter {
|
||||
constructor(options?: DataFormatter.FormatterOptions);
|
||||
|
||||
/**
|
||||
* Format a value
|
||||
* @param value
|
||||
* @param type value type
|
||||
* @param format format preset
|
||||
*/
|
||||
format(value: any, type: string, format: string): DataFormatter.FormatResult;
|
||||
/**
|
||||
* Defines locales
|
||||
* @param locales
|
||||
*/
|
||||
defineLocales(locales: DataFormatter.LocalesOptions[]): void;
|
||||
/**
|
||||
* Sets locale
|
||||
* If locale doesn't exist, sets default
|
||||
* @param locale
|
||||
*/
|
||||
setLocale(locale: string): void;
|
||||
/**
|
||||
* Sets UTC offset for dates
|
||||
* @param offset in minutes
|
||||
*/
|
||||
setUTCOffset(offset: number | null): void;
|
||||
}
|
||||
|
||||
declare namespace DataFormatter {
|
||||
interface LocalesOptions {
|
||||
name: string;
|
||||
months: string[];
|
||||
monthsShort: string[];
|
||||
days: string[];
|
||||
daysShort: string[];
|
||||
thousandSeparator: string;
|
||||
decimalSeparator: string;
|
||||
formats: {
|
||||
[index: string]: string
|
||||
};
|
||||
}
|
||||
interface FormatterOptions {
|
||||
debug?: boolean;
|
||||
UTCOffset?: number | null;
|
||||
locale?: string;
|
||||
transformCode?: (code: any) => any;
|
||||
locales?: LocalesOptions[];
|
||||
}
|
||||
|
||||
interface FormatResult {
|
||||
value: string;
|
||||
align: string;
|
||||
color: string;
|
||||
pattern: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = DataFormatter;
|
||||
@@ -0,0 +1,4 @@
|
||||
import * as DataFormatter from "../../index";
|
||||
|
||||
declare const locale: DataFormatter.LocalesOptions;
|
||||
export = locale;
|
||||
@@ -0,0 +1,4 @@
|
||||
import * as DataFormatter from "../../index";
|
||||
|
||||
declare const locale: DataFormatter.LocalesOptions;
|
||||
export = locale;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lib/locales/en-US.d.ts",
|
||||
"lib/locales/ru.d.ts",
|
||||
"excel-style-dataformatter-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user