vue: fixed definition for activate() in ComponentOption

This commit is contained in:
Christian Kittelmann
2016-09-29 11:01:40 +02:00
59 changed files with 3414 additions and 367 deletions

2
acl/acl.d.ts vendored
View File

@@ -20,7 +20,7 @@ declare module "acl" {
type Callback = (err: Error) => any;
type AnyCallback = (err: Error, obj: any) => any;
type AllowedCallback = (err: Error, allowed: boolean) => any;
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value;
type GetUserId = (req: http.IncomingMessage, res: http.ServerResponse) => Value;
interface AclStatic {
new (backend: Backend<any>, logger: Logger, options: Option): Acl;

View File

@@ -346,24 +346,24 @@ interface Client {
* Log an incoming http request to your server. The request data will be tracked during the response "finish" event if it is successful or the request "error"
* event if it fails. The request duration is automatically calculated as the timespan between when the trackRequest method was called, and when the response "finish"
* or request "error" events were fired.
* @param request The http.ServerRequest object to track
* @param request The http.IncomingMessage object to track
* @param response The http.ServerResponse object for this request
* @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty.
*/
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
trackRequest(request: any /* http.IncomingMessage */, response: any /* http.ServerResponse */, properties?: {
[key: string]: string;
}): void;
/**
* Log an incoming http request to your server. The request data is tracked synchronously rather than waiting for the response "finish"" or request "error"" events.
* Use this if you need your request telemetry to respect custom app insights operation and user context (for example if you set any appInsights.client.context.tags).
* @param request The http.ServerRequest object to track
* @param request The http.IncomingMessage object to track
* @param response The http.ServerResponse object for this request
* @param ellapsedMilliseconds The duration for this request. Defaults to 0.
* @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty.
* @param error An error that was returned for this request if it was unsuccessful. Defaults to null.
*/
trackRequestSync(request: any /*http.ServerRequest */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
[key: string]: string;}, error?: any) : void;
/**

21
aws-sdk/aws-sdk.d.ts vendored
View File

@@ -22,6 +22,27 @@ declare module "aws-sdk" {
constructor(profile: string);
}
export module CognitoIdentity {
export interface CognitoIdentityCredentialsParams {
IdentityPoolId?: string;
AccountId?: string;
Logins?: {[k: string]: any};
RoleArn?: string;
RoleSessionName?: string;
WebIdentityToken?: string;
ProviderId?: string;
Policy?: string;
DurationSeconds?: number;
IdentityId?: string;
}
}
export class CognitoIdentityCredentials extends Credentials {
constructor(params: CognitoIdentity.CognitoIdentityCredentialsParams);
}
export interface Logger {
write?: (chunk: any, encoding?: string, callback?: () => void) => void;
log?: (...messages: any[]) => void;

View File

@@ -317,6 +317,13 @@ class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R> {
*/
cancel(): void;
/**
* Basically sugar for doing: somePromise.catch(function(){});
*
* Which is needed in case error handlers are attached asynchronously to the promise later, which would otherwise result in premature unhandled rejection reporting.
*/
suppressUnhandledRejections(): void;
/**
* Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
*

View File

@@ -288,11 +288,11 @@ declare module "browser-sync" {
middleware?: MiddlewareHandler;
ws: boolean;
reqHeaders: (config: any) => Hash<any>;
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
proxyRes: (res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any;
}
interface MiddlewareHandler {
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
(req: http.IncomingMessage, res: http.ServerResponse, next: Function): any;
}
interface PerRouteMiddleware {

View File

@@ -104,7 +104,7 @@ declare module 'bufferstream/postbuffer' {
http client buffer
*/
constructor(req: http.ServerRequest);
constructor(req: http.IncomingMessage);
/*
set a callback to get all post data from a http server request
*/

View File

@@ -5,7 +5,7 @@ import * as Busboy from 'busboy';
import * as http from 'http';
import * as util from 'util';
function serverFn(req: http.ServerRequest, res: http.ServerResponse) {
function serverFn(req: http.IncomingMessage, res: http.ServerResponse) {
if (req.method === 'POST') {
var busboy = new Busboy({ headers: req.headers });
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {

View File

@@ -8,10 +8,12 @@ import {
} from 'canvas-gauges';
let linearOptions: LinearGaugeOptions = {
renderTo: document.createElement('canvas')
renderTo: document.createElement('canvas'),
fontNumbersStyle: 'italic'
};
let radialOptions: RadialGaugeOptions = {
renderTo: 'gauge-id'
renderTo: 'gauge-id',
fontNumbersWeight: 'bold'
};
new LinearGauge(linearOptions);

View File

@@ -4,6 +4,10 @@
// Definitions: https://github.com/Mikhus/DefinitelyTyped
declare namespace CanvasGauges {
export type FontStyle = 'normal' | 'italic' | 'oblique';
export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' |
'100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
export type RenderTarget = string|HTMLElement;
export interface AnimationRule {
@@ -86,7 +90,15 @@ declare namespace CanvasGauges {
fontTitleSize?: number,
fontValueSize?: number,
fontUnitsSize?: number,
fontNumbersSize?: number
fontNumbersSize?: number,
fontTitleStyle?: FontStyle,
fontValueStyle?: FontStyle,
fontUnitsStyle?: FontStyle,
fontNumbersStyle?: FontStyle,
fontTitleWeight?: FontWeight,
fontValueWeight?: FontWeight,
fontUnitsWeight?: FontWeight,
fontNumbersWeight?: FontWeight
}
export interface RadialGaugeOptions extends GenericOptions {

View File

@@ -1,6 +1,6 @@
// Type definitions for CrossFilter
// Project: https://github.com/square/crossfilter
// Definitions by: Schmulik Raskin <https://github.com/schmuli>
// Definitions by: Schmulik Raskin <https://github.com/schmuli>, Izaak Baker <https://github.com/iebaker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace CrossFilter {
@@ -111,3 +111,8 @@ declare namespace CrossFilter {
}
declare var crossfilter: CrossFilter.CrossFilterStatic;
declare module "crossfilter" {
var crossfilter: CrossFilter.CrossFilterStatic;
export = crossfilter;
}

View File

@@ -3,12 +3,12 @@
// Definitions by: Maksim Kozhukh <http://github.com/mkozhukh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface SchedulerCallback { (...args: any[]) : any }
interface SchedulerCallback { (...args: any[]): any }
interface SchedulerFilterCallback { (id: string | number, event: any): boolean }
type SchedulerEventName ='onAfterEventDisplay'|'onAfterFolderToggle'|'onAfterLightbox'|'onAfterSchedulerResize'|'onBeforeCollapse'|'onBeforeDrag'|'onBeforeEventChanged'|'onBeforeEventCreated'|'onBeforeEventDelete'|'onBeforeEventDisplay'|'onBeforeEventDragIn'|'onBeforeEventDragOut'|'onBeforeExpand'|'onBeforeExternalDragIn'|'onBeforeFolderToggle'|'onBeforeLightbox'|'onBeforeSectionRender'|'onBeforeTodayDisplayed'|'onBeforeTooltip'|'onBeforeViewChange'|'onCellClick'|'onCellDblClick'|'onClearAll'|'onClick'|'onCollapse'|'onConfirmedBeforeEventDelete'|'onContextMenu'|'onDblClick'|'onDragEnd'|'onEmptyClick'|'onEventAdded'|'onEventCancel'|'onEventChanged'|'onEventCollision'|'onEventCopied'|'onEventCreated'|'onEventCut'|'onEventDeleted'|'onEventDrag'|'onEventDragIn'|'onEventDragOut'|'onEventDropOut'|'onEventIdChange'|'onEventLoading'|'onEventPasted'|'onEventSave'|'onExpand'|'onExternalDragIn'|'onLightbox'|'onLightboxButton'|'onLimitViolation'|'onLoadError'|'onLocationError'|'onMouseDown'|'onMouseMove'|'onOptionsLoad'|'onOptionsLoadFinal'|'onOptionsLoadStart'|'onSaveError'|'onScaleAdd'|'onScaleDblClick'|'onSchedulerReady'|'onSchedulerResize'|'onTemplatesReady'|'onTimelineCreated'|'onViewChange'|'onViewMoreClick'|'onXLE'|'onXLS'|'onXScaleClick'|'onXScaleDblClick'|'onYScaleClick'|'onYScaleDblClick';
type SchedulerEventName = 'onAfterEventDisplay' | 'onAfterFolderToggle' | 'onAfterLightbox' | 'onAfterSchedulerResize' | 'onBeforeCollapse' | 'onBeforeDrag' | 'onBeforeEventChanged' | 'onBeforeEventCreated' | 'onBeforeEventDelete' | 'onBeforeEventDisplay' | 'onBeforeEventDragIn' | 'onBeforeEventDragOut' | 'onBeforeExpand' | 'onBeforeExternalDragIn' | 'onBeforeFolderToggle' | 'onBeforeLightbox' | 'onBeforeSectionRender' | 'onBeforeTodayDisplayed' | 'onBeforeTooltip' | 'onBeforeViewChange' | 'onCellClick' | 'onCellDblClick' | 'onClearAll' | 'onClick' | 'onCollapse' | 'onConfirmedBeforeEventDelete' | 'onContextMenu' | 'onDblClick' | 'onDragEnd' | 'onEmptyClick' | 'onEventAdded' | 'onEventCancel' | 'onEventChanged' | 'onEventCollision' | 'onEventCopied' | 'onEventCreated' | 'onEventCut' | 'onEventDeleted' | 'onEventDrag' | 'onEventDragIn' | 'onEventDragOut' | 'onEventDropOut' | 'onEventIdChange' | 'onEventLoading' | 'onEventPasted' | 'onEventSave' | 'onExpand' | 'onExternalDragIn' | 'onLightbox' | 'onLightboxButton' | 'onLimitViolation' | 'onLoadError' | 'onLocationError' | 'onMouseDown' | 'onMouseMove' | 'onOptionsLoad' | 'onOptionsLoadFinal' | 'onOptionsLoadStart' | 'onSaveError' | 'onScaleAdd' | 'onScaleDblClick' | 'onSchedulerReady' | 'onSchedulerResize' | 'onTemplatesReady' | 'onTimelineCreated' | 'onViewChange' | 'onViewMoreClick' | 'onXLE' | 'onXLS' | 'onXScaleClick' | 'onXScaleDblClick' | 'onYScaleClick' | 'onYScaleDblClick';
interface SchedulerTemplates{
interface SchedulerTemplates {
/**
* specifies the date in the header of the view
* @param start the start date of the view
@@ -458,7 +458,7 @@ interface SchedulerTemplates{
}
interface SchedulerConfigOptions{
interface SchedulerConfigOptions {
/**
* 'says' to present the numbers of days in the Month view as clickable links that open the related day in the specified view
*/
@@ -477,12 +477,12 @@ interface SchedulerConfigOptions{
/**
* specifies how to display the default error notification in case the XML data loading failed
*/
ajax_error: string|boolean;
ajax_error: string | boolean;
/**
* 'says' to show multi-day events in the regular way (as one-day events are displayed)
*/
all_timed: boolean|string;
all_timed: boolean | string;
/**
* sets the date format that will be used by the addEvent() method to parse the start_date, end_date properties in case they are specified as strings
@@ -812,7 +812,7 @@ interface SchedulerConfigOptions{
/**
* sets the height of the area that displays multi-day events
*/
multi_day_height_limit: number|boolean;
multi_day_height_limit: number | boolean;
/**
* enables the possibility to render the same events in several sections of the Timeline or Units view
@@ -942,12 +942,12 @@ interface SchedulerConfigOptions{
/**
* enables/disables the touch support in the scheduler
*/
touch: boolean|string;
touch: boolean | string;
/**
* defines the time period in milliseconds that is used to differ the long touch gesture from the scroll gesture
*/
touch_drag: number|boolean;
touch_drag: number | boolean;
/**
* enables/disables prompting messages in the right top corner of the screen
@@ -996,7 +996,7 @@ interface SchedulerConfigOptions{
}
interface SchedulerDateHelpers{
interface SchedulerDateHelpers {
add(origin: Date, count: number, unit: string): Date;
copy(origin: Date): Date;
@@ -1017,19 +1017,19 @@ interface SchedulerDateHelpers{
to_fixed(value: number): string;
}
interface SchedulerHotkeys{
interface SchedulerHotkeys {
edit_save: number;
edit_cancel: number;
}
interface SchedulerLocaleDate{
interface SchedulerLocaleDate {
month_full: string[];
month_short: string[];
day_full: string[];
day_short: string[];
}
interface SchedulerLocaleLabels{
interface SchedulerLocaleLabels {
dhx_cal_today_button: string;
day_tab: string;
week_tab: string;
@@ -1046,13 +1046,13 @@ interface SchedulerLocaleLabels{
section_time: string;
}
interface SchedulerLocale{
interface SchedulerLocale {
date: SchedulerLocaleDate;
labels: SchedulerLocaleLabels;
}
interface SchedulerSizes{
interface SchedulerSizes {
/**
* the height of day cells in the month view
*/
@@ -1124,14 +1124,14 @@ interface SchedulerSizes{
scroll_width: number;
}
interface SchedulerEnterprise{
interface SchedulerEnterprise {
/**
* Creates a new instance of Scheduler
*/
getSchedulerInstance(): SchedulerStatic;
}
interface SchedulerStatic{
interface SchedulerStatic {
templates: SchedulerTemplates;
config: SchedulerConfigOptions;
date: SchedulerDateHelpers;
@@ -1238,7 +1238,7 @@ interface SchedulerStatic{
* @param time_points an array <b>[start_minute,end_minute,..,start_minute_N,end_minute_N]</b>, <br> where each pair sets a certain limit range. The array can have any number of <br> such pairs
* @param items defines specific items of view(s) to block
*/
blockTime(date: Date|number, time_points: any[], items?: any): void;
blockTime(date: Date | number, time_points: any[], items?: any): void;
/**
* calls an inner event
@@ -1327,7 +1327,7 @@ interface SchedulerStatic{
* deletes the specified event
* @param id the event's id
*/
deleteEvent(id: string|number): void;
deleteEvent(id: string | number): void;
/**
* removes marking/blocking set by the addMarkedTimespan() and blockTime() methods
@@ -1393,39 +1393,39 @@ interface SchedulerStatic{
* returns the event object by its id
* @param event_id the event's id
*/
getEvent(event_id: string|number): void;
getEvent(event_id: string | number): any;
/**
* gets the event's end date
* @param id the event's id
*/
getEventEndDate(id: string): Date;
getEventEndDate(id: string | number): Date;
/**
* gets the event's start date
* @param id the event's id
*/
getEventStartDate(id: string): Date;
getEventStartDate(id: string | number): Date;
/**
* gets the event's text
* @param id the event's id
*/
getEventText(id: string): string;
getEventText(id: string | number): string;
/**
* returns a collection of events which occur during the specified period
* @param from the start date of the period
* @param to the end date of the period
*/
getEvents(from?: Date, to?: Date): void;
getEvents(from?: Date, to?: Date): any;
/**
* gets the label of a select control in the lightbox
* @param property the name of a data property that the control is mapped to
* @param key the option's id. This parameter is compared with the event's data property <br> to assign the select's option to an event
*/
getLabel(property: string, key: string|number): void;
getLabel(property: string, key: string | number): any;
/**
* gets the lightbox's HTML object element
@@ -1486,7 +1486,7 @@ interface SchedulerStatic{
* @param date the initial date of the scheduler (by default, the current date)
* @param view the name of the initial view (by default, "week")
*/
init(container: string|HTMLElement, date?: Date, view?: string): void;
init(container: string | HTMLElement, date?: Date, view?: string): void;
/**
* inverts the specified time zones
@@ -1497,7 +1497,7 @@ interface SchedulerStatic{
/**
* checks whether the calendar is currently opened in the scheduler
*/
isCalendarVisible(): boolean|HTMLElement;
isCalendarVisible(): boolean | HTMLElement;
/**
* checks whether the specified event one-day or multi-day
@@ -1607,7 +1607,7 @@ interface SchedulerStatic{
* @param id the event's id
* @param event the event object
*/
setEvent(id: string|number, event: any): void;
setEvent(id: string | number, event: any): void;
/**
* sets the event's end date
@@ -1739,7 +1739,7 @@ interface SchedulerStatic{
* removes marking/blocking set by the markTimespan() method
* @param divs a timespan to remove marking/blocking from (or an array of timespans)
*/
unmarkTimespan(divs: HTMLElement|any[]): void;
unmarkTimespan(divs: HTMLElement | any[]): void;
/**
* unselects the specified event
@@ -1776,7 +1776,5 @@ interface SchedulerStatic{
}
declare var scheduler: SchedulerStatic;
declare var Scheduler: SchedulerEnterprise;

View File

@@ -15,6 +15,8 @@ declare module Elasticsearch {
create(params: CreateDocumentParams, callback: (err: any, response: any, status: any) => void): void;
delete(params: DeleteDocumentParams): PromiseLike<any>;
delete(params: DeleteDocumentParams, callback: (error: any, response: any) => void): void;
exists(params: ExistsParams): PromiseLike<any>;
exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void;
get<T>(params: GetParams, callback: (error: any, response: GetResponse<T>) => void): void;
get<T>(params: GetParams): PromiseLike<GetResponse<T>>;
index<T>(params: IndexDocumentParams<T>): PromiseLike<any>;
@@ -95,6 +97,7 @@ declare module Elasticsearch {
method?: string;
body?: any;
ignore?: number | number[];
filterPath?: string | string[];
}
export interface BulkIndexDocumentsParams extends GenericParams {
@@ -205,6 +208,17 @@ declare module Elasticsearch {
_source: T;
}
export interface ExistsParams extends GenericParams {
id: string;
index: string;
parent?: string;
preference?: string;
realtime?: boolean;
refresh?: boolean;
routing?: string;
type: string;
}
export interface IndexDocumentParams<T> extends GenericParams {
index: string;
type: string;

View File

@@ -130,7 +130,7 @@ declare module "express-serve-static-core" {
interface Errback { (err: Error): void; }
interface Request extends http.ServerRequest, Express.Request {
interface Request extends http.IncomingMessage, Express.Request {
/**
* Return request header.

View File

@@ -78,10 +78,10 @@ interface FlexSliderOptions {
// Callback API
start?: (slider: SliderObject) => any; //Callback: function(slider) - Fires when the slider loads the first slide
before?: (slider: SliderObject) => any; //Callback: function(slider) - Fires asynchronously with each slider animation
after?: () => any; //Callback: function(slider) - Fires after each slider animation completes
end?: () => any; //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added?: () => any; //{NEW} Callback: function(slider) - Fires after a slide is added
removed?: () => any;
after?: (slider: SliderObject) => any; //Callback: function(slider) - Fires after each slider animation completes
end?: (slider: SliderObject) => any; //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added?: (slider: SliderObject) => any; //{NEW} Callback: function(slider) - Fires after a slide is added
removed?: (slider: SliderObject) => any;
}

View File

@@ -48,7 +48,7 @@ if (form.bytesReceived > 100) {
if (form.bytesExpected > 100) {
}
var req: http.ServerRequest;
var req: http.IncomingMessage;
form.parse(req);
form.parse(req, (err: any, fields: formidable.Fields, files: formidable.Files) => {

View File

@@ -1,4 +1,4 @@
// Type definitions for Electron v1.3.6
// Type definitions for Electron v1.4.1
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -176,7 +176,7 @@ declare namespace Electron {
/**
* Emitted when the gpu process crashes.
*/
on(event: 'gpu-process-crashed', listener: Function): this;
on(event: 'gpu-process-crashed', listener: (event: Event, killed: boolean) => void): this;
/**
* Emitted when Chrome's accessibility support changes.
*
@@ -841,6 +841,11 @@ declare namespace Electron {
* Note: This is only implemented on macOS.
*/
on(event: 'scroll-touch-end', listener: Function): this;
/**
* Emitted when scroll wheel event phase filed upon reaching the edge of element.
* Note: This is only implemented on macOS.
*/
on(event: 'scroll-touch-edge', listener: Function): this;
/**
* Emitted on 3-finger swipe.
* Note: This is only implemented on macOS.
@@ -2589,6 +2594,7 @@ declare namespace Electron {
static createEmpty(): NativeImage;
/**
* Creates a new NativeImage instance from file located at path.
* This method returns an empty image if the path does not exist, cannot be read, or is not a valid image.
*/
static createFromPath(path: string): NativeImage;
/**
@@ -2769,8 +2775,18 @@ declare namespace Electron {
referrer: string;
method: string;
uploadData?: {
/**
* Content being sent.
*/
bytes: Buffer,
file: string
/**
* Path of file being uploaded.
*/
file: string,
/**
* UUID of blob data. Use session.getBlobData method to retrieve the data.
*/
blobUUID: string;
}[];
}
@@ -3016,6 +3032,10 @@ declare namespace Electron {
* @returns The user agent for this session.
*/
getUserAgent(): string;
/**
* Returns the blob data associated with the identifier.
*/
getBlobData(identifier: string, callback: (result: Buffer) => void): void;
/**
* The webRequest API set allows to intercept and modify contents of a request at various stages of its lifetime.
*/
@@ -3317,6 +3337,10 @@ declare namespace Electron {
* Path of file being uploaded.
*/
file: string;
/**
* UUID of blob data. Use session.getBlobData method to retrieve the data.
*/
blobUUID: string;
}
interface BeforeRequestDetails extends Details {
@@ -3495,6 +3519,11 @@ declare namespace Electron {
* Get system preferences.
*/
interface SystemPreferences {
/**
* Note: This is only implemented on Windows.
*/
on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this;
on(event: string, listener: Function): this;
/**
* @returns If the system is in Dark Mode.
*
@@ -3549,13 +3578,17 @@ declare namespace Electron {
*/
getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
/**
* This method returns true if DWM composition (Aero Glass) is enabled,
* and false otherwise. You can use it to determine if you should create
* a transparent window or not (transparent windows wont work correctly when DWM composition is disabled).
* @returns Whether DWM composition (Aero Glass) is enabled.
*
* Note: This is only implemented on Windows.
*/
isAeroGlassEnabled(): boolean;
/**
* @returns The users current system wide color preference in the form of an RGBA hexadecimal string.
*
* Note: This is only implemented on Windows.
*/
getAccentColor(): string;
}
// https://github.com/electron/electron/blob/master/docs/api/tray.md
@@ -3822,7 +3855,7 @@ declare namespace Electron {
/**
* Emitted when the renderer process has crashed.
*/
on(event: 'crashed', listener: Function): this;
on(event: 'crashed', listener: (event: Event, killed: boolean) => void): this;
/**
* Emitted when a plugin process has crashed.
*/
@@ -4237,6 +4270,10 @@ declare namespace Electron {
* If offscreen rendering is enabled returns the current frame rate.
*/
getFrameRate(): number;
/**
* If offscreen rendering is enabled invalidates the frame and generates a new one through the 'paint' event.
*/
invalidate(): void;
/**
* Sets the item as dragging item for current drag-drop operation.
*/
@@ -4438,7 +4475,7 @@ declare namespace Electron {
[key: string]: string;
}
type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'other';
type NewWindowDisposition = 'default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other';
/**
* Specifies the action to take place when ending webContents.findInPage request.
@@ -4881,6 +4918,15 @@ declare namespace Electron {
* A list of strings which specifies the blink features to be disabled separated by ,.
*/
disableblinkfeatures: string;
/**
* A value that links the webview to a specific webContents.
* When a webview first loads a new webContents is created and this attribute is set
* to its instance identifier. Setting this attribute on a new or existing webview connects
* it to the existing webContents that currently renders in a different webview.
*
* The existing webview will see the destroy event and will then create a new webContents when a new url is loaded.
*/
guestinstance: string;
/**
* Loads the url in the webview, the url must contain the protocol prefix, e.g. the http:// or file://.
*/

View File

@@ -13,7 +13,38 @@ interface IDispatcher {
declare type Tween = TweenLite | TweenMax;
declare type Timeline = SimpleTimeline | TimelineLite | TimelineMax;
declare type TweenConfig = {
[tweenProp: string]: any;
delay?: number;
ease?: Ease;
repeat?: number;
repeatDelay?: number;
yoyo?: boolean;
paused?: boolean;
overwrite?: string|number;
onComplete?: Function;
immediateRender?: boolean;
onCompleteParams?: any[];
onCompleteScope?: Object;
onRepeat?: Function;
onRepeatScope?: Object;
onReverseComplete?: Function;
onReverseCompleteParams?: any[];
onReverseCompleteScope?: Object;
onStart?: Function;
onStartParams?: any[];
onStartScope?: Object;
onUpdate?: Function;
onUpdateParams?: any[];
onUpdateScope?: Object;
startAt?: Object;
useFrames?: boolean;
lazy?: boolean;
onOverwrite?: Function;
autoCSS?: boolean;
callbackScope?: Object;
}
//com.greensock.core
declare class Animation {
static ticker: IDispatcher;
@@ -86,7 +117,7 @@ declare class TweenLite extends Animation {
static killTweensOf(target: Object, onlyActive?: boolean, vars?: Object): void;
static lagSmoothing(threshold: number, adjustedLag: number): void;
static set(target: Object, vars: Object): TweenLite;
static to(target: Object, duration: number, vars: Object): TweenLite;
static to(target: Object, duration: number, vars: TweenConfig): TweenLite;
}
declare class TweenMax extends TweenLite {
@@ -112,7 +143,7 @@ declare class TweenMax extends TweenLite {
static staggerFrom(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[];
static staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[];
static staggerTo(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[];
static to(target:Object, duration:number, vars:Object):TweenMax;
static to(target:Object, duration:number, vars:TweenConfig):TweenMax;
updateTo(vars: Object, resetDuration?: boolean): TweenMax;
yoyo(): boolean;
yoyo(value?: boolean): TweenMax;

View File

@@ -300,8 +300,12 @@ declare module "hapi" {
}
export interface ISessionHandler {
(request: Request, reply: IReply): void;
}
export interface IStrictSessionHandler{
<T>(request: Request, reply: IStrictReply<T>): void;
}
export interface IRequestHandler<T> {
(request: Request): T;
}
@@ -464,7 +468,7 @@ declare module "hapi" {
};
/** an alternative location for the route handler option. */
handler?: ISessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** an optional unique identifier used to look up the route using server.lookup(). */
id?: number;
/** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */
@@ -834,7 +838,7 @@ declare module "hapi" {
/** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/
vhost?: string;
/** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/
handler: ISessionHandler | string | IRouteHandlerConfig;
handler: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** - additional route options.*/
config?: IRouteAdditionalConfigurationOptions;
}

View File

@@ -124,5 +124,15 @@ server.route([{
}
}]);
// Implict handler
server.route({
method: 'GET',
path: '/hello6',
handler: function (request, reply) {
request.log('info', { route: '/hello' }, Date.now());
reply('hello world');
}
});
// Start the server
server.start();

View File

@@ -112,6 +112,16 @@ server.route([{
}
}]);
// Implict handler
server.route({
method: 'GET',
path: '/hello6',
handler: function (request, reply) {
request.log('info', { route: '/hello' }, Date.now());
reply('hello world');
}
});
// config.validate parameters should be optional
server.route([{
method: 'GET',

12
hapi/hapi.d.ts vendored
View File

@@ -330,8 +330,12 @@ declare module "hapi" {
export interface ISessionHandler {
(request: Request, reply: IReply): void;
}
export interface IStrictSessionHandler {
<T>(request: Request, reply: IStrictReply<T>): void;
}
export interface IRequestHandler<T> {
(request: Request): T;
}
@@ -495,7 +499,7 @@ declare module "hapi" {
};
/** an alternative location for the route handler option. */
handler?: ISessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** an optional unique identifier used to look up the route using server.lookup(). */
id?: number;
/** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */
@@ -894,7 +898,7 @@ declare module "hapi" {
/** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/
vhost?: string;
/** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/
handler?: ISessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** - additional route options.*/
config?: IRouteAdditionalConfigurationOptions;
}
@@ -1872,7 +1876,9 @@ declare module "hapi" {
}
}
});*/
strategy(name: string, scheme: any, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?:any): void;
/** server.auth.test(strategy, request, next)
Tests a request against an authentication strategy where:

View File

@@ -311,6 +311,9 @@ $(document).ready(function () {
var initSettings = dt.init();
var i18n: string = dt.i18n('buttons.copy', 'Copy to clipboard');
i18n = dt.i18n('select.rows', { _: '%d rows selected', 1: '1 row selected' }, 0);
var off = dt.off("event");
off = dt.off("event", function () { });
off.$("");
@@ -901,5 +904,7 @@ $(document).ready(function () {
//#region "Methods-Util"
var util_1: boolean = dt.any();
//#endregion "Methods-Util"
});

View File

@@ -1,4 +1,4 @@
// Type definitions for JQuery DataTables 1.10.6
// Type definitions for JQuery DataTables 1.10.7
// Project: http://www.datatables.net
// Definitions by: Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>, Omid Rad <https://github.com/omidkrad>, Armin Sander <https://github.com/pragmatrix/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -188,6 +188,17 @@ declare namespace DataTables {
*/
draw(reset?: boolean): DataTable;
/*
* Look up a language token that was defined in the DataTables' language initialisation object.
*
* @param token The language token to lookup from the language object.
* @param def The default value to use if the DataTables initialisation has not specified a value.
* @param numeric If handling numeric output, the number to be presented should be given in this parameter. If not numeric operator is required (for example button label text) this parameter is not required.
*
* @returns Resulting internationalised string.
*/
i18n(token: string, def: any | string, numeric?: number): string;
/*
* Get the initialisation options used for the table. Since: DataTables 1.10.6
*/
@@ -412,6 +423,11 @@ declare namespace DataTables {
//#region "util-methods"
interface UtilityMethods {
/*
* Get a boolean value to indicate if there are any entries in the API instance's result set (i.e. any data, selected rows, etc).
*/
any(): boolean;
/**
* Concatenate two or more API instances together
*

View File

@@ -223,7 +223,7 @@ function test_pnotify() {
});
var type = "error";
var stack_bottomright = {"dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25};
var stack_bottomright = { "dir1": "up", "dir2": "left", "firstpos1": 25, "firstpos2": 25 };
var opts = {
title: "Over Here",
@@ -233,8 +233,8 @@ function test_pnotify() {
width: "100%",
stack: stack_bottomright,
type: "error"
} as PNotifyOptions;
};
new PNotify(opts);
new PNotify({

View File

@@ -4,11 +4,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
// could not pass the Travis Test if enabled
//type NoticeTypeOptions = "notice" | "info" | "success" | "error";
//type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome";
//type StateOptions = "initializing" | "opening" | "open" | "closing" | "closed";
type NoticeTypeOptions = "notice" | "info" | "success" | "error";
type StylingOptions = "brighttheme" | "jqueryui" | "bootstrap2" | "bootstrap3" | "fontawesome";
type StateOptions = "initializing" | "opening" | "open" | "closing" | "closed";
interface PNotifyStack {
dir1?: string;
@@ -137,7 +135,7 @@ interface PNotifyOptions {
/**
* What styling classes to use. (Can be either "brighttheme", "jqueryui", "bootstrap2", "bootstrap3", or "fontawesome".)
*/
styling?: string;
styling?: StylingOptions;
/**
* Additional classes to be added to the notice. (For custom styling.)
*/
@@ -182,7 +180,7 @@ interface PNotifyOptions {
/**
* Type of the notice. "notice", "info", "success", or "error".
*/
type?: string;
type?: NoticeTypeOptions;
/**
* Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class.
*/
@@ -263,7 +261,7 @@ interface PNotify {
/**
* The state can be "initializing", "opening", "open", "closing", and "closed"
*/
state?: string;
state?: StateOptions;
/**
* This function is for updating the notice.

View File

@@ -18,6 +18,11 @@
declare module "koa-bodyparser" {
import * as Koa from "koa";
module "koa" {
interface Request {
body: any;
}
}
function bodyParser(opts?: {
/**

16
kue/kue.d.ts vendored
View File

@@ -10,7 +10,7 @@
declare module "kue" {
import events = require('events');
import express = require('express');
import redis = require('redis');
import redisClientFactory = require('redis');
export class Queue extends events.EventEmitter {
name: string;
@@ -18,7 +18,7 @@ declare module "kue" {
promoter: any;
workers: Worker[];
shuttingDown: boolean;
client: redis.RedisClient;
client: redisClientFactory.RedisClient;
testMode: TestMode;
static singleton: Queue;
@@ -63,7 +63,7 @@ declare module "kue" {
public id: number;
public type: string;
public data: any;
public client: redis.RedisClient;
public client: redisClientFactory.RedisClient;
private _max_attempts;
static priorities: Priorities;
@@ -109,7 +109,7 @@ declare module "kue" {
class Worker extends events.EventEmitter {
queue: Queue;
type: string;
client: redis.RedisClient;
client: redisClientFactory.RedisClient;
job: Job;
constructor(queue: Queue, type: string);
@@ -127,10 +127,10 @@ declare module "kue" {
interface Redis {
configureFactory(options: Object, queue: Queue): void;
createClient(): redis.RedisClient;
createClientFactory(options: Object): redis.RedisClient;
client(): redis.RedisClient;
pubsubClient(): redis.RedisClient;
createClient(): redisClientFactory.RedisClient;
createClientFactory(options: Object): redisClientFactory.RedisClient;
client(): redisClientFactory.RedisClient;
pubsubClient(): redisClientFactory.RedisClient;
reset(): void;
}

View File

@@ -4,7 +4,7 @@ import multiparty = require('multiparty');
import http = require('http');
import util = require('util');
http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) {
http.createServer(function (req: http.IncomingMessage, res: http.ServerResponse) {
if (req.url === '/upload' && req.method === 'POST') {
var count = 0;
var form = new multiparty.Form();

View File

@@ -18,7 +18,7 @@ declare module "multiparty" {
* @param request
* @param callback
*/
parse(request: http.ServerRequest, callback?: (error: Error, fields: any, files: any) => any): void;
parse(request: http.IncomingMessage, callback?: (error: Error, fields: any, files: any) => any): void;
}
export interface File {

View File

@@ -0,0 +1,12 @@
/// <reference path="./murmurhash3js.d.ts"/>
import * as murmurhash3js from 'murmurhash3js';
murmurhash3js.x86.hash32('string');
murmurhash3js.x86.hash32('string with seed', 1337);
murmurhash3js.x86.hash128('string');
murmurhash3js.x86.hash128('string with seed', 1337);
murmurhash3js.x64.hash128('string');
murmurhash3js.x64.hash128('string with seed', 1337);

15
murmurhash3js/murmurhash3js.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
// Type definitions for murmurhash3js v3.0.1
// Project: https://github.com/pid/murmurHash3js
// Definitions by: Dave Lee <https://github.com/dlee-nvisia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'murmurhash3js' {
export module x86 {
function hash32(val: string, seed?: number): string;
function hash128(val: string, seed?: number): string;
}
export module x64 {
function hash128(val: string, seed?: number): string;
}
}

View File

@@ -78,7 +78,17 @@ class UploadController {
fileWithNewName = this.Upload.rename(files[0], "newName.jpg");
this.Upload
.resize(files[0], 1024, 1024, 0.7, 'image/jpeg', 0.9, true)
.resize(files[0], {
height: 1024,
width: 1024,
quality: 0.7,
ratio: 0.9,
centerCrop: true,
restoreExif: true,
resizeIf: (width, height) => {
return true;
}
})
.then((resizedFile) => {
console.log(resizedFile);
});

View File

@@ -1,4 +1,4 @@
// Type definitions for Angular File Upload 11.1.1
// Type definitions for Angular File Upload 12.2.12
// Project: https://github.com/danialfarid/ng-file-upload
// Definitions by: John Reilly <https://github.com/johnnyreilly>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -92,6 +92,20 @@ declare namespace angular.angularFileUpload {
ngfValidateForce?: boolean;
}
interface ResizeIfFunction {
(width: number, height: number): boolean;
}
interface FileResizeOptions {
centerCrop?: boolean;
height?: number;
ratio?: number;
resizeIf?: ResizeIfFunction;
restoreExif?: boolean;
quality?: number;
width?: number;
}
interface IUploadService {
/**
* Convert a single file or array of files to a single or array of
@@ -166,7 +180,7 @@ declare namespace angular.angularFileUpload {
* @param {string} newName
* @return {File}
*/
rename(file: File, newName: string): File;
rename(file: File, newName: string): Blob;
/**
* Resizes an image. Returns a promise
*
@@ -179,8 +193,7 @@ declare namespace angular.angularFileUpload {
* @param {boolean} [centerCrop]
* @return {angular.IPromise<string>}
*/
resize(file: File, width?: number, height?: number, quality?: number, type?: string,
ratio?: number | string, centerCrop?: boolean): angular.IPromise<string>;
resize(file: File, options: FileResizeOptions): angular.IPromise<File>;
/**
* Set the default values for ngf-select and ngf-drop directives
*

View File

@@ -558,17 +558,196 @@ namespace crypto_tests {
//////////////////////////////////////////////////
namespace tls_tests {
var ctx: tls.SecureContext = tls.createSecureContext({
key: "NOT REALLY A KEY",
cert: "SOME CERTIFICATE",
});
var blah = ctx.context;
{
var ctx: tls.SecureContext = tls.createSecureContext({
key: "NOT REALLY A KEY",
cert: "SOME CERTIFICATE",
});
var blah = ctx.context;
var connOpts: tls.ConnectionOptions = {
host: "127.0.0.1",
port: 55
};
var tlsSocket = tls.connect(connOpts);
var connOpts: tls.ConnectionOptions = {
host: "127.0.0.1",
port: 55
};
var tlsSocket = tls.connect(connOpts);
}
{
let _server: tls.Server;
let _boolean: boolean;
let _func1 = function(err: Error, resp: Buffer){};
let _func2 = function(err: Error, sessionData: any){};
/**
* events.EventEmitter
* 1. tlsClientError
* 2. newSession
* 3. OCSPRequest
* 4. resumeSession
* 5. secureConnection
**/
_server = _server.addListener("tlsClientError", (err, tlsSocket) => {
let _err: Error = err;
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.addListener("newSession", (sessionId, sessionData, callback) => {
let _sessionId: any = sessionId;
let _sessionData: any = sessionData;
let _func1 = callback;
})
_server = _server.addListener("OCSPRequest", (certificate, issuer, callback) => {
let _certificate: Buffer = certificate;
let _issuer: Buffer = issuer;
let _callback: Function = callback;
})
_server = _server.addListener("resumeSession", (sessionId, callback) => {
let _sessionId: any = sessionId;
let _func2 = callback;
})
_server = _server.addListener("secureConnection", (tlsSocket) => {
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
let _err: Error;
let _tlsSocket: tls.TLSSocket;
let _any: any;
let _func: Function;
let _buffer: Buffer;
_boolean = _server.emit("tlsClientError", _err, _tlsSocket);
_boolean = _server.emit("newSession", _any, _any, _func1);
_boolean = _server.emit("OCSPRequest", _buffer, _buffer, _func);
_boolean = _server.emit("resumeSession", _any, _func2);
_boolean = _server.emit("secureConnection", _tlsSocket);
_server = _server.on("tlsClientError", (err, tlsSocket) => {
let _err: Error = err;
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.on("newSession", (sessionId, sessionData, callback) => {
let _sessionId: any = sessionId;
let _sessionData: any = sessionData;
let _func1 = callback;
})
_server = _server.on("OCSPRequest", (certificate, issuer, callback) => {
let _certificate: Buffer = certificate;
let _issuer: Buffer = issuer;
let _callback: Function = callback;
})
_server = _server.on("resumeSession", (sessionId, callback) => {
let _sessionId: any = sessionId;
let _func2 = callback;
})
_server = _server.on("secureConnection", (tlsSocket) => {
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.once("tlsClientError", (err, tlsSocket) => {
let _err: Error = err;
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.once("newSession", (sessionId, sessionData, callback) => {
let _sessionId: any = sessionId;
let _sessionData: any = sessionData;
let _func1 = callback;
})
_server = _server.once("OCSPRequest", (certificate, issuer, callback) => {
let _certificate: Buffer = certificate;
let _issuer: Buffer = issuer;
let _callback: Function = callback;
})
_server = _server.once("resumeSession", (sessionId, callback) => {
let _sessionId: any = sessionId;
let _func2 = callback;
})
_server = _server.once("secureConnection", (tlsSocket) => {
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.prependListener("tlsClientError", (err, tlsSocket) => {
let _err: Error = err;
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.prependListener("newSession", (sessionId, sessionData, callback) => {
let _sessionId: any = sessionId;
let _sessionData: any = sessionData;
let _func1 = callback;
})
_server = _server.prependListener("OCSPRequest", (certificate, issuer, callback) => {
let _certificate: Buffer = certificate;
let _issuer: Buffer = issuer;
let _callback: Function = callback;
})
_server = _server.prependListener("resumeSession", (sessionId, callback) => {
let _sessionId: any = sessionId;
let _func2 = callback;
})
_server = _server.prependListener("secureConnection", (tlsSocket) => {
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.prependOnceListener("tlsClientError", (err, tlsSocket) => {
let _err: Error = err;
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
_server = _server.prependOnceListener("newSession", (sessionId, sessionData, callback) => {
let _sessionId: any = sessionId;
let _sessionData: any = sessionData;
let _func1 = callback;
})
_server = _server.prependOnceListener("OCSPRequest", (certificate, issuer, callback) => {
let _certificate: Buffer = certificate;
let _issuer: Buffer = issuer;
let _callback: Function = callback;
})
_server = _server.prependOnceListener("resumeSession", (sessionId, callback) => {
let _sessionId: any = sessionId;
let _func2 = callback;
})
_server = _server.prependOnceListener("secureConnection", (tlsSocket) => {
let _tlsSocket: tls.TLSSocket = tlsSocket;
})
}
{
let _TLSSocket: tls.TLSSocket;
let _boolean: boolean;
/**
* events.EventEmitter
* 1. close
* 2. error
* 3. listening
* 4. message
**/
_TLSSocket = _TLSSocket.addListener("OCSPResponse", (response) => {
let _response: Buffer = response;
})
_TLSSocket = _TLSSocket.addListener("secureConnect", () => { });
let _buffer: Buffer;
_boolean = _TLSSocket.emit("OCSPResponse", _buffer);
_boolean = _TLSSocket.emit("secureConnect");
_TLSSocket = _TLSSocket.on("OCSPResponse", (response) => {
let _response: Buffer = response;
})
_TLSSocket = _TLSSocket.on("secureConnect", () => { });
_TLSSocket = _TLSSocket.once("OCSPResponse", (response) => {
let _response: Buffer = response;
})
_TLSSocket = _TLSSocket.once("secureConnect", () => { });
_TLSSocket = _TLSSocket.prependListener("OCSPResponse", (response) => {
let _response: Buffer = response;
})
_TLSSocket = _TLSSocket.prependListener("secureConnect", () => { });
_TLSSocket = _TLSSocket.prependOnceListener("OCSPResponse", (response) => {
let _response: Buffer = response;
})
_TLSSocket = _TLSSocket.prependOnceListener("secureConnect", () => { });
}
}
////////////////////////////////////////////////////
@@ -659,14 +838,86 @@ namespace tty_tests {
////////////////////////////////////////////////////
namespace dgram_tests {
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
});
ds.bind();
ds.bind(41234);
var ai: dgram.AddressInfo = ds.address();
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
});
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
{
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
});
ds.bind();
ds.bind(41234);
var ai: dgram.AddressInfo = ds.address();
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
});
ds.send(new Buffer("hello"), 5000, "127.0.0.1");
}
{
let _socket: dgram.Socket;
let _boolean: boolean;
let _err: Error;
let _str: string;
let _rinfo: dgram.AddressInfo;
/**
* events.EventEmitter
* 1. close
* 2. error
* 3. listening
* 4. message
**/
_socket = _socket.addListener("close", () => {});
_socket = _socket.addListener("error", (err) => {
let _err: Error = err;
})
_socket = _socket.addListener("listening", () => {});
_socket = _socket.addListener("message", (msg, rinfo) => {
let _msg: string = msg;
let _rinfo: dgram.AddressInfo = rinfo;
})
_boolean = _socket.emit("close")
_boolean = _socket.emit("error", _err);
_boolean = _socket.emit("listening");
_boolean = _socket.emit("message", _str, _rinfo);
_socket = _socket.on("close", () => {});
_socket = _socket.on("error", (err) => {
let _err: Error = err;
})
_socket = _socket.on("listening", () => {});
_socket = _socket.on("message", (msg, rinfo) => {
let _msg: string = msg;
let _rinfo: dgram.AddressInfo = rinfo;
})
_socket = _socket.once("close", () => {});
_socket = _socket.once("error", (err) => {
let _err: Error = err;
})
_socket = _socket.once("listening", () => {});
_socket = _socket.once("message", (msg, rinfo) => {
let _msg: string = msg;
let _rinfo: dgram.AddressInfo = rinfo;
})
_socket = _socket.prependListener("close", () => {});
_socket = _socket.prependListener("error", (err) => {
let _err: Error = err;
})
_socket = _socket.prependListener("listening", () => {});
_socket = _socket.prependListener("message", (msg, rinfo) => {
let _msg: string = msg;
let _rinfo: dgram.AddressInfo = rinfo;
})
_socket = _socket.prependOnceListener("close", () => {});
_socket = _socket.prependOnceListener("error", (err) => {
let _err: Error = err;
})
_socket = _socket.prependOnceListener("listening", () => {});
_socket = _socket.prependOnceListener("message", (msg, rinfo) => {
let _msg: string = msg;
let _rinfo: dgram.AddressInfo = rinfo;
})
}
}
////////////////////////////////////////////////////

126
node/node.d.ts vendored
View File

@@ -1855,8 +1855,8 @@ declare module "dgram" {
interface RemoteInfo {
address: string;
family: string;
port: number;
size: number;
}
interface AddressInfo {
@@ -1894,6 +1894,49 @@ declare module "dgram" {
dropMembership(multicastAddress: string, multicastInterface?: string): void;
ref(): void;
unref(): void;
/**
* events.EventEmitter
* 1. close
* 2. error
* 3. listening
* 4. message
**/
addListener(event: string, listener: Function): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this;
emit(event: string, ...args: any[]): boolean;
emit(event: "close"): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(event: "message", msg: string, rinfo: AddressInfo): boolean;
on(event: string, listener: Function): this;
on(event: "close", listener: () => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this;
once(event: string, listener: Function): this;
once(event: "close", listener: () => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this;
prependListener(event: string, listener: Function): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this;
prependOnceListener(event: string, listener: Function): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "message", listener: (msg: string, rinfo: AddressInfo) => void): this;
}
}
@@ -2278,6 +2321,8 @@ declare module "fs" {
encoding?: string;
fd?: number;
mode?: number;
autoClose?: boolean;
start?: number;
}): WriteStream;
export function fdatasync(fd: number, callback: Function): void;
export function fdatasyncSync(fd: number): void;
@@ -2585,6 +2630,35 @@ declare module "tls" {
* @returns {boolean} - Returns true on success, false otherwise.
*/
setMaxSendFragment(size: number): boolean;
/**
* events.EventEmitter
* 1. OCSPResponse
* 2. secureConnect
**/
addListener(event: string, listener: Function): this;
addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
addListener(event: "secureConnect", listener: () => void): this;
emit(event: string, ...args: any[]): boolean;
emit(event: "OCSPResponse", response: Buffer): boolean;
emit(event: "secureConnect"): boolean;
on(event: string, listener: Function): this;
on(event: "OCSPResponse", listener: (response: Buffer) => void): this;
on(event: "secureConnect", listener: () => void): this;
once(event: string, listener: Function): this;
once(event: "OCSPResponse", listener: (response: Buffer) => void): this;
once(event: "secureConnect", listener: () => void): this;
prependListener(event: string, listener: Function): this;
prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
prependListener(event: "secureConnect", listener: () => void): this;
prependOnceListener(event: string, listener: Function): this;
prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this;
prependOnceListener(event: "secureConnect", listener: () => void): this;
}
export interface TlsOptions {
@@ -2643,6 +2717,56 @@ declare module "tls" {
}): void;
maxConnections: number;
connections: number;
/**
* events.EventEmitter
* 1. tlsClientError
* 2. newSession
* 3. OCSPRequest
* 4. resumeSession
* 5. secureConnection
**/
addListener(event: string, listener: Function): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
addListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
addListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
addListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
emit(event: string, ...args: any[]): boolean;
emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean;
emit(event: "newSession", sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void): boolean;
emit(event: "OCSPRequest", certificate: Buffer, issuer: Buffer, callback: Function): boolean;
emit(event: "resumeSession", sessionId: any, callback: (err: Error, sessionData: any) => void): boolean;
emit(event: "secureConnection", tlsSocket: TLSSocket): boolean;
on(event: string, listener: Function): this;
on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
on(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
on(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
on(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
once(event: string, listener: Function): this;
once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
once(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
once(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
once(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependListener(event: string, listener: Function): this;
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
prependListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
prependListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: string, listener: Function): this;
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this;
prependOnceListener(event: "newSession", listener: (sessionId: any, sessionData: any, callback: (err: Error, resp: Buffer) => void) => void): this;
prependOnceListener(event: "OCSPRequest", listener: (certificate: Buffer, issuer: Buffer, callback: Function) => void): this;
prependOnceListener(event: "resumeSession", listener: (sessionId: any, callback: (err: Error, sessionData: any) => void) => void): this;
prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this;
}
export interface ClearTextStream extends stream.Duplex {

View File

@@ -6,7 +6,7 @@ import onHeaders = require('on-headers')
http.createServer(onRequest)
.listen(3000);
function onRequest(req: http.ServerRequest, res: http.ServerResponse) {
function onRequest(req: http.IncomingMessage, res: http.ServerResponse) {
onHeaders(res, addPoweredBy);
res.setHeader('Content-Type', 'text/plain')
res.end('hello!');

View File

@@ -2131,7 +2131,7 @@ declare namespace ol {
* @param ref2 Value to use as this when executing layerFilter.
* @returns Callback result, i.e. the return value of last callback execution, or the first truthy callback return value.
*/
forEachFeatureAtPixel(pixel: ol.Pixel, callback: (feature: ol.Feature, layer: ol.layer.Layer) => any, ref?: any, layerFilter?: (layerCandidate: ol.layer.Layer) => boolean, ref2?: any): void;
forEachFeatureAtPixel(pixel: ol.Pixel, callback: (feature: ol.Feature, layer: ol.layer.Layer) => any, ref?: any, layerFilter?: (layerCandidate: ol.layer.Layer) => boolean, ref2?: any): any;
/**
* Detect layers that have a color value at a pixel on the viewport, and execute a callback with each matching layer. Layers included in the detection can be configured through opt_layerFilter. Feature overlays will always be included in the detection.

View File

@@ -1591,7 +1591,11 @@ declare namespace __React {
export interface NavigatorIOSProperties extends React.Props<NavigatorIOSStatic> {
/**
* The background color of the navigation bar
*/
barTintColor?: string
/**
* NavigatorIOS uses "route" objects to identify child views, their props, and navigation bar configuration.
* "push" and all the other navigation operations expect routes to be like this

View File

@@ -169,8 +169,8 @@ declare namespace ReactRouter {
path?: RoutePattern
component?: RouteComponent
components?: RouteComponents
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
getComponent?: (nextState: RouterState, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (nextState: RouterState, cb: (error: any, components?: RouteComponents) => void) => void
onEnter?: EnterHook
onLeave?: LeaveHook
indexRoute?: PlainRoute
@@ -195,8 +195,8 @@ declare namespace ReactRouter {
interface IndexRouteProps extends React.Props<IndexRoute> {
component?: RouteComponent
components?: RouteComponents
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
getComponent?: (nextState: RouterState, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (nextState: RouterState, cb: (error: any, components?: RouteComponents) => void) => void
onEnter?: EnterHook
onLeave?: LeaveHook
}

View File

@@ -87,6 +87,12 @@ declare namespace ReactSelect {
* @default true
*/
backspaceRemoves?: boolean;
/**
* Message to use for screenreaders to press backspace to remove the current item
* {label} is replaced with the item label
* @default "Press backspace to remove..."
*/
backspaceToRemoveMessage?: string;
/**
* CSS className for the outer element
*/

2
react/react.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for React v0.14
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>, John Reilly <https://github.com/johnnyreilly/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace __React {

28
restify/restify.d.ts vendored
View File

@@ -35,7 +35,7 @@ declare module "restify" {
}
}
interface Request extends http.ServerRequest {
interface Request extends http.IncomingMessage {
/**
* builds an absolute URI for the request.
* @private
@@ -470,24 +470,24 @@ declare module "restify" {
}
interface Client {
get: (path: string, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
head: (path: string, callback?: (err: any, req: Request, res: Response) => any) => any;
post: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
put: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
patch: (path: string, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
del: (path: string, callback?: (err: any, req: Request, res: Response) => any) => any;
get: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
head: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any;
post: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
put: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
patch: (opts: string | { path?: string; [name: string]: any }, object: any, callback?: (err: any, req: Request, res: Response, obj: any) => any) => any;
del: (opts: string | { path?: string; [name: string]: any }, callback?: (err: any, req: Request, res: Response) => any) => any;
basicAuth: (username: string, password: string) => any;
}
interface HttpClient extends Client {
get: (path?: any, callback?: Function) => any;
head: (path?:any, callback?: Function) => any;
post: (opts?: any, callback?: Function) => any;
put: (opts?: any, callback?: Function) => any;
patch: (opts?: any, callback?: Function) => any;
del: (opts?: any, callback?: Function) => any;
get: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
head: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
post: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
put: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
patch: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
del: (opts?: string | { path?: string; [name: string]: any }, callback?: Function) => any;
}
interface ThrottleOptions {
burst?: number;
rate?: number;

View File

@@ -15,8 +15,10 @@ r.connect({host:"localhost", port: 28015}, function(err, conn) {
})
.between("james", "beth")
.limit(4)
.run(conn, function() {
.run(conn, function(err, cursor) {
cursor.toArray().then(rows => {
console.log(rows);
});
})
})

View File

@@ -8,229 +8,239 @@
declare module "rethinkdb" {
export function connect(host:ConnectionOptions, cb?:(err:Error, conn:Connection)=>void):Promise<Connection>;
export function connect(host: ConnectionOptions, cb?: (err: Error, conn: Connection) => void): Promise<Connection>;
export function dbCreate(name:string):Operation<CreateResult>;
export function dbDrop(name:string):Operation<DropResult>;
export function dbList():Operation<string[]>;
export function dbCreate(name: string): Operation<CreateResult>;
export function dbDrop(name: string): Operation<DropResult>;
export function dbList(): Operation<string[]>;
export function db(name:string):Db;
export function table(name:string, options?:{useOutdated:boolean}):Table;
export function db(name: string): Db;
export function table(name: string, options?: { useOutdated: boolean }): Table;
export function asc(property:string):Sort;
export function desc(property:string):Sort;
export function asc(property: string): Sort;
export function desc(property: string): Sort;
export var count:Aggregator;
export function sum(prop:string):Aggregator;
export function avg(prop:string):Aggregator;
export var count: Aggregator;
export function sum(prop: string): Aggregator;
export function avg(prop: string): Aggregator;
export function row(name:string):Expression<any>;
export function expr(stuff:any):Expression<any>;
export function row(name: string): Expression<any>;
export function expr(stuff: any): Expression<any>;
export function now():Time;
export function now(): Time;
// Control Structures
export function branch(test:Expression<boolean>, trueBranch:Expression<any>, falseBranch:Expression<any>):Expression<any>;
// Control Structures
export function branch(test: Expression<boolean>, trueBranch: Expression<any>, falseBranch: Expression<any>): Expression<any>;
export class Cursor {
hasNext():boolean;
each(cb:(err:Error, row:any)=>void, done?:()=>void);
each(cb:(err:Error, row:any)=>boolean, done?:()=>void); // returning false stops iteration
next(cb:(err:Error, row:any) => void);
toArray(cb:(err:Error, rows:any[]) => void);
close();
}
export class Cursor {
hasNext(): boolean;
each(cb: (err: Error, row: any) => void, done?: () => void): void;
each<T>(cb: (err: Error, row: T) => void, done?: () => void): void;
each(cb: (err: Error, row: any) => boolean, done?: () => void): void; // returning false stops iteration
each<T>(cb: (err: Error, row: T) => boolean, done?: () => void): void; // returning false stops iteration
next(cb: (err: Error, row: any) => void): void;
next<T>(cb: (err: Error, row: T) => void): void;
toArray(cb: (err: Error, rows: any[]) => void): void;
toArray<T>(cb: (err: Error, rows: T[]) => void): void;
toArray(): Promise<any[]>;
toArray<T>(): Promise<T[]>;
close(cb: (err: Error) => void): void;
close(): Promise<void>;
}
interface ConnectionOptions {
host:string;
port:number;
db?:string;
authKey?:string;
}
interface ConnectionOptions {
host: string;
port: number;
db?: string;
authKey?: string;
}
interface Connection {
close();
reconnect(cb?:(err:Error, conn:Connection)=>void):Promise<Connection>;
use(dbName:string);
addListener(event:string, cb:Function);
on(event:string, cb:Function);
}
interface Connection {
close(cb: (err: Error) => void): void;
close(opts: { noreplyWait: boolean }, cb: (err: Error) => void): void;
close(): Promise<void>;
close(opts: { noreplyWait: boolean }): Promise<void>;
reconnect(cb?: (err: Error, conn: Connection) => void): Promise<Connection>;
use(dbName: string): void;
addListener(event: string, cb: Function): void;
on(event: string, cb: Function): void;
}
interface Db {
tableCreate(name:string, options?:TableOptions):Operation<CreateResult>;
tableDrop(name:string):Operation<DropResult>;
tableList():Operation<string[]>;
table(name:string, options?:GetTableOptions):Table;
}
interface Db {
tableCreate(name: string, options?: TableOptions): Operation<CreateResult>;
tableDrop(name: string): Operation<DropResult>;
tableList(): Operation<string[]>;
table(name: string, options?: GetTableOptions): Table;
}
interface TableOptions {
primary_key?:string; // 'id'
durability?:string; // 'soft'
cache_size?:number;
datacenter?:string;
}
interface TableOptions {
primary_key?: string; // 'id'
durability?: string; // 'soft'
cache_size?: number;
datacenter?: string;
}
interface GetTableOptions {
useOutdated: boolean;
}
interface GetTableOptions {
useOutdated: boolean;
}
interface Writeable {
update(obj:Object, options?:UpdateOptions):Operation<WriteResult>;
replace(obj:Object, options?:UpdateOptions):Operation<WriteResult>;
replace(expr:ExpressionFunction<any>):Operation<WriteResult>;
delete(options?:UpdateOptions):Operation<WriteResult>;
}
interface Writeable {
update(obj: Object, options?: UpdateOptions): Operation<WriteResult>;
replace(obj: Object, options?: UpdateOptions): Operation<WriteResult>;
replace(expr: ExpressionFunction<any>): Operation<WriteResult>;
delete(options?: UpdateOptions): Operation<WriteResult>;
}
interface Table extends Sequence {
indexCreate(name:string, index?:ExpressionFunction<any>):Operation<CreateResult>;
indexDrop(name:string):Operation<DropResult>;
indexList():Operation<string[]>;
interface Table extends Sequence {
indexCreate(name: string, index?: ExpressionFunction<any>): Operation<CreateResult>;
indexDrop(name: string): Operation<DropResult>;
indexList(): Operation<string[]>;
insert(obj:any[], options?:InsertOptions):Operation<WriteResult>;
insert(obj:any, options?:InsertOptions):Operation<WriteResult>;
insert(obj: any[], options?: InsertOptions): Operation<WriteResult>;
insert(obj: any, options?: InsertOptions): Operation<WriteResult>;
get(key:string):Sequence; // primary key
getAll(key:string, index?:Index):Sequence; // without index defaults to primary key
getAll(...keys:string[]):Sequence;
}
get(key: string): Sequence; // primary key
getAll(key: string, index?: Index): Sequence; // without index defaults to primary key
getAll(...keys: string[]): Sequence;
}
interface Sequence extends Operation<Cursor>, Writeable {
interface Sequence extends Operation<Cursor>, Writeable {
between(lower:any, upper:any, index?:Index):Sequence;
filter(rql:ExpressionFunction<boolean>):Sequence;
filter(rql:Expression<boolean>):Sequence;
filter(obj:{[key:string]:any}):Sequence;
between(lower: any, upper: any, index?: Index): Sequence;
filter(rql: ExpressionFunction<boolean>): Sequence;
filter(rql: Expression<boolean>): Sequence;
filter(obj: { [key: string]: any }): Sequence;
// Join
// these return left, right
innerJoin(sequence:Sequence, join:JoinFunction<boolean>):Sequence;
outerJoin(sequence:Sequence, join:JoinFunction<boolean>):Sequence;
eqJoin(leftAttribute:string, rightSequence:Sequence, index?:Index):Sequence;
eqJoin(leftAttribute:ExpressionFunction<any>, rightSequence:Sequence, index?:Index):Sequence;
zip():Sequence;
// Join
// these return left, right
innerJoin(sequence: Sequence, join: JoinFunction<boolean>): Sequence;
outerJoin(sequence: Sequence, join: JoinFunction<boolean>): Sequence;
eqJoin(leftAttribute: string, rightSequence: Sequence, index?: Index): Sequence;
eqJoin(leftAttribute: ExpressionFunction<any>, rightSequence: Sequence, index?: Index): Sequence;
zip(): Sequence;
// Transform
map(transform:ExpressionFunction<any>):Sequence;
withFields(...selectors:any[]):Sequence;
concatMap(transform:ExpressionFunction<any>):Sequence;
orderBy(...keys:string[]):Sequence;
orderBy(...sorts:Sort[]):Sequence;
skip(n:number):Sequence;
limit(n:number):Sequence;
slice(start:number, end?:number):Sequence;
nth(n:number):Expression<any>;
indexesOf(obj:any):Sequence;
isEmpty():Expression<boolean>;
union(sequence:Sequence):Sequence;
sample(n:number):Sequence;
// Transform
map(transform: ExpressionFunction<any>): Sequence;
withFields(...selectors: any[]): Sequence;
concatMap(transform: ExpressionFunction<any>): Sequence;
orderBy(...keys: string[]): Sequence;
orderBy(...sorts: Sort[]): Sequence;
skip(n: number): Sequence;
limit(n: number): Sequence;
slice(start: number, end?: number): Sequence;
nth(n: number): Expression<any>;
indexesOf(obj: any): Sequence;
isEmpty(): Expression<boolean>;
union(sequence: Sequence): Sequence;
sample(n: number): Sequence;
// Aggregate
reduce(r:ReduceFunction<any>, base?:any):Expression<any>;
count():Expression<number>;
distinct():Sequence;
groupedMapReduce(group:ExpressionFunction<any>, map:ExpressionFunction<any>, reduce:ReduceFunction<any>, base?:any):Sequence;
groupBy(...aggregators:Aggregator[]):Expression<Object>; // TODO: reduction object
contains(prop:string):Expression<boolean>;
// Aggregate
reduce(r: ReduceFunction<any>, base?: any): Expression<any>;
count(): Expression<number>;
distinct(): Sequence;
groupedMapReduce(group: ExpressionFunction<any>, map: ExpressionFunction<any>, reduce: ReduceFunction<any>, base?: any): Sequence;
groupBy(...aggregators: Aggregator[]): Expression<Object>; // TODO: reduction object
contains(prop: string): Expression<boolean>;
// Manipulation
pluck(...props:string[]):Sequence;
without(...props:string[]):Sequence;
}
// Manipulation
pluck(...props: string[]): Sequence;
without(...props: string[]): Sequence;
}
interface ExpressionFunction<U> {
(doc:Expression<any>):Expression<U>;
}
interface ExpressionFunction<U> {
(doc: Expression<any>): Expression<U>;
}
interface JoinFunction<U> {
(left:Expression<any>, right:Expression<any>):Expression<U>;
}
interface JoinFunction<U> {
(left: Expression<any>, right: Expression<any>): Expression<U>;
}
interface ReduceFunction<U> {
(acc:Expression<any>, val:Expression<any>):Expression<U>;
}
interface ReduceFunction<U> {
(acc: Expression<any>, val: Expression<any>): Expression<U>;
}
interface InsertOptions {
upsert: boolean; // true
durability: string; // 'soft'
return_vals: boolean; // false
}
interface InsertOptions {
upsert: boolean; // true
durability: string; // 'soft'
return_vals: boolean; // false
}
interface UpdateOptions {
non_atomic: boolean;
durability: string; // 'soft'
return_vals: boolean; // false
}
interface UpdateOptions {
non_atomic: boolean;
durability: string; // 'soft'
return_vals: boolean; // false
}
interface WriteResult {
inserted: number;
replaced: number;
unchanged: number;
errors: number;
deleted: number;
skipped: number;
first_error: Error;
generated_keys: string[]; // only for insert
}
interface WriteResult {
inserted: number;
replaced: number;
unchanged: number;
errors: number;
deleted: number;
skipped: number;
first_error: Error;
generated_keys: string[]; // only for insert
}
interface JoinResult {
left:any;
right:any;
}
interface JoinResult {
left: any;
right: any;
}
interface CreateResult {
created: number;
}
interface CreateResult {
created: number;
}
interface DropResult {
dropped: number;
}
interface DropResult {
dropped: number;
}
interface Index {
index: string;
left_bound?: string; // 'closed'
right_bound?: string; // 'open'
}
interface Index {
index: string;
left_bound?: string; // 'closed'
right_bound?: string; // 'open'
}
interface Expression<T> extends Writeable, Operation<T> {
(prop:string):Expression<any>;
merge(query:Expression<Object>):Expression<Object>;
append(prop:string):Expression<Object>;
contains(prop:string):Expression<boolean>;
interface Expression<T> extends Writeable, Operation<T> {
(prop: string): Expression<any>;
merge(query: Expression<Object>): Expression<Object>;
append(prop: string): Expression<Object>;
contains(prop: string): Expression<boolean>;
and(b:boolean):Expression<boolean>;
or(b:boolean):Expression<boolean>;
eq(v:any):Expression<boolean>;
ne(v:any):Expression<boolean>;
not():Expression<boolean>;
and(b: boolean): Expression<boolean>;
or(b: boolean): Expression<boolean>;
eq(v: any): Expression<boolean>;
ne(v: any): Expression<boolean>;
not(): Expression<boolean>;
gt(value:T):Expression<boolean>;
ge(value:T):Expression<boolean>;
lt(value:T):Expression<boolean>;
le(value:T):Expression<boolean>;
gt(value: T): Expression<boolean>;
ge(value: T): Expression<boolean>;
lt(value: T): Expression<boolean>;
le(value: T): Expression<boolean>;
add(n:number):Expression<number>;
sub(n:number):Expression<number>;
mul(n:number):Expression<number>;
div(n:number):Expression<number>;
mod(n:number):Expression<number>;
add(n: number): Expression<number>;
sub(n: number): Expression<number>;
mul(n: number): Expression<number>;
div(n: number): Expression<number>;
mod(n: number): Expression<number>;
hasFields(...fields:string[]):Expression<boolean>;
hasFields(...fields: string[]): Expression<boolean>;
default(value:T):Expression<T>;
}
default(value: T): Expression<T>;
}
interface Operation<T> {
run(conn:Connection, cb?:(err:Error, result:T)=>void):Promise<T>;
}
interface Operation<T> {
run(conn: Connection, cb?: (err: Error, result: T) => void): Promise<T>;
}
interface Aggregator {}
interface Sort {}
interface Aggregator { }
interface Sort { }
interface Time {}
interface Time { }
// http://www.rethinkdb.com/api/#js
// TODO control structures
// http://www.rethinkdb.com/api/#js
// TODO control structures
}

View File

@@ -0,0 +1,12 @@
/// <reference path="shallowequal.d.ts" />
import shallowEqual = require('shallowequal');
const a = {}, b = {};
function compare(a: any, b: any, indexOrKey?: number | string) {
return false;
}
shallowEqual(a, b);
shallowEqual(a, b, compare);
shallowEqual(a, b, compare, {});

9
shallowequal/shallowequal.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for shallowequal v0.2.2
// Project: https://github.com/dashed/shallowequal
// Definitions by: Sean Kelley <https://github.com/seansfkelley>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'shallowequal' {
function shallowEqual(objA: any, objB: any, compare?: (objA: any, objB: any, indexOrKey?: number | string) => boolean, compareContext?: any): boolean;
export = shallowEqual;
}

View File

@@ -0,0 +1,29 @@
/// <reference path="tilebelt.d.ts"/>
import * as tilebelt from 'tilebelt'
const lon = 30.5
const lat = 50.5
const z = 15
const tile = [5, 10, 10]
const tiles = [
[0, 0, 5],
[0, 1, 5],
[1, 1, 5],
[1, 0, 5]
]
const quadkey = '00001033'
const bbox = [ -178.24, 84.70, -177.89, 84.73 ]
tilebelt.tileToQuadkey(tile)
tilebelt.tileToBBOX(tile)
tilebelt.tileToGeoJSON(tile)
tilebelt.getParent(tile)
tilebelt.getSiblings(tile)
tilebelt.tileToQuadkey(tile)
tilebelt.pointToTile(lon, lat, z)
tilebelt.quadkeyToTile(quadkey)
tilebelt.bboxToTile(bbox)
tilebelt.pointToTileFraction(lon, lat, z)
tilebelt.hasSiblings(tile, tiles)
tilebelt.hasTile(tiles, tile)
tilebelt.tilesEqual(tiles[0], tiles[1])

189
tilebelt/tilebelt.d.ts vendored Normal file
View File

@@ -0,0 +1,189 @@
// Type definitions for tilebelt 1.0.1
// Project: https://github.com/mapbox/tilebelt
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../geojson/geojson.d.ts" />
declare const tilebelt: tilebelt.TilebeltStatic;
declare namespace tilebelt {
interface TilebeltStatic {
/**
* Get a geojson representation of a tile
*
* @name tileToGeoJSON
* @param {Array<number>} tile
* @returns {Feature<Polygon>}
* @example
* var poly = tileToGeoJSON([5, 10, 10])
* //=poly
*/
tileToGeoJSON(tile: Array<number>): GeoJSON.Feature<GeoJSON.Polygon>
/**
* Get the bbox of a tile
*
* @name tileToBBOX
* @param {Array<number>} tile
* @returns {Array<number>} bbox
* @example
* var bbox = tileToBBOX([5, 10, 10])
* //=bbox
*/
tileToBBOX(tile: Array<number>): Array<number>
/**
* Get the tile for a point at a specified zoom level
*
* @name pointToTile
* @param {number} lon
* @param {number} lat
* @param {number} z
* @returns {Array<number>} tile
* @example
* var tile = pointToTile(1, 1, 20)
* //=tile
*/
pointToTile(lon: number, lat: number, z: number): Array<number>
/**
* Get the 4 tiles one zoom level higher
*
* @name getChildren
* @param {Array<number>} tile
* @returns {Array<Array<number>>} tiles
* @example
* var tiles = getChildren([5, 10, 10])
* //=tiles
*/
getChildren(tile: Array<number>): Array<Array<number>>
/**
* Get the tile one zoom level lower
*
* @name getParent
* @param {Array<number>} tile
* @returns {Array<number>} tile
* @example
* var tile = getParent([5, 10, 10])
* //=tile
*/
getParent(tile: Array<number>): Array<number>
/**
* Get the 3 sibling tiles for a tile
*
* @name getSiblings
* @param {Array<number>} tile
* @returns {Array<Array<number>>} tiles
* @example
* var tiles = getSiblings([5, 10, 10])
* //=tiles
*/
getSiblings(tile: Array<number>): Array<Array<number>>
/**
* Check to see if an array of tiles contains a tiles siblings
*
* @name hasSiblings
* @param {Array<number>} tile
* @param {Array<Array<number>>} tiles
* @returns {boolean}
* @example
* var tiles = [
* [0, 0, 5],
* [0, 1, 5],
* [1, 1, 5],
* [1, 0, 5]
* ]
* hasSiblings([0, 0, 5], tiles)
* //=boolean
*/
hasSiblings(tile: Array<number>, tiles: Array<Array<number>>): boolean
/**
* Check to see if an array of tiles contains a particular tile
*
* @name hasTile
* @param {Array<Array<number>>} tiles
* @param {Array<number>} tile
* @returns {boolean}
* @example
* var tiles = [
* [0, 0, 5],
* [0, 1, 5],
* [1, 1, 5],
* [1, 0, 5]
* ]
* hasTile(tiles, [0, 0, 5])
* //=boolean
*/
hasTile(tiles: Array<Array<number>>, tile: Array<number>): boolean
/**
* Check to see if two tiles are the same
*
* @name tilesEqual
* @param {Array<number>} tile1
* @param {Array<number>} tile2
* @returns {boolean}
* @example
* tilesEqual([0, 1, 5], [0, 0, 5])
* //=boolean
*/
tilesEqual(tile1: Array<number>, tile2: Array<number>): boolean
/**
* Get the quadkey for a tile
*
* @name tileToQuadkey
* @param {Array<number>} tile
* @returns {string} quadkey
* @example
* var quadkey = tileToQuadkey([0, 1, 5])
* //=quadkey
*/
tileToQuadkey(tile: Array<number>): string
/**
* Get the tile for a quadkey
*
* @name quadkeyToTile
* @param {string} quadkey
* @returns {Array<number>} tile
* @example
* var tile = quadkeyToTile('00001033')
* //=tile
*/
quadkeyToTile(quadkey: string): Array<number>
/**
* Get the smallest tile to cover a bbox
*
* @name bboxToTile
* @param {Array<number>} bbox
* @returns {Array<number>} tile
* @example
* var tile = bboxToTile([ -178, 84, -177, 85 ])
* //=tile
*/
bboxToTile(bbox: Array<number>): Array<number>
/**
* Get the precise fractional tile location for a point at a zoom level
*
* @name pointToTileFraction
* @param {number} lon
* @param {number} lat
* @param {number} z
* @returns {Array<number>} tile fraction
* var tile = pointToTileFraction(30.5, 50.5, 15)
* //=tile
*/
pointToTileFraction(lon: number, lat: number, z: number): Array<number>
}
}
declare module "tilebelt" {
export = tilebelt
}

View File

@@ -499,8 +499,26 @@ turf.collect(polygons, points, 'population', 'values')
///////////////////////////////////////////
// Tests Assertions
///////////////////////////////////////////
// -- Test bbox --
turf.bbox(polygon1)
turf.bbox(point1)
turf.bbox(lineString1)
turf.bbox(multiLineString1)
turf.bbox(multiPolygon1)
turf.bbox(multiPolygon1)
// -- Test circle --
turf.circle(point1, 10)
turf.circle(point1, 10, 32)
turf.circle(point1, 10, 64, 'miles')
// -- Test geojsonType --
turf.geojsonType(point1, 'point', 'Test')
// -- Test propReduce --
turf.propReduce(point1, (memo, coord) => {}, 'point')
// -- Test coordAll --
turf.coordAll(polygon1)
// -- Test tesselate --
turf.tesselate(polygon1)

166
turf/turf.d.ts vendored
View File

@@ -80,16 +80,22 @@ ASSERTIONS
- [ ] featureOf
- [ ] collectionOf
- [x] bbox
- [ ] circle
- [ ] geojsonType
- [ ] propReduce
- [ ] coordAll
- [ ] tesselate
- [x] circle
- [x] geojsonType
- [x] propReduce
- [x] coordAll
- [x] tesselate
*/
declare const turf: turf.TurfStatic;
declare const TemplateUnits: 'miles' | 'nauticalmiles' | 'degrees' | 'radians' | 'inches' | 'yards' | 'meters' | 'metres' | 'kilometers' | 'kilometres'
declare const TemplateType: 'point'| 'points' | 'polygon' | 'polygons'
declare interface OptionsRandom {
bbox?: Array<number>
num_vertices?: number
max_radial_length?: number
}
declare type PropReduceCallback = (memo: any, coord: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>) => any
declare module turf {
interface TurfStatic {
//////////////////////////////////////////////////////
@@ -169,11 +175,79 @@ declare module turf {
* var bboxPolygon = turf.bboxPolygon(bbox);
*
* //=bbox
*
*
* //=bboxPolygon
*/
bbox(bbox: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>): Array<number>;
/**
* Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
*
* @name circle
* @param {Feature<Point>} center center point
* @param {number} radius radius of the circle
* @param {number} [steps=64] number of steps
* @param {string} [units=kilometers] miles, kilometers, degrees, or radians
* @returns {Feature<Polygon>} circle polygon
* @example
* var center = point([-75.343, 39.984]);
* var radius = 5;
* var steps = 10;
* var units = 'kilometers';
*
* var circle = turf.circle(center, radius, steps, units);
*
* //=circle
*/
circle(center: GeoJSON.Feature<GeoJSON.Point>, radius: number, steps?: number, units?: typeof TemplateUnits): GeoJSON.Feature<GeoJSON.Polygon>;
/**
* Enforce expectations about types of GeoJSON objects for Turf.
*
* @name geojsonType
* @param {GeoJSON} value any GeoJSON object
* @param {string} type expected GeoJSON type
* @param {string} name name of calling function
* @throws {Error} if value is not the expected type.
*/
geojsonType(value: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>, type: string, name: string): void
/**
* Reduce properties in any GeoJSON object into a single value, similar to how Array.reduce works. However, in this case we lazily run the reduction, so an array of all properties is unnecessary.
*
* @name propReduce
* @param {GeoJSON} layer any GeoJSON object
* @param {Function} callback a method that takes (memo, coord) and returns a new memo
* @param {*} memo the starting value of memo: can be any type.
* @return {*} combined value
*/
propReduce(layer: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>, callback: PropReduceCallback, memo: any): any
/**
* Get all coordinates from any GeoJSON object, returning an array of coordinate arrays.
*
* @name coordAll
* @param {GeoJSON} layer any GeoJSON object
* @returns {Array<Array<Number>>} coordinate position array
*/
coordAll(layer: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>): Array<Array<number>>
/**
* Tesselates a {@link Feature<Polygon>} into a {@link FeatureCollection<Polygon>} of triangles using [earcut](https://github.com/mapbox/earcut).
*
* @name tesselate
* @param {Feature<Polygon>} polygon the polygon to tesselate
* @returns {FeatureCollection<Polygon>} a geometrycollection feature
* @example
* var polygon = turf.random('polygon').features[0];
*
* var triangles = turf.tesselate(polygon);
*
* //=triangles
*/
tesselate(poly: GeoJSON.Feature<GeoJSON.Polygon>): GeoJSON.FeatureCollection<GeoJSON.Polygon>
/**
* Takes a bbox and returns an equivalent polygon.
* @param bbox An Array of bounding box coordinates in the form: [xLow, yLow, xHigh, yHigh]
@@ -298,7 +372,7 @@ declare module turf {
*/
buffer(feature: GeoJSON.Feature<GeoJSON.Polygon>, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature<GeoJSON.Polygon>;
buffer(feature: GeoJSON.Feature<GeoJSON.MultiPolygon>, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature<GeoJSON.MultiPolygon>;
buffer(feature: GeoJSON.Feature<GeoJSON.Point>, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature<GeoJSON.Point>;
buffer(feature: GeoJSON.Feature<GeoJSON.Point>, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature<GeoJSON.Point>;
buffer(feature: GeoJSON.Feature<any>, distance: number, units?: typeof TemplateUnits): GeoJSON.Feature<any>;
buffer(feature: GeoJSON.FeatureCollection<GeoJSON.Polygon>, distance: number, units?: typeof TemplateUnits): GeoJSON.FeatureCollection<GeoJSON.Polygon>;
buffer(feature: GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>, distance: number, units?: typeof TemplateUnits): GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>;
@@ -343,7 +417,7 @@ declare module turf {
* If they share a border, returns the border if they don't intersect, returns undefined.
*
* @name [intersect](http://turfjs.org/docs/#intersect)
* @param {Feature<Polygon>} poly1
* @param {Feature<Polygon>} poly1
* @param {Feature<Polygon>} poly2
* @returns {Feature|undefined} A feature representing the point(s) they share (in case of a {Point} or {MultiPoint}), the borders they share (in case of a {LineString} or a {MultiLineString}), the area they share (in case of {Polygon} or {MultiPolygon}). If they do not share any point, returns `undefined`.
* @example
@@ -456,7 +530,7 @@ declare module turf {
/**
* Takes one or more {@link Feature|Features} and creates a {@link FeatureCollection}.
*
*
* @name [featureCollection](http://turfjs.org/docs/#featurecollection)
* @param {Feature[]} features input features
* @returns {FeatureCollection} a FeatureCollection of input features
@@ -497,7 +571,7 @@ declare module turf {
/**
* Creates a {@link LineString} based on a coordinate array. Properties can be added optionally.
*
*
* @name [lineString](http://turfjs.org/docs/#linestring)
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object=} properties an Object of key-value pairs to add as properties
@@ -525,7 +599,7 @@ declare module turf {
/**
* Creates a {@link Feature<MultiLineString>} based on a coordinate array. Properties can be added optionally.
*
*
* @name [multiLineString](http://turfjs.org/docs/#multilinestring)
* @param {Array<Array<Array<number>>>} coordinates an array of LineStrings
* @param {Object=} properties an Object of key-value pairs to add as properties
@@ -541,7 +615,7 @@ declare module turf {
/**
* Takes coordinates and properties (optional) and returns a new {@link Point} feature.
*
*
* @name [point](http://turfjs.org/docs/#point)
* @param {Array<number>} coordinates longitude, latitude position (each in decimal degrees)
* @param {Object=} properties an Object that is used as the {@link Feature}'s
@@ -556,7 +630,7 @@ declare module turf {
/**
* Creates a {@link Feature<MultiPoint>} based on a coordinate array. Properties can be added optionally.
*
*
* @name [multiPoint](http://turfjs.org/docs/#multipoint)
* @param {Array<Array<number>>} coordinates an array of Positions
* @param {Object=} properties an Object of key-value pairs to add as properties
@@ -572,7 +646,7 @@ declare module turf {
/**
* Takes an array of LinearRings and optionally an {@link Object} with properties and returns a {@link Polygon} feature.
*
*
* @name [polygon](http://turfjs.org/docs/#polygon)
* @param {Array<Array<Array<number>>>} coordinates an array of LinearRings
* @param {Object=} properties a properties object
@@ -595,7 +669,7 @@ declare module turf {
/**
* Creates a {@link Feature<MultiPolygon>} based on a coordinate array. Properties can be added optionally.
*
*
* @name [multiPolygon](http://turfjs.org/docs/#multipolygon)
* @param {Array<Array<Array<Array<number>>>>} coordinates an array of Polygons
* @param {Object=} properties an Object of key-value pairs to add as properties
@@ -664,15 +738,15 @@ declare module turf {
*
* //=polygons
*/
random(type?: typeof TemplateType, count?: number, options?: {
bbox?: Array<number>
num_vertices?: number
max_radial_length?: number
}): GeoJSON.FeatureCollection<any>;
random(type?: 'point', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection<GeoJSON.Point>;
random(type?: 'points', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection<GeoJSON.Point>;
random(type?: 'polygon', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection<GeoJSON.Polygon>;
random(type?: 'polygons', count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection<GeoJSON.Polygon>;
random(type?: typeof TemplateType, count?: number, options?: OptionsRandom): GeoJSON.FeatureCollection<any>;
/**
* Takes a {@link FeatureCollection} and returns a FeatureCollection with given number of {@link Feature|features} at random.
*
*
* @name [sample](http://turfjs.org/docs/#sample)
* @param {FeatureCollection} featurecollection set of input features
* @param {number} num number of features to select
@@ -694,7 +768,7 @@ declare module turf {
/**
* Takes a bounding box and a cell size in degrees and returns a {@link FeatureCollection} of flat-topped hexagons ({@link Polygon} features) aligned in an "odd-q" vertical grid as described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/).
*
*
* @name [hexGrid](http://turfjs.org/docs/#hexgrid)
* @param {Array<number>} bbox bounding box in [minX, minY, maxX, maxY] order
* @param {number} cellSize dimension of cell in specified units
@@ -737,7 +811,7 @@ declare module turf {
pointGrid(
bbox: Array<number>,
cellSize: number,
units?: typeof TemplateUnits
units?: typeof TemplateUnits
): GeoJSON.FeatureCollection<GeoJSON.Point>;
/**
@@ -835,7 +909,7 @@ declare module turf {
* var poly = polygon([[[-81, 41], [-81, 47], [-72, 47], [-72, 41], [-81, 41]]])
*
* var isInside = turf.inside(pt, poly)
*
*
* //=isInside
*/
inside(
@@ -857,10 +931,10 @@ declare module turf {
* var pt2 = point([-77, 38])
* var poly1 = polygon([[[-81, 41], [-81, 47], [-72, 47], [-72, 41], [-81, 41]]], {pop: 1000})
* var poly2 = polygon([[[-81, 35], [-81, 41], [-72, 41], [-72, 35], [-81, 35]]], {pop: 3000})
*
*
* var points = featureCollection([pt1, pt2])
* var polygons = featureCollection([poly1, poly2])
*
*
* var tagged = turf.tag(points, polygons, 'pop', 'population')
* //=tagged
*/
@@ -1181,27 +1255,27 @@ declare module "@turf/bbox" {
export = bbox;
}
// declare module "@turf/circle" {
// const circle: typeof turf.circle;
// export = circle;
// }
declare module "@turf/circle" {
const circle: typeof turf.circle;
export = circle;
}
// declare module "@turf/geojsonType" {
// const geojsonType: typeof turf.geojsonType;
// export = geojsonType;
// }
declare module "@turf/geojsonType" {
const geojsonType: typeof turf.geojsonType;
export = geojsonType;
}
// declare module "@turf/propReduce" {
// const propReduce: typeof turf.propReduce;
// export = propReduce;
// }
declare module "@turf/propReduce" {
const propReduce: typeof turf.propReduce;
export = propReduce;
}
// declare module "@turf/coordAll" {
// const coordAll: typeof turf.coordAll;
// export = coordAll;
// }
declare module "@turf/coordAll" {
const coordAll: typeof turf.coordAll;
export = coordAll;
}
// declare module "@turf/tesselate" {
// const tesselate: typeof turf.tesselate;
// export = tesselate;
// }
declare module "@turf/tesselate" {
const tesselate: typeof turf.tesselate;
export = tesselate;
}

4
urijs/URIjs.d.ts vendored
View File

@@ -52,8 +52,6 @@ declare namespace uri {
is(qry: string): boolean;
iso8859(): URI;
joinPaths(...paths: (string | URI)[]): URI;
normalize(): URI;
normalizeFragment(): URI;
normalizeHash(): URI;
@@ -190,6 +188,8 @@ declare namespace uri {
expand(template: string, vals: Object): URI;
iso8859(): void;
joinPaths(...paths: (string | URI)[]): URI;
parse(url: string): {
protocol: string;

View File

@@ -13,7 +13,7 @@ declare module "urlrouter" {
namespace UrlRouterInternal {
interface ServerRequest extends http.ServerRequest {
interface ServerRequest extends http.IncomingMessage {
params: any;
}

View File

@@ -2,6 +2,258 @@
import * as validator from 'validator';
/************************************************
* *
* IMPORT TESTS *
* *
************************************************/
import {
blacklist as blacklistFunc,
contains as containsFunc,
equals as equalsFunc,
escape as escapeFunc,
isAfter as isAfterFunc,
isAlpha as isAlphaFunc,
isAlphanumeric as isAlphanumericFunc,
isAscii as isAsciiFunc,
isBase64 as isBase64Func,
isBefore as isBeforeFunc,
isBoolean as isBooleanFunc,
isByteLength as isByteLengthFunc,
isCreditCard as isCreditCardFunc,
isCurrency as isCurrencyFunc,
isDataURI as isDataURIFunc,
isDate as isDateFunc,
isDecimal as isDecimalFunc,
isDivisibleBy as isDivisibleByFunc,
isEmail as isEmailFunc,
isFQDN as isFQDNFunc,
isFloat as isFloatFunc,
isFullWidth as isFullWidthFunc,
isHalfWidth as isHalfWidthFunc,
isHexColor as isHexColorFunc,
isHexadecimal as isHexadecimalFunc,
isIP as isIPFunc,
isISBN as isISBNFunc,
isISIN as isISINFunc,
isISO8601 as isISO8601Func,
isIn as isInFunc,
isInt as isIntFunc,
isJSON as isJSONFunc,
isLength as isLengthFunc,
isLowercase as isLowercaseFunc,
isMACAddress as isMACAddressFunc,
isMD5 as isMD5Func,
isMobilePhone as isMobilePhoneFunc,
isMongoId as isMongoIdFunc,
isMultibyte as isMultibyteFunc,
isNull as isNullFunc,
isNumeric as isNumericFunc,
isSurrogatePair as isSurrogatePairFunc,
isURL as isURLFunc,
isUUID as isUUIDFunc,
isUppercase as isUppercaseFunc,
isVariableWidth as isVariableWidthFunc,
isWhitelisted as isWhitelistedFunc,
ltrim as ltrimFunc,
matches as matchesFunc,
normalizeEmail as normalizeEmailFunc,
rtrim as rtrimFunc,
stripLow as stripLowFunc,
toBoolean as toBooleanFunc,
toDate as toDateFunc,
toFloat as toFloatFunc,
toInt as toIntFunc,
trim as trimFunc,
unescape as unescapeFunc,
whitelist as whitelistFunc,
} from 'validator'
namespace import_tests {
let _blacklist = validator.blacklist;
_blacklist = blacklistFunc;
let _contains = validator.contains;
_contains = containsFunc;
let _equals = validator.equals;
_equals = equalsFunc;
let _escape = validator.escape;
_escape = escapeFunc;
let _isAfter = validator.isAfter;
_isAfter = isAfterFunc;
let _isAlpha = validator.isAlpha;
_isAlpha = isAlphaFunc;
let _isAlphanumeric = validator.isAlphanumeric;
_isAlphanumeric = isAlphanumericFunc;
let _isAscii = validator.isAscii;
_isAscii = isAsciiFunc;
let _isBase64 = validator.isBase64;
_isBase64 = isBase64Func;
let _isBefore = validator.isBefore;
_isBefore = isBeforeFunc;
let _isBoolean = validator.isBoolean;
_isBoolean = isBooleanFunc;
let _isByteLength = validator.isByteLength;
_isByteLength = isByteLengthFunc;
let _isCreditCard = validator.isCreditCard;
_isCreditCard = isCreditCardFunc;
let _isCurrency = validator.isCurrency;
_isCurrency = isCurrencyFunc;
let _isDataURI = validator.isDataURI;
_isDataURI = isDataURIFunc;
let _isDate = validator.isDate;
_isDate = isDateFunc;
let _isDecimal = validator.isDecimal;
_isDecimal = isDecimalFunc;
let _isDivisibleBy = validator.isDivisibleBy;
_isDivisibleBy = isDivisibleByFunc;
let _isEmail = validator.isEmail;
_isEmail = isEmailFunc;
let _isFQDN = validator.isFQDN;
_isFQDN = isFQDNFunc;
let _isFloat = validator.isFloat;
_isFloat = isFloatFunc;
let _isFullWidth = validator.isFullWidth;
_isFullWidth = isFullWidthFunc;
let _isHalfWidth = validator.isHalfWidth;
_isHalfWidth = isHalfWidthFunc;
let _isHexColor = validator.isHexColor;
_isHexColor = isHexColorFunc;
let _isHexadecimal = validator.isHexadecimal;
_isHexadecimal = isHexadecimalFunc;
let _isIP = validator.isIP;
_isIP = isIPFunc;
let _isISBN = validator.isISBN;
_isISBN = isISBNFunc;
let _isISIN = validator.isISIN;
_isISIN = isISINFunc;
let _isISO8601 = validator.isISO8601;
_isISO8601 = isISO8601Func;
let _isIn = validator.isIn;
_isIn = isInFunc;
let _isInt = validator.isInt;
_isInt = isIntFunc;
let _isJSON = validator.isJSON;
_isJSON = isJSONFunc;
let _isLength = validator.isLength;
_isLength = isLengthFunc;
let _isLowercase = validator.isLowercase;
_isLowercase = isLowercaseFunc;
let _isMACAddress = validator.isMACAddress;
_isMACAddress = isMACAddressFunc;
let _isMD5 = validator.isMD5;
_isMD5 = isMD5Func;
let _isMobilePhone = validator.isMobilePhone;
_isMobilePhone = isMobilePhoneFunc;
let _isMongoId = validator.isMongoId;
_isMongoId = isMongoIdFunc;
let _isMultibyte = validator.isMultibyte;
_isMultibyte = isMultibyteFunc;
let _isNull = validator.isNull;
_isNull = isNullFunc;
let _isNumeric = validator.isNumeric;
_isNumeric = isNumericFunc;
let _isSurrogatePair = validator.isSurrogatePair;
_isSurrogatePair = isSurrogatePairFunc;
let _isURL = validator.isURL;
_isURL = isURLFunc;
let _isUUID = validator.isUUID;
_isUUID = isUUIDFunc;
let _isUppercase = validator.isUppercase;
_isUppercase = isUppercaseFunc;
let _isVariableWidth = validator.isVariableWidth;
_isVariableWidth = isVariableWidthFunc;
let _isWhitelisted = validator.isWhitelisted;
_isWhitelisted = isWhitelistedFunc;
let _ltrim = validator.ltrim;
_ltrim = ltrimFunc;
let _matches = validator.matches;
_matches = matchesFunc;
let _normalizeEmail = validator.normalizeEmail;
_normalizeEmail = normalizeEmailFunc;
let _rtrim = validator.rtrim;
_rtrim = rtrimFunc;
let _stripLow = validator.stripLow;
_stripLow = stripLowFunc;
let _toBoolean = validator.toBoolean;
_toBoolean = toBooleanFunc;
let _toDate = validator.toDate;
_toDate = toDateFunc;
let _toFloat = validator.toFloat;
_toFloat = toFloatFunc;
let _toInt = validator.toInt;
_toInt = toIntFunc;
let _trim = validator.trim;
_trim = trimFunc;
let _unescape = validator.unescape;
_unescape = unescapeFunc;
let _whitelist = validator.whitelist;
_whitelist = whitelistFunc;
}
/************************************************
* *
* API TESTS *
* *
************************************************/
let any: any;
// **************
@@ -299,6 +551,16 @@ let any: any;
result = validator.whitelist('sample', 'abc');
}
{
let str: string;
str = validator.toString([123, 456, '123', '456', true, false]);
}
{
let ver: string;
ver = validator.version;
}
// **************
// * Extensions *
// **************

View File

@@ -213,6 +213,10 @@ declare namespace ValidatorJS {
// remove characters that do not appear in the whitelist. The characters are used in a RegExp and so you will
// need to escape some chars, e.g. whitelist(input, '\\[\\]').
whitelist(input: string, chars: string): string;
toString(input: any | any[]): string;
version: string;
// **************
// * Extensions *

2
vue/vue.d.ts vendored
View File

@@ -96,7 +96,7 @@ declare namespace vuejs {
detached?(): void;
beforeDestroy?(): void;
destroyed?(): void;
activate?(callback: Function): void;
activate?: (done: () => void) => void;
directives?: { [key: string]: (DirectiveOption | Function) };
elementDirectives?: { [key: string]: (DirectiveOption | Function) };
filters?: { [key: string]: (Function | FilterOption) };

View File

@@ -0,0 +1,678 @@
/// <reference path="weapp-api.d.ts" />
App({
onLaunch: function () {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync('logs') as Array<any> || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
},
getUserInfo: function (cb: Function) {
var that = this;
if (this.globalData.userInfo) {
typeof cb == "function" && cb(this.globalData.userInfo)
} else {
//调用登录接口
wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo;
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
}
});
}
},
globalData: {
userInfo: null
}
})
let app = getApp();
let page = app.getCurrentPage();
page.setData({ 'foo': 'bar' });
Page({
data: {
foo: 'bar'
},
onLoad: function (options) {
console.log(options.title);
}
})
wx.request({
url: 'test.php',
data: {
x: '',
y: ''
},
header: {
'Content-Type': 'application/json'
},
success: function (res) {
console.log(res.data)
}
})
wx.chooseImage({
success: function (res) {
var tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: 'http://example.com/upload',
filePath: tempFilePaths[0],
name: 'file',
formData: {
'user': 'test'
}
})
}
})
wx.downloadFile({
url: 'http://example.com/audio/123',
type: 'audio',
success: function (res) {
wx.playVoice({
filePath: res.tempFilePath
})
}
})
wx.connectSocket({
url: 'test.php',
data: {
x: '',
y: ''
},
header: {
'content-type': 'application/json'
},
method: "GET",
})
wx.connectSocket({
url: 'test.php'
})
wx.onSocketOpen(function (res) {
console.log('WebSocket连接已打开')
})
wx.connectSocket({
url: 'test.php'
})
wx.onSocketOpen(function (res) {
console.log('WebSocket连接已打开')
})
wx.onSocketError(function (res) {
console.log('WebSocket连接打开失败请检查')
})
var socketOpen = false
var socketMsgQueue: Array<string> = []
wx.connectSocket({
url: 'test.php'
})
wx.onSocketOpen(function (res) {
socketOpen = true
for (var i = 0; i < socketMsgQueue.length; i++) {
sendSocketMessage(socketMsgQueue[i])
}
socketMsgQueue = []
})
function sendSocketMessage(msg: string) {
if (socketOpen) {
wx.sendSocketMessage({
data: msg
})
} else {
socketMsgQueue.push(msg)
}
}
wx.connectSocket({
url: 'test.php'
})
wx.onSocketMessage(function (res) {
console.log('收到服务器内容:' + res.data)
})
wx.connectSocket({
url: 'test.php'
})
//注意这里有时序问题,
//如果 wx.connectSocket 还没回调 wx.onSocketOpen而先调用 wx.closeSocket那么就做不到关闭 WebSocket 的目的。
//必须在 WebSocket 打开期间调用 wx.closeSocket 才能关闭。
wx.onSocketOpen(function () {
wx.closeSocket()
})
wx.onSocketClose(function (res) {
console.log('WebSocket 已关闭!')
})
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
// 返回选定照片的本地文件路径列表tempFilePath可以作为img标签的src属性显示图片
var tempFilePaths = res.tempFilePaths
}
})
wx.previewImage({
current: '', // 当前显示图片的http链接
urls: [] // 需要预览的图片http链接列表
})
wx.startRecord({
success: function (res) {
var tempFilePath = res.tempFilePath
},
fail: function (res) {
//录音失败
}
})
setTimeout(function () {
//结束录音
wx.stopRecord()
}, 10000)
wx.startRecord({
success: function (res) {
var tempFilePath = res.tempFilePath
wx.playVoice({
filePath: tempFilePath,
complete: function () {
}
})
}
})
wx.startRecord({
success: function (res) {
var tempFilePath = res.tempFilePath
wx.playVoice({
filePath: tempFilePath
})
setTimeout(function () {
//暂停播放
wx.pauseVoice()
}, 5000)
}
})
wx.startRecord({
success: function (res) {
var tempFilePath = res.tempFilePath
wx.playVoice({
filePath: tempFilePath
})
setTimeout(function () {
wx.stopVoice()
}, 5000)
}
})
wx.getBackgroundAudioPlayerState({
success: function (res) {
var status = res.status
var dataUrl = res.dataUrl
var currentPosition = res.currentPosition
var duration = res.duration
var downloadPercent = res.downloadPercent
}
})
wx.playBackgroundAudio({
dataUrl: '',
title: '',
coverImgUrl: ''
})
wx.pauseBackgroundAudio()
wx.seekBackgroundAudio({
position: 30
})
wx.stopBackgroundAudio()
wx.startRecord({
success: function (res) {
var tempFilePath = res.tempFilePath
wx.saveFile({
tempFilePath: tempFilePath,
success: function (res) {
var savedFilePath = res.savedFilePath
}
})
}
})
Page({
bindButtonTap: function () {
var that = this
wx.chooseVideo({
sourceType: ['album', 'camera'],
maxDuration: 60,
camera: ['front', 'back'],
success: function (res) {
that.setData({
src: res.tempFilePath
})
}
})
}
})
wx.setStorage({
key: "key",
data: "value"
})
try {
wx.setStorageSync('key', 'value')
} catch (e) {
}
wx.getStorage({
key: 'key',
success: function (res) {
console.log(res.data)
}
})
var value = wx.getStorageSync('key')
if (value) {
// Do something with return value
}
wx.clearStorage()
try {
wx.clearStorageSync()
} catch (e) {
}
wx.getLocation({
type: 'wgs84',
success: function (res) {
var latitude = res.latitude
var longitude = res.longitude
var speed = res.speed
var accuracy = res.accuracy
}
})
wx.getLocation({
type: 'gcj02', //返回可以用于wx.openLocation的经纬度
success: function(res) {
var latitude = res.latitude
var longitude = res.longitude
wx.openLocation({
latitude: latitude,
longitude: longitude,
scale: 28
})
}
})
wx.getNetworkType({
success: function(res) {
var networkType = res.networkType // 返回网络类型2g3g4gwifi
}
})
wx.getSystemInfo({
success: function(res) {
console.log(res.model)
console.log(res.pixelRatio)
console.log(res.windowWidth)
console.log(res.windowHeight)
console.log(res.language)
console.log(res.version)
}
})
wx.onAccelerometerChange(function(res) {
console.log(res.x)
console.log(res.y)
console.log(res.z)
})
wx.onCompassChange(function (res) {
console.log(res.direction)
})
wx.setNavigationBarTitle({
title: '当前页面'
})
wx.navigateTo({
url: 'test?id=1'
})
wx.redirectTo({
url: 'test?id=1'
})
var animation = wx.createAnimation({
transformOrigin: "50% 50%",
duration: 1000,
timingFunction: "ease",
delay: 0
})
Page({
data: {
animationData: {}
},
onShow: function(){
var animation = wx.createAnimation({
duration: 1000,
timingFunction: 'ease',
})
this.animation = animation
animation.scale(2,2).rotate(45).step()
this.setData({
animationData:animation.export()
})
setTimeout(function() {
animation.translate(30).step()
this.setData({
animationData:animation.export()
})
}.bind(this), 1000)
},
rotateAndScale: function () {
// 旋转同时放大
this.animation.rotate(45).scale(2, 2).step()
this.setData({
animationData:animation.export()
})
},
rotateThenScale: function () {
// 先旋转后放大
this.animation.rotate(45).step()
this.animation.scale(2, 2).step()
this.setData({
animationData:animation.export()
})
},
rotateAndScaleThenTranslate: function () {
// 先旋转同时放大,然后平移
this.animation.rotate(45).scale(2, 2).step()
this.animation.translate(100, 100).step({ duration: 1000 })
this.setData({
animationData:animation.export()
})
}
})
// 假设页面上有3个画布
var canvas1Id = 3001
var canvas2Id = 3002
var canvas3Id = 3003
var context = wx.createContext();
[canvas1Id, canvas2Id, canvas3Id].forEach(function (id) {
context.clearActions()
// 在context上调用方法
wx.drawCanvas({
canvasId: id,
actions: context.getActions()
})
})
Page({
onReady: function() {
var context = wx.createContext()
context.rect(5, 5, 25, 15)
context.stroke()
context.scale(2, 2) //再放大2倍
context.rect(5, 5, 25, 15)
context.stroke()
context.scale(2, 2) //再放大2倍
context.rect(5, 5, 25, 15)
context.stroke()
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
})
}
})
Page({
onReady: function() {
var context = wx.createContext()
context.rect(50, 50, 200, 200)
context.stroke()
context.rotate(5 * Math.PI / 180)
context.rect(50, 50, 200, 200)
context.stroke()
context.rotate(5 * Math.PI / 180)
context.rect(50, 50, 200, 200)
context.stroke()
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
})
}
})
Page({
onReady: function() {
var context = wx.createContext()
context.rect(50, 50, 200, 200)
context.stroke()
context.translate(50, 50)
context.rect(50, 50, 200, 200)
context.stroke()
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
})
}
})
Page({
onReady: function() {
var context = wx.createContext()
context.rect(50, 50, 200, 200)
context.fill()
context.clearRect(100, 100, 50, 50)
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
})
}
})
Page({
onReady: function() {
var context = wx.createContext()
wx.chooseImage({
success: function(res) {
context.drawImage(res.tempFilePaths[0], 0, 0)
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
})
}
})
}
})
Page({
onReady:function(){
var context = wx.createContext()
context.setFontSize(14)
context.fillText("MINA", 50, 50)
context.moveTo(0, 50)
context.lineTo(100, 50)
context.stroke()
context.setFontSize(20)
context.fillText("MINA", 100, 100)
context.moveTo(0, 100)
context.lineTo(200, 100)
context.stroke()
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
});
}
})
Page({
onReady: function() {
var context = wx.createContext()
context.setFillStyle("#ff00ff")
context.setStrokeStyle("#00ffff")
context.rect(50, 50, 100, 100)
context.fill()
context.stroke()
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
});
}
})
Page({
onReady: function() {
var context = wx.createContext()
context.setLineWidth(10)
context.setLineCap("round")
context.setLineJoin("miter")
context.setMiterLimit(10)
context.moveTo(20, 20)
context.lineTo(150, 27)
context.lineTo(20, 54)
context.stroke()
context.beginPath()
context.setMiterLimit(3)
context.moveTo(20, 70)
context.lineTo(150, 77)
context.lineTo(20, 104)
context.stroke()
wx.drawCanvas({
canvasId: 1,
actions: context.getActions()
});
}
})
Page({
canvasIdErrorCallback: function (e:any) {
console.error(e.detail.errMsg)
},
onReady: function() {
//使用wx.createContext获取绘图上下文context
var context = wx.createContext()
context.setStrokeStyle("#00ff00")
context.setLineWidth(5)
context.rect(0, 0, 200, 200)
context.stroke()
context.setStrokeStyle("#ff0000")
context.setLineWidth(2)
context.moveTo(160, 100)
context.arc(100, 100, 60, 0,2 * Math.PI, true)
context.moveTo(140, 100)
context.arc(100, 100, 40, 0, Math.PI, false)
context.moveTo(85, 80)
context.arc(80, 80, 5, 0,2 * Math.PI, true)
context.moveTo(125, 80)
context.arc(120, 80, 5, 0, 2 * Math.PI, true)
context.stroke()
// 调用 wx.drawCanvas通过 canvasId 指定在哪张画布上绘制,通过 actions 指定绘制行为
wx.drawCanvas({
canvasId: 'firstCanvas',
actions: context.getActions() // 获取绘图动作数组
})
}
})
App({
onLaunch: function() {
wx.login({
success: function(res) {
if (res.code) {
//发起网络请求
wx.request({
url: 'https://test.com/onLogin',
data: {
code: res.code
}
})
} else {
console.log('获取用户登录态失败!' + res.errMsg)
}
}
});
}
})
wx.getUserInfo({
success: function(res) {
var userInfo = res.userInfo
var nickName = userInfo.nickName
var avatarUrl = userInfo.avatarUrl
var gender = userInfo.gender //性别 0未知、1男、2
var province = userInfo.province
var city = userInfo.city
var country = userInfo.country
}
})
wx.requestPayment({
'timeStamp': '',
'nonceStr': '',
'package': '',
'signType': 'MD5',
'paySign': '',
'success':function(res){
},
'fail':function(res){
}
})

1135
weapp-api/weapp-api.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -404,7 +404,7 @@ declare module "webpack" {
}
interface HotModuleReplacementPluginStatic {
new(): Plugin;
new(options?: any): Plugin;
}
interface ExtendedAPIPluginStatic {

View File

@@ -66,7 +66,7 @@ var WebSocketServer = WebSocket.Server;
info: {
origin: string
secure: boolean
req: http.ServerRequest
req: http.IncomingMessage
}
, callback: (res: boolean) => void
): void {