Merge branch 'master' into patch-1

This commit is contained in:
André Werlang 2017-02-07 23:47:00 -02:00 committed by GitHub
commit 77bbac8da6
661 changed files with 18202 additions and 4448 deletions

View File

@ -1,5 +1,5 @@
- [ ] I tried using the latest `xxxx/xxxx.d.ts` file in this repo and had problems.
- [ ] I tried using the `@types/xxxx` package and had problems.
- [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
- [ ] I have a question that is inappropriate for [StackOverflow](https://stackoverflow.com/). (Please ask any appropriate questions there).
- [ ] I want to talk about `xxxx/xxxx.d.ts`.
- The authors of that type definition are cc/ @....
- [ ] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see `Definitions by:` in `index.d.ts`) so they can respond.
- Authors: @....

View File

@ -3,8 +3,8 @@ Please fill in this template.
- [ ] Make your PR against the `master` branch.
- [ ] Use a meaningful title for the pull request. Include the name of the package modified.
- [ ] Test the change in your own code. (Compile and run.)
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes).
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).
- [ ] Run `tsc` without errors.
- [ ] Run `npm run lint package-name` if a `tslint.json` is present.

55
accepts/index.d.ts vendored
View File

@ -3,29 +3,60 @@
// Definitions by: Stefan Reichel <https://github.com/bomret>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { IncomingMessage } from "http";
declare namespace accepts {
export interface Headers {
[key: string]: string | string[];
}
export interface Accepts {
charset(charsets: string[]): string | string[] | boolean;
charset(...charsets: string[]): string | string[] | boolean;
/**
* Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned.
*/
charset(charsets: string[]): string | false;
charset(...charsets: string[]): string | false;
/**
* Return the charsets that the request accepts, in the order of the client's preference (most preferred first).
*/
charsets(): string[];
encoding(encodings: string[]): string | string[] | boolean;
encoding(...encodings: string[]): string | string[] | boolean;
/**
* Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned.
*/
encoding(encodings: string[]): string | false;
encoding(...encodings: string[]): string | false;
/**
* Return the encodings that the request accepts, in the order of the client's preference (most preferred first).
*/
encodings(): string[];
language(languages: string[]): string | string[] | boolean;
language(...languages: string[]): string | string[] | boolean;
/**
* Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned.
*/
language(languages: string[]): string | false;
language(...languages: string[]): string | false;
/**
* Return the languages that the request accepts, in the order of the client's preference (most preferred first).
*/
languages(): string[];
type(types: string[]): string | string[] | boolean;
type(...types: string[]): string | string[] | boolean;
/**
* Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned.
*
* The `types` array can contain full MIME types or file extensions. Any value that is not a full MIME types is passed to `require('mime-types').lookup`.
*/
type(types: string[]): string | false;
type(...types: string[]): string | false;
/**
* Return the types that the request accepts, in the order of the client's preference (most preferred first).
*/
types(): string[];
}
}
declare function accepts(req: IncomingMessage): accepts.Accepts;
declare function accepts(req: { headers: accepts.Headers }): accepts.Accepts;
export = accepts;

View File

