mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Merge branch 'master' of github.com:DefinitelyTyped/DefinitelyTyped into chrome-updates
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Vendored
+419
-215
@@ -1,10 +1,9 @@
|
||||
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5
|
||||
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.6
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Tony Curtis <https://github.com/daltin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="angular" />
|
||||
/// <reference path="mocks.d.ts" />
|
||||
|
||||
import * as angular from 'angular';
|
||||
@@ -13,7 +12,6 @@ import * as angular from 'angular';
|
||||
// ngMock module (angular-mocks.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module 'angular' {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularStatic
|
||||
// We reopen it to add the MockStatic definition
|
||||
@@ -23,27 +21,27 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
|
||||
// Depending on context, it might return a function, however having `void | (() => void)`
|
||||
// as a return type seems to be not useful. E.g. it requires type assertions in `beforeEach(inject(...))`.
|
||||
interface IInjectStatic {
|
||||
(...fns: Function[]): any;
|
||||
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
strictDi(val?: boolean): void;
|
||||
(...fns: Array<Injectable<(...args: any[]) => void>>): any; // void | (() => void);
|
||||
strictDi(val?: boolean): any; // void | (() => void);
|
||||
}
|
||||
|
||||
interface IMockStatic {
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
|
||||
dump(obj: any): string;
|
||||
|
||||
inject: IInjectStatic
|
||||
inject: IInjectStatic;
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
|
||||
module: {
|
||||
(...modules: any[]): any;
|
||||
sharedInjector(): void;
|
||||
}
|
||||
};
|
||||
|
||||
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
|
||||
TzDate(offset: number, timestamp: number): Date;
|
||||
TzDate(offset: number, timestamp: string): Date;
|
||||
TzDate(offset: number, timestamp: number | string): Date;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -62,7 +60,6 @@ declare module 'angular' {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
flush(delay?: number): void;
|
||||
flushNext(expectedDelay?: number): void;
|
||||
verifyNoPendingTasks(): void;
|
||||
}
|
||||
|
||||
@@ -96,9 +93,11 @@ declare module 'angular' {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IControllerService {
|
||||
// Although the documentation doesn't state this, locals are optional
|
||||
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
|
||||
<T>(controllerConstructor: (...args: any[]) => T, locals?: any, bindings?: any): T;
|
||||
<T>(controllerName: string, locals?: any, bindings?: any): T;
|
||||
<T>(
|
||||
controllerConstructor: (new (...args: any[]) => T) | ((...args: any[]) => T) | string,
|
||||
locals?: any,
|
||||
bindings?: any
|
||||
): T;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -108,268 +107,473 @@ declare module 'angular' {
|
||||
interface IComponentControllerService {
|
||||
// TBinding is an interface exposed by a component as per John Papa's style guide
|
||||
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
|
||||
<T, TBinding>(componentName: string, locals: { $scope?: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
|
||||
<T, TBinding>(
|
||||
componentName: string,
|
||||
locals: { $scope?: IScope; [key: string]: any },
|
||||
bindings?: TBinding,
|
||||
ident?: string
|
||||
): T;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// HttpBackendService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IHttpBackendService {
|
||||
/**
|
||||
* Flushes pending requests using the trained responses. Requests are flushed in the order they were made, but it is also possible to skip one or more requests (for example to have them flushed later). This is useful for simulating scenarios where responses arrive from the server in any order.
|
||||
*
|
||||
* If there are no pending requests to flush when the method is called, an exception is thrown (as this is typically a sign of programming error).
|
||||
* @param count Number of responses to flush. If undefined/null, all pending requests (starting after `skip`) will be flushed.
|
||||
* @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_
|
||||
*/
|
||||
* Flushes pending requests using the trained responses. Requests are flushed in the order they
|
||||
* were made, but it is also possible to skip one or more requests (for example to have them
|
||||
* flushed later). This is useful for simulating scenarios where responses arrive from the server
|
||||
* in any order.
|
||||
*
|
||||
* If there are no pending requests to flush when the method is called, an exception is thrown (as
|
||||
* this is typically a sign of programming error).
|
||||
*
|
||||
* @param count Number of responses to flush. If undefined/null, all pending requests (starting
|
||||
* after `skip`) will be flushed.
|
||||
* @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_
|
||||
*/
|
||||
flush(count?: number, skip?: number): void;
|
||||
|
||||
/**
|
||||
* Resets all request expectations, but preserves all backend definitions.
|
||||
*/
|
||||
* Resets all request expectations, but preserves all backend definitions.
|
||||
*/
|
||||
resetExpectations(): void;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
* 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(digest?: boolean): void;
|
||||
|
||||
/**
|
||||
* Verifies that there are no outstanding requests that need to be flushed.
|
||||
*/
|
||||
* Verifies that there are no outstanding requests that need to be flushed.
|
||||
*/
|
||||
verifyNoOutstandingRequest(): void;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expect(
|
||||
method: string,
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for DELETE requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for DELETE requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectDELETE(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for GET requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for GET requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectGET(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for HEAD requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
/**
|
||||
* Creates a new request expectation for HEAD requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
|
||||
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
expectHEAD(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for JSONP requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for JSONP requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectJSONP(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PATCH requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for PATCH requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPATCH(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for POST requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for POST requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPOST(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new request expectation for PUT requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation for PUT requests.
|
||||
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
expectPUT(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new request expectation that compares only with the requested route.
|
||||
* This method offers colon delimited matching of the url path, ignoring the query string.
|
||||
* This allows declarations similar to how application routes are configured with `$routeProvider`.
|
||||
* As this method converts the definition url to regex, declaration order is important.
|
||||
* @param method HTTP method
|
||||
* @param url HTTP url string that supports colon param matching
|
||||
*/
|
||||
expectRoute(method: string, url: string): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for DELETE requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
when(
|
||||
method: string,
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for GET requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in request url described above
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition for DELETE requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenDELETE(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for HEAD requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition for GET requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in request url described above
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenGET(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for JSONP requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition for HEAD requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenHEAD(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PATCH requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition for JSONP requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenJSONP(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for POST requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition for PATCH requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPATCH(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PUT requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
|
||||
/**
|
||||
* Creates a new backend definition for POST requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true
|
||||
* if the url matches the current definition.
|
||||
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
|
||||
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPOST(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition for PUT requests.
|
||||
* Returns an object with respond method that controls how a matched request is handled.
|
||||
* @param url HTTP url string, regular expression or function that receives a url and returns true
|
||||
* if the url matches the current definition.
|
||||
* @param data HTTP request body or function that receives data string and returns true if the data
|
||||
* is as expected.
|
||||
* @param headers HTTP headers or function that receives http header object and returns true if the
|
||||
* headers match the current definition.
|
||||
* @param keys Array of keys to assign to regex matches in the request url.
|
||||
*/
|
||||
whenPUT(
|
||||
url: string | RegExp | ((url: string) => boolean),
|
||||
data?: string | RegExp | object | ((data: string) => boolean),
|
||||
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
|
||||
keys?: string[]
|
||||
): mock.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Creates a new backend definition that compares only with the requested route.
|
||||
* This method offers colon delimited matching of the url path, ignoring the query string.
|
||||
* This allows declarations similar to how application routes are configured with `$routeProvider`.
|
||||
* As this method converts the definition url to regex, declaration order is important.
|
||||
* @param method HTTP method.
|
||||
* @param url HTTP url string that supports colon param matching.
|
||||
*/
|
||||
whenRoute(method: string, url: string): mock.IRequestHandler;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AnimateService
|
||||
// see https://docs.angularjs.org/api/ngMock/service/$animate
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
module animate {
|
||||
namespace animate {
|
||||
interface IAnimateService {
|
||||
|
||||
/**
|
||||
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks.
|
||||
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining
|
||||
* animation frames and/or callbacks.
|
||||
*/
|
||||
closeAndFlush(): void;
|
||||
|
||||
/**
|
||||
* This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see `closeAndFlush()` for that).
|
||||
* This method is used to flush the pending callbacks and animation frames to either start
|
||||
* an animation or conclude an animation. Note that this will not actually close an
|
||||
* actively running animation (see `closeAndFlush()`} for that).
|
||||
*/
|
||||
flush(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export module mock {
|
||||
// returned interface by the the mocked HttpBackendService expect/when methods
|
||||
namespace mock {
|
||||
/** Object returned by the the mocked HttpBackendService expect/when methods */
|
||||
interface IRequestHandler {
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using a function to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text.
|
||||
*/
|
||||
respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param status HTTP status code to add to the response.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
|
||||
|
||||
// Available when ngMockE2E is loaded
|
||||
/**
|
||||
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
|
||||
*/
|
||||
* Controls the response for a matched request using a function to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys
|
||||
* to regex matches in the request url and returns an array containing response status (number), data,
|
||||
* headers, and status text.
|
||||
*/
|
||||
respond(
|
||||
func: ((
|
||||
method: string,
|
||||
url: string,
|
||||
data: string | object,
|
||||
headers: IHttpHeaders,
|
||||
params: { [key: string]: string }
|
||||
) => [number, string | object, IHttpHeaders, string])
|
||||
): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param status HTTP status code to add to the response.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(
|
||||
status: number,
|
||||
data: string | object,
|
||||
headers?: IHttpHeaders,
|
||||
responseText?: string
|
||||
): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
|
||||
* Returns the RequestHandler object for possible overrides.
|
||||
* @param data Data to add to the response.
|
||||
* @param headers Headers object to add to the response.
|
||||
* @param responseText Response text to add to the response.
|
||||
*/
|
||||
respond(
|
||||
data: string | object,
|
||||
headers?: IHttpHeaders,
|
||||
responseText?: string
|
||||
): IRequestHandler;
|
||||
|
||||
/**
|
||||
* Any request matching a backend definition or expectation with passThrough handler will be
|
||||
* passed through to the real backend (an XHR request will be made to the server.)
|
||||
* Available when ngMockE2E is loaded
|
||||
*/
|
||||
passThrough(): IRequestHandler;
|
||||
}
|
||||
|
||||
interface IHttpHeaders {
|
||||
[headerName: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains additional event data used by the `browserTrigger` function when creating an event.
|
||||
*/
|
||||
interface IBrowserTriggerEventData {
|
||||
/**
|
||||
* [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles).
|
||||
* Not applicable to all events.
|
||||
*/
|
||||
bubbles?: boolean;
|
||||
/**
|
||||
* [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable).
|
||||
* Not applicable to all events.
|
||||
*/
|
||||
cancelable?: boolean;
|
||||
/**
|
||||
* [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode)
|
||||
* for keyboard events (keydown, keypress, and keyup).
|
||||
*/
|
||||
charcode?: number;
|
||||
/**
|
||||
* The elapsedTime for
|
||||
* [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
|
||||
* and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
|
||||
*/
|
||||
elapsedTime?: number;
|
||||
/**
|
||||
* [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode)
|
||||
* for keyboard events (keydown, keypress, and keyup).
|
||||
*/
|
||||
keycode?: number;
|
||||
/**
|
||||
* An array of possible modifier keys (ctrl, alt, shift, meta) for
|
||||
* [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and
|
||||
* keyboard events (keydown, keypress, and keyup).
|
||||
*/
|
||||
keys?: Array<'ctrl' | 'alt' | 'shift' | 'meta'>;
|
||||
/**
|
||||
* The [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget)
|
||||
* for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
|
||||
*/
|
||||
relatedTarget?: Node;
|
||||
/**
|
||||
* [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which)
|
||||
* for keyboard events (keydown, keypress, and keyup).
|
||||
*/
|
||||
which?: number;
|
||||
/**
|
||||
* x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
|
||||
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
|
||||
*/
|
||||
x?: number;
|
||||
/**
|
||||
* y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
|
||||
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
|
||||
*/
|
||||
y?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// functions attached to global object (window)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
|
||||
//declare var module: (...modules: any[]) => any;
|
||||
// Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
|
||||
// declare var module: (...modules: any[]) => any;
|
||||
declare global {
|
||||
export var inject: angular.IInjectStatic;
|
||||
const inject: angular.IInjectStatic;
|
||||
|
||||
/**
|
||||
* This is a global (window) function that is only available when the `ngMock` module is included.
|
||||
* It can be used to trigger a native browser event on an element, which is useful for unit testing.
|
||||
*
|
||||
* @param element Either a wrapped jQuery/jqLite node or a DOM element
|
||||
* @param eventType Optional event type. If none is specified, the function tries to determine
|
||||
* the right event type for the element, e.g. `change` for `input[text]`.
|
||||
* @param eventData An optional object which contains additional event data used when creating the event.
|
||||
*/
|
||||
function browserTrigger(
|
||||
element: JQuery | Element,
|
||||
eventType?: string,
|
||||
eventData?: angular.mock.IBrowserTriggerEventData
|
||||
): void;
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -1,14 +1,14 @@
|
||||
declare module "angular-mocks/ngMock" {
|
||||
var _: string;
|
||||
const _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngMockE2E" {
|
||||
var _: string;
|
||||
const _: string;
|
||||
export = _;
|
||||
}
|
||||
|
||||
declare module "angular-mocks/ngAnimateMock" {
|
||||
var _: string;
|
||||
const _: string;
|
||||
export = _;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"callable-types": false,
|
||||
"interface-name": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"only-arrow-functions": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -772,7 +772,7 @@ export interface VoidTypeAnnotation extends Node {
|
||||
export interface JSXAttribute extends Node {
|
||||
type: "JSXAttribute";
|
||||
name: JSXIdentifier | JSXNamespacedName;
|
||||
value: JSXElement | StringLiteral | JSXExpressionContainer;
|
||||
value: JSXElement | StringLiteral | JSXExpressionContainer | null;
|
||||
}
|
||||
|
||||
export interface JSXClosingElement extends Node {
|
||||
@@ -1424,7 +1424,7 @@ export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation)
|
||||
export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier;
|
||||
export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation;
|
||||
export function voidTypeAnnotation(): VoidTypeAnnotation;
|
||||
export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute;
|
||||
export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer | null): JSXAttribute;
|
||||
export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement;
|
||||
export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array<JSXElement | JSXExpressionContainer | JSXText>, selfClosing?: boolean): JSXElement;
|
||||
export function jSXEmptyExpression(): JSXEmptyExpression;
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/wardbell/bardjs
|
||||
// Definitions by: Andrew Archibald <https://github.com/TepigMC>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="angular" />
|
||||
/// <reference types="chai" />
|
||||
|
||||
Vendored
+12
-8
@@ -3,12 +3,16 @@
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface BlockiesIcon {
|
||||
toDataURL(): string;
|
||||
}
|
||||
interface BlockiesConfig {
|
||||
seed: string;
|
||||
}
|
||||
declare function blockies(config: BlockiesConfig): BlockiesIcon;
|
||||
|
||||
declare function blockies(config?: blockies.BlockiesConfig): HTMLCanvasElement;
|
||||
export = blockies;
|
||||
|
||||
declare namespace blockies {
|
||||
interface BlockiesConfig {
|
||||
size?: number;
|
||||
scale?: number;
|
||||
seed?: string;
|
||||
color?: string;
|
||||
bgcolor?: string;
|
||||
spotcolor?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
|
||||
Vendored
+1
-1
@@ -354,7 +354,7 @@ export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.too
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
declare global {
|
||||
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> {
|
||||
interface JQuery<TElement = HTMLElement> {
|
||||
alert(action?: "close" | "dispose"): this;
|
||||
|
||||
button(action: "toggle" | "dispose"): this;
|
||||
|
||||
Vendored
+1
-1
@@ -182,7 +182,7 @@ export class ObjectID {
|
||||
* @param {number} time optional parameter allowing to pass in a second based timestamp.
|
||||
* @return {string} return the 12 byte id binary string.
|
||||
*/
|
||||
generate(time?: number): string;
|
||||
generate(time?: number): Buffer;
|
||||
/**
|
||||
* Returns the generation date (accurate up to the second) that this ID was generated.
|
||||
* @return {date} the generation date
|
||||
|
||||
@@ -24,7 +24,12 @@ let array = [ 1, 2, 3 ];
|
||||
chai.spy.on(array, 'push');
|
||||
|
||||
// or you can track multiple object's methods
|
||||
chai.spy.on(array, 'push', 'pop');
|
||||
chai.spy.on(array, ['push', 'pop']);
|
||||
|
||||
// or you can track multiple object's methods
|
||||
chai.spy.on(array, 'push', function(item) {
|
||||
array.push(item);
|
||||
});
|
||||
|
||||
array.push(5);
|
||||
|
||||
@@ -149,4 +154,20 @@ spy.should.not.have.been.called.above(3);
|
||||
expect(spy).to.have.been.called.below(3);
|
||||
expect(spy).to.not.have.been.called.lt(3);
|
||||
spy.should.have.been.called.lt(3);
|
||||
spy.should.not.have.been.called.below(3);
|
||||
spy.should.not.have.been.called.below(3);
|
||||
|
||||
// You can also create sandbox
|
||||
let sb = chai.spy.sandbox();
|
||||
|
||||
sb.on(array, 'pop', () => {
|
||||
return 1;
|
||||
})
|
||||
|
||||
let one = array.pop();
|
||||
expect(one).to.equal(1);
|
||||
|
||||
// Can restore methods in sandbox
|
||||
sb.restore();
|
||||
array.push(2);
|
||||
let two = array.pop();
|
||||
expect(two).to.equal(2);
|
||||
|
||||
Vendored
+108
-54
@@ -1,6 +1,8 @@
|
||||
// Type definitions for chai-spies
|
||||
// Type definitions for chai-spies 1.0.0
|
||||
// Project: https://github.com/chaijs/chai-spies
|
||||
// Definitions by: Ilya Kuznetsov <https://github.com/kuzn-ilya>
|
||||
// Harm van der Werf <https://github.com/harm-less>
|
||||
// Jouni Suorsa <https://github.com/jounisuo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="chai" />
|
||||
@@ -21,7 +23,7 @@ declare namespace Chai {
|
||||
* ```ts
|
||||
* expect(spy).to.be.spy;
|
||||
* spy.should.be.spy;
|
||||
* ```
|
||||
* ```
|
||||
*/
|
||||
spy: Assertion;
|
||||
|
||||
@@ -32,7 +34,7 @@ declare namespace Chai {
|
||||
* expect(spy).to.have.been.called();
|
||||
* spy.should.have.been.called();
|
||||
* ```
|
||||
* Note that ```called``` can be used as a chainable method.
|
||||
* Note that ```called``` can be used as a chainable method.
|
||||
*/
|
||||
called: ChaiSpies.Called;
|
||||
|
||||
@@ -61,7 +63,32 @@ declare namespace Chai {
|
||||
}
|
||||
|
||||
declare namespace ChaiSpies {
|
||||
interface Sandbox {
|
||||
/**
|
||||
* #### chai.spy.on (function)
|
||||
*
|
||||
* Wraps an object method into spy. All calls will pass through to the original function.
|
||||
*
|
||||
* @param {Object} object
|
||||
* @param {String} methodNames names to spy on
|
||||
* @param {function} fn replacement function
|
||||
* @returns function to actually call
|
||||
*/
|
||||
on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any;
|
||||
|
||||
/**
|
||||
* #### chai.spy.restore (function)
|
||||
*
|
||||
* Restores previously wrapped object's method.
|
||||
* Restores all spied objects of a sandbox if called without parameters.
|
||||
*
|
||||
* @function
|
||||
* @param {Object} [object]
|
||||
* @param {String|String[]} [methods] name or names
|
||||
* @return {Sandbox} Sandbox instance
|
||||
*/
|
||||
restore(object?: Object, methodNames?: string | string[]): void;
|
||||
}
|
||||
interface Spy {
|
||||
/**
|
||||
* #### chai.spy (function)
|
||||
@@ -72,9 +99,9 @@ declare namespace ChaiSpies {
|
||||
* var spy = chai.spy(original)
|
||||
* , e_spy = chai.spy();
|
||||
* ```
|
||||
* @param fn function to spy on. @default ```function () {}```
|
||||
* @param fn function to spy on. @default ```function () {}```
|
||||
* @returns function to actually call
|
||||
*/
|
||||
*/
|
||||
(): SpyFunc0Proxy<void>;
|
||||
<R>(fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
|
||||
<A1, R>(fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
|
||||
@@ -107,10 +134,11 @@ declare namespace ChaiSpies {
|
||||
* var spy = chai.spy.on(Array, 'isArray');
|
||||
* ```
|
||||
* @param {Object} object
|
||||
* @param {String} method name to spy on
|
||||
* @param {String} method names to spy on
|
||||
* @param {function} fn replacement function
|
||||
* @returns function to actually call
|
||||
*/
|
||||
on(object: Object, ...methodNames: string[]): any;
|
||||
*/
|
||||
on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any;
|
||||
|
||||
/**
|
||||
* #### chai.spy.object (function)
|
||||
@@ -123,10 +151,24 @@ declare namespace ChaiSpies {
|
||||
* @param {String[]|Object} method names or method definitions
|
||||
* @returns object with spied methods
|
||||
*/
|
||||
object(name: string, methods: string[]): any;
|
||||
object(methods: string[]): any;
|
||||
object<T>(name: string, methods: T): T;
|
||||
object<T>(methods: T): T;
|
||||
object(name: string, methods: string[]): any;
|
||||
object(methods: string[]): any;
|
||||
object<T>(name: string, methods: T): T;
|
||||
object<T>(methods: T): T;
|
||||
|
||||
/**
|
||||
* #### chai.spy.restore (function)
|
||||
*
|
||||
* Restores spy assigned to DEFAULT sandbox
|
||||
*
|
||||
* Restores previously wrapped object's method.
|
||||
* Restores all spied objects of a sandbox if called without parameters.
|
||||
*
|
||||
* @param {Object} [object]
|
||||
* @param {String|String[]} [methods] name or names
|
||||
* @return {Sandbox} Sandbox instance
|
||||
*/
|
||||
restore(object?: Object, methodNames?: string | string[]): void;
|
||||
|
||||
/**
|
||||
* #### chai.spy.returns (function)
|
||||
@@ -141,6 +183,18 @@ declare namespace ChaiSpies {
|
||||
*/
|
||||
|
||||
returns<T>(value: T): SpyFunc0Proxy<T>;
|
||||
|
||||
/**
|
||||
* ### chai.spy.sandbox
|
||||
*
|
||||
* Creates a sandbox.
|
||||
*
|
||||
* Sandbox is a set of spies.
|
||||
* Sandbox allows to track methods on objects and restore original methods with on restore call.
|
||||
*
|
||||
* @returns {Sandbox}
|
||||
*/
|
||||
sandbox(): Sandbox;
|
||||
}
|
||||
|
||||
interface Called {
|
||||
@@ -158,12 +212,12 @@ declare namespace ChaiSpies {
|
||||
* spy.should.not.have.been.called.once;
|
||||
* ```
|
||||
*/
|
||||
once: Chai.Assertion;
|
||||
once: Chai.Assertion;
|
||||
|
||||
/**
|
||||
* ####.twice
|
||||
* Assert that a spy has been called exactly twice.
|
||||
* ```ts
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.twice;
|
||||
* expect(spy).to.not.have.been.called.twice;
|
||||
* spy.should.have.been.called.twice;
|
||||
@@ -215,7 +269,7 @@ declare namespace ChaiSpies {
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.above(3);
|
||||
* spy.should.not.have.been.called.above(3);
|
||||
* ```
|
||||
* ```
|
||||
*/
|
||||
above(n: number): Chai.Assertion;
|
||||
|
||||
@@ -225,7 +279,7 @@ declare namespace ChaiSpies {
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.gt(3);
|
||||
* spy.should.not.have.been.called.gt(3);
|
||||
* ```
|
||||
* ```
|
||||
*/
|
||||
gt(n: number): Chai.Assertion;
|
||||
|
||||
@@ -235,7 +289,7 @@ declare namespace ChaiSpies {
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.below(3);
|
||||
* spy.should.not.have.been.called.below(3);
|
||||
* ```
|
||||
* ```
|
||||
*/
|
||||
below(n: number): Chai.Assertion;
|
||||
|
||||
@@ -245,7 +299,7 @@ declare namespace ChaiSpies {
|
||||
* ```ts
|
||||
* expect(spy).to.have.been.called.lt(3);
|
||||
* spy.should.not.have.been.called.lt(3);
|
||||
* ```
|
||||
* ```
|
||||
*/
|
||||
lt(n: number): Chai.Assertion;
|
||||
}
|
||||
@@ -301,7 +355,7 @@ declare namespace ChaiSpies {
|
||||
* spy.should.have.been.called.with('foo');
|
||||
* ```
|
||||
* Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```.
|
||||
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
|
||||
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
|
||||
* ```ts
|
||||
* spy('foo', 'bar', 1);
|
||||
* expect(spy).to.have.been.called.with('bar', 'foo');
|
||||
@@ -389,7 +443,7 @@ declare namespace ChaiSpies {
|
||||
*
|
||||
* Resets __spy object parameters for instantiation and reuse
|
||||
* @returns proxy spy object
|
||||
*/
|
||||
*/
|
||||
reset(): this;
|
||||
}
|
||||
|
||||
@@ -397,77 +451,77 @@ declare namespace ChaiSpies {
|
||||
(): R;
|
||||
}
|
||||
|
||||
interface SpyFunc1<A1, R> {
|
||||
(a: A1): R;
|
||||
interface SpyFunc1<A1, R> {
|
||||
(a: A1): R;
|
||||
}
|
||||
|
||||
interface SpyFunc2<A1, A2, R> {
|
||||
(a: A1, b: A2): R;
|
||||
interface SpyFunc2<A1, A2, R> {
|
||||
(a: A1, b: A2): R;
|
||||
}
|
||||
|
||||
interface SpyFunc3<A1, A2, A3, R> {
|
||||
(a: A1, b: A2, c: A3): R;
|
||||
interface SpyFunc3<A1, A2, A3, R> {
|
||||
(a: A1, b: A2, c: A3): R;
|
||||
}
|
||||
|
||||
interface SpyFunc4<A1, A2, A3, A4, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4): R;
|
||||
interface SpyFunc4<A1, A2, A3, A4, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4): R;
|
||||
}
|
||||
|
||||
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
|
||||
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
|
||||
}
|
||||
|
||||
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
|
||||
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
|
||||
}
|
||||
|
||||
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
|
||||
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
|
||||
}
|
||||
|
||||
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
|
||||
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
|
||||
}
|
||||
|
||||
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
|
||||
|
||||
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
|
||||
}
|
||||
|
||||
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
|
||||
|
||||
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
|
||||
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
|
||||
}
|
||||
|
||||
interface SpyFunc0Proxy<R> extends SpyFunc0<R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
|
||||
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
|
||||
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
|
||||
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
|
||||
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
|
||||
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
|
||||
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
|
||||
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
|
||||
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
|
||||
|
||||
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
|
||||
}
|
||||
|
||||
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
|
||||
|
||||
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import cosmiconfig, { CosmiconfigResult } from "cosmiconfig";
|
||||
import cosmiconfig = require("cosmiconfig");
|
||||
import { CosmiconfigResult } from "cosmiconfig";
|
||||
import * as path from "path";
|
||||
|
||||
const explorer = cosmiconfig("yourModuleName", {
|
||||
|
||||
Vendored
+52
-47
@@ -3,57 +3,62 @@
|
||||
// Definitions by: ozum <https://github.com/ozum>
|
||||
// szeck87 <https://github.com/szeck87>
|
||||
// saadq <https://github.com/saadq>
|
||||
// jinwoo <https://github.com/jinwoo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export interface Config {
|
||||
[key: string]: any;
|
||||
declare function cosmiconfig(moduleName: string, options?: cosmiconfig.ExplorerOptions): cosmiconfig.Explorer;
|
||||
|
||||
declare namespace cosmiconfig {
|
||||
interface Config {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
type CosmiconfigResult = {
|
||||
config: Config;
|
||||
filepath: string;
|
||||
isEmpty?: boolean;
|
||||
} | null;
|
||||
|
||||
interface LoaderResult {
|
||||
config: Config | null;
|
||||
filepath: string;
|
||||
}
|
||||
|
||||
type SyncLoader = (filepath: string, content: string) => Config | null;
|
||||
type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
|
||||
|
||||
interface LoaderEntry {
|
||||
sync?: SyncLoader;
|
||||
async?: AsyncLoader;
|
||||
}
|
||||
|
||||
interface Loaders {
|
||||
[key: string]: LoaderEntry;
|
||||
}
|
||||
|
||||
interface Explorer {
|
||||
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
|
||||
searchSync(searchFrom?: string): null | CosmiconfigResult;
|
||||
load(loadPath: string): Promise<CosmiconfigResult>;
|
||||
loadSync(loadPath: string): CosmiconfigResult;
|
||||
clearLoadCache(): void;
|
||||
clearSearchCache(): void;
|
||||
clearCaches(): void;
|
||||
}
|
||||
|
||||
// These are the user options with defaults applied.
|
||||
interface ExplorerOptions {
|
||||
stopDir?: string;
|
||||
cache?: boolean;
|
||||
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
|
||||
packageProp?: string;
|
||||
loaders?: Loaders;
|
||||
searchPlaces?: string[];
|
||||
ignoreEmptySearchPlaces?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export type CosmiconfigResult = {
|
||||
config: Config;
|
||||
filepath: string;
|
||||
isEmpty?: boolean;
|
||||
} | null;
|
||||
|
||||
export interface LoaderResult {
|
||||
config: Config | null;
|
||||
filepath: string;
|
||||
}
|
||||
|
||||
export type SyncLoader = (filepath: string, content: string) => Config | null;
|
||||
export type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
|
||||
|
||||
export interface LoaderEntry {
|
||||
sync?: SyncLoader;
|
||||
async?: AsyncLoader;
|
||||
}
|
||||
|
||||
export interface Loaders {
|
||||
[key: string]: LoaderEntry;
|
||||
}
|
||||
|
||||
export interface Explorer {
|
||||
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
|
||||
searchSync(searchFrom?: string): null | CosmiconfigResult;
|
||||
load(loadPath: string): Promise<CosmiconfigResult>;
|
||||
loadSync(loadPath: string): CosmiconfigResult;
|
||||
clearLoadCache(): void;
|
||||
clearSearchCache(): void;
|
||||
clearCaches(): void;
|
||||
}
|
||||
|
||||
// These are the user options with defaults applied.
|
||||
export interface ExplorerOptions {
|
||||
stopDir?: string;
|
||||
cache?: boolean;
|
||||
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
|
||||
packageProp?: string;
|
||||
loaders?: Loaders;
|
||||
searchPlaces?: string[];
|
||||
ignoreEmptySearchPlaces?: boolean;
|
||||
}
|
||||
|
||||
export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer;
|
||||
export = cosmiconfig;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import * as CrossFilter from 'crossfilter';
|
||||
import * as d3 from "d3";
|
||||
import * as dc from "dc";
|
||||
|
||||
|
||||
interface IYelpData {
|
||||
city: string;
|
||||
review_count: number;
|
||||
|
||||
Vendored
-4
@@ -5,10 +5,6 @@
|
||||
// matthias jobst <https://github.com/MatthiasJobst>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files
|
||||
|
||||
///<reference types="crossfilter" />
|
||||
|
||||
import * as d3 from "d3";
|
||||
|
||||
export = dc;
|
||||
|
||||
Executable → Regular
Vendored
+5
@@ -21,6 +21,11 @@ declare namespace dygraphs {
|
||||
* A per-series color definition. Used in conjunction with, and overrides, the colors option.
|
||||
*/
|
||||
color?: string;
|
||||
|
||||
/**
|
||||
* A function which plot data for this series on the chart.
|
||||
*/
|
||||
plotter?: any;
|
||||
|
||||
/**
|
||||
* Draw a small dot at each point, in addition to a line going through the point. This makes
|
||||
|
||||
Vendored
+1
-1
@@ -1173,7 +1173,7 @@ declare module 'ember' {
|
||||
* key. You can pass an optional second argument with the target value. Otherwise
|
||||
* this will match any property that evaluates to false.
|
||||
*/
|
||||
rejectBy(key: string, value?: string): NativeArray<T>;
|
||||
rejectBy(key: string, value?: any): NativeArray<T>;
|
||||
/**
|
||||
* Returns the first item in the array for which the callback returns true.
|
||||
* This method works similar to the `filter()` method defined in JavaScript 1.6
|
||||
|
||||
Vendored
+28
-6
@@ -8,6 +8,7 @@
|
||||
// Umidbek Karimov <https://github.com/umidbekkarimov>
|
||||
// Moshe Feuchtwanger <https://github.com/moshfeu>
|
||||
// Michael Prokopchuk <https://github.com/prokopcm>
|
||||
// Tina Roh <https://github.com/tinaroh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -789,11 +790,31 @@ export interface CameraProps extends ViewProps {
|
||||
}
|
||||
|
||||
export interface CameraConstants {
|
||||
readonly Type: string;
|
||||
readonly FlashMode: string;
|
||||
readonly AutoFocus: string;
|
||||
readonly WhiteBalance: string;
|
||||
readonly VideoQuality: string;
|
||||
readonly Type: {
|
||||
back: string;
|
||||
front: string;
|
||||
};
|
||||
readonly FlashMode: {
|
||||
on: string;
|
||||
off: string;
|
||||
auto: string;
|
||||
torch: string;
|
||||
};
|
||||
readonly AutoFocus: {
|
||||
on: string;
|
||||
off: string;
|
||||
};
|
||||
readonly WhiteBalance: {
|
||||
auto: string;
|
||||
sunny: string;
|
||||
cloudy: string;
|
||||
shadow: string;
|
||||
fluorescent: string;
|
||||
incandescent: string;
|
||||
};
|
||||
readonly VideoQuality: {
|
||||
[videoQuality: string]: number;
|
||||
};
|
||||
readonly BarCodeType: {
|
||||
aztec: string;
|
||||
codabar: string;
|
||||
@@ -879,7 +900,7 @@ export namespace Constants {
|
||||
};
|
||||
appKey?: string;
|
||||
androidStatusBar?: {
|
||||
barStyle?: 'lignt-content' | 'dark-content',
|
||||
barStyle?: 'light-content' | 'dark-content',
|
||||
backgroundColor?: string
|
||||
};
|
||||
androidShowExponentNotificationInShellApp?: boolean;
|
||||
@@ -2201,6 +2222,7 @@ export interface VideoProps {
|
||||
translateY?: number;
|
||||
rotation?: number;
|
||||
ref?: Ref<PlaybackObject>;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
export interface VideoState {
|
||||
|
||||
Vendored
+28
-6
@@ -6,6 +6,7 @@
|
||||
// Sergio Sánchez <https://github.com/ssanchezmarc>
|
||||
// Fernando Helwanger <https://github.com/fhelwanger>
|
||||
// Umidbek Karimov <https://github.com/umidbekkarimov>
|
||||
// Tina Roh <https://github.com/tinaroh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -787,11 +788,31 @@ export interface CameraProps extends ViewProps {
|
||||
}
|
||||
|
||||
export interface CameraConstants {
|
||||
readonly Type: string;
|
||||
readonly FlashMode: string;
|
||||
readonly AutoFocus: string;
|
||||
readonly WhiteBalance: string;
|
||||
readonly VideoQuality: string;
|
||||
readonly Type: {
|
||||
back: string;
|
||||
front: string;
|
||||
};
|
||||
readonly FlashMode: {
|
||||
on: string;
|
||||
off: string;
|
||||
auto: string;
|
||||
torch: string;
|
||||
};
|
||||
readonly AutoFocus: {
|
||||
on: string;
|
||||
off: string;
|
||||
};
|
||||
readonly WhiteBalance: {
|
||||
auto: string;
|
||||
sunny: string;
|
||||
cloudy: string;
|
||||
shadow: string;
|
||||
fluorescent: string;
|
||||
incandescent: string;
|
||||
};
|
||||
readonly VideoQuality: {
|
||||
[videoQuality: string]: number;
|
||||
};
|
||||
readonly BarCodeType: {
|
||||
aztec: string;
|
||||
codabar: string;
|
||||
@@ -877,7 +898,7 @@ export namespace Constants {
|
||||
};
|
||||
appKey?: string;
|
||||
androidStatusBar?: {
|
||||
barStyle?: 'lignt-content' | 'dark-content',
|
||||
barStyle?: 'light-content' | 'dark-content',
|
||||
backgroundColor?: string
|
||||
};
|
||||
androidShowExponentNotificationInShellApp?: boolean;
|
||||
@@ -2181,6 +2202,7 @@ export interface VideoProps {
|
||||
translateY?: number;
|
||||
rotation?: number;
|
||||
ref?: Ref<PlaybackObject>;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
export interface VideoState {
|
||||
|
||||
Vendored
+11
-3
@@ -67,19 +67,19 @@ declare namespace ExpressBrute {
|
||||
* @summary Allows you to override the value of failCallback for this middleware.
|
||||
* @type {Function}
|
||||
*/
|
||||
failCallback: Function;
|
||||
failCallback?: Function;
|
||||
|
||||
/**
|
||||
* @summary Disregard IP address when matching requests if set to true. Defaults to false.
|
||||
* @type {boolean}
|
||||
*/
|
||||
ignoreIP: boolean;
|
||||
ignoreIP?: boolean;
|
||||
|
||||
/**
|
||||
* @summary Key.
|
||||
* @type {any}
|
||||
*/
|
||||
key: any;
|
||||
key?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,5 +156,13 @@ declare namespace ExpressBrute {
|
||||
reset(key: string, callback: (error: any) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "express-serve-static-core" {
|
||||
export interface Request {
|
||||
brute?: {
|
||||
reset?: (callback?: () => void) => void
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export = ExpressBrute;
|
||||
|
||||
@@ -26,3 +26,19 @@ io.use(sharedsession(session));
|
||||
io.use(sharedsession(session, { autoSave: true, saveUninitialized: true }));
|
||||
io.use(sharedsession(session, cookieParser));
|
||||
io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true }));
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
const sessionID = [
|
||||
socket.handshake.sessionID,
|
||||
socket.handshake.session!.id
|
||||
];
|
||||
const sessionData = [
|
||||
socket.handshake.session!['sessionEntry'],
|
||||
socket.handshake.session!.anotherSessionEntry
|
||||
];
|
||||
socket.handshake.session!.touch(() => {});
|
||||
socket.handshake.session!.regenerate(() => {});
|
||||
socket.handshake.session!.save(() => {});
|
||||
socket.handshake.session!.reload(() => {});
|
||||
socket.handshake.session!.destroy(() => {});
|
||||
});
|
||||
|
||||
+7
@@ -7,6 +7,13 @@
|
||||
import socketio = require('socket.io');
|
||||
import express = require('express');
|
||||
|
||||
declare module "socket.io" {
|
||||
interface Handshake {
|
||||
session?: Express.Session;
|
||||
sessionID?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function sharedsession(
|
||||
expressSessionMiddleware: express.RequestHandler,
|
||||
cookieParserMiddleware: express.RequestHandler,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
declare var el: Element;
|
||||
declare var els: Element[];
|
||||
declare var els: HTMLElement[];
|
||||
declare var mixinFn: Function;
|
||||
|
||||
function TestComponent() {
|
||||
|
||||
+1
-1
@@ -1387,7 +1387,7 @@ interface hasStartAndEndDateBuilder<B> {
|
||||
}
|
||||
|
||||
interface hasStats {
|
||||
getStatsFor(dateRange: DayOfWeekString): AdWordsStats;
|
||||
getStatsFor(dateRange: DateRange): AdWordsStats;
|
||||
getStatsFor(dateFrom: AdWordsDate | string, dateTo: AdWordsDate | string): AdWordsStats;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,33 @@ map.fitBounds({
|
||||
top: 50
|
||||
});
|
||||
|
||||
/***** Pan map to bounds *****/
|
||||
map.panToBounds({
|
||||
north: 10,
|
||||
east: 10,
|
||||
west: 10,
|
||||
south: 10
|
||||
})
|
||||
|
||||
map.panToBounds({
|
||||
north: 10,
|
||||
east: 10,
|
||||
west: 10,
|
||||
south: 10
|
||||
}, 50)
|
||||
|
||||
map.panToBounds({
|
||||
east: 10,
|
||||
north: 10,
|
||||
south: 10,
|
||||
west: 10
|
||||
}, {
|
||||
bottom: 100,
|
||||
left: 150,
|
||||
right: 150,
|
||||
top: 50
|
||||
});
|
||||
|
||||
|
||||
/***** Data *****/
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -51,7 +51,7 @@ declare namespace google.maps {
|
||||
getZoom(): number;
|
||||
panBy(x: number, y: number): void;
|
||||
panTo(latLng: LatLng|LatLngLiteral): void;
|
||||
panToBounds(latLngBounds: LatLngBounds|LatLngBoundsLiteral): void;
|
||||
panToBounds(latLngBounds: LatLngBounds|LatLngBoundsLiteral, padding?: number|Padding): void;
|
||||
setCenter(latlng: LatLng|LatLngLiteral): void;
|
||||
setHeading(heading: number): void;
|
||||
setMapTypeId(mapTypeId: MapTypeId|string): void;
|
||||
|
||||
@@ -4,8 +4,10 @@ const params: ReCaptchaV2.Parameters = {
|
||||
type: "image",
|
||||
size: "normal",
|
||||
tabindex: 5,
|
||||
isolated: false,
|
||||
callback: (response: string) => { },
|
||||
"expired-callback": () => { },
|
||||
"error-callback": () => { },
|
||||
};
|
||||
|
||||
const size1: ReCaptchaV2.Size = "compact";
|
||||
@@ -25,6 +27,7 @@ const id1: number = grecaptcha.render("foo");
|
||||
const id2: number = grecaptcha.render("foo", params);
|
||||
const id3: number = grecaptcha.render(document.getElementById("foo"));
|
||||
const id4: number = grecaptcha.render(document.getElementById("foo"), params);
|
||||
const id5: number = grecaptcha.render(document.getElementById("foo"), params, true);
|
||||
|
||||
// response takes a number and returns a string
|
||||
const response1: string = grecaptcha.getResponse(id1);
|
||||
|
||||
Vendored
+28
-9
@@ -1,19 +1,24 @@
|
||||
// Type definitions for Google Recaptcha 2.0
|
||||
// Project: https://www.google.com/recaptcha
|
||||
// Definitions by: Kristof Mattei <http://kristofmattei.be>, Martin Costello <https://martincostello.com/>, Ruslan Arkhipau <https://github.com/DethAriel>
|
||||
// Definitions by: Kristof Mattei <http://kristofmattei.be>
|
||||
// Martin Costello <https://martincostello.com/>
|
||||
// Ruslan Arkhipau <https://github.com/DethAriel>
|
||||
// Rafael Tavares <https://github.com/rafaeltavares>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var grecaptcha: ReCaptchaV2.ReCaptcha;
|
||||
|
||||
declare namespace ReCaptchaV2 {
|
||||
class ReCaptcha {
|
||||
interface ReCaptcha {
|
||||
/**
|
||||
* Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.
|
||||
* @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself.
|
||||
* @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters.
|
||||
* @param inherit Invisible reCAPTCHA only. Use existing data-* attributes on the element if the corresponding parameter is not specified.
|
||||
* The values in parameters will take precedence over the attributes.
|
||||
* @return the ID of the newly created widget.
|
||||
*/
|
||||
render(container: (string | HTMLElement), parameters?: Parameters): number;
|
||||
render(container: (string | HTMLElement), parameters?: Parameters, inherit?: boolean): number;
|
||||
/**
|
||||
* Resets the reCAPTCHA widget.
|
||||
* @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified.
|
||||
@@ -65,11 +70,6 @@ declare namespace ReCaptchaV2 {
|
||||
* If other elements in your page use tabindex, it should be set to make user navigation easier.
|
||||
*/
|
||||
tabindex?: number;
|
||||
/**
|
||||
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
|
||||
* The user's response, g-recaptcha-response, will be the input for your callback function.
|
||||
*/
|
||||
callback?(response: string): void;
|
||||
/**
|
||||
* Optional. The badge location for g-recaptcha with size of "invisible".
|
||||
*
|
||||
@@ -77,10 +77,29 @@ declare namespace ReCaptchaV2 {
|
||||
*/
|
||||
badge?: Badge;
|
||||
/**
|
||||
* Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA.
|
||||
* Optional. Invisible reCAPTCHA only. For plugin owners to not interfere with existing reCAPTCHA installations on a page.
|
||||
* If true, this reCAPTCHA instance will be part of a separate ID space.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
isolated?: boolean;
|
||||
/**
|
||||
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
|
||||
* The user's response, g-recaptcha-response, will be the input for your callback function.
|
||||
*/
|
||||
callback?(response: string): void;
|
||||
/**
|
||||
* Optional. Your callback function that's executed when the reCAPTCHA response expires and the user needs to solve a new CAPTCHA.
|
||||
*/
|
||||
// Notice to the reader
|
||||
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
|
||||
"expired-callback"?(): void;
|
||||
/**
|
||||
* Optional. Your callback function that's executed when reCAPTCHA encounters an error (usually network connectivity) and cannot continue until connectivity is restored.
|
||||
* If you specify this function, you are responsible for informing the user that they should retry.
|
||||
*/
|
||||
// Notice to the reader
|
||||
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
|
||||
"error-callback"?(): void;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+10
-1
@@ -7,6 +7,7 @@
|
||||
// Jason Dreyzehner <https://github.com/bitjson>
|
||||
// Synarque <https://github.com/synarque>
|
||||
// Justin Rockwood <https://github.com/jrockwood>
|
||||
// Keith Kelly <https://github.com/kwkelly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.3
|
||||
@@ -21,6 +22,13 @@ declare namespace inquirer {
|
||||
| Question<T>
|
||||
| ReadonlyArray<Question<T>>
|
||||
| Rx.Observable<Question<T>>;
|
||||
interface OutputStreamOption {
|
||||
output: NodeJS.WriteStream
|
||||
}
|
||||
interface InputStreamOption {
|
||||
input: NodeJS.ReadStream
|
||||
}
|
||||
type StreamOptions = InputStreamOption | OutputStreamOption | (InputStreamOption & OutputStreamOption);
|
||||
|
||||
interface Inquirer {
|
||||
restoreDefaultPrompts(): void;
|
||||
@@ -32,8 +40,9 @@ declare namespace inquirer {
|
||||
registerPrompt(name: string, prompt: PromptModule): void;
|
||||
/**
|
||||
* Create a new self-contained prompt module.
|
||||
* @param opt Object specifying input and output streams for the prompt
|
||||
*/
|
||||
createPromptModule(): PromptModule;
|
||||
createPromptModule(opt?: StreamOptions): PromptModule;
|
||||
/**
|
||||
* Public CLI helper interface
|
||||
* @param questions Questions settings array
|
||||
|
||||
@@ -626,3 +626,47 @@ async function testAsyncPrompt(): Promise<void> {
|
||||
}
|
||||
|
||||
testAsyncPrompt();
|
||||
|
||||
/**
|
||||
* Different prompt output example
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
//var inquirer = require("../lib/inquirer");
|
||||
|
||||
var questions = [
|
||||
{
|
||||
type: "input",
|
||||
name: "first_name",
|
||||
message: "What's your first name",
|
||||
prefix: "1 - "
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "last_name",
|
||||
message: "What's your last name",
|
||||
default: function() {
|
||||
return "Doe";
|
||||
},
|
||||
suffix: "!!"
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
name: "phone",
|
||||
message: "What's your phone number",
|
||||
validate: function(value: string): string | boolean {
|
||||
var pass = value.match(
|
||||
/^([01]{1})?[\-\.\s]?\(?(\d{3})\)?[\-\.\s]?(\d{3})[\-\.\s]?(\d{4})\s?((?:#|ext\.?\s?|x\.?\s?){1}(?:\d+)?)?$/i
|
||||
);
|
||||
if (pass) {
|
||||
return true;
|
||||
} else {
|
||||
return "Please enter a valid phone number";
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
inquirer.createPromptModule({ output: process.stderr })(questions, function(answers) {
|
||||
console.log(JSON.stringify(answers, null, " "));
|
||||
});
|
||||
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export declare class Scroll<T> {
|
||||
|
||||
}
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
import {Company} from "intercom-client";
|
||||
|
||||
export type UserIdentifier = { "id": string } | { "user_id": string } | { "email": string }
|
||||
|
||||
export interface Avatar {
|
||||
"type": "avatar",
|
||||
"image_url": string | null
|
||||
}
|
||||
|
||||
export interface SocialProfile {
|
||||
"name": "Twitter",
|
||||
readonly "id": string | null,
|
||||
"username": string | null,
|
||||
"url": string | null
|
||||
}
|
||||
|
||||
export interface Segment {
|
||||
readonly "id": string
|
||||
}
|
||||
|
||||
export interface Tag {
|
||||
readonly "id": string
|
||||
}
|
||||
|
||||
export interface LocationData {
|
||||
"type": "location_data",
|
||||
"city_name": string | null,
|
||||
"continent_code": string | null,
|
||||
"country_code": string | null,
|
||||
"country_name": string | null,
|
||||
"latitude": number | null,
|
||||
"longitude": number | null,
|
||||
"postal_code": string | null,
|
||||
"region_name": string | null,
|
||||
"timezone": string | null
|
||||
}
|
||||
|
||||
export interface User {
|
||||
"type": "user" | "contact",
|
||||
readonly "id": string,
|
||||
"user_id": string | null,
|
||||
"email": string | null,
|
||||
"app_id"?: string,
|
||||
"phone": string | null,
|
||||
"name": string | null,
|
||||
readonly "updated_at": number,
|
||||
"last_seen_ip": string | null,
|
||||
"unsubscribed_from_emails": boolean,
|
||||
"last_request_at": number | null,
|
||||
"signed_up_at": number | null,
|
||||
readonly "created_at": number,
|
||||
"session_count": number,
|
||||
"user_agent_data": string | null,
|
||||
"pseudonym": string | null,
|
||||
"anonymous": boolean,
|
||||
"custom_attributes": {
|
||||
[key: string]: any
|
||||
},
|
||||
"avatar": Avatar,
|
||||
"location_data": LocationData | {},
|
||||
"social_profiles": {
|
||||
"type": "social_profile.list",
|
||||
"social_profiles": SocialProfile[]
|
||||
},
|
||||
"companies": {
|
||||
"type": "company.list",
|
||||
"companies": Company[]
|
||||
},
|
||||
"segments": {
|
||||
"type": "segment.list",
|
||||
"segments": Segment[]
|
||||
|
||||
},
|
||||
"tags": {
|
||||
"type": "tag.list",
|
||||
"tags": Tag[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface List {
|
||||
"type": "user.list",
|
||||
"total_count": number,
|
||||
"users": User[],
|
||||
"pages": { "next"?: string, "page": number, "per_page": number, "total_pages": number }
|
||||
}
|
||||
Vendored
+33
-1
@@ -1,7 +1,10 @@
|
||||
// Type definitions for intercom-client 2.9
|
||||
// Project: https://github.com/intercom/intercom-node
|
||||
// Definitions by: Jinesh Shah <https://github.com/jineshshah36>
|
||||
// Definitions by: Jinesh Shah <https://github.com/jineshshah36>, Josef Hornych <https://github.com/peping>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
import { List as UserList, User, UserIdentifier } from './User';
|
||||
import { Scroll } from './Scroll';
|
||||
|
||||
export interface IdentityVerificationOptions {
|
||||
secretKey: string;
|
||||
@@ -11,3 +14,32 @@ export interface IdentityVerificationOptions {
|
||||
export const IdentityVerification: {
|
||||
userHash(opts: IdentityVerificationOptions): string;
|
||||
};
|
||||
|
||||
export class Client {
|
||||
constructor(auth: { token: string } | { appId: string, appApiKey: string });
|
||||
constructor(username: string, password: string);
|
||||
|
||||
users: Users;
|
||||
}
|
||||
|
||||
export interface Company {
|
||||
readonly "id": string;
|
||||
}
|
||||
|
||||
export class Users {
|
||||
create(user: Partial<User>): Promise<User>;
|
||||
|
||||
update(user: UserIdentifier & Partial<User>): Promise<User>;
|
||||
|
||||
find(identifier: UserIdentifier): Promise<User>;
|
||||
|
||||
list(): Promise<UserList>;
|
||||
|
||||
listBy(params: {tag_id: string, segment_id: string}): Promise<UserList>;
|
||||
|
||||
scroll: Scroll<User>;
|
||||
|
||||
archive(): Promise<User>;
|
||||
|
||||
requestPermanentDeletion(): Promise<{id: number}>;
|
||||
}
|
||||
|
||||
Vendored
+13
-11
@@ -21,7 +21,7 @@ declare namespace Intercom_ {
|
||||
activator?: string;
|
||||
};
|
||||
company?: {
|
||||
id: string|number,
|
||||
id: string | number,
|
||||
name: string,
|
||||
created_at: number,
|
||||
plan?: string,
|
||||
@@ -33,16 +33,17 @@ declare namespace Intercom_ {
|
||||
}
|
||||
|
||||
type IntercomCommand = 'boot'
|
||||
|'shutdown'
|
||||
|'update'
|
||||
|'hide'
|
||||
|'show'
|
||||
|'showMessages'
|
||||
|'showNewMessage'
|
||||
|'onHide'
|
||||
|'onShow'
|
||||
|'onActivatorClick'
|
||||
|'trackEvent';
|
||||
| 'shutdown'
|
||||
| 'update'
|
||||
| 'hide'
|
||||
| 'show'
|
||||
| 'showMessages'
|
||||
| 'showNewMessage'
|
||||
| 'onHide'
|
||||
| 'onShow'
|
||||
| 'onUnreadCountChange'
|
||||
| 'onActivatorClick'
|
||||
| 'trackEvent';
|
||||
|
||||
interface IntercomStatic {
|
||||
(command: 'boot', param: IntercomSettings): void;
|
||||
@@ -51,6 +52,7 @@ declare namespace Intercom_ {
|
||||
(command: 'showNewMessage', param?: string): void;
|
||||
(command: 'onHide' | 'onShow' | 'onActivatorClick', param?: () => void): void;
|
||||
(command: 'trackEvent', tag?: string, metadata?: any): void;
|
||||
(command: 'onUnreadCountChange', cb: (unreadCount: number) => void): void;
|
||||
(command: IntercomCommand, param1?: any, param2?: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ Intercom('showMessages');
|
||||
Intercom('showNewMessage');
|
||||
Intercom('showNewMessage', 'pre-populated content');
|
||||
Intercom('onHide', () => { /* Do stuff */ });
|
||||
Intercom('onUnreadCountChange', (unreadCount: number) => { /* Do stuff */ });
|
||||
Intercom('onActivatorClick', () => { /* Do stuff */ });
|
||||
Intercom('trackEvent', 'invited-friend');
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -16,6 +16,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import Promise = require('bluebird');
|
||||
import tls = require('tls');
|
||||
|
||||
interface RedisStatic {
|
||||
new(port?: number, host?: string, options?: IORedis.RedisOptions): IORedis.Redis;
|
||||
@@ -827,9 +828,7 @@ declare namespace IORedis {
|
||||
*/
|
||||
autoResendUnfulfilledCommands?: boolean;
|
||||
lazyConnect?: boolean;
|
||||
tls?: {
|
||||
ca: Buffer;
|
||||
};
|
||||
tls?: tls.ConnectionOptions;
|
||||
sentinels?: Array<{ host: string; port: number; }>;
|
||||
name?: string;
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,10 @@ new Redis({
|
||||
password: 'auth',
|
||||
db: 0,
|
||||
retryStrategy() { return false; },
|
||||
showFriendlyErrorStack: true
|
||||
showFriendlyErrorStack: true,
|
||||
tls: {
|
||||
servername: 'tlsservername'
|
||||
}
|
||||
});
|
||||
|
||||
const pub = new Redis();
|
||||
|
||||
Vendored
+10
@@ -209,6 +209,14 @@ declare namespace jest {
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
interface Each {
|
||||
(cases: any[]): (name: string, fn: (...args: any[]) => any) => void;
|
||||
(strings: TemplateStringsArray, ...placeholders: any[]): (
|
||||
name: string,
|
||||
fn: (arg: any) => any
|
||||
) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a test closure
|
||||
*/
|
||||
@@ -227,6 +235,7 @@ declare namespace jest {
|
||||
only: It;
|
||||
skip: It;
|
||||
concurrent: It;
|
||||
each: Each;
|
||||
}
|
||||
|
||||
interface Describe {
|
||||
@@ -234,6 +243,7 @@ declare namespace jest {
|
||||
(name: number | string | Function | FunctionLike, fn: EmptyFunction): void;
|
||||
only: Describe;
|
||||
skip: Describe;
|
||||
each: Each;
|
||||
}
|
||||
|
||||
interface MatcherUtils {
|
||||
|
||||
+1017
-743
File diff suppressed because it is too large
Load Diff
Vendored
+28
-7
@@ -1,4 +1,4 @@
|
||||
// Type definitions for joi v13.0.1
|
||||
// Type definitions for joi v13.3.0
|
||||
// Project: https://github.com/hapijs/joi
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Laurence Dougal Myers <https://github.com/laurence-myers>
|
||||
@@ -12,6 +12,7 @@
|
||||
// Anjun Wang <https://github.com/wanganjun>
|
||||
// Rafael Kallis <https://github.com/rafaelkallis>
|
||||
// Conan Lai <https://github.com/aconanlai>
|
||||
// Peter Thorson <https://github.com/zaphoyd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -106,6 +107,13 @@ export interface EmailOptions {
|
||||
minDomainAtoms?: number;
|
||||
}
|
||||
|
||||
export interface HexOptions {
|
||||
/**
|
||||
* hex decoded representation must be byte aligned
|
||||
*/
|
||||
byteAligned: boolean;
|
||||
}
|
||||
|
||||
export interface IpOptions {
|
||||
/**
|
||||
* One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture
|
||||
@@ -512,6 +520,11 @@ export interface NumberSchema extends AnySchema {
|
||||
* Requires the number to be negative.
|
||||
*/
|
||||
negative(): this;
|
||||
|
||||
/**
|
||||
* Requires the number to be a TCP port, so between 0 and 65535.
|
||||
*/
|
||||
port(): this;
|
||||
}
|
||||
|
||||
export interface StringSchema extends AnySchema {
|
||||
@@ -624,7 +637,7 @@ export interface StringSchema extends AnySchema {
|
||||
/**
|
||||
* Requires the string value to be a valid hexadecimal string.
|
||||
*/
|
||||
hex(): this;
|
||||
hex(options?: HexOptions): this;
|
||||
|
||||
/**
|
||||
* Requires the string value to be a valid hostname as per RFC1123.
|
||||
@@ -714,10 +727,15 @@ export interface ArraySchema extends AnySchema {
|
||||
export interface ObjectSchema extends AnySchema {
|
||||
|
||||
/**
|
||||
* Sets the allowed object keys.
|
||||
* Sets or extends the allowed object keys.
|
||||
*/
|
||||
keys(schema?: SchemaMap): this;
|
||||
|
||||
/**
|
||||
* Appends the allowed object keys. If schema is null, undefined, or {}, no changes will be applied.
|
||||
*/
|
||||
append(schema?: SchemaMap): this;
|
||||
|
||||
/**
|
||||
* Specifies the minimum number of keys in the object.
|
||||
*/
|
||||
@@ -966,7 +984,7 @@ export interface Rules<P extends object = any> {
|
||||
name: string;
|
||||
params?: ObjectSchema | {[key in keyof P]: SchemaLike; };
|
||||
setup?(this: ExtensionBoundSchema, params: P): Schema | void;
|
||||
validate?<R = any>(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): Err | R;
|
||||
validate?(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): any;
|
||||
description?: string | ((params: P) => string);
|
||||
}
|
||||
|
||||
@@ -974,8 +992,8 @@ export interface Extension {
|
||||
name: string;
|
||||
base?: Schema;
|
||||
language?: LanguageOptions;
|
||||
coerce?<R = any>(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): Err | R;
|
||||
pre?<R = any>(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): Err | R;
|
||||
coerce?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): any;
|
||||
pre?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): any;
|
||||
describe?(this: Schema, description: Description): Description;
|
||||
rules?: Rules[];
|
||||
}
|
||||
@@ -1101,10 +1119,13 @@ export function ref(key: string, options?: ReferenceOptions): Reference;
|
||||
export function isRef(ref: any): ref is Reference;
|
||||
|
||||
/**
|
||||
* Get a sub-schema of an existing schema based on a path. Path separator is a dot (.).
|
||||
* Get a sub-schema of an existing schema based on a `path` that can be either a string or an array
|
||||
* of strings For string values path separator is a dot (`.`)
|
||||
*/
|
||||
export function reach(schema: ObjectSchema, path: string): Schema;
|
||||
export function reach<T extends Schema>(schema: ObjectSchema, path: string): T;
|
||||
export function reach(schema: ObjectSchema, path: string[]): Schema;
|
||||
export function reach<T extends Schema>(schema: ObjectSchema, path: string[]): T;
|
||||
|
||||
/**
|
||||
* Creates a new Joi instance customized with the extension(s) you provide included.
|
||||
|
||||
+16
-4
@@ -96,6 +96,12 @@ emailOpts = { minDomainAtoms: num };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
let hexOpts: Joi.HexOptions = null;
|
||||
|
||||
hexOpts = { byteAligned: bool };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
let ipOpts: Joi.IpOptions = null;
|
||||
|
||||
ipOpts = { version: str };
|
||||
@@ -602,6 +608,7 @@ numSchema = numSchema.precision(num);
|
||||
numSchema = numSchema.multiple(num);
|
||||
numSchema = numSchema.positive();
|
||||
numSchema = numSchema.negative();
|
||||
numSchema = numSchema.port();
|
||||
|
||||
namespace common {
|
||||
numSchema = numSchema.allow(x);
|
||||
@@ -659,6 +666,9 @@ objSchema = Joi.object(schemaMap);
|
||||
objSchema = objSchema.keys();
|
||||
objSchema = objSchema.keys(schemaMap);
|
||||
|
||||
objSchema = objSchema.append();
|
||||
objSchema = objSchema.append(schemaMap);
|
||||
|
||||
objSchema = objSchema.min(num);
|
||||
objSchema = objSchema.max(num);
|
||||
objSchema = objSchema.length(num);
|
||||
@@ -801,6 +811,7 @@ strSchema = strSchema.guid();
|
||||
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions);
|
||||
strSchema = strSchema.guid({ version: 'uuidv4' });
|
||||
strSchema = strSchema.hex();
|
||||
strSchema = strSchema.hex(hexOpts);
|
||||
strSchema = strSchema.hostname();
|
||||
strSchema = strSchema.isoDate();
|
||||
strSchema = strSchema.lowercase();
|
||||
@@ -969,6 +980,7 @@ description = Joi.describe(schema);
|
||||
description = schema.describe();
|
||||
|
||||
schema = Joi.reach(objSchema, '');
|
||||
schema = Joi.reach(objSchema, []);
|
||||
|
||||
const Joi2 = Joi.extend({ name: '', base: schema });
|
||||
|
||||
@@ -988,13 +1000,13 @@ const Joi3 = Joi.extend({
|
||||
{
|
||||
name: 'asd',
|
||||
params: {
|
||||
allowF: Joi.boolean().default(false),
|
||||
allowFalse: Joi.boolean().default(false),
|
||||
},
|
||||
setup(params) {
|
||||
const fIsAllowed = params.allowF;
|
||||
const fIsAllowed = params.allowFalse;
|
||||
},
|
||||
validate(params, value, state, options) {
|
||||
if (value === 'asd' || params.allowF && value === 'asdf') {
|
||||
validate(params, value: boolean, state, options) {
|
||||
if (value || params.allowFalse && !value) {
|
||||
return value;
|
||||
}
|
||||
return this.createError('asd', { v: value }, state, options);
|
||||
|
||||
Vendored
+647
-595
File diff suppressed because it is too large
Load Diff
+222
-21
@@ -42,7 +42,7 @@ function JQueryStatic() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$([new HTMLElement()]);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<{ foo: string; hello: string; }>
|
||||
$({ foo: 'bar', hello: 'world' });
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -58,6 +58,41 @@ function JQueryStatic() {
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$();
|
||||
|
||||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432
|
||||
function issue_19597_378218432() {
|
||||
let myDiv = $(document.createElement('div'));
|
||||
// $ExpectType JQuery<HTMLDivElement>
|
||||
myDiv;
|
||||
myDiv.on('click', (evt) => {
|
||||
let target = evt.target;
|
||||
// $ExpectType HTMLDivElement
|
||||
target;
|
||||
});
|
||||
let myDiv1 = $<HTMLDivElement>(document.createElement('div'));
|
||||
|
||||
let myForcedDiv: JQuery<HTMLDivElement> = $(document.createElement('div')) as any;
|
||||
myForcedDiv.on('click', (evt) => {
|
||||
let target = evt.target; // HTMLDivElement
|
||||
// $ExpectType HTMLDivElement
|
||||
target;
|
||||
});
|
||||
let myDoc = $(document);
|
||||
// $ExpectType JQuery<Document>
|
||||
myDoc;
|
||||
myDoc.on('click', (evt) => {
|
||||
let target = evt.target;
|
||||
// $ExpectType Document
|
||||
target;
|
||||
});
|
||||
let myDocForced: JQuery<Document> = $(document);
|
||||
let myWindow = $(window);
|
||||
// $ExpectType JQuery<Window>
|
||||
myWindow;
|
||||
let myWindowForced: JQuery<Window> = $(window);
|
||||
// $ExpectType JQuery<Window>
|
||||
myWindowForced;
|
||||
}
|
||||
}
|
||||
|
||||
function ajaxSettings() {
|
||||
@@ -699,7 +734,9 @@ function JQueryStatic() {
|
||||
|
||||
function map() {
|
||||
// $ExpectType number[]
|
||||
$.map([1, 2, 3], (elementOfArray, indexInArray) => {
|
||||
$.map([1, 2, 3], function (elementOfArray, indexInArray) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType number
|
||||
elementOfArray;
|
||||
// $ExpectType number
|
||||
@@ -708,11 +745,49 @@ function JQueryStatic() {
|
||||
return 200 + 10;
|
||||
});
|
||||
|
||||
// $ExpectType number[]
|
||||
$.map([1, 2, 3], function (elementOfArray, indexInArray) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType number
|
||||
elementOfArray;
|
||||
// $ExpectType number
|
||||
indexInArray;
|
||||
|
||||
return [200, 10];
|
||||
});
|
||||
|
||||
// $ExpectType (number | null)[]
|
||||
$.map([1, 2, 3], function (elementOfArray, indexInArray) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType number
|
||||
elementOfArray;
|
||||
// $ExpectType number
|
||||
indexInArray;
|
||||
|
||||
return [200, 10, null];
|
||||
});
|
||||
|
||||
// $ExpectType (number | undefined)[]
|
||||
$.map([1, 2, 3], function (elementOfArray, indexInArray) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType number
|
||||
elementOfArray;
|
||||
// $ExpectType number
|
||||
indexInArray;
|
||||
|
||||
return [200, 10, undefined];
|
||||
});
|
||||
|
||||
// $ExpectType (false | 1)[]
|
||||
$.map({
|
||||
myProp: true,
|
||||
name: 'Rogers',
|
||||
}, (propertyOfObject, key) => {
|
||||
}, function (propertyOfObject, key) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType string | boolean
|
||||
propertyOfObject;
|
||||
// $ExpectType "myProp" | "name"
|
||||
@@ -725,6 +800,67 @@ function JQueryStatic() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// $ExpectType (string | number | boolean)[]
|
||||
$.map({
|
||||
myProp: true,
|
||||
name: 'Rogers',
|
||||
}, function (propertyOfObject, key) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType string | boolean
|
||||
propertyOfObject;
|
||||
// $ExpectType "myProp" | "name"
|
||||
key;
|
||||
|
||||
return [propertyOfObject, 24];
|
||||
});
|
||||
|
||||
// $ExpectType (false | 1)[]
|
||||
$.map({
|
||||
myProp: true,
|
||||
name: 'Rogers',
|
||||
anotherProp: 70,
|
||||
}, function (propertyOfObject, key) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType string | number | boolean
|
||||
propertyOfObject;
|
||||
// $ExpectType "myProp" | "name" | "anotherProp"
|
||||
key;
|
||||
|
||||
switch (key) {
|
||||
case 'myProp':
|
||||
return 1;
|
||||
case 'name':
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
// $ExpectType (false | 1)[]
|
||||
$.map({
|
||||
myProp: true,
|
||||
name: 'Rogers',
|
||||
anotherProp: 70,
|
||||
}, function (propertyOfObject, key) {
|
||||
// $ExpectType Window
|
||||
this;
|
||||
// $ExpectType string | number | boolean
|
||||
propertyOfObject;
|
||||
// $ExpectType "myProp" | "name" | "anotherProp"
|
||||
key;
|
||||
|
||||
switch (key) {
|
||||
case 'myProp':
|
||||
return 1;
|
||||
case 'name':
|
||||
return false;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
|
||||
function merge() {
|
||||
@@ -2041,7 +2177,7 @@ function JQuery() {
|
||||
|
||||
function ajax() {
|
||||
function ajaxComplete() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Document>
|
||||
$(document).ajaxComplete(function(event, jqXHR, ajaxOptions) {
|
||||
// $ExpectType Document
|
||||
this;
|
||||
@@ -2057,7 +2193,7 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function ajaxError() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Document>
|
||||
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
|
||||
// $ExpectType Document
|
||||
this;
|
||||
@@ -2075,7 +2211,7 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function ajaxSend() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Document>
|
||||
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
// $ExpectType Document
|
||||
this;
|
||||
@@ -2091,7 +2227,7 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function ajaxStart() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Document>
|
||||
$(document).ajaxStart(function() {
|
||||
// $ExpectType Document
|
||||
this;
|
||||
@@ -2101,7 +2237,7 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function ajaxStop() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Document>
|
||||
$(document).ajaxStop(function() {
|
||||
// $ExpectType Document
|
||||
this;
|
||||
@@ -2111,7 +2247,7 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function ajaxSuccess() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Document>
|
||||
$(document).ajaxSuccess(function(event, jqXHR, ajaxOptions, data) {
|
||||
// $ExpectType Document
|
||||
this;
|
||||
@@ -5898,8 +6034,9 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function contents() {
|
||||
// $ExpectType JQuery<HTMLElement | Comment | Text>
|
||||
$('p').contents();
|
||||
// TODO: Flaky test due to type ordering.
|
||||
// // $ExpectType JQuery<HTMLElement | Comment | Text>
|
||||
// $('p').contents();
|
||||
}
|
||||
|
||||
function end() {
|
||||
@@ -6131,7 +6268,7 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function map() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<string>
|
||||
$('p').map(function(index, domElement) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
@@ -6143,7 +6280,7 @@ function JQuery() {
|
||||
return 'myVal';
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<string>
|
||||
$('p').map(function(index, domElement) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
@@ -6155,7 +6292,7 @@ function JQuery() {
|
||||
return ['myVal1', 'myVal2'];
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<string | null>
|
||||
$('p').map(function(index, domElement) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
@@ -6164,10 +6301,10 @@ function JQuery() {
|
||||
// $ExpectType HTMLElement
|
||||
domElement;
|
||||
|
||||
return null;
|
||||
return ['myVal1', 'myVal2', null];
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<string | undefined>
|
||||
$('p').map(function(index, domElement) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
@@ -6176,8 +6313,72 @@ function JQuery() {
|
||||
// $ExpectType HTMLElement
|
||||
domElement;
|
||||
|
||||
return undefined;
|
||||
return ['myVal1', 'myVal2', undefined];
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<string>
|
||||
$('p').map(function(index, domElement) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType HTMLElement
|
||||
domElement;
|
||||
|
||||
let value: string;
|
||||
|
||||
if (index % 2 === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
value = 'myVal';
|
||||
|
||||
return value;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<string>
|
||||
$('p').map(function(index, domElement) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType HTMLElement
|
||||
domElement;
|
||||
|
||||
let value: string;
|
||||
|
||||
if (index % 2 === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
value = 'myVal';
|
||||
|
||||
return value;
|
||||
});
|
||||
|
||||
// // $ExpectType JQuery<never>
|
||||
// $('p').map(function(index, domElement) {
|
||||
// // $ExpectType HTMLElement
|
||||
// this;
|
||||
// // $ExpectType number
|
||||
// index;
|
||||
// // $ExpectType HTMLElement
|
||||
// domElement;
|
||||
//
|
||||
// return null;
|
||||
// });
|
||||
|
||||
// // $ExpectType JQuery<never>
|
||||
// $('p').map(function(index, domElement) {
|
||||
// // $ExpectType HTMLElement
|
||||
// this;
|
||||
// // $ExpectType number
|
||||
// index;
|
||||
// // $ExpectType HTMLElement
|
||||
// domElement;
|
||||
//
|
||||
// return undefined;
|
||||
// });
|
||||
}
|
||||
|
||||
function slice() {
|
||||
@@ -6857,7 +7058,7 @@ function JQuery_jqXHR() {
|
||||
}
|
||||
}
|
||||
|
||||
function compatibleWithPromise(): Promise<any> {
|
||||
function compatibleWithPromise(): JQuery._Promise<any> {
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -7279,7 +7480,7 @@ function JQuery_Promise3() {
|
||||
return s;
|
||||
}
|
||||
|
||||
function compatibleWithPromise(): Promise<any> {
|
||||
function compatibleWithPromise(): JQuery._Promise<any> {
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -7423,7 +7624,7 @@ function JQuery_Promise2(p: JQuery.Promise2<string, Error, number, JQuery, strin
|
||||
return s;
|
||||
}
|
||||
|
||||
function compatibleWithPromise(): Promise<any> {
|
||||
function compatibleWithPromise(): JQuery._Promise<any> {
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -7544,7 +7745,7 @@ function JQuery_Promise(p: JQuery.Promise<string, Error, number>) {
|
||||
return s;
|
||||
}
|
||||
|
||||
function compatibleWithPromise(): Promise<any> {
|
||||
function compatibleWithPromise(): JQuery._Promise<any> {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/// <reference types="bluebird-global" />
|
||||
|
||||
// Pulls in bluebird-global to test compatibility.
|
||||
// Fixes https://github.com/DefinitelyTyped/DefinitelyTyped/issues/26328.
|
||||
@@ -3428,7 +3428,7 @@ function examples() {
|
||||
function map_0() {
|
||||
$('p')
|
||||
.append($('input').map(function() {
|
||||
return $(this).val();
|
||||
return $(this).val() as string;
|
||||
})
|
||||
.get()
|
||||
.join(', '));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import jq = require('jquery/dist/jquery.slim');
|
||||
|
||||
const $window = jq(window);
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Window>
|
||||
$window;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import jq = require('jquery');
|
||||
|
||||
const $window = jq(window);
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
// $ExpectType JQuery<Window>
|
||||
$window;
|
||||
|
||||
class CanvasLayersDirective {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery-tests.ts",
|
||||
"test/bluebird-global-tests.ts",
|
||||
"test/example-tests.ts",
|
||||
"test/longdesc-tests.ts",
|
||||
"test/learn-tests.ts",
|
||||
@@ -29,4 +30,4 @@
|
||||
"test/jquery-slim-no-window-module-tests.ts",
|
||||
"test/jquery-slim-window-module-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"no-empty-interface": false,
|
||||
"no-misused-new": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
|
||||
Vendored
+1
-1
@@ -4760,6 +4760,6 @@ declare namespace _ {
|
||||
zipObjectDeep: LodashZipObjectDeep;
|
||||
zipWith: LodashZipWith;
|
||||
__: lodash.__;
|
||||
placehodler: lodash.__;
|
||||
placeholder: lodash.__;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ async function main() {
|
||||
" interface LoDashFp {",
|
||||
...interfaceGroups.map(g => ` ${g.functionName}: ${g.interfaces[0].name};`),
|
||||
" __: lodash.__;",
|
||||
" placehodler: lodash.__;",
|
||||
" placeholder: lodash.__;",
|
||||
" }",
|
||||
"}",
|
||||
"",
|
||||
|
||||
Vendored
+1
-1
@@ -67,7 +67,7 @@ export declare class Element {
|
||||
|
||||
getText(): string;
|
||||
|
||||
getChildText(name: string, xmlns: any): string;
|
||||
getChildText(name: string, xmlns?: any): string;
|
||||
|
||||
/**
|
||||
* Return all direct descendents that are Elements.
|
||||
|
||||
@@ -2,6 +2,11 @@ import * as ltx from 'ltx';
|
||||
|
||||
ltx.parse('<document/>');
|
||||
|
||||
const getChildTextElement = ltx.parse('<test><child>body text</child></test>') as ltx.Element;
|
||||
if (getChildTextElement.getChildText('child') !== 'body text') {
|
||||
throw new Error("body does not match");
|
||||
}
|
||||
|
||||
const p = new ltx.Parser();
|
||||
|
||||
p.on('tree', (ignored: any) => {});
|
||||
|
||||
Vendored
+49
-38
@@ -1,7 +1,8 @@
|
||||
// Type definitions for Marked 0.3
|
||||
// Type definitions for Marked 0.4
|
||||
// Project: https://github.com/chjj/marked
|
||||
// Definitions by: William Orr <https://github.com/worr>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// CrossR <https://github.com/CrossR>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace marked;
|
||||
@@ -202,21 +203,9 @@ declare namespace marked {
|
||||
|
||||
interface MarkedOptions {
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
* A prefix URL for any relative link.
|
||||
*/
|
||||
renderer?: Renderer;
|
||||
|
||||
/**
|
||||
* Enable GitHub flavored markdown.
|
||||
*/
|
||||
gfm?: boolean;
|
||||
|
||||
/**
|
||||
* Enable GFM tables. This option requires the gfm option to be true.
|
||||
*/
|
||||
tables?: boolean;
|
||||
baseUrl?: string;
|
||||
|
||||
/**
|
||||
* Enable GFM line breaks. This option requires the gfm option to be true.
|
||||
@@ -224,34 +213,19 @@ declare namespace marked {
|
||||
breaks?: boolean;
|
||||
|
||||
/**
|
||||
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
|
||||
* Enable GitHub flavored markdown.
|
||||
*/
|
||||
pedantic?: boolean;
|
||||
gfm?: boolean;
|
||||
|
||||
/**
|
||||
* Sanitize the output. Ignore any HTML that has been input.
|
||||
* Include an id attribute when emitting headings.
|
||||
*/
|
||||
sanitize?: boolean;
|
||||
headerIds?: boolean;
|
||||
|
||||
/**
|
||||
* Optionally sanitize found HTML with a sanitizer function.
|
||||
* Set the prefix for header tag ids.
|
||||
*/
|
||||
sanitizer?(html: string): string;
|
||||
|
||||
/**
|
||||
* Mangle autolinks (<email@domain.com>).
|
||||
*/
|
||||
mangle?: boolean;
|
||||
|
||||
/**
|
||||
* Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
|
||||
*/
|
||||
smartLists?: boolean;
|
||||
|
||||
/**
|
||||
* Shows an HTML error message when rendering fails.
|
||||
*/
|
||||
silent?: boolean;
|
||||
headerPrefix?: string;
|
||||
|
||||
/**
|
||||
* A function to highlight code blocks. The function takes three arguments: code, lang, and callback.
|
||||
@@ -263,15 +237,52 @@ declare namespace marked {
|
||||
*/
|
||||
langPrefix?: string;
|
||||
|
||||
/**
|
||||
* Mangle autolinks (<email@domain.com>).
|
||||
*/
|
||||
mangle?: boolean;
|
||||
|
||||
/**
|
||||
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
|
||||
*/
|
||||
pedantic?: boolean;
|
||||
|
||||
/**
|
||||
* Type: object Default: new Renderer()
|
||||
*
|
||||
* An object containing functions to render tokens to HTML.
|
||||
*/
|
||||
renderer?: Renderer;
|
||||
|
||||
/**
|
||||
* Sanitize the output. Ignore any HTML that has been input.
|
||||
*/
|
||||
sanitize?: boolean;
|
||||
|
||||
/**
|
||||
* Optionally sanitize found HTML with a sanitizer function.
|
||||
*/
|
||||
sanitizer?(html: string): string;
|
||||
|
||||
/**
|
||||
* Shows an HTML error message when rendering fails.
|
||||
*/
|
||||
silent?: boolean;
|
||||
|
||||
/**
|
||||
* Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
|
||||
*/
|
||||
smartLists?: boolean;
|
||||
|
||||
/**
|
||||
* Use "smart" typograhic punctuation for things like quotes and dashes.
|
||||
*/
|
||||
smartypants?: boolean;
|
||||
|
||||
/**
|
||||
* Set the prefix for header tag ids.
|
||||
* Enable GFM tables. This option requires the gfm option to be true.
|
||||
*/
|
||||
headerPrefix?: string;
|
||||
tables?: boolean;
|
||||
|
||||
/**
|
||||
* Generate closing slash for self-closing tags (<br/> instead of <br>)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as marked from 'marked';
|
||||
|
||||
const options: marked.MarkedOptions = {
|
||||
baseUrl: '',
|
||||
gfm: true,
|
||||
tables: true,
|
||||
breaks: false,
|
||||
@@ -16,23 +17,24 @@ const options: marked.MarkedOptions = {
|
||||
renderer: new marked.Renderer()
|
||||
};
|
||||
|
||||
function callback() {
|
||||
console.log('callback called');
|
||||
function callback(err: string, markdown: string) {
|
||||
console.log("Callback called!");
|
||||
return markdown;
|
||||
}
|
||||
|
||||
const myOldMarked: typeof marked = marked.setOptions(options);
|
||||
|
||||
console.log(marked('i am using __markdown__.'));
|
||||
console.log(marked('i am using __markdown__.', options));
|
||||
console.log(marked('i am using __markdown__.', callback));
|
||||
console.log(marked('i am using __markdown__.', options, callback));
|
||||
console.log(marked('1) I am using __markdown__.'));
|
||||
console.log(marked('2) I am using __markdown__.', options));
|
||||
console.log(marked('3) I am using __markdown__.', callback));
|
||||
console.log(marked('4) I am using __markdown__.', options, callback));
|
||||
|
||||
console.log(marked.parse('i am using __markdown__.'));
|
||||
console.log(marked.parse('i am using __markdown__.', options));
|
||||
console.log(marked.parse('i am using __markdown__.', callback));
|
||||
console.log(marked.parse('i am using __markdown__.', options, callback));
|
||||
console.log(marked.parse('5) I am using __markdown__.'));
|
||||
console.log(marked.parse('6) I am using __markdown__.', options));
|
||||
console.log(marked.parse('7) I am using __markdown__.', callback));
|
||||
console.log(marked.parse('8) I am using __markdown__.', options, callback));
|
||||
|
||||
const text = 'something';
|
||||
const text = 'Something';
|
||||
const tokens: marked.TokensList = marked.lexer(text, options);
|
||||
console.log(marked.parser(tokens));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as materialize from "materialize-css";
|
||||
|
||||
const elem = document.querySelector('.whatever')!;
|
||||
const elem = document.querySelector('.whatever') as HTMLElement;
|
||||
|
||||
M.textareaAutoResize(elem);
|
||||
M.textareaAutoResize($(elem));
|
||||
|
||||
Vendored
+4467
-2181
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@ Bignumbers examples
|
||||
{
|
||||
// configure the default type of numbers as BigNumbers
|
||||
math.config({
|
||||
number: 'bignumber',
|
||||
number: 'BigNumber',
|
||||
precision: 20,
|
||||
});
|
||||
|
||||
@@ -108,16 +108,13 @@ Complex numbers examples
|
||||
|
||||
// create a complex number from polar coordinates
|
||||
{
|
||||
const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 };
|
||||
const c: math.Complex = math
|
||||
.complex(p);
|
||||
const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 };
|
||||
const c: math.Complex = math.complex(p);
|
||||
}
|
||||
|
||||
// get polar coordinates of a complex number
|
||||
{
|
||||
const p: math.PolarCoordinates = math
|
||||
.complex(3, 4)
|
||||
.toPolar();
|
||||
const p: math.PolarCoordinates = math.complex(3, 4).toPolar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +172,11 @@ Expressions examples
|
||||
|
||||
// get and set variables and functions
|
||||
{
|
||||
parser.eval('x = 7 / 2'); // 3.5
|
||||
parser.eval('x + 3'); // 6.5
|
||||
parser.eval('f(x, y) = x^y'); // f(x, y)
|
||||
parser.eval('f(2, 3)'); // 8
|
||||
|
||||
const x = parser.get('x');
|
||||
const f = parser.get('f');
|
||||
const g = f(3, 3);
|
||||
@@ -193,7 +195,7 @@ Fractions examples
|
||||
{
|
||||
// configure the default type of numbers as Fractions
|
||||
math.config({
|
||||
number: 'fraction',
|
||||
number: 'Fraction',
|
||||
});
|
||||
|
||||
const x = math.fraction(0.125);
|
||||
@@ -205,9 +207,6 @@ Fractions examples
|
||||
|
||||
// output formatting
|
||||
const a = math.fraction('2/3');
|
||||
console.log(math.format(a));
|
||||
console.log(math.format(a, {fraction: 'ratio'}));
|
||||
console.log(math.format(a, {fraction: 'decimal'}));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -237,7 +236,8 @@ Matrices examples
|
||||
|
||||
b.subset(math.index(1, [0, 1]), [[7, 8]]);
|
||||
const c = math.multiply(a, b);
|
||||
const d: math.Matrix = c.subset(math.index(1, 0));
|
||||
const f: math.Matrix = math.matrix([1, 0]);
|
||||
const d: math.Matrix = f.subset(math.index(1, 0));
|
||||
}
|
||||
|
||||
// get a sub matrix
|
||||
@@ -282,8 +282,9 @@ Sparse matrices examples
|
||||
// do operations with a sparse matrix
|
||||
const b = math.multiply(a, a);
|
||||
const c = math.multiply(b, math.complex(2, 2));
|
||||
const d = math.transpose(c);
|
||||
const e = math.multiply(d, a);
|
||||
const d = math.matrix([0, 1]);
|
||||
const e = math.transpose(d);
|
||||
const f = math.multiply(e, a);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -299,8 +300,8 @@ Units examples
|
||||
math.createUnit('foo');
|
||||
math.createUnit('furlong', '220 yards');
|
||||
math.createUnit('furlong', '220 yards', {override: true});
|
||||
math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67});
|
||||
math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true});
|
||||
math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67});
|
||||
math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true});
|
||||
math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']});
|
||||
math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']}, {override: true});
|
||||
math.createUnit('knot', {
|
||||
@@ -309,7 +310,7 @@ Units examples
|
||||
prefixes: 'long'
|
||||
}, {override: true});
|
||||
math.createUnit({
|
||||
foo: {
|
||||
foo_2: {
|
||||
prefixes: 'long'
|
||||
},
|
||||
bar: '40 foo',
|
||||
|
||||
Vendored
+5
@@ -68,6 +68,11 @@ export declare interface Response {
|
||||
readonly names: Translations;
|
||||
};
|
||||
readonly postal?: { code: string };
|
||||
readonly isp?: {
|
||||
readonly isp: string;
|
||||
readonly autonomous_system_number: number;
|
||||
};
|
||||
readonly connection?: { connection_type: string };
|
||||
}
|
||||
|
||||
export declare interface Translations {
|
||||
|
||||
Vendored
+4
-7
@@ -1,12 +1,9 @@
|
||||
// Type definitions for memoize-one 3.1
|
||||
// Project: https://github.com/alexreardon/memoize-one#readme
|
||||
// Definitions by: Karol Majewski <https://github.com/karol-majewski>
|
||||
// Definitions by: Karol Majewski <https://github.com/karol-majewski>, Frank Li <https://github.com/franklixuefei>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = memoizeOne;
|
||||
declare function memoizeOne<T extends (...args: any[]) => any>(resultFn: T, isEqual?: EqualityFn): T;
|
||||
export type EqualityFn = (a: any, b: any) => boolean;
|
||||
|
||||
declare function memoizeOne<T extends (...args: any[]) => any>(resultFn: T, isEqual?: memoizeOne.EqualityFn): T;
|
||||
|
||||
declare namespace memoizeOne {
|
||||
type EqualityFn = (a: any, b: any) => boolean;
|
||||
}
|
||||
export default memoizeOne;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import memoizeOne = require('memoize-one');
|
||||
import memoizeOne, { EqualityFn } from 'memoize-one';
|
||||
|
||||
declare function add(a: number, b: number): number ;
|
||||
declare function lousyEqualityFn(a: any, b: any): boolean;
|
||||
@@ -30,4 +30,4 @@ memoizeOne(add, (a: string, b: string) => 0); // $ExpectError
|
||||
/**
|
||||
* The `EqualityFn` type is publicly accessible.
|
||||
*/
|
||||
const simpleIsEqual: memoizeOne.EqualityFn = (x: number, y: number): boolean => (x === y);
|
||||
const simpleIsEqual: EqualityFn = (x: number, y: number): boolean => (x === y);
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for microrouter 2.2
|
||||
// Type definitions for microrouter 3.1
|
||||
// Project: https://github.com/pedronauck/micro-router#readme
|
||||
// Definitions by: Mathieu Dutour <https://github.com/mathieudutour>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -21,6 +21,7 @@ export type AugmentedRequestHandler = (
|
||||
export type RouteHandler = (path: string, handler: AugmentedRequestHandler) => RequestHandler;
|
||||
|
||||
export function router(...routes: RequestHandler[]): RequestHandler;
|
||||
export function withNamespace(namespace: string): (...routes: RequestHandler[]) => RequestHandler;
|
||||
|
||||
export const get: RouteHandler;
|
||||
export const post: RouteHandler;
|
||||
|
||||
+6
-6
@@ -80,12 +80,12 @@ declare module "moment" {
|
||||
}
|
||||
|
||||
interface LocaleSpecification {
|
||||
durationLabelsLong: DurationLabelDef;
|
||||
durationLabelsStandard: DurationLabelDef;
|
||||
durationLabelsShort: DurationLabelDef;
|
||||
durationTimeTemplates: DurationTimeDef;
|
||||
durationLabelTypes: DurationLabelTypeDef[];
|
||||
durationPluralKey: (token: string, integerValue: number, decimalValue: number) => string;
|
||||
durationLabelsLong?: DurationLabelDef;
|
||||
durationLabelsStandard?: DurationLabelDef;
|
||||
durationLabelsShort?: DurationLabelDef;
|
||||
durationTimeTemplates?: DurationTimeDef;
|
||||
durationLabelTypes?: DurationLabelTypeDef[];
|
||||
durationPluralKey?: (token: string, integerValue: number, decimalValue: number) => string;
|
||||
}
|
||||
|
||||
type TemplateFunction = ((this: DurationFormatSettings) => string);
|
||||
|
||||
Vendored
+1
-1
@@ -1252,7 +1252,7 @@ export class Cursor<T = Default> extends Readable {
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */
|
||||
limit(value: number): Cursor<T>;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */
|
||||
map(transform: Function): Cursor<T>;
|
||||
map<U>(transform: (document: T) => U): Cursor<U>;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */
|
||||
max(max: number): Cursor<T>;
|
||||
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
|
||||
Vendored
+2
@@ -854,6 +854,8 @@ declare module "mongoose" {
|
||||
typeKey?: string;
|
||||
/** defaults to false */
|
||||
useNestedStrict?: boolean;
|
||||
/** defaults to false */
|
||||
usePushEach?: boolean;
|
||||
/** defaults to true */
|
||||
validateBeforeSave?: boolean;
|
||||
/** defaults to "__v" */
|
||||
|
||||
Vendored
+5
-5
@@ -39,7 +39,7 @@ declare namespace naver.maps {
|
||||
*/
|
||||
interface MapEventListener {
|
||||
eventName: string;
|
||||
listener: () => any;
|
||||
listener: (event: any) => any;
|
||||
listenerId: string;
|
||||
target: any;
|
||||
}
|
||||
@@ -1303,14 +1303,14 @@ declare namespace naver.maps {
|
||||
|
||||
function Event(): void;
|
||||
namespace Event {
|
||||
function addDOMListener(element: HTMLElement, eventName: string, listener: () => any): void;
|
||||
function addListener(target: any, eventName: string, listener: () => any): MapEventListener;
|
||||
function addDOMListener(element: HTMLElement, eventName: string, listener: (event: any) => any): void;
|
||||
function addListener(target: any, eventName: string, listener: (event: any) => any): MapEventListener;
|
||||
function clearInstanceListeners(target: any): void;
|
||||
function clearListeners(target: any, fromEventName: string): void;
|
||||
function forward(source: any, fromEventName: string, target: any, toEventName: string): MapEventListener;
|
||||
function hasListener(target: any, eventName: string): boolean;
|
||||
function once(target: any, eventName: string, listener: () => any): MapEventListener;
|
||||
function removeDOMListener(element: HTMLElement, eventName: string, listener: () => any): void;
|
||||
function once(target: any, eventName: string, listener: (event: any) => any): MapEventListener;
|
||||
function removeDOMListener(element: HTMLElement, eventName: string, listener: (event: any) => any): void;
|
||||
function removeDOMListener(listeners: DOMEventListener | DOMEventListener[]): void;
|
||||
function removeListener(listeners: MapEventListener | MapEventListener[]): void;
|
||||
function resumeDispatch(target: any, eventName: string): void;
|
||||
|
||||
Vendored
+25
-15
@@ -8,12 +8,11 @@ export interface EventChangeOptions {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type PopStateCallback = (state: any) => boolean | undefined;
|
||||
|
||||
export type RouterCallback = () => void;
|
||||
export interface RouterProps {
|
||||
// router properties
|
||||
readonly components: {
|
||||
[key: string]: { Component: React.ComponentType<any>; err: any };
|
||||
};
|
||||
// url property fields
|
||||
readonly pathname: string;
|
||||
readonly route: string;
|
||||
readonly asPath?: string;
|
||||
@@ -27,39 +26,50 @@ export interface RouterProps {
|
||||
| string[];
|
||||
};
|
||||
|
||||
// router methods
|
||||
reload(route: string): Promise<void>;
|
||||
// property fields
|
||||
readonly components: {
|
||||
[key: string]: { Component: React.ComponentType<any>; err: any };
|
||||
};
|
||||
|
||||
// core method fields
|
||||
back(): void;
|
||||
beforePopState(cb: PopStateCallback): boolean;
|
||||
prefetch(url: string): Promise<React.ComponentType<any>>;
|
||||
push(
|
||||
url: string | UrlLike,
|
||||
as?: string | UrlLike,
|
||||
options?: EventChangeOptions,
|
||||
): Promise<boolean>;
|
||||
reload(route: string): Promise<void>;
|
||||
replace(
|
||||
url: string | UrlLike,
|
||||
as?: string | UrlLike,
|
||||
options?: EventChangeOptions,
|
||||
): Promise<boolean>;
|
||||
prefetch(url: string): Promise<React.ComponentType<any>>;
|
||||
|
||||
// router events
|
||||
// events
|
||||
onAppUpdated?(nextRoute: string): void;
|
||||
onRouteChangeStart?(url: string): void;
|
||||
onBeforeHistoryChange?(as: string): void;
|
||||
onHashChangeStart?(url: string): void;
|
||||
onHashChangeComplete?(url: string): void;
|
||||
onRouteChangeComplete?(url: string): void;
|
||||
onRouteChangeError?(error: any, url: string): void;
|
||||
onRouteChangeStart?(url: string): void;
|
||||
}
|
||||
|
||||
export interface SingletonRouter {
|
||||
router: RouterProps;
|
||||
export interface SingletonRouter extends RouterProps {
|
||||
router: RouterProps | null;
|
||||
readyCallbacks: RouterCallback[];
|
||||
ready(cb: RouterCallback): void;
|
||||
}
|
||||
|
||||
export interface WithRouterProps {
|
||||
router: SingletonRouter;
|
||||
}
|
||||
|
||||
export function withRouter<T extends {}>(
|
||||
Component: React.ComponentType<T & SingletonRouter>,
|
||||
Component: React.ComponentType<T & WithRouterProps>,
|
||||
): React.ComponentType<T>;
|
||||
|
||||
export const Singleton: SingletonRouter;
|
||||
export type ImperativeRouter = RouterProps;
|
||||
export default Singleton;
|
||||
declare const Router: SingletonRouter;
|
||||
export default Router;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Router, * as r from "next/router";
|
||||
import Router, { withRouter, WithRouterProps } from "next/router";
|
||||
import * as React from "react";
|
||||
import * as qs from "querystring";
|
||||
|
||||
@@ -13,8 +13,8 @@ Router.ready(() => {
|
||||
|
||||
// Access readonly properties of the router.
|
||||
|
||||
Object.keys(Router.router.components).forEach(key => {
|
||||
const c = Router.router.components[key];
|
||||
Object.keys(Router.components).forEach(key => {
|
||||
const c = Router.components[key];
|
||||
c.err.isAnAny;
|
||||
|
||||
return <c.Component />;
|
||||
@@ -26,52 +26,78 @@ function split(routeLike: string) {
|
||||
});
|
||||
}
|
||||
|
||||
if (Router.router.asPath) {
|
||||
split(Router.router.asPath);
|
||||
split(Router.router.asPath);
|
||||
if (Router.asPath) {
|
||||
split(Router.asPath);
|
||||
split(Router.asPath);
|
||||
}
|
||||
|
||||
split(Router.router.pathname);
|
||||
split(Router.pathname);
|
||||
|
||||
const query = `?${qs.stringify(Router.router.query)}`;
|
||||
const query = `?${qs.stringify(Router.query)}`;
|
||||
|
||||
// Assign some callback methods.
|
||||
Router.router.onAppUpdated = (nextRoute: string) => console.log(nextRoute);
|
||||
Router.router.onRouteChangeStart = (url: string) =>
|
||||
Router.onAppUpdated = (nextRoute: string) => console.log(nextRoute);
|
||||
Router.onRouteChangeStart = (url: string) =>
|
||||
console.log("Route is starting to change.", url);
|
||||
Router.router.onBeforeHistoryChange = (as: string) =>
|
||||
Router.onBeforeHistoryChange = (as: string) =>
|
||||
console.log("History hasn't changed yet.", as);
|
||||
Router.router.onRouteChangeComplete = (url: string) =>
|
||||
Router.onRouteChangeComplete = (url: string) =>
|
||||
console.log("Route chaneg is complete.", url);
|
||||
Router.router.onRouteChangeError = (err: any, url: string) =>
|
||||
Router.onRouteChangeError = (err: any, url: string) =>
|
||||
console.log("Route is starting to change.", url, err);
|
||||
|
||||
// Call methods on the router itself.
|
||||
Router.router.reload("/route").then(() => console.log("route was reloaded"));
|
||||
Router.router.back();
|
||||
Router.reload("/route").then(() => console.log("route was reloaded"));
|
||||
Router.back();
|
||||
Router.beforePopState(({ url }) => !!url);
|
||||
|
||||
Router.router.push("/route").then((success: boolean) =>
|
||||
Router.push("/route").then((success: boolean) =>
|
||||
console.log("route push success: ", success),
|
||||
);
|
||||
Router.router.push("/route", "/asRoute").then((success: boolean) =>
|
||||
Router.push("/route", "/asRoute").then((success: boolean) =>
|
||||
console.log("route push success: ", success),
|
||||
);
|
||||
Router.router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) =>
|
||||
Router.push("/route", "/asRoute", { shallow: false }).then((success: boolean) =>
|
||||
console.log("route push success: ", success),
|
||||
);
|
||||
|
||||
Router.router.replace("/route").then((success: boolean) =>
|
||||
Router.replace("/route").then((success: boolean) =>
|
||||
console.log("route replace success: ", success),
|
||||
);
|
||||
Router.router.replace("/route", "/asRoute").then((success: boolean) =>
|
||||
Router.replace("/route", "/asRoute").then((success: boolean) =>
|
||||
console.log("route replace success: ", success),
|
||||
);
|
||||
Router.router.replace("/route", "/asRoute", {
|
||||
Router.replace("/route", "/asRoute", {
|
||||
shallow: false,
|
||||
}).then((success: boolean) => console.log("route replace success: ", success));
|
||||
|
||||
Router.router.prefetch("/route").then(Component => {
|
||||
Router.prefetch("/route").then(Component => {
|
||||
const element = <Component />;
|
||||
});
|
||||
|
||||
r.withRouter(props => <div />);
|
||||
interface TestComponentProps {
|
||||
testValue: string;
|
||||
}
|
||||
|
||||
class TestComponent extends React.Component<TestComponentProps & WithRouterProps> {
|
||||
state = { ready: false };
|
||||
|
||||
constructor(props: TestComponentProps & WithRouterProps) {
|
||||
super(props);
|
||||
props.router.ready(() => {
|
||||
this.setState({ ready: true });
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>{this.state.ready ? 'Ready' : 'Not Ready'}</h1>
|
||||
<h2>Route: {this.props.router.route}</h2>
|
||||
<p>Another prop: {this.props.testValue}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
withRouter(TestComponent);
|
||||
|
||||
Vendored
+40
-11
@@ -25,6 +25,7 @@
|
||||
// Alexander T. <https://github.com/a-tarasyuk>
|
||||
// Lishude <https://github.com/islishude>
|
||||
// Andrew Makarov <https://github.com/r3nya>
|
||||
// Zane Hannan AU <https://github.com/ZaneHannanAU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** inspector module types */
|
||||
@@ -2560,11 +2561,19 @@ declare module "dns" {
|
||||
ttl: number;
|
||||
}
|
||||
|
||||
export interface AnyRecordWithTtl extends RecordWithTtl {
|
||||
type: "A" | "AAAA";
|
||||
}
|
||||
|
||||
export interface MxRecord {
|
||||
priority: number;
|
||||
exchange: string;
|
||||
}
|
||||
|
||||
export interface AnyMxRecord extends MxRecord {
|
||||
type: "MX";
|
||||
}
|
||||
|
||||
export interface NaptrRecord {
|
||||
flags: string;
|
||||
service: string;
|
||||
@@ -2574,6 +2583,10 @@ declare module "dns" {
|
||||
preference: number;
|
||||
}
|
||||
|
||||
export interface AnyNaptrRecord extends NaptrRecord {
|
||||
type: "NAPTR";
|
||||
}
|
||||
|
||||
export interface SoaRecord {
|
||||
nsname: string;
|
||||
hostmaster: string;
|
||||
@@ -2584,6 +2597,10 @@ declare module "dns" {
|
||||
minttl: number;
|
||||
}
|
||||
|
||||
export interface AnySoaRecord extends SoaRecord {
|
||||
type: "SOA";
|
||||
}
|
||||
|
||||
export interface SrvRecord {
|
||||
priority: number;
|
||||
weight: number;
|
||||
@@ -2591,9 +2608,19 @@ declare module "dns" {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface AnySrvRecord extends SrvRecord {
|
||||
type: "SRV";
|
||||
}
|
||||
|
||||
export interface AnyTxtRecord {
|
||||
type: "TXT";
|
||||
entries: string[];
|
||||
}
|
||||
|
||||
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "ANY", callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray<AnySrvRecord | AnySoaRecord | AnyNaptrRecord | AnyRecordWithTtl | AnyMxRecord | AnyTxtRecord>) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
@@ -2607,6 +2634,7 @@ declare module "dns" {
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
export namespace resolve {
|
||||
export function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
||||
export function __promisify__(hostname: string, rrtype: "ANY"): Promise<ReadonlyArray<AnySrvRecord | AnySoaRecord | AnyNaptrRecord | AnyRecordWithTtl | AnyMxRecord | AnyTxtRecord>>;
|
||||
export function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
||||
export function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
||||
export function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
||||
@@ -2637,6 +2665,7 @@ declare module "dns" {
|
||||
export function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
||||
}
|
||||
|
||||
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: ReadonlyArray<AnySrvRecord | AnySoaRecord | AnyNaptrRecord | AnyRecordWithTtl | AnyMxRecord | AnyTxtRecord>) => void): void;
|
||||
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
@@ -5807,19 +5836,19 @@ declare module "crypto" {
|
||||
verifyError: number;
|
||||
}
|
||||
export function getDiffieHellman(group_name: string): DiffieHellman;
|
||||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => any): void;
|
||||
export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string): Buffer;
|
||||
export function randomBytes(size: number): Buffer;
|
||||
export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
|
||||
export function pseudoRandomBytes(size: number): Buffer;
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
|
||||
export function randomFillSync(buffer: Buffer | Uint8Array, offset?: number, size?: number): Buffer;
|
||||
export function randomFill(buffer: Buffer, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function randomFill(buffer: Uint8Array, callback: (err: Error, buf: Uint8Array) => void): void;
|
||||
export function randomFill(buffer: Buffer, offset: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function randomFill(buffer: Uint8Array, offset: number, callback: (err: Error, buf: Uint8Array) => void): void;
|
||||
export function randomFill(buffer: Buffer, offset: number, size: number, callback: (err: Error, buf: Buffer) => void): void;
|
||||
export function randomFill(buffer: Uint8Array, offset: number, size: number, callback: (err: Error, buf: Uint8Array) => void): void;
|
||||
export function randomFill(buffer: Buffer, callback: (err: Error | null, buf: Buffer) => void): void;
|
||||
export function randomFill(buffer: Uint8Array, callback: (err: Error | null, buf: Uint8Array) => void): void;
|
||||
export function randomFill(buffer: Buffer, offset: number, callback: (err: Error | null, buf: Buffer) => void): void;
|
||||
export function randomFill(buffer: Uint8Array, offset: number, callback: (err: Error | null, buf: Uint8Array) => void): void;
|
||||
export function randomFill(buffer: Buffer, offset: number, size: number, callback: (err: Error | null, buf: Buffer) => void): void;
|
||||
export function randomFill(buffer: Uint8Array, offset: number, size: number, callback: (err: Error | null, buf: Uint8Array) => void): void;
|
||||
export interface RsaPublicKey {
|
||||
key: string;
|
||||
padding?: number;
|
||||
@@ -5836,8 +5865,8 @@ declare module "crypto" {
|
||||
export function getCiphers(): string[];
|
||||
export function getCurves(): string[];
|
||||
export function getHashes(): string[];
|
||||
export interface ECDH {
|
||||
convertKey(key: string | Buffer /*| TypedArray*/ | DataView, curve: string, inputEncoding?: string, outputEncoding?: string, format?: string): Buffer | string;
|
||||
export class ECDH {
|
||||
static convertKey(key: string | Buffer /*| TypedArray*/ | DataView, curve: string, inputEncoding?: "latin1" | "hex" | "base64", outputEncoding?: "latin1" | "hex" | "base64", format?: "uncompressed" | "compressed" | "hybrid"): Buffer | string;
|
||||
generateKeys(): Buffer;
|
||||
generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
|
||||
computeSecret(other_public_key: Buffer): Buffer;
|
||||
|
||||
@@ -1151,6 +1151,19 @@ namespace crypto_tests {
|
||||
crypto.randomFill(arr, 2, (err: Error, buf: Uint8Array) => void {});
|
||||
crypto.randomFill(arr, 2, 3, (err: Error, buf: Uint8Array) => void {});
|
||||
}
|
||||
|
||||
{
|
||||
let key: string | Buffer = Buffer.from("buf");
|
||||
let curve = "secp256k1";
|
||||
let ret: string | Buffer = crypto.ECDH.convertKey(key, curve);
|
||||
key = "0xfff";
|
||||
ret = crypto.ECDH.convertKey(key, curve);
|
||||
ret = crypto.ECDH.convertKey(key, curve, "hex");
|
||||
ret = crypto.ECDH.convertKey(key, curve, "hex", "hex");
|
||||
ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "uncompressed");
|
||||
ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "compressed");
|
||||
ret = crypto.ECDH.convertKey(key, curve, "hex", "hex", "hybrid");
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
@@ -3129,6 +3142,9 @@ namespace dns_tests {
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "ANY", (err, addresses) => {
|
||||
const _addresses: ReadonlyArray<dns.AnySrvRecord | dns.AnySoaRecord | dns.AnyNaptrRecord | dns.AnyRecordWithTtl | dns.AnyMxRecord | dns.AnyTxtRecord> = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/nodemailer/nodemailer
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Piotr Roszatycki <https://github.com/dex4er>
|
||||
// Daniel Chao <https://github.com/bioball>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+5
-7
@@ -1,14 +1,12 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { Transport, TransportOptions } from '../..';
|
||||
|
||||
import { Transport, TransportOptions } from '..';
|
||||
import * as shared from '../shared';
|
||||
|
||||
import * as shared from './shared';
|
||||
|
||||
import Mail = require('./mailer');
|
||||
import MailMessage = require('./mailer/mail-message');
|
||||
import MimeNode = require('./mime-node');
|
||||
import Mail = require('../mailer');
|
||||
import MailMessage = require('../mailer/mail-message');
|
||||
import MimeNode = require('../mime-node');
|
||||
|
||||
declare namespace SendmailTransport {
|
||||
type MailOptions = Mail.Options;
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Transform } from 'stream';
|
||||
|
||||
declare class LeUnix extends Transform {}
|
||||
|
||||
export = LeUnix;
|
||||
@@ -0,0 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Transform } from 'stream';
|
||||
|
||||
declare class LeWindows extends Transform {}
|
||||
|
||||
export = LeWindows;
|
||||
@@ -21,6 +21,8 @@ import SMTPTransport = require('nodemailer/lib/smtp-transport');
|
||||
import StreamTransport = require('nodemailer/lib/stream-transport');
|
||||
import wellKnown = require('nodemailer/lib/well-known');
|
||||
import XOAuth2 = require('nodemailer/lib/xoauth2');
|
||||
import LeWindows = require('nodemailer/lib/sendmail-transport/le-windows');
|
||||
import LeUnix = require('nodemailer/lib/sendmail-transport/le-unix');
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as stream from 'stream';
|
||||
@@ -722,6 +724,24 @@ function sendmail_test() {
|
||||
});
|
||||
}
|
||||
|
||||
// line ending transforms using windows-style newlines
|
||||
|
||||
function sendmail_line_endings_windows_test() {
|
||||
function process_le(mail: MailMessage) {
|
||||
const input = mail.message.createReadStream();
|
||||
input.pipe(new LeWindows());
|
||||
}
|
||||
}
|
||||
|
||||
// line ending transforms using unix-style newlines
|
||||
|
||||
function sendmail_line_endings_unix_test() {
|
||||
function process_le(mail: MailMessage) {
|
||||
const input = mail.message.createReadStream();
|
||||
input.pipe(new LeUnix());
|
||||
}
|
||||
}
|
||||
|
||||
// 5. SES transport
|
||||
|
||||
// Send a message using SES transport
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
"lib/mime-funcs/mime-types.d.ts",
|
||||
"lib/mime-node.d.ts",
|
||||
"lib/qp.d.ts",
|
||||
"lib/sendmail-transport.d.ts",
|
||||
"lib/sendmail-transport/index.d.ts",
|
||||
"lib/sendmail-transport/le-unix.d.ts",
|
||||
"lib/sendmail-transport/le-windows.d.ts",
|
||||
"lib/ses-transport.d.ts",
|
||||
"lib/shared.d.ts",
|
||||
"lib/smtp-connection.d.ts",
|
||||
|
||||
Vendored
+3128
-266
File diff suppressed because it is too large
Load Diff
Vendored
+16
-2
@@ -160,15 +160,21 @@ export class Gpio extends NodeJS.EventEmitter {
|
||||
disableInterrupt(): Gpio;
|
||||
|
||||
/**
|
||||
* Enables alerts for the GPIO.
|
||||
* Enables alerts for the GPIO. Returns this.
|
||||
*/
|
||||
enableAlert(): Gpio;
|
||||
|
||||
/**
|
||||
* Disables aterts for the GPIO.
|
||||
* Disables aterts for the GPIO. Returns this.
|
||||
*/
|
||||
disableAlert(): Gpio;
|
||||
|
||||
/**
|
||||
* Sets a glitch filter on a GPIO. Returns this.
|
||||
* @param steady Time, in microseconds, during which the level must be stable. Maximum value: 300000
|
||||
*/
|
||||
glitchFilter(steady: number): Gpio;
|
||||
|
||||
/*----------------------*
|
||||
* mode
|
||||
*----------------------*/
|
||||
@@ -410,3 +416,11 @@ export function terminate(): void;
|
||||
* @param peripheral an unsigned integer specifying the peripheral for timing (CLOCK_PWM or CLOCK_PCM)
|
||||
*/
|
||||
export function configureClock(microseconds: number, peripheral: number): void;
|
||||
|
||||
/**
|
||||
* Configures pigpio to use the specified socket port.
|
||||
* The default setting is to use port 8888.
|
||||
* If configureSocketPort is called, it must be called before creating Gpio objects.
|
||||
* @param port an unsigned integer specifying the pigpio socket port number
|
||||
*/
|
||||
export function configureSocketPort(port: number): void;
|
||||
|
||||
@@ -5,6 +5,7 @@ import * as assert from 'assert';
|
||||
const Gpio = pigpio.Gpio;
|
||||
|
||||
pigpio.configureClock(1, pigpio.CLOCK_PWM);
|
||||
pigpio.configureSocketPort(23456);
|
||||
|
||||
const led = new Gpio(18, {
|
||||
mode: Gpio.OUTPUT,
|
||||
@@ -878,3 +879,37 @@ import * as assert from 'assert';
|
||||
clearInterval(iv);
|
||||
}, 2000);
|
||||
})();
|
||||
|
||||
(function gpio_glitch_filter(): void {
|
||||
const Gpio = pigpio.Gpio;
|
||||
const input = new Gpio(7, {
|
||||
mode: Gpio.INPUT,
|
||||
pullUpDown: Gpio.PUD_OFF,
|
||||
alert: true
|
||||
});
|
||||
const output = new Gpio(8, {
|
||||
mode: Gpio.OUTPUT
|
||||
});
|
||||
let count = 0;
|
||||
|
||||
output.digitalWrite(0);
|
||||
input.glitchFilter(50);
|
||||
input.on('alert', (level, tick) => {
|
||||
if (level === 1) {
|
||||
count++;
|
||||
console.log(' rising edge, count=' + count);
|
||||
}
|
||||
});
|
||||
|
||||
output.trigger(30, 1); // alert function should not be executed (blocked by glitchFilter)
|
||||
|
||||
setTimeout(() => {
|
||||
output.trigger(70, 1); // alert function should be executed
|
||||
}, 500);
|
||||
|
||||
setTimeout(() => {
|
||||
assert.strictEqual(count, 1, 'expected 1 alert function call instead of ' + count);
|
||||
console.log(" success...");
|
||||
process.exit(0);
|
||||
}, 1000);
|
||||
})();
|
||||
|
||||
Vendored
+663
-211
@@ -1,216 +1,668 @@
|
||||
// Type definitions for postmark 1.3
|
||||
// Type definitions for postmark 1.4
|
||||
// Project: http://wildbit.github.io/postmark.js
|
||||
// Definitions by: Ben Bayard <https://github.com/benbayard>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface PostmarkError {
|
||||
status: number;
|
||||
message: string;
|
||||
code: number;
|
||||
}
|
||||
|
||||
interface PostmarkMessageHeader {
|
||||
Name: string;
|
||||
Value: string;
|
||||
}
|
||||
|
||||
interface PostmarkAttachment {
|
||||
Content: string;
|
||||
Name: string;
|
||||
ContentType: string;
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
count: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
interface PostmarkMessageWithTemplate {
|
||||
To: string;
|
||||
From: string;
|
||||
Cc?: string;
|
||||
Bcc?: string;
|
||||
ReplyTo?: string;
|
||||
TemplateId?: string;
|
||||
TemplateModel?: any;
|
||||
Tag?: string;
|
||||
Subject?: string;
|
||||
TrackOpens?: boolean;
|
||||
TrackLinks?: string;
|
||||
Headers?: PostmarkMessageHeader[];
|
||||
}
|
||||
|
||||
interface PostmarkMessage {
|
||||
To: string;
|
||||
From: string;
|
||||
Cc?: string;
|
||||
Bcc?: string;
|
||||
ReplyTo?: string;
|
||||
Tag?: string;
|
||||
Subject?: string;
|
||||
HTMLBody?: string;
|
||||
TextBody?: string;
|
||||
TrackOpens?: boolean;
|
||||
TrackLinks?: string;
|
||||
Headers?: PostmarkMessageHeader[];
|
||||
Attachments?: PostmarkAttachment[];
|
||||
}
|
||||
|
||||
interface Sender {
|
||||
Color: string;
|
||||
RawEmailEnabled: boolean;
|
||||
SmtpApiActivated: boolean;
|
||||
DeliveryHookUrl: string;
|
||||
InboundHookUrl: string;
|
||||
BounceHookUrl: boolean;
|
||||
IncludeBounceContentInHook: boolean;
|
||||
OpenHookUrl: boolean;
|
||||
PostFirstOpenOnly: boolean;
|
||||
TrackOpens: boolean;
|
||||
TrackLinks: string;
|
||||
InboundDomain: string;
|
||||
InboundSpamThreshold: number;
|
||||
}
|
||||
|
||||
interface TemplateValidator<T extends object> {
|
||||
Subject: string;
|
||||
HtmlBody: string;
|
||||
TextBody: string;
|
||||
TestRenderModel?: T;
|
||||
InlineCssForHtmlTestRender?: boolean;
|
||||
}
|
||||
|
||||
type PostmarkCallback<T extends object = any> = ((e: PostmarkError, ret: T) => void) | undefined;
|
||||
|
||||
interface SimpleOptions {
|
||||
ssl: boolean;
|
||||
requestHost: string;
|
||||
}
|
||||
|
||||
interface Options extends SimpleOptions {
|
||||
requestFactory(
|
||||
options: SimpleOptions
|
||||
): (
|
||||
path?: string,
|
||||
type?: string,
|
||||
content?: PostmarkMessage,
|
||||
callback?: PostmarkCallback
|
||||
) => any;
|
||||
}
|
||||
|
||||
declare class Client {
|
||||
constructor(serverKey: string, options?: Partial<Options>);
|
||||
send(message: PostmarkMessage, callback: PostmarkCallback): void;
|
||||
sendEmailWithTemplate(
|
||||
message: PostmarkMessageWithTemplate,
|
||||
callback: PostmarkCallback
|
||||
): void;
|
||||
batch(message: PostmarkMessage[], callback: PostmarkCallback): void;
|
||||
sendEmail(message: PostmarkMessage, callback: PostmarkCallback): void;
|
||||
sendEmailBatch(message: PostmarkMessage[], callback: PostmarkCallback): void;
|
||||
getDeliveryStatistics(callback: PostmarkCallback): void;
|
||||
getBounces(filter: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
getBounce(id: number, callback: PostmarkCallback): void;
|
||||
getBounceDump(id: number, callback: PostmarkCallback): void;
|
||||
activateBounce(id: number, callback: PostmarkCallback): void;
|
||||
getBounceTags(callback: PostmarkCallback): void;
|
||||
getServer(callback: PostmarkCallback): void;
|
||||
editServer<T extends keyof Sender>(options: Pick<Sender, T>, callback: PostmarkCallback): void;
|
||||
getOutboundMessages(filter: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
getOutboundMessageDetails(id: number, callback: PostmarkCallback): void;
|
||||
getMessageOpens(filter: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
getMessageOpensForSingleMessage(id: number, filter: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
getInboundMessages(filter: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
getInboundMessageDetails(id: number, callback: PostmarkCallback): void;
|
||||
bypassBlockedInboundMessage(id: number, callback: PostmarkCallback): void;
|
||||
retryInboundHookForMessage(id: number, callback: PostmarkCallback): void;
|
||||
getOuboundOverview(filter: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
validateTemplate<T extends object>(templateObject: TemplateValidator<T>, callback: PostmarkCallback): void;
|
||||
}
|
||||
|
||||
interface CreateSignature {
|
||||
FromEmail: string;
|
||||
Name: string;
|
||||
ReplyToEmail?: string;
|
||||
ReturnPathDomain?: string;
|
||||
}
|
||||
|
||||
interface CreateServer {
|
||||
Name: string;
|
||||
Color?: string;
|
||||
RawEmailEnabled?: boolean;
|
||||
SmtpApiActivated?: boolean;
|
||||
DeliveryHookUrl?: string;
|
||||
InboundHookUrl?: string;
|
||||
BounceHookUrl?: string;
|
||||
IncludeBounceContentInHook?: boolean;
|
||||
OpenHookUrl?: string;
|
||||
PostFirstOpenOnly?: boolean;
|
||||
TrackOpens?: boolean;
|
||||
TrackLinks?: string;
|
||||
InboundDomain?: string;
|
||||
InboundSpamThreshold?: number;
|
||||
}
|
||||
|
||||
interface CreateDomain {
|
||||
Name: string;
|
||||
ReturnPathDomain?: string;
|
||||
}
|
||||
|
||||
declare class AdminClient {
|
||||
constructor(apiKey: string, options: Partial<Options>);
|
||||
listSenderSignatures(query: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
createSenderSignature(options: CreateSignature, callback: PostmarkCallback): void;
|
||||
editSenderSignature<T extends keyof CreateSignature>(
|
||||
id: number,
|
||||
options: Partial<Pick<CreateSignature, T>>,
|
||||
callback: PostmarkCallback
|
||||
): void;
|
||||
deleteSenderSignature(id: number, callback: PostmarkCallback): void;
|
||||
resendSenderSignatureConfirmation(id: number, callback: PostmarkCallback): void;
|
||||
verifySenderSignatureSPF(id: number, callback: PostmarkCallback): void;
|
||||
requestNewDKIMForSenderSignature(id: number, callback: PostmarkCallback): void;
|
||||
getServer(id: number, callback: PostmarkCallback): void;
|
||||
createServer(options: CreateServer, callback: PostmarkCallback): void;
|
||||
editServer<T extends keyof CreateServer>(
|
||||
id: number,
|
||||
options: Pick<CreateServer, T>,
|
||||
callback: PostmarkCallback
|
||||
): void;
|
||||
deleteServer(id: number, callback: PostmarkCallback): void;
|
||||
listServers(query: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
listDomains(query: Partial<Filter>, callback: PostmarkCallback): void;
|
||||
getDomain(id: number, callback: PostmarkCallback): void;
|
||||
createDomain(
|
||||
options: CreateDomain,
|
||||
callback: PostmarkCallback
|
||||
): void;
|
||||
editDomain<T extends keyof CreateDomain>(
|
||||
id: number,
|
||||
options: Pick<CreateDomain, T>,
|
||||
callback: PostmarkCallback
|
||||
): void;
|
||||
deleteDomain(id: number, callback: PostmarkCallback): void;
|
||||
verifyDomainSPF(id: number, callback: PostmarkCallback): void;
|
||||
rotateDKIMForDomain(id: number, callback: PostmarkCallback): void;
|
||||
}
|
||||
|
||||
interface ClientClass {
|
||||
new(serverKey: string, options: Partial<Options>): Client;
|
||||
}
|
||||
|
||||
interface AdminClientClass {
|
||||
new(apiKey: string, options: Partial<Options>): AdminClient;
|
||||
}
|
||||
|
||||
interface Postmark {
|
||||
(apiKey: string, options: Partial<Options>): void;
|
||||
defaults: Options;
|
||||
Client: ClientClass;
|
||||
AdminClient: AdminClientClass;
|
||||
}
|
||||
|
||||
declare var postmark: Postmark;
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
export = postmark;
|
||||
|
||||
declare const postmark: Postmark.Postmark;
|
||||
declare namespace Postmark {
|
||||
const defaults: Options;
|
||||
|
||||
interface PostmarkError {
|
||||
status: number;
|
||||
message: string;
|
||||
code: number;
|
||||
}
|
||||
|
||||
interface PostmarkMessageHeader {
|
||||
Name: string;
|
||||
Value: string;
|
||||
}
|
||||
|
||||
interface PostmarkAttachment {
|
||||
Content: string;
|
||||
Name: string;
|
||||
ContentType: string;
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
count?: number;
|
||||
offset?: number;
|
||||
}
|
||||
|
||||
interface PostmarkMessageWithTemplate {
|
||||
To: string;
|
||||
From: string;
|
||||
Cc?: string;
|
||||
Bcc?: string;
|
||||
ReplyTo?: string;
|
||||
TemplateId?: string;
|
||||
TemplateModel?: any;
|
||||
Tag?: string;
|
||||
Subject?: string;
|
||||
TrackOpens?: boolean;
|
||||
TrackLinks?: string;
|
||||
Headers?: PostmarkMessageHeader[];
|
||||
}
|
||||
|
||||
interface PostmarkMessage {
|
||||
To: string;
|
||||
From: string;
|
||||
Cc?: string;
|
||||
Bcc?: string;
|
||||
ReplyTo?: string;
|
||||
Tag?: string;
|
||||
Subject?: string;
|
||||
HTMLBody?: string;
|
||||
TextBody?: string;
|
||||
TrackOpens?: boolean;
|
||||
TrackLinks?: string;
|
||||
Headers?: PostmarkMessageHeader[];
|
||||
Attachments?: PostmarkAttachment[];
|
||||
}
|
||||
|
||||
interface Sender {
|
||||
Color: string;
|
||||
RawEmailEnabled: boolean;
|
||||
SmtpApiActivated: boolean;
|
||||
DeliveryHookUrl: string;
|
||||
InboundHookUrl: string;
|
||||
BounceHookUrl: boolean;
|
||||
IncludeBounceContentInHook: boolean;
|
||||
OpenHookUrl: boolean;
|
||||
PostFirstOpenOnly: boolean;
|
||||
TrackOpens: boolean;
|
||||
TrackLinks: string;
|
||||
InboundDomain: string;
|
||||
InboundSpamThreshold: number;
|
||||
}
|
||||
|
||||
interface TemplateValidator<T extends object> {
|
||||
Subject: string;
|
||||
HtmlBody: string;
|
||||
TextBody: string;
|
||||
TestRenderModel?: T;
|
||||
InlineCssForHtmlTestRender?: boolean;
|
||||
}
|
||||
|
||||
type PostmarkCallback<T extends object = any> = ((e: PostmarkError, ret: T) => undefined) | undefined;
|
||||
|
||||
interface SimpleOptions {
|
||||
ssl: boolean;
|
||||
requestHost: string;
|
||||
}
|
||||
|
||||
interface Options extends SimpleOptions {
|
||||
requestFactory(
|
||||
options: SimpleOptions
|
||||
): (
|
||||
path?: string,
|
||||
type?: string,
|
||||
content?: PostmarkMessage,
|
||||
callback?: PostmarkCallback
|
||||
) => any;
|
||||
}
|
||||
|
||||
class Client {
|
||||
constructor(serverKey: string, options?: Partial<Options>);
|
||||
|
||||
send(message: PostmarkMessage): Promise<SendStatus>;
|
||||
send(message: PostmarkMessage, callback: PostmarkCallback<SendStatus>): undefined;
|
||||
|
||||
sendEmailWithTemplate(message: PostmarkMessageWithTemplate): Promise<SendStatus>;
|
||||
sendEmailWithTemplate(message: PostmarkMessageWithTemplate, callback: PostmarkCallback<SendStatus>): undefined;
|
||||
|
||||
batch(message: PostmarkMessage[]): Promise<SendStatus[]>;
|
||||
batch(message: PostmarkMessage[], callback: PostmarkCallback<SendStatus[]>): undefined;
|
||||
|
||||
sendEmail(message: PostmarkMessage): Promise<SendStatus>;
|
||||
sendEmail(message: PostmarkMessage, callback: PostmarkCallback<SendStatus>): undefined;
|
||||
|
||||
sendEmailBatch(message: PostmarkMessage[]): Promise<SendStatus[]>;
|
||||
sendEmailBatch(message: PostmarkMessage[], callback: PostmarkCallback<SendStatus[]>): undefined;
|
||||
|
||||
// stats
|
||||
getDeliveryStatistics(): Promise<DeliveryStats>;
|
||||
getDeliveryStatistics(callback: PostmarkCallback<DeliveryStats>): undefined;
|
||||
|
||||
// bounces
|
||||
getBounces(filter: BounceFilter): Promise<BouncesResult>;
|
||||
getBounces(filter: BounceFilter, callback?: PostmarkCallback<BouncesResult>): undefined;
|
||||
|
||||
getBounce(id: number): Promise<Bounce>;
|
||||
getBounce(id: number, callback?: PostmarkCallback<Bounce>): undefined;
|
||||
|
||||
getBounceDump(id: number): Promise<BounceDump>;
|
||||
getBounceDump(id: number, callback?: PostmarkCallback<BounceDump>): undefined;
|
||||
|
||||
activateBounce(id: number): Promise<ActivatedBounceResult>;
|
||||
activateBounce(id: number, callback?: PostmarkCallback<ActivatedBounceResult>): undefined;
|
||||
|
||||
getBounceTags(): Promise<string[]>;
|
||||
getBounceTags(callback?: PostmarkCallback<string[]>): undefined;
|
||||
|
||||
// server
|
||||
getServer(): Promise<Server>;
|
||||
getServer(callback?: PostmarkCallback<Server>): undefined;
|
||||
|
||||
editServer(server: Partial<Server>): Promise<Server>;
|
||||
editServer(server: Partial<Server>, callback?: PostmarkCallback<Server>): undefined;
|
||||
|
||||
// message info
|
||||
getOutboundMessages(filter: OutboundMessageFilter): Promise<OutboundMessagesResult>;
|
||||
getOutboundMessages(filter: OutboundMessageFilter, callback?: PostmarkCallback<OutboundMessagesResult>): undefined;
|
||||
|
||||
getOutboundMessageDetails(id: number): Promise<OutboundMessage>;
|
||||
getOutboundMessageDetails(id: number, callback?: PostmarkCallback<OutboundMessage>): undefined;
|
||||
|
||||
getMessageOpens(filter: OpenMessageFilter): Promise<MessageOpensResult>;
|
||||
getMessageOpens(filter: OpenMessageFilter, callback?: PostmarkCallback<MessageOpensResult>): undefined;
|
||||
|
||||
getMessageOpensForSingleMessage(id: number, filter: Filter): Promise<MessageOpensResult>;
|
||||
getMessageOpensForSingleMessage(id: number, filter: Filter, callback?: PostmarkCallback<MessageOpensResult>): undefined;
|
||||
|
||||
getInboundMessages(filter: InboundMessageFilter): Promise<InboundMessagesResult>;
|
||||
getInboundMessages(filter: InboundMessageFilter, callback?: PostmarkCallback<InboundMessagesResult>): undefined;
|
||||
|
||||
getInboundMessageDetails(id: number): Promise<InboundMessage>;
|
||||
getInboundMessageDetails(id: number, callback?: PostmarkCallback<InboundMessage>): undefined;
|
||||
|
||||
bypassBlockedInboundMessage(id: number): Promise<GenericResult>;
|
||||
bypassBlockedInboundMessage(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
getOuboundOverview(filter: BaseFilter): Promise<OutboundOverview>;
|
||||
getOuboundOverview(filter: BaseFilter, callback?: PostmarkCallback<OutboundOverview>): undefined;
|
||||
|
||||
retryInboundHookForMessage(id: number): Promise<GenericResult>;
|
||||
retryInboundHookForMessage(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
// templates
|
||||
getTemplate(id: number): Promise<Template>;
|
||||
getTemplate(id: number, callback?: PostmarkCallback<Template>): undefined;
|
||||
|
||||
createTemplate(template: Partial<Template>): Promise<TemplateBase>;
|
||||
createTemplate(template: Partial<Template>, callback?: PostmarkCallback<TemplateBase>): undefined;
|
||||
|
||||
editTemplate(template: Partial<Template>): Promise<TemplateBase>;
|
||||
editTemplate(template: Partial<Template>, callback?: PostmarkCallback<TemplateBase>): undefined;
|
||||
|
||||
getTemplates(filter: Filter): Promise<TemplatesResult>;
|
||||
getTemplates(filter: Filter, callback?: PostmarkCallback<TemplatesResult>): undefined;
|
||||
|
||||
deleteTemplate(id: number): Promise<GenericResult>;
|
||||
deleteTemplate(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
validateTemplate<T extends object>(templateObject: TemplateValidator<T>): Promise<TemplateValidationResult<T>>;
|
||||
validateTemplate<T extends object>(templateObject: TemplateValidator<T>, callback?: PostmarkCallback<TemplateValidationResult<T>>): undefined;
|
||||
}
|
||||
|
||||
interface CreateSignature extends UpdateSignature {
|
||||
FromEmail: string;
|
||||
}
|
||||
|
||||
interface CreateServer {
|
||||
Name: string;
|
||||
Color?: string;
|
||||
RawEmailEnabled?: boolean;
|
||||
SmtpApiActivated?: boolean;
|
||||
DeliveryHookUrl?: string;
|
||||
InboundHookUrl?: string;
|
||||
BounceHookUrl?: string;
|
||||
IncludeBounceContentInHook?: boolean;
|
||||
OpenHookUrl?: string;
|
||||
PostFirstOpenOnly?: boolean;
|
||||
TrackOpens?: boolean;
|
||||
TrackLinks?: string;
|
||||
InboundDomain?: string;
|
||||
InboundSpamThreshold?: number;
|
||||
}
|
||||
|
||||
interface CreateDomain {
|
||||
Name: string;
|
||||
ReturnPathDomain?: string;
|
||||
}
|
||||
|
||||
class AdminClient {
|
||||
constructor(apiKey: string, options: Partial<Options>);
|
||||
listSenderSignatures(query: Filter): Promise<SenderSignaturesResults>;
|
||||
listSenderSignatures(query: Filter, callback?: PostmarkCallback<SenderSignaturesResults>): undefined;
|
||||
|
||||
createSenderSignature(options: CreateSignature): Promise<SenderSignature>;
|
||||
createSenderSignature(options: CreateSignature, callback?: PostmarkCallback<SenderSignature>): undefined;
|
||||
|
||||
editSenderSignature(id: number, options: UpdateSignature): Promise<SenderSignature>;
|
||||
editSenderSignature(id: number, options: UpdateSignature, callback?: PostmarkCallback<SenderSignature>): undefined;
|
||||
|
||||
deleteSenderSignature(id: number): Promise<GenericResult>;
|
||||
deleteSenderSignature(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
resendSenderSignatureConfirmation(id: number): Promise<GenericResult>;
|
||||
resendSenderSignatureConfirmation(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
verifySenderSignatureSPF(id: number): Promise<SenderSignature>;
|
||||
verifySenderSignatureSPF(id: number, callback?: PostmarkCallback<SenderSignature>): undefined;
|
||||
|
||||
requestNewDKIMForSenderSignature(id: number): Promise<GenericResult>;
|
||||
requestNewDKIMForSenderSignature(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
// servers
|
||||
getServer(id: number): Promise<Server>;
|
||||
getServer(id: number, callback?: PostmarkCallback<Server>): undefined;
|
||||
|
||||
createServer(options: CreateServer): Promise<Server>;
|
||||
createServer(options: CreateServer, callback?: PostmarkCallback<Server>): undefined;
|
||||
|
||||
editServer(id: number, options: Partial<CreateServer>): Promise<Server>;
|
||||
editServer(id: number, options: Partial<CreateServer>, callback?: PostmarkCallback<Server>): undefined;
|
||||
|
||||
deleteServer(id: number): Promise<GenericResult>;
|
||||
deleteServer(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
listServers(query: ServerFilter): Promise<ServersResult>;
|
||||
listServers(query: ServerFilter, callback?: PostmarkCallback<ServersResult>): undefined;
|
||||
|
||||
// domains
|
||||
listDomains(query: Filter): Promise<DomainsResult>;
|
||||
listDomains(query: Filter, callback?: PostmarkCallback<DomainsResult>): undefined;
|
||||
|
||||
getDomain(id: number): Promise<Domain>;
|
||||
getDomain(id: number, callback?: PostmarkCallback<Domain>): undefined;
|
||||
|
||||
createDomain(options: CreateDomain): Promise<Domain>;
|
||||
createDomain(options: CreateDomain, callback?: PostmarkCallback<Domain>): undefined;
|
||||
|
||||
editDomain(id: number, options: Partial<CreateDomain>): Promise<Domain>;
|
||||
editDomain(id: number, options: Partial<CreateDomain>, callback?: PostmarkCallback<Domain>): undefined;
|
||||
|
||||
deleteDomain(id: number): Promise<GenericResult>;
|
||||
deleteDomain(id: number, callback?: PostmarkCallback<GenericResult>): undefined;
|
||||
|
||||
verifyDomainSPF(id: number): Promise<SenderSignature>;
|
||||
verifyDomainSPF(id: number, callback?: PostmarkCallback<SenderSignature>): undefined;
|
||||
|
||||
rotateDKIMForDomain(id: number): Promise<RotateDKIMResult>;
|
||||
rotateDKIMForDomain(id: number, callback?: PostmarkCallback<RotateDKIMResult>): undefined;
|
||||
}
|
||||
|
||||
interface ClientClass {
|
||||
new(serverKey: string, options: Partial<Options>): Client;
|
||||
}
|
||||
|
||||
interface AdminClientClass {
|
||||
new(apiKey: string, options: Partial<Options>): AdminClient;
|
||||
}
|
||||
|
||||
interface Postmark {
|
||||
(apiKey: string, options: Partial<Options>): Client;
|
||||
defaults: Options;
|
||||
Client: ClientClass;
|
||||
AdminClient: AdminClientClass;
|
||||
}
|
||||
|
||||
// server
|
||||
interface Server extends Sender {
|
||||
ID: number;
|
||||
ApiTokens: string[];
|
||||
ServerLink: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface SendStatus {
|
||||
To: string;
|
||||
SubmittedAt: string;
|
||||
MessageID: string;
|
||||
ErrorCode: number;
|
||||
Message: string;
|
||||
}
|
||||
|
||||
// validation
|
||||
interface ValidationError {
|
||||
Message: string;
|
||||
Line: number;
|
||||
CharacterPosition: number;
|
||||
}
|
||||
|
||||
interface ValidationSet {
|
||||
ContentIsValid: boolean;
|
||||
ValidationErrors: ValidationError[];
|
||||
RenderedContent: string;
|
||||
}
|
||||
|
||||
interface TemplateValidator<T extends object> {
|
||||
Subject: string;
|
||||
HtmlBody: string;
|
||||
TextBody: string;
|
||||
TestRenderModel?: T;
|
||||
InlineCssForHtmlTestRender?: boolean;
|
||||
}
|
||||
|
||||
// templates
|
||||
interface TemplateBase {
|
||||
Name: string;
|
||||
TemplateId: number;
|
||||
Active: boolean;
|
||||
}
|
||||
|
||||
interface Template extends TemplateBase {
|
||||
Subject: string;
|
||||
HtmlBody: string;
|
||||
TextBody: string;
|
||||
AssociatedServerId: number;
|
||||
}
|
||||
|
||||
// filters
|
||||
interface BaseFilter extends Filter {
|
||||
tag?: string;
|
||||
todate?: string;
|
||||
fromdate?: string;
|
||||
}
|
||||
interface BounceFilter extends BaseFilter {
|
||||
type?: string;
|
||||
inactive?: boolean;
|
||||
emailFilter?: string;
|
||||
messageID?: string;
|
||||
}
|
||||
|
||||
interface OutboundMessageFilter extends BaseFilter {
|
||||
recipient?: string;
|
||||
fromemail?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
interface InboundMessageFilter extends OutboundMessageFilter {
|
||||
mailboxhash?: string;
|
||||
subject?: string;
|
||||
}
|
||||
|
||||
interface OpenMessageFilter extends BaseFilter {
|
||||
client_name?: string;
|
||||
client_company?: string;
|
||||
client_family?: string;
|
||||
os_name?: string;
|
||||
os_family?: string;
|
||||
os_company?: string;
|
||||
platform?: string;
|
||||
region?: string;
|
||||
city?: string;
|
||||
}
|
||||
|
||||
interface ServerFilter extends Filter {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
// bounces
|
||||
interface Bounce {
|
||||
ID: number;
|
||||
Type: string;
|
||||
TypeCode: number;
|
||||
Name: string;
|
||||
Tag: string;
|
||||
MessageID: string;
|
||||
ServerID: number;
|
||||
Description: string;
|
||||
Details: string;
|
||||
Email: string;
|
||||
From: string;
|
||||
Subject: string;
|
||||
BouncedAt: string;
|
||||
DumpAvailable: boolean;
|
||||
Inactive: boolean;
|
||||
CanActivate: boolean;
|
||||
Content: string;
|
||||
}
|
||||
|
||||
interface BounceDump {
|
||||
Body: string;
|
||||
}
|
||||
|
||||
// tracking info
|
||||
interface VendorTrackingInfo {
|
||||
Name: string;
|
||||
Company: string;
|
||||
Family: string;
|
||||
}
|
||||
|
||||
interface GeoTrackingInfo {
|
||||
CountryISOCode: string;
|
||||
Country: string;
|
||||
RegionISOCode: string;
|
||||
Region: string;
|
||||
City: string;
|
||||
Zip: string;
|
||||
Coords: string;
|
||||
IP: string;
|
||||
}
|
||||
|
||||
interface BounceStats {
|
||||
Name: string;
|
||||
Count: number;
|
||||
Type: string | undefined;
|
||||
}
|
||||
|
||||
interface DeliveryStats {
|
||||
InactiveMails: number;
|
||||
Bounces: BounceStats[];
|
||||
}
|
||||
|
||||
interface MessageOpens {
|
||||
FirstOpen: boolean;
|
||||
Client: VendorTrackingInfo;
|
||||
OS: VendorTrackingInfo;
|
||||
Platform: string;
|
||||
UserAgent: string;
|
||||
ReadSeconds: number;
|
||||
Geo: GeoTrackingInfo;
|
||||
MessageID: string;
|
||||
ReceivedAt: string;
|
||||
Tag: string;
|
||||
Recipient: string;
|
||||
}
|
||||
|
||||
interface ExpandedEmail {
|
||||
Email: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
// message events
|
||||
interface MessageEvents {
|
||||
Recipient: string;
|
||||
Type: string;
|
||||
ReceivedAt: string;
|
||||
Details: MessageEventDetails;
|
||||
}
|
||||
|
||||
interface MessageEventDetails {
|
||||
Summary?: string;
|
||||
BounceID?: string;
|
||||
Link?: string;
|
||||
ClickLocation?: string;
|
||||
DeliveryMessage?: string;
|
||||
DestinationServer?: string;
|
||||
DestinationIP?: string;
|
||||
}
|
||||
|
||||
// messages
|
||||
interface MessageBase {
|
||||
Tag: string;
|
||||
MessageID: string;
|
||||
From: string;
|
||||
Cc: string;
|
||||
Subject: string;
|
||||
Status: string;
|
||||
Attachments: PostmarkAttachment[];
|
||||
}
|
||||
|
||||
interface OutboundMessageBase extends MessageBase {
|
||||
To: ExpandedEmail[];
|
||||
Recipients: string[];
|
||||
ReceivedAt: string;
|
||||
TrackOpens: boolean;
|
||||
TrackLinks: string;
|
||||
}
|
||||
|
||||
interface OutboundMessage extends OutboundMessageBase {
|
||||
TextBody: string;
|
||||
HtmlBody: string;
|
||||
Body: string;
|
||||
MessageEvents: MessageEvents[];
|
||||
}
|
||||
|
||||
interface InboundMessageBase extends MessageBase {
|
||||
FromName: string;
|
||||
FromFull: ExpandedEmail;
|
||||
To: string;
|
||||
ToFull: ExpandedEmail[];
|
||||
CcFull: ExpandedEmail[];
|
||||
ReplyTo: string;
|
||||
OriginalRecipient: string;
|
||||
Date: string;
|
||||
MailboxHash: string;
|
||||
}
|
||||
|
||||
interface InboundMessage extends InboundMessageBase {
|
||||
TextBody: string;
|
||||
HtmlBody: string;
|
||||
Headers: PostmarkMessageHeader[];
|
||||
BlockedReason?: string;
|
||||
MessageEvents: MessageEvents[];
|
||||
}
|
||||
|
||||
// Results
|
||||
interface GenericResult {
|
||||
Message: string;
|
||||
ErrorCode?: number;
|
||||
}
|
||||
|
||||
interface PaginatedResult {
|
||||
TotalCount: number;
|
||||
}
|
||||
|
||||
interface ActivatedBounceResult extends GenericResult {
|
||||
Bounce: Bounce;
|
||||
}
|
||||
|
||||
interface BouncesResult extends PaginatedResult {
|
||||
Bounces: Bounce[];
|
||||
}
|
||||
|
||||
interface TemplatesResult extends PaginatedResult {
|
||||
Templates: TemplateBase[];
|
||||
}
|
||||
|
||||
interface MessageOpensResult extends PaginatedResult {
|
||||
Opens: MessageOpens[];
|
||||
}
|
||||
|
||||
interface OutboundMessagesResult extends PaginatedResult {
|
||||
Messages: OutboundMessageBase[];
|
||||
}
|
||||
|
||||
interface InboundMessagesResult extends PaginatedResult {
|
||||
InboundMessages: InboundMessageBase[];
|
||||
}
|
||||
|
||||
interface TemplateValidationResult<T extends object = any> {
|
||||
AllContentIsValid: boolean;
|
||||
HtmlBody: ValidationSet;
|
||||
TextBody: ValidationSet;
|
||||
Subject: ValidationSet;
|
||||
SuggestedTemplateModel: T;
|
||||
}
|
||||
|
||||
interface SenderSignaturesResults extends PaginatedResult {
|
||||
SenderSignatures: SenderSignatureBase[];
|
||||
}
|
||||
|
||||
interface ServersResult extends PaginatedResult {
|
||||
Servers: Server[];
|
||||
}
|
||||
|
||||
interface DomainsResult extends PaginatedResult {
|
||||
Domains: DomainBase[];
|
||||
}
|
||||
|
||||
// sender signature
|
||||
interface SenderSignatureBase {
|
||||
Domain: string;
|
||||
EmailAddress: string;
|
||||
Name: string;
|
||||
ReplyToEmailAddress: string;
|
||||
Confirmed: boolean;
|
||||
ID: number;
|
||||
}
|
||||
|
||||
interface SPFRecord {
|
||||
SPFHost: string;
|
||||
SPFTextValue: string;
|
||||
SPFVerified: boolean;
|
||||
}
|
||||
|
||||
interface DKIMKey {
|
||||
WeakDKIM: boolean;
|
||||
DKIMHost: string;
|
||||
DKIMVerified: boolean;
|
||||
DKIMTextValue: string;
|
||||
DKIMPendingHost: string;
|
||||
DKIMPendingTextValue: string;
|
||||
DKIMRevokedHost: string;
|
||||
DKIMRevokedTextValue: string;
|
||||
SafeToRemoveRevokedKeyFromDNS: boolean;
|
||||
DKIMUpdateStatus: string;
|
||||
}
|
||||
|
||||
interface VerificationDetails extends SPFRecord, DKIMKey {
|
||||
ReturnPathDomain: string;
|
||||
ReturnPathDomainCNAMEValue: string;
|
||||
}
|
||||
|
||||
interface SenderSignature extends SenderSignatureBase, VerificationDetails {
|
||||
ReturnPathDomainVerified: boolean;
|
||||
}
|
||||
|
||||
interface UpdateSignature {
|
||||
Name: string;
|
||||
ReplyToEmail?: string;
|
||||
ReturnPathDomain?: string;
|
||||
}
|
||||
|
||||
// domain
|
||||
interface DomainBase {
|
||||
ID: number;
|
||||
Name: string;
|
||||
SPFVerified: boolean;
|
||||
DKIMVerified: boolean;
|
||||
WeakDKIM: boolean;
|
||||
ReturnPathDomainVerified: boolean;
|
||||
}
|
||||
|
||||
interface Domain extends DomainBase, VerificationDetails {
|
||||
}
|
||||
|
||||
interface RotateDKIMResult extends DKIMKey {
|
||||
Name: string;
|
||||
ID: string;
|
||||
}
|
||||
|
||||
// outbound overview
|
||||
interface OutboundOverview {
|
||||
Sent: number;
|
||||
Bounced: number;
|
||||
SMTPApiErrors: number;
|
||||
BounceRate: number;
|
||||
SpamComplaints: number;
|
||||
SpamComplaintsRate: number;
|
||||
Opens: number;
|
||||
UniqueOpens: number;
|
||||
Tracked: number;
|
||||
WithLinkTracking: number;
|
||||
WithOpenTracking: number;
|
||||
TotalTrackedLinksSent: number;
|
||||
UniqueLinksClicked: number;
|
||||
TotalClicks: number;
|
||||
WithClientRecorded: number;
|
||||
WithPlatformRecorded: number;
|
||||
WithReadTimeRecorded: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ const templateValidator = {
|
||||
TextBody: '123535',
|
||||
};
|
||||
|
||||
declare function callback(err: any, data: any): void;
|
||||
declare function callback(err: any, data: any): undefined;
|
||||
|
||||
const client = new postmark.Client('124345', options);
|
||||
const adminClient = new postmark.AdminClient('1123235', options);
|
||||
@@ -40,16 +40,40 @@ client.retryInboundHookForMessage(1, callback);
|
||||
client.getOuboundOverview(filter, callback);
|
||||
client.validateTemplate(templateValidator, callback);
|
||||
|
||||
client.send(message).then(() => { });
|
||||
client.sendEmailWithTemplate(templateMessage).then(() => { });
|
||||
client.batch([message, message]).then(() => { });
|
||||
client.sendEmail(message).then(() => { });
|
||||
client.sendEmailBatch([message, message]).then(() => { });
|
||||
client.getDeliveryStatistics().then(() => { });
|
||||
client.getBounces(filter).then(() => { });
|
||||
client.getBounce(1).then(() => { });
|
||||
client.getBounceDump(1).then(() => { });
|
||||
client.activateBounce(1).then(() => { });
|
||||
client.getBounceTags().then(() => { });
|
||||
client.getServer().then(() => { });
|
||||
client.editServer(editSender).then(() => { });
|
||||
client.getOutboundMessages(filter).then(() => { });
|
||||
client.getOutboundMessageDetails(1).then(() => { });
|
||||
client.getMessageOpens(filter).then(() => { });
|
||||
client.getMessageOpensForSingleMessage(1, filter).then(() => { });
|
||||
client.getInboundMessages(filter).then(() => { });
|
||||
client.getInboundMessageDetails(1).then(() => { });
|
||||
client.bypassBlockedInboundMessage(1).then(() => { });
|
||||
client.retryInboundHookForMessage(1).then(() => { });
|
||||
client.getOuboundOverview(filter).then(() => { });
|
||||
client.validateTemplate(templateValidator).then(() => { });
|
||||
|
||||
adminClient.listSenderSignatures(filter, callback);
|
||||
adminClient.createSenderSignature({FromEmail: '', Name: ''}, callback);
|
||||
adminClient.editSenderSignature(0, {ReplyToEmail: '123'}, callback);
|
||||
adminClient.editSenderSignature(0, {Name: '123'}, callback);
|
||||
adminClient.deleteSenderSignature(0, callback);
|
||||
adminClient.resendSenderSignatureConfirmation(0, callback);
|
||||
adminClient.verifySenderSignatureSPF(0, callback);
|
||||
adminClient.requestNewDKIMForSenderSignature(0, callback);
|
||||
adminClient.getServer(0, callback);
|
||||
adminClient.createServer({Name: '123'}, callback);
|
||||
adminClient.editServer(0, {Color: 'black'}, callback);
|
||||
adminClient.editServer(0, {Name: 'black'}, callback);
|
||||
adminClient.deleteServer(0, callback);
|
||||
adminClient.listServers(filter, callback);
|
||||
adminClient.listDomains(filter, callback);
|
||||
@@ -59,3 +83,23 @@ adminClient.editDomain(0, {ReturnPathDomain: '/'}, callback);
|
||||
adminClient.deleteDomain(0, callback);
|
||||
adminClient.verifyDomainSPF(0, callback);
|
||||
adminClient.rotateDKIMForDomain(0, callback);
|
||||
|
||||
adminClient.listSenderSignatures(filter).then(() => { });
|
||||
adminClient.createSenderSignature({ FromEmail: '', Name: '' }).then(() => { });
|
||||
adminClient.editSenderSignature(0, { Name: 'somename', ReplyToEmail: '123' }).then(() => { });
|
||||
adminClient.deleteSenderSignature(0).then(() => { });
|
||||
adminClient.resendSenderSignatureConfirmation(0).then(() => { });
|
||||
adminClient.verifySenderSignatureSPF(0).then(() => { });
|
||||
adminClient.requestNewDKIMForSenderSignature(0).then(() => { });
|
||||
adminClient.getServer(0).then(() => { });
|
||||
adminClient.createServer({ Name: '123' }).then(() => { });
|
||||
adminClient.editServer(0, { Name: 'black' }).then(() => { });
|
||||
adminClient.deleteServer(0).then(() => { });
|
||||
adminClient.listServers(filter).then(() => { });
|
||||
adminClient.listDomains(filter).then(() => { });
|
||||
adminClient.getDomain(0).then(() => { });
|
||||
adminClient.createDomain({ Name: '1234' }).then(() => { });
|
||||
adminClient.editDomain(0, { ReturnPathDomain: '/' }).then(() => { });
|
||||
adminClient.deleteDomain(0).then(() => { });
|
||||
adminClient.verifyDomainSPF(0).then(() => { });
|
||||
adminClient.rotateDKIMForDomain(0).then(() => { });
|
||||
|
||||
Vendored
+83
-64
@@ -169,62 +169,7 @@ export interface AreaPathProps extends AreaBaseProps {
|
||||
|
||||
export class AreaPath extends React.Component<AreaPathProps> { }
|
||||
|
||||
export interface AreaTextProps extends AreaBaseProps {
|
||||
style?: {
|
||||
/**
|
||||
* The background color, specified as a CSS color string.
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
* The text color, specified as a CSS color string.
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* The font family (only if available on the system).
|
||||
*/
|
||||
fontFamily?: string;
|
||||
/**
|
||||
* The font size (in pt).
|
||||
*/
|
||||
fontSize?: number;
|
||||
/**
|
||||
* Whether an italic font should be used.
|
||||
*/
|
||||
fontStyle?: 'normal' | 'oblique' | 'italic';
|
||||
/**
|
||||
* Whether a bold font should be used (and the amount).
|
||||
*/
|
||||
fontWeight?: 'minimum' | 'thin' | 'ultraLight' | 'light' | 'book' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'ultraBold' | 'heavy' | 'ultraHeavy' | 'maximum' | number;
|
||||
/**
|
||||
* Wheter the text should be aligned to the left, center or right.
|
||||
*
|
||||
* **Works only on a top level text component, not it's children!**
|
||||
*/
|
||||
textAlign?: 'left' | 'center' | 'right';
|
||||
/**
|
||||
* How wide or narrow the characters should be.
|
||||
*/
|
||||
textStretch?: 'ultraCondensed' | 'extraCondensed' | 'condensed' | 'semiCondensed' | 'normal' | 'semiExpanded' | 'expanded' | 'extraExpanded' | 'ultraExpanded';
|
||||
/**
|
||||
* The text underline style.
|
||||
*/
|
||||
textUnderline?: 'none' | 'single' | 'double' | 'suggestion';
|
||||
/**
|
||||
* The text underline color.
|
||||
*
|
||||
* A color string | 'spelling' | 'grammar' | 'auxiliary'
|
||||
*/
|
||||
textUnderlineColor?: 'spelling' | 'grammar' | 'auxiliary' | string;
|
||||
};
|
||||
/**
|
||||
* The x coordinate of the text's top left corner. (Only in a top level text component.)
|
||||
*/
|
||||
x?: number | string;
|
||||
/**
|
||||
* The y coordinate of the text's top left corner. (Only in a top level text component.)
|
||||
*/
|
||||
y?: number | string;
|
||||
}
|
||||
export interface AreaTextProps extends StyledTextProps, AreaBaseProps { }
|
||||
|
||||
export class AreaText extends React.Component<AreaTextProps> { }
|
||||
|
||||
@@ -601,25 +546,33 @@ export interface PickerProps extends GridChildrenProps, Label, Stretchy {
|
||||
/**
|
||||
* When a *non-editable* Picker is changed. The current selection is passed as an argument.
|
||||
*/
|
||||
onSelect?: (selection: string) => void;
|
||||
onSelect?: (selection: number) => void;
|
||||
/**
|
||||
* What element is selected if the picker *is not* editable.
|
||||
*/
|
||||
selected?: boolean;
|
||||
selected?: number;
|
||||
/**
|
||||
* What text is selected/typed if the picker *is* editable.
|
||||
*/
|
||||
text?: boolean;
|
||||
text?: string;
|
||||
/**
|
||||
* Whether the Picker can be seen.
|
||||
*/
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
export interface PickerItemProps {
|
||||
children: string;
|
||||
}
|
||||
|
||||
export class PickerItem extends React.Component<PickerItemProps> { }
|
||||
|
||||
/**
|
||||
* A drop down menu where the user can pick different values.
|
||||
*/
|
||||
export class Picker extends React.Component<PickerProps> { }
|
||||
export class Picker extends React.Component<PickerProps> {
|
||||
static Item: typeof PickerItem;
|
||||
}
|
||||
|
||||
export interface ProgressBarProps extends GridChildrenProps, Label, Stretchy {
|
||||
/**
|
||||
@@ -764,6 +717,65 @@ export interface Stretchy {
|
||||
stretchy?: boolean;
|
||||
}
|
||||
|
||||
export interface StyledTextProps {
|
||||
style?: {
|
||||
/**
|
||||
* The background color, specified as a CSS color string.
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
* The text color, specified as a CSS color string.
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* The font family (only if available on the system).
|
||||
*/
|
||||
fontFamily?: string;
|
||||
/**
|
||||
* The font size (in pt).
|
||||
*/
|
||||
fontSize?: number;
|
||||
/**
|
||||
* Whether an italic font should be used.
|
||||
*/
|
||||
fontStyle?: 'normal' | 'oblique' | 'italic';
|
||||
/**
|
||||
* Whether a bold font should be used (and the amount).
|
||||
*/
|
||||
fontWeight?: 'minimum' | 'thin' | 'ultraLight' | 'light' | 'book' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'ultraBold' | 'heavy' | 'ultraHeavy' | 'maximum' | number;
|
||||
/**
|
||||
* Wheter the text should be aligned to the left, center or right.
|
||||
*
|
||||
* **Works only on a top level text component, not it's children!**
|
||||
*/
|
||||
textAlign?: 'left' | 'center' | 'right';
|
||||
/**
|
||||
* How wide or narrow the characters should be.
|
||||
*/
|
||||
textStretch?: 'ultraCondensed' | 'extraCondensed' | 'condensed' | 'semiCondensed' | 'normal' | 'semiExpanded' | 'expanded' | 'extraExpanded' | 'ultraExpanded';
|
||||
/**
|
||||
* The text underline style.
|
||||
*/
|
||||
textUnderline?: 'none' | 'single' | 'double' | 'suggestion';
|
||||
/**
|
||||
* The text underline color.
|
||||
*
|
||||
* A color string | 'spelling' | 'grammar' | 'auxiliary'
|
||||
*/
|
||||
textUnderlineColor?: 'spelling' | 'grammar' | 'auxiliary' | string;
|
||||
};
|
||||
/**
|
||||
* The x coordinate of the text's top left corner. (Only in a top level text component.)
|
||||
*/
|
||||
x?: number | string;
|
||||
/**
|
||||
* The y coordinate of the text's top left corner. (Only in a top level text component.)
|
||||
*/
|
||||
y?: number | string;
|
||||
}
|
||||
|
||||
export class StyledText extends React.Component<StyledTextProps> { }
|
||||
|
||||
export interface TabProps extends GridChildrenProps {
|
||||
/**
|
||||
* Whether the Tab is enabled.
|
||||
@@ -896,17 +908,16 @@ export class Window extends React.Component<WindowProps> { }
|
||||
export function render(element: JSX.Element): void;
|
||||
|
||||
/**
|
||||
* A method to display an alert, or a dialog to save or open a file.
|
||||
* A method to display an alert.
|
||||
* @param type What type the dialog is. The current types are:
|
||||
* - Message - a simple message
|
||||
* - Error - an error message
|
||||
* - Open - open a file
|
||||
* - Save - save a file
|
||||
* @param options Options for the title and description if it is a Message or Error.
|
||||
* Required one of title and description (if it is Message or Error)
|
||||
* @param options Options for the title and descript.
|
||||
*/
|
||||
export function Dialog(
|
||||
type: 'Message' | 'Error' | 'Open' | 'Save',
|
||||
type: 'Message' | 'Error',
|
||||
options?: {
|
||||
title: string,
|
||||
description?: string
|
||||
@@ -915,3 +926,11 @@ export function Dialog(
|
||||
description: string
|
||||
}
|
||||
): void;
|
||||
|
||||
/**
|
||||
* A dialog to save or open a file. Returns chosen file path.
|
||||
* @param type What type the dialog is. The current types are:
|
||||
* - Open - open a file
|
||||
* - Save - save a file
|
||||
*/
|
||||
export function Dialog(type: 'Open' | 'Save'): string;
|
||||
|
||||
Vendored
+3
-1
@@ -1,14 +1,16 @@
|
||||
// Type definitions for query-string 5.1
|
||||
// Type definitions for query-string 6.1
|
||||
// Project: https://github.com/sindresorhus/query-string
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// HuHuanming <https://github.com/huhuanming>
|
||||
// Madara Uchiha <https://github.com/MadaraUchiha>
|
||||
// Josh Holmer <https://github.com/shssoichiro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export interface ParseOptions {
|
||||
arrayFormat?: 'bracket' | 'index' | 'none';
|
||||
decode?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ import * as queryString from 'query-string';
|
||||
let fooBar: { foo: 'bar' };
|
||||
fooBar = queryString.parse('?foo=bar');
|
||||
fooBar = queryString.parse('#foo=bar');
|
||||
fooBar = queryString.parse('?foo=bar%20baz', { decode: true });
|
||||
|
||||
let fooBarBaz: { foo: ['bar', 'baz'] };
|
||||
fooBarBaz = queryString.parse('&foo=bar&foo=baz');
|
||||
|
||||
Vendored
+1
@@ -12,6 +12,7 @@
|
||||
// Karol Janyst <https://github.com/LKay>
|
||||
// Aaron Beall <https://github.com/aaronbeall>
|
||||
// Johann Rakotoharisoa <https://github.com/jrakotoharisoa>
|
||||
// Andrew Makarov <https://github.com/r3nya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
|
||||
declare namespace ToggleButton {
|
||||
export interface ToggleButtonProps extends React.HTMLProps<ToggleButton> {
|
||||
checked?: boolean;
|
||||
name?: string;
|
||||
value: number|string;
|
||||
value: number | string;
|
||||
}
|
||||
}
|
||||
declare class ToggleButton extends React.Component<ToggleButton.ToggleButtonProps> { }
|
||||
declare class ToggleButton extends React.Component<ToggleButton.ToggleButtonProps & Button.ButtonProps> { }
|
||||
export = ToggleButton;
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { ButtonGroup } from 'react-bootstrap';
|
||||
import { Omit } from "../index";
|
||||
|
||||
declare namespace ToggleButtonGroup {
|
||||
@@ -34,5 +35,5 @@ declare namespace ToggleButtonGroup {
|
||||
& Omit<React.HTMLProps<ToggleButtonGroup>, "defaultValue" | "type" | "value" | "onChange">;
|
||||
|
||||
}
|
||||
declare class ToggleButtonGroup extends React.Component<ToggleButtonGroup.ToggleButtonGroupProps> { }
|
||||
declare class ToggleButtonGroup extends React.Component<ToggleButtonGroup.ToggleButtonGroupProps & ButtonGroup.ButtonGroupProps> { }
|
||||
export = ToggleButtonGroup;
|
||||
|
||||
@@ -209,8 +209,8 @@ export class ReactBootstrapIndividualComponentsTest extends React.Component {
|
||||
<Table />
|
||||
<Tabs />
|
||||
<Thumbnail />
|
||||
<ToggleButton value="foo" />
|
||||
<ToggleButtonGroup type="checkbox" />
|
||||
<ToggleButton value="foo" bsSize="small" />
|
||||
<ToggleButtonGroup type="checkbox" bsSize="small" />
|
||||
<ToggleButtonGroup type="radio" name="foo" />
|
||||
<Tooltip />
|
||||
<Well />
|
||||
|
||||
@@ -1,18 +1,56 @@
|
||||
import * as React from 'react';
|
||||
import { Component, CSSProperties } from 'react';
|
||||
import {
|
||||
Button, ButtonToolbar, Modal, Well, ButtonGroup,
|
||||
DropdownButton, MenuItem, Panel, PanelGroup, ListGroup,
|
||||
ListGroupItem, Accordion, Tooltip,
|
||||
OverlayTrigger, Popover, ProgressBar,
|
||||
Nav, NavItem, Navbar, NavDropdown,
|
||||
Tabs, Tab, Pager, PageItem,
|
||||
Pagination, Alert, Carousel, SafeAnchor,
|
||||
Grid, Row, Col, Thumbnail, Image, ResponsiveEmbed,
|
||||
Label, Badge, Jumbotron, PageHeader,
|
||||
Glyphicon, Table, Form, FormGroup,
|
||||
ControlLabel, FormControl, HelpBlock,
|
||||
Radio, Checkbox, Media, InputGroup, ToggleButtonGroup,
|
||||
Button,
|
||||
ButtonToolbar,
|
||||
Modal,
|
||||
Well,
|
||||
ButtonGroup,
|
||||
DropdownButton,
|
||||
MenuItem,
|
||||
Panel,
|
||||
PanelGroup,
|
||||
ListGroup,
|
||||
ListGroupItem,
|
||||
Accordion,
|
||||
Tooltip,
|
||||
OverlayTrigger,
|
||||
Popover,
|
||||
ProgressBar,
|
||||
Nav,
|
||||
NavItem,
|
||||
Navbar,
|
||||
NavDropdown,
|
||||
Tabs,
|
||||
Tab,
|
||||
Pager,
|
||||
PageItem,
|
||||
Pagination,
|
||||
Alert,
|
||||
Carousel,
|
||||
SafeAnchor,
|
||||
Grid,
|
||||
Row,
|
||||
Col,
|
||||
Thumbnail,
|
||||
Image,
|
||||
ResponsiveEmbed,
|
||||
Label,
|
||||
Badge,
|
||||
Jumbotron,
|
||||
PageHeader,
|
||||
Glyphicon,
|
||||
Table,
|
||||
Form,
|
||||
FormGroup,
|
||||
ControlLabel,
|
||||
FormControl,
|
||||
HelpBlock,
|
||||
Radio,
|
||||
Checkbox,
|
||||
Media,
|
||||
InputGroup,
|
||||
ToggleButtonGroup,
|
||||
ToggleButton
|
||||
} from 'react-bootstrap';
|
||||
|
||||
@@ -1418,20 +1456,47 @@ export class ReactBootstrapTest extends Component {
|
||||
|
||||
<div>
|
||||
<ButtonToolbar>
|
||||
<ToggleButtonGroup type="checkbox" defaultValue={[1, 3]}>
|
||||
<ToggleButton value={1}>Checkbox 1 (pre-checked)</ToggleButton>
|
||||
<ToggleButton value={2}>Checkbox 2</ToggleButton>
|
||||
<ToggleButton value={3}>Checkbox 3 (pre-checked)</ToggleButton>
|
||||
<ToggleButtonGroup
|
||||
type="checkbox"
|
||||
defaultValue={[1, 3]}
|
||||
bsSize="small"
|
||||
>
|
||||
<ToggleButton value={1} bsSize="small" active>
|
||||
Checkbox 1 (pre-checked)
|
||||
</ToggleButton>
|
||||
<ToggleButton value={2}>
|
||||
Checkbox 2
|
||||
</ToggleButton>
|
||||
<ToggleButton value={3}>
|
||||
Checkbox 3 (pre-checked)
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</ButtonToolbar>
|
||||
|
||||
<ButtonToolbar>
|
||||
<ToggleButtonGroup type="radio" name="options" defaultValue={1}>
|
||||
<ToggleButton value={1}>
|
||||
<ToggleButtonGroup
|
||||
type="radio"
|
||||
name="options"
|
||||
defaultValue={1}
|
||||
>
|
||||
<ToggleButton
|
||||
value={1}
|
||||
bsSize="large"
|
||||
>
|
||||
Radio 1 (pre-checked)
|
||||
</ToggleButton>
|
||||
<ToggleButton value={2}>Radio 2</ToggleButton>
|
||||
<ToggleButton value={3}>Radio 3</ToggleButton>
|
||||
<ToggleButton
|
||||
value={2}
|
||||
bsSize="small"
|
||||
>
|
||||
Radio 2
|
||||
</ToggleButton>
|
||||
<ToggleButton
|
||||
value={3}
|
||||
bsSize="xsmall"
|
||||
>
|
||||
Radio 3
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
</ButtonToolbar>
|
||||
</div>
|
||||
|
||||
Executable → Regular
Vendored
+62
-15
@@ -1075,17 +1075,24 @@ export type KeyboardTypeIOS =
|
||||
| "twitter"
|
||||
| "web-search";
|
||||
export type KeyboardTypeAndroid = "visible-password";
|
||||
export type KeyboardTypeOptions = KeyboardType | KeyboardTypeAndroid | KeyboardTypeIOS
|
||||
export type KeyboardTypeOptions = KeyboardType | KeyboardTypeAndroid | KeyboardTypeIOS;
|
||||
|
||||
export type ReturnKeyType = "done" | "go" | "next" | "search" | "send";
|
||||
export type ReturnKeyTypeAndroid = "none" | "previous";
|
||||
export type ReturnKeyTypeIOS = "default" | "google" | "join" | "route" | "yahoo" | "emergency-call";
|
||||
export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS
|
||||
export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS;
|
||||
|
||||
export interface TextInputFocusEventData {
|
||||
target: number,
|
||||
text: string,
|
||||
eventCount: number
|
||||
target: number;
|
||||
text: string;
|
||||
eventCount: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see TextInputProps.onScroll
|
||||
*/
|
||||
export interface TextInputScrollEventData {
|
||||
contentOffset: { x: number; y: number; }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1220,6 +1227,14 @@ export interface TextInputProps
|
||||
*/
|
||||
onSubmitEditing?: (event: { nativeEvent: { text: string } }) => void;
|
||||
|
||||
/**
|
||||
* Invoked on content scroll with
|
||||
* `{ nativeEvent: { contentOffset: { x, y } } }`.
|
||||
*
|
||||
* May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons.
|
||||
*/
|
||||
onScroll?: (e: NativeSyntheticEvent<TextInputScrollEventData>) => void;
|
||||
|
||||
/**
|
||||
* The string that will be rendered before text input has been entered
|
||||
*/
|
||||
@@ -1318,7 +1333,10 @@ interface TextInputState {
|
||||
declare class TextInputComponent extends React.Component<TextInputProps> {}
|
||||
declare const TextInputBase: Constructor<NativeMethodsMixin> & Constructor<TimerMixin> & typeof TextInputComponent;
|
||||
export class TextInput extends TextInputBase {
|
||||
State: TextInputState;
|
||||
/**
|
||||
* Access the current focus state.
|
||||
*/
|
||||
static State: TextInputState;
|
||||
|
||||
/**
|
||||
* Returns if the input is currently focused.
|
||||
@@ -3398,9 +3416,26 @@ interface ImagePropsAndroid {
|
||||
fadeDuration?: number;
|
||||
}
|
||||
|
||||
// See https://facebook.github.io/react-native/docs/image.html#source
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/image.html#source
|
||||
*/
|
||||
export type ImageSourcePropType = ImageURISource | ImageURISource[] | ImageRequireSource;
|
||||
|
||||
/**
|
||||
* @see ImagePropsBase.onLoad
|
||||
*/
|
||||
interface ImageLoadEventDataAndroid {
|
||||
uri?: string;
|
||||
}
|
||||
|
||||
interface ImageLoadEventData extends ImageLoadEventDataAndroid {
|
||||
source: {
|
||||
height: number;
|
||||
width: number;
|
||||
url: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/image.html
|
||||
*/
|
||||
@@ -3421,8 +3456,9 @@ export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, Access
|
||||
|
||||
/**
|
||||
* Invoked when load completes successfully
|
||||
* { source: { url, height, width } }.
|
||||
*/
|
||||
onLoad?: () => void;
|
||||
onLoad?: (event: NativeSyntheticEvent<ImageLoadEventData>) => void;
|
||||
|
||||
/**
|
||||
* Invoked when load either succeeds or fails
|
||||
@@ -3873,6 +3909,13 @@ export interface SectionListProps<ItemT> extends ScrollViewProps {
|
||||
*/
|
||||
initialNumToRender?: number;
|
||||
|
||||
/**
|
||||
* Used to extract a unique key for a given item at the specified index. Key is used for caching
|
||||
* and as the react key to track item re-ordering. The default extractor checks `item.key`, then
|
||||
* falls back to using the index, like React does.
|
||||
*/
|
||||
keyExtractor?: (item: ItemT, index: number) => string;
|
||||
|
||||
/**
|
||||
* Called once when the scroll position gets within onEndReachedThreshold of the rendered content.
|
||||
*/
|
||||
@@ -3886,19 +3929,23 @@ export interface SectionListProps<ItemT> extends ScrollViewProps {
|
||||
*/
|
||||
onEndReachedThreshold?: number | null;
|
||||
|
||||
/**
|
||||
* Used to extract a unique key for a given item at the specified index. Key is used for caching
|
||||
* and as the react key to track item re-ordering. The default extractor checks `item.key`, then
|
||||
* falls back to using the index, like React does.
|
||||
*/
|
||||
keyExtractor?: (item: ItemT, index: number) => string;
|
||||
|
||||
/**
|
||||
* If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality.
|
||||
* Make sure to also set the refreshing prop correctly.
|
||||
*/
|
||||
onRefresh?: (() => void) | null;
|
||||
|
||||
/**
|
||||
* Used to handle failures when scrolling to an index that has not been measured yet.
|
||||
* Recommended action is to either compute your own offset and `scrollTo` it, or scroll as far
|
||||
* as possible and then try again after more items have been rendered.
|
||||
*/
|
||||
onScrollToIndexFailed?: (info: {
|
||||
index: number,
|
||||
highestMeasuredFrameIndex: number,
|
||||
averageItemLength: number
|
||||
}) => void;
|
||||
|
||||
/**
|
||||
* Set this true while waiting for new data from a refresh.
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
Dimensions,
|
||||
Image,
|
||||
ImageStyle,
|
||||
ImageLoadEventData,
|
||||
InteractionManager,
|
||||
ListView,
|
||||
ListViewDataSource,
|
||||
@@ -54,7 +55,8 @@ import {
|
||||
InputAccessoryView,
|
||||
StatusBar,
|
||||
NativeSyntheticEvent,
|
||||
GestureResponderEvent
|
||||
GestureResponderEvent,
|
||||
TextInputScrollEventData
|
||||
} from "react-native";
|
||||
|
||||
declare module "react-native" {
|
||||
@@ -149,6 +151,25 @@ const viewProperty = StyleSheet.flatten(viewStyle).backgroundColor;
|
||||
const textProperty = StyleSheet.flatten(textStyle).fontSize;
|
||||
const imageProperty = StyleSheet.flatten(imageStyle).resizeMode;
|
||||
|
||||
const testNativeSyntheticEvent = <T extends {}>(e: NativeSyntheticEvent<T>): void => {
|
||||
e.isDefaultPrevented();
|
||||
e.preventDefault();
|
||||
e.isPropagationStopped();
|
||||
e.stopPropagation();
|
||||
e.persist();
|
||||
e.cancelable;
|
||||
e.bubbles;
|
||||
e.currentTarget;
|
||||
e.defaultPrevented;
|
||||
e.eventPhase;
|
||||
e.isTrusted;
|
||||
e.nativeEvent;
|
||||
e.target;
|
||||
e.timeStamp;
|
||||
e.type;
|
||||
e.nativeEvent;
|
||||
}
|
||||
|
||||
class CustomView extends React.Component {
|
||||
render() {
|
||||
return <Text style={[StyleSheet.absoluteFill, { ...StyleSheet.absoluteFillObject }]}>Custom View</Text>;
|
||||
@@ -197,9 +218,9 @@ class Welcome extends React.Component {
|
||||
|
||||
export default Welcome;
|
||||
|
||||
// SyntheticEventsTest
|
||||
export class SyntheticEventsTest extends React.Component {
|
||||
onPressButton(e: GestureResponderEvent) {
|
||||
// TouchableNativeFeedbackTest
|
||||
export class TouchableNativeFeedbackTest extends React.Component {
|
||||
onPressButton = (e: GestureResponderEvent) => {
|
||||
e.persist();
|
||||
e.isPropagationStopped();
|
||||
e.isDefaultPrevented();
|
||||
@@ -219,7 +240,6 @@ export class SyntheticEventsTest extends React.Component {
|
||||
}
|
||||
|
||||
// App State
|
||||
|
||||
function appStateListener(state: string) {
|
||||
console.log("New state: " + state);
|
||||
}
|
||||
@@ -235,7 +255,6 @@ function appStateIOSTest() {
|
||||
}
|
||||
|
||||
// ViewPagerAndroid
|
||||
|
||||
export class ViewPagerAndroidTest {
|
||||
render() {
|
||||
return (
|
||||
@@ -452,45 +471,52 @@ deviceEventEmitterStatic.addListener("keyboardWillShow", data => true);
|
||||
deviceEventEmitterStatic.addListener("keyboardWillShow", data => true, {});
|
||||
|
||||
|
||||
class TextInputRefTest extends React.Component<{}, {username: string}> {
|
||||
class TextInputTest extends React.Component<{}, {username: string}> {
|
||||
username: TextInput | null = null;
|
||||
|
||||
handleUsernameChange(text: string) {
|
||||
handleUsernameChange = (text: string) => {
|
||||
console.log(`text: ${ text }`);
|
||||
}
|
||||
|
||||
onScroll = (e: NativeSyntheticEvent<TextInputScrollEventData>) => {
|
||||
testNativeSyntheticEvent(e);
|
||||
console.log(`x: ${ e.nativeEvent.contentOffset.x }`);
|
||||
console.log(`y: ${ e.nativeEvent.contentOffset.y }`);
|
||||
}
|
||||
|
||||
handleOnBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
||||
testNativeSyntheticEvent(e);
|
||||
}
|
||||
|
||||
handleOnFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
||||
testNativeSyntheticEvent(e);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text onPress={() => this.username.focus()}>Username</Text>
|
||||
|
||||
<TextInput
|
||||
ref={input => this.username = input}
|
||||
value={this.state.username}
|
||||
onChangeText={this.handleUsernameChange.bind(this)}
|
||||
onChangeText={this.handleUsernameChange}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
multiline
|
||||
onScroll={this.onScroll}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
onBlur={this.handleOnBlur}
|
||||
onFocus={this.handleOnFocus}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TextInputFocusBlurEventTest extends React.Component {
|
||||
handleOnBlur(e: NativeSyntheticEvent<TextInputFocusEventData>) {
|
||||
}
|
||||
|
||||
handleOnFocus(e: NativeSyntheticEvent<TextInputFocusEventData>) {
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<TextInput
|
||||
onBlur={(e: NativeSyntheticEvent<TextInputFocusEventData>) => this.handleOnBlur(e)}
|
||||
onFocus={(e: NativeSyntheticEvent<TextInputFocusEventData>) => this.handleOnFocus(e)}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class StatusBarTest extends React.Component {
|
||||
render() {
|
||||
StatusBar.setBarStyle("dark-content", true);
|
||||
@@ -507,6 +533,26 @@ class StatusBarTest extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export class ImageTest extends React.Component {
|
||||
onLoad(e: NativeSyntheticEvent<ImageLoadEventData>) {
|
||||
testNativeSyntheticEvent(e);
|
||||
console.log('height:', e.nativeEvent.source.height);
|
||||
console.log('width:', e.nativeEvent.source.width);
|
||||
console.log('url:', e.nativeEvent.source.url);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Image
|
||||
source={{ uri: 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png' }}
|
||||
onLoad={this.onLoad}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StylePropsTest extends React.PureComponent {
|
||||
render() {
|
||||
const uri = 'https://seeklogo.com/images/T/typescript-logo-B29A3F462D-seeklogo.com.png'
|
||||
|
||||
Vendored
+1
-1
@@ -576,7 +576,7 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
closeDrawer: () => any;
|
||||
toggleDrawer: () => any;
|
||||
getParam: <T extends keyof P>(param: T, fallback?: P[T]) => P[T];
|
||||
setParams: (newParams: P) => boolean;
|
||||
setParams: (newParams: Partial<P>) => boolean;
|
||||
addListener: (
|
||||
eventName: string,
|
||||
callback: NavigationEventCallback
|
||||
|
||||
@@ -489,3 +489,28 @@ const CustomHeaderStack = createStackNavigator({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
interface ScreenProps {
|
||||
name: string;
|
||||
onPlay(): void;
|
||||
}
|
||||
|
||||
class SetParamsTest extends React.Component<NavigationScreenProps<ScreenProps>> {
|
||||
componentDidMount() {
|
||||
this.props.navigation.setParams({
|
||||
onPlay: this.onPlay
|
||||
});
|
||||
}
|
||||
|
||||
onPlay = () => {
|
||||
//
|
||||
}
|
||||
|
||||
render() {
|
||||
const name = this.props.navigation.getParam('name');
|
||||
|
||||
return (
|
||||
<Text>My name is {name}</Text>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-9
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-pointable 1.1
|
||||
// Type definitions for react-pointable 1.2
|
||||
// Project: https://github.com/MilllerTime/react-pointable
|
||||
// Definitions by: Stefan Fochler <https://github.com/istefo>
|
||||
// Dibyo Majumdar <https://github.com/mdibyo>
|
||||
@@ -13,14 +13,6 @@ export interface PointableProps extends React.HTMLAttributes<Element>, React.SVG
|
||||
tagName?: keyof ElementTagNameMap;
|
||||
touchAction?: TouchAction;
|
||||
elementRef?(el: HTMLElement|SVGElement): void;
|
||||
onPointerMove?(evt: PointerEvent): void;
|
||||
onPointerDown?(evt: PointerEvent): void;
|
||||
onPointerUp?(evt: PointerEvent): void;
|
||||
onPointerOver?(evt: PointerEvent): void;
|
||||
onPointerOut?(evt: PointerEvent): void;
|
||||
onPointerEnter?(evt: PointerEvent): void;
|
||||
onPointerLeave?(evt: PointerEvent): void;
|
||||
onPointerCancel?(evt: PointerEvent): void;
|
||||
}
|
||||
|
||||
export default class Pointable extends React.Component<PointableProps> {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user