mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-14 14:00:26 +00:00
Merge remote-tracking branch 'refs/remotes/DefinitelyTyped/master'
This commit is contained in:
Vendored
+43
-12
@@ -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;
|
||||
|
||||
Vendored
+4
-4
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
Vendored
+2
-1
@@ -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.
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+324
-236
File diff suppressed because it is too large
Load Diff
Vendored
+60
-50
@@ -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.
|
||||
@@ -1284,11 +1293,11 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
interface ITemplateLinkingFunctionOptions {
|
||||
parentBoundTranscludeFn?: ITranscludeFunction,
|
||||
parentBoundTranscludeFn?: ITranscludeFunction;
|
||||
transcludeControllers?: {
|
||||
[controller: string]: { instance: IController }
|
||||
},
|
||||
futureParentElement?: JQuery
|
||||
};
|
||||
futureParentElement?: JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1510,7 +1519,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 +1604,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 +1614,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 +1698,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 +1946,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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Vendored
-1
@@ -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;
|
||||
|
||||
+144
-16
@@ -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) => {});
|
||||
|
||||
Vendored
+452
-132
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
Vendored
+136
@@ -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
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -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";
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference types="auth0-js" />
|
||||
/// <reference types="auth0-js/v7" />
|
||||
|
||||
|
||||
var widget: Auth0WidgetStatic = new Auth0Widget({
|
||||
|
||||
Vendored
+1
-1
@@ -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 {
|
||||
|
||||
+19
-1
@@ -13,6 +13,13 @@ interface Issue {
|
||||
title: string;
|
||||
}
|
||||
|
||||
function makePromise(val: any) {
|
||||
return <Axios.IPromise<any>>{
|
||||
then: () => val,
|
||||
catch: () => val
|
||||
};
|
||||
}
|
||||
|
||||
axios.interceptors.request.use<any>(config => {
|
||||
console.log("Method:" + config.method + " Url:" +config.url);
|
||||
return config;
|
||||
@@ -30,12 +37,23 @@ const requestId: number = axios.interceptors.request.use<any>(
|
||||
axios.interceptors.request.eject(requestId);
|
||||
axios.interceptors.request.eject(7);
|
||||
|
||||
const requestId2: number = axios.interceptors.request.use<any>(
|
||||
(config) => {
|
||||
console.log("Method:" + config.method + " Url:" +config.url);
|
||||
return makePromise(config);
|
||||
},
|
||||
(error: any) => error);
|
||||
|
||||
axios.interceptors.response.use<any>(config => {
|
||||
console.log("Status:" + config.status);
|
||||
return config;
|
||||
});
|
||||
|
||||
axios.interceptors.response.use<any>(config => {
|
||||
console.log("Status:" + config.status);
|
||||
return makePromise(config);
|
||||
});
|
||||
|
||||
const responseId: number = axios.interceptors.response.use<any>(
|
||||
config => {
|
||||
console.log("Status:" + config.status);
|
||||
@@ -104,4 +122,4 @@ 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";
|
||||
axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN";
|
||||
|
||||
Vendored
+16
-4
@@ -99,10 +99,10 @@ declare namespace Axios {
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
@@ -199,6 +199,12 @@ declare namespace Axios {
|
||||
rejectedFn: (error: any) => any)
|
||||
: InterceptorId;
|
||||
|
||||
use<U>(fulfilledFn: (config: AxiosXHRConfig<U>) => IPromise<AxiosXHRConfig<U>>): InterceptorId;
|
||||
|
||||
use<U>(fulfilledFn: (config: AxiosXHRConfig<U>) => IPromise<AxiosXHRConfig<U>>,
|
||||
rejectedFn: (error: any) => any)
|
||||
: InterceptorId;
|
||||
|
||||
eject(interceptorId: InterceptorId): void;
|
||||
}
|
||||
|
||||
@@ -209,10 +215,16 @@ declare namespace Axios {
|
||||
|
||||
use<T>(fulfilledFn: (config: Axios.AxiosXHR<T>) => Axios.AxiosXHR<T>): InterceptorId;
|
||||
|
||||
use<T>(fulfilledFn: (config: Axios.AxiosXHR<T>) => IPromise<Axios.AxiosXHR<T>>): InterceptorId;
|
||||
|
||||
use<T>(fulfilledFn: (config: Axios.AxiosXHR<T>) => Axios.AxiosXHR<T>,
|
||||
rejectedFn: (error: any) => any)
|
||||
: InterceptorId;
|
||||
|
||||
use<T>(fulfilledFn: (config: Axios.AxiosXHR<T>) => IPromise<Axios.AxiosXHR<T>>,
|
||||
rejectedFn: (error: any) => any)
|
||||
: InterceptorId;
|
||||
|
||||
eject(interceptorId: InterceptorId): void;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -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 {
|
||||
|
||||
Vendored
+9
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Vendored
+5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
Vendored
+8
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Vendored
+3
-3
@@ -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 {
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { AES } from '../index';
|
||||
|
||||
export = AES;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import * as Core from '../index';
|
||||
|
||||
export = Core;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { enc } from '../index';
|
||||
|
||||
declare const Base64: typeof enc.Base64;
|
||||
export = Base64;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { enc } from '../index';
|
||||
|
||||
declare const Hex: typeof enc.Hex;
|
||||
export = Hex;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { enc } from '../index';
|
||||
|
||||
declare const Latin1: typeof enc.Latin1;
|
||||
export = Latin1;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { enc } from '../index';
|
||||
|
||||
declare const Utf16: typeof enc.Utf16;
|
||||
export = Utf16;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { enc } from '../index';
|
||||
|
||||
declare const Utf8: typeof enc.Utf8;
|
||||
export = Utf8;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { EvpKDF } from '../index';
|
||||
|
||||
export = EvpKDF;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { format } from '../index';
|
||||
|
||||
declare const Hex: typeof format.Hex;
|
||||
export = Hex;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { format } from '../index';
|
||||
|
||||
declare const OpenSSL: typeof format.OpenSSL;
|
||||
export = OpenSSL;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacMD5 } from '../index';
|
||||
|
||||
export = HmacMD5;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacRIPEMD160 } from '../index';
|
||||
|
||||
export = HmacRIPEMD160;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacSHA1 } from '../index';
|
||||
|
||||
export = HmacSHA1;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacSHA224 } from '../index';
|
||||
|
||||
export = HmacSHA224;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacSHA256 } from '../index';
|
||||
|
||||
export = HmacSHA256;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacSHA3 } from '../index';
|
||||
|
||||
export = HmacSHA3;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacSHA384 } from '../index';
|
||||
|
||||
export = HmacSHA384;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { HmacSHA512 } from '../index';
|
||||
|
||||
export = HmacSHA512;
|
||||
Vendored
-1
@@ -114,4 +114,3 @@ declare namespace CryptoJS {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
declare const LibTypedarrays: any;
|
||||
export = LibTypedarrays;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { MD5 } from '../index';
|
||||
|
||||
export = MD5;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { mode } from '../index';
|
||||
|
||||
declare const CFB: typeof mode.CFB;
|
||||
export = CFB;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import { mode } from '../index';
|
||||
|
||||
declare const CTRGladman: typeof mode.CTRGladman;
|
||||
export = CTRGladman;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { mode } from '../index';
|
||||
|
||||
declare const CTR: typeof mode.CTR;
|
||||
export = CTR;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { mode } from '../index';
|
||||
|
||||
declare const ECB: typeof mode.ECB;
|
||||
export = ECB;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { mode } from '../index';
|
||||
|
||||
declare const OFB: typeof mode.OFB;
|
||||
export = OFB;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { pad } from '../index';
|
||||
|
||||
declare const AnsiX923: typeof pad.AnsiX923;
|
||||
export = AnsiX923;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { pad } from '../index';
|
||||
|
||||
declare const Iso10126: typeof pad.Iso10126;
|
||||
export = Iso10126;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { pad } from '../index';
|
||||
|
||||
declare const Iso97971: typeof pad.Iso97971;
|
||||
export = Iso97971;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { pad } from '../index';
|
||||
|
||||
declare const NoPadding: typeof pad.NoPadding;
|
||||
export = NoPadding;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { pad } from '../index';
|
||||
|
||||
declare const Pkcs7: typeof pad.Pkcs7;
|
||||
export = Pkcs7;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { pad } from '../index';
|
||||
|
||||
declare const ZeroPadding: typeof pad.ZeroPadding;
|
||||
export = ZeroPadding;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { PBKDF2 } from '../index';
|
||||
|
||||
export = PBKDF2;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { RabbitLegacy } from '../index';
|
||||
|
||||
export = RabbitLegacy;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { Rabbit } from '../index';
|
||||
|
||||
export = Rabbit;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { RC4 } from '../index';
|
||||
|
||||
export = RC4;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { RIPEMD160 } from '../index';
|
||||
|
||||
export = RIPEMD160;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { SHA1 } from '../index';
|
||||
|
||||
export = SHA1;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { SHA224 } from '../index';
|
||||
|
||||
export = SHA224;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { SHA256 } from '../index';
|
||||
|
||||
export = SHA256;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { SHA3 } from '../index';
|
||||
|
||||
export = SHA3;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { SHA384 } from '../index';
|
||||
|
||||
export = SHA384;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { SHA512 } from '../index';
|
||||
|
||||
export = SHA512;
|
||||
@@ -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);
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import { TripleDES } from '../index';
|
||||
|
||||
export = TripleDES;
|
||||
+47
-2
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import * as X64Core from '../index';
|
||||
|
||||
export = X64Core;
|
||||
@@ -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) {
|
||||
|
||||
Vendored
+19
-13
@@ -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 };
|
||||
|
||||
Vendored
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
});
|
||||
});
|
||||
Vendored
+643
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Vendored
+2
-2
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
Vendored
+12
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -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();
|
||||
|
||||
Vendored
+1
-1
@@ -6765,7 +6765,7 @@ declare module elasticjs {
|
||||
/*
|
||||
Allows you to set a specified filter on this request object.
|
||||
*/
|
||||
filter(filter: Object): Request;
|
||||
filter(filter: Filter): Request;
|
||||
|
||||
/*
|
||||
A search result set could be very large (think Google). Setting the
|
||||
|
||||
Vendored
+8
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for express-jwt
|
||||
// Project: https://www.npmjs.org/package/express-jwt
|
||||
// Definitions by: Wonshik Kim <https://github.com/wokim/>
|
||||
// Definitions by: Wonshik Kim <https://github.com/wokim/>, Kacper Polak <https://github.com/kacepe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import express = require('express');
|
||||
@@ -37,3 +37,10 @@ declare namespace jwt {
|
||||
unless?: typeof unless;
|
||||
}
|
||||
}
|
||||
declare global {
|
||||
namespace Express {
|
||||
export interface Request {
|
||||
user?: any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import MySQLStore = require('express-mysql-session');
|
||||
|
||||
const options = {
|
||||
host: 'localhost',
|
||||
port: 3306,
|
||||
user: 'root',
|
||||
password: '',
|
||||
database: 'session_test'
|
||||
};
|
||||
|
||||
const sessionStore = new MySQLStore(options);
|
||||
|
||||
sessionStore.close();
|
||||
Vendored
+136
@@ -0,0 +1,136 @@
|
||||
// Type definitions for express-mysql-session 1.2
|
||||
// Project: https://github.com/chill117/express-mysql-session#readme
|
||||
// Definitions by: Akim95 <https://github.com/Akim95>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = MySQLStore;
|
||||
|
||||
declare namespace MySQLStore {
|
||||
interface Options {
|
||||
host?: string;
|
||||
port?: number;
|
||||
user?: string;
|
||||
password?: string;
|
||||
database?: string;
|
||||
checkExpirationInterval?: number;
|
||||
expiration?: number;
|
||||
createDatabaseTable?: boolean;
|
||||
connectionLimit?: number;
|
||||
schema?: Schema;
|
||||
}
|
||||
interface Schema {
|
||||
tableName: string;
|
||||
columnNames: ColumnNames;
|
||||
}
|
||||
interface ColumnNames {
|
||||
session_id: string;
|
||||
expires: string;
|
||||
data: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare class MySQLStore {
|
||||
|
||||
/**
|
||||
* @param {MySQLStore.Options} options
|
||||
* @param {any} connection?
|
||||
* @param {(error:any)=>void} callback?
|
||||
*/
|
||||
constructor(options: MySQLStore.Options, connection?: any, callback?: (error: any) => void);
|
||||
|
||||
/**
|
||||
* @returns void
|
||||
*/
|
||||
setDefaultOptions(): void;
|
||||
|
||||
/**
|
||||
* @param {(error:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
createDatabaseTable(callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {string} sessionId
|
||||
* @param {(error:any,session:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
get(sessionId: string, callback?: (error: any, session: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {string} sessionId
|
||||
* @param {any} data
|
||||
* @param {(error:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
set(sessionId: string, data: any, callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {string} sessionId
|
||||
* @param {any} data
|
||||
* @param {(error:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
touch(sessionId: string, data: any, callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {string} sessionId
|
||||
* @param {(error:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
destroy(sessionId: string, callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {(error:any,count:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
length(callback?: (error: any, count: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {(error:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
clear(callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {(error:any)=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
clearExpiredSessions(callback?: (error: any) => void): void;
|
||||
|
||||
/**
|
||||
* @param {number} interval
|
||||
* @returns void
|
||||
*/
|
||||
setExpirationInterval(interval: number): void;
|
||||
|
||||
/**
|
||||
* @returns void
|
||||
*/
|
||||
clearExpirationInterval(): void;
|
||||
|
||||
/**
|
||||
* @param {()=>void} callback?
|
||||
* @returns void
|
||||
*/
|
||||
close(callback?: () => void): void;
|
||||
|
||||
/**
|
||||
* @param {any} object
|
||||
* @param {any} defaultValues
|
||||
* @param {any} options?
|
||||
* @returns void
|
||||
*/
|
||||
default(object: any, defaultValues: any, options?: any): void;
|
||||
|
||||
/**
|
||||
* @param {any} object
|
||||
* @returns void
|
||||
*/
|
||||
clone(object: any): void;
|
||||
|
||||
/**
|
||||
* @param {any} value
|
||||
* @returns void
|
||||
*/
|
||||
isObject(value: any): void;
|
||||
}
|
||||
@@ -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",
|
||||
"express-mysql-session-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -0,0 +1,25 @@
|
||||
import RateLimit = require("express-rate-limit");
|
||||
|
||||
var apiLimiter = new RateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
max: 100,
|
||||
delayMs: 0 // disabled
|
||||
});
|
||||
|
||||
var createAccountLimiter = new RateLimit({
|
||||
windowMs: 60 * 60 * 1000, // 1 hour window
|
||||
delayAfter: 1, // begin slowing down responses after the first request
|
||||
delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request
|
||||
max: 5, // start blocking after 5 requests
|
||||
message: "Too many accounts created from this IP, please try again after an hour"
|
||||
});
|
||||
|
||||
class SomeStore implements RateLimit.Store {
|
||||
incr(key: string, cb: RateLimit.StoreIncrementCallback) { }
|
||||
resetAll() { }
|
||||
resetKey(key: string) { };
|
||||
};
|
||||
|
||||
var limiterWithStore = new RateLimit({
|
||||
store: new SomeStore()
|
||||
});
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// Type definitions for express-rate-limit 2.6
|
||||
// Project: https://github.com/nfriedly/express-rate-limit
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import express = require("express");
|
||||
|
||||
declare namespace RateLimit {
|
||||
type StoreIncrementCallback = (err?: {}, hits?: number) => void;
|
||||
|
||||
export interface Store {
|
||||
incr: (key: string, cb: StoreIncrementCallback) => void;
|
||||
resetAll: () => void;
|
||||
resetKey: (key: string) => void;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
delayAfter?: number;
|
||||
delayMs?: number;
|
||||
handlers?: () => any;
|
||||
headers?: boolean;
|
||||
keyGenerator?: () => string;
|
||||
max?: number;
|
||||
message?: string;
|
||||
skip?: () => boolean;
|
||||
statusCode?: number;
|
||||
store?: Store;
|
||||
windowMs?: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface RateLimitStatic {
|
||||
new(options: RateLimit.Options): express.RequestHandler;
|
||||
}
|
||||
|
||||
declare var RateLimit: RateLimitStatic;
|
||||
export = RateLimit;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express-rate-limit-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
import { createBrowserHistory, createLocation, useBasename, useBeforeUnload, useQueries } from 'history'
|
||||
import { createHistory, createLocation, useBasename, useBeforeUnload, useQueries } from 'history'
|
||||
|
||||
import { getUserConfirmation } from 'history/lib/DOMUtils'
|
||||
|
||||
@@ -10,7 +10,7 @@ let doSomethingAsync: () => Promise<Function>;
|
||||
let input = { value: "" };
|
||||
|
||||
{
|
||||
let history = createBrowserHistory()
|
||||
let history = createHistory()
|
||||
|
||||
// Listen for changes to the current location. The
|
||||
// listener is called once immediately.
|
||||
@@ -46,7 +46,7 @@ let input = { value: "" };
|
||||
}
|
||||
|
||||
{
|
||||
let history = createBrowserHistory()
|
||||
let history = createHistory()
|
||||
|
||||
// Pushing a path string.
|
||||
history.push('/the/path')
|
||||
@@ -63,7 +63,7 @@ let input = { value: "" };
|
||||
}
|
||||
|
||||
{
|
||||
let history = createBrowserHistory()
|
||||
let history = createHistory()
|
||||
history.listenBefore(function(location) {
|
||||
if (input.value !== '')
|
||||
return 'Are you sure you want to leave this page?'
|
||||
@@ -75,7 +75,7 @@ let input = { value: "" };
|
||||
}
|
||||
|
||||
{
|
||||
let history = createBrowserHistory({
|
||||
let history = createHistory({
|
||||
getUserConfirmation(message, callback) {
|
||||
callback(window.confirm(message)) // The default behavior
|
||||
}
|
||||
@@ -83,7 +83,7 @@ let input = { value: "" };
|
||||
}
|
||||
|
||||
{
|
||||
let history = useBeforeUnload(createBrowserHistory)()
|
||||
let history = useBeforeUnload(createHistory)()
|
||||
|
||||
history.listenBeforeUnload(function() {
|
||||
return 'Are you sure you want to leave this page?'
|
||||
@@ -91,7 +91,7 @@ let input = { value: "" };
|
||||
}
|
||||
|
||||
{
|
||||
let history = useQueries(createBrowserHistory)()
|
||||
let history = useQueries(createHistory)()
|
||||
|
||||
history.listen(function(location) {
|
||||
console.log(location.query)
|
||||
@@ -99,7 +99,7 @@ let input = { value: "" };
|
||||
}
|
||||
|
||||
{
|
||||
let history = useQueries(createBrowserHistory)({
|
||||
let history = useQueries(createHistory)({
|
||||
parseQueryString: function(queryString) {
|
||||
// TODO: return a parsed version of queryString
|
||||
return {};
|
||||
@@ -116,7 +116,7 @@ let input = { value: "" };
|
||||
|
||||
{
|
||||
// Run our app under the /base URL.
|
||||
let history = useBasename(createBrowserHistory)({
|
||||
let history = useBasename(createHistory)({
|
||||
basename: '/base'
|
||||
})
|
||||
|
||||
@@ -128,4 +128,4 @@ let input = { value: "" };
|
||||
|
||||
history.createPath('/the/path') // /base/the/path
|
||||
history.push('/the/path') // push /base/the/path
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user