Merge branch 'master' into react-native-snap-carousel-patch-1

This commit is contained in:
Guillaume AMAT 2018-08-26 18:12:02 +02:00 committed by GitHub
commit 36feacaa19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
298 changed files with 14675 additions and 7950 deletions

6
.github/CODEOWNERS vendored
View File

@ -3576,8 +3576,8 @@
/types/react-native-vector-icons/ @iRoachie @timwangdev
/types/react-native-version-number/ @VincentLanglet
/types/react-native-video/ @huhuanming
/types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @robertohuertasm @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi
/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @robertohuertasm @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi
/types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi
/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi
/types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar
/types/react-notification-system-redux/ @LKay
/types/react-notify-toast/ @klaascuvelier
@ -4557,7 +4557,7 @@
/types/webvr-api/ @efokschaner
/types/week/ @sindrenm
/types/weighted/ @ccitro
/types/weixin-app/ @taoqf @AlexStacker
/types/weixin-app/ @taoqf @AlexStacker @Jimexist
/types/wellknown/ @yairtawil
/types/wepy/ @Jimexist
/types/wepy-redux/ @Jimexist

View File

@ -156,12 +156,6 @@
"sourceRepoURL": "https://github.com/brianloveswords/base64url",
"asOfVersion": "2.0.0"
},
{
"libraryName": "better-scroll",
"typingsPackageName": "better-scroll",
"sourceRepoURL": "https://github.com/ustbhuangyi/better-scroll",
"asOfVersion": "1.5.0"
},
{
"libraryName": "BigInteger.js",
"typingsPackageName": "big-integer",

View File

@ -1776,6 +1776,14 @@ declare namespace algoliasearch {
facets?: {
[facetName: string]: { [facetValue: string]: number };
};
facets_stats?: {
[facetName: string]: {
avg: number,
max: number,
min: number,
sum: number,
};
};
}
interface MultiResponse {

View File

@ -4,6 +4,7 @@
// Haroen Viaene <https://github.com/haroenv>
// Aurélien Hervé <https://github.com/aherve>
// Samuel Vaillant <https://github.com/samouss>
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@ -570,6 +571,14 @@ declare namespace algoliasearch {
facets?: {
[facetName: string]: { [facetValue: string]: number };
};
facets_stats?: {
[facetName: string]: {
avg: number,
max: number,
min: number,
sum: number,
};
};
}
interface MultiResponse {

View File

@ -0,0 +1,34 @@
interface MyService {
getFirstname(): ng.IPromise<string>;
getLastname(): ng.IPromise<string>;
}
function TestCtrl($q: ng.IQService, MyService: MyService) {
function arrayCallback(result: [ng.PromiseValue<string>, ng.PromiseValue<string>]) {
const firstnameOk: boolean = $q.isFulfilledState(result[0]);
const lastnameOk: boolean = $q.isFulfilledState(result[1]);
}
function objectCallback(result: {firstname: ng.PromiseValue<string>, lastname: ng.PromiseValue<string>}) {
const firstnameOk: boolean = $q.isFulfilledState(result.firstname);
const lastnameOk: boolean = $q.isFulfilledState(result.lastname);
}
$q
.allSettled([
MyService.getFirstname(),
MyService.getLastname()
])
.then(arrayCallback);
$q
.allSettled({
firstname: MyService.getFirstname(),
lastname: MyService.getLastname()
})
.then(objectCallback);
}
TestCtrl.$inject = ['$q', 'MyService'];
angular.module('test').controller('TestCtrl', TestCtrl);

42
types/angular-q-extras/index.d.ts vendored Normal file
View File

@ -0,0 +1,42 @@
// Type definitions for angular-q-extras 1.1
// Project: https://github.com/niqdev/angular-q-extras
// Definitions by: Damien Sorel <https://github.com/mistic100>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare var _: string;
export = _;
import * as angular from 'angular';
declare module 'angular' {
type PromiseState = 'fulfilled' | 'rejected';
interface PromiseValue<T> {
state: PromiseState;
value?: T;
reason?: any;
}
// tslint:disable-next-line interface-name
interface IQService {
// tslint:disable:max-line-length
allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>, T9 | IPromise<T9>, T10 | IPromise<T10>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>, PromiseValue<T8>, PromiseValue<T9>, PromiseValue<T10>]>;
allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>, T9 | IPromise<T9>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>, PromiseValue<T8>, PromiseValue<T9>]>;
allSettled<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>, PromiseValue<T8>]>;
allSettled<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>]>;
allSettled<T1, T2, T3, T4, T5, T6>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>]>;
allSettled<T1, T2, T3, T4, T5>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>]>;
allSettled<T1, T2, T3, T4>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>]>;
allSettled<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>]>;
allSettled<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>]>;
// tslint:enable:max-line-length
allSettled<TAll>(promises: Array<TAll | IPromise<TAll>>): IPromise<Array<PromiseValue<TAll>>>;
allSettled<T>(promises: { [K in keyof T]: (T[K] | IPromise<T[K]>); }): IPromise<{ [K in keyof T]: PromiseValue<T[K]>; }>;
isFulfilledState(promise: PromiseValue<any>): boolean;
isRejectedState(promise: PromiseValue<any>): boolean;
}
}

View File

@ -0,0 +1,23 @@
{
"files": [
"index.d.ts",
"angular-q-extras-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@ -17,17 +17,24 @@ const config: Microsoft.ApplicationInsights.IConfig = {
autoTrackPageVisitTime: true,
disableExceptionTracking: false,
disableAjaxTracking: false,
disableFetchTracking: true,
overridePageViewDuration: false,
maxAjaxCallsPerView: -1,
disableDataLossAnalysis: true,
disableCorrelationHeaders: true,
correlationHeaderExcludedDomains: [],
disableFlushOnBeforeUnload: false,
enableSessionStorageBuffer: false,
cookieDomain: "",
isCookieUseDisabled: true,
isRetryDisabled: true,
isPerfAnalyzerEnabled: true,
isStorageUseDisabled: true
url: "url",
isStorageUseDisabled: true,
isBeaconApiDisabled: false,
sdkExtension: "sdkExtension",
isBrowserLinkTrackingEnabled: false,
appId: "appId",
enableCorsCorrelation: false
};
appInsights = {
@ -175,3 +182,8 @@ const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", nu
const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
context.track(traceEnvelope);
// UtilHelpers
let Util: typeof Microsoft.ApplicationInsights.UtilHelpers;
Util.newId();

View File

@ -1,6 +1,7 @@
// Type definitions for ApplicationInsights-JS 1.0
// Project: https://github.com/Microsoft/ApplicationInsights-JS
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
// Mark Wolff <https://github.com/markwolff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module AI {
@ -560,19 +561,24 @@ declare module Microsoft.ApplicationInsights {
samplingPercentage?: number;
autoTrackPageVisitTime?: boolean;
disableAjaxTracking?: boolean;
disableFetchTracking?: boolean;
overridePageViewDuration?: boolean;
maxAjaxCallsPerView?: number;
disableDataLossAnalysis?: boolean;
disableCorrelationHeaders?: boolean;
correlationHeaderExcludedDomains?: string[];
disableFlushOnBeforeUnload?: boolean;
enableSessionStorageBuffer?: boolean;
isCookieUseDisabled?: boolean;
cookieDomain?: string;
isRetryDisabled?: boolean;
isPerfAnalyzerEnabled?: boolean;
url?: string;
isStorageUseDisabled?: boolean;
isBeaconApiDisabled?: boolean;
sdkExtension?: string;
isBrowserLinkTrackingEnabled?: boolean;
appId?: string;
enableCorsCorrelation?: boolean;
}
/**
@ -793,10 +799,18 @@ declare module Microsoft.ApplicationInsights {
*/
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
}
class UtilHelpers {
/**
* Generate a random ID string
*/
static newId(): string;
}
}
declare module 'applicationinsights-js' {
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
const Util: typeof Microsoft.ApplicationInsights.UtilHelpers;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;

View File

@ -0,0 +1,68 @@
import BScroll from 'better-scroll';
const BScroll1 = new BScroll('#wrapper');
const BScroll2 = new BScroll('#wrapper', { scrollX: false, scrollY: false });
const BScroll3 = new BScroll('#wrapper', {
snap: true,
wheel: false,
scrollbar: false,
pullDownRefresh: false,
});
const BScroll4 = new BScroll('#wrapper', {
wheel: {
selectedIndex: 0,
},
});
const BScroll6 = new BScroll('#wrapper', {
snap: {
loop: false,
el: document.querySelector('div-test') as Element,
threshold: 0.1,
stepX: 100,
stepY: 100,
listenFlick: true,
},
});
const BScroll7 = new BScroll('#wrapper', {
scrollbar: {
fade: true,
},
});
const BScroll8 = new BScroll('#wrapper', {
pullDownRefresh: {
threshold: 50,
stop: 20,
},
});
BScroll1.refresh();
BScroll1.scrollTo(0, 100);
BScroll1.scrollTo(0, 100, 200);
BScroll1.scrollToElement('selectedElement');
BScroll1.scrollToElement('selectedElement', 250);
BScroll1.scrollToElement(document.getElementById('selectedElement') as HTMLElement);
BScroll1.scrollToElement(document.getElementById('selectedElement') as HTMLElement, 250);
BScroll2.on('scrollStart', () => { console.log('scroll started'); });
const BScroll9 = new BScroll(document.getElementById('wrapper') as HTMLElement);
const BScroll10 = new BScroll(document.getElementById('wrapper') as HTMLElement, { freeScroll: true });
const BScroll11 = new BScroll(document.getElementById('wrapper') as HTMLElement, {
preventDefaultException: {
tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/,
},
});
const BScroll12 = new BScroll(document.getElementById('wrapper') as HTMLElement, {
preventDefaultException: {
className: /(^|\s)test(\s|$)/,
},
});
const BScroll13 = new BScroll(document.getElementById('wrapper') as HTMLElement, {
swipeBounceTime: 1000,
});
const BScroll14 = new BScroll('#wrapper', { disableMouse: true, disableTouch: false });

238
types/better-scroll/index.d.ts vendored Normal file
View File

@ -0,0 +1,238 @@
// Type definitions for better-scroll 1.12
// Project: https://github.com/ustbhuangyi/better-scroll
// Definitions by: cloudstone <https://github.com/stoneChen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export interface WheelOption {
selectedIndex: number;
rotate: number;
adjustTime: number;
wheelWrapperClass: string;
wheelItemClass: string;
}
export interface PageOption {
x: number;
y: number;
pageX: number;
pageY: number;
}
export interface SlideOption {
loop: boolean;
el: Element;
threshold: number;
stepX: number;
stepY: number;
speed: number;
listenFlick: boolean;
}
export interface ScrollBarOption {
fade: boolean;
}
export interface PullDownOption {
threshold: number;
stop: number;
}
export interface PullUpOption {
threshold: number;
}
export interface BounceObjectOption {
top?: boolean;
bottom?: boolean;
left?: boolean;
right?: boolean;
}
export interface EaseOption {
swipe?: {
style: string;
fn: (t: number) => number;
};
swipeBounce?: {
style: string;
fn: (t: number) => number;
};
bounce?: {
style: string;
fn: (t: number) => number;
};
}
export interface BsOption {
startX: number;
startY: number;
scrollX: boolean;
scrollY: boolean;
freeScroll: boolean;
directionLockThreshold: number;
eventPassthrough: string | boolean;
click: boolean;
tap: boolean;
bounce: boolean | BounceObjectOption;
bounceTime: number;
momentum: boolean;
momentumLimitTime: number;
momentumLimitDistance: number;
swipeTime: number;
swipeBounceTime: number;
deceleration: number;
flickLimitTime: number;
flickLimitDistance: number;
resizePolling: number;
probeType: number;
preventDefault: boolean;
preventDefaultException: object;
HWCompositing: boolean;
useTransition: boolean;
useTransform: boolean;
bindToWrapper: boolean;
disableMouse: boolean;
disableTouch: boolean;
observeDOM: boolean;
autoBlur: boolean;
stopPropagation: boolean;
/**
* for picker
* wheel: {
* selectedIndex: 0,
* rotate: 25,
* adjustTime: 400
* }
*/
wheel: Partial<WheelOption> | boolean;
/**
* for slide
* snap: {
* loop: boolean,
* el: domEl,
* threshold: 0.1,
* stepX: 100,
* stepY: 100,
* listenFlick: true
* }
*/
snap: Partial<SlideOption> | boolean;
/**
* for scrollbar
* scrollbar: {
* fade: true
* }
*/
scrollbar: Partial<ScrollBarOption> | boolean;
/**
* for pull down and refresh
* pullDownRefresh: {
* threshold: 50,
* stop: 20
* }
*/
pullDownRefresh: Partial<PullDownOption> | boolean;
/**
* for pull up and load
* pullUpLoad: {
* threshold: 50
* }
*/
pullUpLoad: Partial<PullUpOption> | boolean;
}
export interface Position {
x: number;
y: number;
}
export default class BScroll {
constructor(element: Element | string, options?: Partial<BsOption>);
x: number;
y: number;
maxScrollX: number;
maxScrollY: number;
movingDirectionX: number;
movingDirectionY: number;
directionX: number;
directionY: number;
enabled: boolean;
isInTransition: boolean;
isAnimating: boolean;
options: BsOption;
refresh(): void;
enable(): void;
disable(): void;
scrollBy(x: number, y: number, time?: number, easing?: object): void;
scrollTo(x: number, y: number, time?: number, easing?: object): void;
scrollToElement(el: HTMLElement | string, time?: number, offsetX?: number | boolean, offsetY?: number | boolean, easing?: object): void;
stop(): void;
destroy(): void;
goToPage(x: number, y: number, time?: number, easing?: object): void;
next(time?: number, easing?: object): void;
prev(time?: number, easing?: object): void;
getCurrentPage(): PageOption;
wheelTo(index: number): void;
getSelectedIndex(): number;
finishPullDown(): void;
finishPullUp(): void;
on(
type:
'beforeScrollStart' |
'scrollStart' |
'scrollCancel' |
'beforeScrollStart' |
'flick' |
'refresh' |
'destroy' |
'pullingDown' |
'pullingUp',
fn: () => any
): void;
on(
type:
'scroll' |
'scrollEnd' |
'touchEnd',
fn: (pos: Position) => any
): void;
off(
type:
'beforeScrollStart' |
'scrollStart' |
'scroll' |
'scrollCancel' |
'beforeScrollStart' |
'scrollEnd' |
'touchEnd' |
'flick' |
'refresh' |
'destroy' |
'pullingDown' |
'pullingUp',
fn: (...args: any[]) => void
): void;
trigger(type: string): void;
}