@ -32,7 +32,7 @@ declare module "angular" {
// width of grid columns. "auto" will divide the width of the grid evenly among the columns
colWidth?: string;
// height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels,
// height of grid rows. 'match' will make it the same as the column width, a numeric value will be interpreted as pixels,
// '/2' is half the column width, '*5' is five times the column width, etc.
rowHeight?: string;
@ -84,7 +84,7 @@ declare module "angular" {
// options to pass to resizable handler
resizable?: {
// whether the items are resizable
// whether the items are resizable
enabled?: boolean;
// location of the resize handles
@ -104,7 +104,7 @@ declare module "angular" {
// options to pass to draggable handler
draggable?: {
// whether the items are resizable
// whether the items are resizable
enabled?: boolean;
// Distance in pixels from the edge of the viewport after which the viewport should scroll, relative to pointer
@ -142,4 +142,4 @@ declare module "angular" {
col: number;
}
}
}
}

View File

@ -118,6 +118,7 @@ httpBackendService.flush();
httpBackendService.flush(1234);
httpBackendService.resetExpectations();
httpBackendService.verifyNoOutstandingExpectation();
httpBackendService.verifyNoOutstandingExpectation(false);
httpBackendService.verifyNoOutstandingRequest();
requestHandler = httpBackendService.expect('GET', 'http://test.local');

View File

@ -132,8 +132,9 @@ declare module 'angular' {
/**
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
* @param digest Do digest before checking expectation. Pass anything except false to trigger digest. NOTE this flag is purposely undocumented by Angular, which means it's not to be used in normal client code.
*/
verifyNoOutstandingExpectation(): void;
verifyNoOutstandingExpectation(digest?: boolean): void;
/**
* Verifies that there are no outstanding requests that need to be flushed.

View File

@ -1,9 +1,9 @@
/* tslint:disable:dt-header variable-name */
// Type definitions for Angular JS 1.5 component router
// Project: http://angularjs.org
// Definitions by: David Reher <http://github.com/davidreher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace angular {
/**
* `Instruction` is a tree of {@link ComponentInstruction}s with all the information needed
@ -263,7 +263,7 @@ declare namespace angular {
/**
* Subscribe to URL updates from the router
*/
subscribe(onNext: (value: any) => void): Object;
subscribe(onNext: (value: any) => void): {};
/**
* Removes the contents of this router's outlet and all descendant outlets

File diff suppressed because it is too large Load Diff

120
angular/index.d.ts vendored
View File

@ -27,7 +27,7 @@ import ng = angular;
///////////////////////////////////////////////////////////////////////////////
declare namespace angular {
type Injectable<T extends Function> = T | (string | T)[];
type Injectable<T extends Function> = T | Array<string | T>;
// not directly implemented, but ensures that constructed class implements $get
interface IServiceProviderClass {
@ -64,7 +64,7 @@ declare namespace angular {
* @param config an object for defining configuration options for the application. The following keys are supported:
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
*/
bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService;
bootstrap(element: string|Element|JQuery|Document, modules?: Array<string|Function|any[]>, config?: IAngularBootstrapConfig): auto.IInjectorService;
/**
* Creates a deep copy of source, which should be an object or an array.
@ -122,7 +122,7 @@ declare namespace angular {
fromJson(json: string): any;
identity<T>(arg?: T): T;
injector(modules?: any[], strictDi?: boolean): auto.IInjectorService;
isArray(value: any): value is Array<any>;
isArray(value: any): value is any[];
isDate(value: any): value is Date;
isDefined(value: any): boolean;
isElement(value: any): boolean;
@ -514,7 +514,7 @@ declare namespace angular {
$watchCollection<T>(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): () => void;
$watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void;
$watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void;
$watchGroup(watchExpressions: Array<{ (scope: IScope): any }>, listener: (newValue: any, oldValue: any, scope: IScope) => any): () => void;
$parent: IScope;
$root: IRootScopeService;
@ -662,9 +662,9 @@ declare namespace angular {
}
interface IFilterOrderByItem {
value: any,
type: string,
index: any
value: any;
type: string;
index: any;
}
interface IFilterOrderByComparatorFunc {
@ -756,7 +756,7 @@ declare namespace angular {
* @param comparator Function used to determine the relative order of value pairs.
* @return An array containing the items from the specified collection, ordered by a comparator function based on the values computed using the expression predicate.
*/
<T>(array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean, comparator?: IFilterOrderByComparatorFunc): T[];
<T>(array: T[], expression: string|((value: T) => any)|Array<((value: T) => any)|string>, reverse?: boolean, comparator?: IFilterOrderByComparatorFunc): T[];
}
/**
@ -1023,7 +1023,7 @@ declare namespace angular {
all<T1, T2, T3, T4>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>]): IPromise<[T1, T2, T3, T4]>;
all<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[T1, T2, T3]>;
all<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[T1, T2]>;
all<TAll>(promises: IPromise<TAll>[]): IPromise<TAll[]>;
all<TAll>(promises: Array<IPromise<TAll>>): IPromise<TAll[]>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
*
@ -1044,13 +1044,14 @@ declare namespace angular {
*
* @param reason Constant, message, exception or an object representing the rejection reason.
*/
reject(reason?: any): IPromise<any>;
reject(reason?: any): IPromise<never>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*
* @param value Value or a promise
*/
resolve<T>(value: IPromise<T>|T): IPromise<T>;
resolve<T1, T2>(value: IPromise<T1>|T2): IPromise<T1|T2>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*/
@ -1061,7 +1062,10 @@ declare namespace angular {
* @param value Value or a promise
*/
when<T>(value: IPromise<T>|T): IPromise<T>;
when<TResult, T>(value: IPromise<T>|T, successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
when<T1, T2>(value: IPromise<T1>|T2): IPromise<T1|T2>;
when<TResult, T>(value: IPromise<T>|T, successCallback: (promiseValue: T) => IPromise<TResult>|TResult): IPromise<TResult>;
when<TResult, T>(value: T, successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback: null | undefined | ((reason: any) => any), notifyCallback?: (state: any) => any): IPromise<TResult>;
when<TResult, TResult2, T>(value: IPromise<T>, successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback: (reason: any) => TResult2 | IPromise<TResult2>, notifyCallback?: (state: any) => any): IPromise<TResult | TResult2>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*/
@ -1090,15 +1094,20 @@ declare namespace angular {
interface IPromise<T> {
/**
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
* The successCallBack may return IPromise<void> for when a $q.reject() needs to be returned
* The successCallBack may return IPromise<never> for when a $q.reject() needs to be returned
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
*/
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise<TResult>;
then<TResult1, TResult2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback?: null | undefined, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2>;
then<TResult, TCatch>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback: (reason: any) => IPromise<TCatch>|TCatch, notifyCallback?: (state: any) => any): IPromise<TResult | TCatch>;
then<TResult1, TResult2, TCatch1, TCatch2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback: (reason: any) => IPromise<TCatch1>|TCatch2, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2 | TCatch1 | TCatch2>;
/**
* Shorthand for promise.then(null, errorCallback)
*/
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>|TResult): IPromise<TResult>;
catch<TCatch>(onRejected: (reason: any) => IPromise<TCatch>|TCatch): IPromise<T | TCatch>;
catch<TCatch1, TCatch2>(onRejected: (reason: any) => IPromise<TCatch1>|TCatch2): IPromise<T | TCatch1 | TCatch2>;
/**
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
@ -1245,6 +1254,16 @@ declare namespace angular {
debugInfoEnabled(): boolean;
debugInfoEnabled(enabled: boolean): ICompileProvider;
/**
* Call this method to enable/disable whether directive controllers are assigned bindings before calling the controller's constructor.
* If enabled (true), the compiler assigns the value of each of the bindings to the properties of the controller object before the constructor of this object is called.
* If disabled (false), the compiler calls the constructor first before assigning bindings.
* Defaults to false.
* See: https://docs.angularjs.org/api/ng/provider/$compileProvider#preAssignBindingsEnabled
*/
preAssignBindingsEnabled(): boolean;
preAssignBindingsEnabled(enabled: boolean): ICompileProvider;
/**
* Sets the number of times $onChanges hooks can trigger new changes before giving up and assuming that the model is unstable.
* Increasing the TTL could have performance implications, so you should not change it without proper justification.
@ -1284,11 +1303,11 @@ declare namespace angular {
}
interface ITemplateLinkingFunctionOptions {
parentBoundTranscludeFn?: ITranscludeFunction,
parentBoundTranscludeFn?: ITranscludeFunction;
transcludeControllers?: {
[controller: string]: { instance: IController }
},
futureParentElement?: JQuery
};
futureParentElement?: JQuery;
}
/**
@ -1510,7 +1529,9 @@ declare namespace angular {
(data: any, headersGetter: IHttpHeadersGetter, status: number): any;
}
type HttpHeaderType = {[requestType: string]:string|((config:IRequestConfig) => string)};
interface HttpHeaderType {
[requestType: string]: string|((config: IRequestConfig) => string);
}
interface IHttpRequestConfigHeaders {
[requestType: string]: any;
@ -1593,7 +1614,7 @@ declare namespace angular {
* Register service factories (names or implementations) for interceptors which are called before and after
* each request.
*/
interceptors: (string | Injectable<IHttpInterceptorFactory>)[];
interceptors: Array<string | Injectable<IHttpInterceptorFactory>>;
useApplyAsync(): boolean;
useApplyAsync(value: boolean): IHttpProvider;
@ -1603,7 +1624,7 @@ declare namespace angular {
* @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
* otherwise, returns the current configured value.
*/
useLegacyPromiseExtensions(value:boolean) : boolean | IHttpProvider;
useLegacyPromiseExtensions(value: boolean): boolean | IHttpProvider;
}
///////////////////////////////////////////////////////////////////////////
@ -1687,16 +1708,15 @@ declare namespace angular {
valueOf(value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// SCEDelegateProvider
// see http://docs.angularjs.org/api/ng.$sceDelegateProvider
///////////////////////////////////////////////////////////////////////////
interface ISCEDelegateProvider extends IServiceProvider {
resourceUrlBlacklist(blacklist: any[]): void;
resourceUrlWhitelist(whitelist: any[]): void;
resourceUrlBlacklist(): any[];
resourceUrlBlacklist(blacklist: any[]): void;
resourceUrlWhitelist(): any[];
resourceUrlWhitelist(whitelist: any[]): void;
}
/**
@ -1936,33 +1956,33 @@ declare namespace angular {
annotate(fn: Function, strictDi?: boolean): string[];
annotate(inlineAnnotatedFunction: any[]): string[];
get<T>(name: string, caller?: string): T;
get(name: '$anchorScroll'): IAnchorScrollService
get(name: '$cacheFactory'): ICacheFactoryService
get(name: '$compile'): ICompileService
get(name: '$controller'): IControllerService
get(name: '$document'): IDocumentService
get(name: '$exceptionHandler'): IExceptionHandlerService
get(name: '$filter'): IFilterService
get(name: '$http'): IHttpService
get(name: '$httpBackend'): IHttpBackendService
get(name: '$httpParamSerializer'): IHttpParamSerializer
get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer
get(name: '$interpolate'): IInterpolateService
get(name: '$interval'): IIntervalService
get(name: '$locale'): ILocaleService
get(name: '$location'): ILocationService
get(name: '$log'): ILogService
get(name: '$parse'): IParseService
get(name: '$q'): IQService
get(name: '$rootElement'): IRootElementService
get(name: '$rootScope'): IRootScopeService
get(name: '$sce'): ISCEService
get(name: '$sceDelegate'): ISCEDelegateService
get(name: '$templateCache'): ITemplateCacheService
get(name: '$templateRequest'): ITemplateRequestService
get(name: '$timeout'): ITimeoutService
get(name: '$window'): IWindowService
get<T>(name: '$xhrFactory'): IXhrFactory<T>
get(name: '$anchorScroll'): IAnchorScrollService;
get(name: '$cacheFactory'): ICacheFactoryService;
get(name: '$compile'): ICompileService;
get(name: '$controller'): IControllerService;
get(name: '$document'): IDocumentService;
get(name: '$exceptionHandler'): IExceptionHandlerService;
get(name: '$filter'): IFilterService;
get(name: '$http'): IHttpService;
get(name: '$httpBackend'): IHttpBackendService;
get(name: '$httpParamSerializer'): IHttpParamSerializer;
get(name: '$httpParamSerializerJQLike'): IHttpParamSerializer;
get(name: '$interpolate'): IInterpolateService;
get(name: '$interval'): IIntervalService;
get(name: '$locale'): ILocaleService;
get(name: '$location'): ILocationService;
get(name: '$log'): ILogService;
get(name: '$parse'): IParseService;
get(name: '$q'): IQService;
get(name: '$rootElement'): IRootElementService;
get(name: '$rootScope'): IRootScopeService;
get(name: '$sce'): ISCEService;
get(name: '$sceDelegate'): ISCEDelegateService;
get(name: '$templateCache'): ITemplateCacheService;
get(name: '$templateRequest'): ITemplateRequestService;
get(name: '$timeout'): ITimeoutService;
get(name: '$window'): IWindowService;
get<T>(name: '$xhrFactory'): IXhrFactory<T>;
has(name: string): boolean;
instantiate<T>(typeConstructor: Function, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;

20
angular/tslint.json Normal file
View File

@ -0,0 +1,20 @@
{
"extends": "../tslint.json",
"rules": {
"class-name": true,
"curly": true,
"no-consecutive-blank-lines": true,
"no-shadowed-variable": true,
"quotemark": [true, "single"],
"align": true,
"callable-types": false,
"forbidden-types": false,
"indent": [true, "spaces"],
"interface-name": false,
"linebreak-style": [true, "LF"],
"no-empty-interface": false,
"unified-signatures": false,
"variable-name": [true, "check-format"],
"void-return": false
}
}

1
archiver/index.d.ts vendored
View File

@ -31,7 +31,6 @@ declare namespace archiver {
}
export interface Archiver extends STREAM.Transform {
pipe(writeStream: FS.WriteStream): void;
append(source: STREAM.Readable | Buffer | string, name: nameInterface): void;
directory(dirpath: string, destpath: nameInterface | string): void;

View File

@ -1,23 +1,151 @@
/// <reference types="auth0-js" />
var auth0 = new Auth0({
let webAuth = new auth0.WebAuth({
domain: 'mine.auth0.com',
clientID: 'dsa7d77dsa7d7',
callbackURL: 'http://my-app.com/callback',
callbackOnLocationHash: true
clientID: 'dsa7d77dsa7d7'
});
auth0.login({
connection: 'google-oauth2',
popup: true,
popupOptions: {
width: 450,
height: 800
webAuth.authorize({
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
responseType: 'token',
redirectUri: 'https://example.com/auth/callback'
});
webAuth.parseHash(window.location.hash, (err, authResult) => {
if (err) {
return console.log(err);
}
}, (err, profile, idToken, accessToken, state) => {
if (err) {
alert("something went wrong: " + err.message);
return;
}
alert('hello ' + profile.name);
// The contents of authResult depend on which authentication parameters were used.
// It can include the following:
// authResult.accessToken - access token for the API specified by `audience`
// authResult.expiresIn - string with the access token's expiration time in seconds
// authResult.idToken - ID token JWT containing user profile information
webAuth.client.userInfo(authResult.accessToken, (err, user) => {
// Now you have the user's information
});
});
webAuth.renewAuth({
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
redirectUri: 'https://example.com/auth/silent-callback',
// this will use postMessage to comunicate between the silent callback
// and the SPA. When false the SDK will attempt to parse the url hash
// should ignore the url hash and no extra behaviour is needed.
usePostMessage: true
}, function (err, authResult) {
// Renewed tokens or error
});
webAuth.changePassword({connection: 'the_connection',
email: 'me@example.com',
password: '123456'
}, (err) => {});
webAuth.passwordlessStart({
connection: 'the_connection',
email: 'me@example.com',
send: 'code'
}, (err, data) => {});
webAuth.signupAndAuthorize({
connection: 'the_connection',
email: 'me@example.com',
password: '123456',
scope: 'openid'
}, function (err, data) {
});
webAuth.client.login({
ealm: 'Username-Password-Authentication', //connection name or HRD domain
username: 'info@auth0.com',
password: 'areallystrongpassword',
audience: 'https://mystore.com/api/v2',
scope: 'read:order write:order',
}, function(err, authResult) {
// Auth tokens in the result or an error
});
let authentication = new auth0.Authentication({
domain: 'me.auth0.com',
clientID: '...',
redirectUri: 'http://page.com/callback',
responseType: 'code',
_sendTelemetry: false
});
authentication.buildAuthorizeUrl({state:'1234'});
authentication.buildAuthorizeUrl({
responseType: 'token',
redirectUri: 'http://anotherpage.com/callback2',
prompt: 'none',
state: '1234',
connection_scope: 'scope1,scope2'
});
authentication.buildLogoutUrl('asdfasdfds');
authentication.buildLogoutUrl();
authentication.userInfo('abcd1234', (err, data) => {
//user info retrieved
});
authentication.delegation({
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
refresh_token: 'your_refresh_token',
api_type: 'app'
}, (err, data) => {
});
authentication.loginWithDefaultDirectory({
username: 'someUsername',
password: '123456'
}, (err, data) => {
});
authentication.oauthToken({
username: 'someUsername',
password: '123456',
grantType: 'password'
}, (err, data) => {
});
authentication.getUserCountry((err, data) => {
});
authentication.getSSOData();
authentication.getSSOData(true, (err, data) => {});
authentication.dbConnection.signup({connection: 'bla', email: 'blabla', password: '123456'}, () => {});
authentication.dbConnection.changePassword({connection: 'bla', email: 'blabla', password: '123456'}, () => {});
authentication.passwordless.start({ connection: 'bla', send: 'blabla' }, () => {});
authentication.passwordless.verify({ connection: 'bla', send: 'link', verificationCode: 'asdfasd', email: 'me@example.com' }, () => {});
authentication.loginWithResourceOwner({
username: 'the username',
password: 'the password',
connection: 'the_connection',
scope: 'openid'
}, (err, data) => {});
let management = new auth0.Management({
domain: 'me.auth0.com',
token: 'token'
});
management.getUser('asd', (err, user) => {});
management.patchUserMetadata('asd', {role: 'admin'}, (err, user) => {});
management.linkUser('asd', 'eqwe', (err, user) => {});

584
auth0-js/index.d.ts vendored
View File

@ -1,136 +1,456 @@
// Type definitions for Auth0.js
// Type definitions for Auth0.js v8.1.3
// Project: https://github.com/auth0/auth0.js
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions by: Adrian Chia <https://github.com/adrianchia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** Extensions to the browser Window object. */
interface Window {
/** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
token: string;
}
/** This is the interface for the main Auth0 client. */
interface Auth0Static {
new(options: Auth0ClientOptions): Auth0Static;
changePassword(options: any, callback?: Function): void;
decodeJwt(jwt: string): any;
login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
logout(query: string): void;
getConnections(callback?: Function): void;
refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
getSSOData(withActiveDirectories: any, callback?: Function): void;
parseHash(hash: string): Auth0DecodedHash;
signup(options: Auth0SignupOptions, callback: Function): void;
validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
}
/** Represents constructor options for the Auth0 client. */
interface Auth0ClientOptions {
clientID: string;
callbackURL: string;
callbackOnLocationHash?: boolean;
responseType?: string;
domain: string;
forceJSONP?: boolean;
}
/** Represents a normalized UserProfile. */
interface Auth0UserProfile {
email: string;
email_verified: boolean;
family_name: string;
gender: string;
given_name: string;
locale: string;
name: string;
nickname: string;
picture: string;
user_id: string;
/** Represents one or more Identities that may be associated with the User. */
identities: Auth0Identity[];
user_metadata?: any;
app_metadata?: any;
}
/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
interface MicrosoftUserProfile extends Auth0UserProfile {
emails: string[];
}
/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
interface Office365UserProfile extends Auth0UserProfile {
tenantid: string;
upn: string;
}
/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
interface AdfsUserProfile extends Auth0UserProfile {
issuer: string;
}
/** Represents multiple identities assigned to a user. */
interface Auth0Identity {
access_token: string;
connection: string;
isSocial: boolean;
provider: string;
user_id: string;
}
interface Auth0DecodedHash {
access_token: string;
idToken: string;
profile: Auth0UserProfile;
state: any;
error: string;
}
interface Auth0PopupOptions {
width: number;
height: number;
}
interface Auth0LoginOptions {
auto_login?: boolean;
responseType?: string;
connection?: string;
email?: string;
username?: string;
password?: string;
popup?: boolean;
popupOptions?: Auth0PopupOptions;
}
interface Auth0SignupOptions extends Auth0LoginOptions {
auto_login: boolean;
}
interface Auth0Error {
code: any;
details: any;
name: string;
message: string;
status: any;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
expires_in: string;
/** The JWT for delegated access. */
id_token: string;
/** The type of token being returned. Possible values: "Bearer" */
token_type: string;
}
declare const Auth0: Auth0Static;
declare module "auth0-js" {
export = Auth0
declare namespace auth0 {
export class Authentication {
constructor(options: AuthOptions);
passwordless: PasswordlessAuthentication;
dbConnection: DBConnection;
/**
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
*
* @method buildAuthorizeUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
buildAuthorizeUrl(options: any): string;
/**
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
*
* @method buildLogoutUrl
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
buildLogoutUrl(options?: any): string;
/**
* Makes a call to the `oauth/token` endpoint with `password` grant type
*
* @method loginWithDefaultDirectory
* @param {Object} options: https://auth0.com/docs/api-auth/grant/password
* @param {Function} callback
*/
loginWithDefaultDirectory(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `/ro` endpoint
* @param {any} options
* @param {Function} callback
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
*/
loginWithResourceOwner(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
* @param {any} options
* @param {Function} callback
*/
login(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `oauth/token` endpoint
* @param {any} options
* @param {Function} callback
*/
oauthToken(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Boolean} withActiveDirectories
* @param {Function} callback
* @deprecated `getSSOData` will be soon deprecated.
*/
getSSOData(callback?: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `/ssodata` endpoint
*
* @method getSSOData
* @param {Boolean} withActiveDirectories
* @param {Function} callback
* @deprecated `getSSOData` will be soon deprecated.
*/
getSSOData(withActiveDirectories: boolean, callback?: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Makes a call to the `/userinfo` endpoint and returns the user profile
*
* @method userInfo
* @param {String} accessToken
* @param {Function} callback
*/
userInfo(token: string, callback: (error?: Auth0Error, user?: any) => any): void;
/**
* Makes a call to the `/delegation` endpoint
*
* @method delegation
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation
* @param {Function} callback
* @deprecated `delegation` will be soon deprecated.
*/
delegation(options: any, callback: (error?: Auth0Error, authResult?: Auth0DelegationToken) => any): any;
/**
* Fetches the user country based on the ip.
*
* @method getUserCountry
* @param {Function} callback
*/
getUserCountry(callback: (error?: Auth0Error, result?: any) => any): void;
}
export class PasswordlessAuthentication {
constructor(request: any, option: any);
/**
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
*
* @method buildVerifyUrl
* @param {Object} options
* @param {Function} callback
*/
buildVerifyUrl(options: any): string;
/**
* Initializes a new passwordless authN/authZ transaction
*
* @method start
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
* @param {Function} callback
*/
start(options: PasswordlessStartOptions, callback: any): void;
/**
* Verifies the passwordless TOTP and returns an error if any.
*
* @method buildVerifyUrl
* @param {Object} options
* @param {Function} callback
*/
verify(options: any, callback: any): void;
}
export class DBConnection {
constructor(request: any, option: any);
/**
* Signup a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} calback
*/
signup(options: any, callback: any): void;
/**
* Initializes the change password flow
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: ChangePasswordOptions, callback: any): void;
}
export class Management {
constructor(options: ManagementOptions);
/**
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
*
* @method getUser
* @param {String} userId
* @param {Function} callback
*/
getUser(userId: string, callback: (error?: Auth0Error, user?: any) => any): void;
/**
* Updates the user metdata. It will patch the user metdata with the attributes sent.
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
*
* @method patchUserMetadata
* @param {String} userId
* @param {Object} userMetadata
* @param {Function} callback
*/
patchUserMetadata(userId: string, userMetadata: any, callback: (error?: Auth0Error, user?: any) => any): void;
/**
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
*
* @method linkUser
* @param {String} userId
* @param {String} secondaryUserToken
* @param {Function} callback
*/
linkUser(userId: string, secondaryUserToken: string, callback: (error?: Auth0Error, user?: any) => any): void;
}
export class WebAuth {
constructor(options: AuthOptions);
client: Authentication;
popup: Popup;
redirect: Redirect;
/**
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
*/
authorize(options: any): void;
/**
* Parse the url hash and extract the returned tokens depending on the transaction.
*
* Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
* accepted.
*
* @method parseHash
* @param {Object} options:
* @param {String} options.state [OPTIONAL] to verify the response
* @param {String} options.nonce [OPTIONAL] to verify the id_token
* @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash
* @param {Function} callback: any(err, token_payload)
*/
parseHash(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Decodes the id_token and verifies the nonce.
*
* @method validateToken
* @param {String} token
* @param {String} state
* @param {String} nonce
* @param {Function} callback: function(err, {payload, transaction})
*/
validateToken(token: string, state: string, nonce: string, callback: any): void;
/**
* Executes a silent authentication transaction under the hood in order to fetch a new token.
*
* @method renewAuth
* @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
* @param {Function} callback
*/
renewAuth(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Initialices a change password transaction
*
* @method changePassword
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
* @param {Function} callback
*/
changePassword(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Signs up a new user
*
* @method signup
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signup(options: any, callback: any): void;
/**
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
* The login will be done using /oauth/token with password-realm grant type.
*
* @method signupAndAuthorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndAuthorize(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
/**
* Redirects to the auth0 logout page
*
* @method logout
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
*/
logout(options: any): void;
passwordlessStart(options: PasswordlessStartOptions, callback: (error?: Auth0Error, data?: any) => any): void;
/**
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: any): void;
}
export class Redirect {
constructor(client: any, options: any);
/**
* Initializes the legacy Lock login flow in a popup
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
*/
loginWithCredentials(options: any, callback: any): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndLogin(options: any, callback: any): void;
}
export class Popup {
constructor(client: any, options: any);
/**
* Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
*
* @method preload
* @param {Object} options: receives the window height and width and any other window feature to be sent to window.open
*/
preload(options: any): any;
/**
* Internal use.
*
* @method getPopupHandler
*/
getPopupHandler(options: any, preload: boolean): any;
/**
* Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
*
* @method authorize
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
* @param {Function} callback
*/
authorize(options: any, callback: any): void;
/**
* Initializes the legacy Lock login flow in a popup
*
* @method loginWithCredentials
* @param {Object} options
* @param {Function} callback
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
*/
loginWithCredentials(options: any, callback: any): void;
/**
* Verifies the passwordless TOTP and returns the requested token
*
* @method passwordlessVerify
* @param {Object} options:
* @param {Object} options.type: `sms` or `email`
* @param {Object} options.phoneNumber: only if type = sms
* @param {Object} options.email: only if type = email
* @param {Object} options.connection: the connection name
* @param {Object} options.verificationCode: the TOTP code
* @param {Function} callback
*/
passwordlessVerify(options: any, callback: any): void;
/**
* Signs up a new user and automatically logs the user in after the signup.
*
* @method signupAndLogin
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
* @param {Function} callback
*/
signupAndLogin(options: any, callback: any): void;
}
interface ManagementOptions {
domain: string;
token: string;
_sendTelemetry?: boolean;
_telemetryInfo?: any;
}
interface AuthOptions {
domain: string;
clientID: string;
responseType?: string;
responseMode?: string;
redirectUri?: string;
scope?: string;
audience?: string;
leeway?: number;
_disableDeprecationWarnings?: boolean;
_sendTelemetry?: boolean;
_telemetryInfo?: any;
}
interface PasswordlessAuthOptions {
connection: string;
verificationCode: string;
phoneNumber: string;
email: string;
}
interface Auth0Error {
error: any;
errorDescription: string
}
interface Auth0DecodedHash {
accessToken?: string;
idToken?: string;
idTokenPayload?: any;
refreshToken?: string;
state?: string;
expiresIn?: number;
tokenType?: string;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
ExpiresIn: number;
/** The JWT for delegated access. */
idToken: string;
/** The type of token being returned. Possible values: "Bearer" */
tokenType: string;
}
interface ChangePasswordOptions {
connection: string;
email: string;
password?: string;
}
interface PasswordlessStartOptions {
connection: string;
send: string;
phoneNumber?: string;
email?: string,
authParams?: any;
}
interface PasswordlessVerifyOptions {
connection: string;
verificationCode: string;
phoneNumber?: string;
email?: string;
}
}

View File

@ -0,0 +1,22 @@
/// <reference types="auth0-js/v7" />
var auth0 = new Auth0({
domain: 'mine.auth0.com',
clientID: 'dsa7d77dsa7d7',
callbackURL: 'http://my-app.com/callback',
callbackOnLocationHash: true
});
auth0.login({
connection: 'google-oauth2',
popup: true,
popupOptions: {
width: 450,
height: 800
}
}, (err, profile, idToken, accessToken, state) => {
if (err) {
alert("something went wrong: " + err.message);
return;
}
alert('hello ' + profile.name);
});

136
auth0-js/v7/index.d.ts vendored Normal file
View File

@ -0,0 +1,136 @@
// Type definitions for Auth0.js v7.x
// Project: https://github.com/auth0/auth0.js
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** Extensions to the browser Window object. */
interface Window {
/** Allows you to pass the id_token to other APIs, as specified in https://docs.auth0.com/apps-apis */
token: string;
}
/** This is the interface for the main Auth0 client. */
interface Auth0Static {
new(options: Auth0ClientOptions): Auth0Static;
changePassword(options: any, callback?: Function): void;
decodeJwt(jwt: string): any;
login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
logout(query: string): void;
getConnections(callback?: Function): void;
refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
getSSOData(withActiveDirectories: any, callback?: Function): void;
parseHash(hash: string): Auth0DecodedHash;
signup(options: Auth0SignupOptions, callback: Function): void;
validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
}
/** Represents constructor options for the Auth0 client. */
interface Auth0ClientOptions {
clientID: string;
callbackURL: string;
callbackOnLocationHash?: boolean;
responseType?: string;
domain: string;
forceJSONP?: boolean;
}
/** Represents a normalized UserProfile. */
interface Auth0UserProfile {
email: string;
email_verified: boolean;
family_name: string;
gender: string;
given_name: string;
locale: string;
name: string;
nickname: string;
picture: string;
user_id: string;
/** Represents one or more Identities that may be associated with the User. */
identities: Auth0Identity[];
user_metadata?: any;
app_metadata?: any;
}
/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
interface MicrosoftUserProfile extends Auth0UserProfile {
emails: string[];
}
/** Represents an Auth0UserProfile that has an Office365 account as the primary identity. */
interface Office365UserProfile extends Auth0UserProfile {
tenantid: string;
upn: string;
}
/** Represents an Auth0UserProfile that has an Active Directory account as the primary identity. */
interface AdfsUserProfile extends Auth0UserProfile {
issuer: string;
}
/** Represents multiple identities assigned to a user. */
interface Auth0Identity {
access_token: string;
connection: string;
isSocial: boolean;
provider: string;
user_id: string;
}
interface Auth0DecodedHash {
access_token: string;
idToken: string;
profile: Auth0UserProfile;
state: any;
error: string;
}
interface Auth0PopupOptions {
width: number;
height: number;
}
interface Auth0LoginOptions {
auto_login?: boolean;
responseType?: string;
connection?: string;
email?: string;
username?: string;
password?: string;
popup?: boolean;
popupOptions?: Auth0PopupOptions;
}
interface Auth0SignupOptions extends Auth0LoginOptions {
auto_login: boolean;
}
interface Auth0Error {
code: any;
details: any;
name: string;
message: string;
status: any;
}
/** Represents the response from an API Token Delegation request. */
interface Auth0DelegationToken {
/** The length of time in seconds the token is valid for. */
expires_in: string;
/** The JWT for delegated access. */
id_token: string;
/** The type of token being returned. Possible values: "Bearer" */
token_type: string;
}
declare const Auth0: Auth0Static;
declare module "auth0-js" {
export = Auth0
}

28
auth0-js/v7/tsconfig.json Normal file
View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"auth0-js": [
"auth0-js/v7"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"auth0-js-tests.ts"
]
}

View File

@ -1,4 +1,4 @@
/// <reference types="auth0-js" />
/// <reference types="auth0-js/v7" />
/// <reference path="index.d.ts" />
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";

View File

@ -3,7 +3,7 @@
// Definitions by: Brian Caruso <https://github.com/carusology>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="auth0-js" />
/// <reference types="auth0-js/v7" />
interface Auth0LockAdditionalSignUpFieldOption {
value: string;

View File

@ -1,4 +1,4 @@
/// <reference types="auth0-js" />
/// <reference types="auth0-js/v7" />
var widget: Auth0WidgetStatic = new Auth0Widget({

View File

@ -3,7 +3,7 @@
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="auth0-js" />
/// <reference types="auth0-js/v7" />
interface Auth0WidgetStatic {

View File

@ -6,11 +6,48 @@ var anyObj: any = { abc: 123 };
var num: number = 5;
var error: Error = new Error();
var b: boolean = true;
var apiGwEvt: AWSLambda.APIGatewayEvent;
var clientCtx: AWSLambda.ClientContext;
var clientContextEnv: AWSLambda.ClientContextEnv;
var clientContextClient: AWSLambda.ClientContextClient;
var context: AWSLambda.Context;
var identity: AWSLambda.CognitoIdentity;
var proxyResult: AWSLambda.ProxyResult;
/* API Gateway Event */
str = apiGwEvt.body;
str = apiGwEvt.headers["example"];
str = apiGwEvt.httpMethod;
b = apiGwEvt.isBase64Encoded;
str = apiGwEvt.path;
str = apiGwEvt.pathParameters["example"];
str = apiGwEvt.queryStringParameters["example"];
str = apiGwEvt.stageVariables["example"];
str = apiGwEvt.requestContext.accountId;
str = apiGwEvt.requestContext.apiId;
str = apiGwEvt.requestContext.httpMethod;
str = apiGwEvt.requestContext.identity.accessKey;
str = apiGwEvt.requestContext.identity.accountId;
str = apiGwEvt.requestContext.identity.apiKey;
str = apiGwEvt.requestContext.identity.caller;
str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider;
str = apiGwEvt.requestContext.identity.cognitoAuthenticationType;
str = apiGwEvt.requestContext.identity.cognitoIdentityId;
str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId;
str = apiGwEvt.requestContext.identity.sourceIp;
str = apiGwEvt.requestContext.identity.user;
str = apiGwEvt.requestContext.identity.userAgent;
str = apiGwEvt.requestContext.identity.userArn;
str = apiGwEvt.requestContext.stage;
str = apiGwEvt.requestContext.requestId;
str = apiGwEvt.requestContext.resourceId;
str = apiGwEvt.requestContext.resourcePath;
str = apiGwEvt.resource;
/* Lambda Proxy Result */
num = proxyResult.statusCode;
str = proxyResult.headers["example"];
str = proxyResult.body
/* Context */
b = context.callbackWaitsForEmptyEventLoop;
@ -54,6 +91,15 @@ function callback(cb: AWSLambda.Callback) {
cb(error);
cb(null, anyObj);
}
/* Proxy Callback */
function proxyCallback(cb: AWSLambda.ProxyCallback) {
cb();
cb(null);
cb(error);
cb(null, proxyResult);
}
/* Compatibility functions */
context.done();
context.done(error);
@ -66,3 +112,4 @@ context.fail(str);
/* Handler */
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {};
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {};

48
aws-lambda/index.d.ts vendored
View File

@ -1,8 +1,44 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// API Gateway "event"
interface APIGatewayEvent {
body: string | null;
headers: { [name: string]: string };
httpMethod: string;
isBase64Encoded: boolean;
path: string;
pathParameters: { [name: string]: string } | null;
queryStringParameters: { [name: string]: string } | null;
stageVariables: { [name: string]: string } | null;
requestContext: {
accountId: string;
apiId: string;
httpMethod: string;
identity: {
accessKey: string | null;
accountId: string | null;
apiKey: string | null;
caller: string | null;
cognitoAuthenticationProvider: string | null;
cognitoAuthenticationType: string | null;
cognitoIdentityId: string | null;
cognitoIdentityPoolId: string | null;
sourceIp: string;
user: string | null;
userAgent: string | null;
userArn: string | null;
},
stage: string;
requestId: string;
resourceId: string;
resourcePath: string;
};
resource: string;
}
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
interface Context {
@ -58,6 +94,14 @@ interface ClientContextEnv {
locale: string;
}
interface ProxyResult {
statusCode: number;
headers?: {
[header: string]: string;
},
body: string;
}
/**
* AWS Lambda handler function.
* http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html
@ -67,6 +111,7 @@ interface ClientContextEnv {
* @param callback optional callback to return information to the caller, otherwise return value is null.
*/
export type Handler = (event: any, context: Context, callback?: Callback) => void;
export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => void;
/**
* Optional callback parameter.
@ -76,5 +121,6 @@ export type Handler = (event: any, context: Context, callback?: Callback) => vo
* @param result an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible.
*/
export type Callback = (error?: Error, result?: any) => void;
export type ProxyCallback = (error?: Error, result?: ProxyResult) => void;
export as namespace AWSLambda;

View File

@ -1,107 +0,0 @@
enum HttpMethod { GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH }
enum ResponseType { arraybuffer, blob, document, json, text }
interface Repository {
id: number;
name: string;
}
interface Issue {
id: number;
title: string;
}
axios.interceptors.request.use<any>(config => {
console.log("Method:" + config.method + " Url:" +config.url);
return config;
});
const requestId: number = axios.interceptors.request.use<any>(
(config) => {
console.log("Method:" + config.method + " Url:" +config.url);
return config;
},
(error: any) => error);
axios.interceptors.request.eject(requestId);
axios.interceptors.request.eject(7);
axios.interceptors.response.use<any>(config => {
console.log("Status:" + config.status);
return config;
});
const responseId: number = axios.interceptors.response.use<any>(
config => {
console.log("Status:" + config.status);
return config;
},
(error: any) => error);
axios.interceptors.response.eject(responseId);
axios.get<Repository>("https://api.github.com/repos/mzabriskie/axios")
.then(r => console.log(r.config.method));
var getRepoDetails = axios<Repository>({
url: "https://api.github.com/repos/mzabriskie/axios",
method: HttpMethod[HttpMethod.GET],
headers: {},
}).then(r => {
console.log("ID:" + r.data.id + " Name: " + r.data.name);
return r;
});
axios.post("http://example.com/", {}, {
transformRequest: (data: any) => data
});
axios.post("http://example.com/", {
headers: {'X-Custom-Header': 'foobar'}
}, {
transformRequest: [
(data: any) => data
]
});
var config: Axios.AxiosXHRConfigBase<any> = {headers: {}};
config.headers['X-Custom-Header'] = 'baz';
axios.post("http://example.com/", config);
var getRepoIssue = axios.get<Issue>("https://api.github.com/repos/mzabriskie/axios/issues/1");
var axiosInstance = axios.create({
baseURL: "https://api.github.com/repos/mzabriskie/axios/",
timeout: 1000
});
axiosInstance.request({url: "issues/1"}).then(res => {
if (res.headers['content-type'].startsWith('application/json')) {
throw new Error('Unexpected content-type');
}
});
axios.all<Repository, Repository>([getRepoDetails, getRepoDetails]).then(([repo1, repo2]) => {
var sumIds = repo1.data.id + repo2.data.id;
console.log("Sum ID:" + sumIds);
return sumIds;
});
var repoSum = (repo1: Axios.AxiosXHR<Repository>, repo2: Axios.AxiosXHR<Repository>) => {
var sumIds = repo1.data.id + repo2.data.id;
console.log("Sum ID:" + sumIds);
return sumIds;
};
axios.all<Repository, Repository>([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum));
axios.defaults.baseURL = 'https://api.example.com';
axios.defaults.headers.common['Authorization'] = "AUTH_TOKEN";
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN";

316
axios/index.d.ts vendored
View File

@ -1,316 +0,0 @@
// Type definitions for axios 0.9.1
// Project: https://github.com/mzabriskie/axios
// Definitions by: Marcel Buesing <https://github.com/marcelbuesing>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Axios {
interface IThenable<R> {
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => U | IThenable<U>): IThenable<U>;
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => void): IThenable<U>;
}
interface IPromise<R> extends IThenable<R> {
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => U | IThenable<U>): IPromise<U>;
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => void): IPromise<U>;
catch<U>(onRejected?: (error: any) => U | IThenable<U>): IPromise<U>;
}
/**
* HTTP Basic auth details
*/
interface AxiosHttpBasicAuth {
username: string;
password: string;
}
/**
* Common axios XHR config interface
* <T> - request body data type
*/
interface AxiosXHRConfigBase<T> {
/**
* will be prepended to `url` unless `url` is absolute.
* It can be convenient to set `baseURL` for an instance
* of axios to pass relative URLs to methods of that instance.
*/
baseURL?: string;
/**
* custom headers to be sent
*/
headers?: {[key: string]: any};
/**
* URL parameters to be sent with the request
*/
params?: Object;
/**
* optional function in charge of serializing `params`
* (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
*/
paramsSerializer?: (params: Object) => string;
/**
* specifies the number of milliseconds before the request times out.
* If the request takes longer than `timeout`, the request will be aborted.
*/
timeout?: number;
/**
* indicates whether or not cross-site Access-Control requests
* should be made using credentials
*/
withCredentials?: boolean;
/**
* indicates that HTTP Basic auth should be used, and supplies
* credentials. This will set an `Authorization` header,
* overwriting any existing `Authorization` custom headers you have
* set using `headers`.
*/
auth?: AxiosHttpBasicAuth;
/**
* indicates the type of data that the server will respond with
* options are 'arraybuffer', 'blob', 'document', 'json', 'text'
*/
responseType?: string;
/**
* name of the cookie to use as a value for xsrf token
*/
xsrfCookieName?: string;
/**
* name of the http header that carries the xsrf token value
*/
xsrfHeaderName?: string;
/**
* Change the request data before it is sent to the server.
* This is only applicable for request methods 'PUT', 'POST', and 'PATCH'
* The last function in the array must return a string or an ArrayBuffer
*/
transformRequest?: (<U>(data: T) => U) | [<U>(data: T) => U];
/**
* change the response data to be made before it is passed to then/catch
*/
transformResponse?: <U>(data: T) => U;
/**
* defines whether to resolve or reject the promise for a given HTTP response status code.
* If returns `true` (or is set to `null` or `undefined`), the promise will be resolved;
* otherwise, the promise will be rejected
*/
validateStatus?: (status: number) => boolean | undefined;
}
/**
* <T> - request body data type
*/
interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
/**
* server URL that will be used for the request, options are:
* GET, PUT, POST, DELETE, CONNECT, HEAD, OPTIONS, TRACE, PATCH
*/
url: string;
/**
* request method to be used when making the request
*/
method?: string;
/**
* data to be sent as the request body
* Only applicable for request methods 'PUT', 'POST', and 'PATCH'
* When no `transformRequest` is set, must be a string, an ArrayBuffer or a hash
*/
data?: T;
}
interface AxiosXHRConfigDefaults<T> extends AxiosXHRConfigBase<T> {
/**
* custom headers to be sent
*/
headers: {
common: {[index: string]: string};
patch: {[index: string]: string};
post: {[index: string]: string};
put: {[index: string]: string};
};
}
/**
* <T> - expected response type,
* <U> - request body data type
*/
interface AxiosXHR<T> {
/**
* Response that was provided by the server
*/
data: T;
/**
* HTTP status code from the server response
*/
status: number;
/**
* HTTP status message from the server response
*/
statusText: string;
/**
* headers that the server responded with
*/
headers: {[index: string]: any};
/**
* config that was provided to `axios` for the request
*/
config: AxiosXHRConfig<T>;
}
interface Interceptor {
/**
* intercept request before it is sent
*/
request: RequestInterceptor;
/**
* intercept response of request when it is received.
*/
response: ResponseInterceptor
}
type InterceptorId = number;
interface RequestInterceptor {
/**
* <U> - request body data type
*/
use<U>(fulfilledFn: (config: AxiosXHRConfig<U>) => AxiosXHRConfig<U>): InterceptorId;
use<U>(fulfilledFn: (config: AxiosXHRConfig<U>) => AxiosXHRConfig<U>,
rejectedFn: (error: any) => any)
: InterceptorId;
eject(interceptorId: InterceptorId): void;
}
interface ResponseInterceptor {
/**
* <T> - expected response type
*/
use<T>(fulfilledFn: (config: Axios.AxiosXHR<T>) => Axios.AxiosXHR<T>): InterceptorId;
use<T>(fulfilledFn: (config: Axios.AxiosXHR<T>) => Axios.AxiosXHR<T>,
rejectedFn: (error: any) => any)
: InterceptorId;
eject(interceptorId: InterceptorId): void;
}
/**
* <T> - expected response type,
* <U> - request body data type
*/
interface AxiosInstance {
/**
* Send request as configured
*/
<T>(config: AxiosXHRConfig<T>): IPromise<AxiosXHR<T>>;
/**
* Send request as configured
*/
new <T>(config: AxiosXHRConfig<T>): IPromise<AxiosXHR<T>>;
/**
* Send request as configured
*/
request<T>(config: AxiosXHRConfig<T>): IPromise<AxiosXHR<T>>;
/**
* intercept requests or responses before they are handled by then or catch
*/
interceptors: Interceptor;
/**
* Config defaults
*/
defaults: AxiosXHRConfigDefaults<any>;
/**
* equivalent to `Promise.all`
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>, T8 | IPromise<AxiosXHR<T8>>, T9 | IPromise<AxiosXHR<T9>>, T10 | IPromise<AxiosXHR<T10>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>, AxiosXHR<T8>, AxiosXHR<T9>, AxiosXHR<T10>]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>, T8 | IPromise<AxiosXHR<T8>>, T9 | IPromise<AxiosXHR<T9>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>, AxiosXHR<T8>, AxiosXHR<T9>]>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>, T8 | IPromise<AxiosXHR<T8>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>, AxiosXHR<T8>]>;
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>, T7 | IPromise<AxiosXHR<T7>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>, AxiosXHR<T7>]>;
all<T1, T2, T3, T4, T5, T6>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>, T6 | IPromise<AxiosXHR<T6>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>, AxiosXHR<T6>]>;
all<T1, T2, T3, T4, T5>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>, T5 | IPromise<AxiosXHR<T5>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>, AxiosXHR<T5>]>;
all<T1, T2, T3, T4>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>, T4 | IPromise<AxiosXHR<T4>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>, AxiosXHR<T4>]>;
all<T1, T2, T3>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>, T3 | IPromise<AxiosXHR<T3>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>, AxiosXHR<T3>]>;
all<T1, T2>(values: [T1 | IPromise<AxiosXHR<T1>>, T2 | IPromise<AxiosXHR<T2>>]): IPromise<[AxiosXHR<T1>, AxiosXHR<T2>]>;
/**
* spread array parameter to `fn`.
* note: alternative to `spread`, destructuring assignment.
*/
spread<T1, T2, U>(fn: (t1: T1, t2: T2) => U): (arr: ([T1, T2])) => U;
/**
* convenience alias, method = GET
*/
get<T>(url: string, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
/**
* convenience alias, method = DELETE
*/
delete<T>(url: string, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
/**
* convenience alias, method = HEAD
*/
head<T>(url: string, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
/**
* convenience alias, method = POST
*/
post<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
/**
* convenience alias, method = PUT
*/
put<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
/**
* convenience alias, method = PATCH
*/
patch<T>(url: string, data?: any, config?: AxiosXHRConfigBase<T>): IPromise<AxiosXHR<T>>;
}
/**
* <T> - expected response type,
*/
interface AxiosStatic extends AxiosInstance {
/**
* create a new instance of axios with a custom config
*/
create<T>(config: AxiosXHRConfigBase<T>): AxiosInstance;
}
}
declare var axios: Axios.AxiosStatic;
declare module "axios" {
export = axios;
}

2
bintrees/index.d.ts vendored
View File

@ -5,7 +5,7 @@
declare module 'bintrees' {
type Callback = <T>(err: Error, item: T) => void;
type Callback = <T>(item: T) => void;
type Comparator = <T>(a: T, b: T) => number;
class Iterator<T> {

View File

@ -2,6 +2,7 @@
// Project: http://bookshelfjs.org/
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import Knex = require('knex');
import knex = require('knex');

View File

@ -58,7 +58,7 @@ declare class BufferStream extends stream.Duplex {
shortcut for buffer.length
*/
length: number;
}
} // https://github.com/dodo/node-bufferstream/blob/master/src/buffer-stream.coffee#L28
declare namespace BufferStream {
export interface Opts {

9
c3/index.d.ts vendored
View File

@ -248,6 +248,15 @@ declare namespace c3 {
*/
width?: number;
};
spline?: {
interpolation?: {
/**
* Set custom spline interpolation
*/
type?: 'linear' | 'linear-closed' | 'basis' | 'basis-open' | 'basis-closed' | 'bundle' | 'cardinal' | 'cardinal-open' | 'cardinal-closed' | 'monotone';
};
};
}
interface Data {

View File

@ -8,6 +8,7 @@
/// <reference types="enzyme" />
/// <reference types="chai" />
/// <reference types="react" />
/// <reference types="cheerio" />
declare namespace Chai {
type EnzymeSelector = string | React.StatelessComponent<any> | React.ComponentClass<any> | { [key: string]: any };
@ -143,9 +144,9 @@ declare namespace Chai {
}
declare module "chai-enzyme" {
import { ShallowWrapper, ReactWrapper, CheerioWrapper } from "enzyme";
import { ShallowWrapper, ReactWrapper } from "enzyme";
type DebugWrapper = ShallowWrapper<any,any> | CheerioWrapper<any, any> | ReactWrapper<any, any>;
type DebugWrapper = ShallowWrapper<any,any> | Cheerio | ReactWrapper<any, any>;
function chaiEnzyMe(wrapper?: (debugWrapper: DebugWrapper) => string): (chai: any) => void;
module chaiEnzyMe {

View File

@ -55,6 +55,7 @@ declare namespace ChaiHttp {
send(data: Object): Request;
auth(user: string, name: string): Request;
field(name: string, val: string): Request;
buffer(): Request;
end(callback?: (err: any, res: Response) => void): FinishedRequest;
}

View File

@ -9,19 +9,19 @@ import ChaiJsonSchema = require('chai-json-schema');
chai.use(ChaiJsonSchema);
chai.should();
let goodApple = {
const goodApple = {
skin: 'thin',
colors: ['red', 'green', 'yellow'],
taste: 10
};
let badApple = {
const badApple = {
colors: ['brown'],
taste: 0,
worms: 2
};
let fruitSchema = {
const fruitSchema = {
title: 'fresh fruit schema v1',
type: 'object',
required: ['skin', 'colors', 'taste'],
@ -54,3 +54,17 @@ badApple.should.not.be.jsonSchema(fruitSchema);
//tdd style
assert.jsonSchema(goodApple, fruitSchema);
assert.notJsonSchema(badApple, fruitSchema);
// tv4
const schema = {
items: {
type: 'boolean'
}
};
const data1 = [true, false];
const data2 = [true, 123];
expect(chai.tv4.validate(data1, schema)).to.be.true;
expect(chai.tv4.validate(data2, schema)).to.be.false;

View File

@ -5,6 +5,7 @@
// <reference types="node"/>
// <reference types="chai" />
import tv4 = require('tv4');
declare global {
namespace Chai {
@ -16,6 +17,10 @@ declare global {
export interface LanguageChains {
jsonSchema(schema: any, msg?: string): void;
}
export interface ChaiStatic {
tv4: tv4.TV4;
}
}
}

1
chrome/index.d.ts vendored
View File

@ -7267,6 +7267,7 @@ declare namespace chrome.webRequest {
interface WebResponseHeadersDetails extends WebResponseDetails {
/** Optional. The HTTP response headers that have been received with this response. */
responseHeaders?: HttpHeader[];
method: string; /** standard HTTP method i.e. GET, POST, PUT, etc. */
}
interface WebResponseCacheDetails extends WebResponseHeadersDetails {

View File

@ -0,0 +1,16 @@
import * as commentJson from 'comment-json';
const result = commentJson.parse(`
/**
block comment at the top
*/
// comment at the top
{
// comment for a
// comment line 2 for a
/* block comment */
"a": 1 // comment at right
}
// comment at the bottom
`);
const str = commentJson.stringify(result);

8
comment-json/index.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
// Type definitions for comment-json 1.1
// Project: https://github.com/kaelzhang/node-comment-json
// Definitions by: Jason Dent <https://github.com/Jason3S>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export type Reviver = (k: number | string, v: any) => any;
export function parse(json: string, reviver?: Reviver, removes_comments?: boolean): any;
export function stringify(value: any, replacer?: any, space?: string | number): string;

View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"comment-json-tests.ts"
]
}

1
comment-json/tslint.json Normal file
View File

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

View File

@ -10,7 +10,8 @@ declare namespace creditCardType {
interface CreditCardTypeInfo {
niceType?: string
type?: CardBrand
pattern?: RegExp
prefixPattern?: RegExp
exactPattern?: RegExp
gaps?: Array<number>
lengths?: Array<number>
code?: {

6
cron/index.d.ts vendored
View File

@ -1,4 +1,4 @@
// Type definitions for cron 1.0.9
// Type definitions for cron 1.2
// Project: https://www.npmjs.com/package/cron
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -6,9 +6,9 @@
interface CronJobStatic {
new (cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any): CronJob;
new (cronTime: string | Date, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean): CronJob;
new (options: {
cronTime: string | Date; onTick: () => void; onComplete?: () => void; start?: boolean; timeZone?: string; context?: any
cronTime: string | Date; onTick: () => void; onComplete?: () => void; start?: boolean; timeZone?: string; context?: any; runOnInit?: boolean
}): CronJob;
}
interface CronJob {

3
crypto-js/aes/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { AES } from '../index';
export = AES;

3
crypto-js/core/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import * as Core from '../index';
export = Core;

4
crypto-js/enc-base64/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { enc } from '../index';
declare const Base64: typeof enc.Base64;
export = Base64;

4
crypto-js/enc-hex/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { enc } from '../index';
declare const Hex: typeof enc.Hex;
export = Hex;

4
crypto-js/enc-latin1/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { enc } from '../index';
declare const Latin1: typeof enc.Latin1;
export = Latin1;

4
crypto-js/enc-utf16/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { enc } from '../index';
declare const Utf16: typeof enc.Utf16;
export = Utf16;

4
crypto-js/enc-utf8/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { enc } from '../index';
declare const Utf8: typeof enc.Utf8;
export = Utf8;

3
crypto-js/evpkdf/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { EvpKDF } from '../index';
export = EvpKDF;

4
crypto-js/format-hex/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { format } from '../index';
declare const Hex: typeof format.Hex;
export = Hex;

4
crypto-js/format-openssl/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { format } from '../index';
declare const OpenSSL: typeof format.OpenSSL;
export = OpenSSL;

3
crypto-js/hmac-md5/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacMD5 } from '../index';
export = HmacMD5;

3
crypto-js/hmac-ripemd160/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacRIPEMD160 } from '../index';
export = HmacRIPEMD160;

3
crypto-js/hmac-sha1/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacSHA1 } from '../index';
export = HmacSHA1;

3
crypto-js/hmac-sha224/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacSHA224 } from '../index';
export = HmacSHA224;

3
crypto-js/hmac-sha256/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacSHA256 } from '../index';
export = HmacSHA256;

3
crypto-js/hmac-sha3/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacSHA3 } from '../index';
export = HmacSHA3;

3
crypto-js/hmac-sha384/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacSHA384 } from '../index';
export = HmacSHA384;

3
crypto-js/hmac-sha512/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { HmacSHA512 } from '../index';
export = HmacSHA512;

View File

@ -114,4 +114,3 @@ declare namespace CryptoJS {
};
}
}

2
crypto-js/lib-typedarrays/index.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare const LibTypedarrays: any;
export = LibTypedarrays;

3
crypto-js/md5/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { MD5 } from '../index';
export = MD5;

4
crypto-js/mode-cfb/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { mode } from '../index';
declare const CFB: typeof mode.CFB;
export = CFB;

4
crypto-js/mode-ctr-gladman/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { mode } from '../index';
declare const CTRGladman: typeof mode.CTRGladman;
export = CTRGladman;

4
crypto-js/mode-ctr/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { mode } from '../index';
declare const CTR: typeof mode.CTR;
export = CTR;

4
crypto-js/mode-ecb/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { mode } from '../index';
declare const ECB: typeof mode.ECB;
export = ECB;

4
crypto-js/mode-ofb/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { mode } from '../index';
declare const OFB: typeof mode.OFB;
export = OFB;

4
crypto-js/pad-ansix923/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { pad } from '../index';
declare const AnsiX923: typeof pad.AnsiX923;
export = AnsiX923;

4
crypto-js/pad-iso10126/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { pad } from '../index';
declare const Iso10126: typeof pad.Iso10126;
export = Iso10126;

4
crypto-js/pad-iso97971/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { pad } from '../index';
declare const Iso97971: typeof pad.Iso97971;
export = Iso97971;

4
crypto-js/pad-nopadding/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { pad } from '../index';
declare const NoPadding: typeof pad.NoPadding;
export = NoPadding;

4
crypto-js/pad-pkcs7/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { pad } from '../index';
declare const Pkcs7: typeof pad.Pkcs7;
export = Pkcs7;

4
crypto-js/pad-zeropadding/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
import { pad } from '../index';
declare const ZeroPadding: typeof pad.ZeroPadding;
export = ZeroPadding;

3
crypto-js/pbkdf2/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { PBKDF2 } from '../index';
export = PBKDF2;

3
crypto-js/rabbit-legacy/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { RabbitLegacy } from '../index';
export = RabbitLegacy;

3
crypto-js/rabbit/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { Rabbit } from '../index';
export = Rabbit;

3
crypto-js/rc4/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { RC4 } from '../index';
export = RC4;

3
crypto-js/ripemd160/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { RIPEMD160 } from '../index';
export = RIPEMD160;

3
crypto-js/sha1/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { SHA1 } from '../index';
export = SHA1;

3
crypto-js/sha224/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { SHA224 } from '../index';
export = SHA224;

3
crypto-js/sha256/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { SHA256 } from '../index';
export = SHA256;

3
crypto-js/sha3/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { SHA3 } from '../index';
export = SHA3;

3
crypto-js/sha384/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { SHA384 } from '../index';
export = SHA384;

3
crypto-js/sha512/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { SHA512 } from '../index';
export = SHA512;

View File

@ -0,0 +1,184 @@
import Core = require('../core');
import X64Core = require('../x64-core');
import LibTypedarrays = require('../lib-typedarrays');
// ---
import MD5 = require('../md5');
import SHA1 = require('../sha1');
import SHA256 = require('../sha256');
import SHA224 = require('../sha224');
import SHA512 = require('../sha512');
import SHA384 = require('../sha384');
import SHA3 = require('../sha3');
import RIPEMD160 = require('../ripemd160');
// ---
import HmacMD5 = require('../hmac-md5');
import HmacSHA1 = require('../hmac-sha1');
import HmacSHA256 = require('../hmac-sha256');
import HmacSHA224 = require('../hmac-sha224');
import HmacSHA512 = require('../hmac-sha512');
import HmacSHA384 = require('../hmac-sha384');
import HmacSHA3 = require('../hmac-sha3');
import HmacRIPEMD160 = require('../hmac-ripemd160');
// ---
import PBKDF2 = require('../pbkdf2');
// ---
import AES = require('../aes');
import TripleDES = require('../tripledes');
import RC4 = require('../rc4');
import Rabbit = require('../rabbit');
import RabbitLegacy = require('../rabbit-legacy');
import EvpKDF = require('../evpkdf');
// ---
import FormatOpenSSL = require('../format-openssl');
import FormatHex = require('../format-hex');
// ---
import EncLatin1 = require('../enc-latin1');
import EncUtf8 = require('../enc-utf8');
import EncHex = require('../enc-hex');
import EncUtf16 = require('../enc-utf16');
import EncBase64 = require('../enc-base64');
// ---
import ModeCFB = require('../mode-cfb');
import ModeCTR = require('../mode-ctr');
import ModeCTRGladman = require('../mode-ctr-gladman');
import ModeOFB = require('../mode-ofb');
import ModeECB = require('../mode-ecb');
// ---
import PadPkcs7 = require('../pad-pkcs7');
import PadAnsiX923 = require('../pad-ansix923');
import PadIso10126 = require('../pad-iso10126');
import PadIso97971 = require('../pad-iso97971');
import PadZeroPadding = require('../pad-zeropadding');
import PadNoPadding = require('../pad-nopadding');
// Hashers
var str: string;
str = MD5('some message');
str = MD5('some message', 'some key');
str = SHA1('some message');
str = SHA1('some message', 'some key', { any: true });
str = FormatOpenSSL('some message');
str = FormatOpenSSL('some message', 'some key');
// Ciphers
var encrypted: CryptoJS.WordArray;
var decrypted: CryptoJS.DecryptedMessage;
encrypted = <CryptoJS.WordArray>AES.encrypt("Message", "Secret Passphrase");
decrypted = AES.decrypt(encrypted, "Secret Passphrase");
encrypted = <CryptoJS.WordArray>Core.DES.encrypt("Message", "Secret Passphrase");
decrypted = Core.DES.decrypt(encrypted, "Secret Passphrase");
encrypted = TripleDES.encrypt("Message", "Secret Passphrase");
decrypted = TripleDES.decrypt(encrypted, "Secret Passphrase");
encrypted = Rabbit.encrypt("Message", "Secret Passphrase");
decrypted = Rabbit.decrypt(encrypted, "Secret Passphrase");
encrypted = RC4.encrypt("Message", "Secret Passphrase");
decrypted = RC4.decrypt(encrypted, "Secret Passphrase");
encrypted = Core.RC4Drop.encrypt("Message", "Secret Passphrase");
encrypted = Core.RC4Drop.encrypt("Message", "Secret Passphrase", { drop: 3072 / 4 });
decrypted = Core.RC4Drop.decrypt(encrypted, "Secret Passphrase", { drop: 3072 / 4 });
var key = EncHex.parse('000102030405060708090a0b0c0d0e0f');
var iv = EncHex.parse('101112131415161718191a1b1c1d1e1f');
encrypted = AES.encrypt("Message", key, { iv: iv });
encrypted = AES.encrypt("Message", "Secret Passphrase", {
mode: ModeCFB,
padding: PadAnsiX923
});
// The Cipher Output
encrypted = AES.encrypt("Message", "Secret Passphrase");
alert(encrypted.key);
// 74eb593087a982e2a6f5dded54ecd96d1fd0f3d44a58728cdcd40c55227522223
alert(encrypted.iv);
// 7781157e2629b094f0e3dd48c4d786115
alert(encrypted.salt);
// 7a25f9132ec6a8b34
alert(encrypted.ciphertext);
// 73e54154a15d1beeb509d9e12f1e462a0
alert(encrypted);
// U2FsdGVkX1+iX5Ey7GqLND5UFUoV0b7rUJ2eEvHkYqA=
var JsonFormatter = {
stringify: function(cipherParams: any) {
// create json object with ciphertext
var jsonObj: any = {
ct: cipherParams.ciphertext.toString(EncBase64)
};
// optionally add iv and salt
if (cipherParams.iv) {
jsonObj.iv = cipherParams.iv.toString();
}
if (cipherParams.salt) {
jsonObj.s = cipherParams.salt.toString();
}
// stringify json object
return JSON.stringify(jsonObj);
},
parse: function (jsonStr: any) {
// parse json string
var jsonObj = JSON.parse(jsonStr);
// extract ciphertext from json object, and create cipher params object
var cipherParams = (<any>Core).lib.CipherParams.create({
ciphertext: EncBase64.parse(jsonObj.ct)
});
// optionally extract iv and salt
if (jsonObj.iv) {
cipherParams.iv = EncHex.parse(jsonObj.iv);
}
if (jsonObj.s) {
cipherParams.salt = EncHex.parse(jsonObj.s);
} return cipherParams;
}
};
encrypted = AES.encrypt("Message", "Secret Passphrase", {
format: JsonFormatter
});
alert(encrypted);
// {"ct":"tZ4MsEnfbcDOwqau68aOrQ==","iv":"8a8c8fd8fe33743d3638737ea4a00698","s":"ba06373c8f57179c"}
decrypted = AES.decrypt(encrypted, "Secret Passphrase", {
format: JsonFormatter
});
alert(decrypted.toString(EncUtf8)); // Message
// Progressive Ciphering
var key = EncHex.parse('000102030405060708090a0b0c0d0e0f');
var iv = EncHex.parse('101112131415161718191a1b1c1d1e1f');
var aesEncryptor = Core.algo.AES.createEncryptor(key, { iv: iv });
var ciphertextPart1 = aesEncryptor.process("Message Part 1");
var ciphertextPart2 = aesEncryptor.process("Message Part 2");
var ciphertextPart3 = aesEncryptor.process("Message Part 3");
var ciphertextPart4 = aesEncryptor.finalize();
var aesDecryptor = Core.algo.AES.createDecryptor(key, { iv: iv });
var plaintextPart1 = aesDecryptor.process(ciphertextPart1);
var plaintextPart2 = aesDecryptor.process(ciphertextPart2);
var plaintextPart3 = aesDecryptor.process(ciphertextPart3);
var plaintextPart4 = aesDecryptor.process(ciphertextPart4);
var plaintextPart5 = aesDecryptor.finalize();
// Encoders
var words = EncBase64.parse('SGVsbG8sIFdvcmxkIQ==');
var base64 = EncBase64.stringify(words);
var words = EncLatin1.parse('Hello, World!');
var latin1 = EncLatin1.stringify(words);
var words = EncHex.parse('48656c6c6f2c20576f726c6421');
var hex = EncHex.stringify(words);
var words = EncUtf8.parse('𤭢');
var utf8 = EncUtf8.stringify(words);
var words = EncUtf16.parse('Hello, World!');
var utf16 = EncUtf16.stringify(words);
var words = Core.enc.Utf16LE.parse('Hello, World!');
var utf16 = Core.enc.Utf16LE.stringify(words);

3
crypto-js/tripledes/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import { TripleDES } from '../index';
export = TripleDES;

View File

@ -18,6 +18,51 @@
},
"files": [
"index.d.ts",
"crypto-js-tests.ts"
"crypto-js-tests.ts",
"test/submodule-tests.ts",
"core/index.d.ts",
"x64-core/index.d.ts",
"lib-typedarrays/index.d.ts",
"md5/index.d.ts",
"sha1/index.d.ts",
"sha256/index.d.ts",
"sha224/index.d.ts",
"sha512/index.d.ts",
"sha384/index.d.ts",
"sha3/index.d.ts",
"ripemd160/index.d.ts",
"hmac-md5/index.d.ts",
"hmac-sha1/index.d.ts",
"hmac-sha256/index.d.ts",
"hmac-sha224/index.d.ts",
"hmac-sha512/index.d.ts",
"hmac-sha384/index.d.ts",
"hmac-sha3/index.d.ts",
"hmac-ripemd160/index.d.ts",
"pbkdf2/index.d.ts",
"aes/index.d.ts",
"tripledes/index.d.ts",
"rc4/index.d.ts",
"rabbit/index.d.ts",
"rabbit-legacy/index.d.ts",
"evpkdf/index.d.ts",
"format-openssl/index.d.ts",
"format-hex/index.d.ts",
"enc-latin1/index.d.ts",
"enc-utf8/index.d.ts",
"enc-hex/index.d.ts",
"enc-utf16/index.d.ts",
"enc-base64/index.d.ts",
"mode-cfb/index.d.ts",
"mode-ctr/index.d.ts",
"mode-ctr-gladman/index.d.ts",
"mode-ofb/index.d.ts",
"mode-ecb/index.d.ts",
"pad-pkcs7/index.d.ts",
"pad-ansix923/index.d.ts",
"pad-iso10126/index.d.ts",
"pad-iso97971/index.d.ts",
"pad-zeropadding/index.d.ts",
"pad-nopadding/index.d.ts"
]
}
}

3
crypto-js/x64-core/index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import * as X64Core from '../index';
export = X64Core;

View File

@ -125,6 +125,13 @@ hierarchyRootNode = hierarchyRootNode.sum(function (d) { return d.val; });
num = hierarchyRootNode.value;
// count() and value ----------------------------------------------------------
hierarchyRootNode = hierarchyRootNode.count();
num = hierarchyRootNode.value;
// sort ---------------------------------------------------------------------
hierarchyRootNode = hierarchyRootNode.sort(function (a, b) {
@ -307,6 +314,12 @@ clusterRootNode = clusterRootNode.sum(function (d) { return d.val; });
num = clusterRootNode.value;
// count() and value ----------------------------------------------------------
clusterRootNode = clusterRootNode.count();
num = clusterRootNode.value;
// sort ---------------------------------------------------------------------
clusterRootNode = clusterRootNode.sort(function (a, b) {
@ -584,6 +597,11 @@ treemapRootNode = treemapRootNode.sum(function (d) { return d.val; });
num = treemapRootNode.value;
// count() and value ----------------------------------------------------------
treemapRootNode = treemapRootNode.count();
num = treemapRootNode.value;
// sort ---------------------------------------------------------------------
treemapRootNode = treemapRootNode.sort(function (a, b) {
@ -766,6 +784,11 @@ packRootNode = packRootNode.sum(function (d) { return d.val; });
num = packRootNode.value;
// count() and value ----------------------------------------------------------
packRootNode = packRootNode.count();
num = packRootNode.value;
// sort ---------------------------------------------------------------------
packRootNode = packRootNode.sort(function (a, b) {

View File

@ -1,8 +1,10 @@
// Type definitions for D3JS d3-hierarchy module v1.0.2
// Type definitions for D3JS d3-hierarchy module 1.1
// Project: https://github.com/d3/d3-hierarchy/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.1.1
// -----------------------------------------------------------------------
// Hierarchy
// -----------------------------------------------------------------------
@ -20,7 +22,7 @@ export interface HierarchyNode<Datum> {
parent: HierarchyNode<Datum> | null;
children?: Array<HierarchyNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value),
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
*/
readonly value?: number;
@ -35,6 +37,7 @@ export interface HierarchyNode<Datum> {
path(target: HierarchyNode<Datum>): Array<HierarchyNode<Datum>>;
links(): Array<HierarchyLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyNode<Datum>, b: HierarchyNode<Datum>) => number): this;
each(func: (node: HierarchyNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyNode<Datum>) => void): this;
@ -43,7 +46,7 @@ export interface HierarchyNode<Datum> {
}
export function hierarchy<Datum>(data: Datum, children?: (d: Datum) => (Array<Datum> | null)): HierarchyNode<Datum>;
export function hierarchy<Datum>(data: Datum, children?: (d: Datum) => (Datum[] | null)): HierarchyNode<Datum>;
// -----------------------------------------------------------------------
// Stratify
@ -53,11 +56,11 @@ export function hierarchy<Datum>(data: Datum, children?: (d: Datum) => (Array<Da
export interface StratifyOperator<Datum> {
(data: Array<Datum>): HierarchyNode<Datum>;
id(): (d: Datum, i: number, data: Array<Datum>) => (string | null | '' | undefined);
id(id: (d: Datum, i?: number, data?: Array<Datum>) => (string | null | '' | undefined)): this;
parentId(): (d: Datum, i: number, data: Array<Datum>) => (string | null | '' | undefined);
parentId(parentId: (d: Datum, i?: number, data?: Array<Datum>) => (string | null | '' | undefined)): this;
(data: Datum[]): HierarchyNode<Datum>;
id(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined);
id(id: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this;
parentId(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined);
parentId(parentId: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this;
}
export function stratify<Datum>(): StratifyOperator<Datum>;
@ -80,7 +83,7 @@ export interface HierarchyPointNode<Datum> {
parent: HierarchyPointNode<Datum> | null;
children?: Array<HierarchyPointNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value),
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
*/
readonly value?: number;
@ -95,6 +98,7 @@ export interface HierarchyPointNode<Datum> {
path(target: HierarchyPointNode<Datum>): Array<HierarchyPointNode<Datum>>;
links(): Array<HierarchyPointLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
each(func: (node: HierarchyPointNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyPointNode<Datum>) => void): this;
@ -150,7 +154,7 @@ export interface HierarchyRectangularNode<Datum> {
parent: HierarchyRectangularNode<Datum> | null;
children?: Array<HierarchyRectangularNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value),
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
*/
readonly value?: number;
@ -165,6 +169,7 @@ export interface HierarchyRectangularNode<Datum> {
path(target: HierarchyRectangularNode<Datum>): Array<HierarchyRectangularNode<Datum>>;
links(): Array<HierarchyRectangularLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyRectangularNode<Datum>, b: HierarchyRectangularNode<Datum>) => number): this;
each(func: (node: HierarchyRectangularNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyRectangularNode<Datum>) => void): this;
@ -258,7 +263,7 @@ export interface HierarchyCircularNode<Datum> {
parent: HierarchyCircularNode<Datum> | null;
children?: Array<HierarchyCircularNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value),
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
*/
readonly value?: number;
@ -273,6 +278,7 @@ export interface HierarchyCircularNode<Datum> {
path(target: HierarchyCircularNode<Datum>): Array<HierarchyCircularNode<Datum>>;
links(): Array<HierarchyCircularLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyCircularNode<Datum>, b: HierarchyCircularNode<Datum>) => number): this;
each(func: (node: HierarchyCircularNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyCircularNode<Datum>) => void): this;
@ -310,6 +316,6 @@ export interface PackCircle {
// For invocation of packEnclose the x and y coordinates are mandatory. It seems easier to just comment
// on the mandatory nature, then to create separate interfaces and having to deal with recasting.
export function packSiblings<Datum extends PackCircle>(circles: Array<Datum>): Array<Datum>;
export function packSiblings<Datum extends PackCircle>(circles: Datum[]): Datum[];
export function packEnclose<Datum extends PackCircle>(circles: Array<Datum>): { r: number, x: number, y: number };
export function packEnclose<Datum extends PackCircle>(circles: Datum[]): { r: number, x: number, y: number };

2
d3/index.d.ts vendored
View File

@ -1,4 +1,4 @@
// Type definitions for D3JS d3 standard bundle 4.4
// Type definitions for D3JS d3 standard bundle 4.5
// Project: https://github.com/d3/d3
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -0,0 +1,58 @@
import * as Docker from 'dockerode';
// Code samples from Dockerode 'Getting started'
const docker = new Docker();
const docker1 = new Docker({ socketPath: '/var/run/docker.sock' });
const docker2 = new Docker({ host: 'http://192.168.1.10', port: 3000 });
const docker3 = new Docker({ protocol: 'http', host: '127.0.0.1', port: 3000 });
const docker4 = new Docker({ host: '127.0.0.1', port: 3000 });
const docker5 = new Docker({
host: '192.168.1.10',
port: process.env.DOCKER_PORT || 2375,
ca: 'ca',
cert: 'cert',
key: 'key'
});
const docker6 = new Docker({
protocol: 'https', //you can enforce a protocol
host: '192.168.1.10',
port: process.env.DOCKER_PORT || 2375,
ca: 'ca',
cert: 'cert',
key: 'key'
});
const container = docker.getContainer('container-id');
container.inspect((err, data) => {
// NOOP
});
container.start((err, data) => {
// NOOP
});
container.remove((err, data) => {
// NOOP
});
docker.listContainers((err, containers) => {
containers.forEach(container => {
docker
.getContainer(container.Id)
.stop((err, data) => {
// NOOP
});
});
});
docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => {
// NOOP
});
docker.createContainer({ Tty: true }, (err, container) => {
container.start((err, data) => {
// NOOP
});
});

643
dockerode/index.d.ts vendored Normal file
View File

@ -0,0 +1,643 @@
// Type definitions for dockerode 2.3
// Project: https://github.com/apocas/dockerode
// Definitions by: Carl Winkler <https://github.com/seikho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as stream from 'stream';
import * as events from 'events';
declare namespace Dockerode {
interface Container {
inspect(options: {}, callback: Callback<ContainerInspectInfo>): void;
inspect(callback: Callback<ContainerInspectInfo>): void;
inspect(options?: {}): { id: string };
rename(options: {}, callback: Callback<any>): void;
update(options: {}, callback: Callback<any>): void;
top(options: {}, callback: Callback<any>): void;
top(callback: Callback<any>): void;
changes(callback: Callback<any>): void;
export(callback: Callback<NodeJS.ReadableStream>): void;
start(options: {}, callback: Callback<any>): void;
start(callback: Callback<any>): void;
pause(options: {}, callback: Callback<any>): void;
pause(callback: Callback<any>): void;
unpause(options: {}, callback: Callback<any>): void;
unpause(callback: Callback<any>): void;
exec(options: {}, callback: Callback<any>): void;
commit(options: {}, callback: Callback<any>): void;
commit(callback: Callback<any>): void;
stop(options: {}, callback: Callback<any>): void;
stop(callback: Callback<any>): void;
restart(options: {}, callback: Callback<any>): void;
restart(callback: Callback<any>): void;
kill(options: {}, callback: Callback<any>): void;
kill(callback: Callback<any>): void;
resize(options: {}, callback: Callback<any>): void;
resize(callback: Callback<any>): void;
wait(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
/** Deprecated since RAPI v1.20 */
copy(options: {}, callback: Callback<any>): void;
/** Deprecated since RAPI v1.20 */
copy(callback: Callback<any>): void;
getArchive(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
infoArchive(options: {}, callback: Callback<any>): void;
/** @param file Filename (will read synchronously), Buffer or stream */
putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.WritableStream>): void;
logs(options: { stdout?: boolean, stderr?: boolean, follow?: boolean, since?: number, details?: boolean, tail?: number, timestamps?: boolean }, callback: Callback<NodeJS.ReadableStream>): void;
logs(callback: Callback<NodeJS.ReadableStream>): void;
stats(options: {}, callback: Callback<any>): void;
stats(callback: Callback<any>): void;
attach(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
modem: any;
id?: string;
}
interface Image {
inspect(callback: Callback<ImageInspectInfo>): void;
history(callback: Callback<any>): void;
get(callback: Callback<NodeJS.ReadableStream>): void;
push(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
push(callback: Callback<NodeJS.ReadableStream>): void;
tag(options: {}, callback: Callback<any>): void;
tag(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
modem: any;
id?: string;
}
interface Volume {
inspect(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
modem: any;
name?: string;
}
interface Service {
inspect(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
update(options: {}, callback: Callback<any>): void;
modem: any;
id?: string;
}
interface Task {
inspect(callback: Callback<any>): void;
modem: any;
id?: string;
}
interface Node {
inspect(callback: Callback<any>): void;
modem: any;
id?: string;
}
interface Network {
inspect(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
connect(options: {}, callback: Callback<any>): void;
connect(callback: Callback<any>): void;
disconnect(options: {}, callback: Callback<any>): void;
disconnect(callback: Callback<any>): void;
modem: any;
id?: string;
}
interface Exec {
inspect(callback: Callback<any>): void;
start(options: {}, callback: Callback<any>): void;
resize(options: {}, callback: Callback<any>): void;
modem: any;
id?: string;
}
interface ImageInfo {
Id: string;
ParentId: string;
RepoTags: string[];
RepoDigests?: string[];
Created: number;
Size: number;
VirtualSize: number;
Labels: { [label: string]: string };
}
interface ContainerInfo {
Id: string;
Names: string[];
Image: string;
ImageID: string;
Command: string;
Created: number;
Ports: Port[];
Labels: { [label: string]: string };
Status: string;
HostConfig: {
NetworkMode: string;
};
NetworkSettings: {
Networks: { [networkType: string]: NetworkInfo }
};
}
interface Port {
IP: string;
PrivatePort: number;
PublicPort: number;
Type: string;
}
interface NetworkInfo {
IPAMConfig?: any;
Links?: any;
Aliases?: any;
NetworkID: string;
EndpointID: string;
Gateway: string;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
MacAddress: string;
}
interface ContainerInspectInfo {
Id: string;
Created: string;
Path: string;
Args: string[];
State: {
Status: string;
Running: boolean;
Paused: boolean;
Restarting: boolean;
OOMKilled: boolean;
Dead: boolean;
Pid: number;
ExitCode: number;
Error: string;
StartedAt: string;
FinishedAt: string;
};
Image: string;
ResolvConfPath: string;
HostnamePath: string;
HostsPath: string;
LogPath: string;
Name: string;
RestartCount: number;
Driver: string;
MountLabel: string;
ProcessLabel: string;
AppArmorProfile: string;
ExecIDs?: any;
HostConfig: HostConfig;
GraphDriver: {
Name: string;
Data: {
DeviceId: string;
DeviceName: string;
DeviceSize: string;
}
};
Mounts: Array<{
Source: string;
Destination: string;
Mode: string;
RW: boolean;
Propagation: string;
}>;
Config: {
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
ExposedPorts: { [portAndProtocol: string]: {} };
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
Image: string;
Volumes: { [volume: string]: {} };
WorkingDir: string;
Entrypoint?: any;
OnBuild?: any;
Labels: { [label: string]: string }
};
NetworkSettings: {
Bridge: string;
SandboxID: string;
HairpinMode: boolean;
LinkLocalIPv6Address: string;
LinkLocalIPv6PrefixLen: number;
Ports: {
[portAndProtocol: string]: {
HostIp: string;
HostPort: string;
}
};
SandboxKey: string;
SecondaryIPAddresses?: any;
SecondaryIPv6Addresses?: any;
EndpointID: string;
Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
MacAddress: string;
Networks: {
[type: string]: {
IPAMConfig?: any;
Links?: any;
Aliases?: any;
NetworkID: string;
EndpointID: string;
Gateway: string;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
MacAddress: string;
}
}
};
}
interface HostConfig {
Binds: string[];
ContainerIDFile: string;
LogConfig: {
Type: string;
Config: any;
};
NetworkMode: string;
PortBindings?: any;
RestartPolicy: {
Name: string;
MaximumRetryCount: number;
};
VolumeDriver: string;
VolumesFrom?: any;
CapAdd?: any;
CapDrop?: any;
Dns: any[];
DnsOptions: any[];
DnsSearch: any[];
ExtraHosts?: any;
IpcMode: string;
Links?: any;
OomScoreAdj: number;
PidMode: string;
Privileged: boolean;
PublishAllPorts: boolean;
ReadonlyRootfs: boolean;
SecurityOpt?: any;
UTSMode: string;
ShmSize: number;
ConsoleSize: number[];
Isolation: string;
CpuShares: number;
CgroupParent: string;
BlkioWeight: number;
BlkioWeightDevice?: any;
BlkioDeviceReadBps?: any;
BlkioDeviceWriteBps?: any;
BlkioDeviceReadIOps?: any;
BlkioDeviceWriteIOps?: any;
CpuPeriod: number;
CpuQuota: number;
CpusetCpus: string;
CpusetMems: string;
Devices?: any;
KernelMemory: number;
Memory: number;
MemoryReservation: number;
MemorySwap: number;
MemorySwappiness: number;
OomKillDisable: boolean;
PidsLimit: number;
Ulimits?: any;
}
interface ImageInspectInfo {
Id: string;
RepoTags: string[];
RepoDigests: string[];
Parent: string;
Comment: string;
Created: string;
Container: string;
ContainerConfig:
{
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
ExposedPorts: { [portAndProtocol: string]: {} };
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
ArgsEscaped: boolean;
Image: string;
Volumes: { [path: string]: {} },
WorkingDir: string;
Entrypoint?: any;
OnBuild?: any[];
Labels: { [label: string]: string }
};
DockerVersion: string;
Author: string;
Config:
{
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
ExposedPorts: { [portAndProtocol: string]: {} }
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
ArgsEscaped: boolean;
Image: string;
Volumes: { [path: string]: {} },
WorkingDir: string;
Entrypoint?: any;
OnBuild: any[];
Labels: { [label: string]: string }
};
Architecture: string;
Os: string;
Size: number;
VirtualSize: number;
GraphDriver:
{
Name: string;
Data:
{
DeviceId: string;
DeviceName: string;
DeviceSize: string;
}
};
}
interface ContainerCreateOptions {
name?: string;
Hostname?: string;
Domainname?: string;
User?: string;
AttachStdin?: boolean;
AttachStdout?: boolean;
AttachStderr?: boolean;
Tty?: boolean;
OpenStdin?: boolean;
StdinOnce?: boolean;
Env?: string[];
Cmd?: string[];
Entrypoint?: string;
Image?: string;
Labels?: { [label: string]: string };
Volumes?: { [volume: string]: {} };
WorkingDir?: string;
NetworkDisabled?: boolean;
MacAddress?: boolean;
ExposedPorts?: { [port: string]: {} };
StopSignal?: string;
HostConfig?: {
Binds?: string[];
Links?: string[];
Memory?: number;
MemorySwap?: number;
MemoryReservation?: number;
KernelMemory?: number;
CpuPercent?: number;
CpuShares?: number;
CpuPeriod?: number;
CpuQuota?: number;
CpusetMems?: string;
MaximumIOps?: number;
MaxmimumIOBps?: number;
BlkioWeightDevice?: Array<{}>;
BlkioDeviceReadBps?: Array<{}>;
BlkioDeviceReadIOps?: Array<{}>;
BlkioDeviceWriteBps?: Array<{}>;
BlkioDeviceWriteIOps?: Array<{}>;
MemorySwappiness?: number;
OomKillDisable?: boolean;
OomScoreAdj?: number;
PidMode?: string;
PidsLimit?: number;
PortBindings?: { [portAndProtocol: string]: Array<{ [index: string]: string }> };
PublishAllPorts?: boolean;
Privileged?: boolean;
ReadonlyRootfs?: boolean;
Dns?: string[];
DnsOptions?: string[];
DnsSearch?: string[];
ExtraHosts?: any;
VolumesFrom?: string[];
CapAdd?: string[];
CapDrop?: string[];
GroupAdd?: string[];
RestartPolicy?: { [index: string]: number | string };
NetworkMode?: string;
Devices?: any[];
Sysctls?: { [index: string]: string };
Ulimits?: Array<{}>;
LogConfig?: { [index: string]: string | {} };
SecurityOpt?: { [index: string]: any };
CgroupParent?: string;
VolumeDriver?: string;
ShmSize?: number;
};
NetworkingConfig?: {
EndpointsConfig?: {
[index: string]: any;
isolated_nw?: {
[index: string]: any;
IPAMConfig?: {
IPv4Address?: string;
IPv6Adress?: string;
LinkLocalIPs?: string[];
}
Links?: string[];
Aliases?: string[];
}
}
};
}
interface DockerOptions {
socketPath?: string;
host?: string;
port?: number;
ca?: string;
cert?: string;
key?: string;
protocol?: "https" | "http";
timeout?: number;
}
}
type Callback<T> = (error?: any, result?: T) => void;
declare class Dockerode {
constructor(options?: Dockerode.DockerOptions);
createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback<Dockerode.Container>): void;
createImage(options: {}, callback: Callback<Dockerode.Image>): void;
createImage(auth: any, options: {}, callback: Callback<Dockerode.Image>): void;
loadImage(file: string, options: {}, callback: Callback<any>): void;
loadImage(file: string, callback: Callback<any>): void;
importImage(file: string, options: {}, callback: Callback<any>): void;
importImage(file: string, callback: Callback<any>): void;
checkAuth(options: any, callback: Callback<any>): void;
buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<any>): void;
buildImage(file: string | NodeJS.ReadableStream, callback: Callback<any>): void;
getContainer(id: string): Dockerode.Container;
getImage(name: string): Dockerode.Image;
getVolume(name: string): Dockerode.Volume;
getService(id: string): Dockerode.Service;
getTask(id: string): Dockerode.Task;
getNode(id: string): Node;
getNetwork(id: string): Dockerode.Network;
getExec(id: string): Dockerode.Exec;
listContainers(options: {}, callback: Callback<Dockerode.ContainerInfo[]>): void;
listContainers(callback: Callback<Dockerode.ContainerInfo[]>): void;
listImages(options: {}, callback: Callback<Dockerode.ImageInfo[]>): void;
listImages(callback: Callback<Dockerode.ImageInfo[]>): void;
listServices(options: {}, callback: Callback<any[]>): void;
listServices(callback: Callback<any[]>): void;
listNodes(options: {}, callback: Callback<any[]>): void;
listNodes(callback: Callback<any[]>): void;
listTasks(options: {}, callback: Callback<any[]>): void;
listTasks(callback: Callback<any[]>): void;
listVolumes(options: {}, callback: Callback<any[]>): void;
listVolumes(callback: Callback<any[]>): void;
listNetworks(options: {}, callback: Callback<any[]>): void;
listNetworks(callback: Callback<any[]>): void;
createVolume(options: {}, callback: Callback<any>): void;
createService(options: {}, callback: Callback<any>): void;
createNetwork(options: {}, callback: Callback<any>): void;
searchImages(options: {}, callback: Callback<any>): void;
info(callback: Callback<any>): void;
version(callback: Callback<any>): void;
ping(callback: Callback<any>): void;
getEvents(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
getEvents(callback: Callback<NodeJS.ReadableStream>): void;
pull(repoTag: string, options: {}, callback: Callback<any>, auth?: {}): Dockerode.Image;
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, startOptions: {}, callback: Callback<any>): events.EventEmitter;
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, startOptions: {}, callback: Callback<any>): events.EventEmitter;
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, callback: Callback<any>): events.EventEmitter;
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, callback: Callback<any>): events.EventEmitter;
swarmInit(options: {}, callback: Callback<any>): void;
swarmJoin(options: {}, callback: Callback<any>): void;
swarmLeave(options: {}, callback: Callback<any>): void;
swarmUpdate(options: {}, callback: Callback<any>): void;
modem: any;
}
export = Dockerode;

20
dockerode/tsconfig.json Normal file
View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dockerode-tests.ts"
]
}

3
dockerode/tslint.json Normal file
View File

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

View File

@ -1,4 +1,4 @@
// Type definitions for Dot-Object v1.4.2
// Type definitions for Dot-Object v1.5
// Project: https://github.com/rhalff/dot-object
// Definitions by: Niko Kovačič <https://github.com/nkovacic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -109,7 +109,7 @@ declare namespace DotObject {
* @param {Object} obj
* @param {Boolean} remove
*/
pick(path: string, obj: any, remove?: boolean): void;
pick(path: string, obj: any, remove?: boolean): any;
/**
*
* Remove value from an object using dot notation.

2
draft-js/index.d.ts vendored
View File

@ -458,7 +458,7 @@ declare namespace Draft {
entityMap: { [key: string]: RawDraftEntity };
}
function convertFromHTMLtoContentBlocks(html: string, DOMBuilder: Function, blockRenderMap?: DraftBlockRenderMap): Array<ContentBlock>;
function convertFromHTMLtoContentBlocks(html: string, DOMBuilder?: Function, blockRenderMap?: DraftBlockRenderMap): Array<ContentBlock>;
function convertFromRawToDraftState(rawState: RawDraftContentState): ContentState;
function convertFromDraftStateToRaw(contentState: ContentState): RawDraftContentState;
}

View File

@ -0,0 +1,7 @@
import Dragster = require("dragster");
var dropzone = document.getElementById("my-dropzone") as HTMLElement;
var dragster = new Dragster(dropzone);
dragster.removeListeners();
dragster.reset();

12
dragster/index.d.ts vendored Normal file
View File

@ -0,0 +1,12 @@
// Type definitions for dragster 0.1
// Project: https://github.com/bensmithett/dragster
// Definitions by: Zsolt Kovacs <https://github.com/zskovacs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Dragster {
constructor(elem: HTMLElement);
removeListeners(): void;
reset(): void;
}
export = Dragster;

23
dragster/tsconfig.json Normal file
View File

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

1
dragster/tslint.json Normal file
View File

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

View File

@ -1,6 +1,13 @@
import * as elasticjs from 'elastic.js';
let body = new elasticjs.Request({})
new elasticjs.Request({})
.query(new elasticjs.MatchQuery('title_field', 'testQuery'))
.facet(new elasticjs.TermsFacet('tags').field('tags'))
.toJSON();
new elasticjs.Request({})
.query(new elasticjs.MatchAllQuery())
.filter(new elasticjs.BoolFilter().must([
new elasticjs.TermFilter('a', 'b'),
new elasticjs.TermFilter('c', 'd')]))
.toJSON();

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