[expo] resolve conflict with main master

This commit is contained in:
KonstantinKai
2018-01-31 10:49:41 +02:00
628 changed files with 15763 additions and 3571 deletions
+3 -2
View File
@@ -256,7 +256,7 @@ When it graduates draft mode, we may remove it from DefinitelyTyped and deprecat
#### I want to update a package to a new major version
Before making your change, please create a new subfolder with the current version e.g. `v2`, and copy existing files to it. You will need to:
If you intend to continue updating the older version of the package, you may create a new subfolder with the current version e.g. `v2`, and copy existing files to it. If so, you will need to:
1. Update the relative paths in `tsconfig.json` as well as `tslint.json`.
2. Add path mapping rules to ensure that tests are running against the intended version.
@@ -279,7 +279,8 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi
}
```
Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*.
If there are other packages on DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version. You will also need to do this for packages depending on packages depending on the old version.
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`;
transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
+9 -3
View File
@@ -701,7 +701,7 @@ declare namespace algoliasearch {
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#add-objects---addobjects
*/
addObjects(objects: [{}]): Promise<any>;
addObjects(objects: {}[]): Promise<any>;
/**
* Add or replace a specific object
* @param object
@@ -729,7 +729,7 @@ declare namespace algoliasearch {
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#update-objects---saveobjects
*/
partialUpdateObjects(objects: [{}]): Promise<any>;
partialUpdateObjects(objects: {}[]): Promise<any>;
/**
* Delete a specific object
* @param objectID
@@ -1387,6 +1387,12 @@ Interface describing options available for gettings the logs
* https://github.com/algolia/algoliasearch-client-js#unretrievableattributes
*/
unretrievableAttributes?: string[];
/**
* List of attributes you want to use for textual search
* default: []
* https://github.com/algolia/algoliasearch-client-js#searchableattributes
*/
searchableAttributes?: string[];
/**
* A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer
* default: *
@@ -1602,7 +1608,7 @@ Interface describing options available for gettings the logs
* default: []
* https://github.com/algolia/algoliasearch-client-js#altcorrections
*/
altCorrections?: [{}];
altCorrections?: {}[];
/**
* Configure the precision of the proximity ranking criterion
* default: 1
+153 -57
View File
@@ -548,80 +548,158 @@ namespace TestPromise {
const promise: angular.IPromise<TResult> = null;
const $q: angular.IQService = null;
const assertPromiseType = <T>(arg: angular.IPromise<T>) => arg;
const reject = $q.reject();
// promise.then
assertPromiseType<any>(promise.then((result) => any));
assertPromiseType<any>(promise.then((result) => any, (any) => any));
assertPromiseType<any>(promise.then((result) => any, (any) => any, (any) => any));
// $ExpectType IPromise<any>
promise.then(result => any);
// $ExpectType IPromise<any>
promise.then(result => any, any => any);
// $ExpectType IPromise<any>
promise.then(result => any, any => any, any => any);
assertPromiseType<never>(promise.then((result) => reject));
assertPromiseType<never>(promise.then((result) => reject, (any) => reject));
assertPromiseType<never>(promise.then((result) => reject, (any) => reject, (any) => any));
// $ExpectType IPromise<never>
promise.then(result => reject);
// $ExpectType IPromise<never>
promise.then(result => reject, any => reject);
// $ExpectType IPromise<never>
promise.then(result => reject, any => reject, any => any);
assertPromiseType<TResult>(promise.then((result) => result));
assertPromiseType<TResult>(promise.then((result) => tresult));
assertPromiseType<TResult>(promise.then((result) => tresultPromise));
assertPromiseType<TResult>(promise.then((result) => result, (any) => any));
assertPromiseType<TResult>(promise.then((result) => result, (any) => any, (any) => any));
assertPromiseType<TResult>(promise.then((result) => result, (any) => reject, (any) => any));
// $ExpectType IPromise<TResult>
promise.then(result => result);
// $ExpectType IPromise<TResult>
promise.then(result => tresult);
// $ExpectType IPromise<TResult>
promise.then(result => tresultPromise);
// $ExpectType IPromise<any>
promise.then(result => result, any => any);
// $ExpectType IPromise<number | TResult>
promise.then(result => result, any => Math.random());
// $ExpectType IPromise<any>
promise.then(result => result, any => any, any => any);
// $ExpectType IPromise<number | TResult>
promise.then(result => result, any => Math.random(), any => any);
// $ExpectType IPromise<TResult>
promise.then(result => result, any => reject, any => any);
assertPromiseType<angular.IPromise<never> | TResult>(promise.then((result) => anyOf2(reject, result)));
assertPromiseType<TResult>(promise.then((result) => anyOf3(result, tresultPromise, reject)));
assertPromiseType<TResult>(promise.then(
(result) => anyOf3(reject, result, tresultPromise),
(reason) => anyOf3(reject, tresult, tresultPromise)
));
// $ExpectType IPromise<TResult>
promise.then(result => anyOf2(reject, result));
// $ExpectType IPromise<TResult>
promise.then(result => anyOf3(result, tresultPromise, reject));
// $ExpectType IPromise<TResult>
promise.then(
result => anyOf3(reject, result, tresultPromise),
reason => anyOf3(reject, tresult, tresultPromise)
);
assertPromiseType<ng.IHttpResponse<TResult>>(promise.then((result) => tresultHttpPromise));
// $ExpectType IPromise<IHttpResponse<TResult>>
promise.then(result => tresultHttpPromise);
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
assertPromiseType<TResult | angular.IPromise<TResult> | angular.IPromise<never> | TOther | angular.IPromise<TOther>>(promise.then(
(result) => anyOf3(reject, result, totherPromise),
(reason) => anyOf3(reject, tother, tresultPromise)
));
// $ExpectType IPromise<TResult | TOther>
promise.then(result => result, any => tother);
assertPromiseType<TResult | TOther>(promise.then<TResult | TOther, TResult>(
(result) => anyOf3(tresultPromise, result, totherPromise)
));
// These are broken and seemingly can't be made to work
// with the current limitations of TypeScript.
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother, (any) => any));
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise));
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any));
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise));
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any));
// xExpectType IPromise<TResult | TOther>
// promise.then(result => anyOf2(result, totherPromise));
// xExpectType IPromise<TResult | TOther>
// promise.then(result => anyOf3(reject, result, totherPromise));
// xExpectType IPromise<TResult | TOther>
// const a4 = promise.then(
// result => anyOf3(reject, result, totherPromise),
// reason => anyOf3(reject, tother, tresultPromise)
// );
assertPromiseType<TOther>(promise.then((result) => tother));
assertPromiseType<TOther>(promise.then((result) => tother, (any) => any));
assertPromiseType<TOther>(promise.then((result) => tother, (any) => any, (any) => any));
assertPromiseType<TOther>(promise.then((result) => totherPromise));
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any));
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any, (any) => any));
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise));
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any));
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any));
// $ExpectType IPromise<TResult | TOther>
promise.then<TResult | TOther, TResult>(result =>
anyOf3(tresultPromise, result, totherPromise)
);
assertPromiseType<boolean>(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
// $ExpectType IPromise<TResult | TOther>
promise.then(result => result, any => tother, any => any);
// $ExpectType IPromise<TResult | TOther>
promise.then(result => tresultPromise, any => totherPromise);
// $ExpectType IPromise<TResult | TOther>
promise.then(result => tresultPromise, any => totherPromise, any => any);
// $ExpectType IPromise<IHttpResponse<TResult> | IHttpResponse<TOther>>
promise.then(result => tresultHttpPromise, any => totherHttpPromise);
// $ExpectType IPromise<IHttpResponse<TResult> | IHttpResponse<TOther>>
promise.then(result => tresultHttpPromise, any => totherHttpPromise, any => any);
// $ExpectType IPromise<TOther>
promise.then(result => tother);
// $ExpectType IPromise<any>
promise.then(result => tother, any => any);
// $ExpectType IPromise<any>
promise.then(result => tother, any => any, any => any);
// $ExpectType IPromise<TOther>
promise.then(result => totherPromise);
// $ExpectType IPromise<any>
promise.then(result => totherPromise, any => any);
// $ExpectType IPromise<any>
promise.then(result => totherPromise, any => any, any => any);
// $ExpectType IPromise<IHttpResponse<TOther>>
promise.then(result => totherHttpPromise);
// $ExpectType IPromise<any>
promise.then(result => totherHttpPromise, any => any);
// $ExpectType IPromise<any>
promise.then(result => totherHttpPromise, any => any, any => any);
// $ExpectType IPromise<boolean>
promise
.then(result => tresult, any => tother)
.then(ambiguous => (isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
// promise.then + $q.reject:
// $ExpectType IPromise<number>
$q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject());
// $ExpectType IPromise<number>
$q.resolve(true).then(result => Math.random() > 0.5 ? Math.random() : $q.reject('a'));
// $ExpectType IPromise<never>
$q.resolve().then(() => $q.reject('a'));
// $ExpectType IPromise<void>
$q.resolve().then(() => {
if (Math.random() > 0.5) $q.reject();
});
// promise.catch
assertPromiseType<any>(promise.catch((err) => err));
assertPromiseType<any>(promise.catch((err) => any));
assertPromiseType<TResult>(promise.catch((err) => tresult));
assertPromiseType<TResult | angular.IPromise<never>>(promise.catch((err) => anyOf2(tresult, reject)));
assertPromiseType<TResult>(promise.catch((err) => anyOf3(tresult, tresultPromise, reject)));
assertPromiseType<TResult>(promise.catch((err) => tresultPromise));
assertPromiseType<TResult | ng.IHttpResponse<TResult>>(promise.catch((err) => tresultHttpPromise));
assertPromiseType<TResult | TOther>(promise.catch((err) => tother));
assertPromiseType<TResult | TOther>(promise.catch((err) => totherPromise));
assertPromiseType<TResult | ng.IHttpResponse<TOther>>(promise.catch((err) => totherHttpPromise));
// $ExpectType IPromise<any>
promise.catch(err => err);
// $ExpectType IPromise<any>
promise.catch(err => any);
// $ExpectType IPromise<TResult>
promise.catch(err => tresult);
// $ExpectType IPromise<TResult>
promise.catch(err => anyOf2(tresult, reject));
// $ExpectType IPromise<TResult>
promise.catch(err => anyOf3(tresult, tresultPromise, reject));
// $ExpectType IPromise<TResult>
promise.catch(err => tresultPromise);
// $ExpectType IPromise<TResult | IHttpResponse<TResult>>
promise.catch(err => tresultHttpPromise);
// $ExpectType IPromise<TResult | TOther>
promise.catch(err => tother);
// $ExpectType IPromise<TResult | TOther>
promise.catch(err => totherPromise);
// $ExpectType IPromise<TResult | IHttpResponse<TOther>>
promise.catch(err => totherHttpPromise);
assertPromiseType<boolean>(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
// $ExpectType IPromise<boolean>
promise
.catch(err => tother)
.then(
ambiguous => (isTResult(ambiguous) ? ambiguous.c : ambiguous.f)
);
// promise.finally
assertPromiseType<TResult>(promise.finally(() => any));
assertPromiseType<TResult>(promise.finally(() => tresult));
assertPromiseType<TResult>(promise.finally(() => tother));
// $ExpectType IPromise<TResult>
promise.finally(() => any);
// $ExpectType IPromise<TResult>
promise.finally(() => tresult);
// $ExpectType IPromise<TResult>
promise.finally(() => tother);
}
function test_angular_forEach() {
@@ -1187,6 +1265,24 @@ function NgModelControllerTyping() {
};
}
// FormController
angular.module('app').directive('formDebugChecker', () => {
return {
require: '^^form',
link: (scope, el, attrs, ctrl) => {
const form = ctrl as angular.IFormController;
el.on('click', () => {
const report = [] as string[];
angular.forEach(form.$error, (controls, validationErrorKey) => {
const names = controls.map(control => control.$name);
report.push(`${validationErrorKey}: ${controls.length} control(s) (${names.join(', ')})`);
});
console.log(`This form has ${report.length} error(s).\n${report.join('\n')}`);
});
}
};
});
let $filter: angular.IFilterService;
function testFilter() {
+32 -17
View File
@@ -357,9 +357,9 @@ declare namespace angular {
$valid: boolean;
$invalid: boolean;
$submitted: boolean;
$error: any;
$name: string;
$pending: any;
$error: { [validationErrorKey: string]: Array<INgModelController | IFormController> };
$name?: string;
$pending?: { [validationErrorKey: string]: Array<INgModelController | IFormController> };
$addControl(control: INgModelController | IFormController): void;
$removeControl(control: INgModelController | IFormController): void;
$setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController | IFormController): void;
@@ -399,8 +399,8 @@ declare namespace angular {
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$viewChangeListeners: IModelViewChangeListener[];
$error: any;
$name: string;
$error: { [validationErrorKey: string]: boolean };
$name?: string;
$touched: boolean;
$untouched: boolean;
@@ -408,7 +408,7 @@ declare namespace angular {
$validators: IModelValidators;
$asyncValidators: IAsyncModelValidators;
$pending: any;
$pending?: { [validationErrorKey: string]: boolean };
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
@@ -1103,28 +1103,43 @@ declare namespace angular {
interface IPromise<T> {
/**
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
* The successCallBack may return IPromise<never> for when a $q.reject() needs to be returned
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method.
* Regardless of when the promise was or will be resolved or rejected, then calls one of
* the success or error callbacks asynchronously as soon as the result is available. The
* callbacks are called with a single argument: the result or rejection reason.
* Additionally, the notify callback may be called zero or more times to provide a
* progress indication, before the promise is resolved or rejected.
* The `successCallBack` may return `IPromise<never>` for when a `$q.reject()` needs to
* be returned.
* This method returns a new promise which is resolved or rejected via the return value
* of the `successCallback`, `errorCallback`. It also notifies via the return value of
* the `notifyCallback` method. The promise can not be resolved or rejected from the
* `notifyCallback` method.
*/
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise<TResult>;
then<TResult1, TResult2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback?: null, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2>;
then<TResult, TCatch>(successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback: (reason: any) => IPromise<TCatch>|TCatch, notifyCallback?: (state: any) => any): IPromise<TResult | TCatch>;
then<TResult1, TResult2, TCatch1, TCatch2>(successCallback: (promiseValue: T) => IPromise<TResult1>|TResult2, errorCallback: (reason: any) => IPromise<TCatch1>|TCatch2, notifyCallback?: (state: any) => any): IPromise<TResult1 | TResult2 | TCatch1 | TCatch2>;
then<TResult1 = T, TResult2 = never>(
successCallback?:
| ((value: T) => IPromise<never> | IPromise<TResult1> | TResult1)
| null,
errorCallback?:
| ((reason: any) => IPromise<never> | IPromise<TResult2> | TResult2)
| null,
notifyCallback?: (state: any) => any
): IPromise<TResult1 | TResult2>;
/**
* Shorthand for promise.then(null, errorCallback)
*/
catch<TCatch>(onRejected: (reason: any) => IPromise<TCatch>|TCatch): IPromise<T | TCatch>;
catch<TCatch1, TCatch2>(onRejected: (reason: any) => IPromise<TCatch1>|TCatch2): IPromise<T | TCatch1 | TCatch2>;
catch<TResult = never>(
onRejected?:
| ((reason: any) => IPromise<never> | IPromise<TResult> | TResult)
| null
): IPromise<T | TResult>;
/**
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
*
* Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
*/
finally(finallyCallback: () => any): IPromise<T>;
finally(finallyCallback: () => void): IPromise<T>;
}
interface IDeferred<T> {
+151
View File
@@ -0,0 +1,151 @@
import QB = require("aqb");
/*
* Most of these tests are taken directly from the examples
* in the aqbjs Github documentation.
*
* https://github.com/arangodb/aqbjs
*/
/*
* section aqb.js
* https://github.com/arangodb/aqbjs#auto-casting-raw-data
*/
const doc = {
aString: "hello",
aDate: new Date(),
aNumber: 23,
anArray: [1, 2, 3, "potato"]
};
QB(doc);
QB.for('x').in('1..5').return('x');
QB.insert(QB(doc)).into('my_collection');
/*
* section aqb.js
* https://github.com/arangodb/aqbjs#aql-types
*/
QB.bool(true);
QB.num("12");
QB.int("1");
QB.str(23);
QB.list([ 1 , 2 , 3 , 4 , 5]);
QB.obj({'some.name': 'value'});
QB.ref("users");
/*
* section aqb.js
* https://github.com/arangodb/aqbjs#aql-expressions
*/
QB.range(1 , 5);
QB.get("property");
QB.ref("user").get("property");
QB.expr(QB.for('x').in('1..5').return('x').toAQL());
/*
* section aqb.js
* https://github.com/arangodb/aqbjs#aql-operations
*/
QB.and("a", "b");
QB.ref("a").and("b");
QB.or("a" , "b");
QB.ref("a").or("b");
QB.add("a" , "b");
QB.ref("a").add("b");
QB.plus("a" , "b");
QB.ref("a").plus("b");
QB.sub("a" , "b");
QB.ref("a").sub("b");
QB.minus("a" , "b");
QB.ref("a").minus("b");
QB.mul("a" , "b");
QB.ref("a").mul("b");
QB.times("a" , "b");
QB.ref("a").times("b");
QB.div("a" , "b");
QB.ref("a").div("b");
QB.mod("a", "b");
QB.ref("a").mod("b");
QB.eq("a" , "b");
QB.ref("a").eq("b");
QB.neq("a", "b");
QB.ref("a").neq("b");
QB.gt("a" , "b");
QB.ref("a").gt("b");
QB.gte("a" , "b");
QB.ref("a").gte("b");
QB.lt("a" , "b");
QB.ref("a").lt("b");
QB.lte("a" , "b");
QB.ref("a").lte("b");
QB.in("a" , "b");
QB.ref("a").in("b");
QB.not("a");
QB.ref("a").not();
QB.notIn("a" , "b");
QB.ref("a").notIn("b");
QB.neg("a");
QB.ref("a").neg();
QB.if("x" , "y" , "z");
QB.ref("x").then("y").else("z");
QB.fn('MY::USER::FUNC')(1, 2, 3);
QB.fn('hello')();
/*
* section aqb.js
* https://github.com/arangodb/aqbjs#aql-statements
*/
QB.for('doc').in('my_collection');
QB.for('doc').in('my_collection').let('foo' , 23);
QB.for('doc').in('my_collection').let('foo' , 23);
// QB.for('doc').in('my_collection').let({a: 1, b: 2, c: 3});
QB.for('doc').in('my_collection').return('x');
QB.for('doc').in('my_collection').return({x: 'x'});
QB.for('doc').in('my_collection').returnDistinct('x');
QB.for('doc').in('my_collection').filter(QB.eq('a', 'b'));
QB.for('doc').in('my_collection').collectWithCountInto('x');
QB.for('doc').in('my_collection').collect('x', 'y');
// QB.for('doc').in('my_collection').collect({x: 'a', y: 'b'});
QB.for('doc').in('my_collection').collect('x' , 'y').withCountInto('z');
QB.for('doc').in('my_collection').collect('x' , 'y').into('z').keep('a' , 'b');
QB.for('doc').in('my_collection').collect('x' , 'y').into('z' , 'Z');
QB.for('doc').in('my_collection').collect('x' , 'y').into('z');
QB.for('doc').in('my_collection').collect('x' , 'y').into('z').options('opts');
QB.for('doc').in('my_collection').collect('x' , 'y').options('opts');
QB.for('doc').in('my_collection').collect('x' , 'y').keep('a' , 'b');
QB.for('doc').in('my_collection').collect('x' , 'y').sort('x', 'DESC', 'y', 'ASC');
QB.for('doc').in('my_collection').collect('x' , 'y').limit(20);
QB.for('doc').in('my_collection').collect('x' , 'y').limit(20 , 20);
QB.for('doc').in('my_collection').remove('x');
QB.for('doc').in('my_collection').remove('x').in('y');
QB.for('doc').in('my_collection').remove('x').in('y').returnOld('a');
QB.for('doc').in('my_collection').remove('x').in('y').options('opts');
QB.upsert('x').insert('y').replace('z').in('c');
QB.upsert('x').insert('y').replace('z').in('c').options('opts');
QB.upsert('x').insert('y').update('z').in('c');
QB.upsert('x').insert('y').update('z').in('c').options('opts');
QB.insert('x').into('y');
QB.insert('x').into('y').options('opts');
QB.insert('x').into('y').returnNew('z');
QB.update('x').in('y');
QB.update('x').into('y');
QB.update('x').with('y').in('z');
QB.update('x').with('y').into('z');
QB.update('x').with('y').into('z').options('opts');
QB.update('x').in('y').options('opts');
QB.update('x').with('y').into('z').returnNew('v');
QB.update('x').with('y').into('z').returnOld('v');
QB.update('x').in('y').options('opts').returnNew('v');
QB.update('x').in('y').options('opts').returnOld('v');
QB.replace('x').in('y');
QB.replace('x').into('y');
QB.replace('x').with('y').in('z');
QB.replace('x').with('y').into('z');
QB.replace('x').with('y').into('z').options('opts');
QB.replace('x').in('y').options('opts');
QB.replace('x').with('y').into('z').returnNew('v');
QB.replace('x').with('y').into('z').returnOld('v');
QB.replace('x').in('y').options('opts').returnNew('v');
QB.replace('x').in('y').options('opts').returnOld('v');
+1105
View File
File diff suppressed because it is too large Load Diff
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": [
"es2015"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"aqb-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+8
View File
@@ -10,6 +10,14 @@ lock.acquire("key", (done) => {
done();
}).then(() => { /* ... */ });
lock.acquire("key", () => "stringValue")
// Check returned value's type is inherited properly
.then((str) => str.replace("s", "S"));
lock.acquire("key", async () => "stringValue")
// Check returned value's type is inherited properly
.then((str) => str.replace("s", "S"));
lock.acquire([ "key1", "key2" ], (done) => {
done();
}, (err, ret) => { /* ... */ });
+11 -5
View File
@@ -1,11 +1,12 @@
// Type definitions for async-lock
// Project: https://github.com/rain1017/async-lock
// Definitions by: Elisée MAURER <https://github.com/elisee>
// Definitions by: Elisée MAURER <https://github.com/elisee>, Alejandro <https://github.com/afharo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
interface AsyncLockDoneCallback {
(err?: Error, ret?: any): void;
interface AsyncLockDoneCallback<T> {
(err?: Error, ret?: T): void;
}
interface AsyncLockOptions {
@@ -18,8 +19,13 @@ interface AsyncLockOptions {
declare class AsyncLock {
constructor(options?: AsyncLockOptions);
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void;
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike<any>;
acquire<T>(key: string | string[],
fn: (() => T | PromiseLike<T>) | ((done: AsyncLockDoneCallback<T>) => any),
opts?: AsyncLockOptions): PromiseLike<T>;
acquire<T>(key: string | string[],
fn: (done: AsyncLockDoneCallback<T>) => any,
cb: AsyncLockDoneCallback<T>,
opts?: AsyncLockOptions): void;
isBusy(): boolean;
}
-2
View File
@@ -8,13 +8,11 @@
"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,
+20
View File
@@ -0,0 +1,20 @@
import { Options, RetryFunction, retry } from 'async-retry';
const o: Options = {
retries: 1,
factor: 2,
minTimeout: 3,
maxTimeout: 4,
randomize: true,
onRetry: (e: Error) => 42
};
retry(
bail => 'hello',
{ retries: 3 }
);
retry(
bail => Promise.resolve(42),
{ retries: 3 }
);
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for async-retry 1.1
// Project: https://github.com/zeit/async-retry#readme
// Definitions by: Albert Wu <https://github.com/albertywu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function retry<A>(fn: RetryFunction<A>, opts: Options): Promise<A>;
export interface Options {
retries?: number;
factor?: number;
minTimeout?: number;
maxTimeout?: number;
randomize?: boolean;
onRetry?: (e: Error) => any;
}
export type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"async-retry-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+8
View File
@@ -1459,6 +1459,14 @@ function testPackageManager() {
bool = atom.packages.isPackageDisabled("Test");
// Activating and deactivating packages
atom.packages.activatePackage("Test").then((activePack) => {
pack = activePack;
});
atom.packages.deactivatePackage("Test", true).then(() => {
// package is deactivated
});
// Accessing active packages
packs = atom.packages.getActivePackages();
+3
View File
@@ -4111,6 +4111,9 @@ export interface PackageManager {
/** Activate a single package by name or path. */
activatePackage(nameOrPath: string): Promise<Package>;
/** Deactivate a single package by name or path. */
deactivatePackage(nameOrPath: string, suppressSerialization?: boolean): Promise<void>;
/** Triggers the given package activation hook. */
triggerActivationHook(hook: string): void;
+13
View File
@@ -204,6 +204,19 @@ const selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks);
// test checkbox-field additional sign up field
const checkboxFieldOptions : Auth0LockConstructorOptions = {
additionalSignUpFields: [{
type: "checkbox",
name: "remember",
placeholder: "Remember Me",
prefill: "false"
}]
};
new Auth0Lock(CLIENT_ID, DOMAIN, checkboxFieldOptions);
// test Avatar options
const avatarOptions : Auth0LockConstructorOptions = {
+24 -2
View File
@@ -2,6 +2,7 @@
// Project: http://auth0.com
// Definitions by: Brian Caruso <https://github.com/carusology>
// Dan Caddigan <https://github.com/goldcaddy77>
// Larry Faudree <https://github.com/lfaudreejr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="auth0-js" />
@@ -23,16 +24,37 @@ type Auth0LockAdditionalSignUpFieldPrefillCallback =
type Auth0LockAdditionalSignUpFieldPrefillFunction =
(callback: Auth0LockAdditionalSignUpFieldPrefillCallback) => void;
interface Auth0LockAdditionalSignUpField {
interface Auth0LockAdditionalTextSignUpField {
type?: "text";
icon?: string;
name: string;
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction;
placeholder: string;
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction;
type?: "select" | "text";
validator?: (input: string) => { valid: boolean; hint?: string };
}
interface Auth0LockAdditionalSelectSignUpField {
type?: "select";
icon?: string;
name: string;
options?: Auth0LockAdditionalSignUpFieldOption[] | Auth0LockAdditionalSignUpFieldOptionsFunction;
placeholder: string;
prefill?: string | Auth0LockAdditionalSignUpFieldPrefillFunction;
validator?: (input: string) => { valid: boolean; hint?: string };
}
interface Auth0LockAdditionalCheckboxSignUpField {
type?: "checkbox";
icon?: string;
name: string;
placeholder: string;
prefill: "true" | "false";
validator?: (input: string) => { valid: boolean, hint?: string };
}
type Auth0LockAdditionalSignUpField = Auth0LockAdditionalSelectSignUpField |Auth0LockAdditionalTextSignUpField |Auth0LockAdditionalCheckboxSignUpField;
type Auth0LockAvatarUrlCallback = (error: auth0.Auth0Error, url: string) => void;
type Auth0LockAvatarDisplayNameCallback = (error: auth0.Auth0Error, displayName: string) => void;
+10
View File
@@ -131,3 +131,13 @@ const retryableManagementClient = new auth0.ManagementClient({
enabled : true
}
});
management.createPasswordChangeTicket({
connection_id: 'con_id',
email: 'test@me.co',
new_password: 'password',
result_url: 'https://www.google.com/',
ttl_sec: 86400,
}, (err: Error, data) => {
console.log(data.ticket);
});
+12 -6
View File
@@ -488,10 +488,16 @@ export interface UserIdParams {
}
export interface PasswordChangeTicketParams {
result_url: string;
user_id: string;
email: string;
new_password: string;
result_url?: string;
user_id?: string;
new_password?: string;
connection_id?: string;
email?: string;
ttl_sec?: number;
}
export interface PasswordChangeTicketResponse {
ticket: string;
}
export interface EmailVerificationTicketOptions {
@@ -711,8 +717,8 @@ export class ManagementClient {
sendEmailVerification(data: UserIdParams, cb?: (err: Error, data: any) => void): void;
// Tickets
createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise<any>;
createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: any) => void): void;
createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise<PasswordChangeTicketResponse>;
createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: PasswordChangeTicketResponse) => void): void;
createEmailVerificationTicket(data: EmailVerificationTicketOptions): Promise<any>;
createEmailVerificationTicket(data: EmailVerificationTicketOptions, cb?: (err: Error, data: any) => void): void;
+102 -102
View File
@@ -1,29 +1,29 @@
var str: string = "any string";
var date: Date = new Date();
var anyObj: any = { abc: 123 };
var num: number = 5;
var error: Error = new Error();
var b: boolean = true;
var apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext;
var apiGwEvt: AWSLambda.APIGatewayEvent;
var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent;
var clientCtx: AWSLambda.ClientContext;
var clientContextEnv: AWSLambda.ClientContextEnv;
var clientContextClient: AWSLambda.ClientContextClient;
var context: AWSLambda.Context;
var identity: AWSLambda.CognitoIdentity;
var proxyResult: AWSLambda.ProxyResult;
var authResponse: AWSLambda.AuthResponse;
var policyDocument: AWSLambda.PolicyDocument;
var statement: AWSLambda.Statement;
var authResponseContext: AWSLambda.AuthResponseContext;
var snsEvt: AWSLambda.SNSEvent;
var snsEvtRecs: AWSLambda.SNSEventRecord[];
var snsEvtRec: AWSLambda.SNSEventRecord;
var snsMsg: AWSLambda.SNSMessage;
var snsMsgAttr: AWSLambda.SNSMessageAttribute;
var snsMsgAttrs: AWSLambda.SNSMessageAttributes;
var S3EvtRec: AWSLambda.S3EventRecord = {
let str: string;
let date: Date;
let anyObj: any;
let num: number;
let error: Error;
let b: boolean;
let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext;
let apiGwEvt: AWSLambda.APIGatewayEvent;
let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent;
let clientCtx: AWSLambda.ClientContext;
let clientContextEnv: AWSLambda.ClientContextEnv;
let clientContextClient: AWSLambda.ClientContextClient;
let context: AWSLambda.Context;
let identity: AWSLambda.CognitoIdentity;
let proxyResult: AWSLambda.ProxyResult;
let authResponse: AWSLambda.AuthResponse;
let policyDocument: AWSLambda.PolicyDocument;
let statement: AWSLambda.Statement;
let authResponseContext: AWSLambda.AuthResponseContext;
let snsEvt: AWSLambda.SNSEvent;
let snsEvtRecs: AWSLambda.SNSEventRecord[];
let snsEvtRec: AWSLambda.SNSEventRecord;
let snsMsg: AWSLambda.SNSMessage;
let snsMsgAttr: AWSLambda.SNSMessageAttribute;
let snsMsgAttrs: AWSLambda.SNSMessageAttributes;
const S3EvtRec: AWSLambda.S3EventRecord = {
eventVersion: '2.0',
eventSource: 'aws:s3',
awsRegion: 'us-east-1',
@@ -32,7 +32,7 @@ var S3EvtRec: AWSLambda.S3EventRecord = {
userIdentity: {
principalId: 'AIDAJDPLRKLG7UEXAMPLE'
},
requestParameters:{
requestParameters: {
sourceIPAddress: '127.0.0.1'
},
responseElements: {
@@ -59,15 +59,15 @@ var S3EvtRec: AWSLambda.S3EventRecord = {
}
};
var S3CreateEvent: AWSLambda.S3CreateEvent = {
const S3CreateEvent: AWSLambda.S3CreateEvent = {
Records: [S3EvtRec]
};
var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent;
var cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent;
var cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse;
var cloudwatchLogsEvent: AWSLambda.CloudWatchLogsEvent;
var cloudwatchLogsDecodedData: AWSLambda.CloudWatchLogsDecodedData;
var scheduledEvent: AWSLambda.ScheduledEvent;
declare const cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent;
declare const cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent;
declare const cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse;
declare const cloudwatchLogsEvent: AWSLambda.CloudWatchLogsEvent;
declare const cloudwatchLogsDecodedData: AWSLambda.CloudWatchLogsDecodedData;
declare const scheduledEvent: AWSLambda.ScheduledEvent;
/* API Gateway Event request context */
str = apiGwEvtReqCtx.accountId;
@@ -113,7 +113,7 @@ str = apiGwEvt.stageVariables["example"];
apiGwEvtReqCtx = apiGwEvt.requestContext;
/* DynamoDB Stream Event */
var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
const dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
Records: [
{
eventID: '1',
@@ -266,13 +266,13 @@ policyDocument = {
authResponse = {
principalId: str,
policyDocument: policyDocument,
policyDocument,
context: authResponseContext
};
authResponse = {
principalId: str,
policyDocument: policyDocument
policyDocument,
};
// CognitoUserPoolEvent
@@ -442,67 +442,67 @@ function customAuthorizerCallback(cb: AWSLambda.CustomAuthorizerCallback) {
}
/* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */
var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = {
"Records": [
const CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = {
Records: [
{
"cf": {
"config": {
"distributionId": "EDFDVBD6EXAMPLE",
"requestId": "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE=="
cf: {
config: {
distributionId: "EDFDVBD6EXAMPLE",
requestId: "MRVMF7KydIvxMWfJIglgwHQwZsbG2IhRJ07sn9AkKUFSHS9EXAMPLE=="
},
"request": {
"clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334",
"method": "GET",
"uri": "/picture.jpg",
"querystring": "size=large",
"headers": {
"host": [
request: {
clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334",
method: "GET",
uri: "/picture.jpg",
querystring: "size=large",
headers: {
host: [
{
"key": "Host",
"value": "d111111abcdef8.cloudfront.net"
key: "Host",
value: "d111111abcdef8.cloudfront.net"
}
],
"user-agent": [
{
"key": "User-Agent",
"value": "curl/7.51.0"
key: "User-Agent",
value: "curl/7.51.0"
}
]
},
"origin": {
"custom": {
"customHeaders": {
origin: {
custom: {
customHeaders: {
"my-origin-custom-header": [
{
"key": "My-Origin-Custom-Header",
"value": "Test"
key: "My-Origin-Custom-Header",
value: "Test"
}
]
},
"domainName": "example.com",
"keepaliveTimeout": 5,
"path": "/custom_path",
"port": 443,
"protocol": "https",
"readTimeout": 5,
"sslProtocols": [
domainName: "example.com",
keepaliveTimeout: 5,
path: "/custom_path",
port: 443,
protocol: "https",
readTimeout: 5,
sslProtocols: [
"TLSv1",
"TLSv1.1"
]
},
"s3": {
"authMethod": "origin-access-identity",
"customHeaders": {
s3: {
authMethod: "origin-access-identity",
customHeaders: {
"my-origin-custom-header": [
{
"key": "My-Origin-Custom-Header",
"value": "Test"
key: "My-Origin-Custom-Header",
value: "Test"
}
]
},
"domainName": "my-bucket.s3.amazonaws.com",
"path": "/s3_path",
"region": "us-east-1"
domainName: "my-bucket.s3.amazonaws.com",
path: "/s3_path",
region: "us-east-1"
}
}
}
@@ -511,52 +511,52 @@ var CloudFrontRequestEvent: AWSLambda.CloudFrontRequestEvent = {
]
};
var CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = {
"Records": [
const CloudFrontResponseEvent: AWSLambda.CloudFrontResponseEvent = {
Records: [
{
"cf": {
"config": {
"distributionId": "EDFDVBD6EXAMPLE",
"requestId": "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE=="
cf: {
config: {
distributionId: "EDFDVBD6EXAMPLE",
requestId: "xGN7KWpVEmB9Dp7ctcVFQC4E-nrcOcEKS3QyAez--06dV7TEXAMPLE=="
},
"request": {
"clientIp": "2001:0db8:85a3:0:0:8a2e:0370:7334",
"method": "GET",
"uri": "/picture.jpg",
"querystring": "size=large",
"headers": {
"host": [
request: {
clientIp: "2001:0db8:85a3:0:0:8a2e:0370:7334",
method: "GET",
uri: "/picture.jpg",
querystring: "size=large",
headers: {
host: [
{
"key": "Host",
"value": "d111111abcdef8.cloudfront.net"
key: "Host",
value: "d111111abcdef8.cloudfront.net"
}
],
"user-agent": [
{
"key": "User-Agent",
"value": "curl/7.18.1"
key: "User-Agent",
value: "curl/7.18.1"
}
]
}
},
"response": {
"status": "200",
"statusDescription": "OK",
"headers": {
"server": [
response: {
status: "200",
statusDescription: "OK",
headers: {
server: [
{
"key": "Server",
"value": "MyCustomOrigin"
key: "Server",
value: "MyCustomOrigin"
}
],
"set-cookie": [
{
"key": "Set-Cookie",
"value": "theme=light"
key: "Set-Cookie",
value: "theme=light"
},
{
"key": "Set-Cookie",
"value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
key: "Set-Cookie",
value: "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
}
]
}
+102 -85
View File
@@ -18,10 +18,10 @@
// TypeScript Version: 2.2
// API Gateway "event" request context
interface APIGatewayEventRequestContext {
export interface APIGatewayEventRequestContext {
accountId: string;
apiId: string;
authorizer?: AuthResponseContext | null | undefined;
authorizer?: AuthResponseContext | null;
httpMethod: string;
identity: {
accessKey: string | null;
@@ -36,7 +36,7 @@ interface APIGatewayEventRequestContext {
user: string | null;
userAgent: string | null;
userArn: string | null;
},
};
stage: string;
requestId: string;
requestTimeEpoch: number;
@@ -45,7 +45,7 @@ interface APIGatewayEventRequestContext {
}
// API Gateway "event"
interface APIGatewayEvent {
export interface APIGatewayEvent {
body: string | null;
headers: { [name: string]: string };
httpMethod: string;
@@ -59,7 +59,7 @@ interface APIGatewayEvent {
}
// API Gateway CustomAuthorizer "event"
interface CustomAuthorizerEvent {
export interface CustomAuthorizerEvent {
type: string;
methodArn: string;
authorizationToken?: string;
@@ -71,22 +71,22 @@ interface CustomAuthorizerEvent {
// Context
// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html
interface AttributeValue {
export interface AttributeValue {
B?: string;
BS?: Array<string>;
BS?: string[];
BOOL?: boolean;
L?: Array<AttributeValue>;
L?: AttributeValue[];
M?: { [id: string]: AttributeValue };
N?: string;
NS?: Array<string>;
NS?: string[];
NULL?: boolean;
S?: string;
SS?: Array<string>;
SS?: string[];
}
// Context
// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html
interface StreamRecord {
export interface StreamRecord {
ApproximateCreationTime?: number;
Keys?: { [key: string]: AttributeValue };
NewImage?: { [key: string]: AttributeValue };
@@ -98,7 +98,7 @@ interface StreamRecord {
// Context
// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_Record.html
interface DynamoDBRecord {
export interface DynamoDBRecord {
awsRegion?: string;
dynamodb?: StreamRecord;
eventID?: string;
@@ -112,21 +112,21 @@ interface DynamoDBRecord {
// AWS Lambda Stream event
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ddb-update
interface DynamoDBStreamEvent {
Records: Array<DynamoDBRecord>;
export interface DynamoDBStreamEvent {
Records: DynamoDBRecord[];
}
// SNS "event"
interface SNSMessageAttribute {
export interface SNSMessageAttribute {
Type: string;
Value: string;
}
interface SNSMessageAttributes {
export interface SNSMessageAttributes {
[name: string]: SNSMessageAttribute;
}
interface SNSMessage {
export interface SNSMessage {
SignatureVersion: string;
Timestamp: string;
Signature: string;
@@ -140,37 +140,37 @@ interface SNSMessage {
Subject: string;
}
interface SNSEventRecord {
export interface SNSEventRecord {
EventVersion: string;
EventSubscriptionArn: string;
EventSource: string;
Sns: SNSMessage;
}
interface SNSEvent {
Records: Array<SNSEventRecord>;
export interface SNSEvent {
Records: SNSEventRecord[];
}
/**
* S3Create event
* https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html
*/
interface S3EventRecord {
export interface S3EventRecord {
eventVersion: string;
eventSource: string;
awsRegion: string
awsRegion: string;
eventTime: string;
eventName: string;
userIdentity: {
principalId: string;
},
};
requestParameters: {
sourceIPAddress: string;
},
};
responseElements: {
'x-amz-request-id': string;
'x-amz-id-2': string;
},
};
s3: {
s3SchemaVersion: string;
configurationId: string;
@@ -188,20 +188,41 @@ interface S3EventRecord {
versionId: string;
sequencer: string;
}
}
};
}
interface S3CreateEvent {
Records: Array<S3EventRecord>;
export interface S3CreateEvent {
Records: S3EventRecord[];
}
/**
* Cognito User Pool event
* http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html
*/
interface CognitoUserPoolEvent {
export interface CognitoUserPoolEvent {
version: number;
triggerSource: "PreSignUp_SignUp" | "PostConfirmation_ConfirmSignUp" | "PreAuthentication_Authentication" | "PostAuthentication_Authentication" | "CustomMessage_SignUp" | "CustomMessage_AdminCreateUser" | "CustomMessage_ResendCode" | "CustomMessage_ForgotPassword" | "CustomMessage_UpdateUserAttribute" | "CustomMessage_VerifyUserAttribute" | "CustomMessage_Authentication" | "DefineAuthChallenge_Authentication" | "CreateAuthChallenge_Authentication" | "VerifyAuthChallengeResponse_Authentication" | "PreSignUp_AdminCreateUser" | "PostConfirmation_ConfirmForgotPassword" | "TokenGeneration_HostedAuth" | "TokenGeneration_Authentication" | "TokenGeneration_NewPasswordChallenge" | "TokenGeneration_AuthenticateDevice" | "TokenGeneration_RefreshTokens";
triggerSource:
| "PreSignUp_SignUp"
| "PostConfirmation_ConfirmSignUp"
| "PreAuthentication_Authentication"
| "PostAuthentication_Authentication"
| "CustomMessage_SignUp"
| "CustomMessage_AdminCreateUser"
| "CustomMessage_ResendCode"
| "CustomMessage_ForgotPassword"
| "CustomMessage_UpdateUserAttribute"
| "CustomMessage_VerifyUserAttribute"
| "CustomMessage_Authentication"
| "DefineAuthChallenge_Authentication"
| "CreateAuthChallenge_Authentication"
| "VerifyAuthChallengeResponse_Authentication"
| "PreSignUp_AdminCreateUser"
| "PostConfirmation_ConfirmForgotPassword"
| "TokenGeneration_HostedAuth"
| "TokenGeneration_Authentication"
| "TokenGeneration_NewPasswordChallenge"
| "TokenGeneration_AuthenticateDevice"
| "TokenGeneration_RefreshTokens";
region: string;
userPoolId: string;
userName?: string;
@@ -215,11 +236,11 @@ interface CognitoUserPoolEvent {
codeParameter?: string;
usernameParameter?: string;
newDeviceUsed?: boolean;
session?: {
session?: Array<{
challengeName: "CUSTOM_CHALLENGE" | "PASSWORD_VERIFIER" | "SMS_MFA" | "DEVICE_SRP_AUTH" | "DEVICE_PASSWORD_VERIFIER" | "ADMIN_NO_SRP_AUTH";
challengeResult: boolean;
challengeMetaData?: string;
}[];
}>;
challengeName?: string;
privateChallengeParameters?: {[key: string]: string};
challengeAnswer?: {[key: string]: string};
@@ -243,7 +264,7 @@ interface CognitoUserPoolEvent {
* CloudFormation Custom Resource event and response
* http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/crpg-ref.html
*/
type CloudFormationCustomResourceEventCommon = {
export interface CloudFormationCustomResourceEventCommon {
ServiceToken: string;
ResponseURL: string;
StackId: string;
@@ -253,14 +274,14 @@ type CloudFormationCustomResourceEventCommon = {
ResourceProperties: {
ServiceToken: string;
[Key: string]: any;
}
};
}
type CloudFormationCustomResourceCreateEvent = CloudFormationCustomResourceEventCommon & {
export interface CloudFormationCustomResourceCreateEvent extends CloudFormationCustomResourceEventCommon {
RequestType: "Create";
}
type CloudFormationCustomResourceUpdateEvent = CloudFormationCustomResourceEventCommon & {
export interface CloudFormationCustomResourceUpdateEvent extends CloudFormationCustomResourceEventCommon {
RequestType: "Update";
PhysicalResourceId: string;
OldResourceProperties: {
@@ -268,29 +289,29 @@ type CloudFormationCustomResourceUpdateEvent = CloudFormationCustomResourceEvent
};
}
type CloudFormationCustomResourceDeleteEvent = CloudFormationCustomResourceEventCommon & {
export interface CloudFormationCustomResourceDeleteEvent extends CloudFormationCustomResourceEventCommon {
RequestType: "Delete";
PhysicalResourceId: string;
}
export type CloudFormationCustomResourceEvent = CloudFormationCustomResourceCreateEvent | CloudFormationCustomResourceUpdateEvent | CloudFormationCustomResourceDeleteEvent;
type CloudFormationCustomResourceResponseCommon = {
export interface CloudFormationCustomResourceResponseCommon {
PhysicalResourceId: string;
StackId: string;
RequestId: string;
LogicalResourceId: string;
Data?: {
[Key: string]: any;
}
};
}
type CloudFormationCustomResourceSuccessResponse = CloudFormationCustomResourceResponseCommon & {
export interface CloudFormationCustomResourceSuccessResponse extends CloudFormationCustomResourceResponseCommon {
Status: "SUCCESS";
Reason?: string;
}
type CloudFormationCustomResourceFailedResponse = CloudFormationCustomResourceResponseCommon & {
export interface CloudFormationCustomResourceFailedResponse extends CloudFormationCustomResourceResponseCommon {
Status: "FAILED";
Reason: string;
}
@@ -300,7 +321,7 @@ export type CloudFormationCustomResourceResponse = CloudFormationCustomResourceS
/**
* See https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-scheduled-event
*/
interface ScheduledEvent {
export interface ScheduledEvent {
account: string;
region: string;
detail: any;
@@ -308,21 +329,21 @@ interface ScheduledEvent {
source: string;
time: string;
id: string;
resources: string[]
resources: string[];
}
/**
* See http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-cloudwatch-logs
*/
interface CloudWatchLogsEvent {
export interface CloudWatchLogsEvent {
awslogs: CloudWatchLogsEventData;
}
interface CloudWatchLogsEventData {
export interface CloudWatchLogsEventData {
data: string;
}
interface CloudWatchLogsDecodedData {
export interface CloudWatchLogsDecodedData {
owner: string;
logGroup: string;
logStream: string;
@@ -334,17 +355,15 @@ interface CloudWatchLogsDecodedData {
/**
* See http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html#LambdaFunctionExample
*/
interface CloudWatchLogsLogEvent {
export interface CloudWatchLogsLogEvent {
id: string;
timestamp: number;
message: string;
}
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
interface Context {
export interface Context {
// Properties
callbackWaitsForEmptyEventLoop: boolean;
functionName: string;
@@ -363,25 +382,23 @@ interface Context {
// Functions for compatibility with earlier Node.js Runtime v0.10.42
// For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods
done(error?: Error, result?: any): void;
fail(error: Error): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;
fail(error: Error | string): void;
succeed(messageOrObject: any): void;
succeed(message: string, object: any): void;
}
interface CognitoIdentity {
export interface CognitoIdentity {
cognitoIdentityId: string;
cognitoIdentityPoolId: string;
}
interface ClientContext {
export interface ClientContext {
client: ClientContextClient;
Custom?: any;
env: ClientContextEnv;
}
interface ClientContextClient {
export interface ClientContextClient {
installationId: string;
appTitle: string;
appVersionName: string;
@@ -389,7 +406,7 @@ interface ClientContextClient {
appPackageName: string;
}
interface ClientContextEnv {
export interface ClientContextEnv {
platformVersion: string;
platform: string;
make: string;
@@ -397,11 +414,11 @@ interface ClientContextEnv {
locale: string;
}
interface ProxyResult {
export interface ProxyResult {
statusCode: number;
headers?: {
[header: string]: boolean | number | string;
},
};
body: string;
isBase64Encoded?: boolean;
}
@@ -410,7 +427,7 @@ interface ProxyResult {
* API Gateway CustomAuthorizer AuthResponse.
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
*/
interface AuthResponse {
export interface AuthResponse {
principalId: string;
policyDocument: PolicyDocument;
context?: AuthResponseContext;
@@ -420,7 +437,7 @@ interface AuthResponse {
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
*/
interface PolicyDocument {
export interface PolicyDocument {
Version: string;
Statement: [Statement];
}
@@ -429,7 +446,7 @@ interface PolicyDocument {
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement.
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
*/
interface Statement {
export interface Statement {
Action: string | string[];
Effect: string;
Resource: string | string[];
@@ -439,58 +456,58 @@ interface Statement {
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement.
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
*/
interface AuthResponseContext {
[name: string]: string | number | boolean;
export interface AuthResponseContext {
[name: string]: any;
}
/**
* CloudFront events
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
*/
type CloudFrontHeaders = {
[name: string]: {
key: string;
value: string;
}[]
};
export interface CloudFrontHeaders {
[name: string]: Array<{
key: string;
value: string;
}>;
}
type CloudFrontResponse = {
export interface CloudFrontResponse {
status: string;
statusDescription: string;
headers: CloudFrontHeaders;
};
}
type CloudFrontRequest = {
export interface CloudFrontRequest {
clientIp: string;
method: string;
uri: string;
querystring: string;
headers: CloudFrontHeaders;
};
}
type CloudFrontEvent = {
export interface CloudFrontEvent {
config: {
distributionId: string;
requestId: string;
}
};
}
export type CloudFrontResponseEvent = {
Records: {
export interface CloudFrontResponseEvent {
Records: Array<{
cf: CloudFrontEvent & {
request: CloudFrontRequest;
response: CloudFrontResponse;
}
}[]
};
}>;
}
export type CloudFrontRequestEvent = {
Records: {
export interface CloudFrontRequestEvent {
Records: Array<{
cf: CloudFrontEvent & {
request: CloudFrontRequest;
}
}[]
};
}>;
}
/**
* AWS Lambda handler function.
+2 -74
View File
@@ -1,79 +1,7 @@
{
"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
// TODO
"dt-header": false
}
}
+2 -2
View File
@@ -516,7 +516,7 @@ export namespace Widgets {
* Debug mode. Enables usage of the debug method. Also creates a debug console which will display when
* pressing F12. It will display all log and debug messages.
*/
debug?(...msg: string[]): void;
debug?: boolean;
/**
* Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful
@@ -963,7 +963,7 @@ export namespace Widgets {
/**
* Spawn a process in the foreground, return to blessed app after exit.
*/
spawn(file: string, args: string[], options: NodeChildProcessExecOptions): child_process.ChildProcess;
spawn(file: string, args?: string[], options?: NodeChildProcessExecOptions): child_process.ChildProcess;
/**
* Spawn a process in the foreground, return to blessed app after exit. Executes callback on error or exit.
+56 -54
View File
@@ -47,7 +47,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
/**
* Promises/A+ `.then()`. Returns a new promise chained from this promise.
*
* The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
* The new promise will be rejected or resolved depending on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
*/
// Based on PromiseLike.then, but returns a Bluebird instance.
then<U>(onFulfill?: (value: R) => U | PromiseLike<U>, onReject?: (error: any) => U | PromiseLike<U>): Bluebird<U>; // For simpler signature help.
@@ -192,34 +192,34 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
*/
tapCatch<U>(onReject: (error?: any) => U | PromiseLike<U>): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error, E5 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | object,
filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | object,
tapCatch<U, E1, E2, E3, E4, E5>(
filter1: CatchFilter<E1>,
filter2: CatchFilter<E2>,
filter3: CatchFilter<E3>,
filter4: CatchFilter<E4>,
filter5: CatchFilter<E5>,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | object,
tapCatch<U, E1, E2, E3, E4>(
filter1: CatchFilter<E1>,
filter2: CatchFilter<E2>,
filter3: CatchFilter<E3>,
filter4: CatchFilter<E4>,
onReject: (error: E1 | E2 | E3 | E4) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error, E3 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | object,
tapCatch<U, E1, E2, E3>(
filter1: CatchFilter<E1>,
filter2: CatchFilter<E2>,
filter3: CatchFilter<E3>,
onReject: (error: E1 | E2 | E3) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | object,
tapCatch<U, E1, E2>(
filter1: CatchFilter<E1>,
filter2: CatchFilter<E2>,
onReject: (error: E1 | E2) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | object,
tapCatch<U, E1>(
filter1: CatchFilter<E1>,
onReject: (error: E1) => U | PromiseLike<U>,
): Bluebird<R>;
@@ -364,34 +364,35 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
*/
catchReturn<U>(value: U): Bluebird<R | U>;
// No need to be specific about Error types in these overrides, since there's no handler function
catchReturn<U>(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter5: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
filter3: CatchFilter<Error>,
filter4: CatchFilter<Error>,
filter5: CatchFilter<Error>,
value: U,
): Bluebird<R | U>;
catchReturn<U>(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
filter3: CatchFilter<Error>,
filter4: CatchFilter<Error>,
value: U,
): Bluebird<R | U>;
catchReturn<U>(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
filter3: CatchFilter<Error>,
value: U,
): Bluebird<R | U>;
catchReturn<U>(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
value: U,
): Bluebird<R | U>;
catchReturn<U>(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
value: U,
): Bluebird<R | U>;
@@ -407,34 +408,35 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
*/
catchThrow(reason: Error): Bluebird<R>;
// No need to be specific about Error types in these overrides, since there's no handler function
catchThrow(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter5: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
filter3: CatchFilter<Error>,
filter4: CatchFilter<Error>,
filter5: CatchFilter<Error>,
reason: Error,
): Bluebird<R>;
catchThrow(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter4: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
filter3: CatchFilter<Error>,
filter4: CatchFilter<Error>,
reason: Error,
): Bluebird<R>;
catchThrow(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter3: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
filter3: CatchFilter<Error>,
reason: Error,
): Bluebird<R>;
catchThrow(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter2: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
filter2: CatchFilter<Error>,
reason: Error,
): Bluebird<R>;
catchThrow(
filter1: (new (...args: any[]) => Error) | ((error: any) => boolean) | object,
filter1: CatchFilter<Error>,
reason: Error,
): Bluebird<R>;
@@ -761,7 +763,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
static race<R>(values: PromiseLike<Iterable<PromiseLike<R> | R>> | Iterable<PromiseLike<R> | R>): Bluebird<R>;
/**
* Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises).
* Initiate a competitive race between multiple promises or values (values will become immediately fulfilled promises).
* When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.
*
* If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in.
@@ -835,7 +837,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
*
* If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
*
* *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned.
* *The original array is not modified. If no `initialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned.
* If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.*
*/
static reduce<R, U>(
@@ -1053,7 +1055,7 @@ declare namespace Bluebird {
* Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property.
* The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions.
*
* If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values.
* If the the callback is called with multiple success values, the resolver fulfills its promise with an array of the values.
*/
// TODO specify resolver callback
callback(err: any, value: R, ...values: R[]): void;
+18 -7
View File
@@ -228,11 +228,11 @@ declare namespace Bull {
}
interface JobCounts {
wait: number;
active: number;
completed: number;
failed: number;
delayed: number;
waiting: number;
}
interface JobInformation {
@@ -384,21 +384,27 @@ declare namespace Bull {
/**
* Returns a promise that resolves when the queue is paused.
* The pause is global, meaning that all workers in all queue instances for a given queue will be paused.
* A paused queue will not process new jobs until resumed,
* but current jobs being processed will continue until they are finalized.
*
* A paused queue will not process new jobs until resumed, but current jobs being processed will continue until
* they are finalized. The pause can be either global or local. If global, all workers in all queue instances
* for a given queue will be paused. If local, just this worker will stop processing new jobs after the current
* lock expires. This can be useful to stop a worker from taking new jobs prior to shutting down.
*
* Pausing a queue that is already paused does nothing.
*/
pause(): Promise<void>;
pause(isLocal?: boolean): Promise<void>;
/**
* Returns a promise that resolves when the queue is resumed after being paused.
* The resume is global, meaning that all workers in all queue instances for a given queue will be resumed.
*
* The resume can be either local or global. If global, all workers in all queue instances for a given queue
* will be resumed. If local, only this worker will be resumed. Note that resuming a queue globally will not
* resume workers that have been paused locally; for those, resume(true) must be called directly on their
* instances.
*
* Resuming a queue that is not paused does nothing.
*/
resume(): Promise<void>;
resume(isLocal?: boolean): Promise<void>;
/**
* Returns a promise that returns the number of jobs in the queue, waiting or paused.
@@ -445,6 +451,11 @@ declare namespace Bull {
*/
getFailed(start?: number, end?: number): Promise<Job[]>;
/**
* Returns a promise that will return an array with the waiting jobs between start and end.
*/
getWaiting(start?: number, end?: number): Promise<Job[]>;
/**
* Returns JobInformation of repeatable jobs (ordered descending). Provide a start and/or an end
* index to limit the number of results. Start defaults to 0, end to -1 and asc to false.
+39 -1
View File
@@ -152,7 +152,8 @@ function axis_examples() {
fit: true,
values: [1, 2, 4, 8, 16, 32],
rotate: 60,
outer: false
outer: false,
width: 100
},
max: 100,
min: -100,
@@ -940,6 +941,26 @@ function axes_x_tick_fit() {
});
}
function axes_x_tick_width() {
const chart = c3.generate({
data: {
x: "x",
columns: [
["x", "2013-10-31", "2013-12-31", "2014-01-31", "2014-02-28"],
["sample", 30, 100, 400, 150],
]
},
axis: {
x: {
type: "bar",
tick: {
width: 100
}
}
}
});
}
function axes_x_localtime() {
const chart = c3.generate({
data: {
@@ -1861,6 +1882,23 @@ function tooltip_order() {
});
}
function tooltip_order_function() {
const chart = c3.generate({
data: {
columns: [
["data1", 30, 200, 100, 400, 150, 250],
["data2", 50, 20, 10, 40, 15, 25]
]
},
tooltip: {
order: (data1, data2) => {
return data1.id - data2.id;
// return data2.id - data2.id in case we want desc order
}
}
});
}
////////////////////////
// Chart options Tests
////////////////////////
+7 -1
View File
@@ -3,6 +3,7 @@
// Definitions by: Marc Climent <https://github.com/mcliment>
// Gerin Jacob <https://github.com/gerinjacob>
// Bernd Hacker <https://github.com/denyo>
// Dzmitry Shyndzin <https://github.com/dmitryshindin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -585,6 +586,10 @@ export interface XTickConfiguration {
* Show x axis outer tick.
*/
outer?: boolean;
/**
* Set width of x axis tick.
*/
width?: number;
multiline?: boolean; // Undocumented
}
@@ -739,8 +744,9 @@ export interface TooltipOptions {
contents?(data: any, defaultTitleFormat: string, defaultValueFormat: string, color: any): string;
/**
* Set tooltip values order
* Available Values: desc, asc, any[], function (data1, data2) { ... }, null
*/
order?: string | any[] | ((data: Data) => boolean);
order?: string | any[] | ((data1: any, data2: any) => number) | null;
}
export interface SubchartOptions {
+100
View File
@@ -51,6 +51,90 @@ describe('chai-string', function() {
});
describe('#containIgnoreSpaces', function () {
it('should return true', function () {
var str1 = '1234abcdef56',
str2 = '1234a\nb\tc\r d ef56';
str1.should.containIgnoreSpaces(str2);
});
it('should return true (2)', function () {
var str1 = 'abcdef',
str2 = 'a\nb\tc\r d ef';
str1.should.containIgnoreSpaces(str2);
});
it('should return false', function () {
var str1 = 'abdef',
str2 = 'a\nb\tc\r d ef';
str1.should.not.containIgnoreSpaces(str2);
});
});
describe('#containIgnoreCase', function () {
it('should return true', function () {
var str1 = 'abcdef',
str2 = 'cDe';
str1.should.containIgnoreCase(str2);
});
it('should return true (2)', function () {
'abcdef'.should.containIgnoreCase('cDe');
});
it('should return true (3)', function () {
var str1 = 'abcdef',
str2 = 'AbCdeF';
str1.should.containIgnoreCase(str2);
});
it('should return false', function () {
var str1 = 'abcdef',
str2 = 'efg';
str1.should.not.containIgnoreCase(str2);
});
it('should return false (3)', function () {
var str1 = 'abcdef',
str2 = 'zabcd';
str1.should.not.containIgnoreCase(str2);
});
});
describe('#indexOf', function () {
it('should return true', function () {
var str = 'abcabd',
substr = 'ab',
index = 0;
str.indexOf(substr, index).should.be.true;
});
it('should return true (2)', function () {
var str = 'abcabd',
substr = 'ca',
index = 2;
str.indexOf(substr, index).should.be.true;
});
it('should return true (3)', function () {
var str = 'ababab',
substr = 'ba',
index = 1;
str.indexOf(substr, index).should.be.true;
});
it('should return false', function () {
var str = 'abcaab',
substr = 'da',
index = 1;
str.indexOf(substr, index).should.be.false;
});
});
describe('tdd alias', function() {
let str: string;
let str2: string;
@@ -92,6 +176,14 @@ describe('chai-string', function() {
assert.notEqualIgnoreSpaces(str, str2 + 'g');
});
it('.containIgnoreSpaces', function () {
assert.containIgnoreSpaces(str, str2);
});
it('.notContainIgnoreSpaces', function () {
assert.notContainIgnoreSpaces(str, str2 + 'g');
});
it('.singleLine', function() {
assert.singleLine(str);
});
@@ -125,5 +217,13 @@ describe('chai-string', function() {
assert.entriesCount('', 'ab', 0);
});
it('.indexOf', function () {
assert.indexOf('abcabd', 'ab', 0);
assert.indexOf('abcabd', 'ca', 2);
assert.indexOf('ababab', 'ba', 1);
assert.indexOf('ababab', 'ba', 1);
'ababab'.indexOf('ba', 1).should.be.true;
});
});
});
+9 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for chai-string 1.1.4
// Type definitions for chai-string 1.4.0
// Project: https://github.com/onechiporenko/chai-string
// Definitions by: Nick Malaguti <https://github.com/nmalaguti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -14,10 +14,13 @@ declare global {
endWith(expected: string, message?: string): Assertion;
equalIgnoreCase(expected: string, message?: string): Assertion;
equalIgnoreSpaces(expected: string, message?: string): Assertion;
containIgnoreCase(expected: string, msg?: string): Assertion;
containIgnoreSpaces(expected: string, msg?: string): Assertion;
singleLine(message?: string): Assertion;
reverseOf(message?: string): Assertion;
palindrome(message?: string): Assertion;
entriesCount(substr: string, expected: number, message?: string): Assertion;
indexOf(str: string, substr: string, index: number, msg?: string): Assertion;
}
interface Assert {
@@ -29,6 +32,10 @@ declare global {
notEqualIgnoreCase(val: string, exp: string, msg?: string): void;
equalIgnoreSpaces(val: string, exp: string, msg?: string): void;
notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void;
containIgnoreCase(val: string, exp: string, msg?: string): void;
notContainIgnoreCase(val: string, exp: string, msg?: string): void;
containIgnoreSpaces(val: string, exp: string, msg?: string): void;
notContainIgnoreSpaces(val: string, exp: string, msg?: string): void;
singleLine(val: string, msg?: string): void;
notSingleLine(val: string, msg?: string): void;
reverseOf(val: string, exp: string, msg?: string): void;
@@ -36,6 +43,7 @@ declare global {
palindrome(val: string, msg?: string): void;
notPalindrome(val: string, msg?: string): void;
entriesCount(str: string, substr: string, count: number, msg?: string): void;
indexOf(str: string, substr: string, index: number, msg?: string): void;
}
}
}
+8 -1
View File
@@ -45,7 +45,14 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
}
}]
},
plugins: { arbitraryPlugin: {option: "value"} }
plugins: { arbitraryPlugin: {option: "value"} },
legend: {
display: true,
labels: {
usePointStyle: true,
padding: 40
}
},
}
});
chart.update();
+4
View File
@@ -8,6 +8,7 @@
// Joseph Page <https://github.com/josefpaij>
// Dan Manastireanu <https://github.com/danmana>
// Guillaume Rodriguez <https://github.com/guillaume-ro-fr>
// Sergey Rubanov <https://github.com/chicoxyzzy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -119,6 +120,7 @@ declare namespace Chart {
lineJoin?: string;
lineWidth?: number;
strokeStyle?: string;
pointStyle?: PointStyle;
}
interface ChartTooltipItem {
@@ -231,6 +233,8 @@ declare namespace Chart {
fontFamily?: string;
padding?: number;
generateLabels?(chart: any): any;
filter?(item: ChartLegendItem, data: ChartData): any;
usePointStyle?: boolean;
}
interface ChartTooltipOptions {
+6
View File
@@ -6050,6 +6050,12 @@ declare namespace chrome.tabs {
* @since Chrome 39.
*/
matchAboutBlank?: boolean;
/**
* Optional. The origin of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to "author".
* One of: "author", or "user"
* @since Chrome 66.
*/
cssOrigin?: string;
}
export interface CreateProperties {
+70 -25
View File
@@ -24,6 +24,8 @@ declare namespace CKEDITOR {
var DIALOG_RESIZE_HEIGHT: number;
var DIALOG_RESIZE_NONE: number;
var DIALOG_RESIZE_WIDTH: number;
var DIALOG_STATE_IDLE: number;
var DIALOG_STATE_BUSY: number;
var ELEMENT_MODE_APPENDTO: number;
var ELEMENT_MODE_INLINE: number;
var ELEMENT_MODE_NONE: number;
@@ -42,6 +44,10 @@ declare namespace CKEDITOR {
var NODE_DOCUMENT_FRAGMENT: number;
var NODE_ELEMENT: number;
var NODE_TEXT: number;
var POSITION_BEFORE_START: number;
var POSITION_BEFORE_END: number;
var POSITION_AFTER_START: number;
var POSITION_AFTER_END: number;
var SELECTION_ELEMENT: number;
var SELECTION_NONE: number;
var SELECTION_TEXT: number;
@@ -49,6 +55,9 @@ declare namespace CKEDITOR {
var SHRINK_ELEMENT: number;
var SHRINK_TEXT: number;
var START: number;
var STYLE_BLOCK: string;
var STYLE_INLINE: string;
var STYLE_OBJECT: string;
var TRISTATE_DISABLED: number;
var TRISTATE_OFF: number;
var TRISTATE_ON: number;
@@ -62,7 +71,7 @@ declare namespace CKEDITOR {
var currentInstance: editor;
var document: dom.document;
var env: environmentConfig;
var instances: editor[];
var instances: { [id: string]: editor | undefined };
var loadFullCoreTimeout: number;
var revision: string;
var rnd: number;
@@ -92,9 +101,19 @@ declare namespace CKEDITOR {
function replaceAll(className?: string): void;
function replaceAll(assertionFunction: (textarea: HTMLTextAreaElement, config: config) => boolean): void;
type listenerRegistration = {
removeListener: () => void;
}
namespace dom {
interface bookmark {
startNode: dom.node | string;
endNode: dom.node | string;
serializable: boolean;
collapsed: boolean;
}
class comment {
// Properties
@@ -269,16 +288,17 @@ declare namespace CKEDITOR {
class elementPath {
constructor(startNode: element, root: element);
constructor(startNode: element);
block: element;
blockLimit: element;
root: element;
elements: element[];
compare(otherPath: elementPath): boolean;
contains(query: string, excludeRoot: boolean, fromTop: boolean): element;
contains(query: string[], excludeRoot: boolean, fromTop: boolean): element;
contains(query: (element: element) => boolean, excludeRoot: boolean, fromTop: boolean): element;
contains(query: Object, excludeRoot: boolean, fromTop: boolean): element;
contains(query: element, excludeRoot: boolean, fromTop: boolean): element;
contains(query: string, excludeRoot?: boolean, fromTop?: boolean): element;
contains(query: string[], excludeRoot?: boolean, fromTop?: boolean): element;
contains(query: (element: element) => boolean, excludeRoot?: boolean, fromTop?: boolean): element;
contains(query: Object, excludeRoot?: boolean, fromTop?: boolean): element;
contains(query: element, excludeRoot?: boolean, fromTop?: boolean): element;
isContextFor(tag: string): boolean;
direction(): string;
}
@@ -300,7 +320,7 @@ declare namespace CKEDITOR {
cloneContents(): documentFragment;
deleteContents(mergeThen?: boolean): void;
extractContents(mergeThen?: boolean): documentFragment;
createBookmark(serializable: boolean): Object;
createBookmark(serializable?: boolean): bookmark;
createBookmark2(normalized: boolean): Object;
createIterator(): iterator;
moveToBookmark(bookmark: Object): void;
@@ -322,6 +342,7 @@ declare namespace CKEDITOR {
setStartAt(node: node, position: number): void;
setEndAt(node: node, position: number): void;
fixBlock(isStart: boolean, blockTag: Object): Object;
select(): selection;
splitBlock(blockTag: Object): Object;
splitElement(toSplit: element): element;
removeEmptyBlocksAtEnd(atEnd: boolean): void;
@@ -815,7 +836,7 @@ declare namespace CKEDITOR {
templates_files?: Object;
templates_replaceContent?: boolean;
title?: string | boolean;
toolbar?: string | (string | string[])[];
toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null;
toolbarCanCollapse?: boolean;
toolbarGroupCycling?: boolean;
toolbarGroups?: (toolbarGroups | string)[];
@@ -847,14 +868,20 @@ declare namespace CKEDITOR {
bottom?: string | HTMLElement;
}
module skin {
var icons: { [name: string]: { path: string } };
function addIcon(name: string, path: string, offset?: number, bgsize?: string): void;
}
interface style {
}
interface editable {
class style {
constructor(something: { element: string, attributes: { [att: string]: string } });
applyToRange(range: Range, editor: editor): void;
}
interface editable extends dom.element {
hasFocus: boolean;
attachListener(obj: event | editable, eventName: string, listenerFunction: (ei: eventInfo) => void,
scopeobj?: {}, listenerData?: any, priority?: number): listenerRegistration;
}
@@ -951,11 +978,14 @@ declare namespace CKEDITOR {
destroy(widget: CKEDITOR.plugins.widget, offline?: boolean): void;
destroyAll(offline?: boolean): void;
finalizeCreation(container: any): void;
focused: widget;
fire(eventName: string, data: Object, editor: editor): any; // should be boolean | Object
getByElement(element: any, checkWrapperOnly: boolean): CKEDITOR.plugins.widget;
hasListeners(eventName: string): boolean;
initOn(element: any, widgetDef?: CKEDITOR.plugins.widget.definition, startupData?: Object): CKEDITOR.plugins.widget;
initOnAll(container?: any): CKEDITOR.plugins.widget[];
initOn(element: dom.element, widgetDef?: CKEDITOR.plugins.widget.definition, startupData?: Object): CKEDITOR.plugins.widget;
initOn(element: dom.element, widgetDef?: string, startupData?: Object): CKEDITOR.plugins.widget;
initOnAll(container?: dom.element): CKEDITOR.plugins.widget[];
instances: { [id: string]: widget };
on(eventName: string, listenerFunction: Function, scopeObj?: Object, listenerData?: Object, priority?: number): any;
once(): void;
parseElementClasses(classes: string): any;
@@ -1040,12 +1070,13 @@ declare namespace CKEDITOR {
requires?: string | string[];
afterInit?(editor: editor): any;
beforeInit?(editor: editor): any;
init?(editor: editor): any;
init?(editor: editor): void;
onLoad?(): any;
icons?: string;
}
function add(name: string, definition?: IPluginDefinition): void;
function add(name: string, definition: IPluginDefinition): void;
function add(name: string): void;
function addExternal(name: string, path: string, fileName: string): void;
function get(name: string): any;
function getFilePath(name: string): string;
@@ -1058,6 +1089,7 @@ declare namespace CKEDITOR {
interface IMenuItemDefinition {
label:string,
command:string,
icon: string
group:string,
order:number
}
@@ -1110,6 +1142,7 @@ declare namespace CKEDITOR {
createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
createRange(): dom.range;
destroy(noUpdate?: boolean): void;
editable(): editable | null;
editable(elementOrEditable: dom.element): void;
editable(elementOrEditable: editable): void;
elementPath(startNode?: dom.node): dom.elementPath;
@@ -1267,8 +1300,14 @@ declare namespace CKEDITOR {
stop(): void;
}
module filter {
interface allowedContentRules {
}
}
class filter {
allow(newRules: CKEDITOR.filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean;
}
@@ -1309,8 +1348,8 @@ declare namespace CKEDITOR {
fire(eventName: string, data?: Object, editor?: editor): any;
fireOnce(eventName: string, data?: Object, editor?: editor): any;
hasListeners(eventName: string): boolean;
on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void;
once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object, listenerData?: Object, priority?: number): void;
on(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object | null, listenerData?: Object | null, priority?: number): listenerRegistration;
once(eventName: string, listenerFunction: (eventInfo: eventInfo) => void, scopeObj?: Object | null, listenerData?: Object | null, priority?: number): listenerRegistration;
removeAllListeners(): void;
removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void;
static implementOn(targetObject: Object): void;
@@ -1768,6 +1807,7 @@ declare namespace CKEDITOR {
constructor(value: string);
type: number;
filter(filter: filter): boolean;
value: string;
writeHtml(writer: basicWriter, filter: filter): void;
}
@@ -1779,6 +1819,7 @@ declare namespace CKEDITOR {
children: any[];
type: number;
add(node: node): number;
add(node: node, index: number): void;
clone(): element;
filter(filter: filter): boolean;
filterChildren(filter: filter): void;
@@ -1803,10 +1844,12 @@ declare namespace CKEDITOR {
children: any[];
parent: any;
type: number;
fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: string): void;
fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: string): void;
fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: boolean): void;
fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: boolean): void;
static fromHtml(fragmentHtml: string): fragment;
static fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: string): fragment | element;
static fromHtml(fragmentHtml: string, parent: null, fixingBlock?: string): fragment;
static fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: string): fragment | element;
static fromHtml(fragmentHtml: string, parent?: element, fixingBlock?: boolean): fragment | element;
static fromHtml(fragmentHtml: string, parent?: string, fixingBlock?: boolean): fragment | element;
add(node: node, index?: number): void;
filter(filter: filter): void;
filterChildren(filter: filter, filterRoot?: boolean): void;
@@ -1847,7 +1890,9 @@ declare namespace CKEDITOR {
namespace tools {
var callFunction: Function;
function enableHtml5Elements(doc: Object, withAppend? : Boolean) : void;
function enableHtml5Elements(doc: Object, withAppend?: Boolean): void;
function parseCssText(styleText: string, normalize?: Boolean, nativeNormalize?: Boolean): { [key: string]: string }
function writeCssText(style: { [key: string]: string }, sort?: Boolean): string;
}
+2 -2
View File
@@ -25,8 +25,8 @@ const yellow: number = color.yellow();
const black: number = color.black();
const luminosity: number = color.luminosity();
const contrast: number = color.contrast(colorOther);
const dark: boolean = color.dark();
const light: boolean = color.light();
const isDark: boolean = color.isDark();
const isLight: boolean = color.isLight();
const level: string = color.level(colorOther);
const x: number = color.x();
+4 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for color 2.0
// Type definitions for color 3.0
// Project: https://github.com/qix-/color#readme
// Definitions by: Junyoung Clare Jang <https://github.com/Airlun>
// Definitions by: Junyoung Clare Jang <https://github.com/Airlun>, James W. Lane <https://github.com/jameswlane>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -72,8 +72,8 @@ interface Color {
luminosity(): number;
contrast(color2: Color): number;
level(color2: Color): 'AAA' | 'AA' | '';
dark(): boolean;
light(): boolean;
isDark(): boolean;
isLight(): boolean;
negate(): Color;
lighten(ratio: number): Color;
darken(ratio: number): Color;
+65
View File
@@ -0,0 +1,65 @@
import Color = require('color');
const color: Color = new Color("white");
const colorOther: Color = new Color("black");
const colorRGB: Color = new Color({ r: 0, g: 0, b: 0 }, "rgb");
const colorInt: Color = new Color(0x000000);
const colorWithoutNew: Color = Color(0x000000);
const colorByStaticMethod: Color = Color.rgb({ r: 0, g: 0, b: 0 });
const hex: string = color.hex();
const percent: string = color.percentString();
const keyword: string = color.keyword();
const alpha: number = color.alpha();
const red: number = color.red();
const green: number = color.green();
const blue: number = color.blue();
const hue: number = color.hue();
const saturationl: number = color.saturationl();
const lightness: number = color.lightness();
const saturationv: number = color.saturationv();
const value: number = color.value();
const cyan: number = color.cyan();
const magenta: number = color.magenta();
const yellow: number = color.yellow();
const black: number = color.black();
const luminosity: number = color.luminosity();
const contrast: number = color.contrast(colorOther);
const dark: boolean = color.dark();
const light: boolean = color.light();
const level: string = color.level(colorOther);
const x: number = color.x();
const y: number = color.y();
const z: number = color.z();
const l: number = color.l();
const a: number = color.a();
const b: number = color.b();
const rgbNumber: number = color.rgbNumber();
const chain: Color = color
.alpha(0)
.red(0)
.green(0)
.blue(0)
.hue(0)
.saturationl(0)
.lightness(0)
.saturationv(0)
.value(0)
.cyan(0)
.magenta(0)
.yellow(0)
.black(0)
.negate()
.lighten(0)
.darken(0)
.saturate(0)
.desaturate(0)
.grayscale()
.whiten(0)
.blacken(0)
.opaquer(0)
.rotate(0)
.mix(colorOther, 0)
.hsl();
+135
View File
@@ -0,0 +1,135 @@
// Type definitions for color 2.0
// Project: https://github.com/qix-/color#readme
// Definitions by: Junyoung Clare Jang <https://github.com/Airlun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import convert = require('color-convert');
type ColorParam = Color | string | ArrayLike<number> | number | { [key: string]: any };
interface Color {
toString(): string;
toJSON(): Color;
string(places?: number): string;
percentString(places?: number): string;
array(): number[];
object(): { alpha?: number } & { [key: string]: number };
unitArray(): number[];
unitObject(): { r: number, g: number, b: number, alpha?: number };
round(places?: number): Color;
alpha(): number;
alpha(val: number): Color;
red(): number;
red(val: number): Color;
green(): number;
green(val: number): Color;
blue(): number;
blue(val: number): Color;
hue(): number;
hue(val: number): Color;
saturationl(): number;
saturationl(val: number): Color;
lightness(): number;
lightness(val: number): Color;
saturationv(): number;
saturationv(val: number): Color;
value(): number;
value(val: number): Color;
chroma(): number;
chroma(val: number): Color;
gray(): number;
gray(val: number): Color;
white(): number;
white(val: number): Color;
wblack(): number;
wblack(val: number): Color;
cyan(): number;
cyan(val: number): Color;
magenta(): number;
magenta(val: number): Color;
yellow(): number;
yellow(val: number): Color;
black(): number;
black(val: number): Color;
x(): number;
x(val: number): Color;
y(): number;
y(val: number): Color;
z(): number;
z(val: number): Color;
l(): number;
l(val: number): Color;
a(): number;
a(val: number): Color;
b(): number;
b(val: number): Color;
keyword(): string;
keyword(val: string): Color;
hex(): string;
hex(val: string): Color;
rgbNumber(): number;
luminosity(): number;
contrast(color2: Color): number;
level(color2: Color): 'AAA' | 'AA' | '';
dark(): boolean;
light(): boolean;
negate(): Color;
lighten(ratio: number): Color;
darken(ratio: number): Color;
saturate(ratio: number): Color;
desaturate(ratio: number): Color;
whiten(ratio: number): Color;
blacken(ratio: number): Color;
grayscale(): Color;
fade(ratio: number): Color;
opaquer(ratio: number): Color;
rotate(degrees: number): Color;
mix(mixinColor: Color, weight?: number): Color;
rgb(...args: number[]): Color;
hsl(...args: number[]): Color;
hsv(...args: number[]): Color;
hwb(...args: number[]): Color;
cmyk(...args: number[]): Color;
xyz(...args: number[]): Color;
lab(...args: number[]): Color;
lch(...args: number[]): Color;
ansi16(...args: number[]): Color;
ansi256(...args: number[]): Color;
hcg(...args: number[]): Color;
apple(...args: number[]): Color;
}
interface ColorConstructor {
(obj?: ColorParam, model?: keyof (typeof convert)): Color;
new(obj?: ColorParam, model?: keyof (typeof convert)): Color;
rgb(...val: number[]): Color;
rgb(color: ColorParam): Color;
hsl(...val: number[]): Color;
hsl(color: ColorParam): Color;
hsv(...val: number[]): Color;
hsv(color: ColorParam): Color;
hwb(...val: number[]): Color;
hwb(color: ColorParam): Color;
cmyk(...val: number[]): Color;
cmyk(color: ColorParam): Color;
xyz(...val: number[]): Color;
xyz(color: ColorParam): Color;
lab(...val: number[]): Color;
lab(color: ColorParam): Color;
lch(...val: number[]): Color;
lch(color: ColorParam): Color;
ansi16(...val: number[]): Color;
ansi16(color: ColorParam): Color;
ansi256(...val: number[]): Color;
ansi256(color: ColorParam): Color;
hcg(...val: number[]): Color;
hcg(color: ColorParam): Color;
apple(...val: number[]): Color;
apple(color: ColorParam): Color;
}
declare const Color: ColorConstructor;
export = Color;
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"color": [
"color/v2"
]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"color-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for conf 1.1
// Type definitions for conf 1.4
// Project: https://github.com/sindresorhus/conf
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// BendingBender <https://github.com/BendingBender>
@@ -24,6 +24,7 @@ declare class Conf<T = any> implements Iterable<[string, T]> {
has(key: string): boolean;
delete(key: string): void;
clear(): void;
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
[Symbol.iterator](): Iterator<[string, T]>;
}
@@ -73,6 +73,12 @@ const ClassicComponent: React.ClassicComponentClass<Props> = createReactClass<Pr
}
});
const ClassicComponentNoProps: React.ClassicComponentClass = createReactClass({
render() {
return DOM.div();
}
});
// React.createFactory
const classicFactory: React.ClassicFactory<Props> =
React.createFactory(ClassicComponent);
@@ -81,6 +87,7 @@ const classicFactoryElement: React.ClassicElement<Props> =
// React.createElement
const classicElement: React.ClassicElement<Props> = React.createElement(ClassicComponent, props);
const classicElementNullProps: React.ClassicElement<{}> = React.createElement(ClassicComponentNoProps, null);
// React.cloneElement
const clonedClassicElement: React.ClassicElement<Props> =
+15
View File
@@ -488,6 +488,21 @@ declare class cropperjs {
*/
rotateTo(degree: number): void;
/**
* Scale the image.
*/
scale(scaleX: number, scaleY?: number): void;
/**
* Scale the abscissa of the image.
*/
scaleX(scaleX: number): void;
/**
* Scale the ordinate of the image.
*/
scaleY(scaleY: number): void;
/**
* Clear the crop box.
*/
+20
View File
@@ -0,0 +1,20 @@
import * as spawn from 'cross-spawn';
import * as cp from 'child_process';
const p1: cp.ChildProcess = spawn('my-cmd', ['foo', 'bar']);
const pw: cp.ChildProcess = spawn('my-cmd', ['foo', 'bar'], {env: process.env});
pw.on('error', (err: Error) => {
console.log(err);
});
const r1: Error = spawn.sync('foo').error;
const r2: string[] = spawn.sync('foo').output;
const r3: Buffer = spawn.sync('foo').stdout;
const r4: Buffer = spawn.sync('foo').stderr;
const r5: number = spawn.sync('foo').status;
const r6: string = spawn.sync('foo').signal;
const r7: string = spawn.sync('foo', {encoding: 'utf8'}).stdout;
spawn.sync('foo', ['bar']);
spawn.sync('foo', ['bar'], {stdio: 'inherit'});
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for cross-spawn 6.0
// Project: https://github.com/moxystudio/node-cross-spawn
// Definitions by: Alorel <https://github.com/Alorel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as child_process from 'child_process';
declare function spawn(command: string, args?: string[], options?: child_process.SpawnOptions): child_process.ChildProcess;
declare namespace spawn {
const sync: typeof child_process.spawnSync;
}
export = spawn;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cross-spawn-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+158 -176
View File
@@ -1,6 +1,12 @@
import * as assert from "power-assert";
import { setWorldConstructor, defineParameterType, After, AfterAll, Before, BeforeAll, Given, When, Then } from "cucumber";
import cucumber = require("cucumber");
type Callback = cucumber.CallbackStepDefinition;
type Table = cucumber.TableDefinition;
type HookScenarioResult = cucumber.HookScenarioResult;
const Status = cucumber.Status;
// You can optionally declare your own world properties
declare module "cucumber" {
interface World {
@@ -8,190 +14,166 @@ declare module "cucumber" {
}
}
function StepSample() {
type Callback = cucumber.CallbackStepDefinition;
type Table = cucumber.TableDefinition;
type HookScenarioResult = cucumber.HookScenarioResult;
const Status = cucumber.Status;
cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => {
setWorldConstructor(function({attach, parameters}) {
this.attach = attach;
this.parameters = parameters;
this.visit = (url: string, callback: Callback) => {
callback(null, 'pending');
};
});
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
BeforeAll((callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll('@tag', (callback: Callback) => {
console.log("Before all");
callback();
});
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
if (scenarioResult.result.status === Status.FAILED) {
runScenario(null, () => {
console.log('finish tasks');
});
}
});
After((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
AfterAll((callback: Callback) => {
console.log("After all");
callback();
});
AfterAll({ timeout: 1000 }, (callback: Callback) => {
console.log("After all");
callback();
});
AfterAll('@tag', (callback: Callback) => {
console.log("After all");
callback();
});
registerHandler('AfterFeatures', (event: any, callback: () => void) => {
callback();
});
Given(/^a variable set to (\d+)$/, (x: string) => {
console.log("the number is: " + x);
});
Given(/^a variable set to (\d+)$/, (x: number) => {
console.log(typeof x);
});
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
this.visit('https://github.com/cucumber/cucumber-js', callback);
});
When(/^I go to the README file$/, (title: string, callback: Callback) => {
function StepSampleWithoutDefineSupportCode() {
setWorldConstructor(function({attach, parameters}) {
this.attach = attach;
this.parameters = parameters;
this.visit = (url: string, callback: Callback) => {
callback(null, 'pending');
});
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
const pageTitle = this.browser.text('title');
if (title === pageTitle) {
callback();
} else {
callback(new Error("Expected to be on page with title " + title));
}
});
// Type for data_table.js on
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
Given(/^a table step with Table raw$/, (table: Table) => {
const expected = [
['Cucumber', 'Cucumis sativus'],
['Burr Gherkin', 'Cucumis anguria']
];
const actual: string[][] = table.raw();
assert.deepEqual(actual, expected);
});
Given(/^a table step with Table rows$/, (table: Table) => {
const expected = [
['Apricot', '5'],
['Brocolli', '2'],
['Cucumber', '10']
];
const actual: string[][] = table.rows();
assert.deepEqual(actual, expected);
});
Given(/^a table step with Table rowHash$/, (table: Table) => {
const expected = {
Cucumber: 'Cucumis sativus',
'Burr Gherkin': 'Cucumis anguria'
};
const actual: { [firstCol: string]: string } = table.rowsHash();
assert.deepEqual(actual, expected);
});
Given(/^a table step$/, (table: Table) => {
const expected = [
{Vegetable: 'Apricot', Rating: '5'},
{Vegetable: 'Brocolli', Rating: '2'},
{Vegetable: 'Cucumber', Rating: '10'}
];
const actual: Array<{ [colName: string]: string }> = table.hashes();
assert.deepEqual(actual, expected);
});
defineParameterType({
regexp: /particular/,
transformer: s => s.toUpperCase(),
typeName: 'param' // deprecated but still supported
});
defineParameterType({
regexp: /particularly/,
transformer: s => s.toUpperCase(),
name: 'param'
});
Given('a {param} step', param => {
assert.equal(param, 'PARTICULAR');
});
};
});
const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns();
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
cucumber.clearSupportCodeFns();
}
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
function registerListener(): cucumber.EventListener {
const listener = Object.assign(cucumber.Listener(), {
handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => {
// do some interesting stuff ...
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
BeforeAll((callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll('@tag', (callback: Callback) => {
console.log("Before all");
callback();
});
After((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
AfterAll((callback: Callback) => {
console.log("After all");
callback();
});
AfterAll({ timeout: 1000 }, (callback: Callback) => {
console.log("After all");
callback();
});
AfterAll('@tag', (callback: Callback) => {
console.log("After all");
callback();
});
Given(/^a variable set to (\d+)$/, (x: string) => {
console.log("the number is: " + x);
});
Given(/^a variable set to (\d+)$/, (x: number) => {
console.log(typeof x);
});
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
this.visit('https://github.com/cucumber/cucumber-js', callback);
});
When(/^I go to the README file$/, (title: string, callback: Callback) => {
callback(null, 'pending');
});
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
const pageTitle = this.browser.text('title');
if (title === pageTitle) {
callback();
} else {
callback(new Error("Expected to be on page with title " + title));
}
});
return listener;
// Type for data_table.js on
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
Given(/^a table step with Table raw$/, (table: Table) => {
const expected = [
['Cucumber', 'Cucumis sativus'],
['Burr Gherkin', 'Cucumis anguria']
];
const actual: string[][] = table.raw();
assert.deepEqual(actual, expected);
});
Given(/^a table step with Table rows$/, (table: Table) => {
const expected = [
['Apricot', '5'],
['Brocolli', '2'],
['Cucumber', '10']
];
const actual: string[][] = table.rows();
assert.deepEqual(actual, expected);
});
Given(/^a table step with Table rowHash$/, (table: Table) => {
const expected = {
Cucumber: 'Cucumis sativus',
'Burr Gherkin': 'Cucumis anguria'
};
const actual: { [firstCol: string]: string } = table.rowsHash();
assert.deepEqual(actual, expected);
});
Given(/^a table step$/, (table: Table) => {
const expected = [
{Vegetable: 'Apricot', Rating: '5'},
{Vegetable: 'Brocolli', Rating: '2'},
{Vegetable: 'Cucumber', Rating: '10'}
];
const actual: Array<{ [colName: string]: string }> = table.hashes();
assert.deepEqual(actual, expected);
});
defineParameterType({
regexp: /particular/,
transformer: s => s.toUpperCase(),
typeName: 'param' // deprecated but still supported
});
defineParameterType({
regexp: /particularly/,
transformer: s => s.toUpperCase(),
name: 'param',
preferForRegexpMatch: false,
useForSnippets: false
});
Given('a {param} step', param => {
assert.equal(param, 'PARTICULAR');
});
}
// syntax defineSupportCode deprecated
function StepSample() {
cucumber.defineSupportCode((l) => {
});
}
const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns();
cucumber.clearSupportCodeFns();
+26 -7
View File
@@ -1,4 +1,4 @@
// Type definitions for cucumber-js 3.2
// Type definitions for cucumber-js 4.0
// Project: https://github.com/cucumber/cucumber-js
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
// Jan Molak <https://github.com/jan-molak>
@@ -49,6 +49,29 @@ export interface StepDefinitions {
setDefaultTimeout(time: number): void;
}
export function After(code: HookCode): void;
export function After(options: HookOptions | string, code: HookCode): void;
export function AfterAll(code: GlobalHookCode): void;
export function AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
export function Before(code: HookCode): void;
export function Before(options: HookOptions | string, code: HookCode): void;
export function BeforeAll(code: GlobalHookCode): void;
export function BeforeAll(options: HookOptions | string, code: GlobalHookCode): void;
export function defineParameterType(transform: Transform): void;
export function defineStep(pattern: RegExp | string, code: StepDefinitionCode): void;
export function Given(pattern: RegExp | string, code: StepDefinitionCode): void;
export function Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
export function setDefaultTimeout(time: number): void;
export function setDefinitionFunctionWrapper(fn: () => void, options?: {[key: string]: any}): void;
// tslint:disable-next-line ban-types
export function setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void;
export function Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
export function Then(pattern: RegExp | string, code: StepDefinitionCode): void;
export function When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
export function When(pattern: RegExp | string, code: StepDefinitionCode): void;
export interface HookScenarioResult {
sourceLocation: SourceLocation;
result: ScenarioResult;
@@ -98,12 +121,11 @@ export namespace pickle {
export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void;
export type GlobalHookCode = (callback?: CallbackStepDefinition) => void;
// tslint:disable-next-line ban-types
export type AroundCode = (scenario: HookScenarioResult, runScenario?: (error: string, callback?: Function) => void) => void;
export interface Transform {
regexp: RegExp;
transformer(arg: string): any;
useForSnippets?: boolean;
preferForRegexpMatch?: boolean;
name?: string;
typeName?: string; // deprecated
}
@@ -122,12 +144,9 @@ export interface Hooks {
After(options: HookOptions | string, code: HookCode): void;
AfterAll(code: GlobalHookCode): void;
AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
Around(code: AroundCode): void;
setDefaultTimeout(time: number): void;
// tslint:disable-next-line ban-types
setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void;
registerHandler(handlerOption: string, code: (event: any, callback: CallbackStepDefinition) => void): void;
registerListener(listener: EventListener): void;
defineParameterType(transform: Transform): void;
}
+197
View File
@@ -0,0 +1,197 @@
import * as assert from "power-assert";
import cucumber = require("cucumber");
// You can optionally declare your own world properties
declare module "cucumber" {
interface World {
visit(url: string, callback: CallbackStepDefinition): void;
}
}
function StepSample() {
type Callback = cucumber.CallbackStepDefinition;
type Table = cucumber.TableDefinition;
type HookScenarioResult = cucumber.HookScenarioResult;
const Status = cucumber.Status;
cucumber.defineSupportCode(({setWorldConstructor, defineParameterType, After, AfterAll, Around, Before, BeforeAll, registerHandler, Given, When, Then}) => {
setWorldConstructor(function({attach, parameters}) {
this.attach = attach;
this.parameters = parameters;
this.visit = (url: string, callback: Callback) => {
callback(null, 'pending');
};
});
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log(scenarioResult.result.status === Status.FAILED);
callback();
});
BeforeAll((callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll({ timeout: 1000 }, (callback: Callback) => {
console.log("Before all");
callback();
});
BeforeAll('@tag', (callback: Callback) => {
console.log("Before all");
callback();
});
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
if (scenarioResult.result.status === Status.FAILED) {
runScenario(null, () => {
console.log('finish tasks');
});
}
});
After((scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
After('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();
});
AfterAll((callback: Callback) => {
console.log("After all");
callback();
});
AfterAll({ timeout: 1000 }, (callback: Callback) => {
console.log("After all");
callback();
});
AfterAll('@tag', (callback: Callback) => {
console.log("After all");
callback();
});
registerHandler('AfterFeatures', (event: any, callback: () => void) => {
callback();
});
Given(/^a variable set to (\d+)$/, (x: string) => {
console.log("the number is: " + x);
});
Given(/^a variable set to (\d+)$/, (x: number) => {
console.log(typeof x);
});
Given(/^I am on the Cucumber.js GitHub repository$/, function(callback: Callback) {
this.visit('https://github.com/cucumber/cucumber-js', callback);
});
When(/^I go to the README file$/, (title: string, callback: Callback) => {
callback(null, 'pending');
});
Then(/^I should see "(.*)" as the page title$/, {timeout: 60 * 1000}, function(title: string, callback: Callback) {
const pageTitle = this.browser.text('title');
if (title === pageTitle) {
callback();
} else {
callback(new Error("Expected to be on page with title " + title));
}
});
// Type for data_table.js on
// https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js
Given(/^a table step with Table raw$/, (table: Table) => {
const expected = [
['Cucumber', 'Cucumis sativus'],
['Burr Gherkin', 'Cucumis anguria']
];
const actual: string[][] = table.raw();
assert.deepEqual(actual, expected);
});
Given(/^a table step with Table rows$/, (table: Table) => {
const expected = [
['Apricot', '5'],
['Brocolli', '2'],
['Cucumber', '10']
];
const actual: string[][] = table.rows();
assert.deepEqual(actual, expected);
});
Given(/^a table step with Table rowHash$/, (table: Table) => {
const expected = {
Cucumber: 'Cucumis sativus',
'Burr Gherkin': 'Cucumis anguria'
};
const actual: { [firstCol: string]: string } = table.rowsHash();
assert.deepEqual(actual, expected);
});
Given(/^a table step$/, (table: Table) => {
const expected = [
{Vegetable: 'Apricot', Rating: '5'},
{Vegetable: 'Brocolli', Rating: '2'},
{Vegetable: 'Cucumber', Rating: '10'}
];
const actual: Array<{ [colName: string]: string }> = table.hashes();
assert.deepEqual(actual, expected);
});
defineParameterType({
regexp: /particular/,
transformer: s => s.toUpperCase(),
typeName: 'param' // deprecated but still supported
});
defineParameterType({
regexp: /particularly/,
transformer: s => s.toUpperCase(),
name: 'param'
});
Given('a {param} step', param => {
assert.equal(param, 'PARTICULAR');
});
});
const fns: cucumber.SupportCodeConsumer[] = cucumber.getSupportCodeFns();
cucumber.clearSupportCodeFns();
}
function registerListener(): cucumber.EventListener {
const listener = Object.assign(cucumber.Listener(), {
handleBeforeScenarioEvent: (scenario: cucumber.events.ScenarioPayload, callback: () => void) => {
// do some interesting stuff ...
callback();
}
});
return listener;
}
+311
View File
@@ -0,0 +1,311 @@
// Type definitions for cucumber-js 3.2
// Project: https://github.com/cucumber/cucumber-js
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
// Jan Molak <https://github.com/jan-molak>
// Isaiah Soung <https://github.com/isoung>
// BendingBender <https://github.com/BendingBender>
// ErikSchierboom <https://github.com/ErikSchierboom>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
export enum Status {
AMBIGUOUS = "ambiguous",
FAILED = "failed",
PASSED = "passed",
PENDING = "pending",
SKIPPED = "skipped",
UNDEFINED = "undefined"
}
export interface World {
[key: string]: any;
}
export interface CallbackStepDefinition {
pending(): PromiseLike<any>;
(error?: any, pending?: string): void;
}
export interface TableDefinition {
raw(): string[][];
rows(): string[][];
rowsHash(): { [firstCol: string]: string };
hashes(): Array<{ [colName: string]: string }>;
}
export type StepDefinitionCode = (this: World, ...stepArgs: any[]) => any;
export interface StepDefinitionOptions {
timeout?: number;
}
export interface StepDefinitions {
Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
Given(pattern: RegExp | string, code: StepDefinitionCode): void;
When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
When(pattern: RegExp | string, code: StepDefinitionCode): void;
Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void;
Then(pattern: RegExp | string, code: StepDefinitionCode): void;
setDefaultTimeout(time: number): void;
}
export interface HookScenarioResult {
sourceLocation: SourceLocation;
result: ScenarioResult;
pickle: pickle.Pickle;
}
export interface SourceLocation {
line: number;
url: string;
}
export interface ScenarioResult {
duration: number;
status: Status;
}
export namespace pickle {
interface Pickle {
language: string;
locations: Location[];
name: string;
steps: Step[];
tags: string[];
}
interface Location {
column: number;
line: number;
}
interface Step {
arguments: Argument[];
locations: Location[];
text: string;
}
interface Argument {
rows: Cell[];
}
interface Cell {
location: Location;
value: string;
}
}
export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void;
export type GlobalHookCode = (callback?: CallbackStepDefinition) => void;
// tslint:disable-next-line ban-types
export type AroundCode = (scenario: HookScenarioResult, runScenario?: (error: string, callback?: Function) => void) => void;
export interface Transform {
regexp: RegExp;
transformer(arg: string): any;
name?: string;
typeName?: string; // deprecated
}
export interface HookOptions {
timeout?: number;
tags?: any;
}
export interface Hooks {
Before(code: HookCode): void;
Before(options: HookOptions | string, code: HookCode): void;
BeforeAll(code: GlobalHookCode): void;
BeforeAll(options: HookOptions | string, code: GlobalHookCode): void;
After(code: HookCode): void;
After(options: HookOptions | string, code: HookCode): void;
AfterAll(code: GlobalHookCode): void;
AfterAll(options: HookOptions | string, code: GlobalHookCode): void;
Around(code: AroundCode): void;
setDefaultTimeout(time: number): void;
// tslint:disable-next-line ban-types
setWorldConstructor(world: ((this: World, init: {attach: Function, parameters: {[key: string]: any}}) => void) | {}): void;
registerHandler(handlerOption: string, code: (event: any, callback: CallbackStepDefinition) => void): void;
registerListener(listener: EventListener): void;
defineParameterType(transform: Transform): void;
}
export class EventListener {
hear(event: events.Event, callback: () => void): void;
hasHandlerForEvent(event: events.Event): boolean;
buildHandlerNameForEvent(event: events.Event): string;
getHandlerForEvent(event: events.Event): EventHook;
buildHandlerName(shortName: string): string;
setHandlerForEvent(shortName: string, handler: EventListener): void;
}
export function Listener(): EventListener;
export namespace events {
interface Event {
name: string;
data: any;
}
// tslint:disable-next-line no-empty-interface
interface EventPayload {
}
interface FeaturesPayload extends EventPayload {
getFeatures(): any[]; // https://github.com/cucumber/cucumber-js/blob/dc698bf5bc10d591fa7adeec5fa21b2d90dc9679/lib/cucumber/runtime.js#L34
}
interface FeaturesResultPayload extends EventPayload {
duration: number;
scenarioResults: any[];
success: boolean;
stepsResults: any[];
strict: boolean;
}
interface FeaturePayload extends EventPayload {
description: string;
keyword: string;
line: number;
name: string;
tags: Tag[];
uri: string;
scenarios: Scenario[];
}
interface ScenarioPayload extends EventPayload {
feature: Feature;
exception: Error;
keyword: string;
lines: number[];
name: string;
tags: Tag[];
uri: string;
line: number;
description: string;
steps: Step[];
}
interface ScenarioResultPayload extends EventPayload {
duration: any;
failureException: Error;
scenario: Scenario;
status: Status;
stepResults: any[];
}
interface StepPayload extends EventPayload {
arguments: any;
line: number;
name: string;
scenario: Scenario;
uri: string;
isBackground: boolean;
keyword: string;
keywordType: string;
}
interface StepResultPayload extends EventPayload {
ambiguousStepDefinitions: any;
attachments: any[];
duration: any;
failureException: Error;
step: Step;
stepDefinition: StepDefinition;
status: Status;
}
}
export interface StepDefinition {
// tslint:disable-next-line ban-types
code: Function;
line: number;
options: {};
pattern: any;
uri: string;
}
export interface Tag {
name: string;
line: number;
}
export interface Step {
arguments: any;
line: number;
name: string;
scenario: Scenario;
uri: string;
isBackground: boolean;
keyword: string;
keywordType: string;
}
export interface Scenario {
feature: Feature;
exception: Error;
keyword: string;
lines: number[];
name: string;
tags: Tag[];
uri: string;
line: number;
description: string;
steps: Step[];
}
export interface Feature {
description: string;
keyword: string;
line: number;
name: string;
tags: Tag[];
uri: string;
scenarios: Scenario[];
}
export type EventHook = (event: events.Event, callback?: () => void) => void;
export type SupportCodeConsumer = (stepDefinitions: StepDefinitions & Hooks) => void;
export function defineSupportCode(consumer: SupportCodeConsumer): void;
export function getSupportCodeFns(): SupportCodeConsumer[];
export function clearSupportCodeFns(): void;
// https://github.com/cucumber/cucumber-js/commit/231183a8a11c985ef7ced1155b7a75f5120a34b6
export class Formatter {
constructor(options?: any);
log(data: any): void;
}
export class SummaryFormatter extends Formatter {
indent(text: string, numberOfSpaces: number): any;
}
export class PrettyFormatter extends SummaryFormatter {
formatTags(tags: Tag[]): any;
logIndented(text: string, level: number): void;
logStepResult(stepResult: any): void;
}
export class ProgressFormatter extends SummaryFormatter {
}
export class RerunFormatter extends Formatter {
}
export class SnippetsFormatter extends Formatter {
}
export class UsageFormatter extends Formatter {
}
export class UsageJsonFormatter extends Formatter {
}
export class JsonFormatter extends Formatter {
}
+32
View File
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"cucumber": [
"cucumber/v3"
],
"cucumber/*": [
"cucumber/v3/*"
]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cucumber-tests.ts"
]
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "dtslint/dt.json",
"no-any-union": false,
"rules": {
"no-any-union": false,
"no-unnecessary-generics": false
}
}
@@ -0,0 +1,40 @@
let config_1: DataTables.Settings = {
// RowGroup extension options
rowGroup: {
className: 'className',
enable: true,
dataSrc: 'data',
endClassName: 'endClassName',
endRender: (rows, group) => {
return `${ group } (${ rows.count() } rows)`;
},
startRender: (rows, group) => {
return `${ group } (${ rows.count() } rows)`;
}
}
};
let dt: DataTables.Api = $("selector").DataTable({
rowGroup: true
});
// Statics
let fixed_1 = new $.fn.dataTable.RowGroup(dt, {
enable: true,
});
let fixed_2 = new $.fn.dataTable.RowGroup(dt, true);
let version = $.fn.dataTable.RowGroup.version;
$.fn.dataTable.RowGroup.defaults.className = 'row-group-class';
// API
dt.rowGroup().dataSrc();
dt.rowGroup().disable();
dt.rowGroup().enable(true);
// Chaining
dt.rowGroup().dataSrc(12)
.rowGroup().disable()
.rowGroup().enable();
+88
View File
@@ -0,0 +1,88 @@
// Type definitions for datatables.net-rowgroup 1.0
// Project: https://datatables.net/extensions/rowgroup/
// Definitions by: Matthieu Tabuteau <https://github.com/maixiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/**
* RowGroup extension options
*/
rowGroup?: boolean | RowGroupSettings;
}
interface StaticFunctions {
RowGroup: RowGroupStaticFunctions;
}
interface RowGroupStaticFunctions {
new (dt: Api, settings: boolean | RowGroupSettings): undefined;
version: string;
defaults: RowGroupSettings;
}
interface Api {
rowGroup(): RowGroupApi;
}
interface RowGroupApi {
/**
* Get the data source for the row grouping
*/
dataSrc(): number|string;
/**
* Set the data source for the row grouping
*/
dataSrc(prop: number|string): Api;
/**
* Disable RowGroup's interaction with the table
*/
disable(): Api;
/**
* Enable or disable RowGroup's interaction with the table
*/
enable(enable?: boolean): Api;
}
/**
* RowGroup extension options
*/
interface RowGroupSettings {
/**
* Set the class name to be used for the grouping rows
*/
className?: string;
/**
* Set the data point to use as the grouping data source
*/
dataSrc?: number|string;
/**
* Provides the ability to disable row grouping at initialisation
*/
enable?: boolean;
/**
* Set the class name to be used for the grouping end rows
*/
endClassName?: string;
/**
* Provide a function that can be used to control the data shown in the end grouping row
*/
endRender?: (rows: Api, group: string) => string|HTMLElement|JQuery;
/**
* Provide a function that can be used to control the data shown in the start grouping row
*/
startRender?: (rows: Api, group: string) => string|HTMLElement|JQuery;
}
}
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datatables.net-rowgroup-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -3
View File
@@ -1,7 +1,7 @@
function testDocument() {
document.query(".container-a").classList;
document.queryAll(".container-b")[0].className;
document.queryAll(".container-c").childElementCount;
document.querySelector(".container-a").classList;
document.querySelectorAll(".container-b")[0].className;
document.querySelector(".container-c").append("foo", document.createElement("button"));
}
function testElement(el: Element) {
+34 -6
View File
@@ -1,8 +1,11 @@
// Type definitions for dom4 v1.5
// Type definitions for dom4 v2.0
// Project: https://github.com/WebReflection/dom4
// Definitions by: Adi Dahiya <https://github.com/adidahiya>, Gilad Gray <https://github.com/giladgray>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* https://dom.spec.whatwg.org/#parentnode
*/
interface ParentNode {
/**
* Returns the child elements.
@@ -10,21 +13,46 @@ interface ParentNode {
readonly children: HTMLCollection;
/**
* Returns the first element that is a descendant of node that matches relativeSelectors.
* Inserts `nodes` after the last child of this node, while replacing strings with equivalent `Text` nodes.
*/
query(relativeSelectors: string): Element;
append(...nodes: Array<Node | string>): void;
/**
* Returns all element descendants of node that match relativeSelectors.
* Inserts `nodes` before the first child of this node, while replacing strings with equivalent `Text` nodes.
*/
queryAll(relativeSelectors: string): Elements;
prepend(...nodes: Array<Node | string>): void;
}
/**
* https://dom.spec.whatwg.org/#childnode
*/
interface ChildNode {
/**
* Inserts `nodes` just after this node, while replacing strings with equivalent `Text` nodes.
*/
after(...nodes: Array<Node | string>): void;
/**
* Inserts `nodes` just before this node, while replacing strings with equivalent `Text` nodes.
*/
before(...nodes: Array<Node | string>): void;
/**
* Replaces this node with `nodes`, while replacing strings in nodes with equivalent Text nodes.
*/
replaceWith(...nodes: Array<Node | string>): void;
/**
* Removes this node.
*/
remove(): void;
}
interface Element extends ParentNode {
/**
* Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.
*/
closest(selectors: string): Element;
closest(selectors: string): Element | null;
/**
* Returns true if matching selectors against element’s root yields element, and false otherwise.
+51 -48
View File
@@ -2,6 +2,7 @@
// Project: http://echarts.baidu.com/
// Definitions by: Xie Jingyang <https://github.com/xieisabug>, AntiMoron <https://github.com/AntiMoron>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare namespace echarts {
function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: {
@@ -9,13 +10,13 @@ declare namespace echarts {
renderer?: string
}): ECharts;
const graphic: {
const graphic: Graphic;
interface Graphic {
clipPointsByRect(points: number[][], rect: ERectangle): number[][];
clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle;
LinearGradient: { new (x: number, y: number, x2: number, y2: number, colorStops: Array<Object>, globalCoord?: boolean): LinearGradient }
};
LinearGradient: { new(x: number, y: number, x2: number, y2: number, colorStops: Array<Object>, globalCoord?: boolean): LinearGradient }
}
function connect(group: string | Array<string>): void;
@@ -29,6 +30,15 @@ declare namespace echarts {
function registerTheme(themeName: string, theme: Object): void;
interface MapObj {
/** geoJson data for map */
geoJson: object,
/** special areas fro map */
specialAreas: object
}
function getMap(mapName: string): MapObj;
interface LinearGradient {
colorStops: Array<Object>;
global: boolean;
@@ -39,9 +49,8 @@ declare namespace echarts {
y2: number
}
interface ECharts {
group: string;
group: string
setOption(option: EChartOption, notMerge?: boolean, notRefreshImmediately?: boolean): void
@@ -66,20 +75,20 @@ declare namespace echarts {
hideLoading(): void
getDataURL(opts: {
// 导出的格式,可选 png, jpeg
/** 导出的格式,可选 png, jpeg */
type?: string,
// 导出的图片分辨率比例,默认为 1。
/** 导出的图片分辨率比例,默认为 1。*/
pixelRatio?: number,
// 导出的图片背景色,默认使用 option 里的 backgroundColor
/** 导出的图片背景色,默认使用 option 里的 backgroundColor */
backgroundColor?: string
}): string
getConnectedDataURL(opts: {
// 导出的格式,可选 png, jpeg
/** 导出的格式,可选 png, jpeg */
type: string,
// 导出的图片分辨率比例,默认为 1。
/** 导出的图片分辨率比例,默认为 1。 */
pixelRatio: number,
// 导出的图片背景色,默认使用 option 里的 backgroundColor
/** 导出的图片背景色,默认使用 option 里的 backgroundColor */
backgroundColor: string
}): string
@@ -89,42 +98,32 @@ declare namespace echarts {
dispose(): void
// 转换逻辑点到像素
convertToPixel(finder: {
seriesIndex?: number,
seriesId?: string,
seriesName?: string,
geoIndex?: number,
geoId?: string,
geoName?: string,
xAxisIndex?: number,
xAxisId?: string,
xAxisName?: string,
yAxisIndex?: number,
yAxisId?: string,
yAxisName?: string,
gridIndex?: number,
gridId?: string
gridName?: string
} | string, value: string | Array<any>): string | Array<any>
/** 转换逻辑点到像素 */
convertToPixel(finder: ConvertFinder | string, value: string | Array<any>): string | Array<any>
convertFromPixel(finder: {
seriesIndex?: number,
seriesId?: string,
seriesName?: string,
geoIndex?: number,
geoId?: string,
geoName?: string,
xAxisIndex?: number,
xAxisId?: string,
xAxisName?: string,
yAxisIndex?: number,
yAxisId?: string,
yAxisName?: string,
gridIndex?: number,
gridId?: string
gridName?: string
} | string, value: Array<any> | string): Array<any> | string
convertFromPixel(finder: ConvertFinder | string, value: Array<any> | string): Array<any> | string
containPixel(finder: ConvertFinder | string,
/** 要被判断的点,为像素坐标值,以 echarts 实例的 dom 节点的左上角为坐标 [0, 0] 点。*/
value: any[]): boolean
}
interface ConvertFinder {
seriesIndex?: number,
seriesId?: string,
seriesName?: string,
geoIndex?: number,
geoId?: string,
geoName?: string,
xAxisIndex?: number,
xAxisId?: string,
xAxisName?: string,
yAxisIndex?: number,
yAxisId?: string,
yAxisName?: string,
gridIndex?: number,
gridId?: string
gridName?: string
}
interface ERectangle {
@@ -194,3 +193,7 @@ declare namespace echarts {
declare module 'echarts' {
export = echarts;
}
declare module 'echarts/lib/echarts' {
export = echarts;
}
@@ -1,8 +1,16 @@
import * as packager from "electron-packager";
function callback(err: Error, appPath: string) {
function callback(err: Error, appPaths: string[]) {
const msg = err.message;
const index = appPath.indexOf("test");
const index = appPaths.indexOf("test");
}
function completeFunction(buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) {
callbackFn();
}
function ignoreFunction(path: string) {
return true;
}
packager({
@@ -10,20 +18,38 @@ packager({
name: "myapplication",
platform: "win32",
arch: "all",
electronVersion: "0.34.0"
electronVersion: "0.34.0",
win32metadata: {
CompanyName: "Acme CO",
FileDescription: "My application",
OriginalFilename: "myapp.exe",
ProductName: "Application",
InternalName: "roadrunner",
"requested-execution-level": "highestAvailable",
"application-manifest": "manifest.xml"
}
}, callback);
packager({
dir: ".",
name: "myapplication",
electronVersion: "0.34.0",
all: true
all: true,
win32metadata: {
CompanyName: "Acme CO",
FileDescription: "My application",
OriginalFilename: "myapp.exe",
ProductName: "Application",
InternalName: "roadrunner",
"requested-execution-level": "requireAdministrator",
"application-manifest": "manifest.xml"
}
}, callback);
packager({
dir: ".",
name: "myapplication",
platform: "win32",
platform: "all",
arch: "all",
electronVersion: "0.34.0"
}, callback);
@@ -34,3 +60,136 @@ packager({
electronVersion: "0.34.0",
all: true
}, callback);
packager({
dir: ".",
name: "myapplication",
electronVersion: "0.34.0",
arch: "arm64",
executableName: "myapp"
}, callback);
packager({
dir: ".",
afterCopy: [
completeFunction
],
afterExtract: [
completeFunction
],
afterPrune: [
completeFunction
],
appCopyright: "Copyright",
appVersion: "1.0",
arch: "ia32",
asar: false,
buildVersion: "1.2.3",
derefSymlinks: true,
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: true,
strictSSL: true
},
extraResource: "foo.js",
icon: "foo.ico",
ignore: /ab+c/,
out: "out",
overwrite: true,
packageManager: false,
prune: true,
quiet: true,
tmpdir: "/tmp",
win32metadata: {
CompanyName: "Acme CO",
FileDescription: "My application",
OriginalFilename: "myapp.exe",
ProductName: "Application",
InternalName: "roadrunner",
"requested-execution-level": "asInvoker",
"application-manifest": "manifest.xml"
}
}, callback);
packager({
dir: ".",
arch: "x64",
asar: true,
derefSymlinks: false,
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: false,
strictSSL: true
},
extraResource: [
"foo.js",
"bar.js"
],
ignore: [
/ab+c/,
new RegExp('abc')
],
overwrite: false,
packageManager: "npm",
platform: "darwin",
prune: false,
quiet: false,
tmpdir: "false",
appBundleId: "123456",
appCategoryType: "public.app-category.developer-tools",
extendInfo: "plist.txt",
helperBundleId: "23223f",
osxSign: true
}, callback);
packager({
dir: ".",
arch: "armv7l",
asar: {
ordering: "order.txt",
unpack: "*.js",
unpackDir: "sub_dir"
},
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: false,
strictSSL: false
},
ignore: ignoreFunction,
packageManager: "cnpm",
platform: "linux"
}, callback);
packager({
dir: ".",
arch: [
"ia32",
"x64"
],
download: {
cache: "./zips",
mirror: "https://10.1.2.105/",
quiet: true,
strictSSL: false
},
packageManager: "yarn",
platform: "mas",
extendInfo: {
foo: "bar"
},
osxSign: {
identity: "myidentity",
entitlements: "path/to/my.entitlements",
"entitlements-inherit": "path/to/inherit.entitlements"
},
protocols: [{
name: "myappproto",
schemes: [
"myapp",
"myapp2"
]
}]
}, callback);
+9 -4
View File
@@ -1,7 +1,8 @@
// Type definitions for electron-packager 8.7
// Type definitions for electron-packager 10.1
// Project: https://github.com/electron-userland/electron-packager
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
// Juan Jimenez-Anca <https://github.com/cortopy>
// John Kleinschmidt <https://github.com/jkleinsc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -31,8 +32,8 @@ declare namespace electronPackager {
type ignoreFunction = (path: string) => boolean;
type onCompleteFn = (buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) => void;
type arch = "ia32" | "x64" | "armv7l" | "all";
type packageManager = "npm" | "cnpm" | "yarn";
type arch = "ia32" | "x64" | "armv7l" | "arm64" |"all";
type packageManager = "npm" | "cnpm" | "yarn" | false;
type platform = "linux" | "win32" | "darwin" | "mas" | "all";
interface AsarOptions {
@@ -94,7 +95,7 @@ declare namespace electronPackager {
* Arbitrary combinations of individual architectures are also supported via a comma-delimited string or array of strings.
* The non-all values correspond to the architecture names used by Electron releases. This value is not restricted to the official set if download.mirror is set.
*/
arch?: arch;
arch?: arch | arch[];
/**
* Whether to package the application's source code into an archive, using Electron's archive format
*/
@@ -120,6 +121,10 @@ declare namespace electronPackager {
* One or more files to be copied directly into the app's Contents/Resources directory for OS X target platforms, and the resources directory for other target platforms.
*/
extraResource?: string | string[];
/**
* The name of the executable file, sans file extension. Defaults to the value for the name parameter
*/
executableName?: string;
/**
* The local path to the icon file, if the target platform supports setting embedding an icon.
*/
+52 -81
View File
@@ -1111,7 +1111,7 @@ declare module 'ember' {
* item. This method corresponds to the `forEach()` method defined in
* JavaScript 1.6.
*/
forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
forEach: GlobalArray<T>['forEach'];
/**
* Alias for `mapBy`
*/
@@ -1127,7 +1127,7 @@ declare module 'ember' {
* Maps all of the items in the enumeration to another value, returning
* a new array. This method corresponds to `map()` defined in JavaScript 1.6.
*/
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
map: GlobalArray<T>['map'];
/**
* Similar to map, this specialized function returns the value of the named
* property on all items in the enumeration.
@@ -1138,11 +1138,7 @@ declare module 'ember' {
* function returns true for. This method corresponds to `filter()` defined in
* JavaScript 1.6.
*/
filter<S extends T>(
callbackfn: (value: T, index: number, array: T[]) => value is S,
thisArg?: any
): S[];
filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): NativeArray<T>;
filter: GlobalArray<T>['filter'];
/**
* Returns an array with all of the items in the enumeration where the passed
* function returns false. This method is the inverse of filter().
@@ -1165,10 +1161,7 @@ declare module 'ember' {
* This method works similar to the `filter()` method defined in JavaScript 1.6
* except that it will stop working on the array once a match is found.
*/
find(
predicate: (value: T, index: number, obj: T[]) => boolean,
thisArg?: any
): T | undefined;
find: GlobalArray<T>['find'];
/**
* Returns the first item with a property matching the passed value. You
* can pass an optional second argument with the target value. Otherwise
@@ -1179,10 +1172,7 @@ declare module 'ember' {
* Returns `true` if the passed function returns true for every item in the
* enumeration. This corresponds with the `every()` method in JavaScript 1.6.
*/
every(
callbackfn: (value: T, index: number, array: T[]) => boolean,
thisArg?: any
): boolean;
every: GlobalArray<T>['every'];
/**
* Returns `true` if the passed property resolves to the value of the second
* argument for all items in the enumerable. This method is often simpler/faster
@@ -1205,8 +1195,7 @@ declare module 'ember' {
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
reduce: GlobalArray<T>['reduce'];
/**
* Invokes the named method on every object in the receiver that
* implements it. This method corresponds to the implementation in
@@ -1616,32 +1605,6 @@ declare module 'ember' {
* __Required.__ You must implement this method to apply this mixin.
*/
length: number;
// NOTE: some array polyfill methods are re-declared here because their signatures
// differ between typescript versions 2.4 and 2.6. Since we need to compile against
// both, pick the more recent signature and re-declare it here as a tie-breaker.
/**
* 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
* except that it will stop working on the array once a match is found.
*/
find(
predicate: (value: T, index: number, obj: T[]) => boolean,
thisArg?: any
): T | undefined;
/**
* This will combine the values of the enumerator into a single value. It
* is a useful way to collect a summary value from an enumeration. This
* corresponds to the `reduce()` method defined in JavaScript 1.8.
*/
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
filter<S extends T>(
callbackfn: (value: T, index: number, array: T[]) => value is S,
thisArg?: any
): S[];
filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): Enumerable<T>;
}
const NativeArray: Mixin<NativeArray<any>>;
/**
@@ -3321,7 +3284,7 @@ declare module 'ember' {
declare module '@ember/application' {
import Ember from 'ember';
export default Ember.Application;
export default class Application extends Ember.Application { }
export const getOwner: typeof Ember.getOwner;
export const onLoad: typeof Ember.onLoad;
export const runLoadHooks: typeof Ember.runLoadHooks;
@@ -3336,22 +3299,23 @@ declare module '@ember/application/deprecations' {
declare module '@ember/application/globals-resolver' {
import Ember from 'ember';
export default Ember.DefaultResolver;
export default class GlobalsResolver extends Ember.DefaultResolver { }
}
declare module '@ember/application/instance' {
import Ember from 'ember';
export default Ember.ApplicationInstance;
export default class ApplicationInstance extends Ember.ApplicationInstance { }
}
declare module '@ember/application/resolver' {
import Ember from 'ember';
export default Ember.Resolver;
export default class Resolver extends Ember.Resolver { }
}
declare module '@ember/array' {
import Ember from 'ember';
export default Ember.Array;
const EmberArray: typeof Ember.Array;
export default EmberArray;
export const A: typeof Ember.A;
export const isArray: typeof Ember.isArray;
export const makeArray: typeof Ember.makeArray;
@@ -3359,43 +3323,44 @@ declare module '@ember/array' {
declare module '@ember/array/mutable' {
import Ember from 'ember';
export default Ember.MutableArray;
const MutableArray: typeof Ember.MutableArray;
export default MutableArray;
}
declare module '@ember/array/proxy' {
import Ember from 'ember';
export default Ember.ArrayProxy;
export default class ArrayProxy<T> extends Ember.ArrayProxy<T> { }
}
declare module '@ember/component' {
import Ember from 'ember';
export default Ember.Component;
export default class Component extends Ember.Component { }
}
declare module '@ember/component/checkbox' {
import Ember from 'ember';
export default Ember.Checkbox;
export default class Checkbox extends Ember.Checkbox { }
}
declare module '@ember/component/helper' {
import Ember from 'ember';
export default Ember.Helper;
export default class Helper extends Ember.Helper { }
export const helper: typeof Ember.Helper.helper;
}
declare module '@ember/component/text-area' {
import Ember from 'ember';
export default Ember.TextArea;
export default class TextArea extends Ember.TextArea { }
}
declare module '@ember/component/text-field' {
import Ember from 'ember';
export default Ember.TextField;
export default class TextField extends Ember.TextField { }
}
declare module '@ember/controller' {
import Ember from 'ember';
export default Ember.Controller;
export default class Controller extends Ember.Controller { }
export const inject: typeof Ember.inject.controller;
}
@@ -3412,28 +3377,29 @@ declare module '@ember/debug' {
declare module '@ember/debug/container-debug-adapter' {
import Ember from 'ember';
export default Ember.ContainerDebugAdapter;
export default class ContainerDebugAdapter extends Ember.ContainerDebugAdapter { }
}
declare module '@ember/debug/data-adapter' {
import Ember from 'ember';
export default Ember.DataAdapter;
export default class DataAdapter extends Ember.DataAdapter { }
}
declare module '@ember/engine' {
import Ember from 'ember';
export default Ember.Engine;
export default class Engine extends Ember.Engine { }
export const getEngineParent: typeof Ember.getEngineParent;
}
declare module '@ember/engine/instance' {
import Ember from 'ember';
export default Ember.EngineInstance;
export default class EngineInstance extends Ember.EngineInstance { }
}
declare module '@ember/enumerable' {
import Ember from 'ember';
export default Ember.Enumerable;
const Enumerable: typeof Ember.Enumerable;
export default Enumerable;
}
declare module '@ember/instrumentation' {
@@ -3446,17 +3412,17 @@ declare module '@ember/instrumentation' {
declare module '@ember/map' {
import Ember from 'ember';
export default Ember.Map;
export default class EmberMap extends Ember.Map { }
}
declare module '@ember/map/with-default' {
import Ember from 'ember';
export default Ember.MapWithDefault;
export default class MapWithDefault extends Ember.MapWithDefault { }
}
declare module '@ember/object' {
import Ember from 'ember';
export default Ember.Object;
export default class EmberObject extends Ember.Object { }
export const aliasMethod: typeof Ember.aliasMethod;
export const computed: typeof Ember.computed;
export const defineProperty: typeof Ember.defineProperty;
@@ -3471,7 +3437,7 @@ declare module '@ember/object' {
declare module '@ember/object/computed' {
import Ember from 'ember';
export default Ember.ComputedProperty;
export default class ComputedProperty<T> extends Ember.ComputedProperty<T> { }
export const alias: typeof Ember.computed.alias;
export const and: typeof Ember.computed.and;
export const bool: typeof Ember.computed.bool;
@@ -3509,12 +3475,13 @@ declare module '@ember/object/computed' {
declare module '@ember/object/core' {
import Ember from 'ember';
export default Ember.CoreObject;
export default class CoreObject extends Ember.CoreObject { }
}
declare module '@ember/object/evented' {
import Ember from 'ember';
export default Ember.Evented;
const Evented: typeof Ember.Evented;
export default Evented;
export const on: typeof Ember.on;
}
@@ -3534,12 +3501,14 @@ declare module '@ember/object/internals' {
declare module '@ember/object/mixin' {
import Ember from 'ember';
export default Ember.Mixin;
const Mixin: typeof Ember.Mixin;
export default Mixin;
}
declare module '@ember/object/observable' {
import Ember from 'ember';
export default Ember.Observable;
const Observable: typeof Ember.Observable;
export default Observable;
}
declare module '@ember/object/observers' {
@@ -3550,12 +3519,13 @@ declare module '@ember/object/observers' {
declare module '@ember/object/promise-proxy-mixin' {
import Ember from 'ember';
export default Ember.PromiseProxyMixin;
const PromiseProxyMixin: typeof Ember.PromiseProxyMixin;
export default PromiseProxyMixin;
}
declare module '@ember/object/proxy' {
import Ember from 'ember';
export default Ember.ObjectProxy;
export default class ObjectProxy extends Ember.ObjectProxy { }
}
declare module '@ember/polyfills' {
@@ -3569,42 +3539,43 @@ declare module '@ember/polyfills' {
declare module '@ember/routing/auto-location' {
import Ember from 'ember';
export default Ember.AutoLocation;
export default class AutoLocation extends Ember.AutoLocation { }
}
declare module '@ember/routing/hash-location' {
import Ember from 'ember';
export default Ember.HashLocation;
export default class HashLocation extends Ember.HashLocation { }
}
declare module '@ember/routing/history-location' {
import Ember from 'ember';
export default Ember.HistoryLocation;
export default class HistoryLocation extends Ember.HistoryLocation { }
}
declare module '@ember/routing/link-component' {
import Ember from 'ember';
export default Ember.LinkComponent;
export default class LinkComponent extends Ember.LinkComponent { }
}
declare module '@ember/routing/location' {
import Ember from 'ember';
export default Ember.Location;
const Location: typeof Ember.Location;
export default Location;
}
declare module '@ember/routing/none-location' {
import Ember from 'ember';
export default Ember.NoneLocation;
export default class NoneLocation extends Ember.NoneLocation { }
}
declare module '@ember/routing/route' {
import Ember from 'ember';
export default Ember.Route;
export default class Route extends Ember.Route { }
}
declare module '@ember/routing/router' {
import Ember from 'ember';
export default Ember.Router;
export default class EmberRouter extends Ember.Router { }
}
declare module '@ember/runloop' {
@@ -3626,7 +3597,7 @@ declare module '@ember/runloop' {
declare module '@ember/service' {
import Ember from 'ember';
export default Ember.Service;
export default class Service extends Ember.Service { }
export const inject: typeof Ember.inject.service;
}
@@ -3656,7 +3627,7 @@ declare module '@ember/test' {
declare module '@ember/test/adapter' {
import Ember from 'ember';
export default Ember.Test.Adapter;
export default class TestAdapter extends Ember.Test.Adapter { }
}
declare module '@ember/utils' {
+2 -1
View File
@@ -3,6 +3,7 @@
// Definitions by: Konstantin Kai <https://github.com/KonstantinKai>
// Martynas Kadiša <https://github.com/martynaskadisa>
// Jan Aagaard <https://github.com/janaagaard75>
// Sergio Sánchez <https://github.com/ssanchezmarc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -1631,7 +1632,7 @@ declare namespace Notifications {
type LocalNotificationId = string | number;
function addListener(listener: (notification: Notification) => any): EventSubscription;
function getExponentPushTokenAsync(): Promise<string>;
function getExpoPushTokenAsync(): Promise<string>;
function presentLocalNotificationAsync(localNotification: LocalNotification): Promise<LocalNotificationId>;
function scheduleLocalNotificationAsync(
localNotification: LocalNotification,
@@ -0,0 +1,12 @@
import * as Koa from 'koa';
import * as connect from 'connect';
import expressToKoa = require('express-to-koa');
const app = new Koa();
const middleware: connect.NextHandleFunction = (req, res, next) => {
// 'express middleware'
next();
};
app.use(expressToKoa(middleware));
app.listen(3000);
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for express-to-koa 1.0
// Project: https://github.com/kaelzhang/express-to-koa
// Definitions by: Xiaohan Zhang <https://github.com/xiaohanzhang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as Koa from "koa";
import { IncomingMessage, ServerResponse } from "http";
export = expressToKoa;
declare function expressToKoa(
middleware: (
req: IncomingMessage,
res: ServerResponse,
next: (err?: any) => void,
) => void
): Koa.Middleware;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-to-koa-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+7 -7
View File
@@ -331,10 +331,10 @@ function sample6() {
canvas.centerObject(obj);
canvas.add(obj);
canvas.add(obj.clone(() => { }).set({ left: 100, top: 100, angle: -15 }));
canvas.add(obj.clone(() => { }).set({ left: 480, top: 100, angle: 15 }));
canvas.add(obj.clone(() => { }).set({ left: 100, top: 400, angle: -15 }));
canvas.add(obj.clone(() => { }).set({ left: 480, top: 400, angle: 15 }));
obj.clone(clone => canvas.add(clone.set({ left: 100, top: 100, angle: -15 })));
obj.clone(clone => canvas.add(clone.set({ left: 480, top: 100, angle: 15 })));
obj.clone(clone => canvas.add(clone.set({ left: 100, top: 400, angle: -15 })));
obj.clone(clone => canvas.add(clone.set({ left: 480, top: 400, angle: 15 })));
canvas.on('mouse:move', options => {
const p = canvas.getPointer(options.e);
@@ -481,7 +481,7 @@ function sample8() {
top,
angle,
padding: 10,
cornersize: 10
cornerSize: 10
});
image.scale(getRandomNum(0.1, 0.25)).setCoords();
canvas.add(image);
@@ -495,7 +495,7 @@ function sample8() {
top,
angle,
padding: 10,
cornersize: 10
cornerSize: 10
});
image.scale(getRandomNum(0.1, 1)).setCoords();
canvas.add(image);
@@ -515,7 +515,7 @@ function sample8() {
top,
angle,
padding: 10,
cornersize: 10
cornerSize: 10
});
loadedObject/*.scaleToWidth(300)*/.setCoords();
+114 -97
View File
@@ -1,7 +1,11 @@
// Type definitions for FabricJS 1.5
// Project: http://fabricjs.com/
// Definitions by: Oliver Klemencic <https://github.com/oklemencic>, Joseph Livecchi <https://github.com/joewashear007>, Michael Randolph <https://github.com/mrand01>
// Definitions by: Oliver Klemencic <https://github.com/oklemencic>
// Joseph Livecchi <https://github.com/joewashear007>
// Michael Randolph <https://github.com/mrand01>
// Tiger Oakes <https://github.com/NotWoods>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export as namespace fabric;
@@ -61,7 +65,7 @@ export function parseStyleAttribute(element: SVGElement): any;
* @param [options] Options object
* @param [reviver] Method for further parsing of SVG elements, called after each fabric object created.
*/
export function parseElements(elements: any[], callback: Function, options?: any, reviver?: Function): void;
export function parseElements(elements: SVGElement[], callback: Function, options?: any, reviver?: Function): void;
/**
* Returns an object of attributes' name/value, given element and an array of attribute names;
* Parses parent "g" nodes recursively upwards.
@@ -232,7 +236,7 @@ interface ICollection<T> {
* @param context Context (aka thisObject)
* @return thisArg
*/
forEachObject(callback: (element: Object, index: number, array: Object[]) => any, context?: any): T;
forEachObject(callback: (element: Object, index: number, array: Object[]) => void, context?: any): T;
/**
* Returns an array of children objects of this instance
@@ -279,13 +283,13 @@ interface IObservable<T> {
* @param eventName Event name (eg. 'after:render')
* @param handler Function that receives a notification when an event of the specified type occurs
*/
on(eventName: string, handler: (e: IEvent) => any): T;
on(eventName: string, handler: (e: IEvent) => void): T;
/**
* Observes specified event
* @param eventName Object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler})
*/
on(eventName: {[key: string]: Function}): T;
on(events: {[eventName: string]: (e: IEvent) => void}): T;
/**
* Fires event with an optional options object
* @param eventName Event name to fire
@@ -298,7 +302,7 @@ interface IObservable<T> {
* @param eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler})
* @param handler Function to be deleted from EventListeners
*/
off(eventName?: string|any, handler?: (e: IEvent) => any): T;
off(eventName?: string|any, handler?: (e: IEvent) => void): T;
}
interface Callbacks {
@@ -799,14 +803,14 @@ interface IShadowOptions {
*/
offsetY: number;
}
export interface IShadow extends IShadowOptions {}
export class IShadow {
export interface Shadow extends IShadowOptions {}
export class Shadow {
constructor(options?: IShadowOptions);
initialize(options?: IShadowOptions|string): IShadow;
initialize(options?: IShadowOptions|string): Shadow;
/**
* Returns object representation of a shadow
*/
toObject(): Object;
toObject(): any;
/**
* Returns a string representation of an instance, CSS3 text-shadow declaration
*/
@@ -953,7 +957,7 @@ export class StaticCanvas {
* @param callback Callback to invoke when image is loaded and set as background
* @param [options] Optional options to set for the {@link fabric.Image|background image}.
*/
setBackgroundImage(image: Image|string, callback: Function, options?: IObjectOptions): StaticCanvas;
setBackgroundImage(image: Image|string, callback?: Function, options?: IObjectOptions): StaticCanvas;
/**
* Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas
@@ -1112,19 +1116,19 @@ export class StaticCanvas {
* Returs dataless JSON representation of canvas
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toDatalessJSON(propertiesToInclude?: any[]): string;
toDatalessJSON(propertiesToInclude?: string[]): string;
/**
* Returns object representation of canvas
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns dataless object representation of canvas
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toDatalessObject(propertiesToInclude?: any[]): any;
toDatalessObject(propertiesToInclude?: string[]): any;
/**
* When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true,
@@ -1198,7 +1202,7 @@ export class StaticCanvas {
* @param methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash"
* @return `true` if method is supported (or at least exists), null` if canvas element or context can not be initialized
*/
supports(methodName: string): boolean;
supports(methodName: "getImageData" | "toDataURL" | "toDataURLWithQuality" | "setLineDash"): boolean;
/**
* Populates canvas with data from the specified JSON.
@@ -1215,7 +1219,7 @@ export class StaticCanvas {
* @param [callback] Receives cloned instance as a first argument
* @param [properties] Array of properties to include in the cloned canvas and children
*/
clone(callback: (canvas: StaticCanvas) => any, properties?: any[]): void;
clone(callback: (canvas: StaticCanvas) => void, properties?: any[]): void;
/**
* Clones canvas instance without cloning existing data.
@@ -1223,7 +1227,7 @@ export class StaticCanvas {
* but leaves data empty (so that you can populate it with your own)
* @param [callback] Receives cloned instance as a first argument
*/
cloneWithoutData(callback: (canvas: StaticCanvas) => any): void;
cloneWithoutData(callback: (canvas: StaticCanvas) => void): void;
/**
* Callback; invoked right before object is about to be scaled/rotated
@@ -1251,12 +1255,12 @@ export class StaticCanvas {
* (either those of HTMLCanvasElement itself, or rendering context)
* @param methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash"
*/
static supports(methodName: string): boolean;
static supports(methodName: "getImageData" | "toDataURL" | "toDataURLWithQuality" | "setLineDash"): boolean;
/**
* Returns JSON representation of canvas
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
static toJSON(propertiesToInclude?: any[]): string;
static toJSON(propertiesToInclude?: string[]): string;
}
interface ICanvasOptions extends IStaticCanvasOptions {
@@ -1473,12 +1477,12 @@ export class Canvas {
* (either those of HTMLCanvasElement itself, or rendering context)
* @param methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash"
*/
static supports(methodName: string): boolean;
static supports(methodName: "getImageData" | "toDataURL" | "toDataURLWithQuality" | "setLineDash"): boolean;
/**
* Returns JSON representation of canvas
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
static toJSON(propertiesToInclude?: any[]): string;
static toJSON(propertiesToInclude?: string[]): string;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1527,7 +1531,7 @@ export class Circle {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns svg representation of an instance
* @param [reviver] Method for further parsing of svg representation.
@@ -1580,7 +1584,7 @@ export class Ellipse {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns svg representation of an instance
* @param [reviver] Method for further parsing of svg representation.
@@ -1681,7 +1685,7 @@ export class Group {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns string represenation of a group
*/
@@ -1751,7 +1755,7 @@ export class Image {
* @param callback Callback is invoked with a clone as a first argument
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
clone(callback?: Function, propertiesToInclude?: any[]): Object;
clone(callback?: Function, propertiesToInclude?: string[]): void;
/**
* Returns complexity of an instance
* @return complexity of this instance
@@ -1791,7 +1795,7 @@ export class Image {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return Object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns string representation of an instance
* @return String representation of an instance
@@ -1817,20 +1821,20 @@ export class Image {
* @param [callback] Callback to invoke when image is created (newly created image is passed as a first argument)
* @param [imgOptions] Options object
*/
static fromURL(url: string, callback?: (image: Image) => any, objObjects?: IObjectOptions): Image;
static fromURL(url: string, callback?: (image: Image) => void, objObjects?: IObjectOptions): Image;
/**
* Creates an instance of fabric.Image from its object representation
* @param object Object to create an instance from
* @param [callback] Callback to invoke when an image instance is created
*/
static fromObject(object: any, callback: (image: Image) => {}): void;
static fromObject(object: any, callback: (image: Image) => void): void;
/**
* Returns Image instance from an SVG element
* @param element Element to parse
* @param callback Callback to execute when fabric.Image object is created
* @param [options] Options object
*/
static fromElement(element: SVGElement, callback: Function, options?: IImageOptions): void;
static fromElement(element: SVGElement, callback: (image: Image) => void, options?: IImageOptions): void;
/**
* Default CSS class name for canvas
*/
@@ -1877,7 +1881,7 @@ export class Line {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude: any[]): any;
toObject(propertiesToInclude: string[]): any;
/**
* Returns SVG representation of an instance
* @param [reviver] Method for further parsing of svg representation.
@@ -1997,6 +2001,11 @@ interface IObjectOptions {
*/
cornerColor?: string;
/**
* Specify style of control, 'rect' or 'circle'
*/
cornerStrokeColor?: "rect" | "circle";
/**
* When true, this object will use center point as the origin of transformation
* when being scaled via the controls.
@@ -2066,7 +2075,7 @@ interface IObjectOptions {
/**
* Shadow object representing shadow of this shape
*/
shadow?: IShadow|string;
shadow?: Shadow|string;
/**
* Opacity of object's controlling borders when object is active and moving
@@ -2245,7 +2254,7 @@ export class Object {
/* * Sets object's properties from options
* @param {Object} [options] Options object
*/
setOptions(options: any): void;
setOptions(options: IObjectOptions): void;
/**
* Transforms context when rendering an object
@@ -2258,13 +2267,13 @@ export class Object {
* Returns an object representation of an instance
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns (dataless) object representation of an instance
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toDatalessObject(propertiesToInclude?: any[]): any;
toDatalessObject(propertiesToInclude?: string[]): any;
/**
* Returns a string representation of an instance
@@ -2275,7 +2284,7 @@ export class Object {
* Basic getter
* @param property Property name
*/
get(property: string): any;
get<K extends keyof this>(property: K): this[K];
/**
* Sets property to a given value.
@@ -2284,26 +2293,26 @@ export class Object {
* @param key Property name
* @param value Property value (if function, the value is passed into it and its return value is used as a new one)
*/
set(key: string, value: any|Function): Object;
set<K extends keyof this>(key: K, value: this[K] | ((value: this[K]) => this[K])): this;
/**
* Sets property to a given value.
* When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls.
* If you need to update those, call `setCoords()`.
* @param Object key Property object, iterate over the object properties
* @param options Property object, iterate over the object properties
*/
set(key: any): Object;
set(options: Partial<this>): this;
/**
* Toggles specified property from `true` to `false` or from `false` to `true`
* @param property Property to toggle
*/
toggle(property: string): Object;
toggle(property: keyof this): this;
/**
* Sets sourcePath of an object
* @param value Value to set sourcePath to
*/
setSourcePath(value: string): Object;
setSourcePath(value: string): this;
/**
* Retrieves viewportTransform from Object's canvas if possible
@@ -2318,17 +2327,17 @@ export class Object {
render(ctx: CanvasRenderingContext2D, noTransform?: boolean): void;
/**
* Clones an instance
* Clones an instance, using a callback method will work for every object.
* @param callback Callback is invoked with a clone as a first argument
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
clone(callback: Function, propertiesToInclude?: any[]): Object;
clone(callback: (clone: Object) => void, propertiesToInclude?: string[]): void;
/**
* Creates an instance of fabric.Image out of an object
* @param callback callback, invoked with an instance as a first argument
*/
cloneAsImage(callback: (image: Image) => any): Object;
cloneAsImage(callback: (image: Image) => void): this;
/**
* Converts an object into a data-url-like string
@@ -2351,67 +2360,62 @@ export class Object {
* Returns a JSON representation of an instance
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toJSON(propertiesToInclude?: any[]): any;
toJSON(propertiesToInclude?: string[]): any;
/**
* Sets gradient (fill or stroke) of an object
* <b>Backwards incompatibility note:</b> This method was named "setGradientFill" until v1.1.0
* **Backwards incompatibility note:** This method was named "setGradientFill" until v1.1.0
* @param property Property name 'stroke' or 'fill'
* @param [options] Options object
*/
setGradient(property: string, options: IGradientOptions): Object;
setGradient(property: "stroke" | "fill", options: IGradientOptions): this;
/**
* Sets pattern fill of an object
* @param options Options object
*/
setPatternFill(options: IFillOptions): Object;
setPatternFill(options: IFillOptions): this;
/**
* Sets shadow of an object
* @param [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)")
*/
setShadow(options?: string): Object;
/**
* Sets shadow of an object
* @param [options] Options object
*/
setShadow(options: IShadow): Object;
setShadow(options?: string | Shadow): this;
/**
* Sets "color" of an instance (alias of `set('fill', …)`)
* @param color Color value
*/
setColor(color: string): Object;
setColor(color: string): this;
/**
* Sets "angle" of an instance
* @param angle Angle value
*/
setAngle(angle: number): Object;
setAngle(angle: number): this;
/**
* Sets "angle" of an instance
* @param angle Angle value
*/
rotate(angle: number): Object;
rotate(angle: number): this;
/**
* Centers object horizontally on canvas to which it was added last.
* You might need to call `setCoords` on an object after centering, to update controls area.
*/
centerH(): void;
centerH(): this;
/**
* Centers object vertically on canvas to which it was added last.
* You might need to call `setCoords` on an object after centering, to update controls area.
*/
centerV(): void;
centerV(): this;
/**
* Centers object vertically and horizontally on canvas to which is was added last
* You might need to call `setCoords` on an object after centering, to update controls area.
*/
center(): void;
center(): this;
/**
* Removes object from canvas to which it was added last
@@ -2423,7 +2427,7 @@ export class Object {
* @param e Event to operate upon
* @param [pointer] Pointer to operate upon (instead of event)
*/
getLocalPointer(e: Event, pointer: any): any;
getLocalPointer(e: Event, pointer?: { x: number, y: number }): { x: number, y: number };
/**
* Sets object's properties from options
@@ -2461,21 +2465,21 @@ export class Object {
* @param [options] Object with additional `stateProperties` array to include when saving state
* @return thisArg
*/
saveState(options?: { stateProperties: any[] }): Object;
saveState(options?: { stateProperties: any[] }): this;
/**
* Setups state of an object
*/
setupState(): Object;
setupState(): this;
// functions from object straightening mixin
// -----------------------------------------------------------------------------------------------------------------------------------
/**
* Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer)
*/
straighten(): Object;
straighten(): this;
/**
* Same as straighten but with animation
*/
fxStraighten(callbacks: Callbacks): Object;
fxStraighten(callbacks: Callbacks): this;
// functions from object stacking mixin
// -----------------------------------------------------------------------------------------------------------------------------------
@@ -2483,25 +2487,25 @@ export class Object {
* Moves an object up in stack of drawn objects
* @param [intersecting] If `true`, send object in front of next upper intersecting object
*/
bringForward(intersecting?: boolean): Object;
bringForward(intersecting?: boolean): this;
/**
* Moves an object to the top of the stack of drawn objects
*/
bringToFront(): Object;
bringToFront(): this;
/**
* Moves an object down in stack of drawn objects
* @param [intersecting] If `true`, send object behind next lower intersecting object
*/
sendBackwards(intersecting?: boolean): Object;
sendBackwards(intersecting?: boolean): this;
/**
* Moves an object to the bottom of the stack of drawn objects
*/
sendToBack(): Object;
sendToBack(): this;
/**
* Moves an object to specified level in stack of drawn objects
* @param index New position of object
*/
moveTo(index: number): Object;
moveTo(index: number): this;
// functions from object origin mixin
// -----------------------------------------------------------------------------------------------------------------------------------
@@ -2561,7 +2565,7 @@ export class Object {
* Requires public options: padding, borderColor
* @param ctx Context to draw on
*/
drawBorders(context: CanvasRenderingContext2D): Object;
drawBorders(context: CanvasRenderingContext2D): this;
/**
* Draws corners of an object's bounding box.
@@ -2581,7 +2585,7 @@ export class Object {
* @param controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'.
* @param visible true to set the specified control visible, false otherwise
*/
setControlVisible(controlName: string, visible: boolean): Object;
setControlVisible(controlName: string, visible: boolean): this;
/**
* Sets the visibility state of object controls.
@@ -2596,7 +2600,7 @@ export class Object {
mt?: boolean;
tl?: boolean;
tr?: boolean;
mtr?: boolean; }): Object;
mtr?: boolean; }): this;
// functions from geometry mixin
// -------------------------------------------------------------------------------------------------------------------------------
@@ -2604,7 +2608,7 @@ export class Object {
* Sets corner position coordinates based on current angle, width and height
* See https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords
*/
setCoords(): Object;
setCoords(): this;
/**
* Returns coordinates of object's bounding rectangle (left, top, width, height)
* @return Object with left, top, width, height properties
@@ -2631,17 +2635,17 @@ export class Object {
* @param value Scale factor
* @return thisArg
*/
scale(value: number): Object;
scale(value: number): this;
/**
* Scales an object to a given height, with respect to bounding box (scaling by x/y equally)
* @param value New height value
*/
scaleToHeight(value: number): Object;
scaleToHeight(value: number): this;
/**
* Scales an object to a given width, with respect to bounding box (scaling by x/y equally)
* @param value New width value
*/
scaleToWidth(value: number): Object;
scaleToWidth(value: number): this;
/**
* Checks if object intersects with another object
* @param other Object to test
@@ -2671,8 +2675,8 @@ interface IPathOptions extends IObjectOptions {
*/
minY?: number;
}
export interface IPath extends Object, IPathOptions {}
export class IPath {
export interface Path extends Object, IPathOptions {}
export class Path {
/**
* Constructor
* @param path Path data (sequence of coordinates and corresponding "command" tokens)
@@ -2680,7 +2684,7 @@ export class IPath {
*/
constructor(path?: string|any[], options?: IPathOptions);
initialize(path?: any[], options?: IPathOptions): IPath;
initialize(path?: any[], options?: IPathOptions): Path;
/**
* Returns number representation of an instance complexity
@@ -2699,13 +2703,13 @@ export class IPath {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toDatalessObject(propertiesToInclude?: any[]): any;
toDatalessObject(propertiesToInclude?: string[]): any;
/**
* Returns object representation of an instance
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns string representation of an instance
* @return string representation of an instance
@@ -2724,12 +2728,12 @@ export class IPath {
* @param callback Callback to invoke when an fabric.Path instance is created
* @param [options] Options object
*/
static fromElement(element: SVGElement, callback: (path: IPath) => any, options?: IPathOptions): void;
static fromElement(element: SVGElement, callback: (path: Path) => any, options?: IPathOptions): void;
/**
* Creates an instance of fabric.Path from an object
* @param callback Callback to invoke when an fabric.Path instance is created
*/
static fromObject(object: any, callback: (path: IPath) => any): void;
static fromObject(object: any, callback: (path: Path) => any): void;
}
export class PathGroup extends Object {
@@ -2737,9 +2741,9 @@ export class PathGroup extends Object {
* Constructor
* @param [options] Options object
*/
constructor(paths: IPath[], options?: IObjectOptions);
constructor(paths: Path[], options?: IObjectOptions);
initialize(paths: IPath[], options?: IObjectOptions): void;
initialize(paths: Path[], options?: IObjectOptions): void;
/**
* Returns number representation of object's complexity
* @return complexity
@@ -2760,13 +2764,13 @@ export class PathGroup extends Object {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return dataless object representation of an instance
*/
toDatalessObject(propertiesToInclude?: any[]): any;
toDatalessObject(propertiesToInclude?: string[]): any;
/**
* Returns object representation of this path group
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns a string representation of this path group
* @return string representation of an object
@@ -2782,7 +2786,7 @@ export class PathGroup extends Object {
* Returns all paths in this path group
* @return array of path objects included in this path group
*/
getObjects(): IPath[];
getObjects(): Path[];
static fromObject(object: any): PathGroup;
/**
@@ -2829,7 +2833,7 @@ export class Polygon extends Object {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns svg representation of an instance
* @param [reviver] Method for further parsing of svg representation.
@@ -2891,7 +2895,7 @@ export class Polyline extends Object {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return Object representation of an instance
*/
toObject(propertiesToInclude?: any[]): any;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns SVG representation of an instance
* @param [reviver] Method for further parsing of svg representation.
@@ -3012,7 +3016,7 @@ interface ITextOptions extends IObjectOptions {
* Shadow object representing shadow of this shape.
* <b>Backwards incompatibility note?:</b> This property was named "textShadow" (String) until v1.2.11
*/
shadow?: IShadow|string;
shadow?: Shadow|string;
/**
* Background color of text lines
*/
@@ -3047,7 +3051,7 @@ export class Text extends Object {
* Returns object representation of an instance
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
*/
toObject(propertiesToInclude?: any[]): Object;
toObject(propertiesToInclude?: string[]): any;
/**
* Returns SVG representation of an instance
* @param [reviver] Method for further parsing of svg representation.
@@ -3237,7 +3241,7 @@ export class IText extends Object {
* @param [propertiesToInclude] Any properties that you might want to additionally include in the output
* @return object representation of an instance
*/
toObject(propertiesToInclude?: any[]): Object;
toObject(propertiesToInclude?: string[]): any;
setText(value: string): Text;
/**
@@ -3843,7 +3847,7 @@ export class BaseBrush {
* <b>Backwards incompatibility note:</b> This property replaces "shadowColor" (String), "shadowOffsetX" (Number),
* "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12
*/
shadow: IShadow|string;
shadow: Shadow|string;
/**
* Line endings style of a brush (one of "butt", "round", "square")
*/
@@ -3924,7 +3928,7 @@ export class PatternBrush extends PencilBrush {
/**
* Creates path
*/
createPath(pathData: string): IPath;
createPath(pathData: string): Path;
}
export class PencilBrush extends BaseBrush {
/**
@@ -3937,7 +3941,7 @@ export class PencilBrush extends BaseBrush {
* Creates fabric.Path object to add on canvas
* @param pathData Path data
*/
createPath(pathData: string): IPath;
createPath(pathData: string): Path;
}
///////////////////////////////////////////////////////////////////////////////
@@ -4258,6 +4262,13 @@ interface IUtilMisc {
*/
rotatePoint(point: Point, origin: Point, radians: number): Point;
/**
* Rotates `vector` with `radians`
* @param vector The vector to rotate (x and y)
* @param radians The radians of the angle for the rotation
*/
rotateVector(vector: { x: number, y: number }, radians: number): { x: number, y: number };
/**
* Apply transform t to point p
* @param p The point to transform
@@ -4378,7 +4389,13 @@ interface IUtilMisc {
* @param a First transformMatrix
* @param b Second transformMatrix
*/
multiplyTransformMatrices(a: any[], b: any[]): any[];
multiplyTransformMatrices(a: number[], b: number[]): number[];
/**
* Decomposes standard 2x2 matrix into transform componentes
* @param a transformMatrix
*/
qrDecompose(a: number[]): { angle: number, scaleX: number, scaleY: number, skewX: number, skewY: number, translateX: number, translateY: number };
/**
* Returns string representation of function body
@@ -1,4 +1,11 @@
import feathers from '@feathersjs/feathers';
import feathersAuthClient from '@feathersjs/authentication-client';
// we can't really do much, because the augmentation of @feathersjs/feathers breaks importing it here.
const configureFn = feathersAuthClient({});
const app = feathers();
app.configure(feathersAuthClient());
app.authenticate({strategy : 'abcdef'}).then(() => {});
app.logout().then(() => {});
// check if the non-augmented @feathersjs/feathers typings still work
app.on('asd', () => {});
app.service('asd').get(0).then(() => {});
@@ -1,14 +0,0 @@
declare module '@feathersjs/feathers' {
import {
FeathersAuthCredentials,
Passport
} from '@feathersjs/authentication-client';
interface Application<ServiceTypes> {
authenticate(options?: FeathersAuthCredentials): Promise<any>;
logout(): Promise<void>;
passport: Passport;
}
}
+10 -2
View File
@@ -3,8 +3,6 @@
// Definitions by: Abraao Alves <https://github.com/AbraaoAlves>, Jan Lohage <https://github.com/j2L4e>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
import './feathersjs__feathers';
export default function feathersAuthClient(config?: FeathersAuthClientConfig): () => void;
export interface FeathersAuthClientConfig {
@@ -62,3 +60,13 @@ export interface Passport {
getStorage(storage: any): any;
}
declare module '@feathersjs/feathers' {
interface Application<ServiceTypes> {
authenticate(options?: FeathersAuthCredentials): Promise<any>;
logout(): Promise<void>;
passport: Passport;
}
}
@@ -1,5 +1,8 @@
import feathers, { Application } from '@feathersjs/feathers';
import feathersExpress from '@feathersjs/express';
import { Application as ExpressApplication } from 'express';
import feathersExpress, { original, rest, notFound, errorHandler } from '@feathersjs/express';
const app: ExpressApplication & Application<{}> = feathersExpress(feathers());
const app = feathersExpress(feathers());
app.configure(rest());
app.use(notFound());
app.use(errorHandler());
+40 -2
View File
@@ -5,6 +5,44 @@
// TypeScript Version: 2.2
import { Application as FeathersApplication } from '@feathersjs/feathers';
import { Application as ExpressApplication } from 'express';
import * as express from 'express';
export default function feathersExpress<T>(app: FeathersApplication<T>): ExpressApplication & FeathersApplication<T>;
export default function feathersExpress<T>(app: FeathersApplication<T>): Application<T>;
export type Application<T> = express.Application & FeathersApplication<T>;
export function errorHandler(options?: any): express.ErrorRequestHandler;
export function notFound(): express.RequestHandler;
export const rest: {
(): () => void;
formatter: express.RequestHandler;
};
/*
* Re-export of the express package.
**/
export {
CookieOptions,
Errback,
ErrorRequestHandler,
Express,
Handler,
IRoute,
IRouter,
IRouterHandler,
IRouterMatcher,
json,
MediaType,
NextFunction,
Request,
RequestHandler,
RequestParamHandler,
Response,
Router,
RouterOptions,
Send,
static,
urlencoded
} from 'express';
export const original: typeof express;
+3
View File
@@ -2,6 +2,9 @@
// Project: http://feathersjs.com/
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3
/// <reference types="feathersjs__socket-commons"/>
// primus removed its typings from the repo https://github.com/primus/primus/pull/623, as of 01/2018 there are none on DT
export default function feathersPrimus(options: any, callback?: (primus: any) => void): () => void;
-18
View File
@@ -1,18 +0,0 @@
declare module '@feathersjs/feathers' {
import { Channel } from '@feathersjs/socket-commons';
import { HookContext } from '@feathersjs/feathers';
export interface ServiceAddons<T> {
publish(callback: (data: T, hook: HookContext<T>) => Channel): this
publish(event: string, callback: (data: T, hook: HookContext<T>) => Channel): this
}
export interface Application<ServiceTypes = {}> {
channel(...names: string[]): Channel;
publish<T>(callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
publish<T>(event: string, callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
}
}
@@ -1 +1,9 @@
const dummy: any = null;
import feathers from '@feathersjs/feathers';
const app = feathers();
app.channel('abc').send({});
// check if the non-augmented @feathersjs/feathers typings still work
app.on('asd', () => {});
app.service('asd').get(0).then(() => {});
+30 -2
View File
@@ -2,6 +2,34 @@
// Project: http://feathersjs.com/
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3
import './socket-commons';
import './feathers';
import { HookContext } from '@feathersjs/feathers';
export type Connection = any; // todo: spec connection
export interface Channel {
join(...connections: Connection[]): this;
leave(...connections: Connection[]): this;
filter(callback: (connection: Connection) => boolean): Channel;
send(data: any): this;
}
declare module '@feathersjs/feathers' {
interface ServiceAddons<T> {
publish(callback: (data: T, hook: HookContext<T>) => Channel): this;
publish(event: string, callback: (data: T, hook: HookContext<T>) => Channel): this;
}
interface Application<ServiceTypes> {
channel(...names: string[]): Channel;
publish<T>(callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
publish<T>(event: string, callback: (data: T, hook: HookContext<T>) => Channel | Channel[]): Application<ServiceTypes>;
}
}
-13
View File
@@ -1,13 +0,0 @@
declare module '@feathersjs/socket-commons' {
export type Connection = any; // todo: spec connection
export interface Channel {
join(...connections: Connection[]): this;
leave(...connections: Connection[]): this;
filter(callback: (connection: Connection) => boolean): Channel;
send(data: any): this;
}
}
+2
View File
@@ -2,8 +2,10 @@
// Project: http://feathersjs.com/
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3
/// <reference types="socket.io" />
/// <reference types="feathersjs__socket-commons"/>
export default function feathersSocketIO(callback: (io: SocketIO.Server) => void): () => void;
export default function feathersSocketIO(options: number | SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void;
+1
View File
@@ -161,5 +161,6 @@ export interface Feature<G extends GeometryObject, P = GeoJsonProperties> extend
* https://tools.ietf.org/html/rfc7946#section-3.3
*/
export interface FeatureCollection<G extends GeometryObject, P = GeoJsonProperties> extends GeoJsonObject {
type: "FeatureCollection";
features: Array<Feature<G, P>>;
}
+1 -1
View File
@@ -42,7 +42,6 @@ declare namespace libphonenumber {
hasCountryCode(): boolean;
countryCodeCount(): number;
clearCountryCode(): void;
getNationalNumber(): number | undefined;
getNationalNumberOrDefault(): number;
setNationalNumber(value: number): number;
@@ -115,6 +114,7 @@ declare namespace libphonenumber {
format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string;
getNddPrefixForRegion(regionCode?: string, stripNonDigits?: boolean): string | undefined;
getNumberType(phoneNumber: PhoneNumber): PhoneNumberType;
getCountryCodeForRegion(supportedRegion:string):string;
getRegionCodeForCountryCode(countryCallingCode: number): string;
getRegionCodeForNumber(phoneNumber: PhoneNumber): string | undefined;
getSupportedRegions():string [];
+3 -4
View File
@@ -39,9 +39,8 @@ interface GoogleAnalytics {
declare namespace UniversalAnalytics {
// https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
enum HitType {
'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'
}
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#hitType
type HitType = 'pageview' | 'screenview' | 'event' | 'transaction' | 'item' | 'social' | 'exception' | 'timing';
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
@@ -294,7 +293,7 @@ declare namespace UniversalAnalytics {
flashVersion?: string;
forceSSL?: boolean;
hitCallback?(): void;
hitType?: string;
hitType?: HitType;
hostname?: string;
id?: string;
javaEnabled?: boolean;
@@ -0,0 +1,5 @@
import { GraphQLDate, GraphQLTime, GraphQLDateTime } from "graphql-iso-date";
GraphQLDate.name;
GraphQLTime.name;
GraphQLDateTime.name;
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for graphql-iso-date 3.3
// Project: https://github.com/excitement-engineer/graphql-iso-date
// Definitions by: Jason Waldrip <https://github.com/jwaldrip>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { GraphQLScalarType } from "graphql";
export const GraphQLDate: GraphQLScalarType;
export const GraphQLTime: GraphQLScalarType;
export const GraphQLDateTime: GraphQLScalarType;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"graphql-iso-date-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+49 -49
View File
@@ -9,60 +9,60 @@ import { Source } from '../language/source';
* GraphQL document and/or execution result that correspond to the Error.
*/
export class GraphQLError extends Error {
/**
* A message describing the Error for debugging purposes.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
message: string;
/**
* A message describing the Error for debugging purposes.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
message: string;
/**
* An array of { line, column } locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
locations?: Array<{ line: number, column: number }> | undefined;
/**
* An array of { line, column } locations within the source GraphQL document
* which correspond to this error.
*
* Errors during validation often contain multiple locations, for example to
* point out two things with the same name. Errors during execution include a
* single location, the field which produced the error.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
locations?: Array<{ line: number; column: number }> | undefined;
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
path?: Array<string | number> | undefined;
/**
* An array describing the JSON-path into the execution response which
* corresponds to this error. Only included for errors during execution.
*
* Enumerable, and appears in the result of JSON.stringify().
*/
path?: Array<string | number> | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes?: ASTNode[] | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes?: ASTNode[] | undefined;
/**
* The source GraphQL document corresponding to this error.
*/
source?: Source | undefined;
/**
* The source GraphQL document corresponding to this error.
*/
source?: Source | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
positions?: number[] | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
positions?: number[] | undefined;
/**
* The original error thrown from a field resolver during execution.
*/
originalError?: Error;
/**
* The original error thrown from a field resolver during execution.
*/
originalError?: Error;
constructor(
message: string,
nodes?: any[],
source?: Source,
positions?: number[],
path?: Array<string | number>,
originalError?: Error,
);
constructor(
message: string,
nodes?: any[],
source?: Source,
positions?: number[],
path?: Array<string | number>,
originalError?: Error,
);
}
+5 -5
View File
@@ -7,12 +7,12 @@ import { GraphQLError } from './GraphQLError';
export function formatError(error: GraphQLError): GraphQLFormattedError;
export interface GraphQLFormattedError {
message: string;
locations?: GraphQLErrorLocation[];
path?: Array<string | number>;
message: string;
locations?: GraphQLErrorLocation[];
path?: Array<string | number>;
}
export interface GraphQLErrorLocation {
line: number;
column: number;
line: number;
column: number;
}
+5 -1
View File
@@ -1,4 +1,8 @@
export { GraphQLError } from './GraphQLError';
export { syntaxError } from './syntaxError';
export { locatedError } from './locatedError';
export { formatError, GraphQLFormattedError, GraphQLErrorLocation } from './formatError';
export {
formatError,
GraphQLFormattedError,
GraphQLErrorLocation,
} from './formatError';
+3 -3
View File
@@ -6,7 +6,7 @@ import { GraphQLError } from './GraphQLError';
* document responsible for the original Error.
*/
export function locatedError<T>(
originalError: Error,
nodes: T[],
path: Array<string | number>
originalError: Error,
nodes: T[],
path: Array<string | number>,
): GraphQLError;
+3 -3
View File
@@ -6,7 +6,7 @@ import { GraphQLError } from './GraphQLError';
* descriptive information about the syntax error's position in the source.
*/
export function syntaxError(
source: Source,
position: number,
description: string
source: Source,
position: number,
description: string,
): GraphQLError;
+39 -37
View File
@@ -1,14 +1,18 @@
import { GraphQLError, locatedError } from '../error';
import { GraphQLSchema } from '../type/schema';
import { GraphQLField, GraphQLFieldResolver, ResponsePath } from '../type/definition';
import {
DirectiveNode,
DocumentNode,
OperationDefinitionNode,
SelectionSetNode,
FieldNode,
InlineFragmentNode,
FragmentDefinitionNode,
GraphQLField,
GraphQLFieldResolver,
ResponsePath,
} from '../type/definition';
import {
DirectiveNode,
DocumentNode,
OperationDefinitionNode,
SelectionSetNode,
FieldNode,
InlineFragmentNode,
FragmentDefinitionNode,
} from '../language/ast';
/**
* Data that must be available at all points during query execution.
@@ -17,13 +21,13 @@ import {
* and the fragments defined in the query document
*/
export interface ExecutionContext {
schema: GraphQLSchema;
fragments: { [key: string]: FragmentDefinitionNode };
rootValue: any;
operation: OperationDefinitionNode;
variableValues: { [key: string]: any };
fieldResolver: GraphQLFieldResolver<any, any>;
errors: GraphQLError[];
schema: GraphQLSchema;
fragments: { [key: string]: FragmentDefinitionNode };
rootValue: any;
operation: OperationDefinitionNode;
variableValues: { [key: string]: any };
fieldResolver: GraphQLFieldResolver<any, any>;
errors: GraphQLError[];
}
/**
@@ -33,19 +37,19 @@ export interface ExecutionContext {
* non-empty array if an error occurred.
*/
export interface ExecutionResult {
data?: { [key: string]: any };
extensions?: { [key: string]: any };
errors?: GraphQLError[];
data?: { [key: string]: any };
extensions?: { [key: string]: any };
errors?: GraphQLError[];
}
export type ExecutionArgs = {
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {[key: string]: any},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
schema: GraphQLSchema;
document: DocumentNode;
rootValue?: any;
contextValue?: any;
variableValues?: { [key: string]: any };
operationName?: string;
fieldResolver?: GraphQLFieldResolver<any, any>;
};
/**
@@ -60,24 +64,22 @@ export type ExecutionArgs = {
*/
export function execute(args: ExecutionArgs): Promise<ExecutionResult>;
export function execute(
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
schema: GraphQLSchema,
document: DocumentNode,
rootValue?: any,
contextValue?: any,
variableValues?: {
[key: string]: any;
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
): Promise<ExecutionResult>;
/**
* Given a ResponsePath (found in the `path` entry in the information provided
* as the last argument to a field resolver), return an Array of the path keys.
*/
export function responsePathAsArray(
path: ResponsePath
): Array<string | number>;
export function responsePathAsArray(path: ResponsePath): Array<string | number>;
export function addPath(prev: ResponsePath, key: string | number): any;
+5 -5
View File
@@ -1,9 +1,9 @@
export {
execute,
defaultFieldResolver,
responsePathAsArray,
ExecutionArgs,
ExecutionResult
execute,
defaultFieldResolver,
responsePathAsArray,
ExecutionArgs,
ExecutionResult,
} from './execute';
export { getDirectiveValues } from './values';
+19 -11
View File
@@ -1,7 +1,15 @@
import { GraphQLInputType, GraphQLField, GraphQLArgument } from '../type/definition';
import {
GraphQLInputType,
GraphQLField,
GraphQLArgument,
} from '../type/definition';
import { GraphQLDirective } from '../type/directives';
import { GraphQLSchema } from '../type/schema';
import { FieldNode, DirectiveNode, VariableDefinitionNode } from '../language/ast';
import {
FieldNode,
DirectiveNode,
VariableDefinitionNode,
} from '../language/ast';
/**
* Prepares an object map of variableValues of the correct type based on the
@@ -9,9 +17,9 @@ import { FieldNode, DirectiveNode, VariableDefinitionNode } from '../language/as
* parsed to match the variable definitions, a GraphQLError will be thrown.
*/
export function getVariableValues(
schema: GraphQLSchema,
varDefNodes: VariableDefinitionNode[],
inputs: { [key: string]: any }
schema: GraphQLSchema,
varDefNodes: VariableDefinitionNode[],
inputs: { [key: string]: any },
): { [key: string]: any };
/**
@@ -19,9 +27,9 @@ export function getVariableValues(
* definitions and list of argument AST nodes.
*/
export function getArgumentValues(
def: GraphQLField<any, any> | GraphQLDirective,
node: FieldNode | DirectiveNode,
variableValues?: { [key: string]: any }
def: GraphQLField<any, any> | GraphQLDirective,
node: FieldNode | DirectiveNode,
variableValues?: { [key: string]: any },
): { [key: string]: any };
/**
@@ -32,7 +40,7 @@ export function getArgumentValues(
* If the directive does not exist on the node, returns undefined.
*/
export function getDirectiveValues(
directiveDef: GraphQLDirective,
node: { directives?: Array<DirectiveNode> },
variableValues?: { [key: string]: any }
directiveDef: GraphQLDirective,
node: { directives?: Array<DirectiveNode> },
variableValues?: { [key: string]: any },
): void | { [key: string]: any };
+369 -375
View File
@@ -5,30 +5,30 @@ import { Source } from './source';
* identify the region of the source from which the AST derived.
*/
export interface Location {
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The Token at which this Node begins.
*/
startToken: Token;
/**
* The Token at which this Node begins.
*/
startToken: Token;
/**
* The Token at which this Node ends.
*/
endToken: Token;
/**
* The Token at which this Node ends.
*/
endToken: Token;
/**
* The Source document the AST represents.
*/
source: Source;
/**
* The Source document the AST represents.
*/
source: Source;
}
/**
@@ -37,181 +37,181 @@ export interface Location {
* *only*.
*/
type TokenKind =
| '<SOF>'
| '<EOF>'
| '!'
| '$'
| '('
| ')'
| '...'
| ':'
| '='
| '@'
| '['
| ']'
| '{'
| '|'
| '}'
| 'Name'
| 'Int'
| 'Float'
| 'String'
| 'BlockString'
| 'Comment';
| '<SOF>'
| '<EOF>'
| '!'
| '$'
| '('
| ')'
| '...'
| ':'
| '='
| '@'
| '['
| ']'
| '{'
| '|'
| '}'
| 'Name'
| 'Int'
| 'Float'
| 'String'
| 'BlockString'
| 'Comment';
/**
* Represents a range of characters represented by a lexical token
* within a Source.
*/
export interface Token {
/**
* The kind of Token.
*/
kind: TokenKind;
/**
* The kind of Token.
*/
kind: TokenKind;
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node begins.
*/
start: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The character offset at which this Node ends.
*/
end: number;
/**
* The 1-indexed line number on which this Token appears.
*/
line: number;
/**
* The 1-indexed line number on which this Token appears.
*/
line: number;
/**
* The 1-indexed column number at which this Token begins.
*/
column: number;
/**
* The 1-indexed column number at which this Token begins.
*/
column: number;
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*/
value: string | undefined;
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*/
value: string | undefined;
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
prev?: Token;
next?: Token;
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
* including ignored tokens. <SOF> is always the first node and <EOF>
* the last.
*/
prev?: Token;
next?: Token;
}
/**
* The list of all possible AST node types.
*/
export type ASTNode =
| NameNode
| DocumentNode
| OperationDefinitionNode
| VariableDefinitionNode
| VariableNode
| SelectionSetNode
| FieldNode
| ArgumentNode
| FragmentSpreadNode
| InlineFragmentNode
| FragmentDefinitionNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode
| ObjectFieldNode
| DirectiveNode
| NamedTypeNode
| ListTypeNode
| NonNullTypeNode
| SchemaDefinitionNode
| OperationTypeDefinitionNode
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| FieldDefinitionNode
| InputValueDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| EnumValueDefinitionNode
| InputObjectTypeDefinitionNode
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode
| DirectiveDefinitionNode;
| NameNode
| DocumentNode
| OperationDefinitionNode
| VariableDefinitionNode
| VariableNode
| SelectionSetNode
| FieldNode
| ArgumentNode
| FragmentSpreadNode
| InlineFragmentNode
| FragmentDefinitionNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode
| ObjectFieldNode
| DirectiveNode
| NamedTypeNode
| ListTypeNode
| NonNullTypeNode
| SchemaDefinitionNode
| OperationTypeDefinitionNode
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| FieldDefinitionNode
| InputValueDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| EnumValueDefinitionNode
| InputObjectTypeDefinitionNode
| ScalarTypeExtensionNode
| ObjectTypeExtensionNode
| InterfaceTypeExtensionNode
| UnionTypeExtensionNode
| EnumTypeExtensionNode
| InputObjectTypeExtensionNode
| DirectiveDefinitionNode;
/**
* Utility type listing all nodes indexed by their kind.
*/
export interface ASTKindToNode {
Name: NameNode;
Document: DocumentNode;
OperationDefinition: OperationDefinitionNode;
VariableDefinition: VariableDefinitionNode;
Variable: VariableNode;
SelectionSet: SelectionSetNode;
Field: FieldNode;
Argument: ArgumentNode;
FragmentSpread: FragmentSpreadNode;
InlineFragment: InlineFragmentNode;
FragmentDefinition: FragmentDefinitionNode;
IntValue: IntValueNode;
FloatValue: FloatValueNode;
StringValue: StringValueNode;
BooleanValue: BooleanValueNode;
NullValue: NullValueNode;
EnumValue: EnumValueNode;
ListValue: ListValueNode;
ObjectValue: ObjectValueNode;
ObjectField: ObjectFieldNode;
Directive: DirectiveNode;
NamedType: NamedTypeNode;
ListType: ListTypeNode;
NonNullType: NonNullTypeNode;
SchemaDefinition: SchemaDefinitionNode;
OperationTypeDefinition: OperationTypeDefinitionNode;
ScalarTypeDefinition: ScalarTypeDefinitionNode;
ObjectTypeDefinition: ObjectTypeDefinitionNode;
FieldDefinition: FieldDefinitionNode;
InputValueDefinition: InputValueDefinitionNode;
InterfaceTypeDefinition: InterfaceTypeDefinitionNode;
UnionTypeDefinition: UnionTypeDefinitionNode;
EnumTypeDefinition: EnumTypeDefinitionNode;
EnumValueDefinition: EnumValueDefinitionNode;
InputObjectTypeDefinition: InputObjectTypeDefinitionNode;
ScalarTypeExtension: ScalarTypeExtensionNode;
ObjectTypeExtension: ObjectTypeExtensionNode;
InterfaceTypeExtension: InterfaceTypeExtensionNode;
UnionTypeExtension: UnionTypeExtensionNode;
EnumTypeExtension: EnumTypeExtensionNode;
InputObjectTypeExtension: InputObjectTypeExtensionNode;
DirectiveDefinition: DirectiveDefinitionNode;
Name: NameNode;
Document: DocumentNode;
OperationDefinition: OperationDefinitionNode;
VariableDefinition: VariableDefinitionNode;
Variable: VariableNode;
SelectionSet: SelectionSetNode;
Field: FieldNode;
Argument: ArgumentNode;
FragmentSpread: FragmentSpreadNode;
InlineFragment: InlineFragmentNode;
FragmentDefinition: FragmentDefinitionNode;
IntValue: IntValueNode;
FloatValue: FloatValueNode;
StringValue: StringValueNode;
BooleanValue: BooleanValueNode;
NullValue: NullValueNode;
EnumValue: EnumValueNode;
ListValue: ListValueNode;
ObjectValue: ObjectValueNode;
ObjectField: ObjectFieldNode;
Directive: DirectiveNode;
NamedType: NamedTypeNode;
ListType: ListTypeNode;
NonNullType: NonNullTypeNode;
SchemaDefinition: SchemaDefinitionNode;
OperationTypeDefinition: OperationTypeDefinitionNode;
ScalarTypeDefinition: ScalarTypeDefinitionNode;
ObjectTypeDefinition: ObjectTypeDefinitionNode;
FieldDefinition: FieldDefinitionNode;
InputValueDefinition: InputValueDefinitionNode;
InterfaceTypeDefinition: InterfaceTypeDefinitionNode;
UnionTypeDefinition: UnionTypeDefinitionNode;
EnumTypeDefinition: EnumTypeDefinitionNode;
EnumValueDefinition: EnumValueDefinitionNode;
InputObjectTypeDefinition: InputObjectTypeDefinitionNode;
ScalarTypeExtension: ScalarTypeExtensionNode;
ObjectTypeExtension: ObjectTypeExtensionNode;
InterfaceTypeExtension: InterfaceTypeExtensionNode;
UnionTypeExtension: UnionTypeExtensionNode;
EnumTypeExtension: EnumTypeExtensionNode;
InputObjectTypeExtension: InputObjectTypeExtensionNode;
DirectiveDefinition: DirectiveDefinitionNode;
}
// Name
export interface NameNode {
kind: 'Name';
loc?: Location;
value: string;
kind: 'Name';
loc?: Location;
value: string;
}
// Document
export interface DocumentNode {
kind: 'Document';
loc?: Location;
definitions: DefinitionNode[];
kind: 'Document';
loc?: Location;
definitions: DefinitionNode[];
}
export type DefinitionNode =
@@ -223,300 +223,294 @@ export type ExecutableDefinitionNode =
| FragmentDefinitionNode;
export interface OperationDefinitionNode {
kind: 'OperationDefinition';
loc?: Location;
operation: OperationTypeNode;
name?: NameNode;
variableDefinitions?: VariableDefinitionNode[];
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
kind: 'OperationDefinition';
loc?: Location;
operation: OperationTypeNode;
name?: NameNode;
variableDefinitions?: VariableDefinitionNode[];
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
}
// Note: subscription is an experimental non-spec addition.
export type OperationTypeNode = 'query' | 'mutation' | 'subscription';
export interface VariableDefinitionNode {
kind: 'VariableDefinition';
loc?: Location;
variable: VariableNode;
type: TypeNode;
defaultValue?: ValueNode;
kind: 'VariableDefinition';
loc?: Location;
variable: VariableNode;
type: TypeNode;
defaultValue?: ValueNode;
}
export interface VariableNode {
kind: 'Variable';
loc?: Location;
name: NameNode;
kind: 'Variable';
loc?: Location;
name: NameNode;
}
export interface SelectionSetNode {
kind: 'SelectionSet';
loc?: Location;
selections: SelectionNode[];
kind: 'SelectionSet';
loc?: Location;
selections: SelectionNode[];
}
export type SelectionNode =
| FieldNode
| FragmentSpreadNode
| InlineFragmentNode;
export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode;
export interface FieldNode {
kind: 'Field';
loc?: Location;
alias?: NameNode;
name: NameNode;
arguments?: ArgumentNode[];
directives?: DirectiveNode[];
selectionSet?: SelectionSetNode;
kind: 'Field';
loc?: Location;
alias?: NameNode;
name: NameNode;
arguments?: ArgumentNode[];
directives?: DirectiveNode[];
selectionSet?: SelectionSetNode;
}
export interface ArgumentNode {
kind: 'Argument';
loc?: Location;
name: NameNode;
value: ValueNode;
kind: 'Argument';
loc?: Location;
name: NameNode;
value: ValueNode;
}
// Fragments
export interface FragmentSpreadNode {
kind: 'FragmentSpread';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
kind: 'FragmentSpread';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
}
export interface InlineFragmentNode {
kind: 'InlineFragment';
loc?: Location;
typeCondition?: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
kind: 'InlineFragment';
loc?: Location;
typeCondition?: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
}
export interface FragmentDefinitionNode {
kind: 'FragmentDefinition';
loc?: Location;
name: NameNode;
// Note: fragment variable definitions are experimental and may be changed
// or removed in the future.
variableDefinitions?: VariableDefinitionNode[];
typeCondition: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
kind: 'FragmentDefinition';
loc?: Location;
name: NameNode;
// Note: fragment variable definitions are experimental and may be changed
// or removed in the future.
variableDefinitions?: VariableDefinitionNode[];
typeCondition: NamedTypeNode;
directives?: DirectiveNode[];
selectionSet: SelectionSetNode;
}
// Values
export type ValueNode =
| VariableNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode;
| VariableNode
| IntValueNode
| FloatValueNode
| StringValueNode
| BooleanValueNode
| NullValueNode
| EnumValueNode
| ListValueNode
| ObjectValueNode;
export interface IntValueNode {
kind: 'IntValue';
loc?: Location;
value: string;
kind: 'IntValue';
loc?: Location;
value: string;
}
export interface FloatValueNode {
kind: 'FloatValue';
loc?: Location;
value: string;
kind: 'FloatValue';
loc?: Location;
value: string;
}
export interface StringValueNode {
kind: 'StringValue';
loc?: Location;
value: string;
kind: 'StringValue';
loc?: Location;
value: string;
}
export interface BooleanValueNode {
kind: 'BooleanValue';
loc?: Location;
value: boolean;
kind: 'BooleanValue';
loc?: Location;
value: boolean;
}
export interface NullValueNode {
kind: 'NullValue';
loc?: Location;
kind: 'NullValue';
loc?: Location;
}
export interface EnumValueNode {
kind: 'EnumValue';
loc?: Location;
value: string;
kind: 'EnumValue';
loc?: Location;
value: string;
}
export interface ListValueNode {
kind: 'ListValue';
loc?: Location;
values: ValueNode[];
kind: 'ListValue';
loc?: Location;
values: ValueNode[];
}
export interface ObjectValueNode {
kind: 'ObjectValue';
loc?: Location;
fields: ObjectFieldNode[];
kind: 'ObjectValue';
loc?: Location;
fields: ObjectFieldNode[];
}
export interface ObjectFieldNode {
kind: 'ObjectField';
loc?: Location;
name: NameNode;
value: ValueNode;
kind: 'ObjectField';
loc?: Location;
name: NameNode;
value: ValueNode;
}
// Directives
export interface DirectiveNode {
kind: 'Directive';
loc?: Location;
name: NameNode;
arguments?: ArgumentNode[];
kind: 'Directive';
loc?: Location;
name: NameNode;
arguments?: ArgumentNode[];
}
// Type Reference
export type TypeNode =
| NamedTypeNode
| ListTypeNode
| NonNullTypeNode;
export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode;
export interface NamedTypeNode {
kind: 'NamedType';
loc?: Location;
name: NameNode;
kind: 'NamedType';
loc?: Location;
name: NameNode;
}
export interface ListTypeNode {
kind: 'ListType';
loc?: Location;
type: TypeNode;
kind: 'ListType';
loc?: Location;
type: TypeNode;
}
export interface NonNullTypeNode {
kind: 'NonNullType';
loc?: Location;
type: NamedTypeNode | ListTypeNode;
kind: 'NonNullType';
loc?: Location;
type: NamedTypeNode | ListTypeNode;
}
// Type System Definition
export type TypeSystemDefinitionNode =
| SchemaDefinitionNode
| TypeDefinitionNode
| TypeExtensionNode
| DirectiveDefinitionNode;
| SchemaDefinitionNode
| TypeDefinitionNode
| TypeExtensionNode
| DirectiveDefinitionNode;
export interface SchemaDefinitionNode {
kind: 'SchemaDefinition';
loc?: Location;
directives: DirectiveNode[];
operationTypes: OperationTypeDefinitionNode[];
kind: 'SchemaDefinition';
loc?: Location;
directives: DirectiveNode[];
operationTypes: OperationTypeDefinitionNode[];
}
export interface OperationTypeDefinitionNode {
kind: 'OperationTypeDefinition';
loc?: Location;
operation: OperationTypeNode;
type: NamedTypeNode;
kind: 'OperationTypeDefinition';
loc?: Location;
operation: OperationTypeNode;
type: NamedTypeNode;
}
export type TypeDefinitionNode =
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| InputObjectTypeDefinitionNode;
| ScalarTypeDefinitionNode
| ObjectTypeDefinitionNode
| InterfaceTypeDefinitionNode
| UnionTypeDefinitionNode
| EnumTypeDefinitionNode
| InputObjectTypeDefinitionNode;
export interface ScalarTypeDefinitionNode {
kind: 'ScalarTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
kind: 'ScalarTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
}
export interface ObjectTypeDefinitionNode {
kind: 'ObjectTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
kind: 'ObjectTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
}
export interface FieldDefinitionNode {
kind: 'FieldDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments: InputValueDefinitionNode[];
type: TypeNode;
directives?: DirectiveNode[];
kind: 'FieldDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments: InputValueDefinitionNode[];
type: TypeNode;
directives?: DirectiveNode[];
}
export interface InputValueDefinitionNode {
kind: 'InputValueDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
type: TypeNode;
defaultValue?: ValueNode;
directives?: DirectiveNode[];
kind: 'InputValueDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
type: TypeNode;
defaultValue?: ValueNode;
directives?: DirectiveNode[];
}
export interface InterfaceTypeDefinitionNode {
kind: 'InterfaceTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
kind: 'InterfaceTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: FieldDefinitionNode[];
}
export interface UnionTypeDefinitionNode {
kind: 'UnionTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
types: NamedTypeNode[];
kind: 'UnionTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
types: NamedTypeNode[];
}
export interface EnumTypeDefinitionNode {
kind: 'EnumTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
values: EnumValueDefinitionNode[];
kind: 'EnumTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
values: EnumValueDefinitionNode[];
}
export interface EnumValueDefinitionNode {
kind: 'EnumValueDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
kind: 'EnumValueDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
}
export interface InputObjectTypeDefinitionNode {
kind: 'InputObjectTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: InputValueDefinitionNode[];
kind: 'InputObjectTypeDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
directives?: DirectiveNode[];
fields: InputValueDefinitionNode[];
}
export type TypeExtensionNode =
@@ -528,60 +522,60 @@ export type TypeExtensionNode =
| InputObjectTypeExtensionNode;
export type ScalarTypeExtensionNode = {
kind: 'ScalarTypeExtension',
loc?: Location,
name: NameNode,
directives?: DirectiveNode[],
kind: 'ScalarTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
};
export type ObjectTypeExtensionNode = {
kind: 'ObjectTypeExtension',
loc?: Location,
name: NameNode,
interfaces?: NamedTypeNode[],
directives?: DirectiveNode[],
fields?: FieldDefinitionNode[],
kind: 'ObjectTypeExtension';
loc?: Location;
name: NameNode;
interfaces?: NamedTypeNode[];
directives?: DirectiveNode[];
fields?: FieldDefinitionNode[];
};
export type InterfaceTypeExtensionNode = {
kind: 'InterfaceTypeExtension',
loc?: Location,
name: NameNode,
directives?: DirectiveNode[],
fields?: FieldDefinitionNode[],
kind: 'InterfaceTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
fields?: FieldDefinitionNode[];
};
export type UnionTypeExtensionNode = {
kind: 'UnionTypeExtension',
loc?: Location,
name: NameNode,
directives?: DirectiveNode[],
types?: NamedTypeNode[],
kind: 'UnionTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
types?: NamedTypeNode[];
};
export type EnumTypeExtensionNode = {
kind: 'EnumTypeExtension',
loc?: Location,
name: NameNode,
directives?: DirectiveNode[],
values?: EnumValueDefinitionNode[],
kind: 'EnumTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
values?: EnumValueDefinitionNode[];
};
export type InputObjectTypeExtensionNode = {
kind: 'InputObjectTypeExtension',
loc?: Location,
name: NameNode,
directives?: DirectiveNode[],
fields?: InputValueDefinitionNode[],
kind: 'InputObjectTypeExtension';
loc?: Location;
name: NameNode;
directives?: DirectiveNode[];
fields?: InputValueDefinitionNode[];
};
// Directive Definitions
export interface DirectiveDefinitionNode {
kind: 'DirectiveDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments?: InputValueDefinitionNode[];
locations: NameNode[];
kind: 'DirectiveDefinition';
loc?: Location;
description?: StringValueNode;
name: NameNode;
arguments?: InputValueDefinitionNode[];
locations: NameNode[];
}
+5 -5
View File
@@ -7,9 +7,9 @@ export { parse, parseValue, parseType, ParseOptions } from './parser';
export { print } from './printer';
export { Source } from './source';
export {
visit,
visitInParallel,
visitWithTypeInfo,
getVisitFn,
BREAK
visit,
visitInParallel,
visitWithTypeInfo,
getVisitFn,
BREAK,
} from './visitor';
+44 -44
View File
@@ -11,41 +11,41 @@ import { syntaxError } from '../error';
* whenever called.
*/
export function createLexer<TOptions>(
source: Source,
options: TOptions
source: Source,
options: TOptions,
): Lexer<TOptions>;
/**
* The return type of createLexer.
*/
export interface Lexer<TOptions> {
source: Source;
options: TOptions;
source: Source;
options: TOptions;
/**
* The previously focused non-ignored token.
*/
lastToken: Token;
/**
* The previously focused non-ignored token.
*/
lastToken: Token;
/**
* The currently focused non-ignored token.
*/
token: Token;
/**
* The currently focused non-ignored token.
*/
token: Token;
/**
* The (1-indexed) line containing the current token.
*/
line: number;
/**
* The (1-indexed) line containing the current token.
*/
line: number;
/**
* The character offset at which the current line begins.
*/
lineStart: number;
/**
* The character offset at which the current line begins.
*/
lineStart: number;
/**
* Advances the token stream to the next non-ignored token.
*/
advance(): Token;
/**
* Advances the token stream to the next non-ignored token.
*/
advance(): Token;
}
/**
@@ -53,26 +53,26 @@ export interface Lexer<TOptions> {
* lexer emits.
*/
export const TokenKind: {
SOF: '<SOF>'
EOF: '<EOF>'
BANG: '!'
DOLLAR: '$'
PAREN_L: '('
PAREN_R: ')'
SPREAD: '...'
COLON: ':'
EQUALS: '='
AT: '@'
BRACKET_L: '['
BRACKET_R: ']'
BRACE_L: '{'
PIPE: '|'
BRACE_R: '}'
NAME: 'Name'
INT: 'Int'
FLOAT: 'Float'
STRING: 'String'
COMMENT: 'Comment'
SOF: '<SOF>';
EOF: '<EOF>';
BANG: '!';
DOLLAR: '$';
PAREN_L: '(';
PAREN_R: ')';
SPREAD: '...';
COLON: ':';
EQUALS: '=';
AT: '@';
BRACKET_L: '[';
BRACKET_R: ']';
BRACE_L: '{';
PIPE: '|';
BRACE_R: '}';
NAME: 'Name';
INT: 'Int';
FLOAT: 'Float';
STRING: 'String';
COMMENT: 'Comment';
};
/**

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