mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
+5
-5
@@ -644,7 +644,7 @@
|
||||
/types/connect-mongo/ @Syati
|
||||
/types/connect-mongodb-session/ @NattapongSiri
|
||||
/types/connect-pg-simple/ @pasieronen
|
||||
/types/connect-redis/ @xstoudi @morcerf
|
||||
/types/connect-redis/ @xstoudi
|
||||
/types/connect-slashes/ @samherrmann
|
||||
/types/connect-timeout/ @cyrilschumacher
|
||||
/types/consola/ @Jungwoo-An
|
||||
@@ -3691,8 +3691,8 @@
|
||||
/types/rdflib/ @cenotelie
|
||||
/types/re-base/ @jordandrako
|
||||
/types/reach__router/ @kingdaro
|
||||
/types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz
|
||||
/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei
|
||||
/types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz
|
||||
/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei
|
||||
/types/react-adal/ @dkorolev1
|
||||
/types/react-albus/ @sseppola @conradreuter @kuirak
|
||||
/types/react-alert/v2/ @ssyrell
|
||||
@@ -3833,7 +3833,7 @@
|
||||
/types/react-json/ @spielc
|
||||
/types/react-json-pretty/ @LKay
|
||||
/types/react-json-tree/ @gnestor
|
||||
/types/react-jsonschema-form/ @iamdanfox @iplus26 @KurtPreston @phbou72 @LucianBuzzo @sthenault @sbusch
|
||||
/types/react-jsonschema-form/ @iamdanfox @iplus26 @phbou72 @LucianBuzzo @sthenault @sbusch
|
||||
/types/react-jss/ @eps1lon
|
||||
/types/react-lazyload/ @m0a
|
||||
/types/react-lazylog/ @benjaminRomano
|
||||
@@ -4057,7 +4057,7 @@
|
||||
/types/reactable/ @spielc
|
||||
/types/reactcss/ @chrisgervang @LKay
|
||||
/types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva
|
||||
/types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @KurtPreston @timc13 @patrickrgaffney @prabodht
|
||||
/types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @timc13 @patrickrgaffney @prabodht
|
||||
/types/read/ @timjk
|
||||
/types/read-chunk/ @crispybee
|
||||
/types/read-package-tree/ @mgroenhoff
|
||||
|
||||
@@ -46,6 +46,7 @@ npm-debug.log
|
||||
.settings/launch.json
|
||||
.vs
|
||||
.vscode
|
||||
.history
|
||||
|
||||
# yarn
|
||||
yarn.lock
|
||||
|
||||
@@ -336,3 +336,6 @@ This project is licensed under the MIT license.
|
||||
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) Are packages being published to npm in less than 10,000 seconds on average?
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Has typescript-bot been active on DefinitelyTyped in the last two hours?
|
||||
|
||||
+25
-1
@@ -144,6 +144,12 @@
|
||||
"sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "@babel/parser",
|
||||
"typingsPackageName": "babel__parser",
|
||||
"sourceRepoURL": "https://github.com/babel/babel",
|
||||
"asOfVersion": "7.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "BabylonJS",
|
||||
"typingsPackageName": "babylonjs",
|
||||
@@ -630,6 +636,12 @@
|
||||
"sourceRepoURL": "https://github.com/mikedeboer/node-github",
|
||||
"asOfVersion": "7.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "gitlab",
|
||||
"typingsPackageName": "gitlab",
|
||||
"sourceRepoURL": "https://github.com/jdalrymple/node-gitlab",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "graphene-pk11",
|
||||
"typingsPackageName": "graphene-pk11",
|
||||
@@ -948,6 +960,12 @@
|
||||
"sourceRepoURL": "http://maquettejs.org/",
|
||||
"asOfVersion": "2.1.6"
|
||||
},
|
||||
{
|
||||
"libraryName": "maxmind",
|
||||
"typingsPackageName": "maxmind",
|
||||
"sourceRepoURL": "https://github.com/runk/node-maxmind",
|
||||
"asOfVersion": "2.0.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "mendixmodelsdk",
|
||||
"typingsPackageName": "mendixmodelsdk",
|
||||
@@ -988,7 +1006,7 @@
|
||||
"libraryName": "Mobx Cookie",
|
||||
"typingsPackageName": "mobx-cookie",
|
||||
"sourceRepoURL": "https://github.com/will-stone/mobx-cookie",
|
||||
"asOfVersion": "1.1.0"
|
||||
"asOfVersion": "1.1.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "Moment",
|
||||
@@ -1638,6 +1656,12 @@
|
||||
"sourceRepoURL": "https://github.com/ansman/validate.js",
|
||||
"asOfVersion": "0.11.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "vega",
|
||||
"typingsPackageName": "vega",
|
||||
"sourceRepoURL": "https://github.com/vega/vega",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "vso-node-api",
|
||||
"typingsPackageName": "vso-node-api",
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import * as accept from 'accept';
|
||||
|
||||
accept.charsets("iso-8859-5, unicode-1-1;q=0.8"); // charset === "iso-8859-5"
|
||||
accept.charset("iso-8859-5, unicode-1-1;q=0.8", ["unicode-1-1"]); // charset === "unicode-1-1"
|
||||
|
||||
accept.encoding("gzip, deflate, sdch"); // encoding === "gzip"
|
||||
accept.encoding("gzip, deflate, sdch", ["deflate", "identity"]);
|
||||
|
||||
const encodings = accept.encodings("compress;q=0.5, gzip;q=1.0"); // encodings === ["gzip", "compress", "identity"]
|
||||
encodings.lastIndexOf('');
|
||||
|
||||
accept.language("en;q=0.7, en-GB;q=0.8");
|
||||
accept.language("en;q=0.7, en-GB;q=0.8", ["en-gb"]); // language === "en-GB"
|
||||
const languages = accept.languages("da, en;q=0.7, en-GB;q=0.8"); // languages === ["da", "en-GB", "en"]
|
||||
languages.lastIndexOf('');
|
||||
|
||||
const mediaTypes = accept.mediaTypes("text/plain, application/json;q=0.5, text/html, */*;q=0.1");
|
||||
// mediaTypes === ["text/plain", "text/html", "application/json", "*/*"]
|
||||
mediaTypes.lastIndexOf('');
|
||||
const headers = {
|
||||
accept: 'text/plain, application/json;q=0.5, text/html, */*;q=0.1',
|
||||
'accept-language': 'da, en;q=0.7, en-GB;q=0.8'
|
||||
};
|
||||
|
||||
const all = accept.parseAll(headers);
|
||||
all.charsets.length;
|
||||
all.encodings.length;
|
||||
all.languages.length;
|
||||
all.mediaTypes.length;
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for accept 3.1
|
||||
// Project: https://github.com/hapijs/accept#readme
|
||||
// Definitions by: feinoujc <https://github.com/feinoujc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function charset(charsetHeader?: string, preferences?: string[]): string;
|
||||
export function charsets(charsetHeader?: string): string[];
|
||||
export function encoding(encodingHeader?: string, preferences?: string[]): string;
|
||||
export function encodings(encodingHeader?: string): string[];
|
||||
export function language(languageHeader?: string, preferences?: string[]): string;
|
||||
export function languages(languageHeader?: string): string[];
|
||||
export function mediaTypes(mediaTypeHeader?: string): string[];
|
||||
export function parseAll(
|
||||
headers: Record<string, string | string[] | undefined>
|
||||
): {
|
||||
charsets: string[];
|
||||
encodings: string[];
|
||||
languages: string[];
|
||||
mediaTypes: string[];
|
||||
};
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gitlab-tests.ts"
|
||||
"accept-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+2
-2
@@ -64,7 +64,7 @@ declare class Agenda extends EventEmitter {
|
||||
defaultConcurrency(value: number): this;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* Takes a number which specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
@@ -189,7 +189,7 @@ declare namespace Agenda {
|
||||
defaultLockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* Takes a number which specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
Vendored
-63
@@ -1,63 +0,0 @@
|
||||
import {
|
||||
ACLType,
|
||||
CopyAndPutMetaResult,
|
||||
CopyObjectOptions,
|
||||
DeleteMultiOptions,
|
||||
DeleteMultiResult,
|
||||
GetObjectOptions,
|
||||
GetObjectResult,
|
||||
GetStreamOptions,
|
||||
GetStreamResult,
|
||||
HeadObjectOptions,
|
||||
HeadObjectResult,
|
||||
ListObjectResult,
|
||||
ListObjectsQuery,
|
||||
NormalSuccessResponse,
|
||||
PutObjectOptions,
|
||||
PutObjectResult,
|
||||
PutStreamOptions,
|
||||
RequestOptions,
|
||||
SignatureUrlOptions,
|
||||
UserMeta
|
||||
} from "./index";
|
||||
|
||||
export interface ClusterType {
|
||||
host: string;
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
}
|
||||
|
||||
export interface ClusterOptions {
|
||||
clusters: ClusterType[];
|
||||
schedule?: string;
|
||||
}
|
||||
|
||||
export class Cluster {
|
||||
constructor(options: ClusterOptions)
|
||||
|
||||
list(query: ListObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
|
||||
|
||||
put(name: string, file: any, options?: PutObjectOptions): Promise<PutObjectResult>;
|
||||
|
||||
putStream(name: string, stream: any, options?: PutStreamOptions): Promise<{ name: string, res: NormalSuccessResponse }>;
|
||||
|
||||
head(name: string, options?: HeadObjectOptions): Promise<HeadObjectResult>;
|
||||
|
||||
get(name: string, file?: any, options?: GetObjectOptions): Promise<GetObjectResult>;
|
||||
|
||||
getStream(name?: string, options?: GetStreamOptions): Promise<GetStreamResult>;
|
||||
|
||||
delete(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
copy(name: string, sourceName: string, options?: CopyObjectOptions): Promise<CopyAndPutMetaResult>;
|
||||
|
||||
putMeta(name: string, meta: UserMeta, options: RequestOptions): Promise<CopyAndPutMetaResult>;
|
||||
|
||||
deleteMulti(names: string[], options?: DeleteMultiOptions): Promise<DeleteMultiResult>;
|
||||
|
||||
signatureUrl(name: string, options?: SignatureUrlOptions): string;
|
||||
|
||||
putACL(name: string, acl: ACLType, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
restore(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
}
|
||||
Vendored
-71
@@ -1,71 +0,0 @@
|
||||
import { NormalSuccessResponse, RequestOptions } from "./index";
|
||||
|
||||
export interface ImageClientOptions {
|
||||
imageHost: string; // your image service domain that binding to a OSS bucket
|
||||
accessKeyId: string; // access key you create on aliyun console website
|
||||
accessKeySecret: string; // access secret you create
|
||||
bucket: string; // the default bucket you want to access If you don't have any bucket, please use putBucket() create one first.
|
||||
region?: string; // the bucket data region location, please see Data Regions, default is oss-cn-hangzhou
|
||||
internal?: boolean; // access OSS with aliyun internal network or not, default is false If your servers are running on aliyun too, you can set true to save lot of money.
|
||||
timeout?: string | number; // instance level timeout for all operations, default is 60s
|
||||
}
|
||||
|
||||
export interface ImageGetOptions {
|
||||
timeout?: number;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
export interface StyleData {
|
||||
Name: string; // style name
|
||||
Content: string; // style content
|
||||
CreateTime: string; // style create time
|
||||
LastModifyTime: string; // style last modify time
|
||||
}
|
||||
export class ImageClient {
|
||||
constructor(options: ImageClientOptions)
|
||||
|
||||
/**
|
||||
* Get an image from the image channel.
|
||||
*/
|
||||
get(name: string, file?: any, options?: ImageGetOptions): Promise<{ content: any, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get an image read stream.
|
||||
*/
|
||||
getStream(name: string, options?: ImageGetOptions): Promise<{ stream: any, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a image exif info by image object name from the image channel.
|
||||
*/
|
||||
getExif(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a image info and exif info by image object name from the image channel.
|
||||
*/
|
||||
getInfo(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* todo
|
||||
*/
|
||||
putStyle(name: string, style: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a style by name from the image channel.
|
||||
*/
|
||||
getStyle(name: string, options?: RequestOptions): Promise<{ data: StyleData, res: NormalSuccessResponse}>;
|
||||
|
||||
/**
|
||||
* Get all styles from the image channel.
|
||||
*/
|
||||
listStyle(options?: RequestOptions): Promise<StyleData[]>;
|
||||
|
||||
/**
|
||||
* todo
|
||||
*/
|
||||
deleteStyle(styleName: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Create a signature url for directly download.
|
||||
*/
|
||||
signatureUrl(name: string, options?: { expires?: string, timeout?: string }): string;
|
||||
}
|
||||
@@ -1,34 +1,25 @@
|
||||
import OSS from "ali-oss";
|
||||
import * as OSS from 'ali-oss';
|
||||
|
||||
const client = new OSS({
|
||||
const ossOptions: OSS.Options = {
|
||||
accessKeyId: 'your access key',
|
||||
accessKeySecret: 'your access secret',
|
||||
bucket: 'your bucket name',
|
||||
region: 'oss-cn-hangzhou'
|
||||
});
|
||||
};
|
||||
|
||||
const ImageClient = OSS.ImageClient({
|
||||
imageHost: 'host',
|
||||
accessKeySecret: "secret",
|
||||
accessKeyId: 'id',
|
||||
bucket: "",
|
||||
internal: false,
|
||||
region: "",
|
||||
timeout: 2000
|
||||
});
|
||||
const client = new OSS(ossOptions);
|
||||
|
||||
const cluster = OSS.Cluster({
|
||||
clusters: [
|
||||
{
|
||||
accessKeyId: 'id',
|
||||
accessKeySecret: 'secret',
|
||||
host: ""
|
||||
},
|
||||
{
|
||||
accessKeyId: 'id',
|
||||
accessKeySecret: 'secret',
|
||||
host: ""
|
||||
},
|
||||
],
|
||||
schedule: 'masterSlave',
|
||||
});
|
||||
const clusterOptions: OSS.ClusterOptions = {
|
||||
clusters: [],
|
||||
};
|
||||
|
||||
const clusterClient = new OSS.Cluster(clusterOptions);
|
||||
|
||||
const imageOptions: OSS.ImageClientOptions = {
|
||||
imageHost: 'xxxx',
|
||||
accessKeyId: 'xxxx',
|
||||
accessKeySecret: 'xxxx',
|
||||
bucket: 'xxxx'
|
||||
};
|
||||
|
||||
const imageClient = new OSS.ImageClient(imageOptions);
|
||||
|
||||
Vendored
+576
-463
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ImageClient.d.ts",
|
||||
"Cluster.d.ts",
|
||||
"ali-oss-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-mergeable-namespace": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
Vendored
+12
-8
@@ -22,8 +22,8 @@ declare namespace AnalyticsNode {
|
||||
},
|
||||
timestamp?: Date;
|
||||
messageId?: string;
|
||||
anonymousId: string | number;
|
||||
userId: string | number;
|
||||
anonymousId?: string | number;
|
||||
userId?: string | number;
|
||||
}
|
||||
|
||||
interface Data {
|
||||
@@ -47,7 +47,8 @@ declare namespace AnalyticsNode {
|
||||
/* The identify method lets you tie a user to their actions and record
|
||||
traits about them. */
|
||||
identify(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
traits?: Object;
|
||||
timestamp?: Date;
|
||||
context?: Object;
|
||||
@@ -56,7 +57,8 @@ declare namespace AnalyticsNode {
|
||||
|
||||
/* The track method lets you record the actions your users perform. */
|
||||
track(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
event: string;
|
||||
properties?: Object;
|
||||
timestamp?: Date;
|
||||
@@ -67,7 +69,8 @@ declare namespace AnalyticsNode {
|
||||
/* The page method lets you record page views on your website, along with
|
||||
optional extra information about the page being viewed. */
|
||||
page(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
category?: string;
|
||||
name?: string;
|
||||
properties?: Object;
|
||||
@@ -79,19 +82,20 @@ declare namespace AnalyticsNode {
|
||||
/* alias is how you associate one identity with another. */
|
||||
alias(message: {
|
||||
previousId: string | number;
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
integrations?: Integrations;
|
||||
}, callback?: (err: Error, data: Data) => void): Analytics;
|
||||
|
||||
/* Group calls can be used to associate individual users with shared
|
||||
accounts or companies. */
|
||||
group(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
groupId: string | number;
|
||||
traits?: Object;
|
||||
context?: Object;
|
||||
timestamp?: Date;
|
||||
anonymous_id?: string | number;
|
||||
integrations?: Integrations;
|
||||
}, callback?: (err: Error, data: Data) => void): Analytics;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
Vendored
+1
@@ -76,6 +76,7 @@ declare module 'angular' {
|
||||
|
||||
interface IConfirmDialog extends IPresetDialog<IConfirmDialog> {
|
||||
cancel(cancel: string): IConfirmDialog;
|
||||
multiple(multiple: boolean): IConfirmDialog;
|
||||
}
|
||||
|
||||
interface IPromptDialog extends IPresetDialog<IPromptDialog> {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
@@ -22,7 +22,7 @@ Object.keys({
|
||||
}).forEach((color) => {
|
||||
const cname = color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`);
|
||||
|
||||
((<(...anything: any[]) => ansi.Cursor> cursor[color])()
|
||||
((cursor[color] as (...anything: any[]) => ansi.Cursor)()
|
||||
.bold()
|
||||
.bg)[color === 'blue' || color === 'brightBlue' ? 'black' : 'blue']()
|
||||
.write(
|
||||
|
||||
Vendored
+41
-4
@@ -1,8 +1,45 @@
|
||||
// Type definitions for ansicolors
|
||||
// Project: https://github.com/thlorenz/ansicolors
|
||||
// Definitions by: rogierschouten <https://github.com/rogierschouten>
|
||||
// Definitions by: Benjamin Arthur Lupton <https://github.com/balupton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare var colors: { [index: string]: (s: string) => string; };
|
||||
export = colors;
|
||||
interface Colors extends String {
|
||||
(value: string): string
|
||||
white: this
|
||||
black: this
|
||||
blue: this
|
||||
cyan: this
|
||||
green: this
|
||||
magenta: this
|
||||
red: this
|
||||
yellow: this
|
||||
brightBlack: this
|
||||
brightRed: this
|
||||
brightGreen: this
|
||||
brightYellow: this
|
||||
brightBlue: this
|
||||
brightMagenta: this
|
||||
brightCyan: this
|
||||
brightWhite: this
|
||||
bgBlack: this
|
||||
bgRed: this
|
||||
bgGreen: this
|
||||
bgYellow: this
|
||||
bgBlue: this
|
||||
bgMagenta: this
|
||||
bgCyan: this
|
||||
bgWhite: this
|
||||
bgBrightBlack: this
|
||||
bgBrightRed: this
|
||||
bgBrightGreen: this
|
||||
bgBrightYellow: this
|
||||
bgBrightBlue: this
|
||||
bgBrightMagenta: this
|
||||
bgBrightCyan: this
|
||||
bgBrightWhite: this
|
||||
open: this
|
||||
close: this
|
||||
colors: this
|
||||
}
|
||||
declare const colors: Colors
|
||||
export default colors
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { addPath, enableForDir, removePath } from 'app-module-path';
|
||||
|
||||
addPath('/tmp');
|
||||
|
||||
enableForDir('/tmp');
|
||||
|
||||
removePath('/tmp');
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for app-module-path 2.2
|
||||
// Project: https://github.com/patrick-steele-idem/app-module-path-node
|
||||
// Definitions by: Timur Manyanov <https://github.com/darkwebdev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
export function addPath(path: string, parent?: any): void;
|
||||
|
||||
export function enableForDir(dir: string): void;
|
||||
|
||||
export function removePath(path: string): void;
|
||||
@@ -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",
|
||||
"app-module-path-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -47,7 +47,8 @@ appInsights = {
|
||||
startTrackEvent(name: string) { return null; },
|
||||
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
|
||||
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) { return null; },
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean,
|
||||
resultCode: number, properties?: { [name: string]: string }, measurements?: { [name: string]: number }) { return null; },
|
||||
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null; },
|
||||
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null; },
|
||||
trackTrace(message: string, properties?: { [name: string]: string; }, severityLevel?: AI.SeverityLevel) { return null; },
|
||||
@@ -86,7 +87,7 @@ appInsights.trackTrace("message", null);
|
||||
appInsights.trackTrace("message", { a: '1', b: '2' }, AI.SeverityLevel.Error);
|
||||
|
||||
// trackDependency
|
||||
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null);
|
||||
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null, {prop1: 'abc'}, {meas1: 4.5});
|
||||
|
||||
// flush
|
||||
appInsights.flush();
|
||||
|
||||
+14
-9
@@ -670,14 +670,16 @@ declare module Microsoft.ApplicationInsights {
|
||||
context: ITelemetryContext;
|
||||
queue: Array<() => void>;
|
||||
/**
|
||||
* Starts timing how long the user views a page or other item. Call this when the page opens.
|
||||
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
|
||||
* Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,
|
||||
* but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view
|
||||
* and send the event.
|
||||
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
|
||||
*/
|
||||
startTrackPage(name?: string): any;
|
||||
/**
|
||||
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.
|
||||
* The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.
|
||||
* @param name The string you used as the name in `startTrackPage`. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
@@ -689,7 +691,7 @@ declare module Microsoft.ApplicationInsights {
|
||||
measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Logs that a page or other item was viewed.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* @param name The string you used as the name in `startTrackPage`. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
@@ -701,13 +703,13 @@ declare module Microsoft.ApplicationInsights {
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number }, duration?: number): any;
|
||||
/**
|
||||
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
|
||||
* Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.
|
||||
* @param name A string that identifies this event uniquely within the document.
|
||||
*/
|
||||
startTrackEvent(name: string): any;
|
||||
/**
|
||||
* Log an extended event that you started timing with {@link startTrackEvent}.
|
||||
* @param name The string you used to identify this event in startTrackEvent.
|
||||
* Log an extended event that you started timing with `startTrackEvent`.
|
||||
* @param name The string you used to identify this event in `startTrackEvent`.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
@@ -734,8 +736,11 @@ declare module Microsoft.ApplicationInsights {
|
||||
* @param totalTime total request time
|
||||
* @param success indicates if the request was sessessful
|
||||
* @param resultCode response code returned by the dependency request
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number): any;
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number,
|
||||
properties?: { [name: string]: string }, measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Log an exception you have caught.
|
||||
* @param exception An Error from a catch clause, or the string error message.
|
||||
|
||||
@@ -16,6 +16,9 @@ coll.save({ username: "user" });
|
||||
const doc = coll.any();
|
||||
console.log(doc.username);
|
||||
|
||||
const coll2 = db._collection(coll.name());
|
||||
console.log(coll2 === coll);
|
||||
|
||||
const users = coll as ArangoDB.Collection<User>;
|
||||
const admin = users.firstExample({ username: "admin" })!;
|
||||
users.update(admin, { password: md5("hunter2") });
|
||||
|
||||
Vendored
+2
-10
@@ -619,6 +619,7 @@ declare namespace ArangoDB {
|
||||
|
||||
interface Collection<T extends object = any> {
|
||||
// Collection
|
||||
name(): string;
|
||||
checksum(
|
||||
withRevisions?: boolean,
|
||||
withData?: boolean
|
||||
@@ -1503,16 +1504,7 @@ declare module "@arangodb/foxx/queues" {
|
||||
function deleteQueue(name: string): boolean;
|
||||
function get(name: string): Queue;
|
||||
|
||||
export {
|
||||
createQueue as create,
|
||||
deleteQueue as delete,
|
||||
get,
|
||||
JobOptions,
|
||||
Job,
|
||||
Queue,
|
||||
QueueItem,
|
||||
Script,
|
||||
};
|
||||
export { createQueue as create, deleteQueue as delete, get, JobOptions, Job, Queue, QueueItem, Script, };
|
||||
}
|
||||
|
||||
declare module "@arangodb/foxx/graphql" {
|
||||
|
||||
@@ -390,22 +390,22 @@ async.auto({
|
||||
get_data: function (callback: AsyncResultCallback<any>) { },
|
||||
make_folder: function (callback: AsyncResultCallback<any>) { },
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
|
||||
write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback<any>) {
|
||||
callback(null, filename);
|
||||
}],
|
||||
} as any],
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
|
||||
email_link: ['write_file', function (callback: AsyncResultCallback<any>, results: any) { } as any]
|
||||
});
|
||||
|
||||
async.auto({
|
||||
get_data: function (callback: AsyncResultCallback<any>) { },
|
||||
make_folder: function (callback: AsyncResultCallback<any>) { },
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
|
||||
write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback<any>) {
|
||||
callback(null, filename);
|
||||
}],
|
||||
} as any],
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
|
||||
email_link: ['write_file', function (callback: AsyncResultCallback<any>, results: any) { } as any]
|
||||
}, function (err, results) {
|
||||
console.log('finished auto');
|
||||
});
|
||||
@@ -421,11 +421,11 @@ async.auto<A>({
|
||||
get_data: function (callback: AsyncResultCallback<any>) { },
|
||||
make_folder: function (callback: AsyncResultCallback<any>) { },
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
|
||||
write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback<any>) {
|
||||
callback(null, filename);
|
||||
}],
|
||||
} as any],
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
|
||||
email_link: ['write_file', function (callback: AsyncResultCallback<any>, results: any) { } as any]
|
||||
}, 1, function (err, results) {
|
||||
console.log('finished auto');
|
||||
});
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,8 +557,8 @@ function testDesializerManager() {
|
||||
}
|
||||
|
||||
function isStorableClass(o: object): o is StorableClass {
|
||||
if (typeof o === "object" && (<StorableClass> o).name &&
|
||||
(<StorableClass> o).name === "test") {
|
||||
if (typeof o === "object" && (o as StorableClass).name &&
|
||||
(o as StorableClass).name === "test") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
Vendored
-2
@@ -4,8 +4,6 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as Promise from 'bluebird';
|
||||
|
||||
export interface ManagementClientOptions {
|
||||
token?: string;
|
||||
domain: string;
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
import Timeout from "await-timeout";
|
||||
|
||||
/**
|
||||
* This test is just a TS-friendly version of the await-timeout README:
|
||||
* https://github.com/vitalets/await-timeout/blob/v0.3.0/README.md
|
||||
*
|
||||
* How to generate this file:
|
||||
* 1. Paste the source code of README.md
|
||||
* 2. Replace every code fence with async () => {}
|
||||
* 3. Comment out all other lines
|
||||
* 4. Add and remove import statements and repeated statements
|
||||
* 5. Declare required globals
|
||||
*/
|
||||
|
||||
// -- Globals --
|
||||
declare const fetch: (url: string) => Promise<any>;
|
||||
declare const console: any;
|
||||
declare const MyTimeoutError: any;
|
||||
|
||||
// --- README ---
|
||||
|
||||
// ## Usage
|
||||
// 1. Just wait some time:
|
||||
async () => {
|
||||
// wait 1000 ms and resolve
|
||||
await Timeout.set(1000);
|
||||
|
||||
// wait 1000 ms and reject with 'Error'
|
||||
await Timeout.set(1000, 'Error');
|
||||
};
|
||||
|
||||
// 2. Use `Timeout` instance inside `try...finally` block to make proper cleanup:
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
try {
|
||||
await Promise.race([
|
||||
fetch('https://example.com'),
|
||||
timer.set(1000)
|
||||
.then(() => Promise.reject('Timeout'))
|
||||
]);
|
||||
} finally {
|
||||
timer.clear();
|
||||
}
|
||||
};
|
||||
|
||||
// ## API
|
||||
// ### new Timeout()
|
||||
// Constructs new timeout instance. It does not start timer but creates variable for timer manipulation.
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
};
|
||||
// > Note : having separate variable is useful for clearing timeout in `finally` block
|
||||
|
||||
// ### .set(ms, [message]) ⇒ `Promise`
|
||||
// Starts new timer like `setTimeout()` and returns promise. The promise will be resolved after `ms` milliseconds:
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
timer.set(1000)
|
||||
.then(() => console.log('1000 ms passed.'));
|
||||
};
|
||||
|
||||
// If you need to reject after timeout:
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
timer.set(1000)
|
||||
.then(() => {throw new Error('Timeout'); });
|
||||
};
|
||||
|
||||
// Or reject with custom error:
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
timer.set(1000)
|
||||
.then(() => {throw new MyTimeoutError(); });
|
||||
};
|
||||
// The second parameter `message` is just convenient way to reject with `new Error(message)`:
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
timer.set(1000, 'Timeout');
|
||||
// is equivalent to
|
||||
timer.set(1000).then(() => {throw new Error('Timeout'); });
|
||||
};
|
||||
|
||||
// If you need to just wait some time - use static version of `.set()` :
|
||||
async () => {
|
||||
Timeout.set(1000).then(/*...*/);
|
||||
};
|
||||
|
||||
// ### .wrap(promise, ms, [message]) ⇒ `Promise`
|
||||
// Wraps existing promise with timeout:
|
||||
// * promise automatically rejected after timeout
|
||||
// * timeout automatically cleared if promise fulfills first
|
||||
async () => {
|
||||
const promise = fetch('https://example.com');
|
||||
|
||||
const timeoutedPromise = Timeout.wrap(promise, 1000, 'Timeout');
|
||||
};
|
||||
// Actually it is a shortcut for :
|
||||
async () => {
|
||||
const promise = fetch('https://example.com');
|
||||
|
||||
const timer = new Timeout();
|
||||
try {
|
||||
const timeoutedPromise = await Promise.race([
|
||||
promise,
|
||||
timer.set(1000, 'Timeout')
|
||||
]);
|
||||
} finally {
|
||||
timer.clear();
|
||||
}
|
||||
};
|
||||
|
||||
// ### .clear()
|
||||
// Clears existing timeout like `clearTimeout()`.
|
||||
async () => {
|
||||
const timer = new Timeout();
|
||||
timer.set(1000)
|
||||
.then(() => console.log('This will never be called, because timeout is cleared on the next line'));
|
||||
timer.clear();
|
||||
};
|
||||
|
||||
// With [ES7 async / await ] `.clear()` can be used in `finally` block:
|
||||
async () => {
|
||||
async function foo() {
|
||||
const timer = new Timeout();
|
||||
try {
|
||||
// some async stuff
|
||||
} finally {
|
||||
timer.clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for await-timeout 0.3
|
||||
// Project: https://github.com/vitalets/await-timeout
|
||||
// Definitions by: Sean Zhu <https://github.com/szhu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export default Timeout;
|
||||
|
||||
declare class Timeout {
|
||||
static set(delay: number): Promise<undefined>;
|
||||
static set(delay: number, message: string): Promise<never>;
|
||||
|
||||
static wrap(promise: Promise<any>, delay: number, error?: string): Promise<any>;
|
||||
|
||||
set(delay: number): Promise<undefined>;
|
||||
set(delay: number, message: string): Promise<never>;
|
||||
clear(): void;
|
||||
}
|
||||
@@ -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",
|
||||
"await-timeout-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
-1
@@ -75,7 +75,7 @@ export namespace Azure.ServiceBus {
|
||||
DefaultMessageTimeToLive: string;
|
||||
DuplicateDetectionHistoryTimeWindow: string;
|
||||
EnablePartitioning: boolean;
|
||||
MaxSizeInMegaBytes: number;
|
||||
MaxSizeInMegabytes: number;
|
||||
RequiresDuplicateDetection: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,15 +7,18 @@ const options: babel.TransformOptions = {
|
||||
|
||||
babel.transform("code();", options, (err, result) => {
|
||||
const { code, map, ast } = result!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
const transformSyncResult = babel.transformSync("code();", options);
|
||||
if (transformSyncResult) {
|
||||
const { code, map, ast } = transformSyncResult;
|
||||
const { body } = ast!.program;
|
||||
}
|
||||
|
||||
babel.transformFile("filename.js", options, (err, result) => {
|
||||
const { code, map, ast } = result!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
babel.transformFileSync("filename.js", options)!.code;
|
||||
@@ -25,7 +28,14 @@ const parsedAst = babel.parse(sourceCode, options);
|
||||
|
||||
babel.transformFromAst(parsedAst!, sourceCode, options, (err, result) => {
|
||||
const { code, map, ast } = result!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
const transformFromAstSyncResult = babel.transformFromAstSync(parsedAst!, sourceCode, options);
|
||||
const { code, map, ast } = transformFromAstSyncResult!;
|
||||
const { body } = ast!.program;
|
||||
|
||||
babel.transformFromAstAsync(parsedAst!, sourceCode, options).then(transformFromAstAsyncResult => {
|
||||
const { code, map, ast } = transformFromAstAsyncResult!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
Vendored
+6
-6
@@ -4,16 +4,16 @@
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import { GeneratorOptions } from "@babel/generator";
|
||||
import traverse, { Visitor, NodePath } from "@babel/traverse";
|
||||
import template from "@babel/template";
|
||||
import * as t from "@babel/types";
|
||||
import { ParseOptions } from "@babel/parser";
|
||||
import { ParserOptions } from "@babel/parser";
|
||||
|
||||
export {
|
||||
ParseOptions,
|
||||
ParserOptions,
|
||||
GeneratorOptions,
|
||||
t as types,
|
||||
template,
|
||||
@@ -217,7 +217,7 @@ export interface TransformOptions {
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
parserOpts?: ParseOptions | null;
|
||||
parserOpts?: ParserOptions | null;
|
||||
|
||||
/**
|
||||
* List of plugins to load and use
|
||||
@@ -349,7 +349,7 @@ export function transformFromAstSync(ast: Node, code?: string, opts?: TransformO
|
||||
/**
|
||||
* Given an AST, transform it.
|
||||
*/
|
||||
export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
export function transformFromAstAsync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
|
||||
// A babel plugin is a simple function which must return an object matching
|
||||
// the following interface. Babel will throw if it finds unknown properties.
|
||||
@@ -365,7 +365,7 @@ export interface PluginObj<S = {}> {
|
||||
}
|
||||
|
||||
export interface BabelFileResult {
|
||||
ast?: Node | null;
|
||||
ast?: t.File | null;
|
||||
code?: string | null;
|
||||
ignored?: boolean;
|
||||
map?: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/parser": "^7.1.0",
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
"@babel/generator": [
|
||||
"babel__generator"
|
||||
],
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
],
|
||||
"@babel/template": [
|
||||
"babel__template"
|
||||
],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Example from https://github.com/babel/babel/tree/master/packages/babel-generator
|
||||
import generate from "@babel/generator";
|
||||
import { parse } from "@babel/parser";
|
||||
import * as t from "@babel/types";
|
||||
|
||||
const code = "class Example {}";
|
||||
const ast = parse(code);
|
||||
declare const ast: t.Node;
|
||||
|
||||
ast.type;
|
||||
ast.loc!.start;
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Johnny Estilles <https://github.com/johnnyestilles>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import * as t from "@babel/types";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
"paths": {
|
||||
"@babel/generator": [
|
||||
"babel__generator"
|
||||
],
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { parse, parseExpression } from "@babel/parser";
|
||||
|
||||
declare function assert(expr: boolean): void;
|
||||
|
||||
const code = `function square(n) {
|
||||
return n * n;
|
||||
}`;
|
||||
|
||||
const node = parse(code);
|
||||
assert(node.type === "File");
|
||||
assert(node.start === 0);
|
||||
assert(node.end === 38);
|
||||
assert(!!node.loc && node.loc.start > node.loc.end);
|
||||
|
||||
parse(code, {
|
||||
sourceType: "module", // default: "script"
|
||||
plugins: ["jsx"] // default: []
|
||||
});
|
||||
Vendored
-107
@@ -1,107 +0,0 @@
|
||||
// Type definitions for @babel/parser 7.0
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-parser
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { File, Expression } from "@babel/types";
|
||||
|
||||
export function parse(code: string, opts?: ParseOptions): File;
|
||||
|
||||
export function parseExpression(input: string, options?: ParseOptions): Expression;
|
||||
|
||||
export interface ParseOptions {
|
||||
/**
|
||||
* By default, import and export declarations can only appear at a program's top level.
|
||||
* Setting this option to true allows them anywhere where a statement is allowed.
|
||||
*/
|
||||
allowImportExportEverywhere?: boolean;
|
||||
|
||||
/**
|
||||
* By default, await use is not allowed outside of an async function. Set this to true to accept such code.
|
||||
*/
|
||||
allowAwaitOutsideFunction?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a return statement at the top level raises an error. Set this to true to accept such code.
|
||||
*/
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
|
||||
allowSuperOutsideMethod?: boolean;
|
||||
|
||||
/**
|
||||
* Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous".
|
||||
* Defaults to "script". "unambiguous" will make @babel/parser attempt to guess, based on the presence of ES6 import or export
|
||||
* statements. Files with ES6 imports and exports are considered "module" and are otherwise "script".
|
||||
*/
|
||||
sourceType?: "script" | "module" | "unambiguous";
|
||||
|
||||
/**
|
||||
* Correlate output AST nodes with their source filename. Useful when
|
||||
* generating code and source maps from the ASTs of multiple input files.
|
||||
*/
|
||||
sourceFilename?: string;
|
||||
|
||||
/**
|
||||
* By default, the first line of code parsed is treated as line 1. You can provide a line number to alternatively start with. Useful
|
||||
* for integration with other source tools.
|
||||
*/
|
||||
startLine?: number;
|
||||
|
||||
/**
|
||||
* Array containing the plugins that you want to enable.
|
||||
*/
|
||||
plugins?: PluginList;
|
||||
|
||||
strictMode?: boolean;
|
||||
|
||||
/**
|
||||
* Adds a `ranges` property to each node: `[node.start, node.end]`
|
||||
*/
|
||||
ranges?: boolean;
|
||||
|
||||
/**
|
||||
* Adds all parsed tokens to a `tokens` property on the `File` node
|
||||
*/
|
||||
tokens?: boolean;
|
||||
}
|
||||
|
||||
export type PluginList = Array<PluginName | [PluginName, PluginOptions]>;
|
||||
|
||||
export type PluginName =
|
||||
"asyncGenerators" |
|
||||
"bigInt" |
|
||||
"classPrivateMethods" |
|
||||
"classPrivateProperties" |
|
||||
"classProperties" |
|
||||
"decorators" |
|
||||
"doExpressions" |
|
||||
"dynamicImport" |
|
||||
"estree" |
|
||||
"exportDefaultFrom" |
|
||||
"exportNamespaceFrom" |
|
||||
"flow" |
|
||||
"flowComments" |
|
||||
"functionBind" |
|
||||
"functionSent" |
|
||||
"importMeta" |
|
||||
"jsx" |
|
||||
"nullishCoalescingOperator" |
|
||||
"numericSeparator" |
|
||||
"objectRestSpread" |
|
||||
"optionalCatchBinding" |
|
||||
"optionalChaining" |
|
||||
"pipelineOperator" |
|
||||
"throwExpressions" |
|
||||
"typescript";
|
||||
|
||||
export interface PluginOptions {
|
||||
decorators?: {
|
||||
decoratorsBeforeExport?: boolean;
|
||||
};
|
||||
flow?: {
|
||||
all?: boolean;
|
||||
};
|
||||
}
|
||||
Vendored
+3
-3
@@ -4,12 +4,12 @@
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import { ParseOptions } from "@babel/parser";
|
||||
import { ParserOptions } from "@babel/parser";
|
||||
import { Expression, File, Program, Statement } from "@babel/types";
|
||||
|
||||
export interface TemplateBuilderOptions extends ParseOptions {
|
||||
export interface TemplateBuilderOptions extends ParserOptions {
|
||||
/**
|
||||
* A set of placeholder names to automatically accept. Items in this list do not need to match the given placeholder pattern.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/parser": "^7.1.0",
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
"@babel/generator": [
|
||||
"babel__generator"
|
||||
],
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
],
|
||||
"@babel/template": [
|
||||
"babel__template"
|
||||
]
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
import { parse } from "@babel/parser";
|
||||
import traverse, { Visitor } from "@babel/traverse";
|
||||
import * as t from "@babel/types";
|
||||
|
||||
// Examples from: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md
|
||||
const MyVisitor: Visitor = {
|
||||
Identifier: {
|
||||
enter() {
|
||||
enter(path) {
|
||||
// $ExpectType NodePath<Identifier>
|
||||
path;
|
||||
console.log("Entered!");
|
||||
},
|
||||
exit() {
|
||||
exit(path) {
|
||||
// $ExpectType NodePath<Identifier>
|
||||
path;
|
||||
console.log("Exited!");
|
||||
}
|
||||
}
|
||||
@@ -21,11 +24,7 @@ const MyVisitor2: Visitor = {
|
||||
};
|
||||
|
||||
// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-traverse
|
||||
const code = `function square(n) {
|
||||
return n * n;
|
||||
}`;
|
||||
|
||||
const ast = parse(code);
|
||||
declare const ast: t.Node;
|
||||
|
||||
traverse(ast, {
|
||||
enter(path) {
|
||||
@@ -94,7 +93,8 @@ const v1: Visitor = {
|
||||
|
||||
const id = path.scope.generateUidIdentifierBasedOnNode(path.node.id!);
|
||||
path.remove();
|
||||
path.scope.parent.push({ id, init: path.node });
|
||||
path.scope.parent.push({ id });
|
||||
path.scope.parent.push({ id, init: t.stringLiteral('foo'), kind: "const" });
|
||||
|
||||
path.scope.rename("n", "x");
|
||||
path.scope.rename("n");
|
||||
@@ -109,7 +109,44 @@ const BindingKindTest: Visitor = {
|
||||
kind === 'const';
|
||||
kind === 'let';
|
||||
kind === 'var';
|
||||
// The following should fail when uncommented
|
||||
// kind === 'anythingElse';
|
||||
// $ExpectError
|
||||
kind === 'anythingElse';
|
||||
},
|
||||
};
|
||||
|
||||
interface SomeVisitorState { someState: string; }
|
||||
|
||||
const VisitorStateTest: Visitor<SomeVisitorState> = {
|
||||
enter(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
exit(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
Identifier(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
FunctionDeclaration: {
|
||||
enter(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
exit(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+15
-10
@@ -5,7 +5,7 @@
|
||||
// Ryan Petrich <https://github.com/rpetrich>
|
||||
// Melvin Groenhoff <https://github.com/mgroenhoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
import * as t from "@babel/types";
|
||||
|
||||
@@ -90,11 +90,16 @@ export class Scope {
|
||||
|
||||
removeData(key: string): void;
|
||||
|
||||
push(opts: any): void;
|
||||
push(opts: {
|
||||
id: t.LVal,
|
||||
init?: t.Expression,
|
||||
unique?: boolean,
|
||||
kind?: "var" | "let" | "const",
|
||||
}): void;
|
||||
|
||||
getProgramParent(): Scope;
|
||||
|
||||
getFunctionParent(): Scope;
|
||||
getFunctionParent(): Scope | null;
|
||||
|
||||
getBlockParent(): Scope;
|
||||
|
||||
@@ -138,17 +143,17 @@ export class Binding {
|
||||
constantViolations: NodePath[];
|
||||
}
|
||||
|
||||
export type Visitor<S = Node> = VisitNodeObject<Node> & {
|
||||
[P in Node["type"]]?: VisitNode<S, Extract<Node, { type: P; }>>;
|
||||
export type Visitor<S = {}> = VisitNodeObject<S, Node> & {
|
||||
[Type in Node["type"]]?: VisitNode<S, Extract<Node, { type: Type; }>>;
|
||||
};
|
||||
|
||||
export type VisitNode<T, P> = VisitNodeFunction<T, P> | VisitNodeObject<T>;
|
||||
export type VisitNode<S, P> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
|
||||
|
||||
export type VisitNodeFunction<T, P> = (this: T, path: NodePath<P>, state: any) => void;
|
||||
export type VisitNodeFunction<S, P> = (this: S, path: NodePath<P>, state: S) => void;
|
||||
|
||||
export interface VisitNodeObject<T> {
|
||||
enter?(path: NodePath<T>, state: any): void;
|
||||
exit?(path: NodePath<T>, state: any): void;
|
||||
export interface VisitNodeObject<S, P> {
|
||||
enter?: VisitNodeFunction<S, P>;
|
||||
exit?: VisitNodeFunction<S, P>;
|
||||
}
|
||||
|
||||
export class NodePath<T = Node> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.0.0-beta.54"
|
||||
"@babel/types": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@babel/parser": [
|
||||
"babel__parser"
|
||||
],
|
||||
"@babel/traverse": [
|
||||
"babel__traverse"
|
||||
]
|
||||
|
||||
@@ -64,7 +64,7 @@ const modelOpts: Backbone.ModelFetchWithCacheOptions = {
|
||||
context: {},
|
||||
};
|
||||
|
||||
const hoge = <Backbone.ModelWithCache> new Backbone.Model;
|
||||
const hoge = new Backbone.Model() as Backbone.ModelWithCache;
|
||||
hoge.fetch(modelOpts);
|
||||
|
||||
const collectionOpts: Backbone.CollectionFetchWithCacheOptions = {
|
||||
@@ -76,5 +76,5 @@ const collectionOpts: Backbone.CollectionFetchWithCacheOptions = {
|
||||
prefillSuccess: (self: any) => { },
|
||||
};
|
||||
|
||||
const fuga = <Backbone.CollectionWithCache> new Backbone.Collection;
|
||||
const fuga = new Backbone.Collection() as Backbone.CollectionWithCache;
|
||||
fuga.fetch(collectionOpts);
|
||||
|
||||
Vendored
+13
-1
@@ -122,7 +122,19 @@ declare module 'backbone' {
|
||||
|
||||
}
|
||||
|
||||
export class Store extends Events {
|
||||
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;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
Vendored
+142
-3
@@ -4,13 +4,15 @@
|
||||
// Natan Vivo <https://github.com/nvivo>,
|
||||
// Sven Tschui <https://github.com/sventschui>,
|
||||
// Volker Nauruhn <https://github.com/razorness>,
|
||||
// Ard Timmerman <https://github.com/confususs>
|
||||
// Ard Timmerman <https://github.com/confususs>,
|
||||
// J. Joe Koullas <https://github.com/jjoekoullas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Backbone from 'backbone';
|
||||
import * as JQuery from 'jquery';
|
||||
import * as Radio from 'backbone.radio';
|
||||
import * as _ from 'underscore';
|
||||
|
||||
export as namespace Marionette;
|
||||
|
||||
@@ -179,6 +181,131 @@ export class Container<TView> {
|
||||
* Find a view by it's cid.
|
||||
*/
|
||||
remove(view: TView): void;
|
||||
|
||||
/**
|
||||
* @see _.forEach
|
||||
*/
|
||||
forEach(iterator: _.ListIterator<TView, void>, context?: any): Container<TView>;
|
||||
|
||||
/**
|
||||
* @see _.each
|
||||
*/
|
||||
each(iterator: _.ListIterator<TView, void>, context?: any): Container<TView>;
|
||||
|
||||
/**
|
||||
* @see _.map
|
||||
*/
|
||||
map<TResult>(iterator: _.ListIterator<TView, TResult>, context?: any): TResult[];
|
||||
|
||||
/**
|
||||
* @see _.find
|
||||
*/
|
||||
find(iterator: _.ListIterator<TView, boolean>, context?: any): Container<TView> | undefined;
|
||||
|
||||
/**
|
||||
* @see _.detect
|
||||
*/
|
||||
detect(iterator: _.ListIterator<TView, boolean>, context?: any): Container<TView> | undefined;
|
||||
|
||||
/**
|
||||
* @see _.filter
|
||||
*/
|
||||
filter(iterator: _.ListIterator<TView, boolean>, context?: any): TView[];
|
||||
|
||||
/**
|
||||
* @see _.select
|
||||
*/
|
||||
select(iterator: _.ListIterator<TView, boolean>, context?: any): TView[];
|
||||
|
||||
/**
|
||||
* @see _.reject
|
||||
*/
|
||||
reject(iterator: _.ListIterator<TView, boolean>, context?: any): TView[];
|
||||
|
||||
/**
|
||||
* @see _.every
|
||||
*/
|
||||
every(iterator: _.ListIterator<TView, boolean>, context?: any): boolean;
|
||||
|
||||
/**
|
||||
* @see _.all
|
||||
*/
|
||||
all(iterator: _.ListIterator<TView, boolean>, context?: any): boolean;
|
||||
|
||||
/**
|
||||
* @see _.some
|
||||
*/
|
||||
some(iterator: _.ListIterator<TView, boolean>, context?: any): boolean;
|
||||
|
||||
/**
|
||||
* @see _.any
|
||||
*/
|
||||
any(iterator: _.ListIterator<TView, boolean>, context?: any): boolean;
|
||||
|
||||
/**
|
||||
* @see _.include
|
||||
*/
|
||||
include(value: TView, fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.contains
|
||||
*/
|
||||
contains(value: TView, fromIndex?: number): boolean;
|
||||
|
||||
/**
|
||||
* @see _.invoke
|
||||
*/
|
||||
invoke(methodName: string, ...args: any[]): any;
|
||||
|
||||
/**
|
||||
* @see _.toArray
|
||||
*/
|
||||
toArray(): TView[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
*/
|
||||
first(): TView | undefined;
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
*/
|
||||
initial(n?: number): TView[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
*/
|
||||
rest(n?: number): TView[];
|
||||
|
||||
/**
|
||||
* @see _.last
|
||||
*/
|
||||
last(n: number): TView[];
|
||||
|
||||
/**
|
||||
* @see _.without
|
||||
*/
|
||||
without(...values: TView[]): TView[];
|
||||
|
||||
/**
|
||||
* @see _.isEmpty
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* @see _.pluck
|
||||
*/
|
||||
pluck(propertyName: string): any[];
|
||||
|
||||
/**
|
||||
* @see _.reduce
|
||||
*/
|
||||
reduce<TResult>(iterator: _.MemoIterator<TView, TResult>, memo?: TResult, context?: any): TResult;
|
||||
|
||||
/**
|
||||
* @see _.partition
|
||||
*/
|
||||
partition(iterator: _.ListIterator<TView, boolean>, context?: any): TView[][];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,9 +407,21 @@ 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 extends Backbone.Events implements CommonMixin, RadioMixin {
|
||||
export class Object implements CommonMixin, RadioMixin, Backbone.Events {
|
||||
constructor(options?: ObjectOptions);
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Receives a hash of event names and functions and/or function names,
|
||||
* and returns the same hash with the function names replaced with the
|
||||
@@ -1154,7 +1293,7 @@ export class View<TModel extends Backbone.Model> extends Backbone.View<TModel> i
|
||||
export interface CollectionViewOptions<
|
||||
TModel extends Backbone.Model,
|
||||
TCollection extends Backbone.Collection<TModel> = Backbone.Collection<TModel>
|
||||
> extends Backbone.ViewOptions<TModel>, ViewMixinOptions {
|
||||
> extends Backbone.ViewOptions<TModel>, ViewMixinOptions {
|
||||
/**
|
||||
* Specify a child view to use.
|
||||
*/
|
||||
|
||||
@@ -70,8 +70,8 @@ namespace InitializingWithOptions {
|
||||
});
|
||||
|
||||
var testCollection6 = new TestCollection([
|
||||
<TestModel>{},
|
||||
<TestModel>{},
|
||||
{} as TestModel,
|
||||
{} as TestModel,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+12
-1
@@ -71,7 +71,18 @@ declare module "backbone" {
|
||||
stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests;
|
||||
}
|
||||
|
||||
class Channel extends Backbone.Events implements Commands, Requests {
|
||||
class Channel implements Commands, Requests, Backbone.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;
|
||||
channelName: string;
|
||||
reset(): Channel;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function test_events() {
|
||||
|
||||
var object = new Backbone.Events();
|
||||
var object = Backbone.Events;
|
||||
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
|
||||
|
||||
object.trigger("alert", "an event");
|
||||
|
||||
Vendored
+45
-13
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Natan Vivo <https://github.com/nvivo>
|
||||
// kenjiru <https://github.com/kenjiru>
|
||||
// jjoekoullas <https://github.com/jjoekoullas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -94,21 +95,34 @@ declare namespace Backbone {
|
||||
[selector: string]: string | {(eventObject: JQueryEventObject): void};
|
||||
}
|
||||
|
||||
class Events {
|
||||
on(eventName: string, callback?: Function, context?: any): any;
|
||||
export const Events: Events;
|
||||
interface Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
off(eventName?: string, callback?: Function, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, 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;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, 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;
|
||||
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;
|
||||
}
|
||||
|
||||
class ModelBase extends Events {
|
||||
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
|
||||
|
||||
parse(response: any, options?: any): any;
|
||||
toJSON(options?: any): any;
|
||||
sync(...arg: any[]): JQueryXHR;
|
||||
@@ -353,7 +367,7 @@ declare namespace Backbone {
|
||||
without(...values: TModel[]): TModel[];
|
||||
}
|
||||
|
||||
class Router extends Events {
|
||||
class Router extends EventSignatures {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -382,7 +396,7 @@ declare namespace Backbone {
|
||||
|
||||
var history: History;
|
||||
|
||||
class History extends Events {
|
||||
class History extends EventSignatures {
|
||||
|
||||
handlers: any[];
|
||||
interval: number;
|
||||
@@ -419,7 +433,7 @@ declare namespace Backbone {
|
||||
attributes?: {[id: string]: any};
|
||||
}
|
||||
|
||||
class View<TModel extends Model> extends Events {
|
||||
class View<TModel extends Model> extends EventSignatures {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -471,3 +485,21 @@ 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;
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
@@ -120,7 +120,7 @@ function CommonMethodsInEventStreamsAndProperties() {
|
||||
Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => {
|
||||
if (event.hasValue()) {
|
||||
// had to cast to `number` because event:Bacon.Next<number>|Bacon.Error<{}>
|
||||
return [sum + <number>event.value(), []];
|
||||
return [sum + (event.value() as number), []];
|
||||
}
|
||||
else if (event.isEnd()) {
|
||||
return [undefined, [new Bacon.Next(sum), event]];
|
||||
@@ -140,8 +140,8 @@ function CommonMethodsInEventStreamsAndProperties() {
|
||||
|
||||
{
|
||||
// This is handy for keeping track whether we are currently awaiting an AJAX response:
|
||||
var ajaxRequest = <Bacon.Observable<Error, JQueryXHR>>{},
|
||||
ajaxResponse = <Bacon.Observable<Error, JQueryXHR>>{},
|
||||
var ajaxRequest = {} as Bacon.Observable<Error, JQueryXHR>,
|
||||
ajaxResponse = {} as Bacon.Observable<Error, JQueryXHR>,
|
||||
showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+4758
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"esnext"
|
||||
],
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"baidu-app-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-console": false,
|
||||
"semicolon": true
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ async function run() {
|
||||
clientSecret: '',
|
||||
scope(request) {
|
||||
const scopes = ['public_profile', 'email'];
|
||||
if ((<RequestQuery> request.query).wantsSharePermission) {
|
||||
if ((request.query as RequestQuery).wantsSharePermission) {
|
||||
scopes.push('publish_actions');
|
||||
}
|
||||
return scopes;
|
||||
|
||||
@@ -2,24 +2,32 @@ import Database = require('better-sqlite3');
|
||||
|
||||
const integer = Database.Integer(1);
|
||||
const err = new Database.SqliteError('ok', 'ok');
|
||||
const result: Database.RunResult = { changes: 1, lastInsertRowid: 1 };
|
||||
const options: Database.Options = { fileMustExist: true, memory: true, readonly: true };
|
||||
const registrationOptions: Database.RegistrationOptions = {
|
||||
deterministic: true,
|
||||
name: '',
|
||||
safeIntegers: true,
|
||||
varargs: true
|
||||
};
|
||||
|
||||
let db = Database('.');
|
||||
db = new Database('.', {memory: true});
|
||||
db = new Database('.', { memory: true });
|
||||
db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);');
|
||||
db.exec('INSERT INTO test(name) VALUES("name");');
|
||||
db.pragma('data_version', true);
|
||||
db.checkpoint();
|
||||
db.checkpoint('main');
|
||||
db.register(() => {});
|
||||
db.register({name: 'noop', deterministic: true, varargs: true}, () => {});
|
||||
db.register(() => { });
|
||||
db.register({ name: 'noop', deterministic: true, varargs: true }, () => { });
|
||||
db.defaultSafeIntegers();
|
||||
db.defaultSafeIntegers(true);
|
||||
|
||||
const stmt = db.prepare('SELECT * FROM test WHERE name == ?;');
|
||||
stmt.get(['name']);
|
||||
stmt.all({name: 'name'});
|
||||
stmt.each('name', (row: {name: string}) => {});
|
||||
stmt.each((row: {name: string}) => {});
|
||||
stmt.all({ name: 'name' });
|
||||
stmt.each('name', (row: { name: string }) => { });
|
||||
stmt.each((row: { name: string }) => { });
|
||||
stmt.pluck();
|
||||
stmt.pluck(true);
|
||||
stmt.bind('name');
|
||||
|
||||
Vendored
+68
-62
@@ -1,88 +1,94 @@
|
||||
// Type definitions for better-sqlite3 3.1
|
||||
// Type definitions for better-sqlite3 5.0
|
||||
// Project: http://github.com/JoshuaWise/better-sqlite3
|
||||
// Definitions by: Ben Davies <https://github.com/Morfent>
|
||||
// Mathew Rumsey <https://github.com/matrumz>
|
||||
// Santiago Aguilar <https://github.com/sant123>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import Integer = require('integer');
|
||||
|
||||
interface RunResult {
|
||||
changes: number;
|
||||
lastInsertROWID: Integer.IntLike;
|
||||
}
|
||||
import Integer = require("integer");
|
||||
|
||||
declare class Statement {
|
||||
database: Database;
|
||||
source: string;
|
||||
returnsData: boolean;
|
||||
constructor(db: Database, sources: string[]);
|
||||
database: Database;
|
||||
source: string;
|
||||
returnsData: boolean;
|
||||
constructor(db: Database, sources: string[]);
|
||||
|
||||
run(...params: any[]): RunResult;
|
||||
get(...params: any[]): any;
|
||||
all(...params: any[]): any[];
|
||||
each(params: any, cb: (row: any) => void): void;
|
||||
each(cb: (row: any) => void): void;
|
||||
each(...params: any[]): void;
|
||||
pluck(toggleState?: boolean): this;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
run(...params: any[]): Database.RunResult;
|
||||
get(...params: any[]): any;
|
||||
all(...params: any[]): any[];
|
||||
each(params: any, cb: (row: any) => void): void;
|
||||
each(cb: (row: any) => void): void;
|
||||
each(...params: any[]): void;
|
||||
pluck(toggleState?: boolean): this;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
declare class Transaction {
|
||||
database: Database;
|
||||
source: string;
|
||||
constructor(db: Database, sources: string[]);
|
||||
database: Database;
|
||||
source: string;
|
||||
constructor(db: Database, sources: string[]);
|
||||
|
||||
run(...params: any[]): RunResult;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
interface DatabaseOptions {
|
||||
memory?: boolean;
|
||||
readonly?: boolean;
|
||||
fileMustExist?: boolean;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
name?: string;
|
||||
varargs?: boolean;
|
||||
deterministic?: boolean;
|
||||
safeIntegers?: boolean;
|
||||
run(...params: any[]): Database.RunResult;
|
||||
bind(...params: any[]): this;
|
||||
safeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
interface Database {
|
||||
memory: boolean;
|
||||
readonly: boolean;
|
||||
name: string;
|
||||
open: boolean;
|
||||
inTransaction: boolean;
|
||||
memory: boolean;
|
||||
readonly: boolean;
|
||||
name: string;
|
||||
open: boolean;
|
||||
inTransaction: boolean;
|
||||
|
||||
prepare(source: string): Statement;
|
||||
transaction(sources: string[]): Transaction;
|
||||
exec(source: string): this;
|
||||
pragma(source: string, simplify?: boolean): any;
|
||||
checkpoint(databaseName?: string): this;
|
||||
register(cb: (...params: any[]) => any): this;
|
||||
register(options: RegistrationOptions, cb: (...params: any[]) => any): this;
|
||||
close(): this;
|
||||
defaultSafeIntegers(toggleState?: boolean): this;
|
||||
prepare(source: string): Statement;
|
||||
transaction(sources: string[]): Transaction;
|
||||
exec(source: string): this;
|
||||
pragma(source: string, simplify?: boolean): any;
|
||||
checkpoint(databaseName?: string): this;
|
||||
register(cb: (...params: any[]) => any): this;
|
||||
register(
|
||||
options: Database.RegistrationOptions,
|
||||
cb: (...params: any[]) => any
|
||||
): this;
|
||||
close(): this;
|
||||
defaultSafeIntegers(toggleState?: boolean): this;
|
||||
}
|
||||
|
||||
declare class SqliteError implements Error {
|
||||
name: string;
|
||||
message: string;
|
||||
code: string;
|
||||
constructor(message: string, code: string);
|
||||
name: string;
|
||||
message: string;
|
||||
code: string;
|
||||
constructor(message: string, code: string);
|
||||
}
|
||||
|
||||
interface DatabaseConstructor {
|
||||
new(filename: string, options?: DatabaseOptions): Database;
|
||||
(filename: string, options?: DatabaseOptions): Database;
|
||||
prototype: Database;
|
||||
new (filename: string, options?: Database.Options): Database;
|
||||
(filename: string, options?: Database.Options): Database;
|
||||
prototype: Database;
|
||||
|
||||
Integer: typeof Integer;
|
||||
SqliteError: typeof SqliteError;
|
||||
Integer: typeof Integer;
|
||||
SqliteError: typeof SqliteError;
|
||||
}
|
||||
|
||||
declare namespace Database {
|
||||
interface RunResult {
|
||||
changes: number;
|
||||
lastInsertRowid: Integer.IntLike;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
memory?: boolean;
|
||||
readonly?: boolean;
|
||||
fileMustExist?: boolean;
|
||||
}
|
||||
|
||||
interface RegistrationOptions {
|
||||
name?: string;
|
||||
varargs?: boolean;
|
||||
deterministic?: boolean;
|
||||
safeIntegers?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const Database: DatabaseConstructor;
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ export const wordlists: {
|
||||
spanish: string[];
|
||||
};
|
||||
|
||||
export function entropyToMnemonic(entropyHex: string, wordlist?: string[]): string;
|
||||
export function entropyToMnemonic(entropyHex: Buffer | string, wordlist?: string[]): string;
|
||||
|
||||
export function generateMnemonic(strength?: number, rng?: (size: number) => Buffer, wordlist?: string[]): string;
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
import xor = require('bitwise-xor');
|
||||
|
||||
"use strict";
|
||||
let b: Buffer;
|
||||
|
||||
import xor = require("bitwise-xor");
|
||||
|
||||
var b: Buffer;
|
||||
|
||||
b = xor("a", "b");
|
||||
b = xor(new Buffer("a"), new Buffer("b"));
|
||||
b = xor('a', 'b');
|
||||
b = xor(new Buffer('a'), new Buffer('b'));
|
||||
|
||||
Vendored
+3
-4
@@ -1,15 +1,14 @@
|
||||
// Type definitions for bitwise-xor 0.0.0
|
||||
// Type definitions for bitwise-xor 0.0
|
||||
// Project: https://github.com/czzarr/node-bitwise-xor
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
/**
|
||||
* Bitwise XOR between two Buffers or Strings, returns a Buffer
|
||||
*/
|
||||
declare function xor(b1: Buffer, b2: Buffer): Buffer;
|
||||
declare function xor(s1: string, s2: string): Buffer;
|
||||
declare function xor(a: Buffer | string, b: Buffer | string): Buffer;
|
||||
|
||||
export = xor;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"bitwise-xor-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,79 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"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,
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+21
-15
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/braintree/braintree-web
|
||||
// Definitions by: Guy Shahine <https://github.com/chlela>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/**
|
||||
* @module braintree-web/american-express
|
||||
@@ -359,7 +360,8 @@ declare namespace braintree {
|
||||
* });
|
||||
* @static
|
||||
*/
|
||||
create: (options: { authorization: string }, callback: callback) => void;
|
||||
create(options: { authorization: string }): Promise<Client>;
|
||||
create(options: { authorization: string }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* @description The current version of the SDK, i.e. `3.0.2`.
|
||||
@@ -439,7 +441,8 @@ declare namespace braintree {
|
||||
* @param {callback} callback The second argument, `data`, is the {@link DataCollector} instance.
|
||||
* @returns {void}
|
||||
*/
|
||||
create: (options: { client: Client, kount: boolean, paypal: boolean }, callback: callback) => void;
|
||||
create(options: { client: Client, kount: boolean, paypal: boolean }): Promise<DataCollector>;
|
||||
create(options: { client: Client, kount: boolean, paypal: boolean }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* @description The current version of the SDK, i.e. `3.0.2`.
|
||||
@@ -591,18 +594,15 @@ declare namespace braintree {
|
||||
* @property {?HostedFields~hostedFieldsFieldData} fields.expirationYear {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration year field, if it is present.
|
||||
* @property {?HostedFields~hostedFieldsFieldData} fields.postalCode {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the postal code field, if it is present.
|
||||
*/
|
||||
interface HostedFieldsFieldDataFields {
|
||||
number: HostedFieldsHostedFieldsFieldData;
|
||||
cvv: HostedFieldsHostedFieldsFieldData;
|
||||
expirationDate: HostedFieldsHostedFieldsFieldData;
|
||||
expirationMonth: HostedFieldsHostedFieldsFieldData;
|
||||
expirationYear: HostedFieldsHostedFieldsFieldData;
|
||||
postalCode: HostedFieldsHostedFieldsFieldData;
|
||||
}
|
||||
type HostedFieldsHostedFieldsFieldName = 'number' | 'cvv' | 'expirationDate' | 'expirationMonth' | 'expirationYear' | 'postalCode';
|
||||
|
||||
type HostedFieldsFieldDataFields = {
|
||||
[key in HostedFieldsHostedFieldsFieldName]: HostedFieldsHostedFieldsFieldData;
|
||||
};
|
||||
|
||||
interface HostedFieldsStateObject {
|
||||
cards: HostedFieldsHostedFieldsCard[];
|
||||
emittedBy: string;
|
||||
emittedBy: HostedFieldsHostedFieldsFieldName;
|
||||
fields: HostedFieldsFieldDataFields;
|
||||
}
|
||||
|
||||
@@ -666,7 +666,8 @@ declare namespace braintree {
|
||||
* }
|
||||
* }, callback);
|
||||
*/
|
||||
create: (options: { client: Client, fields: HostedFieldFieldOptions, styles: any }, callback: callback) => void;
|
||||
create(options: { client: Client, fields: HostedFieldFieldOptions, styles: any }): Promise<HostedFields>;
|
||||
create(options: { client: Client, fields: HostedFieldFieldOptions, styles: any }, callback: callback): void;
|
||||
|
||||
|
||||
/**
|
||||
@@ -726,7 +727,7 @@ declare namespace braintree {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
on(event: string, handler: ((event: any) => any)): void;
|
||||
on(event: string, handler: ((event: HostedFieldsStateObject) => void)): void;
|
||||
|
||||
/**
|
||||
* Cleanly tear down anything set up by {@link module:braintree-web/hosted-fields.create|create}
|
||||
@@ -785,7 +786,9 @@ declare namespace braintree {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
tokenize(options?: { vault: boolean }, callback?: callback): void;
|
||||
tokenize(options?: { vault?: boolean, cardholderName?: string, billingAddress?: any }): Promise<HostedFieldsTokenizePayload>;
|
||||
tokenize(options: { vault?: boolean, cardholderName?: string, billingAddress?: any }, callback: callback): void;
|
||||
tokenize(callback: callback): void;
|
||||
|
||||
/**
|
||||
* Add a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
|
||||
@@ -1138,7 +1141,8 @@ declare namespace braintree {
|
||||
* client: client
|
||||
* }, callback);
|
||||
*/
|
||||
create: (options: { client: Client }, callback: callback) => void;
|
||||
create(options: { client: Client }): Promise<ThreeDSecure>;
|
||||
create(options: { client: Client }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* @description The current version of the SDK, i.e. `3.0.2`.
|
||||
@@ -1207,6 +1211,7 @@ declare namespace braintree {
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame?: () => void }): Promise<ThreeDSecureVerifyPayload>;
|
||||
verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
|
||||
|
||||
/**
|
||||
@@ -1751,3 +1756,4 @@ declare namespace braintree {
|
||||
|
||||
export = braintree;
|
||||
export as namespace braintree;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiO
|
||||
|
||||
braintree.client.create({
|
||||
authorization: clientToken
|
||||
}, function (error: braintree.BraintreeError, clientInstance: any) {
|
||||
}, function (error: braintree.BraintreeError, clientInstance: braintree.Client) {
|
||||
|
||||
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
|
||||
var data: { creditCard: braintree.CreditCardInfo } = {
|
||||
@@ -396,7 +396,7 @@ let submitNonceToServer: (nonce: string) => void;
|
||||
|
||||
braintree.threeDSecure.verifyCard({
|
||||
nonce: existingNonce,
|
||||
amount: 123.45,
|
||||
amount: 123.45, // $ExpectType number
|
||||
addFrame: function (err, iframe) {
|
||||
// Set up your UI and add the iframe.
|
||||
let my3DSContainer = document.createElement('div');
|
||||
@@ -437,4 +437,4 @@ braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError,
|
||||
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
|
||||
verifyPayload.liabilityShifted; // boolean
|
||||
verifyPayload.liabilityShiftPossible; // boolean
|
||||
});
|
||||
});
|
||||
@@ -1,10 +1,13 @@
|
||||
import { ApplePay } from "..";
|
||||
import * as braintree from "..";
|
||||
|
||||
let version: string = braintree.VERSION;
|
||||
|
||||
let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI0YjlhYzVmYmI4ZTNkYzQzMmFkZjJhNzBlNjZlMWNjY2M5ODRkYzE4ZTM4YmY4NjYzZTM5NjM3NWZjYmQzY2U5fGNyZWF0ZWRfYXQ9MjAxNi0wOS0wOFQwNTowMzo0MC4xNjk1NTUwMzUrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJtZXJjaGFudEFjY291bnRJZCI6ImFjbWV3aWRnZXRzbHRkc2FuZGJveCIsImN1cnJlbmN5SXNvQ29kZSI6IlVTRCJ9LCJjb2luYmFzZUVuYWJsZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
|
||||
|
||||
braintree.client.create({
|
||||
authorization: clientToken
|
||||
}, function (error: braintree.BraintreeError, clientInstance: any) {
|
||||
}, function (error: braintree.BraintreeError, clientInstance: braintree.Client) {
|
||||
|
||||
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
|
||||
var data: { creditCard: braintree.CreditCardInfo } = {
|
||||
@@ -62,7 +65,7 @@ braintree.client.create({
|
||||
select: true
|
||||
}
|
||||
}
|
||||
}, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
|
||||
}, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: braintree.HostedFields) {
|
||||
|
||||
if (hostedFieldsErr) {
|
||||
// Handle error in Hosted Fields creation
|
||||
@@ -178,7 +181,7 @@ braintree.client.create({
|
||||
});
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: ApplePay) {
|
||||
if (createErr) {
|
||||
// Handle error in client creation
|
||||
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
|
||||
@@ -194,7 +197,7 @@ braintree.client.create({
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var paymentRequest = braintree.applePay.createPaymentRequest(request);
|
||||
var paymentRequest = applePayInstance.createPaymentRequest(request);
|
||||
|
||||
console.log(paymentRequest);
|
||||
// { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
|
||||
@@ -394,7 +397,7 @@ let submitNonceToServer: (nonce: string) => void;
|
||||
|
||||
braintree.threeDSecure.verifyCard({
|
||||
nonce: existingNonce,
|
||||
amount: 123.45,
|
||||
amount: 123.45, // $ExpectType number
|
||||
addFrame: function (err, iframe) {
|
||||
// Set up your UI and add the iframe.
|
||||
let my3DSContainer = document.createElement('div');
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import browserslist from "browserslist";
|
||||
|
||||
browserslist(); // $ExpectType string[]
|
||||
browserslist(""); // $ExpectType string[]
|
||||
browserslist([""]); // $ExpectType string[]
|
||||
|
||||
const opts: browserslist.Options[] = [
|
||||
{},
|
||||
{ path: "" },
|
||||
{ env: "" },
|
||||
{ stats: { "": { "": 0 } } },
|
||||
{ config: "" },
|
||||
{ ignoreUnknownVersions: false },
|
||||
{ dangerousExtend: false }
|
||||
];
|
||||
for (const opt of opts) {
|
||||
browserslist("", opt); // $ExpectType string[]
|
||||
browserslist([""], opt); // $ExpectType string[]
|
||||
}
|
||||
|
||||
browserslist.coverage([""]); // $ExpectType number
|
||||
browserslist.coverage([""], { "": { "": 0 } }); // $ExpectType number
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for browserslist 4.3
|
||||
// Project: https://github.com/browserslist/browserslist#readme
|
||||
// Definitions by: Dave Cardwell <https://github.com/davecardwell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
declare namespace browserslist {
|
||||
interface Browserslist {
|
||||
(queries?: string | ReadonlyArray<string>, opts?: Options): string[];
|
||||
|
||||
coverage: (browsers: ReadonlyArray<string>, stats?: Stats) => number;
|
||||
|
||||
clearCaches: () => void;
|
||||
}
|
||||
|
||||
interface Stats {
|
||||
[browser: string]: {
|
||||
[version: string]: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface Options {
|
||||
path?: string;
|
||||
env?: string;
|
||||
stats?: Stats;
|
||||
config?: string;
|
||||
ignoreUnknownVersions?: boolean;
|
||||
dangerousExtend?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var browserslist: browserslist.Browserslist;
|
||||
|
||||
export = browserslist;
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": ["index.d.ts", "browserslist-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -98,11 +98,17 @@ const pdfQueue = new Queue('pdf transcoding', {
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pdfQueue.process((job) => {
|
||||
pdfQueue.process((job: Queue.Job) => {
|
||||
// Processors can also return promises instead of using the done callback
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
async function pfdPromise(job: Queue.Job) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
pdfQueue.process(1, pfdPromise);
|
||||
|
||||
videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 })
|
||||
.then((video1Job) => {
|
||||
// When job has successfully be placed in the queue the job is returned
|
||||
@@ -133,7 +139,7 @@ pdfQueue
|
||||
.on('failed', (job: Queue.Job) => undefined)
|
||||
.on('paused', () => undefined)
|
||||
.on('resumed', () => undefined)
|
||||
.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatus) => undefined)
|
||||
.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatusClean) => undefined)
|
||||
.on('drained', () => undefined)
|
||||
.on('removed', (job: Queue.Job) => undefined);
|
||||
|
||||
|
||||
Vendored
+40
-94
@@ -1,4 +1,4 @@
|
||||
// Type definitions for bull 3.4
|
||||
// Type definitions for bull 3.5
|
||||
// Project: https://github.com/OptimalBits/bull
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
|
||||
// Cameron Crothers <https://github.com/JProgrammer>
|
||||
@@ -11,11 +11,12 @@
|
||||
// Wuha Team <https://github.com/wuha-team>
|
||||
// Alec Brunelle <https://github.com/aleccool213>
|
||||
// Dan Manastireanu <https://github.com/danmana>
|
||||
// Kjell-Morten Bratsberg Thorsen <https://github.com/kjellmorten>
|
||||
// Christian D. <https://github.com/pc-jedi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as Redis from "ioredis";
|
||||
import * as Promise from "bluebird";
|
||||
|
||||
/**
|
||||
* This is the Queue constructor.
|
||||
@@ -91,7 +92,7 @@ declare namespace Bull {
|
||||
* Define a custom backoff strategy
|
||||
*/
|
||||
backoffStrategies?: {
|
||||
[key: string]: (attemptsMade: number, err: typeof Error) => number;
|
||||
[key: string]: (attemptsMade: number, err: Error) => number;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -194,6 +195,7 @@ declare namespace Bull {
|
||||
}
|
||||
|
||||
type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed';
|
||||
type JobStatusClean = 'completed' | 'wait' | 'active' | 'delayed' | 'failed';
|
||||
|
||||
interface BackoffOptions {
|
||||
/**
|
||||
@@ -340,50 +342,39 @@ declare namespace Bull {
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* If the callback signature contains the second optional done argument,
|
||||
* the callback will be passed a done callback to be called after the job has been completed.
|
||||
* The done callback can be called with an Error instance, to signal that the job did not complete successfully,
|
||||
* or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event;
|
||||
* results, as a second argument to the "completed" event.
|
||||
*/
|
||||
process(callback: (job: Job<T>, done: DoneCallback) => void): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
* or with a result as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If, however, the callback signature does not contain the done argument,
|
||||
* a promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*/
|
||||
process(callback: ((job: Job<T>) => void) | string): Promise<any>;
|
||||
process(callback: ((job: Job<T>, done: DoneCallback) => void) | ((job: Job<T>) => Promise<any>) | string): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If the callback signature contains the second optional done argument,
|
||||
* the callback will be passed a done callback to be called after the job has been completed.
|
||||
* The done callback can be called with an Error instance, to signal that the job did not complete successfully,
|
||||
* or with a result as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.
|
||||
*
|
||||
* If, however, the callback signature does not contain the done argument,
|
||||
* a promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
* @param concurrency Bull will then call your handler in parallel respecting this maximum value.
|
||||
*/
|
||||
process(concurrency: number, callback: ((job: Job<T>) => void) | string): Promise<any>;
|
||||
process(concurrency: number, callback: ((job: Job<T>, done: DoneCallback) => void) | ((job: Job<T>) => Promise<any>) | string): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
@@ -391,35 +382,21 @@ declare namespace Bull {
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* If the callback signature contains the second optional done argument,
|
||||
* the callback will be passed a done callback to be called after the job has been completed.
|
||||
* The done callback can be called with an Error instance, to signal that the job did not complete successfully,
|
||||
* or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event;
|
||||
* results, as a second argument to the "completed" event.
|
||||
* or with a result as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.
|
||||
*
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
*/
|
||||
process(concurrency: number, callback: (job: Job<T>, done: DoneCallback) => void): void;
|
||||
|
||||
/**
|
||||
* Defines a named processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If, however, the callback signature does not contain the done argument,
|
||||
* a promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*
|
||||
* @param name Bull will only call the handler if the job name matches
|
||||
*/
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
process(name: string, callback: ((job: Job<T>) => void) | string): Promise<any>;
|
||||
process(name: string, callback: ((job: Job<T>, done: DoneCallback) => void) | ((job: Job<T>) => Promise<any>) | string): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
@@ -427,52 +404,21 @@ declare namespace Bull {
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* If the callback signature contains the second optional done argument,
|
||||
* the callback will be passed a done callback to be called after the job has been completed.
|
||||
* The done callback can be called with an Error instance, to signal that the job did not complete successfully,
|
||||
* or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event;
|
||||
* results, as a second argument to the "completed" event.
|
||||
* or with a result as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event; results, as a second argument to the "completed" event.
|
||||
*
|
||||
* @param name Bull will only call the handler if the job name matches
|
||||
*/
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
process(name: string, callback: (job: Job<T>, done: DoneCallback) => void): void;
|
||||
|
||||
/**
|
||||
* Defines a named processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If, however, the callback signature does not contain the done argument,
|
||||
* a promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*
|
||||
* @param name Bull will only call the handler if the job name matches
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
* @param concurrency Bull will then call your handler in parallel respecting this maximum value.
|
||||
*/
|
||||
process(name: string, concurrency: number, callback: ((job: Job<T>) => void) | string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* The done callback can be called with an Error instance, to signal that the job did not complete successfully,
|
||||
* or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful.
|
||||
* Errors will be passed as a second argument to the "failed" event;
|
||||
* results, as a second argument to the "completed" event.
|
||||
*
|
||||
* @param name Bull will only call the handler if the job name matches
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
*/
|
||||
process(name: string, concurrency: number, callback: (job: Job<T>, done: DoneCallback) => void): void;
|
||||
process(name: string, concurrency: number, callback: ((job: Job<T>, done: DoneCallback) => void) | ((job: Job<T>) => Promise<any>) | string): void;
|
||||
|
||||
/**
|
||||
* Creates a new job and adds it to the queue.
|
||||
@@ -635,12 +581,12 @@ declare namespace Bull {
|
||||
|
||||
/**
|
||||
* Tells the queue remove all jobs created outside of a grace period in milliseconds.
|
||||
* You can clean the jobs with the following states: completed, waiting, active, delayed, and failed.
|
||||
* You can clean the jobs with the following states: completed, wait (typo for waiting), active, delayed, and failed.
|
||||
* @param grace Grace period in milliseconds.
|
||||
* @param status Status of the job to clean. Values are completed, wait, active, delayed, and failed. Defaults to completed.
|
||||
* @param limit Maximum amount of jobs to clean per call. If not provided will clean all matching jobs.
|
||||
*/
|
||||
clean(grace: number, status?: JobStatus, limit?: number): Promise<Array<Job<T>>>;
|
||||
clean(grace: number, status?: JobStatusClean, limit?: number): Promise<Array<Job<T>>>;
|
||||
|
||||
/**
|
||||
* Listens to queue events
|
||||
@@ -734,7 +680,7 @@ declare namespace Bull {
|
||||
|
||||
type FailedEventCallback<T = any> = (job: Job<T>, error: Error) => void;
|
||||
|
||||
type CleanedEventCallback<T = any> = (jobs: Array<Job<T>>, status: JobStatus) => void;
|
||||
type CleanedEventCallback<T = any> = (jobs: Array<Job<T>>, status: JobStatusClean) => void;
|
||||
|
||||
type RemovedEventCallback<T = any> = (job: Job<T>) => void;
|
||||
|
||||
|
||||
-238
@@ -1,239 +1 @@
|
||||
// Type definitions for business-rules-engine - v1.0.20
|
||||
// Project: https://github.com/rsamec/form
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Validation {
|
||||
interface IErrorCustomMessage {
|
||||
(config: any, args: any): string;
|
||||
}
|
||||
interface IPropertyValidator {
|
||||
isAcceptable(s: any): boolean;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IStringValidator extends IPropertyValidator {
|
||||
isAcceptable(s: string): boolean;
|
||||
}
|
||||
interface IAsyncPropertyValidator {
|
||||
isAcceptable(s: any): Q.Promise<boolean>;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
isAsync: boolean;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
|
||||
isAcceptable(s: string): Q.Promise<boolean>;
|
||||
}
|
||||
enum CompareOperator {
|
||||
LessThan = 0,
|
||||
LessThanEqual = 1,
|
||||
Equal = 2,
|
||||
NotEqual = 3,
|
||||
GreaterThanEqual = 4,
|
||||
GreaterThan = 5,
|
||||
}
|
||||
interface IError {
|
||||
HasError: boolean;
|
||||
ErrorMessage: string;
|
||||
TranslateArgs?: IErrorTranslateArgs;
|
||||
}
|
||||
interface IErrorTranslateArgs {
|
||||
TranslateId: string;
|
||||
MessageArgs: any;
|
||||
CustomMessage?: IErrorCustomMessage;
|
||||
}
|
||||
interface IOptional {
|
||||
(): boolean;
|
||||
}
|
||||
interface IValidationFailure extends IError {
|
||||
IsAsync: boolean;
|
||||
Error: IError;
|
||||
}
|
||||
interface IValidationResult {
|
||||
Name: string;
|
||||
Add(validationResult: IValidationResult): void;
|
||||
Remove(index: number): void;
|
||||
Children: IValidationResult[];
|
||||
HasErrors: boolean;
|
||||
HasErrorsDirty: boolean;
|
||||
ErrorMessage: string;
|
||||
ErrorCount: number;
|
||||
Optional?: IOptional;
|
||||
TranslateArgs?: IErrorTranslateArgs[];
|
||||
}
|
||||
interface IValidate {
|
||||
(args: IError): void;
|
||||
}
|
||||
interface IAsyncValidate {
|
||||
(args: IError): Q.Promise<any>;
|
||||
}
|
||||
interface IValidatorFce {
|
||||
Name: string;
|
||||
ValidationFce?: IValidate;
|
||||
AsyncValidationFce?: IAsyncValidate;
|
||||
}
|
||||
interface IValidator {
|
||||
Validate(context: any): IValidationFailure;
|
||||
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
|
||||
Error: IError;
|
||||
}
|
||||
interface IAbstractValidator<T> {
|
||||
RuleFor(prop: string, validator: IPropertyValidator): any;
|
||||
ValidationFor(prop: string, validatorFce: IValidatorFce): any;
|
||||
Validation(validatorFce: IValidatorFce): any;
|
||||
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
|
||||
CreateRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
|
||||
ForList: boolean;
|
||||
}
|
||||
interface IAbstractValidationRule<T> {
|
||||
Validate(context: T): IValidationResult;
|
||||
ValidateAsync(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateAll(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateProperty(context: T, propName: string): void;
|
||||
ValidationResult: IValidationResult;
|
||||
Rules: {
|
||||
[name: string]: IPropertyValidationRule<T>;
|
||||
};
|
||||
Validators: {
|
||||
[name: string]: IValidator;
|
||||
};
|
||||
Children: {
|
||||
[name: string]: IAbstractValidationRule<any>;
|
||||
};
|
||||
}
|
||||
interface IPropertyValidationRule<T> {
|
||||
Validators: {
|
||||
[name: string]: any;
|
||||
};
|
||||
Validate(context: IValidationContext<T>): IValidationFailure[];
|
||||
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
|
||||
}
|
||||
interface IValidationContext<T> {
|
||||
Value: string;
|
||||
Key: string;
|
||||
Data: T;
|
||||
}
|
||||
class Error implements IError {
|
||||
public HasError: boolean;
|
||||
public ErrorMessage: string;
|
||||
constructor();
|
||||
}
|
||||
class ValidationFailure implements IError {
|
||||
public Error: IError;
|
||||
public IsAsync: boolean;
|
||||
constructor(Error: IError, IsAsync: boolean);
|
||||
public HasError : boolean;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs;
|
||||
}
|
||||
class ValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
constructor(Name: string);
|
||||
public IsDirty: boolean;
|
||||
public Children : IValidationResult[];
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public Optional: IOptional;
|
||||
public TranslateArgs: IErrorTranslateArgs[];
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
}
|
||||
class CompositeValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
public Children: IValidationResult[];
|
||||
constructor(Name: string);
|
||||
public Optional: IOptional;
|
||||
public AddFirst(error: IValidationResult): void;
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs[];
|
||||
public LogErrors(headerMessage?: string): void;
|
||||
public Errors : {
|
||||
[name: string]: IValidationResult;
|
||||
};
|
||||
private FlattenErros;
|
||||
public SetDirty(): void;
|
||||
public SetPristine(): void;
|
||||
private SetDirtyEx(node, dirty);
|
||||
private flattenErrors(node, errorCollection);
|
||||
private traverse(node, indent);
|
||||
}
|
||||
class AbstractValidator<T> implements IAbstractValidator<T> {
|
||||
public Validators: {
|
||||
[name: string]: IPropertyValidator[];
|
||||
};
|
||||
public AbstractValidators: {
|
||||
[name: string]: IAbstractValidator<any>;
|
||||
};
|
||||
public ValidationFunctions: {
|
||||
[name: string]: IValidatorFce[];
|
||||
};
|
||||
public RuleFor(prop: string, validator: IPropertyValidator): void;
|
||||
public ValidationFor(prop: string, fce: IValidatorFce): void;
|
||||
public Validation(fce: IValidatorFce): void;
|
||||
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
|
||||
public CreateAbstractRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateAbstractListRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateRule(name: string): IAbstractValidationRule<T>;
|
||||
public ForList: boolean;
|
||||
}
|
||||
class MessageLocalization {
|
||||
static customMsg: string;
|
||||
static defaultMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static ValidationMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static GetValidationMessage(validator: any): string;
|
||||
}
|
||||
}
|
||||
declare module "node-validation" {export = Validation;}
|
||||
|
||||
+230
-235
@@ -4,242 +4,237 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// Source: typings/business-rules-engine/Validation.d.ts
|
||||
|
||||
import * as Q from "q";
|
||||
|
||||
declare namespace Validation {
|
||||
interface IErrorCustomMessage {
|
||||
(config: any, args: any): string;
|
||||
}
|
||||
interface IPropertyValidator {
|
||||
isAcceptable(s: any): boolean;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IStringValidator extends IPropertyValidator {
|
||||
isAcceptable(s: string): boolean;
|
||||
}
|
||||
interface IAsyncPropertyValidator {
|
||||
isAcceptable(s: any): Q.Promise<boolean>;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
isAsync: boolean;
|
||||
tagName?: string;
|
||||
}
|
||||
interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
|
||||
isAcceptable(s: string): Q.Promise<boolean>;
|
||||
}
|
||||
enum CompareOperator {
|
||||
LessThan = 0,
|
||||
LessThanEqual = 1,
|
||||
Equal = 2,
|
||||
NotEqual = 3,
|
||||
GreaterThanEqual = 4,
|
||||
GreaterThan = 5,
|
||||
}
|
||||
interface IError {
|
||||
HasError: boolean;
|
||||
ErrorMessage: string;
|
||||
TranslateArgs?: IErrorTranslateArgs;
|
||||
}
|
||||
interface IErrorTranslateArgs {
|
||||
TranslateId: string;
|
||||
MessageArgs: any;
|
||||
CustomMessage?: IErrorCustomMessage;
|
||||
}
|
||||
interface IOptional {
|
||||
(): boolean;
|
||||
}
|
||||
interface IValidationFailure extends IError {
|
||||
IsAsync: boolean;
|
||||
Error: IError;
|
||||
}
|
||||
interface IValidationResult {
|
||||
Name: string;
|
||||
Add(validationResult: IValidationResult): void;
|
||||
Remove(index: number): void;
|
||||
Children: IValidationResult[];
|
||||
HasErrors: boolean;
|
||||
HasErrorsDirty: boolean;
|
||||
ErrorMessage: string;
|
||||
ErrorCount: number;
|
||||
Optional?: IOptional;
|
||||
TranslateArgs?: IErrorTranslateArgs[];
|
||||
}
|
||||
interface IValidate {
|
||||
(args: IError): void;
|
||||
}
|
||||
interface IAsyncValidate {
|
||||
(args: IError): Q.Promise<any>;
|
||||
}
|
||||
interface IValidatorFce {
|
||||
Name: string;
|
||||
ValidationFce?: IValidate;
|
||||
AsyncValidationFce?: IAsyncValidate;
|
||||
}
|
||||
interface IValidator {
|
||||
Validate(context: any): IValidationFailure;
|
||||
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
|
||||
Error: IError;
|
||||
}
|
||||
interface IAbstractValidator<T> {
|
||||
RuleFor(prop: string, validator: IPropertyValidator): any;
|
||||
ValidationFor(prop: string, validatorFce: IValidatorFce): any;
|
||||
Validation(validatorFce: IValidatorFce): any;
|
||||
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
|
||||
CreateRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
|
||||
ForList: boolean;
|
||||
}
|
||||
interface IAbstractValidationRule<T> {
|
||||
Validate(context: T): IValidationResult;
|
||||
ValidateAsync(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateAll(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateProperty(context: T, propName: string): void;
|
||||
ValidationResult: IValidationResult;
|
||||
Rules: {
|
||||
[name: string]: IPropertyValidationRule<T>;
|
||||
};
|
||||
Validators: {
|
||||
[name: string]: IValidator;
|
||||
};
|
||||
Children: {
|
||||
[name: string]: IAbstractValidationRule<any>;
|
||||
};
|
||||
}
|
||||
interface IPropertyValidationRule<T> {
|
||||
Validators: {
|
||||
[name: string]: any;
|
||||
};
|
||||
Validate(context: IValidationContext<T>): IValidationFailure[];
|
||||
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
|
||||
}
|
||||
interface IValidationContext<T> {
|
||||
Value: string;
|
||||
Key: string;
|
||||
Data: T;
|
||||
}
|
||||
class Error implements IError {
|
||||
public HasError: boolean;
|
||||
public ErrorMessage: string;
|
||||
constructor();
|
||||
}
|
||||
class ValidationFailure implements IError {
|
||||
public Error: IError;
|
||||
public IsAsync: boolean;
|
||||
constructor(Error: IError, IsAsync: boolean);
|
||||
public HasError : boolean;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs;
|
||||
}
|
||||
class ValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
constructor(Name: string);
|
||||
public IsDirty: boolean;
|
||||
public Children : IValidationResult[];
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public Optional: IOptional;
|
||||
public TranslateArgs: IErrorTranslateArgs[];
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
}
|
||||
class CompositeValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
public Children: IValidationResult[];
|
||||
constructor(Name: string);
|
||||
public Optional: IOptional;
|
||||
public AddFirst(error: IValidationResult): void;
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs[];
|
||||
public LogErrors(headerMessage?: string): void;
|
||||
public Errors : {
|
||||
[name: string]: IValidationResult;
|
||||
};
|
||||
private FlattenErros;
|
||||
public SetDirty(): void;
|
||||
public SetPristine(): void;
|
||||
private SetDirtyEx(node, dirty);
|
||||
private flattenErrors(node, errorCollection);
|
||||
private traverse(node, indent);
|
||||
}
|
||||
class AbstractValidator<T> implements IAbstractValidator<T> {
|
||||
public Validators: {
|
||||
[name: string]: IPropertyValidator[];
|
||||
};
|
||||
public AbstractValidators: {
|
||||
[name: string]: IAbstractValidator<any>;
|
||||
};
|
||||
public ValidationFunctions: {
|
||||
[name: string]: IValidatorFce[];
|
||||
};
|
||||
public RuleFor(prop: string, validator: IPropertyValidator): void;
|
||||
public ValidationFor(prop: string, fce: IValidatorFce): void;
|
||||
public Validation(fce: IValidatorFce): void;
|
||||
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
|
||||
public CreateAbstractRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateAbstractListRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateRule(name: string): IAbstractValidationRule<T>;
|
||||
public ForList: boolean;
|
||||
}
|
||||
class MessageLocalization {
|
||||
static customMsg: string;
|
||||
static defaultMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static ValidationMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static GetValidationMessage(validator: any): string;
|
||||
}
|
||||
export interface IErrorCustomMessage {
|
||||
(config: any, args: any): string;
|
||||
}
|
||||
export interface IPropertyValidator {
|
||||
isAcceptable(s: any): boolean;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
tagName?: string;
|
||||
}
|
||||
export interface IStringValidator extends IPropertyValidator {
|
||||
isAcceptable(s: string): boolean;
|
||||
}
|
||||
export interface IAsyncPropertyValidator {
|
||||
isAcceptable(s: any): Q.Promise<boolean>;
|
||||
customMessage?: IErrorCustomMessage;
|
||||
isAsync: boolean;
|
||||
tagName?: string;
|
||||
}
|
||||
export interface IAsyncStringPropertyValidator extends IAsyncPropertyValidator {
|
||||
isAcceptable(s: string): Q.Promise<boolean>;
|
||||
}
|
||||
export enum CompareOperator {
|
||||
LessThan = 0,
|
||||
LessThanEqual = 1,
|
||||
Equal = 2,
|
||||
NotEqual = 3,
|
||||
GreaterThanEqual = 4,
|
||||
GreaterThan = 5,
|
||||
}
|
||||
export interface IError {
|
||||
HasError: boolean;
|
||||
ErrorMessage: string;
|
||||
TranslateArgs?: IErrorTranslateArgs;
|
||||
}
|
||||
export interface IErrorTranslateArgs {
|
||||
TranslateId: string;
|
||||
MessageArgs: any;
|
||||
CustomMessage?: IErrorCustomMessage;
|
||||
}
|
||||
export interface IOptional {
|
||||
(): boolean;
|
||||
}
|
||||
export interface IValidationFailure extends IError {
|
||||
IsAsync: boolean;
|
||||
Error: IError;
|
||||
}
|
||||
export interface IValidationResult {
|
||||
Name: string;
|
||||
Add(validationResult: IValidationResult): void;
|
||||
Remove(index: number): void;
|
||||
Children: IValidationResult[];
|
||||
HasErrors: boolean;
|
||||
HasErrorsDirty: boolean;
|
||||
ErrorMessage: string;
|
||||
ErrorCount: number;
|
||||
Optional?: IOptional;
|
||||
TranslateArgs?: IErrorTranslateArgs[];
|
||||
}
|
||||
export interface IValidate {
|
||||
(args: IError): void;
|
||||
}
|
||||
export interface IAsyncValidate {
|
||||
(args: IError): Q.Promise<any>;
|
||||
}
|
||||
export interface IValidatorFce {
|
||||
Name: string;
|
||||
ValidationFce?: IValidate;
|
||||
AsyncValidationFce?: IAsyncValidate;
|
||||
}
|
||||
export interface IValidator {
|
||||
Validate(context: any): IValidationFailure;
|
||||
ValidateAsync(context: any): Q.Promise<IValidationFailure>;
|
||||
Error: IError;
|
||||
}
|
||||
export interface IAbstractValidator<T> {
|
||||
RuleFor(prop: string, validator: IPropertyValidator): any;
|
||||
ValidationFor(prop: string, validatorFce: IValidatorFce): any;
|
||||
Validation(validatorFce: IValidatorFce): any;
|
||||
ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>): any;
|
||||
CreateRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractRule(name: string): IAbstractValidationRule<any>;
|
||||
CreateAbstractListRule(name: string): IAbstractValidationRule<any>;
|
||||
ForList: boolean;
|
||||
}
|
||||
export interface IAbstractValidationRule<T> {
|
||||
Validate(context: T): IValidationResult;
|
||||
ValidateAsync(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateAll(context: T): Q.Promise<IValidationResult>;
|
||||
ValidateProperty(context: T, propName: string): void;
|
||||
ValidationResult: IValidationResult;
|
||||
Rules: {
|
||||
[name: string]: IPropertyValidationRule<T>;
|
||||
};
|
||||
Validators: {
|
||||
[name: string]: IValidator;
|
||||
};
|
||||
Children: {
|
||||
[name: string]: IAbstractValidationRule<any>;
|
||||
};
|
||||
}
|
||||
export interface IPropertyValidationRule<T> {
|
||||
Validators: {
|
||||
[name: string]: any;
|
||||
};
|
||||
Validate(context: IValidationContext<T>): IValidationFailure[];
|
||||
ValidateAsync(context: IValidationContext<T>): Q.Promise<IValidationFailure[]>;
|
||||
}
|
||||
export interface IValidationContext<T> {
|
||||
Value: string;
|
||||
Key: string;
|
||||
Data: T;
|
||||
}
|
||||
export class Error implements IError {
|
||||
public HasError: boolean;
|
||||
public ErrorMessage: string;
|
||||
constructor();
|
||||
}
|
||||
export class ValidationFailure implements IError {
|
||||
public Error: IError;
|
||||
public IsAsync: boolean;
|
||||
constructor(Error: IError, IsAsync: boolean);
|
||||
public HasError : boolean;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs;
|
||||
}
|
||||
export class ValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
constructor(Name: string);
|
||||
public IsDirty: boolean;
|
||||
public Children : IValidationResult[];
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public Optional: IOptional;
|
||||
public TranslateArgs: IErrorTranslateArgs[];
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
}
|
||||
export class CompositeValidationResult implements IValidationResult {
|
||||
public Name: string;
|
||||
public Children: IValidationResult[];
|
||||
constructor(Name: string);
|
||||
public Optional: IOptional;
|
||||
public AddFirst(error: IValidationResult): void;
|
||||
public Add(error: IValidationResult): void;
|
||||
public Remove(index: number): void;
|
||||
public HasErrorsDirty : boolean;
|
||||
public HasErrors : boolean;
|
||||
public ErrorCount : number;
|
||||
public ErrorMessage : string;
|
||||
public TranslateArgs : IErrorTranslateArgs[];
|
||||
public LogErrors(headerMessage?: string): void;
|
||||
public Errors : {
|
||||
[name: string]: IValidationResult;
|
||||
};
|
||||
private FlattenErros;
|
||||
public SetDirty(): void;
|
||||
public SetPristine(): void;
|
||||
private SetDirtyEx(node, dirty);
|
||||
private flattenErrors(node, errorCollection);
|
||||
private traverse(node, indent);
|
||||
}
|
||||
export class AbstractValidator<T> implements IAbstractValidator<T> {
|
||||
public Validators: {
|
||||
[name: string]: IPropertyValidator[];
|
||||
};
|
||||
public AbstractValidators: {
|
||||
[name: string]: IAbstractValidator<any>;
|
||||
};
|
||||
public ValidationFunctions: {
|
||||
[name: string]: IValidatorFce[];
|
||||
};
|
||||
public RuleFor(prop: string, validator: IPropertyValidator): void;
|
||||
public ValidationFor(prop: string, fce: IValidatorFce): void;
|
||||
public Validation(fce: IValidatorFce): void;
|
||||
public ValidatorFor<K>(prop: string, validator: IAbstractValidator<K>, forList?: boolean): void;
|
||||
public CreateAbstractRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateAbstractListRule(name: string): IAbstractValidationRule<T>;
|
||||
public CreateRule(name: string): IAbstractValidationRule<T>;
|
||||
public ForList: boolean;
|
||||
}
|
||||
export class MessageLocalization {
|
||||
static customMsg: string;
|
||||
static defaultMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static ValidationMessages: {
|
||||
"required": string;
|
||||
"remote": string;
|
||||
"email": string;
|
||||
"url": string;
|
||||
"date": string;
|
||||
"dateISO": string;
|
||||
"number": string;
|
||||
"digits": string;
|
||||
"signedDigits": string;
|
||||
"creditcard": string;
|
||||
"equalTo": string;
|
||||
"maxlength": string;
|
||||
"minlength": string;
|
||||
"rangelength": string;
|
||||
"range": string;
|
||||
"max": string;
|
||||
"min": string;
|
||||
"step": string;
|
||||
"contains": string;
|
||||
"mask": string;
|
||||
"custom": string;
|
||||
};
|
||||
static GetValidationMessage(validator: any): string;
|
||||
}
|
||||
export = Validation;
|
||||
export as namespace Validation;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import cachedPathRelative = require("cached-path-relative");
|
||||
|
||||
function browserifyTest() {
|
||||
const file = "file.txt";
|
||||
const m1: string = cachedPathRelative("./", file).replace(/\\/g, '/');
|
||||
return m1;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for cached-path-relative 1.0
|
||||
// Project: https://github.com/ashaffer/cached-path-relative
|
||||
// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Memoize the results of the path.relative function. path.relative can be an expensive operation
|
||||
* if it happens a lot, and its results shouldn't change for the same arguments.
|
||||
* Use it just like your normal path.relative, but it's memoized.
|
||||
*/
|
||||
declare function cachedPathRelative(from: string, to: string): string;
|
||||
|
||||
export = cachedPathRelative;
|
||||
@@ -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",
|
||||
"cached-path-relative-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as CatboxMemory from 'catbox-memory';
|
||||
|
||||
const client = new CatboxMemory<string>({
|
||||
allowMixedContent: true,
|
||||
cloneBuffersOnGet: false,
|
||||
maxByteSize: 1024,
|
||||
minCleanupIntervalMsec: 1000,
|
||||
});
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for catbox-memory 4.0
|
||||
// Project: https://github.com/hapijs/catbox-memory#readme
|
||||
// Definitions by: Simon Schick <https://github.com/SimonSchick>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { ClientApi } from 'catbox';
|
||||
|
||||
interface CatboxMemory<T> extends ClientApi<T> {}
|
||||
|
||||
// tslint:disable-next-line:no-unnecessary-class
|
||||
declare class CatboxMemory<T> implements ClientApi<T> {
|
||||
constructor(options?: CatboxMemory.Options);
|
||||
}
|
||||
|
||||
declare namespace CatboxMemory {
|
||||
interface Options {
|
||||
/**
|
||||
* Sets an upper limit on the number of bytes that can be stored in the cache.
|
||||
* Once this limit is reached no additional items will be added to the cache until some expire.
|
||||
* The utilized memory calculation is a rough approximation and must not be relied on.
|
||||
* @default 104857600 (100MB).
|
||||
*/
|
||||
maxByteSize?: number;
|
||||
/**
|
||||
* The minimum number of milliseconds in between each cache cleanup.
|
||||
* @default 1000 (1 second)
|
||||
*/
|
||||
minCleanupIntervalMsec?: number;
|
||||
/**
|
||||
* by default, all data is cached as JSON strings, and converted to an object using JSON.parse() on retrieval.
|
||||
* By setting this option to true, Buffer data can be stored alongside the stringified data.
|
||||
* Buffers are not stringified, and are copied before storage to prevent the value from changing while in the cache.
|
||||
* @default false
|
||||
*/
|
||||
allowMixedContent?: boolean;
|
||||
/**
|
||||
* by default, buffers stored in the cache with allowMixedContent set to true are copied when they are set but not when they are retrieved.
|
||||
* This means a change to the buffer returned by a get() will change the value in the cache. To prevent this,
|
||||
* set cloneBuffersOnGet to true to always return a copy of the cached buffer.
|
||||
* @default false
|
||||
*/
|
||||
cloneBuffersOnGet?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = CatboxMemory;
|
||||
@@ -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",
|
||||
"catbox-memory-tests.ts"
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user