mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge: upstream/master into update/jest-each-templatize
This commit is contained in:
@@ -726,6 +726,12 @@
|
||||
"sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status",
|
||||
"asOfVersion": "1.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "i18next-browser-languagedetector",
|
||||
"typingsPackageName": "i18next-browser-languagedetector",
|
||||
"sourceRepoURL": "https://github.com/i18next/i18next-browser-languagedetector",
|
||||
"asOfVersion": "2.0.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "i18next-xhr-backend",
|
||||
"typingsPackageName": "i18next-xhr-backend",
|
||||
@@ -1116,6 +1122,12 @@
|
||||
"sourceRepoURL": "http://onsen.io",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "p-throttle",
|
||||
"typingsPackageName": "p-throttle",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/p-throttle",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "param-case",
|
||||
"typingsPackageName": "param-case",
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "github:Microsoft/dtslint#production",
|
||||
"dtslint": "latest",
|
||||
"types-publisher": "github:Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {}
|
||||
|
||||
@@ -97,6 +97,7 @@ let _algoliaIndexSettings: IndexSettings = {
|
||||
minProximity: 0,
|
||||
placeholders: { '': [''] },
|
||||
camelCaseAttributes: [''],
|
||||
sortFacetValuesBy: 'count',
|
||||
};
|
||||
|
||||
let _algoliaQueryParameters: QueryParameters = {
|
||||
@@ -150,6 +151,7 @@ let _algoliaQueryParameters: QueryParameters = {
|
||||
synonyms: true,
|
||||
replaceSynonymsInHighlight: false,
|
||||
minProximity: 0,
|
||||
sortFacetValuesBy: 'alpha',
|
||||
};
|
||||
|
||||
let client: Client = algoliasearch('', '');
|
||||
|
||||
Vendored
+19
-11
@@ -5,6 +5,7 @@
|
||||
// Aurélien Hervé <https://github.com/aherve>
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Nery Ortez <https://github.com/neryortez>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -24,25 +25,25 @@ declare namespace algoliasearch {
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[],
|
||||
cb: (err: Error, res: MultiResponse) => void
|
||||
cb: (err: Error, res: MultiResponse<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[]
|
||||
): Promise<MultiResponse>;
|
||||
): Promise<MultiResponse<T>>;
|
||||
/**
|
||||
* Query for facet values of a specific facet
|
||||
*/
|
||||
@@ -590,14 +591,14 @@ declare namespace algoliasearch {
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(params: QueryParameters): Promise<Response>;
|
||||
search<T=any>(params: QueryParameters): Promise<Response<T>>;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
params: QueryParameters,
|
||||
cb: (err: Error, res: Response) => void
|
||||
cb: (err: Error, res: Response<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Search in an index
|
||||
@@ -1451,6 +1452,11 @@ declare namespace algoliasearch {
|
||||
|
||||
nbShards?: number;
|
||||
userData?: string | object;
|
||||
|
||||
/**
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
|
||||
*/
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
}
|
||||
|
||||
namespace SearchForFacetValues {
|
||||
@@ -1776,14 +1782,16 @@ declare namespace algoliasearch {
|
||||
https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
|
||||
*/
|
||||
camelCaseAttributes?: string[];
|
||||
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
}
|
||||
|
||||
interface Response {
|
||||
interface Response<T=any> {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hits: any[];
|
||||
hits: T[];
|
||||
/**
|
||||
* Current page
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
@@ -1842,8 +1850,8 @@ declare namespace algoliasearch {
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
results: Response[];
|
||||
interface MultiResponse<T=any> {
|
||||
results: Response<T>[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+17
-11
@@ -6,6 +6,7 @@
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
|
||||
// Kai Eichinger <https://github.com/keichinger>
|
||||
// Nery Ortez <https://github.com/neryortez>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -25,25 +26,25 @@ declare namespace algoliasearch {
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[],
|
||||
cb: (err: Error, res: MultiResponse) => void
|
||||
cb: (err: Error, res: MultiResponse<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[]
|
||||
): Promise<MultiResponse>;
|
||||
): Promise<MultiResponse<T>>;
|
||||
/**
|
||||
* Query for facet values of a specific facet
|
||||
*/
|
||||
@@ -109,15 +110,15 @@ declare namespace algoliasearch {
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(
|
||||
search<T=any>(
|
||||
params: QueryParameters,
|
||||
cb: (err: Error, res: Response) => void
|
||||
cb: (err: Error, res: Response<T>) => void
|
||||
): void;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(params: QueryParameters): Promise<Response>;
|
||||
search<T=any>(params: QueryParameters): Promise<Response<T>>;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
|
||||
@@ -531,6 +532,11 @@ declare namespace algoliasearch {
|
||||
|
||||
nbShards?: number;
|
||||
userData?: string | object;
|
||||
|
||||
/**
|
||||
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
|
||||
*/
|
||||
sortFacetValuesBy?: 'count' | 'alpha';
|
||||
}
|
||||
|
||||
namespace SearchForFacetValues {
|
||||
@@ -552,12 +558,12 @@ declare namespace algoliasearch {
|
||||
}
|
||||
}
|
||||
|
||||
interface Response {
|
||||
interface Response<T=any> {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
*/
|
||||
hits: any[];
|
||||
hits: T[];
|
||||
/**
|
||||
* Current page
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript#response
|
||||
@@ -616,8 +622,8 @@ declare namespace algoliasearch {
|
||||
cursor?: string;
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
results: Response[];
|
||||
interface MultiResponse<T=any> {
|
||||
results: Response<T>[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -346,7 +346,7 @@ declare module 'angular' {
|
||||
interface IMenuService {
|
||||
close(): void;
|
||||
hide(response?: any, options?: any): IPromise<any>;
|
||||
open(event?: MouseEvent): void;
|
||||
open(event?: MouseEvent | JQueryEventObject): void;
|
||||
}
|
||||
|
||||
interface IColorPalette {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Type definitions for Backbone-associations 0.6.4
|
||||
// Project: https://github.com/dhruvaray/backbone-associations/
|
||||
// Project: http://dhruvaray.github.io/backbone-associations
|
||||
// Definitions by: Craig Brett <https://github.com/craigbrett17>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
Vendored
+120
-137
@@ -7,180 +7,163 @@
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
import { Events, EventsHash, Model as BModel, Collection } from 'backbone';
|
||||
import { EventsMixin, Events, Model as BModel, Collection } from 'backbone';
|
||||
|
||||
declare module 'backbone-relational' {
|
||||
class Model extends BModel {
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
//private static extend(properties:any, classProperties?:any):any;
|
||||
export class Model extends BModel {
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
//private static extend(properties:any, classProperties?:any):any;
|
||||
|
||||
relations:any;
|
||||
subModelTypes:any;
|
||||
subModelTypeAttribute:any;
|
||||
relations:any;
|
||||
subModelTypes:any;
|
||||
subModelTypeAttribute:any;
|
||||
|
||||
|
||||
initializeRelations(options:any):void;
|
||||
initializeRelations(options:any):void;
|
||||
|
||||
updateRelations(options:any):void;
|
||||
updateRelations(options:any):void;
|
||||
|
||||
queue(func:any):void;
|
||||
queue(func:any):void;
|
||||
|
||||
processQueue():void;
|
||||
processQueue():void;
|
||||
|
||||
getRelation(name:string):Relation;
|
||||
getRelation(name:string):Relation;
|
||||
|
||||
getRelations():Relation[];
|
||||
getRelations():Relation[];
|
||||
|
||||
fetchRelated(key:string, options?:any, update?:boolean):any;
|
||||
fetchRelated(key:string, options?:any, update?:boolean):any;
|
||||
|
||||
toJSON(options?: any):any;
|
||||
toJSON(options?: any):any;
|
||||
|
||||
static setup();
|
||||
static setup();
|
||||
|
||||
static build(attributes:any, options?:any);
|
||||
static build(attributes:any, options?:any);
|
||||
|
||||
static findOrCreate(attributes:string, options?:any);
|
||||
static findOrCreate(attributes:string, options?:any);
|
||||
|
||||
static findOrCreate(attributes:number, options?:any);
|
||||
static findOrCreate(attributes:number, options?:any);
|
||||
|
||||
static findOrCreate(attributes:any, options?:any);
|
||||
}
|
||||
static findOrCreate(attributes:any, options?:any);
|
||||
}
|
||||
|
||||
export class Relation extends BModel {
|
||||
export class Relation extends BModel {
|
||||
|
||||
options:any;
|
||||
instance:any;
|
||||
key:any;
|
||||
keyContents:any;
|
||||
relatedModel:any;
|
||||
relatedCollection:any;
|
||||
reverseRelation:any;
|
||||
related:any;
|
||||
options:any;
|
||||
instance:any;
|
||||
key:any;
|
||||
keyContents:any;
|
||||
relatedModel:any;
|
||||
relatedCollection:any;
|
||||
reverseRelation:any;
|
||||
related:any;
|
||||
|
||||
checkPreconditions():boolean;
|
||||
checkPreconditions():boolean;
|
||||
|
||||
setRelated(related:BModel):void;
|
||||
setRelated(related:BModel):void;
|
||||
|
||||
setRelated(related:Collection<BModel>):void;
|
||||
setRelated(related:Collection<BModel>):void;
|
||||
|
||||
getReverseRelations(model:Model):Relation;
|
||||
getReverseRelations(model:Model):Relation;
|
||||
|
||||
destroy():void;
|
||||
}
|
||||
destroy():void;
|
||||
}
|
||||
|
||||
export class HasOne extends Relation {
|
||||
collectionType:any;
|
||||
export class HasOne extends Relation {
|
||||
collectionType:any;
|
||||
|
||||
findRelated(options:any):BModel;
|
||||
findRelated(options:any):BModel;
|
||||
|
||||
setKeyContents(keyContents:string):void;
|
||||
setKeyContents(keyContents:string):void;
|
||||
|
||||
setKeyContents(keyContents:string[]):void;
|
||||
setKeyContents(keyContents:string[]):void;
|
||||
|
||||
setKeyContents(keyContents:number):void;
|
||||
setKeyContents(keyContents:number):void;
|
||||
|
||||
setKeyContents(keyContents:number[]):void;
|
||||
setKeyContents(keyContents:number[]):void;
|
||||
|
||||
setKeyContents(keyContents:Collection<BModel>):void;
|
||||
setKeyContents(keyContents:Collection<BModel>):void;
|
||||
|
||||
onChange(model:BModel, attr:any, options:any):void;
|
||||
onChange(model:BModel, attr:any, options:any):void;
|
||||
|
||||
handleAddition(model:BModel, coll:Collection<BModel>, options:any):void;
|
||||
handleAddition(model:BModel, coll:Collection<BModel>, options:any):void;
|
||||
|
||||
handleRemoval(model:BModel, coll:Collection<BModel>, options:any):void;
|
||||
handleRemoval(model:BModel, coll:Collection<BModel>, options:any):void;
|
||||
|
||||
handleReset(coll:Collection<BModel>, options:any):void;
|
||||
handleReset(coll:Collection<BModel>, options:any):void;
|
||||
|
||||
tryAddRelated(model:BModel, coll:any, options:any):void;
|
||||
tryAddRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
addRelated(model:BModel, options:any):void;
|
||||
addRelated(model:BModel, options:any):void;
|
||||
|
||||
removeRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
export class HasMany extends Relation {
|
||||
collectionType:any;
|
||||
|
||||
findRelated(options:any):BModel;
|
||||
|
||||
setKeyContents(keyContents:string):void;
|
||||
|
||||
setKeyContents(keyContents:number):void;
|
||||
|
||||
setKeyContents(keyContents:BModel):void;
|
||||
|
||||
onChange(model:BModel, attr:any, options:any):void;
|
||||
|
||||
tryAddRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
addRelated(model:BModel, options:any):void;
|
||||
|
||||
removeRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
}
|
||||
|
||||
export class Store implements Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
on(eventName: any, callback?: any, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
|
||||
initializeRelation(model, relation, options);
|
||||
|
||||
addModelScope(scope:any):void;
|
||||
|
||||
removeModelScope(scope):void;
|
||||
|
||||
addSubModels(subModelTypes:Model, superModelType:Model):void;
|
||||
|
||||
setupSuperModel(modelType:Model):void;
|
||||
|
||||
addReverseRelation(relation:any):void;
|
||||
|
||||
addOrphanRelation(relation:any):void;
|
||||
|
||||
processOrphanRelations():void;
|
||||
|
||||
retroFitRelation(relation:Model, create:boolean):Collection<BModel>;
|
||||
|
||||
getCollection(type:Model, create:boolean):Collection<BModel>;
|
||||
|
||||
getObjectByName(name:string):any;
|
||||
|
||||
|
||||
resolveIdForItem(type:any, item:any):any;
|
||||
|
||||
static find(type:any, item:string):Model;
|
||||
|
||||
static find(type:any, item:number):Model;
|
||||
|
||||
static find(type:any, item:Model):Model;
|
||||
|
||||
static find(type:any, item:any):Model;
|
||||
|
||||
register(model:Model):void;
|
||||
|
||||
checkId(model:Model, id:any):void;
|
||||
|
||||
update(model:Model):void;
|
||||
|
||||
unregister(model:Model, collection:Collection<BModel>, options:any):void;
|
||||
|
||||
reset():void;
|
||||
|
||||
|
||||
}
|
||||
removeRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
export class HasMany extends Relation {
|
||||
collectionType:any;
|
||||
|
||||
findRelated(options:any):BModel;
|
||||
|
||||
setKeyContents(keyContents:string):void;
|
||||
|
||||
setKeyContents(keyContents:number):void;
|
||||
|
||||
setKeyContents(keyContents:BModel):void;
|
||||
|
||||
onChange(model:BModel, attr:any, options:any):void;
|
||||
|
||||
tryAddRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
addRelated(model:BModel, options:any):void;
|
||||
|
||||
removeRelated(model:BModel, coll:any, options:any):void;
|
||||
|
||||
}
|
||||
|
||||
export class Store extends EventsMixin implements Events {
|
||||
initializeRelation(model, relation, options);
|
||||
|
||||
addModelScope(scope:any):void;
|
||||
|
||||
removeModelScope(scope):void;
|
||||
|
||||
addSubModels(subModelTypes:Model, superModelType:Model):void;
|
||||
|
||||
setupSuperModel(modelType:Model):void;
|
||||
|
||||
addReverseRelation(relation:any):void;
|
||||
|
||||
addOrphanRelation(relation:any):void;
|
||||
|
||||
processOrphanRelations():void;
|
||||
|
||||
retroFitRelation(relation:Model, create:boolean):Collection<BModel>;
|
||||
|
||||
getCollection(type:Model, create:boolean):Collection<BModel>;
|
||||
|
||||
getObjectByName(name:string):any;
|
||||
|
||||
|
||||
resolveIdForItem(type:any, item:any):any;
|
||||
|
||||
static find(type:any, item:string):Model;
|
||||
|
||||
static find(type:any, item:number):Model;
|
||||
|
||||
static find(type:any, item:Model):Model;
|
||||
|
||||
static find(type:any, item:any):Model;
|
||||
|
||||
register(model:Model):void;
|
||||
|
||||
checkId(model:Model, id:any):void;
|
||||
|
||||
update(model:Model):void;
|
||||
|
||||
unregister(model:Model, collection:Collection<BModel>, options:any):void;
|
||||
|
||||
reset():void;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,79 +1,24 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-11
@@ -6,6 +6,7 @@
|
||||
// Volker Nauruhn <https://github.com/razorness>,
|
||||
// Ard Timmerman <https://github.com/confususs>,
|
||||
// J. Joe Koullas <https://github.com/jjoekoullas>
|
||||
// Julian Gonggrijp <https://github.com/jgonggrijp>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -407,20 +408,14 @@ export interface ObjectOptions extends RadioMixinOptions {
|
||||
* A base class which other classes can extend from. Object incorporates many
|
||||
* backbone conventions and utilities like initialize and Backbone.Events.
|
||||
*/
|
||||
export class Object implements CommonMixin, RadioMixin, Backbone.Events {
|
||||
export class Object extends Backbone.EventsMixin implements CommonMixin, RadioMixin, Backbone.Events {
|
||||
constructor(options?: ObjectOptions);
|
||||
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
/**
|
||||
* Faulty overgeneralization of Backbone.Events.on, for historical
|
||||
* reasons.
|
||||
*/
|
||||
on(eventName: any, callback?: any, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
|
||||
/**
|
||||
* Receives a hash of event names and functions and/or function names,
|
||||
|
||||
Vendored
+6
-11
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Backbone.Radio v0.8.3
|
||||
// Project: https://github.com/marionettejs/backbone.radio
|
||||
// Definitions by: Peter Palotas <https://github.com/alphaleonis>
|
||||
// Julian Gonggrijp <https://github.com/jgonggrijp>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -71,18 +72,12 @@ declare module "backbone" {
|
||||
stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests;
|
||||
}
|
||||
|
||||
class Channel implements Commands, Requests, Backbone.Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
class Channel extends Backbone.EventsMixin implements Commands, Requests, Backbone.Events {
|
||||
/**
|
||||
* Faulty overgeneralization of Backbone.Events.on, for historical
|
||||
* reasons.
|
||||
*/
|
||||
on(eventName: any, callback?: any, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
channelName: string;
|
||||
reset(): Channel;
|
||||
|
||||
|
||||
@@ -15,6 +15,50 @@ function test_events() {
|
||||
object.off();
|
||||
}
|
||||
|
||||
class PubSub implements Backbone.Events {
|
||||
on: Backbone.Events_On<PubSub>;
|
||||
off: Backbone.Events_Off<PubSub>;
|
||||
trigger: Backbone.Events_Trigger<PubSub>;
|
||||
bind: Backbone.Events_On<PubSub>;
|
||||
unbind: Backbone.Events_Off<PubSub>;
|
||||
|
||||
once: Backbone.Events_On<PubSub>;
|
||||
listenTo: Backbone.Events_Listen<PubSub>;
|
||||
listenToOnce: Backbone.Events_Listen<PubSub>;
|
||||
stopListening: Backbone.Events_Stop<PubSub>;
|
||||
}
|
||||
|
||||
Object.assign(PubSub.prototype, Backbone.Events);
|
||||
|
||||
function test_events_shorthands() {
|
||||
let channel1 = new PubSub();
|
||||
let channel2 = new PubSub();
|
||||
let onChange = () => alert('whatever');
|
||||
|
||||
channel1.on("alert", (eventName: string) => alert("Triggered " + eventName));
|
||||
channel1.trigger("alert", "an event");
|
||||
|
||||
channel1.once('invalid', () => { }, this);
|
||||
channel1.once('invalid', () => { });
|
||||
channel1.once({invalid: () => { }, success: () => { }}, this);
|
||||
channel1.once({invalid: () => { }, success: () => { }});
|
||||
|
||||
channel1.off("change", onChange);
|
||||
channel1.off("change");
|
||||
channel1.off(null, onChange);
|
||||
channel1.off(null, null, this);
|
||||
channel1.off();
|
||||
|
||||
channel2.listenTo(channel1, 'invalid', () => { });
|
||||
channel2.listenTo(channel1, {invalid: () => { }, success: () => { }});
|
||||
channel2.listenToOnce(channel1, 'invalid', () => { });
|
||||
channel2.listenToOnce(channel1, {invalid: () => { }, success: () => { }});
|
||||
|
||||
channel2.stopListening(channel1, 'invalid', () => { });
|
||||
channel2.stopListening(channel1, 'invalid');
|
||||
channel2.stopListening(channel1);
|
||||
}
|
||||
|
||||
class SettingDefaults extends Backbone.Model {
|
||||
|
||||
// 'defaults' could be set in one of the following ways:
|
||||
@@ -272,18 +316,22 @@ namespace v1Changes {
|
||||
var model = new Employee;
|
||||
model.once('invalid', () => { }, this);
|
||||
model.once('invalid', () => { });
|
||||
model.once({invalid: () => { }, success: () => { }}, this);
|
||||
model.once({invalid: () => { }, success: () => { }});
|
||||
}
|
||||
|
||||
function test_listenTo() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.listenTo(model, 'invalid', () => { });
|
||||
view.listenTo(model, {invalid: () => { }, success: () => { }});
|
||||
}
|
||||
|
||||
function test_listenToOnce() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.listenToOnce(model, 'invalid', () => { });
|
||||
view.listenToOnce(model, {invalid: () => { }, success: () => { }});
|
||||
}
|
||||
|
||||
function test_stopListening() {
|
||||
@@ -398,7 +446,7 @@ namespace v1Changes {
|
||||
namespace Collection {
|
||||
function test_fetch() {
|
||||
var collection = new EmployeeCollection;
|
||||
collection.fetch({
|
||||
collection.fetch({
|
||||
reset: true,
|
||||
remove: false
|
||||
});
|
||||
|
||||
Vendored
+101
-48
@@ -1,9 +1,11 @@
|
||||
// Type definitions for Backbone 1.3.3
|
||||
// Project: http://backbonejs.org/
|
||||
// https://github.com/jashkenas/backbone
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Natan Vivo <https://github.com/nvivo>
|
||||
// kenjiru <https://github.com/kenjiru>
|
||||
// jjoekoullas <https://github.com/jjoekoullas>
|
||||
// Julian Gonggrijp <https://github.com/jgonggrijp>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -91,44 +93,113 @@ declare namespace Backbone {
|
||||
[routePattern: string]: string | {(...urlParts: string[]): void};
|
||||
}
|
||||
|
||||
/**
|
||||
* DOM events (used in the events property of a View)
|
||||
*/
|
||||
interface EventsHash {
|
||||
[selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void};
|
||||
}
|
||||
|
||||
export const Events: Events;
|
||||
interface Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
/**
|
||||
* JavaScript events (used in the methods of the Events interface)
|
||||
*/
|
||||
interface EventHandler {
|
||||
(...args: any[]): void;
|
||||
}
|
||||
interface EventMap {
|
||||
[event: string]: EventHandler;
|
||||
}
|
||||
|
||||
class ModelBase implements Events {
|
||||
on(eventName: string, callback?: Function, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
on(eventName: any, callback?: any, context?: any): any
|
||||
off(eventName?: string, callback?: Function, context?: any): any
|
||||
trigger(eventName: string, ...args: any[]): any
|
||||
bind(eventName: string, callback: Function, context?: any): any
|
||||
unbind(eventName?: string, callback?: Function, context?: any): any
|
||||
once(events: string, callback: Function, context?: any): any
|
||||
listenTo(object: any, events: string, callback: Function):any
|
||||
listenToOnce(object: any, events: string, callback: Function): any
|
||||
stopListening(object?: any, events?: string, callback?: Function): any
|
||||
export const Events: Events;
|
||||
interface Events extends EventsMixin { }
|
||||
|
||||
/**
|
||||
* Helper shorthands for classes that implement the Events interface.
|
||||
* Define your class like this:
|
||||
*
|
||||
* import {
|
||||
* Events,
|
||||
* Events_On,
|
||||
* Events_Off,
|
||||
* Events_Trigger,
|
||||
* Events_Listen,
|
||||
* Events_Stop,
|
||||
* } from 'backbone';
|
||||
*
|
||||
* class YourClass implements Events {
|
||||
* on: Events_On<YourClass>;
|
||||
* off: Events_Off<YourClass>;
|
||||
* trigger: Events_Trigger<YourClass>;
|
||||
* bind: Events_On<YourClass>;
|
||||
* unbind: Events_Off<YourClass>;
|
||||
*
|
||||
* once: Events_On<YourClass>;
|
||||
* listenTo: Events_Listen<YourClass>;
|
||||
* listenToOnce: Events_Listen<YourClass>;
|
||||
* stopListening: Events_Stop<YourClass>;
|
||||
*
|
||||
* // ... (other methods)
|
||||
* }
|
||||
*
|
||||
* Object.assign(YourClass.prototype, Events); // can also use _.extend
|
||||
*
|
||||
* If you are just writing a class type declaration that doesn't already
|
||||
* extend some other base class, you can use the EventsMixin instead;
|
||||
* see below.
|
||||
*/
|
||||
interface Events_On<BaseT> {
|
||||
<T extends BaseT>(this: T, eventName: string, callback: EventHandler, context?: any): T;
|
||||
<T extends BaseT>(this: T, eventMap: EventMap, context?: any): T;
|
||||
}
|
||||
interface Events_Off<BaseT> {
|
||||
<T extends BaseT>(this: T, eventName?: string, callback?: EventHandler, context?: any): T;
|
||||
}
|
||||
interface Events_Trigger<BaseT> {
|
||||
<T extends BaseT>(this: T, eventName: string, ...args: any[]): T;
|
||||
}
|
||||
interface Events_Listen<BaseT> {
|
||||
<T extends BaseT>(this: T, object: any, events: string, callback: EventHandler): T;
|
||||
<T extends BaseT>(this: T, object: any, eventMap: EventMap): T;
|
||||
}
|
||||
interface Events_Stop<BaseT> {
|
||||
<T extends BaseT>(this: T, object?: any, events?: string, callback?: EventHandler): T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to avoid code repetition in type declarations.
|
||||
* Backbone.Events cannot be extended, hence a separate abstract
|
||||
* class with a different name. Both classes and interfaces can
|
||||
* extend from this helper class to reuse the signatures.
|
||||
*
|
||||
* For class type declarations that already extend another base
|
||||
* class, and for actual class definitions, please see the
|
||||
* Events_* interfaces above.
|
||||
*/
|
||||
abstract class EventsMixin implements Events {
|
||||
on(eventName: string, callback: EventHandler, context?: any): this;
|
||||
on(eventMap: EventMap, context?: any): this;
|
||||
off(eventName?: string, callback?: EventHandler, context?: any): this;
|
||||
trigger(eventName: string, ...args: any[]): this;
|
||||
bind(eventName: string, callback: EventHandler, context?: any): this;
|
||||
bind(eventMap: EventMap, context?: any): this;
|
||||
unbind(eventName?: string, callback?: EventHandler, context?: any): this;
|
||||
|
||||
once(events: string, callback: EventHandler, context?: any): this;
|
||||
once(eventMap: EventMap, context?: any): this;
|
||||
listenTo(object: any, events: string, callback: EventHandler): this;
|
||||
listenTo(object: any, eventMap: EventMap): this;
|
||||
listenToOnce(object: any, events: string, callback: EventHandler): this;
|
||||
listenToOnce(object: any, eventMap: EventMap): this;
|
||||
stopListening(object?: any, events?: string, callback?: EventHandler): this;
|
||||
}
|
||||
|
||||
class ModelBase extends EventsMixin {
|
||||
parse(response: any, options?: any): any;
|
||||
toJSON(options?: any): any;
|
||||
sync(...arg: any[]): JQueryXHR;
|
||||
}
|
||||
|
||||
class Model extends ModelBase {
|
||||
class Model extends ModelBase implements Events {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -229,7 +300,7 @@ declare namespace Backbone {
|
||||
matches(attrs: any): boolean;
|
||||
}
|
||||
|
||||
class Collection<TModel extends Model> extends ModelBase {
|
||||
class Collection<TModel extends Model> extends ModelBase implements Events {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -367,7 +438,7 @@ declare namespace Backbone {
|
||||
without(...values: TModel[]): TModel[];
|
||||
}
|
||||
|
||||
class Router extends EventSignatures {
|
||||
class Router extends EventsMixin implements Events {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -396,7 +467,7 @@ declare namespace Backbone {
|
||||
|
||||
var history: History;
|
||||
|
||||
class History extends EventSignatures {
|
||||
class History extends EventsMixin implements Events {
|
||||
|
||||
handlers: any[];
|
||||
interval: number;
|
||||
@@ -433,7 +504,7 @@ declare namespace Backbone {
|
||||
attributes?: {[id: string]: any};
|
||||
}
|
||||
|
||||
class View<TModel extends Model> extends EventSignatures {
|
||||
class View<TModel extends Model> extends EventsMixin implements Events {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -485,21 +556,3 @@ declare namespace Backbone {
|
||||
function noConflict(): typeof Backbone;
|
||||
var $: JQueryStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not for external use and is only here as a convenient way to
|
||||
* specify signatures for internal implementers of Backbone.Events
|
||||
*/
|
||||
declare abstract class EventSignatures implements Backbone.Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: Backbone.EventsHash): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
}
|
||||
@@ -8,73 +8,35 @@
|
||||
"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-angle-bracket-type-assertion": 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,8 @@ pdfQueue
|
||||
.on('drained', () => undefined)
|
||||
.on('removed', (job: Queue.Job) => undefined);
|
||||
|
||||
pdfQueue.setMaxListeners(42);
|
||||
|
||||
// test different process methods
|
||||
|
||||
const profileQueue = new Queue('profile');
|
||||
|
||||
Vendored
+2
-1
@@ -17,6 +17,7 @@
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as Redis from "ioredis";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
/**
|
||||
* This is the Queue constructor.
|
||||
@@ -384,7 +385,7 @@ declare namespace Bull {
|
||||
next: number;
|
||||
}
|
||||
|
||||
interface Queue<T = any> {
|
||||
interface Queue<T = any> extends EventEmitter {
|
||||
/**
|
||||
* The name of the queue
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -116,7 +116,7 @@ export namespace policies {
|
||||
onUnavailable(requestInfo: RequestInfo, consistency: types.consistencies, required: number, alive: number): DecisionInfo;
|
||||
onWriteTimeout(requestInfo: RequestInfo, consistency: types.consistencies, received: number, blockFor: number, writeType: string): DecisionInfo;
|
||||
rethrowResult(): { decision: retryDecision };
|
||||
retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
|
||||
retryResult(consistency?: types.consistencies, useCurrentHost?: boolean): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ const Memory: EnginePrototypeOrObject = {
|
||||
|
||||
const client = new Client<string>(Memory, { partition: 'cache' });
|
||||
|
||||
client.start().then(() => {});
|
||||
client.stop().then(() => {});
|
||||
|
||||
const cache = new Policy({
|
||||
expiresIn: 5000,
|
||||
}, client, 'cache');
|
||||
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ export class Client<T> implements ClientApi<T> {
|
||||
/** start() - creates a connection to the cache server. Must be called before any other method is available. */
|
||||
start(): Promise<void>;
|
||||
/** stop() - terminates the connection to the cache server. */
|
||||
stop(): void;
|
||||
stop(): Promise<void>;
|
||||
/**
|
||||
* get(key, callback) - retrieve an item from the cache engine if found where:
|
||||
* * key - a cache key object (see [ICacheKey]).
|
||||
|
||||
Vendored
+1
-1
@@ -5246,7 +5246,7 @@ declare namespace chrome.runtime {
|
||||
|
||||
export interface PortMessageEvent extends chrome.events.Event<(message: any, port: Port) => void> { }
|
||||
|
||||
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> { }
|
||||
export interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response?: any) => void) => void> { }
|
||||
|
||||
export interface ExtensionConnectEvent extends chrome.events.Event<(port: Port) => void> { }
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import co = require('co');
|
||||
|
||||
function* gen(num: number, str: string, arr: number[], obj: object, fun: () => void) {
|
||||
return num;
|
||||
}
|
||||
|
||||
co(gen, 42, 'forty-two', [42], { value: 42 }, () => {})
|
||||
.then((num: number) => {}, (err: Error) => {})
|
||||
.catch((err: Error) => {});
|
||||
|
||||
co.default(gen, 42, 'forty-two', [42], { value: 42 }, () => {})
|
||||
.then((num: number) => {}, (err: Error) => {})
|
||||
.catch((err: Error) => {});
|
||||
|
||||
co.co(gen, 42, 'forty-two', [42], { value: 42 }, () => {})
|
||||
.then((num: number) => {}, (err: Error) => {})
|
||||
.catch((err: Error) => {});
|
||||
|
||||
co.wrap(gen)(42, 'forty-two', [42], { value: 42 }, () => {})
|
||||
.then((num: number) => {}, (err: Error) => {})
|
||||
.catch((err: Error) => {});
|
||||
|
||||
// $ExpectError
|
||||
co(gen, 42, 'forty-two', [42], { value: 42 }, () => {}).then((str: string) => {});
|
||||
|
||||
// $ExpectError
|
||||
co.wrap(gen)();
|
||||
|
||||
// $ExpectError
|
||||
co.wrap(gen)('forty-two');
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for co 4.6
|
||||
// Project: https://github.com/tj/co#readme
|
||||
// Definitions by: Doniyor Aliyev <https://github.com/doniyor2109>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.1
|
||||
|
||||
type ExtractType<T> = T extends IterableIterator<infer R> ? R : never;
|
||||
|
||||
interface Co {
|
||||
<F extends (...args: any[]) => Generator>(fn: F, ...args: Parameters<F>): Promise<ExtractType<ReturnType<F>>>;
|
||||
default: Co;
|
||||
co: Co;
|
||||
wrap: <F extends (...args: any[]) => Generator>(fn: F) => (...args: Parameters<F>) => Promise<ExtractType<ReturnType<F>>>;
|
||||
}
|
||||
|
||||
declare const co: Co;
|
||||
|
||||
export = co;
|
||||
@@ -8,21 +8,16 @@
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"i18next-browser-languagedetector": [
|
||||
"i18next-browser-languagedetector/v0"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"i18next-browser-languagedetector-tests.ts"
|
||||
"co-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+22
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Cytoscape.js 3.2
|
||||
// Type definitions for Cytoscape.js 3.3
|
||||
// Project: http://js.cytoscape.org/
|
||||
// Definitions by: Fabian Schmidt and Fred Eisele <https://github.com/phreed>
|
||||
// Shenghan Gao <https://github.com/wy193777>
|
||||
@@ -464,6 +464,27 @@ declare namespace cytoscape {
|
||||
*/
|
||||
endBatch(): void;
|
||||
|
||||
/**
|
||||
* Attaches the instance to the specified container for visualisation.
|
||||
* http://js.cytoscape.org/#cy.mount
|
||||
*
|
||||
* If the core instance is headless prior to calling cy.mount(), then
|
||||
* the instance will no longer be headless and the visualisation will
|
||||
* be shown in the specified container. If the core instance is
|
||||
* non-headless prior to calling cy.mount(), then the visualisation
|
||||
* is swapped from the prior container to the specified container.
|
||||
*/
|
||||
mount(element: Element): void;
|
||||
|
||||
/**
|
||||
* Remove the instance from its current container.
|
||||
* http://js.cytoscape.org/#cy.unmount
|
||||
*
|
||||
* This function sets the instance to be headless after unmounting from
|
||||
* the current container.
|
||||
*/
|
||||
unmount(): void;
|
||||
|
||||
/**
|
||||
* A convenience function to explicitly destroy the Core.
|
||||
* http://js.cytoscape.org/#cy.destroy
|
||||
|
||||
Vendored
+1
-1
@@ -38,7 +38,7 @@ declare namespace debug {
|
||||
(formatter: any, ...args: any[]): void;
|
||||
|
||||
enabled: boolean;
|
||||
log: (v: any) => string;
|
||||
log: (...args: any[]) => any;
|
||||
namespace: string;
|
||||
extend: (namespace: string, delimiter?: string) => Debugger;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -187,7 +187,7 @@ export class ec {
|
||||
|
||||
export namespace ec {
|
||||
interface GenKeyPairOptions {
|
||||
pers: any;
|
||||
pers?: any;
|
||||
entropy: any;
|
||||
persEnc?: string;
|
||||
entropyEnc?: string;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import * as express from "express";
|
||||
|
||||
import rewrite = require("express-urlrewrite");
|
||||
|
||||
declare const app: express.Application;
|
||||
|
||||
app.use(rewrite(/^\/i(\w+)/, "/items/$1"));
|
||||
|
||||
app.use(rewrite("/:src..:dst", "/commits/$1/to/$2"));
|
||||
app.use(rewrite("/:src..:dst", "/commits/:src/to/:dst"));
|
||||
|
||||
app.use(rewrite("/js/*", "/public/assets/js/$1"));
|
||||
|
||||
app.use(rewrite("/file\\?param=:param", "/file/:param"));
|
||||
|
||||
app.use(rewrite("/path", "/anotherpath?param=some"));
|
||||
|
||||
app.get("/route/:var", rewrite("/rewritten/:var"));
|
||||
|
||||
declare const someMw: express.Handler;
|
||||
|
||||
app.get("/rewritten/:var", someMw);
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for express-urlrewrite 1.2
|
||||
// Project: https://github.com/kapouer/express-urlrewrite
|
||||
// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import * as express from "express";
|
||||
|
||||
declare function rewrite(s: string): express.Handler;
|
||||
declare function rewrite(s: string | RegExp, t: string): express.Handler;
|
||||
|
||||
export = rewrite;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"express-urlrewrite-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+7
-5
@@ -9,7 +9,7 @@
|
||||
import { Duplex } from "stream";
|
||||
|
||||
declare namespace favicons {
|
||||
interface Configuration {
|
||||
interface Configuration {
|
||||
/** Path for overriding default icons path @default "/" */
|
||||
path: string;
|
||||
/** Your application's name @default null */
|
||||
@@ -38,6 +38,8 @@ declare namespace favicons {
|
||||
version: string;
|
||||
/** Print logs to console? @default false */
|
||||
logging: boolean;
|
||||
/** Use nearest neighbor resampling to preserve hard edges on pixel art @default false */
|
||||
pixel_art: boolean;
|
||||
/**
|
||||
* Platform Options:
|
||||
* - offset - offset in percentage
|
||||
@@ -66,18 +68,18 @@ declare namespace favicons {
|
||||
}>;
|
||||
}
|
||||
|
||||
interface FavIconResponse {
|
||||
interface FavIconResponse {
|
||||
images: Array<{ name: string; contents: Buffer }>;
|
||||
files: Array<{ name: string; contents: Buffer }>;
|
||||
html: string[];
|
||||
}
|
||||
|
||||
type Callback = (error: Error | null, response: FavIconResponse) => void;
|
||||
type Callback = (error: Error | null, response: FavIconResponse) => void;
|
||||
|
||||
/** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */
|
||||
const config: Configuration;
|
||||
const config: Configuration;
|
||||
|
||||
function stream(configuration?: Configuration): Duplex;
|
||||
function stream(configuration?: Configuration): Duplex;
|
||||
}
|
||||
/**
|
||||
* Generate favicons
|
||||
|
||||
+1
-1
@@ -3188,7 +3188,7 @@ declare namespace browser.storage {
|
||||
* @param changes Object mapping each key that changed to its corresponding `storage.StorageChange` for that item.
|
||||
* @param areaName The name of the storage area (`"sync"`, `"local"` or `"managed"`) the changes are for.
|
||||
*/
|
||||
const onChanged: WebExtEvent<(changes: StorageChange, areaName: string) => void>;
|
||||
const onChanged: WebExtEvent<(changes: {[key: string]: StorageChange}, areaName: string) => void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+6
-11
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Giraffe
|
||||
// Project: https://github.com/barc/backbone.giraffe
|
||||
// Definitions by: Matt McCray <https://github.com/darthapo>
|
||||
// Julian Gonggrijp <https://github.com/jgonggrijp>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -145,18 +146,12 @@ declare namespace Giraffe {
|
||||
|
||||
namespace Contrib {
|
||||
|
||||
class Controller implements GiraffeObject, Backbone.Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any);
|
||||
on(eventMap: Backbone.EventsHash);
|
||||
class Controller extends Backbone.EventsMixin implements GiraffeObject, Backbone.Events {
|
||||
/**
|
||||
* Faulty overgeneralization of Backbone.Events.on, for historical
|
||||
* reasons.
|
||||
*/
|
||||
on(eventName: any, callback?: any, context?: any)
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any)
|
||||
trigger(eventName: string, ...args: any[])
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any)
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any)
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
|
||||
app: App;
|
||||
}
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
import * as i18next from "i18next";
|
||||
import * as LngDetector from "i18next-browser-languagedetector";
|
||||
|
||||
const options: LngDetector.DetectorOptions = {
|
||||
// order and from where user language should be detected
|
||||
order: ["querystring", "cookie", "localStorage", "navigator", "htmlTag"],
|
||||
|
||||
// keys or params to lookup language from
|
||||
lookupQuerystring: "lng",
|
||||
lookupCookie: "i18next",
|
||||
lookupLocalStorage: "i18nextLng",
|
||||
|
||||
// cache user language on
|
||||
caches: ["localStorage", "cookie"],
|
||||
excludeCacheFor: ["cimode"], // languages to not persist (cookie, localStorage)
|
||||
|
||||
// optional expire and domain for set cookie
|
||||
cookieMinutes: 10,
|
||||
cookieDomain: "myDomain",
|
||||
|
||||
// optional htmlTag with lang attribute, the default is:
|
||||
htmlTag: document.documentElement
|
||||
};
|
||||
|
||||
i18next.use(LngDetector).init({
|
||||
detection: options
|
||||
});
|
||||
|
||||
const customDetector: LngDetector.CustomDetector = {
|
||||
name: "myDetectorsName",
|
||||
|
||||
lookup(options: LngDetector.DetectorOptions) {
|
||||
// options -> are passed in options
|
||||
return "en";
|
||||
},
|
||||
|
||||
cacheUserLanguage(lng: string, options: LngDetector.DetectorOptions) {
|
||||
// options -> are passed in options
|
||||
// lng -> current language, will be called after init and on changeLanguage
|
||||
|
||||
// store it
|
||||
}
|
||||
};
|
||||
|
||||
const customDetector2: LngDetector.CustomDetector = {
|
||||
name: "myDetectorsName",
|
||||
lookup(options: LngDetector.DetectorOptions) {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const lngDetector = new LngDetector(null, options);
|
||||
|
||||
lngDetector.init(options);
|
||||
lngDetector.addDetector(customDetector);
|
||||
|
||||
i18next
|
||||
.use(lngDetector)
|
||||
.init({
|
||||
detection: options
|
||||
});
|
||||
@@ -1,65 +0,0 @@
|
||||
// Type definitions for i18next-browser-languagedetector 2.0
|
||||
// Project: http://i18next.com/, https://github.com/i18next/i18next-browser-languagedetector
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace i18nextBrowserLanguageDetector {
|
||||
interface DetectorOptions {
|
||||
/**
|
||||
* order and from where user language should be detected
|
||||
*/
|
||||
order?: Array<"querystring" | "cookie" | "localStorage" | "navigator" | "htmlTag" | string>;
|
||||
|
||||
/**
|
||||
* keys or params to lookup language from
|
||||
*/
|
||||
lookupQuerystring?: string;
|
||||
lookupCookie?: string;
|
||||
lookupLocalStorage?: string;
|
||||
|
||||
/**
|
||||
* cache user language on
|
||||
*/
|
||||
caches?: string[];
|
||||
|
||||
/**
|
||||
* languages to not persist (cookie, localStorage)
|
||||
*/
|
||||
excludeCacheFor?: string[];
|
||||
|
||||
/**
|
||||
* optional expire and domain for set cookie
|
||||
* @default 10
|
||||
*/
|
||||
cookieMinutes?: number;
|
||||
cookieDomain?: string;
|
||||
|
||||
/**
|
||||
* optional htmlTag with lang attribute
|
||||
* @default document.documentElement
|
||||
*/
|
||||
htmlTag?: HTMLElement;
|
||||
}
|
||||
|
||||
interface CustomDetector {
|
||||
name: string;
|
||||
cacheUserLanguage?(lng: string, options: DetectorOptions): void;
|
||||
lookup(options: DetectorOptions): string | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
declare class i18nextBrowserLanguageDetector {
|
||||
constructor(services?: any, options?: i18nextBrowserLanguageDetector.DetectorOptions);
|
||||
/**
|
||||
* Adds detector.
|
||||
*/
|
||||
addDetector(detector: i18nextBrowserLanguageDetector.CustomDetector): i18nextBrowserLanguageDetector;
|
||||
|
||||
/**
|
||||
* Initializes detector.
|
||||
*/
|
||||
init(options?: i18nextBrowserLanguageDetector.DetectorOptions): void;
|
||||
}
|
||||
|
||||
export = i18nextBrowserLanguageDetector;
|
||||
@@ -1,42 +0,0 @@
|
||||
import * as i18next from 'i18next';
|
||||
import LngDetector from 'i18next-browser-languagedetector';
|
||||
|
||||
const options = {
|
||||
// order and from where user language should be detected
|
||||
order: ['querystring', 'cookie', 'localStorage', 'navigator'],
|
||||
|
||||
// keys or params to lookup language from
|
||||
lookupQuerystring: 'lng',
|
||||
lookupCookie: 'i18next',
|
||||
lookupLocalStorage: 'i18nextLng',
|
||||
|
||||
// cache user language on
|
||||
caches: ['localStorage', 'cookie'],
|
||||
|
||||
// optional expire and domain for set cookie
|
||||
cookieMinutes: 10,
|
||||
cookieDomain: 'myDomain'
|
||||
};
|
||||
const myDetector = {
|
||||
name: 'myDetectorsName',
|
||||
|
||||
lookup(options: {}) {
|
||||
// options -> are passed in options
|
||||
return 'en';
|
||||
},
|
||||
|
||||
cacheUserLanguage(lng: string, options: {}) {
|
||||
// options -> are passed in options
|
||||
// lng -> current language, will be called after init and on changeLanguage
|
||||
|
||||
// store it
|
||||
}
|
||||
};
|
||||
|
||||
i18next.use(LngDetector).init({
|
||||
detection: options
|
||||
});
|
||||
|
||||
const lngDetector = new LngDetector(null, options);
|
||||
lngDetector.init(options);
|
||||
lngDetector.addDetector(myDetector);
|
||||
@@ -1,58 +0,0 @@
|
||||
// Type definitions for i18next-browser-languagedetector 0.0
|
||||
// Project: http://i18next.com/
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as i18next from "i18next";
|
||||
|
||||
declare namespace I18next {
|
||||
interface I18nextStatic extends i18nextBrowserLanguageDetector.I18nextStatic { }
|
||||
interface I18nextOptions extends i18nextBrowserLanguageDetector.I18nextOptions { }
|
||||
}
|
||||
|
||||
declare namespace i18nextBrowserLanguageDetector {
|
||||
/** Interface for Language detector options. */
|
||||
interface LanguageDetectorOptions {
|
||||
caches?: string[] | boolean;
|
||||
cookieDomain?: string;
|
||||
cookieExpirationDate?: Date;
|
||||
lookupCookie?: string;
|
||||
lookupFromPathIndex?: number;
|
||||
lookupQuerystring?: string;
|
||||
lookupSession?: string;
|
||||
order?: string[];
|
||||
}
|
||||
|
||||
/** Interface for custom detector. */
|
||||
interface CustomDetector {
|
||||
name: string;
|
||||
|
||||
// todo: Checks parameters type.
|
||||
cacheUserLanguage(lng: string, options: {}): void;
|
||||
lookup(options: {}): string;
|
||||
}
|
||||
|
||||
/** i18next options. */
|
||||
interface I18nextOptions {
|
||||
detection?: LanguageDetectorOptions;
|
||||
}
|
||||
|
||||
/** i18next interface. */
|
||||
interface I18nextStatic {
|
||||
use(module: LngDetector): I18nextStatic;
|
||||
}
|
||||
|
||||
/** i18next language detection. */
|
||||
class LngDetector {
|
||||
constructor(services?: any, options?: LanguageDetectorOptions);
|
||||
|
||||
/** Adds detector. */
|
||||
addDetector(detector: CustomDetector): LngDetector;
|
||||
|
||||
/** Initializes detector. */
|
||||
init(options?: LanguageDetectorOptions): void;
|
||||
}
|
||||
}
|
||||
|
||||
export default i18nextBrowserLanguageDetector.LngDetector;
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": [
|
||||
false
|
||||
],
|
||||
"no-empty-interface": [
|
||||
false
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for ink-spinner 2.0
|
||||
// Project: https://github.com/vadimdemedes/ink-spinner#readme
|
||||
// Definitions by: Łukasz Ostrowski <https://github.com/lukostry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Chalk } from 'chalk';
|
||||
import * as cliSpinners from 'cli-spinners';
|
||||
import { Component } from 'ink';
|
||||
|
||||
type StringifyPartial<T> = {
|
||||
[P in keyof T]?: string;
|
||||
};
|
||||
|
||||
type BooleansPartial<T> = {
|
||||
[P in keyof T]?: boolean;
|
||||
};
|
||||
|
||||
type TupleOfNumbersPartial<T> = {
|
||||
[P in keyof T]?: [number, number, number];
|
||||
};
|
||||
// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html
|
||||
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
type ChalkColorModels = Pick<Chalk, 'rgb' | 'hsl' | 'hsv' | 'hwb' | 'bgRgb' | 'bgHsl' | 'bgHsv' | 'bgHwb'>;
|
||||
type ChalkKeywordsAndHexes = Pick<Chalk, 'keyword' | 'hex' | 'bgKeyword' | 'bgHex'>;
|
||||
type ChalkCommons = Omit<Chalk, keyof ChalkColorModels | keyof ChalkKeywordsAndHexes | 'constructor' | 'level' | 'enabled'>;
|
||||
|
||||
interface SpinnerProps {
|
||||
type?: cliSpinners.SpinnerName;
|
||||
}
|
||||
|
||||
type ChalkProps = BooleansPartial<ChalkCommons>
|
||||
& StringifyPartial<ChalkKeywordsAndHexes>
|
||||
& TupleOfNumbersPartial<ChalkColorModels>;
|
||||
|
||||
declare class Spinner extends Component<SpinnerProps & ChalkProps> { }
|
||||
|
||||
export = Spinner;
|
||||
@@ -0,0 +1,10 @@
|
||||
/** @jsx h */
|
||||
import { h } from 'ink';
|
||||
import Spinner from 'ink-spinner';
|
||||
// NOTE: `import Spinner = require('ink-spinner');` will work as well.
|
||||
// If importing using ES6 default import as above,
|
||||
// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true`
|
||||
|
||||
const Demo = () => {
|
||||
return <Spinner type="line" rgb={[255, 255, 255]} />;
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"jsx": "react",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ink-spinner-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for ink-text-input 2.0
|
||||
// Project: https://github.com/vadimdemedes/ink-text-input#readme
|
||||
// Definitions by: Łukasz Ostrowski <https://github.com/lukostry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Component } from 'ink';
|
||||
|
||||
interface TextInputProps {
|
||||
focus?: boolean;
|
||||
onChange?: (value: string) => void;
|
||||
onSubmit?: (value: string) => void;
|
||||
placeholder?: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
declare class TextInput extends Component<TextInputProps> { }
|
||||
|
||||
export = TextInput;
|
||||
@@ -0,0 +1,47 @@
|
||||
/** @jsx h */
|
||||
import { h, Component } from 'ink';
|
||||
import TextInput from 'ink-text-input';
|
||||
// NOTE: `import TextInput = require('ink-text-input');` will work as well
|
||||
// For importing using ES6 default import as above,
|
||||
// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true`
|
||||
|
||||
interface QueryState {
|
||||
query: string;
|
||||
}
|
||||
|
||||
class SearchQuery extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.state = {
|
||||
query: ''
|
||||
};
|
||||
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
render(props: {}, state: QueryState) {
|
||||
return (
|
||||
<div>
|
||||
Enter your query:
|
||||
|
||||
<TextInput
|
||||
value={state.query}
|
||||
onChange={this.handleChange}
|
||||
onSubmit={this.handleSubmit}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
private handleChange(value: string) {
|
||||
this.setState({
|
||||
query: value,
|
||||
});
|
||||
}
|
||||
|
||||
private handleSubmit(value: string) {
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"jsx": "react",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ink-text-input-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+8
-7
@@ -900,7 +900,7 @@ declare global {
|
||||
q?: boolean;
|
||||
addID?: boolean;
|
||||
limit?: number;
|
||||
ignoreNull: boolean;
|
||||
ignoreNull?: boolean;
|
||||
sessionId?: any;
|
||||
aggregate?: "minmax" | "min" | "max" | "average" | "total" | "count" | "none";
|
||||
}
|
||||
@@ -1627,11 +1627,11 @@ declare global {
|
||||
removeAllListeners(event?: "ready" | "unload" | "stateChange" | "objectChange" | "message"): this;
|
||||
} // end interface Adapter
|
||||
|
||||
type ReadyHandler = () => void;
|
||||
type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void;
|
||||
type StateChangeHandler = (id: string, obj: State | null | undefined) => void;
|
||||
type MessageHandler = (obj: Message) => void;
|
||||
type UnloadHandler = (callback: EmptyCallback) => void;
|
||||
type ReadyHandler = () => void | Promise<void>;
|
||||
type ObjectChangeHandler = (id: string, obj: ioBroker.Object | null | undefined) => void | Promise<void>;
|
||||
type StateChangeHandler = (id: string, obj: State | null | undefined) => void | Promise<void>;
|
||||
type MessageHandler = (obj: Message) => void | Promise<void>;
|
||||
type UnloadHandler = (callback: EmptyCallback) => void | Promise<void>;
|
||||
|
||||
type EmptyCallback = () => void;
|
||||
type ErrorCallback = (err?: string) => void;
|
||||
@@ -1682,7 +1682,8 @@ declare global {
|
||||
type SetStateCallback = (err: string | null, id?: string) => void;
|
||||
type SetStateChangedCallback = (err: string | null, id: string, notChanged: boolean) => void;
|
||||
type DeleteStateCallback = (err: string | null, id?: string) => void;
|
||||
type GetHistoryCallback = (err: string | null, result: Array<(State & { id?: string })>, step: number, sessionId?: string) => void;
|
||||
type GetHistoryResult = Array<(State & { id?: string })>;
|
||||
type GetHistoryCallback = (err: string | null, result: GetHistoryResult, step: number, sessionId?: string) => void;
|
||||
|
||||
/** Contains the return values of readDir */
|
||||
interface ReadDirResult {
|
||||
|
||||
@@ -20,6 +20,16 @@ adapter
|
||||
;
|
||||
adapter.removeAllListeners();
|
||||
|
||||
// Test adapter constructor options
|
||||
let adapterOptions: ioBroker.AdapterOptions = {
|
||||
name: "foo",
|
||||
ready: readyHandler,
|
||||
stateChange: stateChangeHandler,
|
||||
objectChange: objectChangeHandler,
|
||||
message: messageHandler,
|
||||
unload: unloadHandler,
|
||||
};
|
||||
|
||||
function readyHandler() { }
|
||||
|
||||
function stateChangeHandler(id: string, state: ioBroker.State | null | undefined) {
|
||||
@@ -260,6 +270,8 @@ adapter.subscribeForeignStatesAsync("*").catch(handleError);
|
||||
adapter.unsubscribeStatesAsync("*").catch(handleError);
|
||||
adapter.unsubscribeForeignStatesAsync("*").catch(handleError);
|
||||
|
||||
adapter.getHistory("state.id", {}, (err, result: ioBroker.GetHistoryResult) => {});
|
||||
|
||||
// Repro from https://github.com/ioBroker/adapter-core/issues/3
|
||||
const repro1: ioBroker.ObjectChangeHandler = (id, obj) => {
|
||||
if (!obj || !obj.common) return;
|
||||
|
||||
Vendored
+2
@@ -489,6 +489,8 @@ declare namespace IORedis {
|
||||
xack(key: KeyType, group: string, ...ids: string[]): any;
|
||||
|
||||
xadd(key: KeyType, id: string, ...args: string[]): any;
|
||||
xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', count: number, ...args: string[]): any;
|
||||
xadd(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', approximate: '~', count: number, ...args: string[]): any;
|
||||
|
||||
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any;
|
||||
|
||||
|
||||
@@ -177,6 +177,8 @@ new Redis.Cluster([{
|
||||
|
||||
redis.xack('streamName', 'groupName', 'id');
|
||||
redis.xadd('streamName', '*', 'field', 'name');
|
||||
redis.xadd('streamName', 'MAXLEN', 100, '*', 'field', 'name');
|
||||
redis.xadd('streamName', 'MAXLEN', '~', 100, '*', 'field', 'name');
|
||||
redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id');
|
||||
redis.xdel('streamName', 'id');
|
||||
redis.xgroup('CREATE', 'streamName', 'groupName', '$');
|
||||
|
||||
+1
-1
@@ -34,6 +34,6 @@ interface JasmineDataDrivenTest {
|
||||
assertion: (arg0: T, arg1: U, done: () => void) => void): void;
|
||||
<T>(
|
||||
description: string,
|
||||
dataset: T[],
|
||||
dataset: T[] | Array<[T]>,
|
||||
assertion: (value: T, done: () => void) => void): void;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,13 @@ xall("A data driven test can be pending",
|
||||
}
|
||||
);
|
||||
|
||||
all("A data set must consist of array-wrapped arrays, if test expects single array input",
|
||||
[[[1, 2]], [[3, 4]], [[5, 6]]],
|
||||
(numberArray: number[]) => {
|
||||
expect(numberArray.length).toBe(2);
|
||||
}
|
||||
);
|
||||
|
||||
describe("A suite", () => {
|
||||
let a: number;
|
||||
|
||||
|
||||
Vendored
+20
-11
@@ -991,20 +991,29 @@ declare namespace jest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the result of a single call to a mock function.
|
||||
* Represents the result of a single call to a mock function with a return value.
|
||||
*/
|
||||
interface MockResult {
|
||||
/**
|
||||
* True if the function threw.
|
||||
* False if the function returned.
|
||||
*/
|
||||
isThrow: boolean;
|
||||
/**
|
||||
* The value that was either thrown or returned by the function.
|
||||
*/
|
||||
interface MockResultReturn<T> {
|
||||
type: 'return';
|
||||
value: T;
|
||||
}
|
||||
/**
|
||||
* Represents the result of a single incomplete call to a mock function.
|
||||
*/
|
||||
interface MockResultIncomplete {
|
||||
type: 'incomplete';
|
||||
value: undefined;
|
||||
}
|
||||
/**
|
||||
* Represents the result of a single call to a mock function with a thrown error.
|
||||
*/
|
||||
interface MockResultThrow {
|
||||
type: 'throw';
|
||||
value: any;
|
||||
}
|
||||
|
||||
type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
|
||||
|
||||
interface MockContext<T, Y extends any[]> {
|
||||
calls: Y[];
|
||||
instances: T[];
|
||||
@@ -1012,7 +1021,7 @@ declare namespace jest {
|
||||
/**
|
||||
* List of results of calls to the mock function.
|
||||
*/
|
||||
results: MockResult[];
|
||||
results: Array<MockResult<T>>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ interface TestApi {
|
||||
test(x: number): string;
|
||||
}
|
||||
// $ExpectType Mock<string, [number]>
|
||||
const mock12 = jest.fn<ReturnType<TestApi["test"]>, ArgsType<TestApi["test"]>>();
|
||||
const mock12 = jest.fn<ReturnType<TestApi["test"]>, jest.ArgsType<TestApi["test"]>>();
|
||||
|
||||
// $ExpectType number
|
||||
mock1('test');
|
||||
@@ -485,6 +485,19 @@ mocked.test4.mockRejectedValue(new Error());
|
||||
// $ExpectError
|
||||
mocked.test4.mockRejectedValueOnce(new Error());
|
||||
|
||||
const mockResult = jest.fn(() => 1).mock.results[0];
|
||||
switch (mockResult.type) {
|
||||
case 'return':
|
||||
mockResult.value; // $ExpectType number
|
||||
break;
|
||||
case 'incomplete':
|
||||
mockResult.value; // $ExpectType undefined
|
||||
break;
|
||||
case 'throw':
|
||||
mockResult.value; // $ExpectType any
|
||||
break;
|
||||
}
|
||||
|
||||
/* Snapshot serialization */
|
||||
|
||||
const snapshotSerializerPlugin: jest.SnapshotSerializerPlugin = {
|
||||
|
||||
Vendored
+161
-16
@@ -1,54 +1,199 @@
|
||||
// Type definitions for jsoneditor v5.19.0
|
||||
// Type definitions for jsoneditor v5.28.2
|
||||
// Project: https://github.com/josdejong/jsoneditor
|
||||
// Definitions by: Alejandro Sánchez <https://github.com/alejo90>
|
||||
// Errietta Kostala <https://github.com/errietta>
|
||||
// Adam Vigneaux <https://github.com/adamvig>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="ace" />
|
||||
|
||||
import { Ajv } from "ajv";
|
||||
|
||||
declare module 'jsoneditor' {
|
||||
export interface JSONEditorNode {
|
||||
type JSONPath = (string|number)[];
|
||||
|
||||
export interface Node {
|
||||
field: string;
|
||||
value: string;
|
||||
path: Array<string>;
|
||||
value?: string;
|
||||
path: JSONPath;
|
||||
}
|
||||
|
||||
export type JSONEditorMode = 'tree' | 'view' | 'form' | 'code' | 'text';
|
||||
|
||||
export interface NodeName {
|
||||
path: string;
|
||||
type: 'object'|'array';
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface ValidationError {
|
||||
path: JSONPath;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface Template {
|
||||
text: string;
|
||||
title: string;
|
||||
className?: string;
|
||||
field: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export type AutoCompleteCompletion = null|string[]|{startFrom: number, options: string[]};
|
||||
|
||||
export type AutoCompleteOptionsGetter = (
|
||||
text: string, path: JSONPath, input: string, editor: JSONEditor,
|
||||
) => AutoCompleteCompletion|Promise<AutoCompleteCompletion>;
|
||||
|
||||
export interface AutoCompleteOptions {
|
||||
/**
|
||||
* @default [39, 35, 9]
|
||||
*/
|
||||
confirmKeys?: number[];
|
||||
caseSensitive?: boolean;
|
||||
getOptions?: AutoCompleteOptionsGetter;
|
||||
}
|
||||
|
||||
export interface SelectionPosition {
|
||||
row: number;
|
||||
column: number;
|
||||
}
|
||||
|
||||
export interface SerializableNode {
|
||||
value: any;
|
||||
path: JSONPath;
|
||||
}
|
||||
|
||||
// Based on the API of https://github.com/Sphinxxxx/vanilla-picker
|
||||
export interface Color {
|
||||
rgba: Array<number>;
|
||||
hsla: Array<number>;
|
||||
rgbString: string;
|
||||
rgbaString: string;
|
||||
hslString: string;
|
||||
hslaString: string;
|
||||
hex: string;
|
||||
}
|
||||
|
||||
export interface JSONEditorOptions {
|
||||
ace?: AceAjax.Ace;
|
||||
ajv?: any; // Any for now, since ajv typings aren't A-Ok
|
||||
ajv?: Ajv;
|
||||
onChange?: () => void;
|
||||
onEditable?: (node: JSONEditorNode) => boolean | {field: boolean, value: boolean};
|
||||
onChangeJSON?: (json: any) => void;
|
||||
onChangeText?: (jsonString: string) => void;
|
||||
onEditable?: (node: Node) => boolean|{field: boolean, value: boolean};
|
||||
onError?: (error: Error) => void;
|
||||
onModeChange?: (newMode: JSONEditorMode, oldMode: JSONEditorMode) => void;
|
||||
onNodeName?: (nodeName: NodeName) => string|undefined;
|
||||
onValidate?: (json: any) => ValidationError[]|Promise<ValidationError[]>;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
escapeUnicode?: boolean;
|
||||
/**
|
||||
* @default false
|
||||
*/
|
||||
sortObjectKeys?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
history?: boolean;
|
||||
/**
|
||||
* @default 'tree'
|
||||
*/
|
||||
mode?: JSONEditorMode;
|
||||
modes?: Array<JSONEditorMode>;
|
||||
modes?: JSONEditorMode[];
|
||||
/**
|
||||
* @default undefined
|
||||
*/
|
||||
name?: string;
|
||||
schema?: Object;
|
||||
schemaRefs?: Object;
|
||||
schema?: object;
|
||||
schemaRefs?: object;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
search?: boolean;
|
||||
/**
|
||||
* @default 2
|
||||
*/
|
||||
indentation?: number;
|
||||
theme?: string;
|
||||
templates?: Template[];
|
||||
autocomplete?: AutoCompleteOptions;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
mainMenuBar?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
navigationBar?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
statusBar?: boolean;
|
||||
onTextSelectionChange?: (start: SelectionPosition, end: SelectionPosition, text: string) => void;
|
||||
onSelectionChange?: (start: SerializableNode, end: SerializableNode) => void;
|
||||
onEvent?: (node: Node, event: string) => void;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
colorPicker?: boolean;
|
||||
onColorPicker?: (parent: HTMLElement, color: string, onChange: (color: Color) => void) => void;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
timestampTag?: boolean;
|
||||
language?: string;
|
||||
languages?: {
|
||||
[lang: string]: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
modalAnchor?: HTMLElement;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableSort?: boolean;
|
||||
/**
|
||||
* @default true
|
||||
*/
|
||||
enableTransform?: boolean;
|
||||
/**
|
||||
* @default 100
|
||||
*/
|
||||
maxVisibleChilds?: number;
|
||||
|
||||
}
|
||||
|
||||
export default class JSONEditor {
|
||||
constructor(container: HTMLElement, options?: JSONEditorOptions, json?: Object);
|
||||
constructor(container: HTMLElement, options?: JSONEditorOptions, json?: any);
|
||||
collapseAll(): void;
|
||||
destroy(): void;
|
||||
expandAll(): void;
|
||||
focus(): void;
|
||||
set(json: Object): void;
|
||||
setMode(mode: JSONEditorMode): void;
|
||||
setName(name?: string): void;
|
||||
setSchema(schema: Object): void;
|
||||
setText(jsonString: string): void;
|
||||
get(): any;
|
||||
getMode(): JSONEditorMode;
|
||||
getName(): string;
|
||||
getName(): string|undefined;
|
||||
getNodesByRange(start: {path: JSONPath}, end: {path: JSONPath}): Array<SerializableNode>;
|
||||
getSelection(): {start: SerializableNode, end: SerializableNode};
|
||||
getText(): string;
|
||||
getTextSelection(): {start: SelectionPosition, end: SelectionPosition, text: string};
|
||||
refresh(): void;
|
||||
set(json: any): void;
|
||||
setMode(mode: JSONEditorMode): void;
|
||||
setName(name?: string): void;
|
||||
setSchema(schema: object, schemaRefs?: object): void;
|
||||
setSelection(start: {path: JSONPath}, end: {path: JSONPath}): void;
|
||||
setText(jsonString: string): void;
|
||||
setTextSelection(start: SelectionPosition, end: SelectionPosition): void;
|
||||
update(json: any): void;
|
||||
updateText(jsonString: string): void;
|
||||
|
||||
static VALID_OPTIONS: Array<string>;
|
||||
static ace: AceAjax.Ace;
|
||||
static Ajv: Ajv;
|
||||
static VanillaPicker: any;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import JSONEditor, {JSONEditorMode, JSONEditorNode, JSONEditorOptions } from 'jsoneditor';
|
||||
import * as Ajv from 'ajv';
|
||||
import JSONEditor, {JSONEditorMode, Node, JSONEditorOptions } from 'jsoneditor';
|
||||
|
||||
let options: JSONEditorOptions;
|
||||
options = {};
|
||||
options = {
|
||||
ace: ace,
|
||||
//ajv: Ajv({allErrors: true, verbose: true})
|
||||
ajv: new Ajv({allErrors: true, verbose: true}),
|
||||
onChange() {},
|
||||
onEditable(node: JSONEditorNode) {
|
||||
onEditable(node: Node) {
|
||||
return true;
|
||||
},
|
||||
onError(error: Error) {},
|
||||
@@ -23,7 +25,7 @@ options = {
|
||||
theme: 'default'
|
||||
};
|
||||
options = {
|
||||
onEditable(node: JSONEditorNode) {
|
||||
onEditable(node: Node) {
|
||||
return {field: true, value: false};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"ajv": "*"
|
||||
}
|
||||
}
|
||||
Vendored
+3
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for klaw v2.1.1
|
||||
// Type definitions for klaw v3.0.0
|
||||
// Project: https://github.com/jprichardson/node-klaw
|
||||
// Definitions by: Matthew McEachen <https://github.com/mceachen>
|
||||
// Pascal Sthamer <https://github.com/p4sca1>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -26,6 +27,7 @@ declare module "klaw" {
|
||||
fs?: any // fs or mock-fs
|
||||
filter?: (path: string) => boolean
|
||||
depthLimit?: number
|
||||
preserveSymlinks?: boolean
|
||||
}
|
||||
|
||||
type Event = "close" | "data" | "end" | "readable" | "error"
|
||||
|
||||
@@ -5,7 +5,7 @@ const path = require('path');
|
||||
|
||||
let items: klaw.Item[] = [] // files, directories, symlinks, etc
|
||||
|
||||
klaw('/some/dir')
|
||||
klaw('/some/dir', { preserveSymlinks: false })
|
||||
.on('data', function(item: klaw.Item) {
|
||||
items.push(item)
|
||||
})
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// Type definitions for Knockback.js
|
||||
// Project: http://kmalakoff.github.io/knockback/
|
||||
// Project: http://kmalakoff.github.com/knockback
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
Vendored
+1
-1
@@ -426,7 +426,7 @@ export class Interval {
|
||||
engulfs(other: Interval): boolean;
|
||||
equals(other: Interval): boolean;
|
||||
hasSame(unit: DurationUnit): boolean;
|
||||
intersection(other: Interval): Interval;
|
||||
intersection(other: Interval): Interval | null;
|
||||
isAfter(dateTime: DateTime): boolean;
|
||||
isBefore(dateTime: DateTime): boolean;
|
||||
isEmpty(): boolean;
|
||||
|
||||
@@ -140,6 +140,7 @@ i.length('years'); // $ExpectType number
|
||||
i.contains(DateTime.local(2019)); // $ExpectType boolean
|
||||
i.set({end: DateTime.local(2020)}); // $ExpectType Interval
|
||||
i.mapEndpoints((d) => d); // $ExpectType Interval
|
||||
i.intersection(i); // $ExpectType Interval | null
|
||||
|
||||
i.toISO(); // $ExpectType string
|
||||
i.toString(); // $ExpectType string
|
||||
|
||||
Vendored
+1
-1
@@ -337,7 +337,7 @@ declare module "mongoose" {
|
||||
/** Use ssl connection (needs to have a mongod server with ssl support) (default: true) */
|
||||
ssl?: boolean;
|
||||
/** Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) */
|
||||
sslValidate?: object;
|
||||
sslValidate?: boolean;
|
||||
/** Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. */
|
||||
poolSize?: number;
|
||||
/** Reconnect on error (default: true) */
|
||||
|
||||
Vendored
+6
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for moveto 1.7
|
||||
// Type definitions for moveto 1.8
|
||||
// Project: https://github.com/hsnaydd/moveTo
|
||||
// Definitions by: Rostislav Shermenyov <https://github.com/shermendev>
|
||||
// pea3nut <https://github.com/pea3nut>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class MoveTo {
|
||||
@@ -66,6 +67,10 @@ declare namespace MoveTo {
|
||||
* Ease function name
|
||||
*/
|
||||
easing?: string;
|
||||
/**
|
||||
* The container been computed and scrolled
|
||||
*/
|
||||
container?: Window | HTMLElement;
|
||||
/**
|
||||
* The function to be run after scrolling complete. Target passes as the first argument
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ const options: MoveTo.MoveToOptions = {
|
||||
tolerance: 70,
|
||||
duration: 300,
|
||||
easing: "easeOutQuart",
|
||||
container: Math.random() > 0.5 ? window : document.createElement('div'),
|
||||
callback: () => {}
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -85,7 +85,7 @@ interface MUIDataTableTextLabelsSelectedRows {
|
||||
deleteAria: string;
|
||||
}
|
||||
|
||||
interface MUIDataTableTextLabels {
|
||||
export interface MUIDataTableTextLabels {
|
||||
body: MUIDataTableTextLabelsBody;
|
||||
pagination: MUIDataTableTextLabelsPagination;
|
||||
toolbar: MUIDataTableTextLabelsToolbar;
|
||||
|
||||
@@ -1,84 +1,76 @@
|
||||
import MUIDataTable, { MUIDataTableColumnDef, MUIDataTableOptions } from 'mui-datatables';
|
||||
import MUIDataTable, { MUIDataTableOptions, MUIDataTableTextLabels } from 'mui-datatables';
|
||||
import * as React from 'react';
|
||||
|
||||
const dataSimple: string[][] = [
|
||||
['Joe James', 'Test Corp', 'Yonkers', 'NY'],
|
||||
['John Walsh', 'Test Corp', 'Hartford', 'CT'],
|
||||
['Bob Herm', 'Test Corp', 'Tampa', 'FL'],
|
||||
['James Houston', 'Test Corp', 'Dallas', 'TX']
|
||||
];
|
||||
interface Props extends MUIDataTableOptions {
|
||||
data: any;
|
||||
title: string;
|
||||
textLabels?: MUIDataTableTextLabels;
|
||||
}
|
||||
|
||||
const columnWithOptions: MUIDataTableColumnDef[] = [
|
||||
{
|
||||
name: 'Name',
|
||||
label: 'New Name',
|
||||
options: {
|
||||
display: 'true',
|
||||
filter: true,
|
||||
sort: true,
|
||||
sortDirection: 'asc',
|
||||
download: true,
|
||||
class MuiCustomTable extends React.Component<Props> {
|
||||
private readonly data: string[][] = this.props.data.map((asset: any) => Object.values(asset));
|
||||
private readonly columns = this.props.data
|
||||
.map((entry: any) => Object.keys(entry))
|
||||
.flat()
|
||||
.map((title: string) => title.toUpperCase())
|
||||
.filter((element: string, index: number, array: string[]) => array.indexOf(element) === index);
|
||||
private readonly TableOptions: MUIDataTableOptions = {
|
||||
filterType: 'checkbox',
|
||||
responsive: 'scroll',
|
||||
selectableRows: false,
|
||||
elevation: 0,
|
||||
rowsPerPageOptions: [5, 10, 20, 25, 50, 100],
|
||||
downloadOptions: {
|
||||
filename: 'filename.csv',
|
||||
separator: ','
|
||||
},
|
||||
sortFilterList: false,
|
||||
textLabels: {
|
||||
body: {
|
||||
noMatch: 'Sorry, no matching records found',
|
||||
toolTip: 'Sort',
|
||||
},
|
||||
pagination: {
|
||||
next: 'Next Page',
|
||||
previous: 'Previous Page',
|
||||
rowsPerPage: 'Rows per page:',
|
||||
displayRows: 'of',
|
||||
},
|
||||
toolbar: {
|
||||
search: 'Search',
|
||||
downloadCsv: 'Download CSV',
|
||||
print: 'Print',
|
||||
viewColumns: 'View Columns',
|
||||
filterTable: 'Filter Table',
|
||||
},
|
||||
filter: {
|
||||
all: 'All',
|
||||
title: 'FILTERS',
|
||||
reset: 'RESET',
|
||||
},
|
||||
viewColumns: {
|
||||
title: 'Show Columns',
|
||||
titleAria: 'Show/Hide Table Columns',
|
||||
},
|
||||
selectedRows: {
|
||||
text: 'rows(s) selected',
|
||||
delete: 'Delete',
|
||||
deleteAria: 'Delete Selected Rows',
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
const options: MUIDataTableOptions = {
|
||||
filterType: 'checkbox',
|
||||
responsive: 'scroll',
|
||||
selectableRows: false,
|
||||
elevation: 0,
|
||||
rowsPerPageOptions: [5, 10, 20, 25, 50, 100],
|
||||
downloadOptions: {
|
||||
filename: 'filename.csv',
|
||||
separator: ','
|
||||
},
|
||||
sortFilterList: false,
|
||||
textLabels: {
|
||||
body: {
|
||||
noMatch: 'Sorry, no matching records found',
|
||||
toolTip: 'Sort',
|
||||
},
|
||||
pagination: {
|
||||
next: 'Next Page',
|
||||
previous: 'Previous Page',
|
||||
rowsPerPage: 'Rows per page:',
|
||||
displayRows: 'of',
|
||||
},
|
||||
toolbar: {
|
||||
search: 'Search',
|
||||
downloadCsv: 'Download CSV',
|
||||
print: 'Print',
|
||||
viewColumns: 'View Columns',
|
||||
filterTable: 'Filter Table',
|
||||
},
|
||||
filter: {
|
||||
all: 'All',
|
||||
title: 'FILTERS',
|
||||
reset: 'RESET',
|
||||
},
|
||||
viewColumns: {
|
||||
title: 'Show Columns',
|
||||
titleAria: 'Show/Hide Table Columns',
|
||||
},
|
||||
selectedRows: {
|
||||
text: 'rows(s) selected',
|
||||
delete: 'Delete',
|
||||
deleteAria: 'Delete Selected Rows',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class MuiDataTable extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<MUIDataTable
|
||||
title='MUI Data Table'
|
||||
data={dataSimple}
|
||||
columns={columnWithOptions}
|
||||
options={options}
|
||||
/>
|
||||
);
|
||||
return (<MUIDataTable title={this.props.title} data={this.data} columns={this.columns} options={this.TableOptions}/>);
|
||||
}
|
||||
}
|
||||
|
||||
<MuiDataTable/>;
|
||||
const TableFruits = [
|
||||
{id: 1, name: "Apple", amount: 1},
|
||||
{id: 2, name: "Pear", amount: 2},
|
||||
{id: 3, name: "Strawberry", amount: 5},
|
||||
{id: 4, name: "Banana", amount: 7},
|
||||
{id: 5, name: "Orange", amount: 9},
|
||||
];
|
||||
|
||||
<MuiCustomTable title="Awesome Table" data={TableFruits}/>;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es2017.object",
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for natural-compare-lite 1.4
|
||||
// Project: https://github.com/litejs/natural-compare-lite
|
||||
// Definitions by: Doniyor Aliyev <https://github.com/doniyor2109>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function naturalCompare(a: string, b: string): -1 | 0 | 1;
|
||||
|
||||
export = naturalCompare;
|
||||
@@ -0,0 +1,3 @@
|
||||
import compare = require("natural-compare-lite");
|
||||
|
||||
['a', 's', 'd'].sort(compare);
|
||||
@@ -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",
|
||||
"natural-compare-lite-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for natural-compare 1.4
|
||||
// Project: https://github.com/litejs/natural-compare-lite
|
||||
// Definitions by: Doniyor Aliyev <https://github.com/doniyor2109>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function naturalCompare(a: string, b: string): -1 | 0 | 1;
|
||||
|
||||
export = naturalCompare;
|
||||
@@ -0,0 +1,3 @@
|
||||
import compare = require("natural-compare");
|
||||
|
||||
['a', 's', 'd'].sort(compare);
|
||||
@@ -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",
|
||||
"natural-compare-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+335
@@ -0,0 +1,335 @@
|
||||
// Type definitions for node-jose 1.1
|
||||
// Project: https://github.com/cisco/node-jose
|
||||
// Definitions by: Nadun Indunil <https://github.com/nadunindunil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export function canYouSee(ks: JWK.Key | JWK.KeyStore, opts: object): JWS.Verifier;
|
||||
|
||||
export namespace JWA {
|
||||
interface DecryptEncryptOptions {
|
||||
aad?: Buffer;
|
||||
adata?: Buffer;
|
||||
iv?: Buffer;
|
||||
tag?: Buffer; // Not used in encrypt
|
||||
mac?: Buffer; // Not used in encrypt
|
||||
epu?: Buffer; // encryption party info
|
||||
epv?: Buffer; // encryption party info
|
||||
kdata?: Buffer;
|
||||
epk?: Buffer; // ephemeral pub key used in ec
|
||||
enc?: string; // algorithm to use in ec
|
||||
alg?: string; // variation of enc, probably oversight in lib code
|
||||
apu?: Buffer; // agreement party info used in ec
|
||||
apv?: Buffer; // agreement party info used in ec
|
||||
p2s?: Buffer; // used in pbes
|
||||
p2c?: number; // used in pbes
|
||||
}
|
||||
|
||||
interface DeriveOptions {
|
||||
length?: number; // key length
|
||||
otherInfo?: Buffer; // info used in concatkdf
|
||||
public?: Buffer; // public key used in ecdh
|
||||
hash?: Buffer; // hash used in ecdh
|
||||
salt?: Buffer; // salt value used in hkdf
|
||||
info?: Buffer; // app identifier info used in hkdf
|
||||
}
|
||||
|
||||
interface EncryptReturn {
|
||||
data: Buffer; // The cipher text
|
||||
tag?: Buffer; // The tag used in some algorithms
|
||||
}
|
||||
|
||||
interface SignReturn {
|
||||
data: Buffer; // the data passed into the sign function
|
||||
mac: Buffer; // the signature for `data`
|
||||
}
|
||||
|
||||
interface SignVerifyOptions {
|
||||
loose?: boolean;
|
||||
}
|
||||
|
||||
interface VerifyReturn {
|
||||
data: Buffer; // the data passed into the verify function
|
||||
mac: Buffer; // the signature for `data`
|
||||
valid: boolean; // whether the signature matches the data
|
||||
}
|
||||
|
||||
function decrypt(
|
||||
alg: string,
|
||||
key: string | Buffer,
|
||||
cdata: string | Buffer,
|
||||
props?: DecryptEncryptOptions
|
||||
): Promise<Buffer>;
|
||||
|
||||
function derive(alg: string, key: string | Buffer, props?: DeriveOptions): Promise<Buffer>;
|
||||
|
||||
function digest(alg: string, data: string | Buffer, props?: any): Promise<Buffer>;
|
||||
|
||||
function encrypt(
|
||||
alg: string,
|
||||
key: string | Buffer,
|
||||
pdata: string | Buffer,
|
||||
props?: DecryptEncryptOptions
|
||||
): Promise<EncryptReturn>;
|
||||
|
||||
function sign(
|
||||
alg: string,
|
||||
key: string | Buffer,
|
||||
pdata: string | Buffer,
|
||||
props: SignVerifyOptions
|
||||
): Promise<SignReturn>;
|
||||
|
||||
function verify(
|
||||
alg: string,
|
||||
key: string | Buffer,
|
||||
pdata: string | Buffer,
|
||||
mac: string | Buffer,
|
||||
props: SignVerifyOptions
|
||||
): Promise<VerifyReturn>;
|
||||
}
|
||||
|
||||
export namespace JWE {
|
||||
function createEncrypt(keys: JWK.Key | JWK.Key[]): Encryptor;
|
||||
function createEncrypt(
|
||||
options: {
|
||||
format?: 'compact' | 'flattened';
|
||||
zip?: boolean;
|
||||
fields?: object;
|
||||
},
|
||||
key: JWK.Key
|
||||
): Encryptor;
|
||||
|
||||
function createDecrypt(key: JWK.Key | JWK.KeyStore, opts?: any): Decryptor;
|
||||
|
||||
interface Encryptor {
|
||||
update(input: any): this;
|
||||
final(): Promise<string>;
|
||||
}
|
||||
|
||||
interface Decryptor {
|
||||
decrypt(input: string): Promise<DecryptResult>;
|
||||
}
|
||||
|
||||
interface DecryptResult {
|
||||
/**
|
||||
* an array of the member names from the "protected" member
|
||||
*/
|
||||
protected: string[];
|
||||
/**
|
||||
* the decrypted content (alternate)
|
||||
*/
|
||||
plaintext: Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace JWK {
|
||||
const MODE_DECRYPT: string;
|
||||
|
||||
const MODE_ENCRYPT: string;
|
||||
|
||||
const MODE_SIGN: string;
|
||||
|
||||
const MODE_UNWRAP: string;
|
||||
|
||||
const MODE_VERIFY: string;
|
||||
|
||||
const MODE_WRAP: string;
|
||||
|
||||
function asKey(
|
||||
key: string | Buffer | object | RawKey,
|
||||
form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem'
|
||||
): Promise<Key>;
|
||||
/**
|
||||
* To import a JWK-set as a keystore
|
||||
*/
|
||||
function asKeyStore(ks: object | string): Promise<KeyStore>;
|
||||
|
||||
function createKey(kty: any, size: any, props: any): Promise<Key>;
|
||||
/**
|
||||
* To create an empty keystore
|
||||
*/
|
||||
function createKeyStore(): KeyStore;
|
||||
|
||||
function isKey(input: any): input is Key;
|
||||
|
||||
function isKeyStore(input: any): input is KeyStore;
|
||||
|
||||
type KeyUse = 'sig' | 'enc' | 'desc';
|
||||
|
||||
interface JWEEncryptor {
|
||||
update(input: any): this;
|
||||
final(): Promise<string>;
|
||||
}
|
||||
|
||||
interface RawKey {
|
||||
alg: string;
|
||||
kty: string;
|
||||
use: KeyUse;
|
||||
|
||||
// e and n make up the public key
|
||||
e: string;
|
||||
n: string;
|
||||
}
|
||||
|
||||
interface KeyStoreGetFilter {
|
||||
kty?: string;
|
||||
use?: KeyUse;
|
||||
alg?: string;
|
||||
}
|
||||
|
||||
interface KeyStoreGetOptions extends KeyStoreGetFilter {
|
||||
kid: string;
|
||||
}
|
||||
|
||||
interface KeyStore {
|
||||
/**
|
||||
* To export the public keys of a keystore as a JWK-set
|
||||
*/
|
||||
toJSON(exportPrivateKeys?: boolean): object;
|
||||
/**
|
||||
* To retrieve a key from a keystore
|
||||
*/
|
||||
get(kid: string, filter?: KeyStoreGetFilter): RawKey;
|
||||
get(options: KeyStoreGetOptions): RawKey;
|
||||
all(options?: Partial<KeyStoreGetOptions>): RawKey[];
|
||||
add(key: RawKey): Promise<Key>;
|
||||
/**
|
||||
* @param key
|
||||
* String serialization of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER
|
||||
* Buffer of a JSON JWK/(base64-encoded) PEM/(binary-encoded) DER
|
||||
* @param form
|
||||
* is either a:
|
||||
* - "json" for a JSON stringified JWK
|
||||
* - "private" for a DER encoded 'raw' private key
|
||||
* - "pkcs8" for a DER encoded (unencrypted!) PKCS8 private key
|
||||
* - "public" for a DER encoded SPKI public key (alternate to 'spki')
|
||||
* - "spki" for a DER encoded SPKI public key
|
||||
* - "pkix" for a DER encoded PKIX X.509 certificate
|
||||
* - "x509" for a DER encoded PKIX X.509 certificate
|
||||
* - "pem" for a PEM encoded of PKCS8 / SPKI / PKIX
|
||||
*/
|
||||
add(
|
||||
key: string | Buffer | Key | object,
|
||||
form?: 'json' | 'private' | 'pkcs8' | 'public' | 'spki' | 'pkix' | 'x509' | 'pem'
|
||||
): Promise<Key>;
|
||||
|
||||
generate(kty: string, size?: string | number, props?: any): Promise<Key>;
|
||||
|
||||
remove(key: Key): void;
|
||||
}
|
||||
|
||||
interface Key {
|
||||
keystore: KeyStore;
|
||||
length: number;
|
||||
kty: string;
|
||||
kid: string;
|
||||
use: KeyUse;
|
||||
alg: string;
|
||||
|
||||
toPEM(isPrivate?: boolean): string;
|
||||
toJSON(isPrivate?: boolean, excluded?: string[]): object;
|
||||
thumbprint(hash?: string): Promise<string>;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace JWS {
|
||||
function createSign(keys: JWK.Key | JWK.Key[]): Signer;
|
||||
function createSign(
|
||||
options: {
|
||||
format?: 'compact' | 'flattened';
|
||||
alg?: string;
|
||||
compact?: boolean;
|
||||
fields?: object;
|
||||
},
|
||||
key: JWK.Key | JWK.Key[]
|
||||
): Signer;
|
||||
|
||||
/**
|
||||
* Using a keystore.
|
||||
*/
|
||||
function createVerify(
|
||||
input?: string | JWK.Key | JWK.KeyStore | object,
|
||||
opts?: { allowEmbeddedKey?: boolean; algorithms?: string[]; handlers?: any }
|
||||
): Verifier;
|
||||
|
||||
interface CreateSignResult {
|
||||
signResult: object;
|
||||
}
|
||||
|
||||
interface Signer {
|
||||
update(input: Buffer | string, encoding?: string): this;
|
||||
final(): Promise<CreateSignResult>;
|
||||
}
|
||||
|
||||
interface BaseResult {
|
||||
/**
|
||||
* the combined 'protected' and 'unprotected' header members
|
||||
*/
|
||||
header: object;
|
||||
/**
|
||||
* the signed content
|
||||
*/
|
||||
payload: Buffer;
|
||||
/**
|
||||
* The key used to verify the signature
|
||||
*/
|
||||
key: JWK.Key;
|
||||
protected: string[];
|
||||
}
|
||||
|
||||
interface VerificationResult extends BaseResult {
|
||||
/**
|
||||
* the verified signature
|
||||
*/
|
||||
signature: Buffer | string;
|
||||
}
|
||||
|
||||
interface Verifier {
|
||||
verify(input: string, opts?: { allowEmbeddedKey?: boolean }): Promise<VerificationResult>;
|
||||
}
|
||||
|
||||
interface Exp {
|
||||
complete(jws: any): any;
|
||||
}
|
||||
|
||||
interface VerifyOptions {
|
||||
allowEmbeddedKey?: boolean;
|
||||
algorithms?: string[];
|
||||
handlers: { exp: boolean | Exp };
|
||||
}
|
||||
}
|
||||
|
||||
export function parse(input: Buffer | string | object): parse.ParseReturn;
|
||||
|
||||
export namespace parse {
|
||||
interface ParseReturn {
|
||||
type: 'JWS' | 'JWE';
|
||||
format: 'compact' | 'json';
|
||||
input: Buffer | string | object;
|
||||
header: object;
|
||||
perform: (ks: JWK.KeyStore) => Promise<JWE.DecryptResult> | Promise<JWS.VerificationResult>;
|
||||
}
|
||||
function compact(input: Buffer | string | object): ParseReturn;
|
||||
|
||||
function json(input: Buffer | string | object): ParseReturn;
|
||||
}
|
||||
|
||||
export namespace util {
|
||||
function asBuffer(input: string | Buffer, encoding?: string): Buffer;
|
||||
|
||||
function randomBytes(len: number): Buffer;
|
||||
|
||||
namespace base64url {
|
||||
function decode(base64url: string): string;
|
||||
|
||||
function encode(buffer: string | Buffer, encoding?: string): string;
|
||||
}
|
||||
|
||||
namespace utf8 {
|
||||
function decode(input: string): string;
|
||||
|
||||
function encode(input: string): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
import * as jose from 'node-jose';
|
||||
|
||||
const keystore = jose.JWK.createKeyStore();
|
||||
const output = keystore.toJSON();
|
||||
keystore.toJSON(true);
|
||||
|
||||
jose.JWK.asKeyStore('input').then(result => {});
|
||||
|
||||
let key = keystore.get('kid');
|
||||
|
||||
key = keystore.get('kid', { kty: 'RSA' });
|
||||
|
||||
// ... and by 'use'
|
||||
key = keystore.get('kid', { use: 'enc' });
|
||||
|
||||
// ... and by 'alg'
|
||||
key = keystore.get('kid', { alg: 'RSA-OAEP' });
|
||||
|
||||
// ... and by 'kty' and 'use'
|
||||
key = keystore.get('kid', { kty: 'RSA', use: 'enc' });
|
||||
|
||||
// same as above, but with a single {props} argument
|
||||
key = keystore.get({ kid: 'kid', kty: 'RSA', use: 'enc' });
|
||||
|
||||
let everything = keystore.all();
|
||||
|
||||
// filter by 'kid'
|
||||
everything = keystore.all({ kid: 'kid' });
|
||||
|
||||
// filter by 'kty'
|
||||
everything = keystore.all({ kty: 'RSA' });
|
||||
|
||||
// filter by 'use'
|
||||
everything = keystore.all({ use: 'enc' });
|
||||
|
||||
// filter by 'alg'
|
||||
everything = keystore.all({ alg: 'RSA-OAEP' });
|
||||
|
||||
// filter by 'kid' + 'kty' + 'alg'
|
||||
everything = keystore.all({ kid: 'kid', kty: 'RSA', alg: 'RSA-OAEP' });
|
||||
|
||||
keystore.add('input').then(result => {});
|
||||
|
||||
keystore.add('input', 'json').then(result => {
|
||||
// {result} is a jose.JWK.Key
|
||||
});
|
||||
|
||||
keystore.generate('oct', 256).then(result => {
|
||||
// {result} is a jose.JWK.Key
|
||||
});
|
||||
|
||||
// ... with properties
|
||||
const props = {
|
||||
kid: 'gBdaS-G8RLax2qgObTD94w',
|
||||
alg: 'A256GCM',
|
||||
use: 'enc'
|
||||
};
|
||||
|
||||
let key2: jose.JWK.Key;
|
||||
keystore.generate('oct', 256, props).then(result => {
|
||||
key2 = result;
|
||||
keystore.remove(key2);
|
||||
|
||||
jose.JWK.asKey(key2).then(result => {});
|
||||
|
||||
jose.JWK.asKey('input', 'json').then(result => {});
|
||||
});
|
||||
|
||||
jose.JWK.createKey('oct', 256, { alg: 'A256GCM' }).then(result => {
|
||||
const output4 = result.toJSON(true);
|
||||
result.thumbprint('hash').then(print => {});
|
||||
|
||||
const key = result;
|
||||
|
||||
jose.JWS.createSign(key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// {result} is a JSON object -- JWS using the JSON General Serialization
|
||||
});
|
||||
|
||||
jose.JWS.createSign({ format: 'flattened' }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// {result} is a JSON object -- JWS using the JSON Flattened Serialization
|
||||
});
|
||||
|
||||
jose.JWS.createSign({ format: 'compact' }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// {result} is a String -- JWS using the Compact Serialization
|
||||
});
|
||||
|
||||
jose.JWS.createSign({ alg: 'PS256' }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
jose.JWS.createSign({ fields: { cty: 'jwk+json' } }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
jose.JWS.createSign(key)
|
||||
.update('input', 'utf8')
|
||||
.final()
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
let opts = {
|
||||
algorithms: ['PS*']
|
||||
};
|
||||
jose.JWS.createVerify(key, opts)
|
||||
.verify('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
opts = {
|
||||
algorithms: ['*', '!HS*']
|
||||
};
|
||||
jose.JWS.createVerify(key, opts)
|
||||
.verify('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
const opts2 = {
|
||||
handlers: {
|
||||
exp: true
|
||||
}
|
||||
};
|
||||
|
||||
jose.JWS.createVerify(key, opts2)
|
||||
.verify('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
jose.JWE.createEncrypt(key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// {result} is a JSON Object -- JWE using the JSON General Serialization
|
||||
});
|
||||
|
||||
jose.JWE.createEncrypt({ format: 'compact' }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// {result} is a String -- JWE using the Compact Serialization
|
||||
});
|
||||
|
||||
jose.JWE.createEncrypt({ format: 'flattened' }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// {result} is a JSON Object -- JWE using the JSON Flattened Serialization
|
||||
});
|
||||
|
||||
jose.JWE.createEncrypt({ zip: true }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
jose.JWE.createEncrypt({ fields: { cty: 'jwk+json' } }, key)
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
jose.JWE.createEncrypt([key, key])
|
||||
.update('input')
|
||||
.final()
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
jose.JWE.createDecrypt(key)
|
||||
.decrypt('input')
|
||||
.then(result => {
|
||||
// ....
|
||||
});
|
||||
|
||||
const opts3 = {
|
||||
algorithms: ['dir', 'A*GCM']
|
||||
};
|
||||
jose.JWE.createDecrypt(key, opts3)
|
||||
.decrypt('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
const opts4 = {
|
||||
algorithms: ['*', '!RSA*']
|
||||
};
|
||||
jose.JWS.createVerify(key, opts4)
|
||||
.verify('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
const opts5 = {
|
||||
handlers: {
|
||||
exp: true
|
||||
}
|
||||
};
|
||||
jose.JWE.createDecrypt(key, opts5)
|
||||
.decrypt('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
});
|
||||
|
||||
jose.JWS.createVerify(keystore)
|
||||
.verify('input')
|
||||
.then(result => {
|
||||
// {result} is a Object with:
|
||||
// * header: the combined 'protected' and 'unprotected' header members
|
||||
// * payload: Buffer of the signed content
|
||||
// * signature: Buffer of the verified signature
|
||||
// * key: The key used to verify the signature
|
||||
});
|
||||
|
||||
// {key} can be:
|
||||
// * jose.JWK.Key
|
||||
// * JSON object representing a JWK
|
||||
jose.JWS.createVerify(key)
|
||||
.verify('input')
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
jose.JWS.createVerify()
|
||||
.verify('input', { allowEmbeddedKey: true })
|
||||
.then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
const verifier = jose.JWS.createVerify({ allowEmbeddedKey: true });
|
||||
|
||||
verifier.verify('input').then(result => {
|
||||
// ...
|
||||
});
|
||||
|
||||
jose.JWE.createDecrypt(keystore)
|
||||
.decrypt('input')
|
||||
.then(result => {
|
||||
// {result} is a Object with:
|
||||
// * header: the combined 'protected' and 'unprotected' header members
|
||||
// * protected: an array of the member names from the "protected" member
|
||||
// * key: Key used to decrypt
|
||||
// * payload: Buffer of the decrypted content
|
||||
// * plaintext: Buffer of the decrypted content (alternate)
|
||||
});
|
||||
|
||||
jose.util.asBuffer('input');
|
||||
|
||||
jose.util.base64url.encode('input');
|
||||
jose.util.base64url.encode('input', 'utf8');
|
||||
|
||||
jose.util.base64url.encode('input');
|
||||
|
||||
jose.util.base64url.decode('input');
|
||||
|
||||
jose.util.randomBytes(32);
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"p-throttle-tests.ts"
|
||||
"node-jose-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/sass/node-sass-middleware
|
||||
// Definitions by: Pascal Garber <http://www.jumplink.eu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+396
-42
@@ -1,56 +1,410 @@
|
||||
// Type definitions for Node Sass v3.10.1
|
||||
// Type definitions for node-sass 4.11
|
||||
// Project: https://github.com/sass/node-sass
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions by: Asana <https://github.com/pspeter3>, Chris Eppstein <https://github.com/chriseppstein>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
type ImporterReturnType = { file: string } | { contents: string } | Error | null;
|
||||
export type ImporterReturnType = { file: string } | { file?: string; contents: string } | Error | null | types.Null | types.Error;
|
||||
|
||||
interface Importer {
|
||||
(url: string, prev: string, done: (data: ImporterReturnType) => void): ImporterReturnType | void;
|
||||
/**
|
||||
* The context value is a value that is shared for the duration of a single render.
|
||||
* The context object is the implicit `this` for importers and sass functions
|
||||
* that are implemented in javascript.
|
||||
*
|
||||
* A render can be detected as asynchronous if the `callback` property is set on the context object.
|
||||
*/
|
||||
export interface Context {
|
||||
options: Options;
|
||||
callback: SassRenderCallback | undefined;
|
||||
[data: string]: any;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
file?: string;
|
||||
data?: string;
|
||||
importer?: Importer | Importer[];
|
||||
functions?: { [key: string]: Function };
|
||||
includePaths?: string[];
|
||||
indentedSyntax?: boolean;
|
||||
indentType?: string;
|
||||
indentWidth?: number;
|
||||
linefeed?: string;
|
||||
omitSourceMapUrl?: boolean;
|
||||
outFile?: string;
|
||||
outputStyle?: "compact" | "compressed" | "expanded" | "nested";
|
||||
precision?: number;
|
||||
sourceComments?: boolean;
|
||||
sourceMap?: boolean | string;
|
||||
sourceMapContents?: boolean;
|
||||
sourceMapEmbed?: boolean;
|
||||
sourceMapRoot?: string;
|
||||
export interface AsyncContext extends Context {
|
||||
callback: SassRenderCallback;
|
||||
}
|
||||
|
||||
interface SassError extends Error {
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
status: number;
|
||||
file: string;
|
||||
export interface SyncContext extends Context {
|
||||
callback: undefined;
|
||||
}
|
||||
|
||||
interface Result {
|
||||
css: Buffer;
|
||||
map: Buffer;
|
||||
stats: {
|
||||
entry: string;
|
||||
start: number;
|
||||
end: number;
|
||||
duration: number;
|
||||
includedFiles: string[];
|
||||
}
|
||||
export type AsyncImporter = (this: AsyncContext, url: string, prev: string, done: (data: ImporterReturnType) => void) => void;
|
||||
export type SyncImporter = (this: SyncContext, url: string, prev: string) => ImporterReturnType;
|
||||
export type Importer = AsyncImporter | SyncImporter;
|
||||
|
||||
// These function types enumerate up to 6 js arguments. More than that will be incorrectly marked by the compiler as an error.
|
||||
|
||||
// ** Sync Sass functions receiving fixed # of arguments ***
|
||||
export type SyncSassFn = (this: SyncContext, ...$args: types.Value[]) => types.ReturnValue;
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
// ** Sync Sass functions receiving variable # of arguments ***
|
||||
export type SyncSassVarArgFn1 = (this: SyncContext, $arg1: types.Value[]) => types.ReturnValue;
|
||||
export type SyncSassVarArgFn2 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value[]) => types.ReturnValue;
|
||||
export type SyncSassVarArgFn3 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value[]) => types.ReturnValue;
|
||||
export type SyncSassVarArgFn4 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value[]) => types.ReturnValue;
|
||||
export type SyncSassVarArgFn5 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value[]) => types.ReturnValue;
|
||||
export type SyncSassVarArgFn6 = (this: SyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value[]) => types.ReturnValue;
|
||||
|
||||
export type SassFunctionCallback = ($result: types.ReturnValue) => void;
|
||||
|
||||
// ** Async Sass functions receiving fixed # of arguments ***
|
||||
export type AsyncSassFn0 = (this: AsyncContext, cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassFn1 = (this: AsyncContext, $arg1: types.Value, cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value, cb: SassFunctionCallback) => void;
|
||||
|
||||
// *** Async Sass Functions receiving variable # of arguments ***
|
||||
export type AsyncSassVarArgFn1 = (this: AsyncContext, $arg1: types.Value[], cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassVarArgFn2 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value[], cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassVarArgFn3 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value[], cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassVarArgFn4 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value[], cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassVarArgFn5 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value[], cb: SassFunctionCallback) => void;
|
||||
export type AsyncSassVarArgFn6 = (this: AsyncContext, $arg1: types.Value, $arg2: types.Value, $arg3: types.Value, $arg4: types.Value, $arg5: types.Value, $arg6: types.Value[], cb: SassFunctionCallback) => void;
|
||||
/* tslint:enable:max-line-length */
|
||||
|
||||
export type SyncSassFunction = SyncSassFn | SyncSassVarArgFn1 | SyncSassVarArgFn2 | SyncSassVarArgFn3 | SyncSassVarArgFn4 | SyncSassVarArgFn5 | SyncSassVarArgFn6;
|
||||
|
||||
export type AsyncSassFunction = AsyncSassFn0 | AsyncSassFn1 | AsyncSassFn2 | AsyncSassFn3 | AsyncSassFn4 | AsyncSassFn5 | AsyncSassFn6
|
||||
| AsyncSassVarArgFn1 | AsyncSassVarArgFn2 | AsyncSassVarArgFn3 | AsyncSassVarArgFn4 | AsyncSassVarArgFn5 | AsyncSassVarArgFn6;
|
||||
|
||||
export type SassFunction = SyncSassFunction | AsyncSassFunction;
|
||||
|
||||
export type FunctionDeclarations<FunctionType extends SassFunction = SassFunction> = Record<string, FunctionType>;
|
||||
|
||||
export interface Options {
|
||||
file?: string;
|
||||
data?: string;
|
||||
importer?: Importer | Importer[];
|
||||
functions?: FunctionDeclarations;
|
||||
includePaths?: string[];
|
||||
indentedSyntax?: boolean;
|
||||
indentType?: string;
|
||||
indentWidth?: number;
|
||||
linefeed?: string;
|
||||
omitSourceMapUrl?: boolean;
|
||||
outFile?: string;
|
||||
outputStyle?: "compact" | "compressed" | "expanded" | "nested";
|
||||
precision?: number;
|
||||
sourceComments?: boolean;
|
||||
sourceMap?: boolean | string;
|
||||
sourceMapContents?: boolean;
|
||||
sourceMapEmbed?: boolean;
|
||||
sourceMapRoot?: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export declare function render(options: Options, callback: (err: SassError, result: Result) => any): void;
|
||||
export declare function renderSync(options: Options): Result;
|
||||
export interface SyncOptions extends Options {
|
||||
functions?: FunctionDeclarations<SyncSassFunction>;
|
||||
importer?: SyncImporter | SyncImporter[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The error object returned to javascript by sass's render methods.
|
||||
*
|
||||
* This is not the same thing as types.Error.
|
||||
*/
|
||||
export interface SassError extends Error {
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
status: number;
|
||||
file: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of successfully compiling a Sass file.
|
||||
*/
|
||||
export interface Result {
|
||||
css: Buffer;
|
||||
map: Buffer;
|
||||
stats: {
|
||||
entry: string;
|
||||
start: number;
|
||||
end: number;
|
||||
duration: number;
|
||||
includedFiles: string[];
|
||||
};
|
||||
}
|
||||
export type SassRenderCallback = (err: SassError, result: Result) => any;
|
||||
|
||||
// Note, most node-sass constructors can be invoked as a function or with a new
|
||||
// operator. The exception: the types Null and Boolean for which new is
|
||||
// forbidden.
|
||||
//
|
||||
// Because of this, the new-able object notation is used here, a class does not
|
||||
// work for these types.
|
||||
export namespace types {
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
/* tslint:disable:ban-types */
|
||||
/**
|
||||
* Values that are received from Sass as an argument to a javascript function.
|
||||
*/
|
||||
export type Value = Null | Number | String | Color | Boolean | List | Map;
|
||||
|
||||
/**
|
||||
* Values that are legal to return to Sass from a javascript function.
|
||||
*/
|
||||
export type ReturnValue = Value | Error;
|
||||
|
||||
// *** Sass Null ***
|
||||
|
||||
export interface Null {
|
||||
/**
|
||||
* This property doesn't exist, but its presence forces the typescript
|
||||
* compiler to properly type check this type. Without it, it seems to
|
||||
* allow things that aren't types.Null to match it in case statements and
|
||||
* assignments.
|
||||
*/
|
||||
readonly ___NULL___: unique symbol;
|
||||
}
|
||||
|
||||
interface NullConstructor {
|
||||
(): Null;
|
||||
NULL: Null;
|
||||
}
|
||||
export const Null: NullConstructor;
|
||||
|
||||
// *** Sass Number ***
|
||||
|
||||
export interface Number {
|
||||
getValue(): number;
|
||||
setValue(n: number): void;
|
||||
getUnit(): string;
|
||||
setUnit(u: string): void;
|
||||
}
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* Constructs a new Sass number. Does not require use of the `new` keyword.
|
||||
*/
|
||||
new(value: number, unit?: string): Number;
|
||||
/**
|
||||
* Constructs a new Sass number. Can also be used with the `new` keyword.
|
||||
*/
|
||||
(value: number, unit?: string): Number;
|
||||
}
|
||||
|
||||
export const Number: NumberConstructor;
|
||||
|
||||
// *** Sass String ***
|
||||
|
||||
export interface String {
|
||||
getValue(): string;
|
||||
setValue(s: string): void;
|
||||
}
|
||||
|
||||
interface StringConstructor {
|
||||
/**
|
||||
* Constructs a new Sass string. Does not require use of the `new` keyword.
|
||||
*/
|
||||
new (value: string): String;
|
||||
/**
|
||||
* Constructs a new Sass string. Can also be used with the `new` keyword.
|
||||
*/
|
||||
(value: string): String;
|
||||
}
|
||||
|
||||
export const String: StringConstructor;
|
||||
|
||||
// *** Sass Color ***
|
||||
|
||||
export interface Color {
|
||||
/**
|
||||
* Get the red component of the color.
|
||||
* @returns integer between 0 and 255 inclusive;
|
||||
*/
|
||||
getR(): number;
|
||||
/**
|
||||
* Set the red component of the color.
|
||||
* @returns integer between 0 and 255 inclusive;
|
||||
*/
|
||||
setR(r: number): void;
|
||||
/**
|
||||
* Get the green component of the color.
|
||||
* @returns integer between 0 and 255 inclusive;
|
||||
*/
|
||||
getG(): number;
|
||||
/**
|
||||
* Set the green component of the color.
|
||||
* @param g integer between 0 and 255 inclusive;
|
||||
*/
|
||||
setG(g: number): void;
|
||||
/**
|
||||
* Get the blue component of the color.
|
||||
* @returns integer between 0 and 255 inclusive;
|
||||
*/
|
||||
getB(): number;
|
||||
/**
|
||||
* Set the blue component of the color.
|
||||
* @param b integer between 0 and 255 inclusive;
|
||||
*/
|
||||
setB(b: number): void;
|
||||
/**
|
||||
* Get the alpha transparency component of the color.
|
||||
* @returns number between 0 and 1 inclusive;
|
||||
*/
|
||||
getA(): number;
|
||||
/**
|
||||
* Set the alpha component of the color.
|
||||
* @param a number between 0 and 1 inclusive;
|
||||
*/
|
||||
setA(a: number): void;
|
||||
}
|
||||
|
||||
interface ColorConstructor {
|
||||
/**
|
||||
* Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword.
|
||||
*
|
||||
* @param r integer 0-255 inclusive
|
||||
* @param g integer 0-255 inclusive
|
||||
* @param b integer 0-255 inclusive
|
||||
* @param [a] float 0 - 1 inclusive
|
||||
* @returns a SassColor instance.
|
||||
*/
|
||||
new (r: number, g: number, b: number, a?: number): Color;
|
||||
|
||||
/**
|
||||
* Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword.
|
||||
*
|
||||
* If a single number is passed it is assumed to be a number that contains
|
||||
* all the components which are extracted using bitmasks and bitshifting.
|
||||
*
|
||||
* @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc.
|
||||
* @returns a Sass Color instance.
|
||||
* @example
|
||||
* // Comparison with byte array manipulation
|
||||
* let a = new ArrayBuffer(4);
|
||||
* let hexN = 0xCCFF0088; // 0xAARRGGBB
|
||||
* let a32 = new Uint32Array(a); // Uint32Array [ 0 ]
|
||||
* a32[0] = hexN;
|
||||
* let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ]
|
||||
* let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ]
|
||||
* let c = sass.types.Color(hexN);
|
||||
* let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ]
|
||||
* assert.deepEqual(componentBytes, components); // does not raise.
|
||||
*/
|
||||
new (hexN: number): Color;
|
||||
|
||||
/**
|
||||
* Constructs a new Sass color given the RGBA component values. Do not invoke with the `new` keyword.
|
||||
*
|
||||
* @param r integer 0-255 inclusive
|
||||
* @param g integer 0-255 inclusive
|
||||
* @param b integer 0-255 inclusive
|
||||
* @param [a] float 0 - 1 inclusive
|
||||
* @returns a SassColor instance.
|
||||
*/
|
||||
(r: number, g: number, b: number, a?: number): Color;
|
||||
|
||||
/**
|
||||
* Constructs a new Sass color given a 4 byte number. Do not invoke with the `new` keyword.
|
||||
*
|
||||
* If a single number is passed it is assumed to be a number that contains
|
||||
* all the components which are extracted using bitmasks and bitshifting.
|
||||
*
|
||||
* @param hexN A number that is usually written in hexadecimal form. E.g. 0xff0088cc.
|
||||
* @returns a Sass Color instance.
|
||||
* @example
|
||||
* // Comparison with byte array manipulation
|
||||
* let a = new ArrayBuffer(4);
|
||||
* let hexN = 0xCCFF0088; // 0xAARRGGBB
|
||||
* let a32 = new Uint32Array(a); // Uint32Array [ 0 ]
|
||||
* a32[0] = hexN;
|
||||
* let a8 = new Uint8Array(a); // Uint8Array [ 136, 0, 255, 204 ]
|
||||
* let componentBytes = [a8[2], a8[1], a8[0], a8[3] / 255] // [ 136, 0, 255, 0.8 ]
|
||||
* let c = sass.types.Color(hexN);
|
||||
* let components = [c.getR(), c.getG(), c.getR(), c.getA()] // [ 136, 0, 255, 0.8 ]
|
||||
* assert.deepEqual(componentBytes, components); // does not raise.
|
||||
*/
|
||||
(hexN: number): Color;
|
||||
}
|
||||
|
||||
export const Color: ColorConstructor;
|
||||
|
||||
// *** Sass Boolean ***
|
||||
|
||||
export interface Boolean {
|
||||
getValue(): boolean;
|
||||
}
|
||||
|
||||
interface BooleanConstructor {
|
||||
(bool: boolean): Boolean;
|
||||
TRUE: Boolean;
|
||||
FALSE: Boolean;
|
||||
}
|
||||
|
||||
export const Boolean: BooleanConstructor;
|
||||
|
||||
// *** Sass List ***
|
||||
|
||||
export interface Enumerable {
|
||||
getValue(index: number): Value;
|
||||
setValue(index: number, value: Value): void;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export interface List extends Enumerable {
|
||||
getSeparator(): boolean;
|
||||
setSeparator(isComma: boolean): void;
|
||||
}
|
||||
interface ListConstructor {
|
||||
new (length: number, commaSeparator?: boolean): List;
|
||||
(length: number, commaSeparator?: boolean): List;
|
||||
}
|
||||
export const List: ListConstructor;
|
||||
|
||||
// *** Sass Map ***
|
||||
|
||||
export interface Map extends Enumerable {
|
||||
getKey(index: number): Value;
|
||||
setKey(index: number, key: Value): void;
|
||||
}
|
||||
interface MapConstructor {
|
||||
new (length: number): Map;
|
||||
(length: number): Map;
|
||||
}
|
||||
export const Map: MapConstructor;
|
||||
|
||||
// *** Sass Error ***
|
||||
|
||||
export interface Error {
|
||||
/**
|
||||
* This property doesn't exist, but its presence forces the typescript
|
||||
* compiler to properly type check this type. Without it, it seems to
|
||||
* allow things that aren't types.Error to match it in case statements and
|
||||
* assignments.
|
||||
*/
|
||||
readonly ___SASS_ERROR___: unique symbol;
|
||||
// why isn't there a getMessage() method?
|
||||
}
|
||||
|
||||
interface ErrorConstructor {
|
||||
/**
|
||||
* An error return value for async functions.
|
||||
* For synchronous functions, this can be returned or a standard error object can be thrown.
|
||||
*/
|
||||
new (message: string): Error;
|
||||
/**
|
||||
* An error return value for async functions.
|
||||
* For synchronous functions, this can be returned or a standard error object can be thrown.
|
||||
*/
|
||||
(message: string): Error;
|
||||
}
|
||||
export const Error: ErrorConstructor;
|
||||
|
||||
/* eslint-enable @typescript-eslint/ban-types */
|
||||
/* tslint:enable:ban-types */
|
||||
}
|
||||
|
||||
// *** Top level Constants ***
|
||||
|
||||
export const NULL: types.Null;
|
||||
export const TRUE: types.Boolean;
|
||||
export const FALSE: types.Boolean;
|
||||
export const info: string;
|
||||
export function render(options: Options, callback: SassRenderCallback): void;
|
||||
export function renderSync(options: SyncOptions): Result;
|
||||
|
||||
@@ -1,48 +1,193 @@
|
||||
import * as sass from 'node-sass';
|
||||
|
||||
sass.render({
|
||||
file: '/path/to/myFile.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
importer: function(url, prev, done) {
|
||||
someAsyncFunction(url, prev, function(result) {
|
||||
if (result == null) {
|
||||
// return null to opt out of handling this path
|
||||
// compiler will fall to next importer in array (or its own default)
|
||||
return null;
|
||||
}
|
||||
// only one of them is required, see section Sepcial Behaviours.
|
||||
done({ file: result.path });
|
||||
done({ contents: result.data });
|
||||
});
|
||||
},
|
||||
includePaths: ['lib/', 'mod/'],
|
||||
outputStyle: 'compressed'
|
||||
}, function(error, result) { // node-style callback from v3.0.0 onwards
|
||||
console.log(sass.info);
|
||||
|
||||
const syncImporter: sass.SyncImporter = function(url, prev) {
|
||||
if (url.startsWith('!')) {
|
||||
return sass.NULL;
|
||||
}
|
||||
if (url.endsWith('?')) {
|
||||
return sass.types.Error("cannot question mark");
|
||||
}
|
||||
console.log(typeof this.callback); // "undefined"
|
||||
return { file: [prev, url].join('/') };
|
||||
};
|
||||
|
||||
const asyncImporter: sass.AsyncImporter = function(url, prev, done) {
|
||||
if (url.startsWith('!')) {
|
||||
// shouldn't really call twice, just checking for compiler validity
|
||||
done(null);
|
||||
done(sass.NULL);
|
||||
}
|
||||
if (url.endsWith('?')) {
|
||||
// shouldn't really call twice, just checking for compiler validity
|
||||
done(new sass.types.Error('Cannot accept this file'));
|
||||
done(new Error('Cannot accept this file'));
|
||||
} else {
|
||||
console.log(this.options.file); // "string"
|
||||
console.log(typeof this.callback); // "function"
|
||||
done({ file: [prev, url].join('/') });
|
||||
}
|
||||
};
|
||||
|
||||
const anotherAsyncImporter: sass.AsyncImporter = (url, prev, done) => {
|
||||
someAsyncFunction(url, prev, (result) => {
|
||||
if (result == null) {
|
||||
// return null to opt out of handling this path
|
||||
// compiler will fall to next importer in array (or its own default)
|
||||
done(null);
|
||||
}
|
||||
// only one of them is required, see section Special Behaviors.
|
||||
done({ file: result.path });
|
||||
done({ contents: result.data });
|
||||
});
|
||||
};
|
||||
|
||||
const handleAsyncResult: sass.SassRenderCallback = (error, result) => { // node-style callback from v3.0.0 onwards
|
||||
if (error) {
|
||||
console.log(error.status, error.column, error.message, error.line);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
console.log(result.stats);
|
||||
console.log(result.css.toString());
|
||||
console.log(result.map.toString());
|
||||
// or better
|
||||
console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const syncFunction: Record<string, sass.SyncSassFn> = {
|
||||
"pow($base, $exp)"($base, $exp) {
|
||||
console.log(this.options.file); // "string"
|
||||
console.log(typeof this.callback); // "undefined"
|
||||
if ($base instanceof sass.types.Number && $exp instanceof sass.types.Number) {
|
||||
if ($base.getUnit() !== "" || $exp.getUnit() !== "") {
|
||||
throw new Error("Cannot have units in an exponent");
|
||||
}
|
||||
return new sass.types.Number(Math.pow($base.getValue(), $exp.getValue()));
|
||||
} else {
|
||||
throw new Error("Number expected");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const syncVarArg: Record<string, sass.SyncSassVarArgFn3> = {
|
||||
"add-all($n1, $n2, $ns...)"($n1, $n2, $ns) {
|
||||
if (!($n1 instanceof sass.types.Number)) {
|
||||
throw new Error("Expected a number");
|
||||
}
|
||||
if (!($n2 instanceof sass.types.Number)) {
|
||||
throw new Error("Expected a number");
|
||||
}
|
||||
const unit = $n1.getUnit();
|
||||
if ($n2.getUnit() !== unit) {
|
||||
throw new Error("units don't match");
|
||||
}
|
||||
let accum = $n1.getValue() + $n2.getValue();
|
||||
$ns.forEach(($n) => {
|
||||
if (!($n instanceof sass.types.Number)) {
|
||||
throw new Error("Expected a number");
|
||||
}
|
||||
if ($n.getUnit() !== unit) {
|
||||
throw new Error("units don't match");
|
||||
}
|
||||
accum = accum + $n.getValue();
|
||||
});
|
||||
return sass.types.Number(accum, unit);
|
||||
}
|
||||
};
|
||||
|
||||
const syncFunctions: Record<string, sass.SyncSassFunction> = {...syncFunction, ...syncVarArg};
|
||||
|
||||
const asyncFunction: Record<string, sass.AsyncSassFn2> = {
|
||||
"pow-async($base, $exp)"($base, $exp, done) {
|
||||
console.log(this.options.file); // "string"
|
||||
console.log(typeof this.callback); // "function"
|
||||
if ($base instanceof sass.types.Number && $exp instanceof sass.types.Number) {
|
||||
if ($base.getUnit() !== "" || $exp.getUnit() !== "") {
|
||||
done(new sass.types.Error("Cannot have units in an exponent"));
|
||||
}
|
||||
done(new sass.types.Number(Math.pow($base.getValue(), $exp.getValue())));
|
||||
} else {
|
||||
done(new sass.types.Error("Number expected"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const asyncVarArg: Record<string, sass.AsyncSassVarArgFn3> = {
|
||||
"add-all-async($n1, $n2, $ns...)"($n1, $n2, $ns, done) {
|
||||
if (!($n1 instanceof sass.types.Number)) {
|
||||
done(new sass.types.Error("Expected a number"));
|
||||
return;
|
||||
}
|
||||
if (!($n2 instanceof sass.types.Number)) {
|
||||
done(new sass.types.Error("Expected a number"));
|
||||
return;
|
||||
}
|
||||
const unit = $n1.getUnit();
|
||||
if ($n2.getUnit() !== unit) {
|
||||
done(new sass.types.Error("units don't match"));
|
||||
return;
|
||||
}
|
||||
let accum = $n1.getValue() + $n2.getValue();
|
||||
for (const $n of $ns) {
|
||||
if (!($n instanceof sass.types.Number)) {
|
||||
done(new sass.types.Error("Expected a number"));
|
||||
return;
|
||||
}
|
||||
if ($n.getUnit() !== unit) {
|
||||
done(new sass.types.Error("units don't match"));
|
||||
return;
|
||||
}
|
||||
accum = accum + $n.getValue();
|
||||
}
|
||||
done(sass.types.Number(accum, unit));
|
||||
}
|
||||
};
|
||||
|
||||
const asyncFunctions: Record<string, sass.AsyncSassFunction> = {...asyncFunction, ...asyncVarArg};
|
||||
|
||||
const functions: sass.FunctionDeclarations = {...syncFunctions, ...asyncFunctions};
|
||||
|
||||
sass.render({
|
||||
file: '/path/to/myFile.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
functions,
|
||||
importer: [anotherAsyncImporter, asyncImporter, syncImporter],
|
||||
includePaths: ['lib/', 'mod/'],
|
||||
outputStyle: 'compressed'
|
||||
}, handleAsyncResult);
|
||||
|
||||
// OR
|
||||
|
||||
sass.render({
|
||||
file: '/path/to/myFile.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
importer: asyncImporter,
|
||||
includePaths: ['lib/', 'mod/'],
|
||||
outputStyle: 'compressed'
|
||||
}, handleAsyncResult);
|
||||
|
||||
// OR
|
||||
|
||||
sass.render({
|
||||
file: '/path/to/myFile.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
importer: syncImporter,
|
||||
includePaths: ['lib/', 'mod/'],
|
||||
outputStyle: 'compressed'
|
||||
}, handleAsyncResult);
|
||||
|
||||
// OR
|
||||
|
||||
const result = sass.renderSync({
|
||||
file: '/path/to/file.scss',
|
||||
data: 'body{background:blue; a{color:black;}}',
|
||||
outputStyle: 'compressed',
|
||||
functions: syncFunctions,
|
||||
outFile: '/to/my/output.css',
|
||||
sourceMap: true, // or an absolute or relative (to outFile) path
|
||||
sourceMapRoot: '.',
|
||||
importer: function(url, prev) {
|
||||
if (url.startsWith('!')) {
|
||||
return new Error('Cannot accept this file');
|
||||
}
|
||||
return { file: [prev, url].join('/') };
|
||||
},
|
||||
importer: syncImporter,
|
||||
});
|
||||
|
||||
console.log(result.css);
|
||||
@@ -50,6 +195,104 @@ console.log(result.map);
|
||||
console.log(result.stats);
|
||||
|
||||
function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void { }
|
||||
function someSyncFunction(url: string, prev: string): { path: string; data: string } {
|
||||
return null;
|
||||
|
||||
function sameType<V extends sass.types.Value>(v1: V, v2: V): boolean {
|
||||
return v1.constructor === v2.constructor;
|
||||
}
|
||||
|
||||
// function-based Constructors and instance methods for types
|
||||
const true1 = sass.types.Boolean(true);
|
||||
true1.getValue(); // true
|
||||
const true2 = sass.types.Boolean.TRUE;
|
||||
const true3 = sass.TRUE;
|
||||
sameType(true2, true3);
|
||||
true2 === true3; // true
|
||||
const false1 = sass.types.Boolean(false);
|
||||
const false2 = sass.types.Boolean.FALSE;
|
||||
const false3 = sass.FALSE;
|
||||
false2 === false3; // true
|
||||
false1.getValue(); // false
|
||||
const null1 = sass.types.Null();
|
||||
const null2 = sass.types.Null.NULL;
|
||||
const null3 = sass.NULL;
|
||||
sameType(null2, null3);
|
||||
null1 === null2; // true
|
||||
null1 === null3; // true
|
||||
const ident = sass.types.String("x");
|
||||
ident.getValue(); // 'x'
|
||||
const stringQuoted = sass.types.String("'x'");
|
||||
stringQuoted.getValue(); // '\'x\''
|
||||
const number = sass.types.Number(5);
|
||||
number.getUnit(); // ""
|
||||
number.getValue(); // 5
|
||||
const dimension = sass.types.Number(5, "px");
|
||||
dimension.getUnit(); // "px"
|
||||
const redOpaque = sass.types.Color(240, 15, 0);
|
||||
redOpaque.getR(); // 240
|
||||
redOpaque.getG(); // 15
|
||||
redOpaque.getB(); // 0
|
||||
redOpaque.getA(); // 1
|
||||
const redTranslucent = sass.types.Color(240, 15, 0, 0.5);
|
||||
redTranslucent.getA(); // 0.5
|
||||
const redOpaque2 = sass.types.Color(0xF00F00FF);
|
||||
redOpaque2.getR(); // 240
|
||||
redOpaque2.getG(); // 15
|
||||
redOpaque2.getB(); // 0
|
||||
redOpaque2.getA(); // 1
|
||||
const redTranslucent2 = sass.types.Color(0xF00F007F);
|
||||
redTranslucent.getA(); // 0.5
|
||||
const spaceList1 = sass.types.List(1);
|
||||
spaceList1.getLength(); // 1
|
||||
spaceList1.getSeparator(); // false
|
||||
spaceList1.setValue(0, ident);
|
||||
spaceList1.setValue(0, true1);
|
||||
spaceList1.setValue(0, false1);
|
||||
spaceList1.setValue(0, null1);
|
||||
spaceList1.setValue(0, dimension);
|
||||
spaceList1.setValue(0, redOpaque);
|
||||
spaceList1.getValue(0) === redOpaque; // true
|
||||
const spaceList2 = sass.types.List(1, false);
|
||||
spaceList2.setValue(0, sass.types.String("s"));
|
||||
const commaList1 = sass.types.List(2, true);
|
||||
commaList1.getLength(); // 2
|
||||
commaList1.getSeparator(); // true (it's a comma)
|
||||
commaList1.setValue(0, spaceList1);
|
||||
commaList1.setValue(2, spaceList2);
|
||||
const map1 = sass.types.Map(2);
|
||||
map1.getLength(); // 2
|
||||
map1.setKey(0, ident);
|
||||
map1.setValue(0, spaceList1);
|
||||
ident === map1.getKey(0); // true
|
||||
spaceList1 === map1.getValue(1); // true
|
||||
sameType(ident, map1.getKey(0)); // true
|
||||
const error = new sass.types.Error("message");
|
||||
|
||||
function valuesOf(enumerable: sass.types.Enumerable): sass.types.Value[] {
|
||||
const values = new Array<sass.types.Value>();
|
||||
for (let i = 0; i < enumerable.getLength(); i++) {
|
||||
values.push(enumerable.getValue(i));
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
let arr = valuesOf(map1);
|
||||
console.dir(arr);
|
||||
arr = valuesOf(commaList1);
|
||||
console.dir(arr);
|
||||
|
||||
// new-based Constructors
|
||||
// boolean and null raise a runtime error if constructed with new.
|
||||
// const newTrue = new sass.types.Boolean(true);
|
||||
// const newFalse = new sass.types.Boolean(false);
|
||||
// const newNull = new sass.types.Null();
|
||||
const newIdent = new sass.types.String("x");
|
||||
const newNumber = new sass.types.Number(5);
|
||||
const newDimension = new sass.types.Number(5, "px");
|
||||
const newRedOpaque = new sass.types.Color(240, 15, 0);
|
||||
const newRedTranslucent = new sass.types.Color(240, 15, 0, 0.5);
|
||||
const newRedOpaque2 = new sass.types.Color(0xF00F00FF);
|
||||
const newSpaceList1 = new sass.types.List(1);
|
||||
const newSpaceList2 = new sass.types.List(1, false);
|
||||
const newCommaList1 = new sass.types.List(2, true);
|
||||
const newMap1 = new sass.types.Map(2);
|
||||
const newError = new sass.types.Error("message");
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
|
||||
@@ -1,79 +1,9 @@
|
||||
{
|
||||
"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
|
||||
// We don't want to export the Constructor interfaces
|
||||
// and I can't figure out how to disable this lint using
|
||||
// `export {}`
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for npm-registry-package-info 1.0
|
||||
// Project: https://github.com/kgryte/npm-registry-package-info#readme
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace pkginfo {
|
||||
interface Options {
|
||||
/** Boolean indicating whether to return only the latest package information from a registry. */
|
||||
latest?: boolean;
|
||||
/** Array of package names (required). */
|
||||
packages: string[];
|
||||
/** Registry port. Default: 443 (HTTPS) or 80 (HTTP). */
|
||||
port?: number;
|
||||
/** Registry protocol. Default: 'https'. */
|
||||
protocol?: 'http' | 'https';
|
||||
/** Registry. Default: 'registry.npmjs.org'. */
|
||||
registry?: string;
|
||||
}
|
||||
|
||||
interface Data {
|
||||
data: any;
|
||||
meta: {
|
||||
failure: number;
|
||||
success: number;
|
||||
total: number;
|
||||
};
|
||||
}
|
||||
|
||||
type Callback = (error: Error | null, data: Data) => void;
|
||||
|
||||
function factory(opts: Options, callback: Callback): () => void;
|
||||
}
|
||||
|
||||
declare function pkginfo(opts: pkginfo.Options, callback: pkginfo.Callback): void;
|
||||
|
||||
export = pkginfo;
|
||||
@@ -0,0 +1,21 @@
|
||||
import pkginfo = require('npm-registry-package-info');
|
||||
|
||||
const opts: pkginfo.Options = {
|
||||
latest: true,
|
||||
packages: ['dstructs-array', 'flow-map', 'utils-merge2'],
|
||||
port: 80,
|
||||
protocol: 'http',
|
||||
registry: 'my.favorite.npm/registry',
|
||||
};
|
||||
|
||||
pkginfo(opts, (error, data) => {
|
||||
data; // $ExpectType Data
|
||||
});
|
||||
|
||||
const pkgs = ['dstructs-matrix', 'compute-stdev', 'compute-variance'];
|
||||
|
||||
const get = pkginfo.factory({ packages: pkgs }, (error, data) => {
|
||||
data; // $ExpectType Data
|
||||
});
|
||||
|
||||
get();
|
||||
@@ -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",
|
||||
"npm-registry-package-info-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-2
@@ -167,8 +167,8 @@ declare namespace NPM {
|
||||
Conf: ConfigStatic;
|
||||
defs: ConfigDefs;
|
||||
|
||||
get(setting: string): string;
|
||||
set(setting: string, value: string): void;
|
||||
get(setting: string): any;
|
||||
set(setting: string, value: any): void;
|
||||
|
||||
loadPrefix(cb: ErrorCallback): void;
|
||||
loadCAFile(caFilePath: string, cb: ErrorCallback): void;
|
||||
|
||||
@@ -22,4 +22,6 @@ npm.load({}, function (er) {
|
||||
npm.on("log", function (message: string) {
|
||||
console.log(message);
|
||||
});
|
||||
|
||||
npm.config.set('audit', false);
|
||||
})
|
||||
|
||||
Vendored
+391
-2144
File diff suppressed because it is too large
Load Diff
Vendored
+391
-2144
File diff suppressed because it is too large
Load Diff
Vendored
-47
@@ -1,47 +0,0 @@
|
||||
// Type definitions for p-throttle 1.1
|
||||
// Project: https://github.com/sindresorhus/p-throttle#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = pThrottle;
|
||||
|
||||
declare function pThrottle<R>(fn: () => PromiseLike<R> | R, limit: number, interval: number): (() => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1>(fn: (arg1: T1) => PromiseLike<R> | R, limit: number, interval: number): ((arg1: T1) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2>(fn: (arg1: T1, arg2: T2) => PromiseLike<R> | R, limit: number, interval: number): ((arg1: T1, arg2: T2) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3>(fn: (arg1: T1, arg2: T2, arg3: T3) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4, T5>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4, T5, T6>(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4, T5, T6, T7>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4, T5, T6, T7, T8>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
|
||||
fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => PromiseLike<R> | R,
|
||||
limit: number,
|
||||
interval: number): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => Promise<R>) & { abort(): void; };
|
||||
declare function pThrottle<R>(fn: (...args: any[]) => PromiseLike<R> | R, limit: number, interval: number): ((...args: any[]) => Promise<R>) & { abort(): void; };
|
||||
|
||||
declare namespace pThrottle {
|
||||
class AbortError extends Error {
|
||||
readonly name: 'AbortError';
|
||||
|
||||
constructor();
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import pThrottle = require('p-throttle');
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
const throttled = pThrottle((i: number) => {
|
||||
const secDiff = ((Date.now() - now) / 1000).toFixed();
|
||||
return Promise.resolve(`${i}: ${secDiff}s`);
|
||||
}, 2, 1000);
|
||||
|
||||
for (let i = 1; i <= 6; i++) {
|
||||
throttled(i).then(res => {
|
||||
const str: string = res;
|
||||
});
|
||||
}
|
||||
|
||||
throttled.abort();
|
||||
|
||||
pThrottle(() => true, 2, 3).abort();
|
||||
pThrottle(() => true, 2, 3)();
|
||||
pThrottle((n: number, s: string) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string) => true, 2, 3)(1, 's');
|
||||
pThrottle((n: number, s: string, b: boolean) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean) => true, 2, 3)(1, 's', true);
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number) => true, 2, 3)(1, 's', true, 1);
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2, 3)(1, 's', true, 1, 's');
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2, 3)(1, 's', true, 1, 's', false);
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1);
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2);
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2, 3);
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2, 3).abort();
|
||||
pThrottle((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2, 3)(1, 's', true, 1, 's', false, 1, 2, 3, 4);
|
||||
pThrottle(
|
||||
(n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true,
|
||||
2,
|
||||
3).abort();
|
||||
pThrottle(
|
||||
(n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true,
|
||||
2,
|
||||
3)(1, 's', true, 1, 's', false, 1, 2, 3, 4, 'as');
|
||||
|
||||
throw new pThrottle.AbortError();
|
||||
Vendored
+1
-1
@@ -3,5 +3,5 @@
|
||||
// Definitions by: Jack Works <https://github.com/Jack-Works>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function parse(value: string): [number, string];
|
||||
declare function parse(value: string | number): [number, string];
|
||||
export = parse;
|
||||
|
||||
@@ -2,3 +2,7 @@ import parse = require('parse-unit');
|
||||
const [number, length] = parse('10px');
|
||||
number === 50;
|
||||
length === 'px';
|
||||
|
||||
parse(10).length === 2;
|
||||
parse(10)[0] === 10;
|
||||
parse(10)[1] === '';
|
||||
|
||||
Vendored
+8
-3
@@ -44,7 +44,7 @@ declare class Pikaday {
|
||||
* can optionally be passed as the second parameter to prevent triggering
|
||||
* of the onSelect callback, allowing the date to be set silently.
|
||||
*/
|
||||
setDate(date: string | Date, preventOnSelect?: boolean): void;
|
||||
setDate(date: string | Date | null, preventOnSelect?: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns a Moment.js object for the selected date (Moment must be
|
||||
@@ -101,13 +101,13 @@ declare class Pikaday {
|
||||
* Update the range start date. For using two Pikaday instances to
|
||||
* select a date range.
|
||||
*/
|
||||
setStartRange(date: Date): void;
|
||||
setStartRange(date: Date | null): void;
|
||||
|
||||
/**
|
||||
* Update the range end date. For using two Pikaday instances to select
|
||||
* a date range.
|
||||
*/
|
||||
setEndRange(date: Date): void;
|
||||
setEndRange(date: Date | null): void;
|
||||
|
||||
/**
|
||||
* Update the HTML.
|
||||
@@ -138,6 +138,11 @@ declare class Pikaday {
|
||||
* Hide the picker and remove all event listeners - no going back!
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Clear and reset the date
|
||||
*/
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
// merge the Pikaday class declaration with a module
|
||||
|
||||
@@ -31,6 +31,8 @@ new Pikaday({field: $('#datepicker')[0]});
|
||||
picker.getDate();
|
||||
picker.setDate('2015-01-01');
|
||||
picker.setDate('2015-01-01', true);
|
||||
picker.setDate(null);
|
||||
picker.setDate(null, true);
|
||||
picker.getMoment();
|
||||
picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'));
|
||||
picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'), true);
|
||||
@@ -45,11 +47,14 @@ new Pikaday({field: $('#datepicker')[0]});
|
||||
picker.setMinDate(null);
|
||||
picker.setMaxDate(null);
|
||||
picker.setStartRange(new Date());
|
||||
picker.setStartRange(null);
|
||||
picker.setEndRange(new Date());
|
||||
picker.setEndRange(null);
|
||||
picker.isVisible();
|
||||
picker.show();
|
||||
picker.adjustPosition();
|
||||
picker.hide();
|
||||
picker.clear();
|
||||
picker.destroy();
|
||||
})();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user