View File

@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"better-scroll-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -9,6 +9,7 @@
// David Koblas <https://github.com/koblas>
// Bond Akinmade <https://github.com/bondz>
// Wuha Team <https://github.com/wuha-team>
// Alec Brunelle <https://github.com/aleccool213>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

View File

@ -54,6 +54,24 @@ declare module "bull" {
* since pubsub does not give any guarantees.
*/
finished(): Promise<void>;
/**
* Moves a job to the `completed` queue. Pulls a job from 'waiting' to
* 'active' and returns a tuple containing the next jobs data and id. If no
* job is in the `waiting` queue, returns null.
* @param returnValue The jobs success message.
* @param ignoreLock True when wanting to ignore the redis lock on this job.
* @returns Contains the next jobs data and id or null if job left in 'waiting' queue.
*/
moveToCompleted(returnValue: string, ignoreLock: boolean): Promise<string[] | null>;
/**
* Moves a job to the failed queue.
* @param errorInfo The jobs error message.
* @param ignoreLock True when wanting to ignore the redis lock on this job.
* @returns void
*/
moveToFailed(errorInfo: ErrorMessage, ignoreLock: boolean): Promise<void>;
}
export interface Backoff {
@ -204,7 +222,7 @@ declare module "bull" {
* Returns a promise that will return the job instance associated with the jobId parameter.
* If the specified job cannot be located, the promise callback parameter will be set to null.
*/
getJob(jobId: string): Promise<Job>;
getJob(jobId: string): Promise<Job | null>;
/**
* Tells the queue remove all jobs created outside of a grace period in milliseconds.
@ -217,6 +235,18 @@ declare module "bull" {
* 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned'
*/
on(eventName: string, callback: EventCallback): void;
/**
* Moves the next job from 'waiting' to 'active'.
* Sets the processedOn timestamp to the current datetime.
* @param jobId If specified, will move a specific job from 'waiting' to 'active',
* @returns Returns the job moved from waiting to active queue.
*/
getNextJob:(jobId?: string) => Promise<Job | null>;
}
interface ErrorMessage {
message: string;
}
interface EventCallback {

View File

@ -214,6 +214,7 @@ interface CheerioOptionsInterface {
recognizeCDATA?: boolean;
recognizeSelfClosing?: boolean;
normalizeWhitespace?: boolean;
ignoreWhitespace?: boolean;
}
interface CheerioSelector {

View File

@ -1,7 +1,7 @@
import * as ddTrace from 'dd-trace';
import * as tracer from 'dd-trace';
import SpanContext = require('dd-trace/src/opentracing/span_context');
const tracer = ddTrace.init({
tracer.init({
service: 'MyLovelyService',
hostname: 'localhost',
port: 8126,
@ -14,7 +14,7 @@ const tracer = ddTrace.init({
tracer
.trace('web.request', {
service: 'my_service',
childOf: new SpanContext({ traceId: 1337, spanId: 42 }),
childOf: new SpanContext({ traceId: 1337, spanId: 42 }), // Childof must be an instance of this type. See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
tags: {
env: 'dev'
}
@ -23,3 +23,13 @@ tracer
span.setTag('my_tag', 'my_value');
span.finish();
});
const parentScope = tracer.scopeManager().active();
const span = tracer.startSpan('memcached', {
childOf: parentScope && parentScope.span(),
tags: {
'service.name': 'my-memcached',
'resource.name': 'get',
'span.type': 'memcached',
},
});

View File

@ -1,11 +1,11 @@
// Type definitions for dd-trace-js 0.2
// Type definitions for dd-trace-js 0.5
// Project: https://github.com/DataDog/dd-trace-js
// Definitions by: Colin Bradley <https://github.com/ColinBradley>
// Eloy Durán <https://github.com/alloy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Tracer = require('./src/opentracing/tracer');
import Span = require('./src/opentracing/span');
import SpanContext = require('./src/opentracing/span_context');
import { Tracer, Span, SpanContext } from "opentracing";
import DatadogSpanContext = require('./src/opentracing/span_context');
declare var trace: TraceProxy;
export = trace;
@ -42,6 +42,11 @@ declare class TraceProxy extends Tracer {
* @returns The current span or null if outside a trace context.
*/
currentSpan(): Span | null;
/**
* Get the scope manager to manager context propagation for the tracer.
*/
scopeManager(): ScopeManager;
}
interface TracerOptions {
@ -139,11 +144,44 @@ interface TraceOptions {
/**
* The parent span or span context for the new span. Generally this is not needed as it will be
* fetched from the current context.
* If creating your own, this must be an instance of DatadogSpanContext from ./src/opentracing/span_context
* See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
*/
childOf?: Span | SpanContext;
childOf?: Span | SpanContext | DatadogSpanContext;
/**
* Global tags that should be assigned to every span.
*/
tags?: { [key: string]: any } | string;
}
declare class ScopeManager {
/**
* Get the current active scope or null if there is none.
*
* @todo The dd-trace source returns null, but opentracing's childOf span
* option is typed as taking undefined or a scope, so using undefined
* here instead.
*/
active(): Scope | undefined;
/**
* Activate a new scope wrapping the provided span.
*
* @param span The span for which to activate the new scope.
* @param finishSpanOnClose Whether to automatically finish the span when the scope is closed.
*/
activate(span: Span, finishSpanOnClose?: boolean): Scope;
}
declare class Scope {
/**
* Get the span wrapped by this scope.
*/
span(): Span;
/**
* Close the scope, and finish the span if the scope was created with `finishSpanOnClose` set to true.
*/
close(): void;
}

View File

@ -1,121 +0,0 @@
import Tracer = require('./tracer');
import SpanContext = require('./span_context');
import { Span } from 'opentracing';
declare class DatadogSpan extends Span {
/**
* Returns the SpanContext object associated with this Span.
*/
context(): SpanContext;
/**
* Returns the Tracer object used to create this Span.
*/
tracer(): Tracer;
/**
* Sets the string name for the logical operation this span represents.
*/
setOperationName(name: string): this;
/**
* Sets a key:value pair on this Span that also propagates to future
* children of the associated Span.
*
* setBaggageItem() enables powerful functionality given a full-stack
* opentracing integration (e.g., arbitrary application data from a web
* client can make it, transparently, all the way into the depths of a
* storage system), and with it some powerful costs: use this feature with
* care.
*
* IMPORTANT NOTE #1: setBaggageItem() will only propagate baggage items to
* *future* causal descendants of the associated Span.
*
* IMPORTANT NOTE #2: Use this thoughtfully and with care. Every key and
* value is copied into every local *and remote* child of the associated
* Span, and that can add up to a lot of network and cpu overhead.
*/
setBaggageItem(key: string, value: string): this;
/**
* Returns the value for a baggage item given its key.
*
* @param key
* The key for the given trace attribute.
* @return String value for the given key, or undefined if the key does not
* correspond to a set trace attribute.
*/
getBaggageItem(key: string): string | undefined;
/**
* Adds a single tag to the span. See `addTags()` for details.
*/
setTag(key: string, value: any): this;
/**
* Adds the given key value pairs to the set of span tags.
*
* Multiple calls to addTags() results in the tags being the superset of
* all calls.
*
* The behavior of setting the same key multiple times on the same span
* is undefined.
*
* The supported type of the values is implementation-dependent.
* Implementations are expected to safely handle all types of values but
* may choose to ignore unrecognized / unhandle-able values (e.g. objects
* with cyclic references, function objects).
*/
addTags(keyValueMap: {
[key: string]: any;
}): this;
/**
* Add a log record to this Span, optionally at a user-provided timestamp.
*
* For example:
*
* span.log({
* size: rpc.size(), // numeric value
* URI: rpc.URI(), // string value
* payload: rpc.payload(), // Object value
* "keys can be arbitrary strings": rpc.foo(),
* });
*
* span.log({
* "error.description": someError.description(),
* }, someError.timestampMillis());
*
* @param keyValuePairs
* An object mapping string keys to arbitrary value types. All
* Tracer implementations should support bool, string, and numeric
* value types, and some may also support Object values.
* @param timestamp
* An optional parameter specifying the timestamp in milliseconds
* since the Unix epoch. Fractional values are allowed so that
* timestamps with sub-millisecond accuracy can be represented. If
* not specified, the implementation is expected to use its notion
* of the current time of the call.
*/
log(keyValuePairs: {
[key: string]: any;
}, timestamp?: number): this;
/**
* Sets the end timestamp and finalizes Span state.
*
* With the exception of calls to Span.context() (which are always allowed),
* finish() must be the last call made to any span instance, and to do
* otherwise leads to undefined behavior.
*
* @param finishTime
* Optional finish time in milliseconds as a Unix timestamp. Decimal
* values are supported for timestamps with sub-millisecond accuracy.
* If not specified, the current time (as defined by the
* implementation) will be used.
*/
finish(finishTime?: number): void;
}
export = DatadogSpan;

View File

@ -1,40 +1,28 @@
import { SpanContext } from 'opentracing';
/**
* SpanContext represents Span state that must propagate to descendant Spans
* and across process boundaries.
*
* SpanContext is logically divided into two pieces: the user-level "Baggage"
* (see setBaggageItem and getBaggageItem) that propagates across Span
* boundaries and any Tracer-implementation-specific fields that are needed to
* identify or otherwise contextualize the associated Span instance (e.g., a
* <trace_id, span_id, sampled> tuple).
*/
declare class DatadogSpanContext extends SpanContext {
/**
* Use to create references to parent spans.
* Used to create references to parent spans.
* See: https://github.com/DataDog/dd-trace-js/blob/master/src/opentracing/tracer.js#L99
*/
constructor(props: SpanContextLike);
}
public traceId: number;
interface SpanContextLike {
traceId: number;
public spanId: number;
spanId: number;
public parentId?: number | null;
parentId?: number | null;
public sampled?: boolean;
sampled?: boolean;
public baggageItems?: { [key: string]: string };
baggageItems?: { [key: string]: string };
public trace?: {
trace?: {
started: number[],
finished: number[]
}
}
interface SpanContextLike {
traceId: number;
spanId: number;
}
export = DatadogSpanContext;

View File

@ -1,11 +0,0 @@
import { Tracer } from 'opentracing';
/**
* Tracer is the entry-point between the instrumentation API and the tracing
* implementation.
*/
declare class DatadogTracer extends Tracer {
}
export = DatadogTracer;

View File

@ -550,7 +550,7 @@ export interface DetectIntentResponse {
export interface QueryResult {
queryText: string;
laugnageCode: string;
languageCode: string;
speechRecognitionConfidence: number;
action: string;
parameters: any;
@ -760,8 +760,8 @@ export enum MatchMode {
}
export interface Credentials {
clientEmail?: string;
privateKey?: string;
client_email: string;
private_key: string;
}
export interface ClientOptions {

View File

@ -500,7 +500,7 @@ declare namespace echarts {
/**
* Chart height.
*/
heiight?: number | string,
height?: number | string,
/**
* Specify whether or not to prevent triggering events.

View File

@ -1,7 +1,8 @@
import {
describeComponent, describeModel, describeModule,
setResolver, setupAcceptanceTest, setupComponentTest,
setupModelTest, setupTest
setupModelTest, setupTest, setupRenderingTest,
setupApplicationTest
} from 'ember-mocha';
import { describe, it, beforeEach, afterEach, before, after } from 'mocha';
import chai = require('chai');
@ -96,8 +97,6 @@ describeModule('component:x-foo', 'TestModule callbacks', function() {
});
describe('setupTest', function() {
setupTest();
setupTest('service:ajax');
setupTest('service:ajax', {
@ -193,3 +192,62 @@ it('can calculate the result', function(assert) {
it.skip('disabled test');
it.skip('disabled test', function() { });
// New testing APIs of ember-mocha 0.14
describe('setupTest', function() {
setupTest();
setupTest({ resolver: Ember.DefaultResolver.create() });
const hooks = setupTest();
hooks.beforeEach(function() {
this.owner.lookup('service:foo');
});
hooks.afterEach(function() {
this.owner.factoryFor('service:foo');
});
setupRenderingTest();
setupRenderingTest({ resolver: Ember.DefaultResolver.create() });
const hooks2 = setupRenderingTest();
hooks2.beforeEach(function() {
this.owner.lookup('service:foo');
});
hooks2.afterEach(function() {
this.owner.factoryFor('service:foo');
});
setupApplicationTest();
setupApplicationTest({ resolver: Ember.DefaultResolver.create() });
const hooks3 = setupApplicationTest();
hooks3.beforeEach(function() {
this.owner.lookup('service:foo');
});
hooks3.afterEach(function() {
this.owner.factoryFor('service:foo');
});
it('test', function() {
});
});
describe('rendering test', function() {
setupRenderingTest();
it('renders', async function() {
// setup the outer context
this.set('value', 'cat');
// render the component
await this.render(hbs`{{ x-foo value=value}}`);
chai.expect(this.element.querySelector('div>.value').textContent.trim()).to.equal('cat', 'The component shows the correct value');
});
});

View File

@ -1,6 +1,7 @@
// Type definitions for ember-mocha 0.12
// Type definitions for ember-mocha 0.14
// Project: https://github.com/emberjs/ember-mocha#readme
// Definitions by: Derek Wickern <https://github.com/dwickern>
// Simon Ihmig <https://github.com/simonihmig>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@ -36,6 +37,17 @@ declare module 'ember-mocha' {
(callbacks: ModuleCallbacks): void;
}
interface TestHooks {
beforeEach: mochaBeforeEach;
afterEach: mochaAfterEach;
}
interface SetupOptions {
resolver: Ember.Resolver;
}
type NewSetupTest = (options?: SetupOptions) => TestHooks;
/** @deprecated Use setupTest instead */
export const describeModule: ContextDefinition;
@ -45,11 +57,14 @@ declare module 'ember-mocha' {
/** @deprecated Use setupModelTest instead */
export const describeModel: ContextDefinition;
export const setupTest: SetupTest;
export const setupTest: NewSetupTest & SetupTest;
export const setupAcceptanceTest: SetupTest;
export const setupComponentTest: SetupTest;
export const setupModelTest: SetupTest;
export const setupRenderingTest: NewSetupTest;
export const setupApplicationTest: NewSetupTest;
export const it: typeof mochaIt;
/**

View File

@ -52,7 +52,7 @@ declare namespace Evaporate {
customAuthMethod?: null | ((
signParams: string,
signHeaders: string,
stringToSign: () => string | undefined,
stringToSign: string,
signatureDateTime: string,
canonicalRequest: string
) => Promise<string>);

View File

@ -0,0 +1,18 @@
import express = require('express');
import * as weAccessMiddleware from 'express-wechat-access';
const app: express.Application = express();
const options: weAccessMiddleware.WeAccessMidOption = {
appId: 'xxxxx',
appSecret: 'xxxxx'
};
app.use(
weAccessMiddleware(
options,
e => {
console.error(e);
}
)
);

38
types/express-wechat-access/index.d.ts vendored Normal file
View File

@ -0,0 +1,38 @@
// Type definitions for express-wechat-access 1.1
// Project: https://github.com/simmons8616/express-wechat-access
// Definitions by: Simmons Zhang <https://github.com/simmons8616>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
import { Response, NextFunction } from 'express';
import * as http from 'http';
import { EventEmitter } from 'events';
type WeMiddleware = (req: any, res: Response | http.ServerResponse, next: NextFunction) => any;
declare function weAccessMiddleware(
options: {
accessTokenUrl?: string;
ticketUrl?: string;
appId: string;
appSecret: string;
https?: boolean;
},
errorHandler?: (e: any) => any
): WeMiddleware;
declare namespace weAccessMiddleware {
interface WeAccessMidOption {
accessTokenUrl?: string;
ticketUrl?: string;
appId: string;
appSecret: string;
https?: boolean;
}
interface WeAccessMiddleware extends WeMiddleware, EventEmitter, Function {}
}
export = weAccessMiddleware;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-wechat-access-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -45,7 +45,7 @@ declare class Class_DgramSocket extends Class_EventEmitter {
*
* @async
*/
bind(opts: Object): void;
bind(opts: object): void;
/**
*

View File

@ -52,23 +52,13 @@ declare class Class_Digest extends Class__object {
/**
*
* @brief
* @param data
* @return
* @param codec "buffer", "hex", "base64", "utf8",
* @return
*
*
*
*/
digest(data: Class_Buffer): Class_Buffer;
/**
*
* @brief
* @return
*
*
*
*/
digest(): Class_Buffer;
digest(codec?: string/** = "buffer"*/): any;
} /** endof class */

View File

@ -56,7 +56,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
on(ev: string, func: Function): Object;
on(ev: string, func: Function): object;
/**
*
@ -67,7 +67,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
on(map: Object): Object;
on(map: object): object;
/**
*
@ -79,7 +79,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
addListener(ev: string, func: Function): Object;
addListener(ev: string, func: Function): object;
/**
*
@ -90,7 +90,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
addListener(map: Object): Object;
addListener(map: object): object;
/**
*
@ -102,7 +102,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
prependListener(ev: string, func: Function): Object;
prependListener(ev: string, func: Function): object;
/**
*
@ -113,7 +113,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
prependListener(map: Object): Object;
prependListener(map: object): object;
/**
*
@ -125,7 +125,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
once(ev: string, func: Function): Object;
once(ev: string, func: Function): object;
/**
*
@ -136,7 +136,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
once(map: Object): Object;
once(map: object): object;
/**
*
@ -148,7 +148,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
prependOnceListener(ev: string, func: Function): Object;
prependOnceListener(ev: string, func: Function): object;
/**
*
@ -159,7 +159,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
prependOnceListener(map: Object): Object;
prependOnceListener(map: object): object;
/**
*
@ -171,7 +171,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
off(ev: string, func: Function): Object;
off(ev: string, func: Function): object;
/**
*
@ -182,7 +182,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
off(ev: string): Object;
off(ev: string): object;
/**
*
@ -193,7 +193,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
off(map: Object): Object;
off(map: object): object;
/**
*
@ -205,7 +205,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
removeListener(ev: string, func: Function): Object;
removeListener(ev: string, func: Function): object;
/**
*
@ -216,7 +216,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
removeListener(ev: string): Object;
removeListener(ev: string): object;
/**
*
@ -227,7 +227,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
removeListener(map: Object): Object;
removeListener(map: object): object;
/**
*
@ -238,7 +238,7 @@ declare class Class_EventEmitter extends Class__object {
*
*
*/
removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): Object;
removeAllListeners(evs?: any[]/** = v8::Array::New(isolate)*/): object;
/**
*

View File

@ -70,7 +70,7 @@ declare class Class_EventInfo extends Class__object {
* @type Object
*/
target: Object
target: object

View File

@ -44,7 +44,7 @@ declare class Class_Handler extends Class__object {
*
*
*/
constructor(map: Object);
constructor(map: object);
/**
*

View File

@ -81,7 +81,7 @@ declare class Class_HandlerEx extends Class_Handler {
*
*
*/
onerror(hdlrs: Object): void;
onerror(hdlrs: object): void;
} /** endof class */

View File

@ -71,7 +71,7 @@ declare class Class_HeapSnapshot extends Class__object {
*
*
*/
diff(before: Class_HeapSnapshot): Object;
diff(before: Class_HeapSnapshot): object;
/**
*

View File

@ -96,6 +96,30 @@ declare class Class_HttpClient extends Class__object {
userAgent: string
/**
* class prop
*
*
* @brief keep-alive 128
*
*
* @type Integer
*/
poolSize: number
/**
* class prop
*
*
* @brief keep-alive 10000 ms
*
*
* @type Integer
*/
poolTimeout: number
/**
@ -139,7 +163,7 @@ declare class Class_HttpClient extends Class__object {
*
* @async
*/
request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
request(method: string, url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -161,7 +185,7 @@ declare class Class_HttpClient extends Class__object {
*
* @async
*/
get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
get(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -183,7 +207,7 @@ declare class Class_HttpClient extends Class__object {
*
* @async
*/
post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
post(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -205,7 +229,7 @@ declare class Class_HttpClient extends Class__object {
*
* @async
*/
del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
del(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -227,7 +251,7 @@ declare class Class_HttpClient extends Class__object {
*
* @async
*/
put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
put(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -249,7 +273,7 @@ declare class Class_HttpClient extends Class__object {
*
* @async
*/
patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
patch(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
} /** endof class */

View File

@ -75,7 +75,7 @@ declare class Class_HttpCollection extends Class__object {
*
*
*/
add(map: Object): void;
add(map: object): void;
/**
*
@ -96,7 +96,7 @@ declare class Class_HttpCollection extends Class__object {
*
*
*/
set(map: Object): void;
set(map: object): void;
/**
*

View File

@ -118,7 +118,7 @@ declare class Class_HttpCookie extends Class__object {
*
*
*/
constructor(opts?: Object/** = v8::Object::New(isolate)*/);
constructor(opts?: object/** = v8::Object::New(isolate)*/);
/**
*
@ -130,7 +130,7 @@ declare class Class_HttpCookie extends Class__object {
*
*
*/
constructor(name: string, value: string, opts?: Object/** = v8::Object::New(isolate)*/);
constructor(name: string, value: string, opts?: object/** = v8::Object::New(isolate)*/);
/**
*

View File

@ -151,7 +151,7 @@ declare class Class_HttpMessage extends Class_Message {
*
*
*/
addHeader(map: Object): void;
addHeader(map: object): void;
/**
*
@ -172,7 +172,7 @@ declare class Class_HttpMessage extends Class_Message {
*
*
*/
setHeader(map: Object): void;
setHeader(map: object): void;
/**
*

View File

@ -80,7 +80,7 @@ declare class Class_HttpResponse extends Class_HttpMessage {
*
*
*/
writeHead(statusCode: number, statusMessage: string, headers?: Object/** = v8::Object::New(isolate)*/): void;
writeHead(statusCode: number, statusMessage: string, headers?: object/** = v8::Object::New(isolate)*/): void;
/**
*
@ -91,7 +91,7 @@ declare class Class_HttpResponse extends Class_HttpMessage {
*
*
*/
writeHead(statusCode: number, headers?: Object/** = v8::Object::New(isolate)*/): void;
writeHead(statusCode: number, headers?: object/** = v8::Object::New(isolate)*/): void;
/**
*

View File

@ -143,7 +143,7 @@ declare class Class_HttpServer extends Class_TcpServer {
*
*
*/
onerror(hdlrs: Object): void;
onerror(hdlrs: object): void;
/**
*

View File

@ -78,7 +78,7 @@ declare class Class_LevelDB extends Class__object {
*
*
*/
mset(map: Object): void;
mset(map: object): void;
/**
*

View File

@ -134,7 +134,7 @@ declare class Class_LruCache extends Class_EventEmitter {
*
*
*/
set(map: Object): void;
set(map: object): void;
/**
*

View File

@ -36,7 +36,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
find(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Class_MongoCursor;
find(query?: object/** = v8::Object::New(isolate)*/, projection?: object/** = v8::Object::New(isolate)*/): Class_MongoCursor;
/**
*
@ -48,7 +48,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
findOne(query?: Object/** = v8::Object::New(isolate)*/, projection?: Object/** = v8::Object::New(isolate)*/): Object;
findOne(query?: object/** = v8::Object::New(isolate)*/, projection?: object/** = v8::Object::New(isolate)*/): object;
/**
*
@ -59,7 +59,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
findAndModify(query: Object): Object;
findAndModify(query: object): object;
/**
*
@ -79,7 +79,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
insert(document: Object): void;
insert(document: object): void;
/**
*
@ -89,7 +89,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
save(document: Object): void;
save(document: object): void;
/**
*
@ -102,7 +102,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
update(query: Object, document: Object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void;
update(query: object, document: object, upsert?: boolean/** = false*/, multi?: boolean/** = false*/): void;
/**
*
@ -114,7 +114,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
update(query: Object, document: Object, options: Object): void;
update(query: object, document: object, options: object): void;
/**
*
@ -124,7 +124,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
remove(query: Object): void;
remove(query: object): void;
/**
*
@ -135,7 +135,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
runCommand(cmd: Object): Object;
runCommand(cmd: object): object;
/**
*
@ -147,7 +147,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
runCommand(cmd: string, arg?: Object/** = v8::Object::New(isolate)*/): Object;
runCommand(cmd: string, arg?: object/** = v8::Object::New(isolate)*/): object;
/**
*
@ -166,7 +166,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
ensureIndex(keys: Object, options?: Object/** = v8::Object::New(isolate)*/): void;
ensureIndex(keys: object, options?: object/** = v8::Object::New(isolate)*/): void;
/**
*
@ -176,7 +176,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
reIndex(): Object;
reIndex(): object;
/**
*
@ -187,7 +187,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
dropIndex(name: string): Object;
dropIndex(name: string): object;
/**
*
@ -197,7 +197,7 @@ declare class Class_MongoCollection extends Class__object {
*
*
*/
dropIndexes(): Object;
dropIndexes(): object;
/**
*

View File

@ -57,7 +57,7 @@ declare class Class_MongoCursor extends Class__object {
*
*
*/
sort(opts: Object): Class_MongoCursor;
sort(opts: object): Class_MongoCursor;
/**
*
@ -77,7 +77,7 @@ declare class Class_MongoCursor extends Class__object {
*
*
*/
next(): Object;
next(): object;
/**
*
@ -140,7 +140,7 @@ declare class Class_MongoCursor extends Class__object {
*
*
*/
hint(opts: Object): Class_MongoCursor;
hint(opts: object): Class_MongoCursor;
} /** endof class */

View File

@ -46,7 +46,7 @@ declare class Class_MongoDB extends Class__object {
*
*
*/
runCommand(cmd: Object): Object;
runCommand(cmd: object): object;
/**
*
@ -58,7 +58,7 @@ declare class Class_MongoDB extends Class__object {
*
*
*/
runCommand(cmd: string, arg: any): Object;
runCommand(cmd: string, arg: any): object;
/**
*

View File

@ -144,7 +144,7 @@ declare class Class_PKey extends Class__object {
*
*
*/
constructor(jsonKey: Object);
constructor(jsonKey: object);
/**
*
@ -258,7 +258,7 @@ declare class Class_PKey extends Class__object {
*
*
*/
importKey(jsonKey: Object): void;
importKey(jsonKey: object): void;
/**
*
@ -299,7 +299,7 @@ declare class Class_PKey extends Class__object {
*
*
*/
exportJson(): Object;
exportJson(): object;
/**
*

View File

@ -90,7 +90,7 @@ declare class Class_Redis extends Class__object {
*
*
*/
mset(kvs: Object): void;
mset(kvs: object): void;
/**
*
@ -108,7 +108,7 @@ declare class Class_Redis extends Class__object {
*
*
*/
msetNX(kvs: Object): void;
msetNX(kvs: object): void;
/**
*
@ -383,7 +383,7 @@ declare class Class_Redis extends Class__object {
*
*
*/
sub(map: Object): void;
sub(map: object): void;
/**
*
@ -424,7 +424,7 @@ declare class Class_Redis extends Class__object {
*
*
*/
unsub(map: Object): void;
unsub(map: object): void;
/**
*
@ -445,7 +445,7 @@ declare class Class_Redis extends Class__object {
*
*
*/
psub(map: Object): void;
psub(map: object): void;
/**
*
@ -486,7 +486,7 @@ declare class Class_Redis extends Class__object {
*
*
*/
unpsub(map: Object): void;
unpsub(map: object): void;
/**
*

View File

@ -53,7 +53,7 @@ declare class Class_RedisHash extends Class__object {
*
*
*/
mset(kvs: Object): void;
mset(kvs: object): void;
/**
*

View File

@ -34,7 +34,7 @@ declare class Class_RedisSortedSet extends Class__object {
*
*
*/
add(sms: Object): number;
add(sms: object): number;
/**
*

View File

@ -34,7 +34,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
constructor(map?: Object/** = v8::Object::New(isolate)*/);
constructor(map?: object/** = v8::Object::New(isolate)*/);
/**
*
@ -45,7 +45,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
constructor(method: string, map: Object);
constructor(method: string, map: object);
/**
*
@ -67,7 +67,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
append(map: Object): Class_Routing;
append(map: object): Class_Routing;
/**
*
@ -103,7 +103,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
all(map: Object): Class_Routing;
all(map: object): Class_Routing;
/**
*
@ -126,7 +126,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
get(map: Object): Class_Routing;
get(map: object): Class_Routing;
/**
*
@ -149,7 +149,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
post(map: Object): Class_Routing;
post(map: object): Class_Routing;
/**
*
@ -172,7 +172,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
del(map: Object): Class_Routing;
del(map: object): Class_Routing;
/**
*
@ -195,7 +195,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
put(map: Object): Class_Routing;
put(map: object): Class_Routing;
/**
*
@ -218,7 +218,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
patch(map: Object): Class_Routing;
patch(map: object): Class_Routing;
/**
*
@ -241,7 +241,7 @@ declare class Class_Routing extends Class_Handler {
*
*
*/
find(map: Object): Class_Routing;
find(map: object): Class_Routing;
/**
*

View File

@ -34,7 +34,20 @@ declare class Class_SandBox extends Class__object {
* @type Object
*/
global: Object
global: object
/**
* class prop
*
*
* @brief
*
*
* @readonly
* @type Object
*/
modules: object
@ -46,7 +59,7 @@ declare class Class_SandBox extends Class__object {
*
*
*/
constructor(mods: Object);
constructor(mods: object);
/**
*
@ -57,7 +70,7 @@ declare class Class_SandBox extends Class__object {
*
*
*/
constructor(mods: Object, require: Function);
constructor(mods: object, require: Function);
/**
*
@ -68,7 +81,7 @@ declare class Class_SandBox extends Class__object {
*
*
*/
constructor(mods: Object, global: Object);
constructor(mods: object, global: object);
/**
*
@ -80,7 +93,7 @@ declare class Class_SandBox extends Class__object {
*
*
*/
constructor(mods: Object, require: Function, global: Object);
constructor(mods: object, require: Function, global: object);
/**
*
@ -101,7 +114,7 @@ declare class Class_SandBox extends Class__object {
*
*
*/
add(mods: Object): void;
add(mods: object): void;
/**
*
@ -125,6 +138,17 @@ declare class Class_SandBox extends Class__object {
*/
remove(id: string): void;
/**
*
* @brief
* @param id
* @return
*
*
*
*/
has(id: string): boolean;
/**
*
* @brief require
@ -135,6 +159,22 @@ declare class Class_SandBox extends Class__object {
*/
clone(): Class_SandBox;
/**
*
* @brief global
*
*
*/
freeze(): void;
/**
*
* @brief
*
*
*/
refresh(): void;
/**
*
* @brief
@ -170,6 +210,44 @@ declare class Class_SandBox extends Class__object {
*/
require(id: string, base: string): any;
/**
*
* @brief extname compiler, extname ( {'.js', '.json', '.jsc', '.wasm'}), compiler javascript .
*
* ```JavaScript
* var vm = require('vm');
* var sbox = new vm.SandBox({
* });
*
* // 编译 typescript 脚本为 js 并加载
* sbox.setModuleCompiler('.ts', tsCompiler);
* var mod_ts = sbox.require('./a.ts');
*
* // 编译 coffee 脚本为 js 并加载
* sbox.setModuleCompiler('.coffee', cafeCompiler);
* var mod_coffee = sbox.require('./a.coffee');
*
* // 编译 jsx 脚本为 js 并加载
* sbox.setModuleCompiler('.jsx', reactCompiler);
* var mod_react = sbox.require('./a.jsx');
*
* // 编译 yml 脚本为自定义的内容(如 API 集合) 并加载
* sbox.setModuleCompiler('.yml', yaml2Rest)
* sbox.setModuleCompiler('.yaml', yaml2Rest)
*
* // 编译 markdown 为自定义的内容(如 html 字符串或 XmlDocument 对象) 并加载
* sbox.setModuleCompiler('.md', mdCompiler)
* sbox.setModuleCompiler('.markdown', mdCompiler)
* ```
*
* @param extname extname, '.' ,
* @param compiler , extname require . `compiler(buf, requireInfo)`, buf Buffer, requireInfo `{filename: string}`.
*
*
*
*/
setModuleCompiler(extname: string, compiler: Function): void;
} /** endof class */
/** endof `module Or Internal Object` */

View File

@ -84,7 +84,7 @@ declare class Class_Service extends Class_EventEmitter {
*
*
*/
constructor(name: string, worker: Function, event?: Object/** = v8::Object::New(isolate)*/);
constructor(name: string, worker: Function, event?: object/** = v8::Object::New(isolate)*/);
/**
*

View File

@ -216,7 +216,7 @@ declare class Class_UrlObject extends Class__object {
*
*
*/
constructor(args: Object);
constructor(args: object);
/**
*
@ -250,7 +250,7 @@ declare class Class_UrlObject extends Class__object {
*
*
*/
format(args: Object): void;
format(args: object): void;
/**
*

View File

@ -47,7 +47,7 @@ declare class Class_Worker extends Class_EventEmitter {
*
*
*/
constructor(path: string, opts?: Object/** = v8::Object::New(isolate)*/);
constructor(path: string, opts?: object/** = v8::Object::New(isolate)*/);
/**
*

View File

@ -146,7 +146,7 @@ declare class Class_X509Req extends Class__object {
*
* @async
*/
sign(issuer: string, key: Class_PKey, opts?: Object/** = v8::Object::New(isolate)*/): Class_X509Cert;
sign(issuer: string, key: Class_PKey, opts?: object/** = v8::Object::New(isolate)*/): Class_X509Cert;
} /** endof class */

View File

@ -217,7 +217,7 @@ declare module "bson" {
*
*
*/
export function encode(data: Object): Class_Buffer;
export function encode(data: object): Class_Buffer;
/**
*
@ -228,7 +228,7 @@ declare module "bson" {
*
*
*/
export function decode(data: Class_Buffer): Object;
export function decode(data: Class_Buffer): object;
} /** end of `module bson` */
export = bson

View File

@ -391,7 +391,7 @@ declare module "console" {
*
*
*/
export function add(cfg: Object): void;
export function add(cfg: object): void;
/**
*

View File

@ -238,7 +238,7 @@ declare module "dgram" {
*
*
*/
export function createSocket(opts: Object): Class_DgramSocket;
export function createSocket(opts: object): Class_DgramSocket;
/**
*
@ -260,7 +260,7 @@ declare module "dgram" {
*
*
*/
export function createSocket(opts: Object, callback: Function): Class_DgramSocket;
export function createSocket(opts: object, callback: Function): Class_DgramSocket;
/**
*

View File

@ -647,6 +647,27 @@ declare module "fs" {
*/
export function appendFile(fname: string, data: Class_Buffer): void;
/**
*
* @brief zip
* @param fname
* @param data zip
*
*
*
*/
export function setZipFS(fname: string, data: Class_Buffer): void;
/**
*
* @brief zip
* @param fname
*
*
*
*/
export function clearZipFS(fname?: string/** = ""*/): void;
} /** end of `module fs` */
export = fs
}

View File

@ -379,7 +379,7 @@ declare module "global" {
*
*
*/
export function setTimeout(callback: Function, timeout: number, ...args: any[]): Class_Timer;
export function setTimeout(callback: Function, timeout?: number/** = 1*/, ...args: any[]): Class_Timer;
/**
*

View File

@ -293,7 +293,7 @@ declare module "gui" {
*
*
*/
export function open(url: string, opt?: Object/** = v8::Object::New(isolate)*/): Class_WebView;
export function open(url: string, opt?: object/** = v8::Object::New(isolate)*/): Class_WebView;
} /** end of `module gui` */
export = gui

View File

@ -196,7 +196,7 @@
/** module Or Internal Object */
/**
* @brief http
* @brief http https
* @detail
*/
declare module "http" {
@ -205,6 +205,14 @@ declare module "http" {
module http {
/**
*
* @brief HTTP
*
*
*/
export const STATUS_CODES: any[];
/**
*
* @brief http客户端的 HttpCookie
@ -253,6 +261,22 @@ declare module "http" {
*/
export const userAgent: string;
/**
*
* @brief keep-alive 128
*
*
*/
export const poolSize: number;
/**
*
* @brief keep-alive 10000 ms
*
*
*/
export const poolTimeout: number;
/**
*
@ -333,7 +357,7 @@ declare module "http" {
*
*
*/
export function fileHandler(root: string, mimes?: Object/** = v8::Object::New(isolate)*/, autoIndex?: boolean/** = false*/): Class_Handler;
export function fileHandler(root: string, mimes?: object/** = v8::Object::New(isolate)*/, autoIndex?: boolean/** = false*/): Class_Handler;
/**
*
@ -368,7 +392,7 @@ declare module "http" {
*
* @async
*/
export function request(method: string, url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
export function request(method: string, url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -390,7 +414,7 @@ declare module "http" {
*
* @async
*/
export function get(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
export function get(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -412,7 +436,7 @@ declare module "http" {
*
* @async
*/
export function post(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
export function post(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -434,7 +458,7 @@ declare module "http" {
*
* @async
*/
export function del(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
export function del(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -456,7 +480,7 @@ declare module "http" {
*
* @async
*/
export function put(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
export function put(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
/**
*
@ -478,7 +502,7 @@ declare module "http" {
*
* @async
*/
export function patch(url: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
export function patch(url: string, opts?: object/** = v8::Object::New(isolate)*/): Class_HttpResponse;
} /** end of `module http` */
export = http

View File

@ -14,54 +14,54 @@
/// <reference path="assert.d.ts" />
/// <reference path="console.d.ts" />
/// <reference path="coroutine.d.ts" />
/// <reference path="global.d.ts" />
/// <reference path="gui.d.ts" />
/// <reference path="os.d.ts" />
/// <reference path="process.d.ts" />
/// <reference path="registry.d.ts" />
/// <reference path="timers.d.ts" />
/// <reference path="tty.d.ts" />
/// <reference path="fs.d.ts" />
/// <reference path="io.d.ts" />
/// <reference path="path.d.ts" />
/// <reference path="path_posix.d.ts" />
/// <reference path="path_win32.d.ts" />
/// <reference path="dgram.d.ts" />
/// <reference path="dns.d.ts" />
/// <reference path="http.d.ts" />
/// <reference path="mq.d.ts" />
/// <reference path="net.d.ts" />
/// <reference path="punycode.d.ts" />
/// <reference path="querystring.d.ts" />
/// <reference path="ssl.d.ts" />
/// <reference path="url.d.ts" />
/// <reference path="ws.d.ts" />
/// <reference path="zmq.d.ts" />
/// <reference path="base32.d.ts" />
/// <reference path="base64.d.ts" />
/// <reference path="base64vlq.d.ts" />
/// <reference path="bson.d.ts" />
/// <reference path="console.d.ts" />
/// <reference path="constants.d.ts" />
/// <reference path="coroutine.d.ts" />
/// <reference path="crypto.d.ts" />
/// <reference path="db.d.ts" />
/// <reference path="dgram.d.ts" />
/// <reference path="dns.d.ts" />
/// <reference path="encoding.d.ts" />
/// <reference path="fs.d.ts" />
/// <reference path="gd.d.ts" />
/// <reference path="global.d.ts" />
/// <reference path="gui.d.ts" />
/// <reference path="hash.d.ts" />
/// <reference path="hex.d.ts" />
/// <reference path="http.d.ts" />
/// <reference path="iconv.d.ts" />
/// <reference path="io.d.ts" />
/// <reference path="json.d.ts" />
/// <reference path="mq.d.ts" />
/// <reference path="net.d.ts" />
/// <reference path="os.d.ts" />
/// <reference path="path.d.ts" />
/// <reference path="path_posix.d.ts" />
/// <reference path="path_win32.d.ts" />
/// <reference path="process.d.ts" />
/// <reference path="profiler.d.ts" />
/// <reference path="punycode.d.ts" />
/// <reference path="querystring.d.ts" />
/// <reference path="registry.d.ts" />
/// <reference path="ssl.d.ts" />
/// <reference path="string_decoder.d.ts" />
/// <reference path="crypto.d.ts" />
/// <reference path="hash.d.ts" />
/// <reference path="zip.d.ts" />
/// <reference path="zlib.d.ts" />
/// <reference path="assert.d.ts" />
/// <reference path="profiler.d.ts" />
/// <reference path="test.d.ts" />
/// <reference path="timers.d.ts" />
/// <reference path="tty.d.ts" />
/// <reference path="url.d.ts" />
/// <reference path="db.d.ts" />
/// <reference path="gd.d.ts" />
/// <reference path="util.d.ts" />
/// <reference path="uuid.d.ts" />
/// <reference path="vm.d.ts" />
/// <reference path="ws.d.ts" />
/// <reference path="xml.d.ts" />
/// <reference path="zip.d.ts" />
/// <reference path="zlib.d.ts" />
/// <reference path="zmq.d.ts" />
/// <reference path="constants.d.ts" />
import _Global from 'global';
import _Process from 'process';

View File

@ -284,7 +284,7 @@ declare module "net" {
*
*
*/
export function info(): Object;
export function info(): object;
/**
*

View File

@ -380,7 +380,7 @@ declare module "os" {
*
*
*/
export function userInfo(options?: Object/** = v8::Object::New(isolate)*/): Object;
export function userInfo(options?: object/** = v8::Object::New(isolate)*/): object;
/**
*
@ -390,7 +390,7 @@ declare module "os" {
*
*
*/
export function networkInterfaces(): Object;
export function networkInterfaces(): object;
/**
*
@ -470,7 +470,7 @@ declare module "os" {
*
*
*/
export function memoryUsage(): Object;
export function memoryUsage(): object;
} /** end of `module os` */
export = os

View File

@ -341,6 +341,19 @@ declare module "path" {
*/
export function resolve(...ps: any[]): string;
/**
*
* @brief _from to
*
* @param _from
* @param to
* @return
*
*
*
*/
export function relative(_from: string, to: string): string;
/**
*
* @brief namespace-prefixed windows

View File

@ -341,6 +341,19 @@ declare module "path_posix" {
*/
export function resolve(...ps: any[]): string;
/**
*
* @brief _from to
*
* @param _from
* @param to
* @return
*
*
*
*/
export function relative(_from: string, to: string): string;
/**
*
* @brief namespace-prefixed windows

View File

@ -341,6 +341,19 @@ declare module "path_win32" {
*/
export function resolve(...ps: any[]): string;
/**
*
* @brief _from to
*
* @param _from
* @param to
* @return
*
*
*
*/
export function relative(_from: string, to: string): string;
/**
*
* @brief namespace-prefixed windows

View File

@ -416,7 +416,7 @@ declare module "process" {
*
*
*/
export function memoryUsage(): Object;
export function memoryUsage(): object;
/**
*
@ -448,7 +448,7 @@ declare module "process" {
*
*
*/
export function open(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess;
export function open(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess;
/**
*
@ -468,7 +468,7 @@ declare module "process" {
*
*
*/
export function open(command: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess;
export function open(command: string, opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess;
/**
*
@ -489,7 +489,7 @@ declare module "process" {
*
*
*/
export function start(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess;
export function start(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess;
/**
*
@ -509,7 +509,7 @@ declare module "process" {
*
*
*/
export function start(command: string, opts?: Object/** = v8::Object::New(isolate)*/): Class_SubProcess;
export function start(command: string, opts?: object/** = v8::Object::New(isolate)*/): Class_SubProcess;
/**
*
@ -530,7 +530,7 @@ declare module "process" {
*
*
*/
export function run(command: string, args: any[], opts?: Object/** = v8::Object::New(isolate)*/): number;
export function run(command: string, args: any[], opts?: object/** = v8::Object::New(isolate)*/): number;
/**
*
@ -550,7 +550,7 @@ declare module "process" {
*
*
*/
export function run(command: string, opts?: Object/** = v8::Object::New(isolate)*/): number;
export function run(command: string, opts?: object/** = v8::Object::New(isolate)*/): number;
} /** end of `module process` */
export = process

View File

@ -416,7 +416,7 @@ declare module "profiler" {
*
*
*/
export function diff(test: Function): Object;
export function diff(test: Function): object;
/**
*

View File

@ -242,7 +242,7 @@ declare module "querystring" {
*
*
*/
export function parse(str: string, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: Object/** = v8::Object::New(isolate)*/): Class_HttpCollection;
export function parse(str: string, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: object/** = v8::Object::New(isolate)*/): Class_HttpCollection;
/**
*
@ -256,7 +256,7 @@ declare module "querystring" {
*
*
*/
export function stringify(obj: Object, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: Object/** = v8::Object::New(isolate)*/): string;
export function stringify(obj: object, sep?: string/** = "&"*/, eq?: string/** = "="*/, opt?: object/** = v8::Object::New(isolate)*/): string;
} /** end of `module querystring` */
export = querystring

View File

@ -196,7 +196,7 @@
/** module Or Internal Object */
/**
* @brief ssl/tls
* @brief ssl/tls tls
* @detail
*/
declare module "ssl" {

View File

@ -219,7 +219,7 @@ declare module "timers" {
*
*
*/
export function setTimeout(callback: Function, timeout: number, ...args: any[]): Class_Timer;
export function setTimeout(callback: Function, timeout?: number/** = 1*/, ...args: any[]): Class_Timer;
/**
*
@ -313,6 +313,19 @@ declare module "timers" {
*/
export function clearImmediate(t: any): void;
/**
*
* @brief
* @param func
* @param timeout
* @param args callback
* @return func
*
*
*
*/
export function call(func: Function, timeout: number, ...args: any[]): any;
} /** end of `module timers` */
export = timers
}

View File

@ -217,7 +217,7 @@ declare module "url" {
*
*
*/
export function format(args: Object): string;
export function format(args: object): string;
/**
*

View File

@ -274,7 +274,7 @@ declare module "util" {
*
*
*/
export function inspect(obj: Object, options?: Object/** = v8::Object::New(isolate)*/): string;
export function inspect(obj: object, options?: object/** = v8::Object::New(isolate)*/): string;
/**
*
@ -637,6 +637,17 @@ declare module "util" {
*/
export function clone(v: any): any;
/**
*
* @brief
*
* @param v
*
*
*
*/
export function deepFreeze(v: any): void;
/**
*
* @brief
@ -674,7 +685,7 @@ declare module "util" {
*
*
*/
export function pick(v: any, ...objs: any[]): Object;
export function pick(v: any, ...objs: any[]): object;
/**
*
@ -687,7 +698,7 @@ declare module "util" {
*
*
*/
export function omit(v: any, ...keys: any[]): Object;
export function omit(v: any, ...keys: any[]): object;
/**
*
@ -937,22 +948,25 @@ declare module "util" {
*
* ```JavaScript
* {
* "fibjs": "0.1.0",
* "svn": 1753,
* "build": "Dec 10 2013 21:44:17",
* "fibjs": "0.25.0",
* "clang": "9.1",
* "date": "Jun 12 2018 07:22:40",
* "vender": {
* "ev": "4.11",
* "exif": "0.6.21",
* "gd": "2.1.0-alpha",
* "ev": "4.24",
* "expat": "2.2.5",
* "gd": "2.2.4",
* "jpeg": "8.3",
* "log4cpp": "1.0",
* "leveldb": "1.17",
* "mongo": "0.7",
* "pcre": "8.21",
* "png": "1.5.4",
* "sqlite": "3.8.1",
* "mbedtls": "2.6.1",
* "snappy": "1.1.2",
* "sqlite": "3.23.0",
* "tiff": "3.9.5",
* "uuid": "1.6.2",
* "v8": "3.23.17 (candidate)",
* "v8": "6.7.288.20",
* "v8-snapshot": true,
* "zlib": "1.2.7",
* "zmq": "3.1"
* }
@ -963,7 +977,7 @@ declare module "util" {
*
*
*/
export function buildInfo(): Object;
export function buildInfo(): object;
} /** end of `module util` */
export = util

View File

@ -264,11 +264,12 @@ declare module "zlib" {
*
* @brief gunzip
* @param to
* @param maxSize -1
* @return
*
*
*/
export function createGunzip(to: Class_Stream): Class_Stream;
export function createGunzip(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream;
/**
*
@ -284,21 +285,23 @@ declare module "zlib" {
*
* @brief inflate
* @param to
* @param maxSize -1
* @return
*
*
*/
export function createInflate(to: Class_Stream): Class_Stream;
export function createInflate(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream;
/**
*
* @brief inflateRaw
* @param to
* @param maxSize -1
* @return
*
*
*/
export function createInflateRaw(to: Class_Stream): Class_Stream;
export function createInflateRaw(to: Class_Stream, maxSize?: number/** = -1*/): Class_Stream;
/**
*
@ -340,34 +343,37 @@ declare module "zlib" {
*
* @brief deflate (zlib格式)
* @param data
* @param maxSize -1
* @return
*
*
* @async
*/
export function inflate(data: Class_Buffer): Class_Buffer;
export function inflate(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer;
/**
*
* @brief deflate (zlib格式)
* @param data
* @param stm
* @param maxSize -1
*
*
* @async
*/
export function inflateTo(data: Class_Buffer, stm: Class_Stream): void;
export function inflateTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void;
/**
*
* @brief deflate (zlib格式)
* @param src
* @param stm
* @param maxSize -1
*
*
* @async
*/
export function inflateTo(src: Class_Stream, stm: Class_Stream): void;
export function inflateTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void;
/**
*
@ -406,34 +412,37 @@ declare module "zlib" {
*
* @brief gzip
* @param data
* @param maxSize -1
* @return
*
*
* @async
*/
export function gunzip(data: Class_Buffer): Class_Buffer;
export function gunzip(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer;
/**
*
* @brief gzip
* @param data
* @param stm
* @param maxSize -1
*
*
* @async
*/
export function gunzipTo(data: Class_Buffer, stm: Class_Stream): void;
export function gunzipTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void;
/**
*
* @brief gzip
* @param src
* @param stm
* @param maxSize -1
*
*
* @async
*/
export function gunzipTo(src: Class_Stream, stm: Class_Stream): void;
export function gunzipTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void;
/**
*
@ -475,34 +484,37 @@ declare module "zlib" {
*
* @brief deflate (inflateRaw)
* @param data
* @param maxSize -1
* @return
*
*
* @async
*/
export function inflateRaw(data: Class_Buffer): Class_Buffer;
export function inflateRaw(data: Class_Buffer, maxSize?: number/** = -1*/): Class_Buffer;
/**
*
* @brief deflate (inflateRaw)
* @param data
* @param stm
* @param maxSize -1
*
*
* @async
*/
export function inflateRawTo(data: Class_Buffer, stm: Class_Stream): void;
export function inflateRawTo(data: Class_Buffer, stm: Class_Stream, maxSize?: number/** = -1*/): void;
/**
*
* @brief deflate (inflateRaw)
* @param src
* @param stm
* @param maxSize -1
*
*
* @async
*/
export function inflateRawTo(src: Class_Stream, stm: Class_Stream): void;
export function inflateRawTo(src: Class_Stream, stm: Class_Stream, maxSize?: number/** = -1*/): void;
} /** end of `module zlib` */
export = zlib

View File

@ -1,4 +1,4 @@
// Type definitions for fibjs 0.25
// Type definitions for fibjs 0.26
// Project: https://github.com/fibjs/fibjs
// Definitions by: richardo2016 <https://github.com/richardo2016>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -1,9 +1,13 @@
// Type definitions for fscreen 1.0
// Project: https://github.com/rafrex/fscreen#readme
// Definitions by: Joscha Feth <https://github.com/joscha>
// Terry Mun <https://github.com/terrymun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
type Handler = () => void;
type Handler = (e?: Event) => void;
type RequestFullScreenFunction = (element: Element) => void;
type EventName = 'fullscreenEnabled' | 'fullscreenElement' | 'requestFullscreen' | 'exitFullscreen' | 'fullscreenchange' | 'fullscreenerror';
declare class Fscreen {
readonly fullscreenElement: Element | undefined;
@ -12,10 +16,10 @@ declare class Fscreen {
onfullscreenchange: Handler;
onfullscreenerror: Handler;
addEventListener(type: string, handler: Handler, useCapture?: boolean): void;
removeEventListener(type: string, handler: Handler): void;
addEventListener(type: EventName, handler: Handler, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: EventName, handler: Handler, options?: boolean | AddEventListenerOptions): void;
requestFullscreen(element: Element): void;
requestFullscreenFunction(element: Element): void;
requestFullscreenFunction(element: Element): RequestFullScreenFunction;
}
declare const fscreen: Fscreen;

View File

@ -0,0 +1,11 @@
import GCStats = require("gc-stats");
import { GCStatistics } from "gc-stats";
const gcStats = GCStats();
gcStats.on("stats", (stats: GCStatistics) => {
const { gctype: gcType, startTime, endTime, before, after, diff } = stats;
const beforeMallocedMemory = before.mallocedMemory;
const afterMallocedMemory = after.mallocedMemory;
const diffMallocedMemory = diff.mallocedMemory;
});

34
types/gc-stats/index.d.ts vendored Normal file
View File

@ -0,0 +1,34 @@
// Type definitions for gc-stats 1.2
// Project: https://github.com/dainis/node-gcstats#readme
// Definitions by: Vitor Fernandes <https://github.com/vfernandestoptal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { EventEmitter } from "events";
declare namespace GCStats {
interface MemoryStatistics {
totalHeapSize: number;
totalHeapExecutableSize: number;
usedHeapSize: number;
heapSizeLimit: number;
totalPhysicalSize: number;
totalAvailableSize: number;
mallocedMemory: number;
peakMallocedMemory: number;
}
interface GCStatistics {
startTime: number;
endTime: number;
pause: number;
pauseMS: number;
gctype: 1 | 2 | 4 | 8 | 15;
before: MemoryStatistics;
after: MemoryStatistics;
diff: MemoryStatistics;
}
}
declare function GCStats(): EventEmitter;
export = GCStats;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gc-stats-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -418,7 +418,8 @@ let service = new google.maps.places.PlacesService(new HTMLDivElement());
service.getDetails({
placeId: '-a1',
fields: ['name']
fields: ['name'],
sessionToken: new google.maps.places.AutocompleteSessionToken()
}, (result, status) => {
if (status === google.maps.places.PlacesServiceStatus.NOT_FOUND) {
return;

View File

@ -1,14 +1,15 @@
// Type definitions for Google Maps JavaScript API 3.30
// Project: https://developers.google.com/maps/
// Definitions by: Folia A/S <http://www.folia.dk>,
// Chris Wrench <https://github.com/cgwrench>,
// Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>,
// Grant Hutchins <https://github.com/nertzy>,
// Denis Atyasov <https://github.com/xaolas>,
// Michael McMullin <https://github.com/mrmcnerd>,
// Martin Costello <https://github.com/martincostello>,
// Definitions by: Folia A/S <http://www.folia.dk>,
// Chris Wrench <https://github.com/cgwrench>,
// Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>,
// Grant Hutchins <https://github.com/nertzy>,
// Denis Atyasov <https://github.com/xaolas>,
// Michael McMullin <https://github.com/mrmcnerd>,
// Martin Costello <https://github.com/martincostello>,
// Sven Kreiss <https://github.com/svenkreiss>
// Umar Bolatov <https://github.com/bolatovumar>
// Michael Gauthier <https://github.com/gauthierm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*
@ -2542,6 +2543,10 @@ declare namespace google.maps {
getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void;
}
export class AutocompleteSessionToken {
constructor();
}
export interface AutocompletionRequest {
bounds?: LatLngBounds|LatLngBoundsLiteral;
componentRestrictions?: ComponentRestrictions;
@ -2549,6 +2554,7 @@ declare namespace google.maps {
location?: LatLng;
offset?: number;
radius?: number;
sessionToken?: AutocompleteSessionToken;
types?: string[];
}
@ -2566,6 +2572,7 @@ declare namespace google.maps {
export interface PlaceDetailsRequest {
placeId: string;
fields?: string[];
sessionToken?: AutocompleteSessionToken;
}
export interface PlaceGeometry {

View File

@ -1,5 +1,14 @@
import * as GulpJsonmin from 'gulp-jsonmin';
import gulp = require('gulp');
import gulpJsonmin = require('gulp-jsonmin');
GulpJsonmin();
GulpJsonmin({});
GulpJsonmin({ verbose: true });
gulp.task('build', () => {
return gulp.src('*.json')
.pipe(gulpJsonmin())
.pipe(gulp.dest('dist'));
});
gulp.task('build', () => {
return gulp.src('*.json')
.pipe(gulpJsonmin({ verbose: true }))
.pipe(gulp.dest('dist'));
});

View File

@ -7,12 +7,12 @@
import { Transform } from 'stream';
declare function jsonmin(options?: jsonmin.Options): Transform;
declare function gulpJsonmin(options?: gulpJsonmin.Options): Transform;
declare namespace jsonmin {
declare namespace gulpJsonmin {
interface Options {
verbose?: boolean;
}
}
export = jsonmin;
export = gulpJsonmin;

View File

@ -0,0 +1,10 @@
import gulp = require('gulp');
import gulpPugI18n = require('gulp-pug-i18n');
gulp.task('build', () => {
return gulp.src('*.pug')
.pipe(gulpPugI18n({
i18n: { locales: 'locales/*.json' }
}))
.pipe(gulp.dest('dist'));
});

25
types/gulp-pug-i18n/index.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
// Type definitions for gulp-pug-i18n 1.0
// Project: https://github.com/dogancelik/gulp-pug-i18n
// Definitions by: Romain Faust <https://github.com/romain-faust>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Options as PugOptions } from 'pug';
import { Transform } from 'stream';
declare function gulpPugI18n(options: gulpPugI18n.Options): Transform;
declare namespace gulpPugI18n {
interface Options extends PugOptions {
data?: any;
i18n: {
default?: string;
filename?: string;
locales: string | ReadonlyArray<string>;
namespace?: string | null;
};
}
}
export = gulpPugI18n;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gulp-pug-i18n-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -0,0 +1,9 @@
import sum = require("hash-sum");
sum(undefined);
sum(null);
sum({});
sum({ hello: "world" });
sum(100);
sum("");
sum(true);

8
types/hash-sum/index.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
// Type definitions for hash-sum 1.0
// Project: https://github.com/bevacqua/hash-sum
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = hash_sum;
declare function hash_sum(value: any): string;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"hash-sum-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@ -206,3 +206,12 @@ function xssFilterTest() {
app.use(helmet.xssFilter({ setOnOldIE: false }));
app.use(helmet.xssFilter({ setOnOldIE: true }));
}
/**
* @summary Test for {@see helmet#permittedCrossDomainPolicies} function.
*/
function permittedCrossDomainPoliciesTest() {
app.use(helmet.permittedCrossDomainPolicies());
app.use(helmet.permittedCrossDomainPolicies({}));
app.use(helmet.permittedCrossDomainPolicies({ permittedPolicies: 'none' }));
}

View File

@ -11,18 +11,23 @@ export = helmet;
declare namespace helmet {
export interface IHelmetConfiguration {
contentSecurityPolicy?: boolean | IHelmetContentSecurityPolicyConfiguration,
dnsPrefetchControl?: boolean | IHelmetDnsPrefetchControlConfiguration,
frameguard?: boolean | IHelmetFrameguardConfiguration,
hidePoweredBy?: boolean | IHelmetHidePoweredByConfiguration,
hpkp?: boolean | IHelmetHpkpConfiguration,
hsts?: boolean | IHelmetHstsConfiguration,
ieNoOpen?: boolean,
noCache?: boolean,
noSniff?: boolean,
referrerPolicy?: boolean | IHelmetReferrerPolicyConfiguration,
xssFilter?: boolean | IHelmetXssFilterConfiguration,
expectCt?: boolean | IHelmetExpectCtConfiguration,
contentSecurityPolicy?: boolean | IHelmetContentSecurityPolicyConfiguration;
dnsPrefetchControl?: boolean | IHelmetDnsPrefetchControlConfiguration;
frameguard?: boolean | IHelmetFrameguardConfiguration;
hidePoweredBy?: boolean | IHelmetHidePoweredByConfiguration;
hpkp?: boolean | IHelmetHpkpConfiguration;
hsts?: boolean | IHelmetHstsConfiguration;
ieNoOpen?: boolean;
noCache?: boolean;
noSniff?: boolean;
referrerPolicy?: boolean | IHelmetReferrerPolicyConfiguration;
xssFilter?: boolean | IHelmetXssFilterConfiguration;
expectCt?: boolean | IHelmetExpectCtConfiguration;
permittedCrossDomainPolicies?: boolean | IHelmetPermittedCrossDomainPoliciesConfiguration;
}
export interface IHelmetPermittedCrossDomainPoliciesConfiguration {
permittedPolicies?: string;
}
export interface IHelmetContentSecurityPolicyDirectiveFunction {
@ -31,22 +36,22 @@ declare namespace helmet {
export type HelmetCspDirectiveValue = string | IHelmetContentSecurityPolicyDirectiveFunction;
export interface IHelmetContentSecurityPolicyDirectives {
baseUri?: HelmetCspDirectiveValue[],
childSrc?: HelmetCspDirectiveValue[],
connectSrc?: HelmetCspDirectiveValue[],
defaultSrc?: HelmetCspDirectiveValue[],
fontSrc?: HelmetCspDirectiveValue[],
formAction?: HelmetCspDirectiveValue[],
frameAncestors?: HelmetCspDirectiveValue[],
frameSrc?: HelmetCspDirectiveValue[],
imgSrc?: HelmetCspDirectiveValue[],
mediaSrc?: HelmetCspDirectiveValue[],
objectSrc?: HelmetCspDirectiveValue[],
pluginTypes?: HelmetCspDirectiveValue[],
reportUri?: string,
sandbox?: HelmetCspDirectiveValue[],
scriptSrc?: HelmetCspDirectiveValue[],
styleSrc?: HelmetCspDirectiveValue[]
baseUri?: HelmetCspDirectiveValue[];
childSrc?: HelmetCspDirectiveValue[];
connectSrc?: HelmetCspDirectiveValue[];
defaultSrc?: HelmetCspDirectiveValue[];
fontSrc?: HelmetCspDirectiveValue[];
formAction?: HelmetCspDirectiveValue[];
frameAncestors?: HelmetCspDirectiveValue[];
frameSrc?: HelmetCspDirectiveValue[];
imgSrc?: HelmetCspDirectiveValue[];
mediaSrc?: HelmetCspDirectiveValue[];
objectSrc?: HelmetCspDirectiveValue[];
pluginTypes?: HelmetCspDirectiveValue[];
reportUri?: string;
sandbox?: HelmetCspDirectiveValue[];
scriptSrc?: HelmetCspDirectiveValue[];
styleSrc?: HelmetCspDirectiveValue[];
}
export interface IHelmetContentSecurityPolicyConfiguration {
@ -54,7 +59,7 @@ declare namespace helmet {
setAllHeaders?: boolean;
disableAndroid?: boolean;
browserSniff?: boolean;
directives?: IHelmetContentSecurityPolicyDirectives
directives?: IHelmetContentSecurityPolicyDirectives;
}
export interface IHelmetDnsPrefetchControlConfiguration {
@ -62,12 +67,12 @@ declare namespace helmet {
}
export interface IHelmetFrameguardConfiguration {
action?: string,
domain?: string
action?: string;
domain?: string;
}
export interface IHelmetHidePoweredByConfiguration {
setTo?: string
setTo?: string;
}
export interface IHelmetSetIfFunction {
@ -80,14 +85,14 @@ declare namespace helmet {
includeSubdomains?: boolean;
reportUri?: string;
reportOnly?: boolean;
setIf?: IHelmetSetIfFunction
setIf?: IHelmetSetIfFunction;
}
export interface IHelmetHstsConfiguration {
maxAge?: number;
includeSubdomains?: boolean;
preload?: boolean;
setIf?: IHelmetSetIfFunction,
setIf?: IHelmetSetIfFunction;
force?: boolean;
}
@ -195,5 +200,12 @@ declare namespace helmet {
* @returns {e.RequestHandler}
*/
expectCt(options?: IHelmetExpectCtConfiguration): express.RequestHandler;
/**
* @summary Adds the "X-Permitted-Cross-Domain-Policies" header.
* @param {helmet.IHelmetPermittedCrossDomainPoliciesConfiguration} options
* @returns {express.RequestHandler}
*/
permittedCrossDomainPolicies(options?: IHelmetPermittedCrossDomainPoliciesConfiguration): express.RequestHandler;
}
}

Some files were not shown because too many files have changed in this diff Show More