mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Unwrap all lone ambient external modules
This commit is contained in:
parent
fa7a5ddc9b
commit
4a433abbf4
23
JSONStream/JSONStream.d.ts
vendored
23
JSONStream/JSONStream.d.ts
vendored
@ -5,18 +5,17 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'JSONStream' {
|
||||
|
||||
export interface Options {
|
||||
recurse: boolean;
|
||||
}
|
||||
|
||||
export function parse(pattern: any): NodeJS.ReadWriteStream;
|
||||
export function parse(patterns: any[]): NodeJS.ReadWriteStream;
|
||||
|
||||
export function stringify(): NodeJS.ReadWriteStream;
|
||||
export function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream;
|
||||
|
||||
export function stringifyObject(): NodeJS.ReadWriteStream;
|
||||
export function stringifyObject(open: string, sep: string, close: string): NodeJS.ReadWriteStream;
|
||||
export interface Options {
|
||||
recurse: boolean;
|
||||
}
|
||||
|
||||
declare export function parse(pattern: any): NodeJS.ReadWriteStream;
|
||||
declare export function parse(patterns: any[]): NodeJS.ReadWriteStream;
|
||||
|
||||
declare export function stringify(): NodeJS.ReadWriteStream;
|
||||
declare export function stringify(open: string, sep: string, close: string): NodeJS.ReadWriteStream;
|
||||
|
||||
declare export function stringifyObject(): NodeJS.ReadWriteStream;
|
||||
declare export function stringifyObject(open: string, sep: string, close: string): NodeJS.ReadWriteStream;
|
||||
|
||||
15
abs/abs.d.ts
vendored
15
abs/abs.d.ts
vendored
@ -3,12 +3,11 @@
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "abs" {
|
||||
/**
|
||||
* Compute the absolute path of an input.
|
||||
* @param input The input path.
|
||||
*/
|
||||
function Abs(input: string): string;
|
||||
|
||||
export default Abs;
|
||||
}
|
||||
/**
|
||||
* Compute the absolute path of an input.
|
||||
* @param input The input path.
|
||||
*/
|
||||
declare function Abs(input: string): string;
|
||||
|
||||
export default Abs;
|
||||
|
||||
13
absolute/absolute.d.ts
vendored
13
absolute/absolute.d.ts
vendored
@ -3,11 +3,10 @@
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "absolute" {
|
||||
/**
|
||||
* Test if a path is absolute
|
||||
*/
|
||||
function absolute(path: string): boolean;
|
||||
|
||||
export default absolute;
|
||||
}
|
||||
/**
|
||||
* Test if a path is absolute
|
||||
*/
|
||||
declare function absolute(path: string): boolean;
|
||||
|
||||
export default absolute;
|
||||
|
||||
153
acl/acl.d.ts
vendored
153
acl/acl.d.ts
vendored
@ -9,42 +9,42 @@
|
||||
/// <reference path='../redis/redis.d.ts'/>
|
||||
/// <reference path="../mongodb/mongodb-1.4.9.d.ts" />
|
||||
|
||||
declare module "acl" {
|
||||
import http = require('http');
|
||||
import Promise = require("bluebird");
|
||||
|
||||
type strings = string|string[];
|
||||
type Value = string|number;
|
||||
type Values = Value|Value[];
|
||||
type Action = () => any;
|
||||
type Callback = (err: Error) => any;
|
||||
type AnyCallback = (err: Error, obj: any) => any;
|
||||
type AllowedCallback = (err: Error, allowed: boolean) => any;
|
||||
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value;
|
||||
import http = require('http');
|
||||
import Promise = require("bluebird");
|
||||
|
||||
interface AclStatic {
|
||||
type strings = string | string[];
|
||||
type Value = string | number;
|
||||
type Values = Value | Value[];
|
||||
type Action = () => any;
|
||||
type Callback = (err: Error) => any;
|
||||
type AnyCallback = (err: Error, obj: any) => any;
|
||||
type AllowedCallback = (err: Error, allowed: boolean) => any;
|
||||
type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value;
|
||||
|
||||
interface AclStatic {
|
||||
new (backend: Backend<any>, logger: Logger, options: Option): Acl;
|
||||
new (backend: Backend<any>, logger: Logger): Acl;
|
||||
new (backend: Backend<any>): Acl;
|
||||
memoryBackend: MemoryBackendStatic;
|
||||
}
|
||||
}
|
||||
|
||||
interface Logger {
|
||||
debug: (msg: string)=>any;
|
||||
}
|
||||
interface Logger {
|
||||
debug: (msg: string) => any;
|
||||
}
|
||||
|
||||
interface Acl {
|
||||
interface Acl {
|
||||
addUserRoles: (userId: Value, roles: strings, cb?: Callback) => Promise<void>;
|
||||
removeUserRoles: (userId: Value, roles: strings, cb?: Callback) => Promise<void>;
|
||||
userRoles: (userId: Value, cb?: (err: Error, roles: string[])=>any) => Promise<string[]>;
|
||||
roleUsers: (role: Value, cb?: (err: Error, users: Values)=>any) => Promise<any>;
|
||||
hasRole: (userId: Value, role: string, cb?: (err: Error, isInRole: boolean)=>any) => Promise<boolean>;
|
||||
userRoles: (userId: Value, cb?: (err: Error, roles: string[]) => any) => Promise<string[]>;
|
||||
roleUsers: (role: Value, cb?: (err: Error, users: Values) => any) => Promise<any>;
|
||||
hasRole: (userId: Value, role: string, cb?: (err: Error, isInRole: boolean) => any) => Promise<boolean>;
|
||||
addRoleParents: (role: string, parents: Values, cb?: Callback) => Promise<void>;
|
||||
removeRole: (role: string, cb?: Callback) => Promise<void>;
|
||||
removeResource: (resource: string, cb?: Callback) => Promise<void>;
|
||||
allow: {
|
||||
(roles: Values, resources: strings, permissions: strings, cb?: Callback): Promise<void>;
|
||||
(aclSets: AclSet|AclSet[]): Promise<void>;
|
||||
(roles: Values, resources: strings, permissions: strings, cb?: Callback): Promise<void>;
|
||||
(aclSets: AclSet | AclSet[]): Promise<void>;
|
||||
}
|
||||
removeAllow: (role: string, resources: strings, permissions: strings, cb?: Callback) => Promise<void>;
|
||||
removePermissions: (role: string, resources: strings, permissions: strings, cb?: Function) => Promise<void>;
|
||||
@ -53,41 +53,41 @@ declare module "acl" {
|
||||
areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise<any>;
|
||||
whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise<any>;
|
||||
permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise<void>;
|
||||
middleware: (numPathComponents: number, userId: Value|GetUserId, actions: strings) => Promise<any>;
|
||||
}
|
||||
middleware: (numPathComponents: number, userId: Value | GetUserId, actions: strings) => Promise<any>;
|
||||
}
|
||||
|
||||
interface Option {
|
||||
interface Option {
|
||||
buckets?: BucketsOption;
|
||||
}
|
||||
}
|
||||
|
||||
interface BucketsOption {
|
||||
interface BucketsOption {
|
||||
meta?: string;
|
||||
parents?: string;
|
||||
permissions?: string;
|
||||
resources?: string;
|
||||
roles?: string;
|
||||
users?: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface AclSet {
|
||||
interface AclSet {
|
||||
roles: strings;
|
||||
allows: AclAllow[];
|
||||
}
|
||||
}
|
||||
|
||||
interface AclAllow {
|
||||
interface AclAllow {
|
||||
resources: strings;
|
||||
permissions: strings;
|
||||
}
|
||||
}
|
||||
|
||||
interface MemoryBackend extends Backend<Action[]> { }
|
||||
interface MemoryBackendStatic {
|
||||
new(): MemoryBackend;
|
||||
}
|
||||
interface MemoryBackend extends Backend<Action[]> { }
|
||||
interface MemoryBackendStatic {
|
||||
new (): MemoryBackend;
|
||||
}
|
||||
|
||||
//
|
||||
// For internal use
|
||||
//
|
||||
interface Backend<T> {
|
||||
//
|
||||
// For internal use
|
||||
//
|
||||
interface Backend<T> {
|
||||
begin: () => T;
|
||||
end: (transaction: T, cb?: Action) => void;
|
||||
clean: (cb?: Action) => void;
|
||||
@ -101,50 +101,49 @@ declare module "acl" {
|
||||
getAsync: Function;
|
||||
cleanAsync: Function;
|
||||
unionAsync: Function;
|
||||
}
|
||||
}
|
||||
|
||||
interface Contract {
|
||||
(args: IArguments): Contract|NoOp;
|
||||
interface Contract {
|
||||
(args: IArguments): Contract | NoOp;
|
||||
debug: boolean;
|
||||
fulfilled: boolean;
|
||||
args: any[];
|
||||
checkedParams: string[];
|
||||
params: (...types: string[]) => Contract|NoOp;
|
||||
params: (...types: string[]) => Contract | NoOp;
|
||||
end: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
interface NoOp {
|
||||
interface NoOp {
|
||||
params: (...types: string[]) => NoOp;
|
||||
end: () => void;
|
||||
}
|
||||
|
||||
// for redis backend
|
||||
import redis = require('redis');
|
||||
|
||||
interface AclStatic {
|
||||
redisBackend: RedisBackendStatic;
|
||||
}
|
||||
|
||||
interface RedisBackend extends Backend<redis.RedisClient> { }
|
||||
interface RedisBackendStatic {
|
||||
new(redis: redis.RedisClient, prefix: string): RedisBackend;
|
||||
new(redis: redis.RedisClient): RedisBackend;
|
||||
}
|
||||
|
||||
// for mongodb backend
|
||||
import mongo = require('mongodb');
|
||||
|
||||
interface AclStatic {
|
||||
mongodbBackend: MongodbBackendStatic;
|
||||
}
|
||||
|
||||
interface MongodbBackend extends Backend<Callback> { }
|
||||
interface MongodbBackendStatic {
|
||||
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
|
||||
new(db: mongo.Db, prefix: string): MongodbBackend;
|
||||
new(db: mongo.Db): MongodbBackend;
|
||||
}
|
||||
|
||||
var _: AclStatic;
|
||||
export = _;
|
||||
}
|
||||
|
||||
// for redis backend
|
||||
import redis = require('redis');
|
||||
|
||||
interface AclStatic {
|
||||
redisBackend: RedisBackendStatic;
|
||||
}
|
||||
|
||||
interface RedisBackend extends Backend<redis.RedisClient> { }
|
||||
interface RedisBackendStatic {
|
||||
new (redis: redis.RedisClient, prefix: string): RedisBackend;
|
||||
new (redis: redis.RedisClient): RedisBackend;
|
||||
}
|
||||
|
||||
// for mongodb backend
|
||||
import mongo = require('mongodb');
|
||||
|
||||
interface AclStatic {
|
||||
mongodbBackend: MongodbBackendStatic;
|
||||
}
|
||||
|
||||
interface MongodbBackend extends Backend<Callback> { }
|
||||
interface MongodbBackendStatic {
|
||||
new (db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
|
||||
new (db: mongo.Db, prefix: string): MongodbBackend;
|
||||
new (db: mongo.Db): MongodbBackend;
|
||||
}
|
||||
|
||||
declare var _: AclStatic;
|
||||
export = _;
|
||||
|
||||
595
adm-zip/adm-zip.d.ts
vendored
595
adm-zip/adm-zip.d.ts
vendored
@ -5,303 +5,302 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "adm-zip" {
|
||||
class AdmZip {
|
||||
/**
|
||||
* Create a new, empty archive.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Read an existing archive.
|
||||
*/
|
||||
constructor(fileName: string);
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as a
|
||||
* Buffer object.
|
||||
* @param entry String with the full path of the entry
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: string): Buffer;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as a
|
||||
* Buffer object.
|
||||
* @param entry ZipEntry object
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: AdmZip.IZipEntry): Buffer;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry String with the full path of the entry
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: string, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry ZipEntry object
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: AdmZip.IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
* @param entry String with the full path of the entry
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: string, encoding?: string): string;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
* @param entry ZipEntry object
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: AdmZip.IZipEntry, encoding?: string): string;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry String with the full path of the entry
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: string, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry ZipEntry object
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: AdmZip.IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
* @param entry String with the full path of the entry
|
||||
*/
|
||||
deleteFile(entry: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
* @param entry A ZipEntry object.
|
||||
*/
|
||||
deleteFile(entry: AdmZip.IZipEntry): void;
|
||||
/**
|
||||
* Adds a comment to the zip. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* @param comment Content of the comment.
|
||||
*/
|
||||
addZipComment(comment: string): void;
|
||||
/**
|
||||
* Returns the zip comment
|
||||
* @return The zip comment.
|
||||
*/
|
||||
getZipComment(): string;
|
||||
/**
|
||||
* Adds a comment to a specified zipEntry. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* The comment cannot exceed 65535 characters in length.
|
||||
* @param entry String with the full path of the entry
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: string, comment: string): void;
|
||||
/**
|
||||
* Adds a comment to a specified zipEntry. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* The comment cannot exceed 65535 characters in length.
|
||||
* @param entry ZipEntry object.
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: AdmZip.IZipEntry, comment: string): void;
|
||||
/**
|
||||
* Returns the comment of the specified entry.
|
||||
* @param entry String with the full path of the entry.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: string): string;
|
||||
/**
|
||||
* Returns the comment of the specified entry
|
||||
* @param entry ZipEntry object.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: AdmZip.IZipEntry): string;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
* @param entry String with the full path of the entry.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: string, content: Buffer): void;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
* @param entry ZipEntry object.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: AdmZip.IZipEntry, content: Buffer): void;
|
||||
/**
|
||||
* Adds a file from the disk to the archive.
|
||||
* @param localPath Path to a file on disk.
|
||||
* @param zipPath Path to a directory in the archive. Defaults to the empty
|
||||
* string.
|
||||
*/
|
||||
addLocalFile(localPath: string, zipPath?: string): void;
|
||||
/**
|
||||
* Adds a local directory and all its nested files and directories to the
|
||||
* archive.
|
||||
* @param localPath Path to a folder on disk.
|
||||
* @param zipPath Path to a folder in the archive. Defaults to an empty
|
||||
* string.
|
||||
*/
|
||||
addLocalFolder(localPath: string, zipPath?: string): void;
|
||||
/**
|
||||
* Allows you to create a entry (file or directory) in the zip file.
|
||||
* If you want to create a directory the entryName must end in / and a null
|
||||
* buffer should be provided.
|
||||
* @param entryName Entry path
|
||||
* @param content Content to add to the entry; must be a 0-length buffer
|
||||
* for a directory.
|
||||
* @param comment Comment to add to the entry.
|
||||
* @param attr Attribute to add to the entry.
|
||||
*/
|
||||
addFile(entryName: string, data: Buffer, comment?: string, attr?: number): void;
|
||||
/**
|
||||
* Returns an array of ZipEntry objects representing the files and folders
|
||||
* inside the archive
|
||||
*/
|
||||
getEntries(): AdmZip.IZipEntry[];
|
||||
/**
|
||||
* Returns a ZipEntry object representing the file or folder specified by
|
||||
* ``name``.
|
||||
* @param name Name of the file or folder to retrieve.
|
||||
* @return ZipEntry The entry corresponding to the name.
|
||||
*/
|
||||
getEntry(name: string): AdmZip.IZipEntry;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
* its subdirectories will be extracted.
|
||||
* @param entry String with the full path of the entry
|
||||
* @param targetPath Target folder where to write the file
|
||||
* @param maintainEntryPath If maintainEntryPath is true and the entry is
|
||||
* inside a folder, the entry folder will be created in targetPath as
|
||||
* well. Default is TRUE
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: string, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
* its subdirectories will be extracted.
|
||||
* @param entry ZipEntry object
|
||||
* @param targetPath Target folder where to write the file
|
||||
* @param maintainEntryPath If maintainEntryPath is true and the entry is
|
||||
* inside a folder, the entry folder will be created in targetPath as
|
||||
* well. Default is TRUE
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: AdmZip.IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
*/
|
||||
extractAllTo(targetPath: string, overwrite?: boolean): void;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @param callback The callback function will be called afeter extraction
|
||||
*/
|
||||
extractAllToAsync(targetPath: string, overwrite: boolean, callback: (error: Error) => void): void;
|
||||
/**
|
||||
* Writes the newly created zip file to disk at the specified location or
|
||||
* if a zip was opened and no ``targetFileName`` is provided, it will
|
||||
* overwrite the opened zip
|
||||
* @param targetFileName
|
||||
*/
|
||||
writeZip(targetPath?: string): void;
|
||||
/**
|
||||
* Returns the content of the entire zip file as a Buffer object
|
||||
* @return Buffer
|
||||
*/
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
namespace AdmZip {
|
||||
/**
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
interface IZipEntry {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
export = AdmZip;
|
||||
declare class AdmZip {
|
||||
/**
|
||||
* Create a new, empty archive.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Read an existing archive.
|
||||
*/
|
||||
constructor(fileName: string);
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as a
|
||||
* Buffer object.
|
||||
* @param entry String with the full path of the entry
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: string): Buffer;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as a
|
||||
* Buffer object.
|
||||
* @param entry ZipEntry object
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: AdmZip.IZipEntry): Buffer;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry String with the full path of the entry
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: string, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry ZipEntry object
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: AdmZip.IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
* @param entry String with the full path of the entry
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: string, encoding?: string): string;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
* @param entry ZipEntry object
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: AdmZip.IZipEntry, encoding?: string): string;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry String with the full path of the entry
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: string, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry ZipEntry object
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: AdmZip.IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
* @param entry String with the full path of the entry
|
||||
*/
|
||||
deleteFile(entry: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
* @param entry A ZipEntry object.
|
||||
*/
|
||||
deleteFile(entry: AdmZip.IZipEntry): void;
|
||||
/**
|
||||
* Adds a comment to the zip. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* @param comment Content of the comment.
|
||||
*/
|
||||
addZipComment(comment: string): void;
|
||||
/**
|
||||
* Returns the zip comment
|
||||
* @return The zip comment.
|
||||
*/
|
||||
getZipComment(): string;
|
||||
/**
|
||||
* Adds a comment to a specified zipEntry. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* The comment cannot exceed 65535 characters in length.
|
||||
* @param entry String with the full path of the entry
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: string, comment: string): void;
|
||||
/**
|
||||
* Adds a comment to a specified zipEntry. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* The comment cannot exceed 65535 characters in length.
|
||||
* @param entry ZipEntry object.
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: AdmZip.IZipEntry, comment: string): void;
|
||||
/**
|
||||
* Returns the comment of the specified entry.
|
||||
* @param entry String with the full path of the entry.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: string): string;
|
||||
/**
|
||||
* Returns the comment of the specified entry
|
||||
* @param entry ZipEntry object.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: AdmZip.IZipEntry): string;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
* @param entry String with the full path of the entry.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: string, content: Buffer): void;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
* @param entry ZipEntry object.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: AdmZip.IZipEntry, content: Buffer): void;
|
||||
/**
|
||||
* Adds a file from the disk to the archive.
|
||||
* @param localPath Path to a file on disk.
|
||||
* @param zipPath Path to a directory in the archive. Defaults to the empty
|
||||
* string.
|
||||
*/
|
||||
addLocalFile(localPath: string, zipPath?: string): void;
|
||||
/**
|
||||
* Adds a local directory and all its nested files and directories to the
|
||||
* archive.
|
||||
* @param localPath Path to a folder on disk.
|
||||
* @param zipPath Path to a folder in the archive. Defaults to an empty
|
||||
* string.
|
||||
*/
|
||||
addLocalFolder(localPath: string, zipPath?: string): void;
|
||||
/**
|
||||
* Allows you to create a entry (file or directory) in the zip file.
|
||||
* If you want to create a directory the entryName must end in / and a null
|
||||
* buffer should be provided.
|
||||
* @param entryName Entry path
|
||||
* @param content Content to add to the entry; must be a 0-length buffer
|
||||
* for a directory.
|
||||
* @param comment Comment to add to the entry.
|
||||
* @param attr Attribute to add to the entry.
|
||||
*/
|
||||
addFile(entryName: string, data: Buffer, comment?: string, attr?: number): void;
|
||||
/**
|
||||
* Returns an array of ZipEntry objects representing the files and folders
|
||||
* inside the archive
|
||||
*/
|
||||
getEntries(): AdmZip.IZipEntry[];
|
||||
/**
|
||||
* Returns a ZipEntry object representing the file or folder specified by
|
||||
* ``name``.
|
||||
* @param name Name of the file or folder to retrieve.
|
||||
* @return ZipEntry The entry corresponding to the name.
|
||||
*/
|
||||
getEntry(name: string): AdmZip.IZipEntry;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
* its subdirectories will be extracted.
|
||||
* @param entry String with the full path of the entry
|
||||
* @param targetPath Target folder where to write the file
|
||||
* @param maintainEntryPath If maintainEntryPath is true and the entry is
|
||||
* inside a folder, the entry folder will be created in targetPath as
|
||||
* well. Default is TRUE
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: string, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
* its subdirectories will be extracted.
|
||||
* @param entry ZipEntry object
|
||||
* @param targetPath Target folder where to write the file
|
||||
* @param maintainEntryPath If maintainEntryPath is true and the entry is
|
||||
* inside a folder, the entry folder will be created in targetPath as
|
||||
* well. Default is TRUE
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: AdmZip.IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
*/
|
||||
extractAllTo(targetPath: string, overwrite?: boolean): void;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @param callback The callback function will be called afeter extraction
|
||||
*/
|
||||
extractAllToAsync(targetPath: string, overwrite: boolean, callback: (error: Error) => void): void;
|
||||
/**
|
||||
* Writes the newly created zip file to disk at the specified location or
|
||||
* if a zip was opened and no ``targetFileName`` is provided, it will
|
||||
* overwrite the opened zip
|
||||
* @param targetFileName
|
||||
*/
|
||||
writeZip(targetPath?: string): void;
|
||||
/**
|
||||
* Returns the content of the entire zip file as a Buffer object
|
||||
* @return Buffer
|
||||
*/
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
declare namespace AdmZip {
|
||||
/**
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
interface IZipEntry {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
export = AdmZip;
|
||||
|
||||
861
agenda/agenda.d.ts
vendored
861
agenda/agenda.d.ts
vendored
@ -6,438 +6,437 @@
|
||||
/// <reference path='../node/node.d.ts' />
|
||||
/// <reference path='../mongodb/mongodb.d.ts' />
|
||||
|
||||
declare module "agenda" {
|
||||
|
||||
import {EventEmitter} from "events";
|
||||
import {Db, Collection, ObjectID} from "mongodb";
|
||||
|
||||
interface Callback {
|
||||
(err?: Error): void;
|
||||
}
|
||||
import {EventEmitter} from "events";
|
||||
import {Db, Collection, ObjectID} from "mongodb";
|
||||
|
||||
interface ResultCallback<T> {
|
||||
(err?: Error, result?: T): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agenda Configuration.
|
||||
*/
|
||||
interface AgendaConfiguration {
|
||||
|
||||
/**
|
||||
* Sets the interval with which the queue is checked. A number in milliseconds or a frequency string.
|
||||
*/
|
||||
processEvery?: string | number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be running at any given moment.
|
||||
* By default it is 5.
|
||||
*/
|
||||
defaultConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the max number of jobs that can be running at any given moment. By default it
|
||||
* is 20.
|
||||
*/
|
||||
maxConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be locked at any given moment.
|
||||
* By default it is 0 for no max.
|
||||
*/
|
||||
defaultLockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This
|
||||
* can be overridden by specifying the lockLifetime option to a defined job.
|
||||
*/
|
||||
defaultLockLifetime?: number;
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should be initialized using and existing MongoDB connection.
|
||||
*/
|
||||
mongo?: {
|
||||
/**
|
||||
* The MongoDB database connection to use.
|
||||
*/
|
||||
db: Db;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should connect to MongoDB.
|
||||
*/
|
||||
db?: {
|
||||
/**
|
||||
* The connection URL.
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Connection options to pass to MongoDB.
|
||||
*/
|
||||
options?: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The database record associated with a job.
|
||||
*/
|
||||
interface JobAttributes {
|
||||
/**
|
||||
* The record identity.
|
||||
*/
|
||||
_id: ObjectID;
|
||||
|
||||
/**
|
||||
* The name of the job.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The type of the job (single|normal).
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The job details.
|
||||
*/
|
||||
data: { [name: string]: any };
|
||||
|
||||
/**
|
||||
* The priority of the job.
|
||||
*/
|
||||
priority: number;
|
||||
|
||||
/**
|
||||
* How often the job is repeated using a human-readable or cron format.
|
||||
*/
|
||||
repeatInterval: string | number;
|
||||
|
||||
/**
|
||||
* The timezone that conforms to [moment-timezone](http://momentjs.com/timezone/).
|
||||
*/
|
||||
repeatTimezone: string;
|
||||
|
||||
/**
|
||||
* Date/time the job was las modified.
|
||||
*/
|
||||
lastModifiedBy: string;
|
||||
|
||||
/**
|
||||
* Date/time the job will run next.
|
||||
*/
|
||||
nextRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was locked.
|
||||
*/
|
||||
lockedAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was last run.
|
||||
*/
|
||||
lastRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job last finished running.
|
||||
*/
|
||||
lastFinishedAt: Date;
|
||||
|
||||
/**
|
||||
* The reason the job failed.
|
||||
*/
|
||||
failReason: string;
|
||||
|
||||
/**
|
||||
* The number of times the job has failed.
|
||||
*/
|
||||
failCount: number;
|
||||
|
||||
/**
|
||||
* The date/time the job last failed.
|
||||
*/
|
||||
failedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* A scheduled job.
|
||||
*/
|
||||
interface Job {
|
||||
|
||||
/**
|
||||
* The database record associated with the job.
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
|
||||
/**
|
||||
* Specifies an interval on which the job should repeat.
|
||||
* @param interval A human-readable format String, a cron format String, or a Number.
|
||||
* @param options An optional argument that can include a timezone field. The timezone should be a string as
|
||||
* accepted by moment-timezone and is considered when using an interval in the cron string format.
|
||||
*/
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
|
||||
|
||||
/**
|
||||
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
|
||||
* @param time
|
||||
*/
|
||||
repeatAt(time: string): Job
|
||||
|
||||
/**
|
||||
* Disables the job.
|
||||
*/
|
||||
disable(): Job;
|
||||
|
||||
/**
|
||||
* Enables the job.
|
||||
*/
|
||||
enable(): Job;
|
||||
|
||||
/**
|
||||
* Ensure that only one instance of this job exists with the specified properties
|
||||
* @param value The properties associated with the job that must be unqiue.
|
||||
* @param opts
|
||||
*/
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job;
|
||||
|
||||
/**
|
||||
* Specifies the next time at which the job should run.
|
||||
* @param time The next time at which the job should run.
|
||||
*/
|
||||
schedule(time: string | Date): Job;
|
||||
|
||||
/**
|
||||
* Specifies the priority weighting of the job.
|
||||
* @param value The priority of the job (lowest|low|normal|high|highest|number).
|
||||
*/
|
||||
priority(value: string | number): Job;
|
||||
|
||||
/**
|
||||
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
|
||||
* @param reason A message or Error object that indicates why the job failed.
|
||||
*/
|
||||
fail(reason: string | Error): Job;
|
||||
|
||||
/**
|
||||
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
|
||||
* @param cb Called when the job is completed.
|
||||
*/
|
||||
run(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Returns true if the job is running; otherwise, returns false.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
|
||||
/**
|
||||
* Saves the job into the database.
|
||||
* @param cb Called when the job is saved.
|
||||
*/
|
||||
save(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Removes the job from the database and cancels the job.
|
||||
* @param cb Called after the job has beeb removed from the database.
|
||||
*/
|
||||
remove(cb?: Callback): void;
|
||||
|
||||
/**
|
||||
* Resets the lock on the job. Useful to indicate that the job hasn't timed out when you have very long running
|
||||
* jobs.
|
||||
* @param cb Called after the job has been saved to the database.
|
||||
*/
|
||||
touch(cb?: Callback): void;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be running at once (per instance of agenda)
|
||||
*/
|
||||
concurrency?: number;
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be locked at once (per instance of agenda)
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Interval in ms of how long the job stays locked for (see multiple job processors for more info). A job will
|
||||
* automatically unlock if done() is called.
|
||||
*/
|
||||
lockLifetime?: number;
|
||||
|
||||
/**
|
||||
* (lowest|low|normal|high|highest|number) specifies the priority of the job. Higher priority jobs will run
|
||||
* first.
|
||||
*/
|
||||
priority?: string | number;
|
||||
}
|
||||
|
||||
class Agenda extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Constructs a new Agenda object.
|
||||
* @param config Optional configuration to initialize the Agenda.
|
||||
* @param cb Optional callback called with the MongoDB colleciton.
|
||||
*/
|
||||
constructor(config?: AgendaConfiguration, cb?: ResultCallback<Collection>);
|
||||
|
||||
/**
|
||||
* Connect to the specified MongoDB server and database.
|
||||
*/
|
||||
database(url: string, collection?: string, options?: any, cb?: ResultCallback<Collection>): Agenda;
|
||||
|
||||
/**
|
||||
* Initialize agenda with an existing MongoDB connection.
|
||||
*/
|
||||
mongo(db: Db, collection?: string, cb?: ResultCallback<Collection>): Agenda;
|
||||
|
||||
/**
|
||||
* Sets the agenda name.
|
||||
*/
|
||||
name(value: string): Agenda;
|
||||
|
||||
/**
|
||||
* Sets the interval with which the queue is checked. A number in milliseconds or a frequency string.
|
||||
*/
|
||||
processEvery(interval: string | number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the max number of jobs that can be running at any given moment. By default it
|
||||
* is 20.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
maxConcurrency(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be running at any given moment.
|
||||
* By default it is 5.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
defaultConcurrency(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number shich 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.
|
||||
*/
|
||||
lockLimit(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be locked at any given moment.
|
||||
* By default it is 0 for no max.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
defaultLockLimit(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This
|
||||
* can be overridden by specifying the lockLifetime option to a defined job.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
defaultLockLifetime(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Returns an instance of a jobName with data. This does NOT save the job in the database. See below to learn
|
||||
* how to manually work with jobs.
|
||||
* @param name The name of the job.
|
||||
* @param data Data to associated with the job.
|
||||
*/
|
||||
create(name: string, data?: any): Job;
|
||||
|
||||
/**
|
||||
* Find all Jobs matching `query` and pass same back in cb().
|
||||
* @param query
|
||||
* @param cb
|
||||
*/
|
||||
jobs(query: any, cb: ResultCallback<Job[]>): void;
|
||||
|
||||
/**
|
||||
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
|
||||
* to remove old jobs.
|
||||
* @param cb Called with the number of jobs removed.
|
||||
*/
|
||||
purge(cb?: ResultCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Defines a job with the name of jobName. When a job of job name gets run, it will be passed to fn(job, done).
|
||||
* To maintain asynchronous behavior, you must call done() when you are processing the job. If your function is
|
||||
* synchronous, you may omit done from the signature.
|
||||
* @param name The name of the jobs.
|
||||
* @param options The options for the job.
|
||||
* @param handler The handler to execute.
|
||||
*/
|
||||
define(name: string, handler: (job?: Job, done?: (err?: Error) => void) => void): void;
|
||||
define(name: string, options: JobOptions, handler: (job?: Job, done?: (err?: Error) => void) => void): void;
|
||||
|
||||
/**
|
||||
* Runs job name at the given interval. Optionally, data and options can be passed in.
|
||||
* @param interval Can be a human-readable format String, a cron format String, or a Number.
|
||||
* @param names The name or names of the job(s) to run.
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param options An optional argument that will be passed to job.repeatEvery.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Job>): Job;
|
||||
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Job[]>): Job[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once at a given time.
|
||||
* @param when A Date or a String such as tomorrow at 5pm.
|
||||
* @param names The name or names of the job(s) to run.
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Job>): Job;
|
||||
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Job[]>): Job[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once immediately.
|
||||
* @param name The name of the job to run.
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
now(name: string, data?: any, cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Cancels any jobs matching the passed mongodb-native query, and removes them from the database.
|
||||
* @param query Mongodb native query.
|
||||
* @param cb Called with the number of jobs removed.
|
||||
*/
|
||||
cancel(query: any, cb?: ResultCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Starts the job queue processing, checking processEvery time to see if there are new jobs.
|
||||
*/
|
||||
start(): void;
|
||||
|
||||
/**
|
||||
* Stops the job queue processing. Unlocks currently running jobs.
|
||||
* @param cb Called after the job processing queue shuts down and unlocks all jobs.
|
||||
*/
|
||||
stop(cb: Callback): void;
|
||||
}
|
||||
|
||||
namespace Agenda {
|
||||
|
||||
}
|
||||
|
||||
export = Agenda;
|
||||
interface Callback {
|
||||
(err?: Error): void;
|
||||
}
|
||||
|
||||
interface ResultCallback<T> {
|
||||
(err?: Error, result?: T): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agenda Configuration.
|
||||
*/
|
||||
interface AgendaConfiguration {
|
||||
|
||||
/**
|
||||
* Sets the interval with which the queue is checked. A number in milliseconds or a frequency string.
|
||||
*/
|
||||
processEvery?: string | number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be running at any given moment.
|
||||
* By default it is 5.
|
||||
*/
|
||||
defaultConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the max number of jobs that can be running at any given moment. By default it
|
||||
* is 20.
|
||||
*/
|
||||
maxConcurrency?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be locked at any given moment.
|
||||
* By default it is 0 for no max.
|
||||
*/
|
||||
defaultLockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number shich specifies the max number jobs that can be locked at any given moment. By default it is
|
||||
* 0 for no max.
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This
|
||||
* can be overridden by specifying the lockLifetime option to a defined job.
|
||||
*/
|
||||
defaultLockLifetime?: number;
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should be initialized using and existing MongoDB connection.
|
||||
*/
|
||||
mongo?: {
|
||||
/**
|
||||
* The MongoDB database connection to use.
|
||||
*/
|
||||
db: Db;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should connect to MongoDB.
|
||||
*/
|
||||
db?: {
|
||||
/**
|
||||
* The connection URL.
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Connection options to pass to MongoDB.
|
||||
*/
|
||||
options?: any;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The database record associated with a job.
|
||||
*/
|
||||
interface JobAttributes {
|
||||
/**
|
||||
* The record identity.
|
||||
*/
|
||||
_id: ObjectID;
|
||||
|
||||
/**
|
||||
* The name of the job.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The type of the job (single|normal).
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The job details.
|
||||
*/
|
||||
data: { [name: string]: any };
|
||||
|
||||
/**
|
||||
* The priority of the job.
|
||||
*/
|
||||
priority: number;
|
||||
|
||||
/**
|
||||
* How often the job is repeated using a human-readable or cron format.
|
||||
*/
|
||||
repeatInterval: string | number;
|
||||
|
||||
/**
|
||||
* The timezone that conforms to [moment-timezone](http://momentjs.com/timezone/).
|
||||
*/
|
||||
repeatTimezone: string;
|
||||
|
||||
/**
|
||||
* Date/time the job was las modified.
|
||||
*/
|
||||
lastModifiedBy: string;
|
||||
|
||||
/**
|
||||
* Date/time the job will run next.
|
||||
*/
|
||||
nextRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was locked.
|
||||
*/
|
||||
lockedAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job was last run.
|
||||
*/
|
||||
lastRunAt: Date;
|
||||
|
||||
/**
|
||||
* Date/time the job last finished running.
|
||||
*/
|
||||
lastFinishedAt: Date;
|
||||
|
||||
/**
|
||||
* The reason the job failed.
|
||||
*/
|
||||
failReason: string;
|
||||
|
||||
/**
|
||||
* The number of times the job has failed.
|
||||
*/
|
||||
failCount: number;
|
||||
|
||||
/**
|
||||
* The date/time the job last failed.
|
||||
*/
|
||||
failedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* A scheduled job.
|
||||
*/
|
||||
interface Job {
|
||||
|
||||
/**
|
||||
* The database record associated with the job.
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
|
||||
/**
|
||||
* Specifies an interval on which the job should repeat.
|
||||
* @param interval A human-readable format String, a cron format String, or a Number.
|
||||
* @param options An optional argument that can include a timezone field. The timezone should be a string as
|
||||
* accepted by moment-timezone and is considered when using an interval in the cron string format.
|
||||
*/
|
||||
repeatEvery(interval: string | number, options?: { timezone?: string }): Job
|
||||
|
||||
/**
|
||||
* Specifies a time when the job should repeat. [Possible values](https://github.com/matthewmueller/date#examples).
|
||||
* @param time
|
||||
*/
|
||||
repeatAt(time: string): Job
|
||||
|
||||
/**
|
||||
* Disables the job.
|
||||
*/
|
||||
disable(): Job;
|
||||
|
||||
/**
|
||||
* Enables the job.
|
||||
*/
|
||||
enable(): Job;
|
||||
|
||||
/**
|
||||
* Ensure that only one instance of this job exists with the specified properties
|
||||
* @param value The properties associated with the job that must be unqiue.
|
||||
* @param opts
|
||||
*/
|
||||
unique(value: any, opts?: { insertOnly?: boolean }): Job;
|
||||
|
||||
/**
|
||||
* Specifies the next time at which the job should run.
|
||||
* @param time The next time at which the job should run.
|
||||
*/
|
||||
schedule(time: string | Date): Job;
|
||||
|
||||
/**
|
||||
* Specifies the priority weighting of the job.
|
||||
* @param value The priority of the job (lowest|low|normal|high|highest|number).
|
||||
*/
|
||||
priority(value: string | number): Job;
|
||||
|
||||
/**
|
||||
* Sets job.attrs.failedAt to now, and sets job.attrs.failReason to reason.
|
||||
* @param reason A message or Error object that indicates why the job failed.
|
||||
*/
|
||||
fail(reason: string | Error): Job;
|
||||
|
||||
/**
|
||||
* Runs the given job and calls callback(err, job) upon completion. Normally you never need to call this manually
|
||||
* @param cb Called when the job is completed.
|
||||
*/
|
||||
run(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Returns true if the job is running; otherwise, returns false.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
|
||||
/**
|
||||
* Saves the job into the database.
|
||||
* @param cb Called when the job is saved.
|
||||
*/
|
||||
save(cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Removes the job from the database and cancels the job.
|
||||
* @param cb Called after the job has beeb removed from the database.
|
||||
*/
|
||||
remove(cb?: Callback): void;
|
||||
|
||||
/**
|
||||
* Resets the lock on the job. Useful to indicate that the job hasn't timed out when you have very long running
|
||||
* jobs.
|
||||
* @param cb Called after the job has been saved to the database.
|
||||
*/
|
||||
touch(cb?: Callback): void;
|
||||
}
|
||||
|
||||
interface JobOptions {
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be running at once (per instance of agenda)
|
||||
*/
|
||||
concurrency?: number;
|
||||
|
||||
/**
|
||||
* Maximum number of that job that can be locked at once (per instance of agenda)
|
||||
*/
|
||||
lockLimit?: number;
|
||||
|
||||
/**
|
||||
* Interval in ms of how long the job stays locked for (see multiple job processors for more info). A job will
|
||||
* automatically unlock if done() is called.
|
||||
*/
|
||||
lockLifetime?: number;
|
||||
|
||||
/**
|
||||
* (lowest|low|normal|high|highest|number) specifies the priority of the job. Higher priority jobs will run
|
||||
* first.
|
||||
*/
|
||||
priority?: string | number;
|
||||
}
|
||||
|
||||
declare class Agenda extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Constructs a new Agenda object.
|
||||
* @param config Optional configuration to initialize the Agenda.
|
||||
* @param cb Optional callback called with the MongoDB colleciton.
|
||||
*/
|
||||
constructor(config?: AgendaConfiguration, cb?: ResultCallback<Collection>);
|
||||
|
||||
/**
|
||||
* Connect to the specified MongoDB server and database.
|
||||
*/
|
||||
database(url: string, collection?: string, options?: any, cb?: ResultCallback<Collection>): Agenda;
|
||||
|
||||
/**
|
||||
* Initialize agenda with an existing MongoDB connection.
|
||||
*/
|
||||
mongo(db: Db, collection?: string, cb?: ResultCallback<Collection>): Agenda;
|
||||
|
||||
/**
|
||||
* Sets the agenda name.
|
||||
*/
|
||||
name(value: string): Agenda;
|
||||
|
||||
/**
|
||||
* Sets the interval with which the queue is checked. A number in milliseconds or a frequency string.
|
||||
*/
|
||||
processEvery(interval: string | number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the max number of jobs that can be running at any given moment. By default it
|
||||
* is 20.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
maxConcurrency(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be running at any given moment.
|
||||
* By default it is 5.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
defaultConcurrency(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number shich 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.
|
||||
*/
|
||||
lockLimit(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default number of a specific job that can be locked at any given moment.
|
||||
* By default it is 0 for no max.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
defaultLockLimit(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Takes a number which specifies the default lock lifetime in milliseconds. By default it is 10 minutes. This
|
||||
* can be overridden by specifying the lockLifetime option to a defined job.
|
||||
* @param value The value to set.
|
||||
*/
|
||||
defaultLockLifetime(value: number): Agenda;
|
||||
|
||||
/**
|
||||
* Returns an instance of a jobName with data. This does NOT save the job in the database. See below to learn
|
||||
* how to manually work with jobs.
|
||||
* @param name The name of the job.
|
||||
* @param data Data to associated with the job.
|
||||
*/
|
||||
create(name: string, data?: any): Job;
|
||||
|
||||
/**
|
||||
* Find all Jobs matching `query` and pass same back in cb().
|
||||
* @param query
|
||||
* @param cb
|
||||
*/
|
||||
jobs(query: any, cb: ResultCallback<Job[]>): void;
|
||||
|
||||
/**
|
||||
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
|
||||
* to remove old jobs.
|
||||
* @param cb Called with the number of jobs removed.
|
||||
*/
|
||||
purge(cb?: ResultCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Defines a job with the name of jobName. When a job of job name gets run, it will be passed to fn(job, done).
|
||||
* To maintain asynchronous behavior, you must call done() when you are processing the job. If your function is
|
||||
* synchronous, you may omit done from the signature.
|
||||
* @param name The name of the jobs.
|
||||
* @param options The options for the job.
|
||||
* @param handler The handler to execute.
|
||||
*/
|
||||
define(name: string, handler: (job?: Job, done?: (err?: Error) => void) => void): void;
|
||||
define(name: string, options: JobOptions, handler: (job?: Job, done?: (err?: Error) => void) => void): void;
|
||||
|
||||
/**
|
||||
* Runs job name at the given interval. Optionally, data and options can be passed in.
|
||||
* @param interval Can be a human-readable format String, a cron format String, or a Number.
|
||||
* @param names The name or names of the job(s) to run.
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param options An optional argument that will be passed to job.repeatEvery.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
every(interval: number | string, names: string, data?: any, options?: any, cb?: ResultCallback<Job>): Job;
|
||||
every(interval: number | string, names: string[], data?: any, options?: any, cb?: ResultCallback<Job[]>): Job[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once at a given time.
|
||||
* @param when A Date or a String such as tomorrow at 5pm.
|
||||
* @param names The name or names of the job(s) to run.
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
schedule(when: Date | string, names: string, data?: any, cb?: ResultCallback<Job>): Job;
|
||||
schedule(when: Date | string, names: string[], data?: any, cb?: ResultCallback<Job[]>): Job[];
|
||||
|
||||
/**
|
||||
* Schedules a job to run name once immediately.
|
||||
* @param name The name of the job to run.
|
||||
* @param data An optional argument that will be passed to the processing function under job.attrs.data.
|
||||
* @param cb An optional callback function which will be called when the job has been persisted in the database.
|
||||
*/
|
||||
now(name: string, data?: any, cb?: ResultCallback<Job>): Job;
|
||||
|
||||
/**
|
||||
* Cancels any jobs matching the passed mongodb-native query, and removes them from the database.
|
||||
* @param query Mongodb native query.
|
||||
* @param cb Called with the number of jobs removed.
|
||||
*/
|
||||
cancel(query: any, cb?: ResultCallback<number>): void;
|
||||
|
||||
/**
|
||||
* Starts the job queue processing, checking processEvery time to see if there are new jobs.
|
||||
*/
|
||||
start(): void;
|
||||
|
||||
/**
|
||||
* Stops the job queue processing. Unlocks currently running jobs.
|
||||
* @param cb Called after the job processing queue shuts down and unlocks all jobs.
|
||||
*/
|
||||
stop(cb: Callback): void;
|
||||
}
|
||||
|
||||
declare namespace Agenda {
|
||||
|
||||
}
|
||||
|
||||
export = Agenda;
|
||||
|
||||
33
amazon-product-api/amazon-product-api.d.ts
vendored
33
amazon-product-api/amazon-product-api.d.ts
vendored
@ -3,23 +3,22 @@
|
||||
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "amazon-product-api" {
|
||||
|
||||
interface ICredentials {
|
||||
awsId: string,
|
||||
awsSecret: string,
|
||||
awsTag: string
|
||||
}
|
||||
|
||||
interface IAmazonProductQueryCallback {
|
||||
(err: string, results: Object[]): void;
|
||||
}
|
||||
|
||||
interface IAmazonProductClient {
|
||||
itemSearch(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
|
||||
itemLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
|
||||
browseNodeLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
|
||||
}
|
||||
|
||||
export function createClient(credentials:ICredentials) : IAmazonProductClient;
|
||||
interface ICredentials {
|
||||
awsId: string,
|
||||
awsSecret: string,
|
||||
awsTag: string
|
||||
}
|
||||
|
||||
interface IAmazonProductQueryCallback {
|
||||
(err: string, results: Object[]): void;
|
||||
}
|
||||
|
||||
interface IAmazonProductClient {
|
||||
itemSearch(query: any, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
|
||||
itemLookup(query: any, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
|
||||
browseNodeLookup(query: any, callback?: IAmazonProductQueryCallback): Promise<Object[]>;
|
||||
}
|
||||
|
||||
declare export function createClient(credentials: ICredentials): IAmazonProductClient;
|
||||
|
||||
41
amqp-rpc/amqp-rpc.d.ts
vendored
41
amqp-rpc/amqp-rpc.d.ts
vendored
@ -5,60 +5,60 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "amqp-rpc" {
|
||||
|
||||
export interface Options {
|
||||
|
||||
export interface Options {
|
||||
connection?: any;
|
||||
url?: string;
|
||||
exchangeInstance?: any;
|
||||
exchange?: string;
|
||||
exchange_options?: {
|
||||
exclusive?: boolean;
|
||||
autoDelete?: boolean;
|
||||
exclusive?: boolean;
|
||||
autoDelete?: boolean;
|
||||
};
|
||||
ipml_options?: {
|
||||
defaultExchangeName?: string;
|
||||
defaultExchangeName?: string;
|
||||
}
|
||||
conn_options?: any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CallOptions {
|
||||
export interface CallOptions {
|
||||
correlationId?: string;
|
||||
autoDeleteCallback?: any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface HandlerOptions {
|
||||
export interface HandlerOptions {
|
||||
queueName?: string;
|
||||
durable?: boolean;
|
||||
exclusive?: boolean;
|
||||
autoDelete?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export interface BroadcastOptions {
|
||||
export interface BroadcastOptions {
|
||||
ttl?: number;
|
||||
onResponse?: any;
|
||||
context?: any;
|
||||
onComplete?: any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CommandInfo {
|
||||
export interface CommandInfo {
|
||||
cmd?: string;
|
||||
exchange?: string;
|
||||
contentType?: string;
|
||||
size?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Callback {
|
||||
export interface Callback {
|
||||
(...args: any[]): void;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CallbackWithError {
|
||||
export interface CallbackWithError {
|
||||
(err: any, ...args: any[]): void;
|
||||
}
|
||||
}
|
||||
|
||||
export function factory(opt?: Options): amqpRPC;
|
||||
declare export function factory(opt?: Options): amqpRPC;
|
||||
|
||||
export class amqpRPC {
|
||||
declare export class amqpRPC {
|
||||
constructor(opt?: Options);
|
||||
generateQueueName(type: string): string;
|
||||
disconnect(): void;
|
||||
@ -68,5 +68,4 @@ declare module "amqp-rpc" {
|
||||
callBroadcast<T>(cmd: string, params: T, options?: BroadcastOptions): void;
|
||||
onBroadcast<T>(cmd: string, cb?: (params?: T, cb?: CallbackWithError) => void, context?: any, options?: any): boolean;
|
||||
offBroadcast(cmd: string): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
62
ansi-styles/ansi-styles.d.ts
vendored
62
ansi-styles/ansi-styles.d.ts
vendored
@ -4,39 +4,37 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "ansi-styles"
|
||||
{
|
||||
export interface EscapeCodePair {
|
||||
open: string;
|
||||
close: string;
|
||||
}
|
||||
|
||||
export var reset: EscapeCodePair;
|
||||
export interface EscapeCodePair {
|
||||
open: string;
|
||||
close: string;
|
||||
}
|
||||
|
||||
export var bold: EscapeCodePair;
|
||||
export var dim: EscapeCodePair;
|
||||
export var italic: EscapeCodePair;
|
||||
export var underline: EscapeCodePair;
|
||||
export var inverse: EscapeCodePair;
|
||||
export var hidden: EscapeCodePair;
|
||||
export var strikethrough: EscapeCodePair;
|
||||
declare export var reset: EscapeCodePair;
|
||||
|
||||
export var black: EscapeCodePair;
|
||||
export var red: EscapeCodePair;
|
||||
export var green: EscapeCodePair;
|
||||
export var yellow: EscapeCodePair;
|
||||
export var blue: EscapeCodePair;
|
||||
export var magenta: EscapeCodePair;
|
||||
export var cyan: EscapeCodePair;
|
||||
export var white: EscapeCodePair;
|
||||
export var gray: EscapeCodePair;
|
||||
declare export var bold: EscapeCodePair;
|
||||
declare export var dim: EscapeCodePair;
|
||||
declare export var italic: EscapeCodePair;
|
||||
declare export var underline: EscapeCodePair;
|
||||
declare export var inverse: EscapeCodePair;
|
||||
declare export var hidden: EscapeCodePair;
|
||||
declare export var strikethrough: EscapeCodePair;
|
||||
|
||||
export var bgBlack: EscapeCodePair;
|
||||
export var bgRed: EscapeCodePair;
|
||||
export var bgGreen: EscapeCodePair;
|
||||
export var bgYellow: EscapeCodePair;
|
||||
export var bgBlue: EscapeCodePair;
|
||||
export var bgMagenta: EscapeCodePair;
|
||||
export var bgCyan: EscapeCodePair;
|
||||
export var bgWhite: EscapeCodePair;
|
||||
}
|
||||
declare export var black: EscapeCodePair;
|
||||
declare export var red: EscapeCodePair;
|
||||
declare export var green: EscapeCodePair;
|
||||
declare export var yellow: EscapeCodePair;
|
||||
declare export var blue: EscapeCodePair;
|
||||
declare export var magenta: EscapeCodePair;
|
||||
declare export var cyan: EscapeCodePair;
|
||||
declare export var white: EscapeCodePair;
|
||||
declare export var gray: EscapeCodePair;
|
||||
|
||||
declare export var bgBlack: EscapeCodePair;
|
||||
declare export var bgRed: EscapeCodePair;
|
||||
declare export var bgGreen: EscapeCodePair;
|
||||
declare export var bgYellow: EscapeCodePair;
|
||||
declare export var bgBlue: EscapeCodePair;
|
||||
declare export var bgMagenta: EscapeCodePair;
|
||||
declare export var bgCyan: EscapeCodePair;
|
||||
declare export var bgWhite: EscapeCodePair;
|
||||
|
||||
7
ansicolors/ansicolors.d.ts
vendored
7
ansicolors/ansicolors.d.ts
vendored
@ -3,7 +3,6 @@
|
||||
// Definitions by: rogierschouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "ansicolors" {
|
||||
var colors: {[index: string]: (s: string) => string;};
|
||||
export = colors;
|
||||
}
|
||||
|
||||
declare var colors: { [index: string]: (s: string) => string; };
|
||||
export = colors;
|
||||
|
||||
152
any-db-transaction/any-db-transaction.d.ts
vendored
152
any-db-transaction/any-db-transaction.d.ts
vendored
@ -6,89 +6,85 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../any-db/any-db.d.ts" />
|
||||
|
||||
declare module "any-db-transaction" {
|
||||
import anyDB = require("any-db");
|
||||
|
||||
namespace begin {
|
||||
/**
|
||||
* Transaction objects are are simple wrappers around a Connection that also implement the Queryable API,
|
||||
* but guarantee that all queries take place within a single database transaction or not at all. Note that
|
||||
* begin also understands how to acquire (and release) a connection from a ConnectionPool as well, so you
|
||||
* can simply pass a pool to it: var tx = begin(pool)
|
||||
*
|
||||
* By default, any queries that error during a transaction will cause an automatic rollback. If a query has
|
||||
* no callback, the transaction will also handle (and re-emit) 'error' events for the Query instance.
|
||||
* This enables handling errors for an entire transaction in a single place.
|
||||
*
|
||||
* Transactions may also be nested by passing a Transaction to begin and these nested transactions can
|
||||
* safely error and rollback without rolling back their parent transaction
|
||||
*
|
||||
* Transaction events:
|
||||
* 'query', query - emitted immediately after .query is called on a connection via tx.query. The argument is a query object.
|
||||
* 'commit:start' - Emitted when .commit() is called.
|
||||
* 'commit:complete' - Emitted after the transaction has committed.
|
||||
* 'rollback:start' - Emitted when .rollback() is called.
|
||||
* 'rollback:complete' - Emitted after the transaction has rolled back.
|
||||
* 'close' - Emitted after rollback or commit completes.
|
||||
* 'error', err - Emitted under three conditions:
|
||||
* There was an error acquiring a connection.
|
||||
* Any query performed in this transaction emits an error that would otherwise go unhandled.
|
||||
* Any of query, begin, commit, or rollback are called after the connection has already been committed or rolled back.
|
||||
* Note that the 'error' event may be emitted multiple times! depending on the callback you are registering, you way want to wrap it using [once][].
|
||||
*/
|
||||
interface Transaction extends anyDB.Queryable {
|
||||
import anyDB = require("any-db");
|
||||
|
||||
/**
|
||||
* Issue a COMMIT (or RELEASE ... in the case of nested transactions) statement to the database.
|
||||
* If a continuation is provided it will be called (possibly with an error) after the COMMIT
|
||||
* statement completes. The transaction object itself will be unusable after calling commit().
|
||||
*/
|
||||
commit(callback?: (error: Error) => void): void;
|
||||
declare namespace begin {
|
||||
/**
|
||||
* Transaction objects are are simple wrappers around a Connection that also implement the Queryable API,
|
||||
* but guarantee that all queries take place within a single database transaction or not at all. Note that
|
||||
* begin also understands how to acquire (and release) a connection from a ConnectionPool as well, so you
|
||||
* can simply pass a pool to it: var tx = begin(pool)
|
||||
*
|
||||
* By default, any queries that error during a transaction will cause an automatic rollback. If a query has
|
||||
* no callback, the transaction will also handle (and re-emit) 'error' events for the Query instance.
|
||||
* This enables handling errors for an entire transaction in a single place.
|
||||
*
|
||||
* Transactions may also be nested by passing a Transaction to begin and these nested transactions can
|
||||
* safely error and rollback without rolling back their parent transaction
|
||||
*
|
||||
* Transaction events:
|
||||
* 'query', query - emitted immediately after .query is called on a connection via tx.query. The argument is a query object.
|
||||
* 'commit:start' - Emitted when .commit() is called.
|
||||
* 'commit:complete' - Emitted after the transaction has committed.
|
||||
* 'rollback:start' - Emitted when .rollback() is called.
|
||||
* 'rollback:complete' - Emitted after the transaction has rolled back.
|
||||
* 'close' - Emitted after rollback or commit completes.
|
||||
* 'error', err - Emitted under three conditions:
|
||||
* There was an error acquiring a connection.
|
||||
* Any query performed in this transaction emits an error that would otherwise go unhandled.
|
||||
* Any of query, begin, commit, or rollback are called after the connection has already been committed or rolled back.
|
||||
* Note that the 'error' event may be emitted multiple times! depending on the callback you are registering, you way want to wrap it using [once][].
|
||||
*/
|
||||
interface Transaction extends anyDB.Queryable {
|
||||
|
||||
/**
|
||||
* The same as Transaction.commit but issues a ROLLBACK. Again, the transaction will be unusable after calling this method.
|
||||
*/
|
||||
rollback(callback?: (error: Error) => void): void;
|
||||
}
|
||||
/**
|
||||
* Issue a COMMIT (or RELEASE ... in the case of nested transactions) statement to the database.
|
||||
* If a continuation is provided it will be called (possibly with an error) after the COMMIT
|
||||
* statement completes. The transaction object itself will be unusable after calling commit().
|
||||
*/
|
||||
commit(callback?: (error: Error) => void): void;
|
||||
|
||||
interface TransactionOptions {
|
||||
/**
|
||||
* Adapter name e.g. 'mysql'
|
||||
*/
|
||||
adapter?: anyDB.Adapter;
|
||||
/**
|
||||
* SQL statement for beginning a transaction, default 'BEGIN'
|
||||
*/
|
||||
begin?: string;
|
||||
/**
|
||||
* SQL statement for committing a transaction, default 'COMMIT'
|
||||
*/
|
||||
commit?: string;
|
||||
/**
|
||||
* SQL statement for rolling back a transaction, default 'ROLLBACK'
|
||||
*/
|
||||
rollback?: string;
|
||||
/**
|
||||
* Callback for transaction
|
||||
*/
|
||||
callback?: (error: Error, transaction: Transaction) => void;
|
||||
/**
|
||||
* Rollback automatically on error, default true
|
||||
*/
|
||||
autoRollback?: boolean;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The same as Transaction.commit but issues a ROLLBACK. Again, the transaction will be unusable after calling this method.
|
||||
*/
|
||||
rollback(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a transaction
|
||||
*/
|
||||
function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
function begin(q: anyDB.Queryable, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
function begin(q: anyDB.Queryable, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
|
||||
export = begin;
|
||||
interface TransactionOptions {
|
||||
/**
|
||||
* Adapter name e.g. 'mysql'
|
||||
*/
|
||||
adapter?: anyDB.Adapter;
|
||||
/**
|
||||
* SQL statement for beginning a transaction, default 'BEGIN'
|
||||
*/
|
||||
begin?: string;
|
||||
/**
|
||||
* SQL statement for committing a transaction, default 'COMMIT'
|
||||
*/
|
||||
commit?: string;
|
||||
/**
|
||||
* SQL statement for rolling back a transaction, default 'ROLLBACK'
|
||||
*/
|
||||
rollback?: string;
|
||||
/**
|
||||
* Callback for transaction
|
||||
*/
|
||||
callback?: (error: Error, transaction: Transaction) => void;
|
||||
/**
|
||||
* Rollback automatically on error, default true
|
||||
*/
|
||||
autoRollback?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a transaction
|
||||
*/
|
||||
declare function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
declare function begin(q: anyDB.Queryable, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
declare function begin(q: anyDB.Queryable, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
declare function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
|
||||
|
||||
export = begin;
|
||||
|
||||
584
any-db/any-db.d.ts
vendored
584
any-db/any-db.d.ts
vendored
@ -5,299 +5,297 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "any-db" {
|
||||
import events = require("events");
|
||||
import stream = require("stream");
|
||||
|
||||
export interface ConnectOpts {
|
||||
adapter: string;
|
||||
}
|
||||
|
||||
export interface Adapter {
|
||||
name: string;
|
||||
/**
|
||||
* Create a new connection object. In common usage, config will be created by parse-db-url and passed to the adapter by any-db.
|
||||
* If a continuation is given, it must be called, either with an error or the established connection.
|
||||
*/
|
||||
createConnection(opts: ConnectOpts, callback?: (error: Error, result: Connection) => void): Connection;
|
||||
|
||||
/**
|
||||
* Create a Query that may eventually be executed later on by a Connection. While this function is rarely needed by user code,
|
||||
* it makes it possible for ConnectionPool.query and Transaction.query to fulfill the Queryable.query contract
|
||||
* by synchronously returning a Query stream
|
||||
*/
|
||||
createQuery(text: string, params?: any[], callback?: (error: Error, result: ResultSet) => void): Query;
|
||||
createQuery(query: Query): Query;
|
||||
}
|
||||
/**
|
||||
* Other properties are driver specific
|
||||
*/
|
||||
export interface Field {
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet objects are just plain data that collect results of a query when a continuation
|
||||
* is provided to Queryable.query. The lastInsertId is optional, and currently supported by
|
||||
* sqlite3 and mysql but not postgres, because it is not supported by Postgres itself.
|
||||
*/
|
||||
export interface ResultSet {
|
||||
/**
|
||||
* Affected rows. Note e.g. for INSERT queries the rows property is not filled even
|
||||
* though rowCount is non-zero.
|
||||
*/
|
||||
rowCount: number;
|
||||
/**
|
||||
* Result rows
|
||||
*/
|
||||
rows: any[];
|
||||
/**
|
||||
* Result field descriptions
|
||||
*/
|
||||
fields: Field[];
|
||||
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
fieldCount?: number;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
lastInsertId?: any;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
affectedRows?: number;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
changedRows?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query objects are returned by the Queryable.query method, available on connections,
|
||||
* pools, and transactions. Queries are instances of Readable, and as such can be piped
|
||||
* through transforms and support backpressure for more efficient memory-usage on very
|
||||
* large results sets. (Note: at this time the sqlite3 driver does not support backpressure)
|
||||
*
|
||||
* Internally, Query instances are created by a database Adapter and may have more methods,
|
||||
* properties, and events than are described here. Consult the documentation for your
|
||||
* specific adapter to find out about any extensions.
|
||||
*
|
||||
* Events:
|
||||
*
|
||||
* Error event
|
||||
* The 'error' event is emitted at most once per query. Note that this event will be
|
||||
* emitted for errors even if a callback was provided, the callback will
|
||||
* simply be subscribed to the 'error' event.
|
||||
* One argument is passed to event listeners:
|
||||
* error - the error object.
|
||||
*
|
||||
* Fields event
|
||||
* A 'fields' event is emmitted before any 'data' events.
|
||||
* One argument is passed to event listeners:
|
||||
* fields - an array of [Field][ResultSet] objects.
|
||||
*
|
||||
* The following events are part of the stream.Readable interface which is implemented by Query:
|
||||
*
|
||||
* Data event
|
||||
* A 'data' event is emitted for each row in the query result set.
|
||||
* One argument is passed to event listeners:
|
||||
* row contains the contents of a single row in the query result
|
||||
*
|
||||
* Close event
|
||||
* A 'close' event is emitted when the query completes.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* End event
|
||||
* An 'end' event is emitted after all query results have been consumed.
|
||||
* No arguments are passed to event listeners.
|
||||
*/
|
||||
export interface Query extends stream.Readable {
|
||||
/**
|
||||
* The SQL query as a string. If you are using MySQL this will contain
|
||||
* interpolated values after the query has been enqueued by a connection.
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* The array of parameter values.
|
||||
*/
|
||||
values: any[];
|
||||
|
||||
/**
|
||||
* The callback (if any) that was provided to Queryable.query. Note that
|
||||
* Query objects must not use a closed over reference to their callback,
|
||||
* as other any-db libraries may rely on modifying the callback property
|
||||
* of a Query they did not create.
|
||||
*/
|
||||
callback: (error: Error, results: ResultSet) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Events:
|
||||
* The 'query' event is emitted immediately before a query is executed. One argument is passed to event handlers:
|
||||
* - query: a Query object
|
||||
*/
|
||||
export interface Queryable extends events.EventEmitter {
|
||||
/**
|
||||
* The Adapter instance that will be used by this Queryable for creating Query instances and/or connections.
|
||||
*/
|
||||
adapter: Adapter;
|
||||
|
||||
/**
|
||||
* Execute a SQL statement using bound parameters (if they are provided) and return a Query object
|
||||
* that is a Readable stream of the resulting rows. If a Continuation<ResultSet> is provided the rows
|
||||
* returned by the database will be aggregated into a [ResultSet][] which will be passed to the
|
||||
* continuation after the query has completed.
|
||||
* The second form is not needed for normal use, but must be implemented by adapters to work correctly
|
||||
* with ConnectionPool and Transaction. See Adapter.createQuery for more details.
|
||||
*/
|
||||
query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query
|
||||
|
||||
/**
|
||||
* The second form is not needed for normal use, but must be implemented by adapters to work correctly
|
||||
* with ConnectionPool and Transaction. See Adapter.createQuery for more details.
|
||||
*/
|
||||
// query(query: Query): Query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connection objects are obtained using createConnection from Any-DB or ConnectionPool.acquire,
|
||||
* both of which delegate to the createConnection implementation of the specified adapter.
|
||||
* While all Connection objects implement the Queryable interface, the implementations in
|
||||
* each adapter may add additional methods or emit additional events. If you need to access a
|
||||
* feature of your database that is not described here (such as Postgres' server-side prepared
|
||||
* statements), consult the documentation for your adapter.
|
||||
*
|
||||
* Events:
|
||||
* Error event
|
||||
* The 'error' event is emitted when there is a connection-level error.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* Open event
|
||||
* The 'open' event is emitted when the connection has been established and is ready to query.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* Close event
|
||||
* The 'close' event is emitted when the connection has been closed.
|
||||
* No arguments are passed to event listeners.
|
||||
*/
|
||||
export interface Connection extends Queryable {
|
||||
/**
|
||||
* Close the database connection. If a continuation is provided it
|
||||
* will be called after the connection has closed.
|
||||
*/
|
||||
end(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
export interface ConnectionStatic {
|
||||
new(): Connection;
|
||||
|
||||
name: string;
|
||||
createConnection(): void;
|
||||
createPool(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* ConnectionPool events
|
||||
* 'acquire' - emitted whenever pool.acquire is called
|
||||
* 'release' - emitted whenever pool.release is called
|
||||
* 'query', query - emitted immediately after .query is called on a
|
||||
* connection via pool.query. The argument is a Query object.
|
||||
* 'close' - emitted when the connection pool has closed all of it
|
||||
* connections after a call to close().
|
||||
*/
|
||||
export interface ConnectionPool extends Queryable {
|
||||
/**
|
||||
* Implements Queryable.query by automatically acquiring a connection
|
||||
* and releasing it when the query completes.
|
||||
*/
|
||||
query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query;
|
||||
|
||||
/**
|
||||
* Remove a connection from the pool. If you use this method you must
|
||||
* return the connection back to the pool using ConnectionPool.release
|
||||
*/
|
||||
acquire(callback: (error: Error, result: Connection) => void): void;
|
||||
|
||||
/**
|
||||
* Return a connection to the pool. This should only be called with connections
|
||||
* you've manually acquired. You must not continue to use the connection after releasing it.
|
||||
*/
|
||||
release(connection: Connection): void;
|
||||
|
||||
/**
|
||||
* Stop giving out new connections, and close all existing database connections as they
|
||||
* are returned to the pool.
|
||||
*/
|
||||
close(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A PoolConfig is generally a plain object with any of the following properties (they are all optional):
|
||||
*/
|
||||
export interface PoolConfig {
|
||||
/**
|
||||
* min (default 0) The minimum number of connections to keep open in the pool.
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* max (default 10) The maximum number of connections to keep open in the pool.
|
||||
* When this limit is reached further requests for connections will queue waiting
|
||||
* for an existing connection to be released back into the pool.
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* (default 30000) The maximum amount of time a connection can sit idle in the pool before being reaped
|
||||
*/
|
||||
idleTimeout?: number;
|
||||
/**
|
||||
* (default 1000) How frequently the pool should check for connections that are old enough to be reaped.
|
||||
*/
|
||||
reapInterval?: number;
|
||||
/**
|
||||
* (default true) When this is true, the pool will reap connections that
|
||||
* have been idle for more than idleTimeout milliseconds.
|
||||
*/
|
||||
refreshIdle?: boolean;
|
||||
/**
|
||||
* Called immediately after a connection is first established. Use this to do one-time setup of new connections.
|
||||
* The supplied Connection will not be added to the pool until you pass it to the done continuation.
|
||||
*/
|
||||
onConnect?: (connection: Connection, ready: (error: Error, result: Connection) => void) => void;
|
||||
/**
|
||||
* Called each time a connection is returned to the pool. Use this to restore a connection to
|
||||
* it's original state (e.g. rollback transactions, set the database session vars). If reset
|
||||
* fails to call the done continuation the connection will be lost in limbo.
|
||||
*/
|
||||
reset?: (connection: Connection, done: (error: Error) => void) => void;
|
||||
/**
|
||||
* (default function (err) { return true }) - Called when an error is encountered
|
||||
* by pool.query or emitted by an idle connection. If shouldDestroyConnection(error)
|
||||
* is truthy the connection will be destroyed, otherwise it will be reset.
|
||||
*/
|
||||
shouldDestroyConnection?: (error: Error) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a database connection.
|
||||
* @param url String of the form adapter://user:password@host/database
|
||||
* @param callback
|
||||
* @returns Connection object.
|
||||
*/
|
||||
export function createConnection(url: string, callback?: (error: Error, connection: Connection) => void): Connection;
|
||||
|
||||
/**
|
||||
* Create a database connection.
|
||||
* @param opts Object with adapter name and any properties that the given adapter requires
|
||||
* @param callback
|
||||
* @returns Connection object.
|
||||
*/
|
||||
export function createConnection(opts: ConnectOpts, callback?: (error: Error, connection: Connection) => void): Connection;
|
||||
|
||||
|
||||
export function createPool(url: string, config: PoolConfig): ConnectionPool;
|
||||
export function createPool(opts: ConnectOpts, config: PoolConfig): ConnectionPool;
|
||||
import events = require("events");
|
||||
import stream = require("stream");
|
||||
|
||||
export interface ConnectOpts {
|
||||
adapter: string;
|
||||
}
|
||||
|
||||
export interface Adapter {
|
||||
name: string;
|
||||
/**
|
||||
* Create a new connection object. In common usage, config will be created by parse-db-url and passed to the adapter by any-db.
|
||||
* If a continuation is given, it must be called, either with an error or the established connection.
|
||||
*/
|
||||
createConnection(opts: ConnectOpts, callback?: (error: Error, result: Connection) => void): Connection;
|
||||
|
||||
/**
|
||||
* Create a Query that may eventually be executed later on by a Connection. While this function is rarely needed by user code,
|
||||
* it makes it possible for ConnectionPool.query and Transaction.query to fulfill the Queryable.query contract
|
||||
* by synchronously returning a Query stream
|
||||
*/
|
||||
createQuery(text: string, params?: any[], callback?: (error: Error, result: ResultSet) => void): Query;
|
||||
createQuery(query: Query): Query;
|
||||
}
|
||||
/**
|
||||
* Other properties are driver specific
|
||||
*/
|
||||
export interface Field {
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet objects are just plain data that collect results of a query when a continuation
|
||||
* is provided to Queryable.query. The lastInsertId is optional, and currently supported by
|
||||
* sqlite3 and mysql but not postgres, because it is not supported by Postgres itself.
|
||||
*/
|
||||
export interface ResultSet {
|
||||
/**
|
||||
* Affected rows. Note e.g. for INSERT queries the rows property is not filled even
|
||||
* though rowCount is non-zero.
|
||||
*/
|
||||
rowCount: number;
|
||||
/**
|
||||
* Result rows
|
||||
*/
|
||||
rows: any[];
|
||||
/**
|
||||
* Result field descriptions
|
||||
*/
|
||||
fields: Field[];
|
||||
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
fieldCount?: number;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
lastInsertId?: any;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
affectedRows?: number;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
changedRows?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query objects are returned by the Queryable.query method, available on connections,
|
||||
* pools, and transactions. Queries are instances of Readable, and as such can be piped
|
||||
* through transforms and support backpressure for more efficient memory-usage on very
|
||||
* large results sets. (Note: at this time the sqlite3 driver does not support backpressure)
|
||||
*
|
||||
* Internally, Query instances are created by a database Adapter and may have more methods,
|
||||
* properties, and events than are described here. Consult the documentation for your
|
||||
* specific adapter to find out about any extensions.
|
||||
*
|
||||
* Events:
|
||||
*
|
||||
* Error event
|
||||
* The 'error' event is emitted at most once per query. Note that this event will be
|
||||
* emitted for errors even if a callback was provided, the callback will
|
||||
* simply be subscribed to the 'error' event.
|
||||
* One argument is passed to event listeners:
|
||||
* error - the error object.
|
||||
*
|
||||
* Fields event
|
||||
* A 'fields' event is emmitted before any 'data' events.
|
||||
* One argument is passed to event listeners:
|
||||
* fields - an array of [Field][ResultSet] objects.
|
||||
*
|
||||
* The following events are part of the stream.Readable interface which is implemented by Query:
|
||||
*
|
||||
* Data event
|
||||
* A 'data' event is emitted for each row in the query result set.
|
||||
* One argument is passed to event listeners:
|
||||
* row contains the contents of a single row in the query result
|
||||
*
|
||||
* Close event
|
||||
* A 'close' event is emitted when the query completes.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* End event
|
||||
* An 'end' event is emitted after all query results have been consumed.
|
||||
* No arguments are passed to event listeners.
|
||||
*/
|
||||
export interface Query extends stream.Readable {
|
||||
/**
|
||||
* The SQL query as a string. If you are using MySQL this will contain
|
||||
* interpolated values after the query has been enqueued by a connection.
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* The array of parameter values.
|
||||
*/
|
||||
values: any[];
|
||||
|
||||
/**
|
||||
* The callback (if any) that was provided to Queryable.query. Note that
|
||||
* Query objects must not use a closed over reference to their callback,
|
||||
* as other any-db libraries may rely on modifying the callback property
|
||||
* of a Query they did not create.
|
||||
*/
|
||||
callback: (error: Error, results: ResultSet) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Events:
|
||||
* The 'query' event is emitted immediately before a query is executed. One argument is passed to event handlers:
|
||||
* - query: a Query object
|
||||
*/
|
||||
export interface Queryable extends events.EventEmitter {
|
||||
/**
|
||||
* The Adapter instance that will be used by this Queryable for creating Query instances and/or connections.
|
||||
*/
|
||||
adapter: Adapter;
|
||||
|
||||
/**
|
||||
* Execute a SQL statement using bound parameters (if they are provided) and return a Query object
|
||||
* that is a Readable stream of the resulting rows. If a Continuation<ResultSet> is provided the rows
|
||||
* returned by the database will be aggregated into a [ResultSet][] which will be passed to the
|
||||
* continuation after the query has completed.
|
||||
* The second form is not needed for normal use, but must be implemented by adapters to work correctly
|
||||
* with ConnectionPool and Transaction. See Adapter.createQuery for more details.
|
||||
*/
|
||||
query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query
|
||||
|
||||
/**
|
||||
* The second form is not needed for normal use, but must be implemented by adapters to work correctly
|
||||
* with ConnectionPool and Transaction. See Adapter.createQuery for more details.
|
||||
*/
|
||||
// query(query: Query): Query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connection objects are obtained using createConnection from Any-DB or ConnectionPool.acquire,
|
||||
* both of which delegate to the createConnection implementation of the specified adapter.
|
||||
* While all Connection objects implement the Queryable interface, the implementations in
|
||||
* each adapter may add additional methods or emit additional events. If you need to access a
|
||||
* feature of your database that is not described here (such as Postgres' server-side prepared
|
||||
* statements), consult the documentation for your adapter.
|
||||
*
|
||||
* Events:
|
||||
* Error event
|
||||
* The 'error' event is emitted when there is a connection-level error.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* Open event
|
||||
* The 'open' event is emitted when the connection has been established and is ready to query.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* Close event
|
||||
* The 'close' event is emitted when the connection has been closed.
|
||||
* No arguments are passed to event listeners.
|
||||
*/
|
||||
export interface Connection extends Queryable {
|
||||
/**
|
||||
* Close the database connection. If a continuation is provided it
|
||||
* will be called after the connection has closed.
|
||||
*/
|
||||
end(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
export interface ConnectionStatic {
|
||||
new (): Connection;
|
||||
|
||||
name: string;
|
||||
createConnection(): void;
|
||||
createPool(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* ConnectionPool events
|
||||
* 'acquire' - emitted whenever pool.acquire is called
|
||||
* 'release' - emitted whenever pool.release is called
|
||||
* 'query', query - emitted immediately after .query is called on a
|
||||
* connection via pool.query. The argument is a Query object.
|
||||
* 'close' - emitted when the connection pool has closed all of it
|
||||
* connections after a call to close().
|
||||
*/
|
||||
export interface ConnectionPool extends Queryable {
|
||||
/**
|
||||
* Implements Queryable.query by automatically acquiring a connection
|
||||
* and releasing it when the query completes.
|
||||
*/
|
||||
query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query;
|
||||
|
||||
/**
|
||||
* Remove a connection from the pool. If you use this method you must
|
||||
* return the connection back to the pool using ConnectionPool.release
|
||||
*/
|
||||
acquire(callback: (error: Error, result: Connection) => void): void;
|
||||
|
||||
/**
|
||||
* Return a connection to the pool. This should only be called with connections
|
||||
* you've manually acquired. You must not continue to use the connection after releasing it.
|
||||
*/
|
||||
release(connection: Connection): void;
|
||||
|
||||
/**
|
||||
* Stop giving out new connections, and close all existing database connections as they
|
||||
* are returned to the pool.
|
||||
*/
|
||||
close(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A PoolConfig is generally a plain object with any of the following properties (they are all optional):
|
||||
*/
|
||||
export interface PoolConfig {
|
||||
/**
|
||||
* min (default 0) The minimum number of connections to keep open in the pool.
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* max (default 10) The maximum number of connections to keep open in the pool.
|
||||
* When this limit is reached further requests for connections will queue waiting
|
||||
* for an existing connection to be released back into the pool.
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* (default 30000) The maximum amount of time a connection can sit idle in the pool before being reaped
|
||||
*/
|
||||
idleTimeout?: number;
|
||||
/**
|
||||
* (default 1000) How frequently the pool should check for connections that are old enough to be reaped.
|
||||
*/
|
||||
reapInterval?: number;
|
||||
/**
|
||||
* (default true) When this is true, the pool will reap connections that
|
||||
* have been idle for more than idleTimeout milliseconds.
|
||||
*/
|
||||
refreshIdle?: boolean;
|
||||
/**
|
||||
* Called immediately after a connection is first established. Use this to do one-time setup of new connections.
|
||||
* The supplied Connection will not be added to the pool until you pass it to the done continuation.
|
||||
*/
|
||||
onConnect?: (connection: Connection, ready: (error: Error, result: Connection) => void) => void;
|
||||
/**
|
||||
* Called each time a connection is returned to the pool. Use this to restore a connection to
|
||||
* it's original state (e.g. rollback transactions, set the database session vars). If reset
|
||||
* fails to call the done continuation the connection will be lost in limbo.
|
||||
*/
|
||||
reset?: (connection: Connection, done: (error: Error) => void) => void;
|
||||
/**
|
||||
* (default function (err) { return true }) - Called when an error is encountered
|
||||
* by pool.query or emitted by an idle connection. If shouldDestroyConnection(error)
|
||||
* is truthy the connection will be destroyed, otherwise it will be reset.
|
||||
*/
|
||||
shouldDestroyConnection?: (error: Error) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a database connection.
|
||||
* @param url String of the form adapter://user:password@host/database
|
||||
* @param callback
|
||||
* @returns Connection object.
|
||||
*/
|
||||
declare export function createConnection(url: string, callback?: (error: Error, connection: Connection) => void): Connection;
|
||||
|
||||
/**
|
||||
* Create a database connection.
|
||||
* @param opts Object with adapter name and any properties that the given adapter requires
|
||||
* @param callback
|
||||
* @returns Connection object.
|
||||
*/
|
||||
declare export function createConnection(opts: ConnectOpts, callback?: (error: Error, connection: Connection) => void): Connection;
|
||||
|
||||
|
||||
declare export function createPool(url: string, config: PoolConfig): ConnectionPool;
|
||||
declare export function createPool(opts: ConnectOpts, config: PoolConfig): ConnectionPool;
|
||||
|
||||
51
anydb-sql-migrations/anydb-sql-migrations.d.ts
vendored
51
anydb-sql-migrations/anydb-sql-migrations.d.ts
vendored
@ -6,29 +6,28 @@
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
|
||||
declare module "anydb-sql-migrations" {
|
||||
import Promise = require('bluebird');
|
||||
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
|
||||
export interface Migration {
|
||||
version: string;
|
||||
}
|
||||
export interface MigrationsTable extends Table<Migration> {
|
||||
version: Column<string>;
|
||||
}
|
||||
export interface MigFn {
|
||||
(tx: Transaction): Promise<any>;
|
||||
}
|
||||
export interface MigrationTask {
|
||||
up: MigFn;
|
||||
down: MigFn;
|
||||
name: string;
|
||||
}
|
||||
export function create(db: AnydbSql, tasks: any): {
|
||||
run: () => Promise<any>;
|
||||
migrateTo: (target?: string) => Promise<any>;
|
||||
check: (f: (m: {
|
||||
type: string;
|
||||
items: MigrationTask[];
|
||||
}) => any) => Promise<any>;
|
||||
};
|
||||
}
|
||||
|
||||
import Promise = require('bluebird');
|
||||
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
|
||||
export interface Migration {
|
||||
version: string;
|
||||
}
|
||||
export interface MigrationsTable extends Table<Migration> {
|
||||
version: Column<string>;
|
||||
}
|
||||
export interface MigFn {
|
||||
(tx: Transaction): Promise<any>;
|
||||
}
|
||||
export interface MigrationTask {
|
||||
up: MigFn;
|
||||
down: MigFn;
|
||||
name: string;
|
||||
}
|
||||
declare export function create(db: AnydbSql, tasks: any): {
|
||||
run: () => Promise<any>;
|
||||
migrateTo: (target?: string) => Promise<any>;
|
||||
check: (f: (m: {
|
||||
type: string;
|
||||
items: MigrationTask[];
|
||||
}) => any) => Promise<any>;
|
||||
};
|
||||
|
||||
369
anydb-sql/anydb-sql.d.ts
vendored
369
anydb-sql/anydb-sql.d.ts
vendored
@ -3,188 +3,191 @@
|
||||
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "anydb-sql" {
|
||||
interface AnyDBPool extends anydbSQL.DatabaseConnection {
|
||||
query:(text:string, values:any[], callback:(err:Error, result:any)=>void)=>void
|
||||
begin:()=>anydbSQL.Transaction
|
||||
close:(err:Error)=>void
|
||||
}
|
||||
|
||||
interface Dictionary<T> { [key:string]:T; }
|
||||
|
||||
namespace anydbSQL {
|
||||
export interface OrderByValueNode {}
|
||||
export interface ColumnDefinition {
|
||||
primaryKey?:boolean;
|
||||
dataType?:string;
|
||||
references?: {table:string; column: string}
|
||||
notNull?:boolean
|
||||
}
|
||||
|
||||
export interface TableDefinition {
|
||||
name:string
|
||||
columns:Dictionary<ColumnDefinition>
|
||||
has?:Dictionary<{from:string; many?:boolean}>
|
||||
}
|
||||
|
||||
|
||||
export interface QueryLike {
|
||||
query:string;
|
||||
values: any[]
|
||||
text:string
|
||||
}
|
||||
export interface DatabaseConnection {
|
||||
queryAsync<T>(query:string, ...params:any[]):Promise<{rowCount:number;rows:T[]}>
|
||||
queryAsync<T>(query:QueryLike):Promise<{rowCount:number;rows:T[]}>
|
||||
}
|
||||
|
||||
export interface Transaction extends DatabaseConnection {
|
||||
rollback():void
|
||||
commitAsync():Promise<void>
|
||||
}
|
||||
|
||||
export interface SubQuery<T> {
|
||||
select(node:Column<T>):SubQuery<T>
|
||||
where(...nodes:any[]):SubQuery<T>
|
||||
from(table:TableNode):SubQuery<T>
|
||||
group(...nodes:any[]):SubQuery<T>
|
||||
order(criteria:OrderByValueNode):SubQuery<T>
|
||||
notExists(subQuery:SubQuery<any>):SubQuery<T>
|
||||
}
|
||||
|
||||
interface Executable<T> {
|
||||
get():Promise<T>
|
||||
getWithin(tx:DatabaseConnection):Promise<T>
|
||||
exec():Promise<void>
|
||||
all():Promise<T[]>
|
||||
execWithin(tx:DatabaseConnection):Promise<void>
|
||||
allWithin(tx:DatabaseConnection):Promise<T[]>
|
||||
toQuery():QueryLike;
|
||||
}
|
||||
|
||||
interface Queryable<T> {
|
||||
where(...nodes:any[]):Query<T>
|
||||
delete():ModifyingQuery
|
||||
select<U>(...nodes:any[]):Query<U>
|
||||
selectDeep<U>(table: Table<T>): Query<T>
|
||||
selectDeep<U>(...nodesOrTables:any[]):Query<U>
|
||||
}
|
||||
|
||||
export interface Query<T> extends Executable<T>, Queryable<T> {
|
||||
from(table:TableNode):Query<T>
|
||||
update(o:Dictionary<any>):ModifyingQuery
|
||||
update(o:{}):ModifyingQuery
|
||||
group(...nodes:any[]):Query<T>
|
||||
order(...criteria:OrderByValueNode[]):Query<T>
|
||||
limit(l:number):Query<T>
|
||||
offset(o:number):Query<T>
|
||||
}
|
||||
|
||||
export interface ModifyingQuery extends Executable<void> {
|
||||
returning<U>(...nodes:any[]):Query<U>
|
||||
where(...nodes:any[]):ModifyingQuery
|
||||
}
|
||||
|
||||
export interface TableNode {
|
||||
join(table:TableNode):JoinTableNode
|
||||
leftJoin(table:TableNode):JoinTableNode
|
||||
}
|
||||
|
||||
export interface JoinTableNode extends TableNode {
|
||||
on(filter:BinaryNode):TableNode
|
||||
on(filter:string):TableNode
|
||||
}
|
||||
|
||||
interface CreateQuery extends Executable<void> {
|
||||
ifNotExists():Executable<void>
|
||||
}
|
||||
interface DropQuery extends Executable<void> {
|
||||
ifExists():Executable<void>
|
||||
}
|
||||
export interface Table<T> extends TableNode, Queryable<T> {
|
||||
create():CreateQuery
|
||||
drop():DropQuery
|
||||
as(name:string):Table<T>
|
||||
update(o:any):ModifyingQuery
|
||||
insert(row:T):ModifyingQuery
|
||||
insert(rows:T[]):ModifyingQuery
|
||||
select():Query<T>
|
||||
select<U>(...nodes:any[]):Query<U>
|
||||
from<U>(table:TableNode):Query<U>
|
||||
star():Column<any>
|
||||
subQuery<U>():SubQuery<U>
|
||||
eventEmitter:{emit:(type:string, ...args:any[])=>void
|
||||
on:(eventName:string, handler:Function)=>void}
|
||||
columns:Column<any>[]
|
||||
sql: SQL;
|
||||
alter():AlterQuery<T>
|
||||
}
|
||||
export interface AlterQuery<T> extends Executable<void> {
|
||||
addColumn(column:Column<any>): AlterQuery<T>;
|
||||
addColumn(name: string, options:string): AlterQuery<T>;
|
||||
dropColumn(column: Column<any>): AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newColumn: Column<any>):AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newName: string):AlterQuery<T>;
|
||||
renameColumn(name: string, newName: string):AlterQuery<T>;
|
||||
rename(newName: string): AlterQuery<T>
|
||||
}
|
||||
|
||||
export interface SQL {
|
||||
functions: {
|
||||
LOWER(c:Column<string>):Column<string>
|
||||
}
|
||||
}
|
||||
|
||||
export interface BinaryNode {
|
||||
and(node:BinaryNode):BinaryNode
|
||||
or(node:BinaryNode):BinaryNode
|
||||
}
|
||||
|
||||
export interface Column<T> {
|
||||
in(arr:T[]):BinaryNode
|
||||
in(subQuery:SubQuery<T>):BinaryNode
|
||||
notIn(arr:T[]):BinaryNode
|
||||
equals(node:any):BinaryNode
|
||||
notEquals(node:any):BinaryNode
|
||||
gte(node:any):BinaryNode
|
||||
lte(node:any):BinaryNode
|
||||
gt(node:any):BinaryNode
|
||||
lt(node:any):BinaryNode
|
||||
like(str:string):BinaryNode
|
||||
multiply:{
|
||||
(node:Column<T>):Column<T>
|
||||
(n:number):Column<number>
|
||||
}
|
||||
isNull():BinaryNode
|
||||
isNotNull():BinaryNode
|
||||
sum():Column<number>
|
||||
count():Column<number>
|
||||
count(name:string):Column<number>
|
||||
distinct():Column<T>
|
||||
as(name:string):Column<T>
|
||||
ascending:OrderByValueNode
|
||||
descending:OrderByValueNode
|
||||
asc:OrderByValueNode
|
||||
desc:OrderByValueNode
|
||||
}
|
||||
|
||||
export interface AnydbSql extends DatabaseConnection {
|
||||
define<T>(map:TableDefinition):Table<T>;
|
||||
transaction<T>(fn:(tx:Transaction)=>Promise<T>):Promise<T>
|
||||
allOf(...tables:Table<any>[]):any
|
||||
models:Dictionary<Table<any>>
|
||||
functions:{LOWER:(name:Column<string>)=>Column<string>
|
||||
RTRIM:(name:Column<string>)=>Column<string>}
|
||||
makeFunction(name:string):Function
|
||||
begin():Transaction
|
||||
open():void;
|
||||
close():void;
|
||||
getPool():AnyDBPool;
|
||||
dialect():string;
|
||||
}
|
||||
}
|
||||
|
||||
function anydbSQL(config:Object):anydbSQL.AnydbSql;
|
||||
|
||||
export = anydbSQL;
|
||||
interface AnyDBPool extends anydbSQL.DatabaseConnection {
|
||||
query: (text: string, values: any[], callback: (err: Error, result: any) => void) => void
|
||||
begin: () => anydbSQL.Transaction
|
||||
close: (err: Error) => void
|
||||
}
|
||||
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
|
||||
declare namespace anydbSQL {
|
||||
export interface OrderByValueNode { }
|
||||
export interface ColumnDefinition {
|
||||
primaryKey?: boolean;
|
||||
dataType?: string;
|
||||
references?: { table: string; column: string }
|
||||
notNull?: boolean
|
||||
}
|
||||
|
||||
export interface TableDefinition {
|
||||
name: string
|
||||
columns: Dictionary<ColumnDefinition>
|
||||
has?: Dictionary<{ from: string; many?: boolean }>
|
||||
}
|
||||
|
||||
|
||||
export interface QueryLike {
|
||||
query: string;
|
||||
values: any[]
|
||||
text: string
|
||||
}
|
||||
export interface DatabaseConnection {
|
||||
queryAsync<T>(query: string, ...params: any[]): Promise<{ rowCount: number; rows: T[] }>
|
||||
queryAsync<T>(query: QueryLike): Promise<{ rowCount: number; rows: T[] }>
|
||||
}
|
||||
|
||||
export interface Transaction extends DatabaseConnection {
|
||||
rollback(): void
|
||||
commitAsync(): Promise<void>
|
||||
}
|
||||
|
||||
export interface SubQuery<T> {
|
||||
select(node: Column<T>): SubQuery<T>
|
||||
where(...nodes: any[]): SubQuery<T>
|
||||
from(table: TableNode): SubQuery<T>
|
||||
group(...nodes: any[]): SubQuery<T>
|
||||
order(criteria: OrderByValueNode): SubQuery<T>
|
||||
notExists(subQuery: SubQuery<any>): SubQuery<T>
|
||||
}
|
||||
|
||||
interface Executable<T> {
|
||||
get(): Promise<T>
|
||||
getWithin(tx: DatabaseConnection): Promise<T>
|
||||
exec(): Promise<void>
|
||||
all(): Promise<T[]>
|
||||
execWithin(tx: DatabaseConnection): Promise<void>
|
||||
allWithin(tx: DatabaseConnection): Promise<T[]>
|
||||
toQuery(): QueryLike;
|
||||
}
|
||||
|
||||
interface Queryable<T> {
|
||||
where(...nodes: any[]): Query<T>
|
||||
delete(): ModifyingQuery
|
||||
select<U>(...nodes: any[]): Query<U>
|
||||
selectDeep<U>(table: Table<T>): Query<T>
|
||||
selectDeep<U>(...nodesOrTables: any[]): Query<U>
|
||||
}
|
||||
|
||||
export interface Query<T> extends Executable<T>, Queryable<T> {
|
||||
from(table: TableNode): Query<T>
|
||||
update(o: Dictionary<any>): ModifyingQuery
|
||||
update(o: {}): ModifyingQuery
|
||||
group(...nodes: any[]): Query<T>
|
||||
order(...criteria: OrderByValueNode[]): Query<T>
|
||||
limit(l: number): Query<T>
|
||||
offset(o: number): Query<T>
|
||||
}
|
||||
|
||||
export interface ModifyingQuery extends Executable<void> {
|
||||
returning<U>(...nodes: any[]): Query<U>
|
||||
where(...nodes: any[]): ModifyingQuery
|
||||
}
|
||||
|
||||
export interface TableNode {
|
||||
join(table: TableNode): JoinTableNode
|
||||
leftJoin(table: TableNode): JoinTableNode
|
||||
}
|
||||
|
||||
export interface JoinTableNode extends TableNode {
|
||||
on(filter: BinaryNode): TableNode
|
||||
on(filter: string): TableNode
|
||||
}
|
||||
|
||||
interface CreateQuery extends Executable<void> {
|
||||
ifNotExists(): Executable<void>
|
||||
}
|
||||
interface DropQuery extends Executable<void> {
|
||||
ifExists(): Executable<void>
|
||||
}
|
||||
export interface Table<T> extends TableNode, Queryable<T> {
|
||||
create(): CreateQuery
|
||||
drop(): DropQuery
|
||||
as(name: string): Table<T>
|
||||
update(o: any): ModifyingQuery
|
||||
insert(row: T): ModifyingQuery
|
||||
insert(rows: T[]): ModifyingQuery
|
||||
select(): Query<T>
|
||||
select<U>(...nodes: any[]): Query<U>
|
||||
from<U>(table: TableNode): Query<U>
|
||||
star(): Column<any>
|
||||
subQuery<U>(): SubQuery<U>
|
||||
eventEmitter: {
|
||||
emit: (type: string, ...args: any[]) => void
|
||||
on: (eventName: string, handler: Function) => void
|
||||
}
|
||||
columns: Column<any>[]
|
||||
sql: SQL;
|
||||
alter(): AlterQuery<T>
|
||||
}
|
||||
export interface AlterQuery<T> extends Executable<void> {
|
||||
addColumn(column: Column<any>): AlterQuery<T>;
|
||||
addColumn(name: string, options: string): AlterQuery<T>;
|
||||
dropColumn(column: Column<any>): AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newColumn: Column<any>): AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newName: string): AlterQuery<T>;
|
||||
renameColumn(name: string, newName: string): AlterQuery<T>;
|
||||
rename(newName: string): AlterQuery<T>
|
||||
}
|
||||
|
||||
export interface SQL {
|
||||
functions: {
|
||||
LOWER(c: Column<string>): Column<string>
|
||||
}
|
||||
}
|
||||
|
||||
export interface BinaryNode {
|
||||
and(node: BinaryNode): BinaryNode
|
||||
or(node: BinaryNode): BinaryNode
|
||||
}
|
||||
|
||||
export interface Column<T> {
|
||||
in(arr: T[]): BinaryNode
|
||||
in(subQuery: SubQuery<T>): BinaryNode
|
||||
notIn(arr: T[]): BinaryNode
|
||||
equals(node: any): BinaryNode
|
||||
notEquals(node: any): BinaryNode
|
||||
gte(node: any): BinaryNode
|
||||
lte(node: any): BinaryNode
|
||||
gt(node: any): BinaryNode
|
||||
lt(node: any): BinaryNode
|
||||
like(str: string): BinaryNode
|
||||
multiply: {
|
||||
(node: Column<T>): Column<T>
|
||||
(n: number): Column<number>
|
||||
}
|
||||
isNull(): BinaryNode
|
||||
isNotNull(): BinaryNode
|
||||
sum(): Column<number>
|
||||
count(): Column<number>
|
||||
count(name: string): Column<number>
|
||||
distinct(): Column<T>
|
||||
as(name: string): Column<T>
|
||||
ascending: OrderByValueNode
|
||||
descending: OrderByValueNode
|
||||
asc: OrderByValueNode
|
||||
desc: OrderByValueNode
|
||||
}
|
||||
|
||||
export interface AnydbSql extends DatabaseConnection {
|
||||
define<T>(map: TableDefinition): Table<T>;
|
||||
transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>
|
||||
allOf(...tables: Table<any>[]): any
|
||||
models: Dictionary<Table<any>>
|
||||
functions: {
|
||||
LOWER: (name: Column<string>) => Column<string>
|
||||
RTRIM: (name: Column<string>) => Column<string>
|
||||
}
|
||||
makeFunction(name: string): Function
|
||||
begin(): Transaction
|
||||
open(): void;
|
||||
close(): void;
|
||||
getPool(): AnyDBPool;
|
||||
dialect(): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function anydbSQL(config: Object): anydbSQL.AnydbSql;
|
||||
|
||||
export = anydbSQL;
|
||||
|
||||
35
api-error-handler/api-error-handler.d.ts
vendored
35
api-error-handler/api-error-handler.d.ts
vendored
@ -5,26 +5,25 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module 'api-error-handler' {
|
||||
import * as express from 'express';
|
||||
|
||||
namespace apiErrorHandler {
|
||||
import * as express from 'express';
|
||||
|
||||
// Body response: the JSON returned by api-error-handler
|
||||
// See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js
|
||||
interface Response {
|
||||
status: number;
|
||||
stack?: string;
|
||||
message: string;
|
||||
declare namespace apiErrorHandler {
|
||||
|
||||
// Client errors
|
||||
code?: any;
|
||||
name?: string;
|
||||
type?: any;
|
||||
}
|
||||
// Body response: the JSON returned by api-error-handler
|
||||
// See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js
|
||||
interface Response {
|
||||
status: number;
|
||||
stack?: string;
|
||||
message: string;
|
||||
|
||||
// Client errors
|
||||
code?: any;
|
||||
name?: string;
|
||||
type?: any;
|
||||
}
|
||||
|
||||
function apiErrorHandler(options?: any): express.ErrorRequestHandler;
|
||||
|
||||
export = apiErrorHandler;
|
||||
}
|
||||
|
||||
declare function apiErrorHandler(options?: any): express.ErrorRequestHandler;
|
||||
|
||||
export = apiErrorHandler;
|
||||
|
||||
711
apn/apn.d.ts
vendored
711
apn/apn.d.ts
vendored
@ -4,361 +4,360 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
declare module "apn" {
|
||||
import events = require("events");
|
||||
import net = require("net");
|
||||
export interface ConnectionOptions {
|
||||
/**
|
||||
* The filename of the connection certificate to load from disk, or a Buffer/String containing the certificate data. (Defaults to: `cert.pem`)
|
||||
*/
|
||||
cert?:string|Buffer;
|
||||
/**
|
||||
* The filename of the connection key to load from disk, or a Buffer/String containing the key data. (Defaults to: `key.pem`)
|
||||
*/
|
||||
key?:string|Buffer;
|
||||
/**
|
||||
* An array of trusted certificates. Each element should contain either a filename to load, or a Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs will be used. - You may need to use this as some environments don't include the CA used by Apple (entrust_2048).
|
||||
*/
|
||||
ca?:(string|Buffer)[];
|
||||
/**
|
||||
* File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data. If supplied will always be used instead of certificate and key above.
|
||||
*/
|
||||
pfx?:string|Buffer;
|
||||
/**
|
||||
* The passphrase for the connection key, if required
|
||||
*/
|
||||
passphrase?:string;
|
||||
/**
|
||||
* Specifies which environment to connect to: Production (if true) or Sandbox - The hostname will be set automatically. (Defaults to NODE_ENV == "production", i.e. false unless the NODE_ENV environment variable is set accordingly)
|
||||
*/
|
||||
production?:boolean;
|
||||
/**
|
||||
* Enable when you are using a VoIP certificate to enable paylods up to 4096 bytes.
|
||||
*/
|
||||
voip?:boolean;
|
||||
/**
|
||||
* Gateway port (Defaults to: `2195`)
|
||||
*/
|
||||
port?:number;
|
||||
/**
|
||||
* Reject Unauthorized property to be passed through to tls.connect() (Defaults to `true`)
|
||||
*/
|
||||
rejectUnauthorized?:boolean;
|
||||
/**
|
||||
* Number of notifications to cache for error purposes (See "Handling Errors" below, (Defaults to: `1000`)
|
||||
*/
|
||||
cacheLength?:number;
|
||||
/**
|
||||
* Whether the cache should grow in response to messages being lost after errors. (Will still emit a 'cacheTooSmall' event) (Defaults to: `true`)
|
||||
*/
|
||||
autoAdjustCache?:boolean;
|
||||
/**
|
||||
* The maximum number of connections to create for sending messages. (Defaults to: `1`)
|
||||
*/
|
||||
maxConnections?:number;
|
||||
/**
|
||||
* The duration of time the module should wait, in milliseconds, when trying to establish a connection to Apple before failing. 0 = Disabled. {Defaults to: `10000`}
|
||||
*/
|
||||
connectTimeout?:number;
|
||||
/**
|
||||
* The duration the socket should stay alive with no activity in milliseconds. 0 = Disabled. (Defaults to: `3600000` - 1h)
|
||||
*/
|
||||
connectionTimeout?:number;
|
||||
/**
|
||||
* The maximum number of connection failures that will be tolerated before `apn` will "terminate". (Defaults to: 10)
|
||||
*/
|
||||
connectionRetryLimit?:number;
|
||||
/**
|
||||
* Whether to buffer notifications and resend them after failure. (Defaults to: `true`)
|
||||
*/
|
||||
buffersNotifications?:number;
|
||||
/**
|
||||
* Whether to aggresively empty the notification buffer while connected - if set to true node-apn may enter a tight loop under heavy load while delivering notifications. (Defaults to: `false`)
|
||||
*/
|
||||
fastMode?:boolean;
|
||||
}
|
||||
export class Connection extends events.EventEmitter {
|
||||
constructor(options:ConnectionOptions);
|
||||
/**
|
||||
* This is the business end of the module. Create a `Notification` object and pass it in, along with a single recipient or an array of them and node-apn will take care of the rest, delivering the notification to each recipient.
|
||||
*
|
||||
* A "recipient" is either a `Device` object, a `String`, or a `Buffer` containing the device token. `Device` objects are used internally and will be created if necessary. Where applicable, all events will return a `Device` regardless of the type passed to this method.
|
||||
*/
|
||||
pushNotification(notification:Notification, recipient:Device|string|Buffer|(Device|string|Buffer)[]):void;
|
||||
/**
|
||||
* Used to manually adjust the "cacheLength" property in the options. This is ideal if you choose to use the `cacheTooSmall` event to tweak your environment. It is safe for increasing and reducing cache size.
|
||||
*/
|
||||
setCacheLength(newLength:number):void;
|
||||
/**
|
||||
* Indicate to node-apn that when the queue of pending notifications is fully drained that it should close all open connections. This will mean that if there are no other pending resources (open sockets, running timers, etc.) the application will terminate. If notifications are pushed after the connection has completely shutdown a new connection will be established and, if applicable, `shutdown` will need to be called again.
|
||||
*/
|
||||
shutdown():void;
|
||||
/**
|
||||
* Emitted when an error occurs during initialisation of the module, usually due to a problem with the keys and certificates.
|
||||
*/
|
||||
on(event: "error", listener: (error:Error) => void):this;
|
||||
/**
|
||||
* Emitted when the connection socket experiences an error. This may be useful for debugging but no action should be necessary.
|
||||
*/
|
||||
on(event: "socketError", listener: (error:Error) => void):this;
|
||||
/**
|
||||
* Emitted when a notification has been sent to Apple - not a guarantee that it has been accepted by Apple, an error relating to it may occur later on. A notification may also be "transmitted" several times if a preceding notification caused an error requiring retransmission.
|
||||
*/
|
||||
on(event: "transmitted", listener: (notification:Notification, decive:Device) => void):this;
|
||||
/**
|
||||
* Emitted when all pending notifications have been transmitted to Apple and the pending queue is empty. This may be called more than once if a notification error occurs and notifications must be re-sent.
|
||||
*/
|
||||
on(event: "completed", listener: () => void):this;
|
||||
/**
|
||||
* Emitted when Apple returns a notification as invalid but the notification has already been expunged from the cache - usually due to high throughput and indicates that notifications will be getting lost. The parameter is an estimate of how many notifications have been lost. You should experiment with increasing the cache size or enabling ```autoAdjustCache``` if you see this frequently.
|
||||
*
|
||||
* **Note**: With ```autoAdjustCache``` enabled this event will still be emitted when an adjustment is triggered.
|
||||
*/
|
||||
on(event: "cacheTooSmall", listener: (sizeDifference:number) => void):this;
|
||||
/**
|
||||
* Emitted when a connection to Apple is successfully established. The parameter indicates the number of open connections. No action is required as the connection is managed internally.
|
||||
*/
|
||||
on(event: "connected", listener: (openSockets:net.Socket[]) => void):this;
|
||||
/**
|
||||
* Emitted when the connection to Apple has been closed, this could be for numerous reasons, for example an error has occurred or the connection has timed out. The parameter is the same as for `connected` and again, no action is required.
|
||||
*/
|
||||
on(event: "disconnected", listener: (openSockets:net.Socket[]) => void):this;
|
||||
/**
|
||||
* Emitted when the connectionTimeout option has been specified and no activity has occurred on a socket for a specified duration. The socket will be closed immediately after this event and a `disconnected` event will also be emitted.
|
||||
*/
|
||||
on(event: "timeout", listener: () => void):this;
|
||||
/**
|
||||
* Emitted when a message has been received from Apple stating that a notification was invalid or if an internal error occurred before that notification could be pushed to Apple. If the notification is still in the cache it will be passed as the second argument, otherwise null. Where possible the associated `Device` object will be passed as a third parameter, however in cases where the token supplied to the module cannot be parsed into a `Buffer` the supplied value will be returned.
|
||||
|
||||
* Error codes smaller than 512 correspond to those returned by Apple as per their [docs][errors]. Other errors are applicable to `node-apn` itself. Definitions can be found in `lib/errors.js`.
|
||||
*/
|
||||
on(event: "transmissionError", listener: (errorCode:number, notification:Notification, device:Device|Buffer) => void):this;
|
||||
on(event: string, listener: Function):this;
|
||||
}
|
||||
export interface NotificationAlertOptions {
|
||||
title?:string;
|
||||
body:string;
|
||||
"title-loc-key"?:string;
|
||||
"title-loc-args"?:string[];
|
||||
"action-loc-key"?:string;
|
||||
"loc-key"?:string;
|
||||
"loc-args"?:string[];
|
||||
"launch-image"?:string;
|
||||
}
|
||||
export class Notification {
|
||||
/**
|
||||
* The maximum number of retries which should be performed when sending a notification if an error occurs. A value of 0 will only allow one attempt at sending (0 retries). Set to -1 to disable (default).
|
||||
*/
|
||||
public retryLimit:number;
|
||||
/**
|
||||
* The UNIX timestamp representing when the notification should expire. This does not contribute to the 2048 byte payload size limit. An expiry of 0 indicates that the notification expires immediately.
|
||||
*/
|
||||
public expiry:number;
|
||||
/**
|
||||
* From Apple's Documentation, Provide one of the following values:
|
||||
*
|
||||
* - 10 - The push message is sent immediately. (Default)
|
||||
* > The push notification must trigger an alert, sound, or badge on the device. It is an error use this priority for a push that contains only the content-available key.
|
||||
* - 5 - The push message is sent at a time that conserves power on the device receiving it.
|
||||
*/
|
||||
public priority:number;
|
||||
/**
|
||||
* The encoding to use when transmitting the notification to APNS, defaults to `utf8`. `utf16le` is also possible but as each character is represented by a minimum of 2 bytes, will at least halve the possible payload size. If in doubt leave as default.
|
||||
*/
|
||||
public encoding:string;
|
||||
/**
|
||||
* This object represents the root JSON object that you can add custom information for your application to. The properties below will only be added to the payload (under `aps`) when the notification is prepared for sending.
|
||||
*/
|
||||
public payload:any;
|
||||
/**
|
||||
* The value to specify for `payload.aps.badge`
|
||||
*/
|
||||
public badge:number;
|
||||
/**
|
||||
* The value to specify for `payload.aps.sound`
|
||||
*/
|
||||
public sound:string;
|
||||
/**
|
||||
* The value to specify for `payload.aps.alert` can be either a `String` or an `Object` as outlined by the payload documentation.
|
||||
*/
|
||||
public alert:string|NotificationAlertOptions;
|
||||
/**
|
||||
* Setting this to true will specify "content-available" in the payload when it is compiled.
|
||||
*/
|
||||
public newsstandAvailable:boolean;
|
||||
/**
|
||||
* Setting this to true will specify "content-available" in the payload when it is compiled.
|
||||
*/
|
||||
public contentAvailable:boolean;
|
||||
/**
|
||||
* The value to specify for the `mdm` field where applicable.
|
||||
*/
|
||||
public mdm:string|Object;
|
||||
/**
|
||||
* The value to specify for `payload.aps['url-args']`. This used for Safari Push NOtifications and should be an array of values in accordance with the Web Payload Documentation.
|
||||
*/
|
||||
public urlArgs:string[];
|
||||
/**
|
||||
* When this parameter is set and `notification#trim()` is called it will attempt to truncate the string at the nearest space.
|
||||
*/
|
||||
public truncateAtWordEnd:boolean;
|
||||
/**
|
||||
* You can optionally pass in an object representing the payload, or configure properties on the returned object.
|
||||
*/
|
||||
constructor(payload?:any);
|
||||
/**
|
||||
* Set the `aps.alert` text body. This will use the most space-efficient means.
|
||||
*/
|
||||
setAlertText(alertText:string):Notification;
|
||||
/**
|
||||
* Set the `title` property of the `aps.alert` object - used with Safari Push Notifications
|
||||
*/
|
||||
setAlertTitle(alertTitle:string):Notification;
|
||||
/**
|
||||
* Set the `action` property of the `aps.alert` object - used with Safari Push Notifications
|
||||
*/
|
||||
setAlertAction(alertAction:string):Notification;
|
||||
/**
|
||||
* Set the `action-loc-key` property of the `aps.alert` object.
|
||||
*/
|
||||
setActionLocKey(key:string):Notification;
|
||||
/**
|
||||
* Set the `loc-key` property of the `aps.alert` object.
|
||||
*/
|
||||
setLocKey(key:string):Notification;
|
||||
/**
|
||||
* Set the `loc-args` property of the `aps.alert` object.
|
||||
*/
|
||||
setLocArgs(args:string[]):Notification;
|
||||
/**
|
||||
* Set the `launch-image` property of the `aps.alert` object.
|
||||
*/
|
||||
setLaunchImage(image:string):Notification;
|
||||
/**
|
||||
* Set the `mdm` property on the payload.
|
||||
*/
|
||||
setMDM(mdm:string|Object):Notification;
|
||||
/**
|
||||
* Set the `content-available` property of the `aps` object.
|
||||
*/
|
||||
setNewsstandAvailable(available:boolean):Notification;
|
||||
/**
|
||||
* Set the `content-available` property of the `aps` object.
|
||||
*/
|
||||
setContentAvailable(available:boolean):Notification;
|
||||
/**
|
||||
* Set the `url-args` property of the `aps` object.
|
||||
*/
|
||||
setUrlArgs(urlArgs:string[]):Notification;
|
||||
/**
|
||||
* Attempt to automatically trim the notification alert text body to meet the payload size limit of 2048 bytes.
|
||||
*/
|
||||
trim():number;
|
||||
}
|
||||
export class Device {
|
||||
public token:Buffer;
|
||||
/**
|
||||
* `deviceToken` can be a `Buffer` or a `String` containing a "hex" representation of the token. Throws an error if the deviceToken supplied is invalid.
|
||||
*/
|
||||
constructor(deviceToken:string|Buffer);
|
||||
}
|
||||
|
||||
export interface FeedbackOptions {
|
||||
/**
|
||||
* The filename of the connection certificate to load from disk, or a Buffer/String containing the certificate data. (Defaults to: `cert.pem`)
|
||||
*/
|
||||
cert?:string|Buffer;
|
||||
/**
|
||||
* The filename of the connection key to load from disk, or a Buffer/String containing the key data. (Defaults to: `key.pem`)
|
||||
*/
|
||||
key?:string|Buffer;
|
||||
/**
|
||||
* An array of trusted certificates. Each element should contain either a filename to load, or a Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs will be used. - You may need to use this as some environments don't include the CA used by Apple (entrust_2048).
|
||||
*/
|
||||
ca?:(string|Buffer)[];
|
||||
/**
|
||||
* File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data. If supplied will be used instead of certificate and key above.
|
||||
*/
|
||||
pfx?:string|Buffer;
|
||||
/**
|
||||
* The passphrase for the connection key, if required
|
||||
*/
|
||||
passphrase?:string;
|
||||
/**
|
||||
* Specifies which environment to connect to: Production (if true) or Sandbox - The hostname will be set automatically. (Defaults to NODE_ENV == "production", i.e. false unless the NODE_ENV environment variable is set accordingly)
|
||||
*/
|
||||
production?:boolean;
|
||||
/**
|
||||
* Feedback server port (Defaults to: `2196`)
|
||||
*/
|
||||
port?:number;
|
||||
/**
|
||||
* Sets the behaviour for triggering the `feedback` event. When `true` the event will be triggered once per connection with an array of timestamp and device token tuples. Otherwise a `feedback` event will be emitted once per token received. (Defaults to: true)
|
||||
*/
|
||||
batchFeedback?:boolean;
|
||||
/**
|
||||
* The maximum number of tokens to pass when emitting the event - a value of 0 will cause all tokens to be passed after connection is reset. After this number of tokens are received the `feedback` event will be emitted. (Only applies when `batchFeedback` is enabled)
|
||||
*/
|
||||
batchSize?:number;
|
||||
/**
|
||||
* How often to automatically poll the feedback service. Set to `0` to disable. (Defaults to: `3600`)
|
||||
*/
|
||||
interval?:number;
|
||||
}
|
||||
export interface FeedbackData {
|
||||
time:number;
|
||||
device:Device;
|
||||
}
|
||||
/**
|
||||
* Connection to the Apple Push Notification Feedback Service and if `interval` isn't disabled automatically begins polling the service. Many of the options are the same as `apn.Connection()`
|
||||
*/
|
||||
export class Feedback {
|
||||
constructor(options:FeedbackOptions);
|
||||
/**
|
||||
* Trigger a query of the feedback service. If `interval` is non-zero then this method will be called automatically.
|
||||
*/
|
||||
start():void;
|
||||
/**
|
||||
* You can cancel the interval by calling `feedback.cancel()`. If you do not wish to have the service automatically queried then set `interval` to 0 and use `feedback.start()` to manually invoke it one time.
|
||||
*/
|
||||
cancel():void;
|
||||
/**
|
||||
* Emitted when an error occurs initialising the module. Usually caused by failing to load the certificates.
|
||||
*/
|
||||
on(event: "error", listener: (error:Error) => void):Feedback;
|
||||
/**
|
||||
* Emitted when an error occurs receiving or processing the feedback and in the case of a socket error occurring. These errors are usually informational and node-apn will automatically recover.
|
||||
*/
|
||||
on(event: "feedbackError", listener: (error:Error) => void):Feedback;
|
||||
/**
|
||||
* Emitted when data has been received from the feedback service, typically once per connection. `feedbackData` is an array of objects, each containing the `time` returned by the server (epoch time) and the `device` a `Buffer` containing the device token.
|
||||
*/
|
||||
on(event: "feedback", listener: (feedbackData:FeedbackData[]) => void):Feedback;
|
||||
on(event: string, listener: Function):Feedback;
|
||||
}
|
||||
|
||||
export enum Errors {
|
||||
"noErrorsEncountered"= 0,
|
||||
"processingError"= 1,
|
||||
"missingDeviceToken"= 2,
|
||||
"missingTopic"= 3,
|
||||
"missingPayload"= 4,
|
||||
"invalidTokenSize"= 5,
|
||||
"invalidTopicSize"= 6,
|
||||
"invalidPayloadSize"= 7,
|
||||
"invalidToken"= 8,
|
||||
"apnsShutdown"= 10,
|
||||
"none"= 255,
|
||||
"retryLimitExceeded"= 512,
|
||||
"moduleInitialisationFailed"= 513,
|
||||
"connectionRetryLimitExceeded"= 514, // When a connection is unable to be established. Usually because of a network / SSL error this will be emitted
|
||||
"connectionTerminated"= 515
|
||||
}
|
||||
|
||||
//Lowercase aliases
|
||||
export {Connection as connection};
|
||||
export {Device as device};
|
||||
export {Errors as error};
|
||||
export {Feedback as feedback};
|
||||
export {Notification as notification};
|
||||
import events = require("events");
|
||||
import net = require("net");
|
||||
export interface ConnectionOptions {
|
||||
/**
|
||||
* The filename of the connection certificate to load from disk, or a Buffer/String containing the certificate data. (Defaults to: `cert.pem`)
|
||||
*/
|
||||
cert?: string | Buffer;
|
||||
/**
|
||||
* The filename of the connection key to load from disk, or a Buffer/String containing the key data. (Defaults to: `key.pem`)
|
||||
*/
|
||||
key?: string | Buffer;
|
||||
/**
|
||||
* An array of trusted certificates. Each element should contain either a filename to load, or a Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs will be used. - You may need to use this as some environments don't include the CA used by Apple (entrust_2048).
|
||||
*/
|
||||
ca?: (string | Buffer)[];
|
||||
/**
|
||||
* File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data. If supplied will always be used instead of certificate and key above.
|
||||
*/
|
||||
pfx?: string | Buffer;
|
||||
/**
|
||||
* The passphrase for the connection key, if required
|
||||
*/
|
||||
passphrase?: string;
|
||||
/**
|
||||
* Specifies which environment to connect to: Production (if true) or Sandbox - The hostname will be set automatically. (Defaults to NODE_ENV == "production", i.e. false unless the NODE_ENV environment variable is set accordingly)
|
||||
*/
|
||||
production?: boolean;
|
||||
/**
|
||||
* Enable when you are using a VoIP certificate to enable paylods up to 4096 bytes.
|
||||
*/
|
||||
voip?: boolean;
|
||||
/**
|
||||
* Gateway port (Defaults to: `2195`)
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Reject Unauthorized property to be passed through to tls.connect() (Defaults to `true`)
|
||||
*/
|
||||
rejectUnauthorized?: boolean;
|
||||
/**
|
||||
* Number of notifications to cache for error purposes (See "Handling Errors" below, (Defaults to: `1000`)
|
||||
*/
|
||||
cacheLength?: number;
|
||||
/**
|
||||
* Whether the cache should grow in response to messages being lost after errors. (Will still emit a 'cacheTooSmall' event) (Defaults to: `true`)
|
||||
*/
|
||||
autoAdjustCache?: boolean;
|
||||
/**
|
||||
* The maximum number of connections to create for sending messages. (Defaults to: `1`)
|
||||
*/
|
||||
maxConnections?: number;
|
||||
/**
|
||||
* The duration of time the module should wait, in milliseconds, when trying to establish a connection to Apple before failing. 0 = Disabled. {Defaults to: `10000`}
|
||||
*/
|
||||
connectTimeout?: number;
|
||||
/**
|
||||
* The duration the socket should stay alive with no activity in milliseconds. 0 = Disabled. (Defaults to: `3600000` - 1h)
|
||||
*/
|
||||
connectionTimeout?: number;
|
||||
/**
|
||||
* The maximum number of connection failures that will be tolerated before `apn` will "terminate". (Defaults to: 10)
|
||||
*/
|
||||
connectionRetryLimit?: number;
|
||||
/**
|
||||
* Whether to buffer notifications and resend them after failure. (Defaults to: `true`)
|
||||
*/
|
||||
buffersNotifications?: number;
|
||||
/**
|
||||
* Whether to aggresively empty the notification buffer while connected - if set to true node-apn may enter a tight loop under heavy load while delivering notifications. (Defaults to: `false`)
|
||||
*/
|
||||
fastMode?: boolean;
|
||||
}
|
||||
declare export class Connection extends events.EventEmitter {
|
||||
constructor(options: ConnectionOptions);
|
||||
/**
|
||||
* This is the business end of the module. Create a `Notification` object and pass it in, along with a single recipient or an array of them and node-apn will take care of the rest, delivering the notification to each recipient.
|
||||
*
|
||||
* A "recipient" is either a `Device` object, a `String`, or a `Buffer` containing the device token. `Device` objects are used internally and will be created if necessary. Where applicable, all events will return a `Device` regardless of the type passed to this method.
|
||||
*/
|
||||
pushNotification(notification: Notification, recipient: Device | string | Buffer | (Device | string | Buffer)[]): void;
|
||||
/**
|
||||
* Used to manually adjust the "cacheLength" property in the options. This is ideal if you choose to use the `cacheTooSmall` event to tweak your environment. It is safe for increasing and reducing cache size.
|
||||
*/
|
||||
setCacheLength(newLength: number): void;
|
||||
/**
|
||||
* Indicate to node-apn that when the queue of pending notifications is fully drained that it should close all open connections. This will mean that if there are no other pending resources (open sockets, running timers, etc.) the application will terminate. If notifications are pushed after the connection has completely shutdown a new connection will be established and, if applicable, `shutdown` will need to be called again.
|
||||
*/
|
||||
shutdown(): void;
|
||||
/**
|
||||
* Emitted when an error occurs during initialisation of the module, usually due to a problem with the keys and certificates.
|
||||
*/
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
/**
|
||||
* Emitted when the connection socket experiences an error. This may be useful for debugging but no action should be necessary.
|
||||
*/
|
||||
on(event: "socketError", listener: (error: Error) => void): this;
|
||||
/**
|
||||
* Emitted when a notification has been sent to Apple - not a guarantee that it has been accepted by Apple, an error relating to it may occur later on. A notification may also be "transmitted" several times if a preceding notification caused an error requiring retransmission.
|
||||
*/
|
||||
on(event: "transmitted", listener: (notification: Notification, decive: Device) => void): this;
|
||||
/**
|
||||
* Emitted when all pending notifications have been transmitted to Apple and the pending queue is empty. This may be called more than once if a notification error occurs and notifications must be re-sent.
|
||||
*/
|
||||
on(event: "completed", listener: () => void): this;
|
||||
/**
|
||||
* Emitted when Apple returns a notification as invalid but the notification has already been expunged from the cache - usually due to high throughput and indicates that notifications will be getting lost. The parameter is an estimate of how many notifications have been lost. You should experiment with increasing the cache size or enabling ```autoAdjustCache``` if you see this frequently.
|
||||
*
|
||||
* **Note**: With ```autoAdjustCache``` enabled this event will still be emitted when an adjustment is triggered.
|
||||
*/
|
||||
on(event: "cacheTooSmall", listener: (sizeDifference: number) => void): this;
|
||||
/**
|
||||
* Emitted when a connection to Apple is successfully established. The parameter indicates the number of open connections. No action is required as the connection is managed internally.
|
||||
*/
|
||||
on(event: "connected", listener: (openSockets: net.Socket[]) => void): this;
|
||||
/**
|
||||
* Emitted when the connection to Apple has been closed, this could be for numerous reasons, for example an error has occurred or the connection has timed out. The parameter is the same as for `connected` and again, no action is required.
|
||||
*/
|
||||
on(event: "disconnected", listener: (openSockets: net.Socket[]) => void): this;
|
||||
/**
|
||||
* Emitted when the connectionTimeout option has been specified and no activity has occurred on a socket for a specified duration. The socket will be closed immediately after this event and a `disconnected` event will also be emitted.
|
||||
*/
|
||||
on(event: "timeout", listener: () => void): this;
|
||||
/**
|
||||
* Emitted when a message has been received from Apple stating that a notification was invalid or if an internal error occurred before that notification could be pushed to Apple. If the notification is still in the cache it will be passed as the second argument, otherwise null. Where possible the associated `Device` object will be passed as a third parameter, however in cases where the token supplied to the module cannot be parsed into a `Buffer` the supplied value will be returned.
|
||||
|
||||
* Error codes smaller than 512 correspond to those returned by Apple as per their [docs][errors]. Other errors are applicable to `node-apn` itself. Definitions can be found in `lib/errors.js`.
|
||||
*/
|
||||
on(event: "transmissionError", listener: (errorCode: number, notification: Notification, device: Device | Buffer) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
export interface NotificationAlertOptions {
|
||||
title?: string;
|
||||
body: string;
|
||||
"title-loc-key"?: string;
|
||||
"title-loc-args"?: string[];
|
||||
"action-loc-key"?: string;
|
||||
"loc-key"?: string;
|
||||
"loc-args"?: string[];
|
||||
"launch-image"?: string;
|
||||
}
|
||||
declare export class Notification {
|
||||
/**
|
||||
* The maximum number of retries which should be performed when sending a notification if an error occurs. A value of 0 will only allow one attempt at sending (0 retries). Set to -1 to disable (default).
|
||||
*/
|
||||
public retryLimit: number;
|
||||
/**
|
||||
* The UNIX timestamp representing when the notification should expire. This does not contribute to the 2048 byte payload size limit. An expiry of 0 indicates that the notification expires immediately.
|
||||
*/
|
||||
public expiry: number;
|
||||
/**
|
||||
* From Apple's Documentation, Provide one of the following values:
|
||||
*
|
||||
* - 10 - The push message is sent immediately. (Default)
|
||||
* > The push notification must trigger an alert, sound, or badge on the device. It is an error use this priority for a push that contains only the content-available key.
|
||||
* - 5 - The push message is sent at a time that conserves power on the device receiving it.
|
||||
*/
|
||||
public priority: number;
|
||||
/**
|
||||
* The encoding to use when transmitting the notification to APNS, defaults to `utf8`. `utf16le` is also possible but as each character is represented by a minimum of 2 bytes, will at least halve the possible payload size. If in doubt leave as default.
|
||||
*/
|
||||
public encoding: string;
|
||||
/**
|
||||
* This object represents the root JSON object that you can add custom information for your application to. The properties below will only be added to the payload (under `aps`) when the notification is prepared for sending.
|
||||
*/
|
||||
public payload: any;
|
||||
/**
|
||||
* The value to specify for `payload.aps.badge`
|
||||
*/
|
||||
public badge: number;
|
||||
/**
|
||||
* The value to specify for `payload.aps.sound`
|
||||
*/
|
||||
public sound: string;
|
||||
/**
|
||||
* The value to specify for `payload.aps.alert` can be either a `String` or an `Object` as outlined by the payload documentation.
|
||||
*/
|
||||
public alert: string | NotificationAlertOptions;
|
||||
/**
|
||||
* Setting this to true will specify "content-available" in the payload when it is compiled.
|
||||
*/
|
||||
public newsstandAvailable: boolean;
|
||||
/**
|
||||
* Setting this to true will specify "content-available" in the payload when it is compiled.
|
||||
*/
|
||||
public contentAvailable: boolean;
|
||||
/**
|
||||
* The value to specify for the `mdm` field where applicable.
|
||||
*/
|
||||
public mdm: string | Object;
|
||||
/**
|
||||
* The value to specify for `payload.aps['url-args']`. This used for Safari Push NOtifications and should be an array of values in accordance with the Web Payload Documentation.
|
||||
*/
|
||||
public urlArgs: string[];
|
||||
/**
|
||||
* When this parameter is set and `notification#trim()` is called it will attempt to truncate the string at the nearest space.
|
||||
*/
|
||||
public truncateAtWordEnd: boolean;
|
||||
/**
|
||||
* You can optionally pass in an object representing the payload, or configure properties on the returned object.
|
||||
*/
|
||||
constructor(payload?: any);
|
||||
/**
|
||||
* Set the `aps.alert` text body. This will use the most space-efficient means.
|
||||
*/
|
||||
setAlertText(alertText: string): Notification;
|
||||
/**
|
||||
* Set the `title` property of the `aps.alert` object - used with Safari Push Notifications
|
||||
*/
|
||||
setAlertTitle(alertTitle: string): Notification;
|
||||
/**
|
||||
* Set the `action` property of the `aps.alert` object - used with Safari Push Notifications
|
||||
*/
|
||||
setAlertAction(alertAction: string): Notification;
|
||||
/**
|
||||
* Set the `action-loc-key` property of the `aps.alert` object.
|
||||
*/
|
||||
setActionLocKey(key: string): Notification;
|
||||
/**
|
||||
* Set the `loc-key` property of the `aps.alert` object.
|
||||
*/
|
||||
setLocKey(key: string): Notification;
|
||||
/**
|
||||
* Set the `loc-args` property of the `aps.alert` object.
|
||||
*/
|
||||
setLocArgs(args: string[]): Notification;
|
||||
/**
|
||||
* Set the `launch-image` property of the `aps.alert` object.
|
||||
*/
|
||||
setLaunchImage(image: string): Notification;
|
||||
/**
|
||||
* Set the `mdm` property on the payload.
|
||||
*/
|
||||
setMDM(mdm: string | Object): Notification;
|
||||
/**
|
||||
* Set the `content-available` property of the `aps` object.
|
||||
*/
|
||||
setNewsstandAvailable(available: boolean): Notification;
|
||||
/**
|
||||
* Set the `content-available` property of the `aps` object.
|
||||
*/
|
||||
setContentAvailable(available: boolean): Notification;
|
||||
/**
|
||||
* Set the `url-args` property of the `aps` object.
|
||||
*/
|
||||
setUrlArgs(urlArgs: string[]): Notification;
|
||||
/**
|
||||
* Attempt to automatically trim the notification alert text body to meet the payload size limit of 2048 bytes.
|
||||
*/
|
||||
trim(): number;
|
||||
}
|
||||
declare export class Device {
|
||||
public token: Buffer;
|
||||
/**
|
||||
* `deviceToken` can be a `Buffer` or a `String` containing a "hex" representation of the token. Throws an error if the deviceToken supplied is invalid.
|
||||
*/
|
||||
constructor(deviceToken: string | Buffer);
|
||||
}
|
||||
|
||||
export interface FeedbackOptions {
|
||||
/**
|
||||
* The filename of the connection certificate to load from disk, or a Buffer/String containing the certificate data. (Defaults to: `cert.pem`)
|
||||
*/
|
||||
cert?: string | Buffer;
|
||||
/**
|
||||
* The filename of the connection key to load from disk, or a Buffer/String containing the key data. (Defaults to: `key.pem`)
|
||||
*/
|
||||
key?: string | Buffer;
|
||||
/**
|
||||
* An array of trusted certificates. Each element should contain either a filename to load, or a Buffer/String (in PEM format) to be used directly. If this is omitted several well known "root" CAs will be used. - You may need to use this as some environments don't include the CA used by Apple (entrust_2048).
|
||||
*/
|
||||
ca?: (string | Buffer)[];
|
||||
/**
|
||||
* File path for private key, certificate and CA certs in PFX or PKCS12 format, or a Buffer containing the PFX data. If supplied will be used instead of certificate and key above.
|
||||
*/
|
||||
pfx?: string | Buffer;
|
||||
/**
|
||||
* The passphrase for the connection key, if required
|
||||
*/
|
||||
passphrase?: string;
|
||||
/**
|
||||
* Specifies which environment to connect to: Production (if true) or Sandbox - The hostname will be set automatically. (Defaults to NODE_ENV == "production", i.e. false unless the NODE_ENV environment variable is set accordingly)
|
||||
*/
|
||||
production?: boolean;
|
||||
/**
|
||||
* Feedback server port (Defaults to: `2196`)
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Sets the behaviour for triggering the `feedback` event. When `true` the event will be triggered once per connection with an array of timestamp and device token tuples. Otherwise a `feedback` event will be emitted once per token received. (Defaults to: true)
|
||||
*/
|
||||
batchFeedback?: boolean;
|
||||
/**
|
||||
* The maximum number of tokens to pass when emitting the event - a value of 0 will cause all tokens to be passed after connection is reset. After this number of tokens are received the `feedback` event will be emitted. (Only applies when `batchFeedback` is enabled)
|
||||
*/
|
||||
batchSize?: number;
|
||||
/**
|
||||
* How often to automatically poll the feedback service. Set to `0` to disable. (Defaults to: `3600`)
|
||||
*/
|
||||
interval?: number;
|
||||
}
|
||||
export interface FeedbackData {
|
||||
time: number;
|
||||
device: Device;
|
||||
}
|
||||
/**
|
||||
* Connection to the Apple Push Notification Feedback Service and if `interval` isn't disabled automatically begins polling the service. Many of the options are the same as `apn.Connection()`
|
||||
*/
|
||||
declare export class Feedback {
|
||||
constructor(options: FeedbackOptions);
|
||||
/**
|
||||
* Trigger a query of the feedback service. If `interval` is non-zero then this method will be called automatically.
|
||||
*/
|
||||
start(): void;
|
||||
/**
|
||||
* You can cancel the interval by calling `feedback.cancel()`. If you do not wish to have the service automatically queried then set `interval` to 0 and use `feedback.start()` to manually invoke it one time.
|
||||
*/
|
||||
cancel(): void;
|
||||
/**
|
||||
* Emitted when an error occurs initialising the module. Usually caused by failing to load the certificates.
|
||||
*/
|
||||
on(event: "error", listener: (error: Error) => void): Feedback;
|
||||
/**
|
||||
* Emitted when an error occurs receiving or processing the feedback and in the case of a socket error occurring. These errors are usually informational and node-apn will automatically recover.
|
||||
*/
|
||||
on(event: "feedbackError", listener: (error: Error) => void): Feedback;
|
||||
/**
|
||||
* Emitted when data has been received from the feedback service, typically once per connection. `feedbackData` is an array of objects, each containing the `time` returned by the server (epoch time) and the `device` a `Buffer` containing the device token.
|
||||
*/
|
||||
on(event: "feedback", listener: (feedbackData: FeedbackData[]) => void): Feedback;
|
||||
on(event: string, listener: Function): Feedback;
|
||||
}
|
||||
|
||||
declare export enum Errors {
|
||||
"noErrorsEncountered" = 0,
|
||||
"processingError" = 1,
|
||||
"missingDeviceToken" = 2,
|
||||
"missingTopic" = 3,
|
||||
"missingPayload" = 4,
|
||||
"invalidTokenSize" = 5,
|
||||
"invalidTopicSize" = 6,
|
||||
"invalidPayloadSize" = 7,
|
||||
"invalidToken" = 8,
|
||||
"apnsShutdown" = 10,
|
||||
"none" = 255,
|
||||
"retryLimitExceeded" = 512,
|
||||
"moduleInitialisationFailed" = 513,
|
||||
"connectionRetryLimitExceeded" = 514, // When a connection is unable to be established. Usually because of a network / SSL error this will be emitted
|
||||
"connectionTerminated" = 515
|
||||
}
|
||||
|
||||
//Lowercase aliases
|
||||
export {Connection as connection};
|
||||
export {Device as device};
|
||||
export {Errors as error};
|
||||
export {Feedback as feedback};
|
||||
export {Notification as notification};
|
||||
|
||||
49
archiver/archiver.d.ts
vendored
49
archiver/archiver.d.ts
vendored
@ -14,29 +14,28 @@
|
||||
=============================================== */
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "archiver" {
|
||||
import * as FS from 'fs';
|
||||
import * as STREAM from 'stream';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver extends STREAM.Transform {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
||||
}
|
||||
|
||||
function archiver(format: string, options?: Options): Archiver;
|
||||
|
||||
namespace archiver {
|
||||
function create(format: string, options?: Options): Archiver;
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
|
||||
import * as FS from 'fs';
|
||||
import * as STREAM from 'stream';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver extends STREAM.Transform {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
||||
}
|
||||
|
||||
declare function archiver(format: string, options?: Options): Archiver;
|
||||
|
||||
declare namespace archiver {
|
||||
function create(format: string, options?: Options): Archiver;
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
|
||||
25
archy/archy.d.ts
vendored
25
archy/archy.d.ts
vendored
@ -3,19 +3,18 @@
|
||||
// Definitions by: vvakame <https://github.com/vvakame/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "archy" {
|
||||
function archy(obj: archy.Data, prefix?: string, opts?: archy.Options): string;
|
||||
function archy(obj: string, prefix?: string, opts?: archy.Options): string;
|
||||
|
||||
namespace archy {
|
||||
interface Data {
|
||||
label: string;
|
||||
nodes?: (Data | string)[];
|
||||
}
|
||||
interface Options {
|
||||
unicode?: boolean;
|
||||
}
|
||||
declare function archy(obj: archy.Data, prefix?: string, opts?: archy.Options): string;
|
||||
declare function archy(obj: string, prefix?: string, opts?: archy.Options): string;
|
||||
|
||||
declare namespace archy {
|
||||
interface Data {
|
||||
label: string;
|
||||
nodes?: (Data | string)[];
|
||||
}
|
||||
interface Options {
|
||||
unicode?: boolean;
|
||||
}
|
||||
|
||||
export = archy;
|
||||
}
|
||||
|
||||
export = archy;
|
||||
|
||||
163
argparse/argparse.d.ts
vendored
163
argparse/argparse.d.ts
vendored
@ -3,88 +3,87 @@
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "argparse" {
|
||||
export class ArgumentParser extends ArgumentGroup {
|
||||
constructor(options? : ArgumentParserOptions);
|
||||
|
||||
addSubparsers(options? : SubparserOptions) : SubParser;
|
||||
parseArgs(args? : string[], ns? : Namespace|Object) : any;
|
||||
printUsage() : void;
|
||||
printHelp() : void;
|
||||
formatUsage() : string;
|
||||
formatHelp() : string;
|
||||
parseKnownArgs(args? : string[], ns? : Namespace|Object) : any[];
|
||||
convertArgLineToArg(argLine : string) : string[];
|
||||
exit(status : number, message : string) : void;
|
||||
error(err : string|Error) : void;
|
||||
}
|
||||
|
||||
interface Namespace {}
|
||||
|
||||
class SubParser {
|
||||
addParser(name : string, options? : SubArgumentParserOptions) : ArgumentParser;
|
||||
}
|
||||
|
||||
class ArgumentGroup {
|
||||
addArgument(args : string[], options? : ArgumentOptions) : void;
|
||||
addArgumentGroup(options? : ArgumentGroupOptions) : ArgumentGroup;
|
||||
addMutuallyExclusiveGroup(options? : {required : boolean}) : ArgumentGroup;
|
||||
setDefaults(options? : {}) : void;
|
||||
getDefault(dest : string) : any;
|
||||
}
|
||||
|
||||
interface SubparserOptions {
|
||||
title? : string;
|
||||
description? : string;
|
||||
prog? : string;
|
||||
parserClass? : {new() : any};
|
||||
action? : string;
|
||||
dest? : string;
|
||||
help? : string;
|
||||
metavar? : string;
|
||||
}
|
||||
|
||||
interface SubArgumentParserOptions extends ArgumentParserOptions {
|
||||
aliases? : string[];
|
||||
help? : string;
|
||||
}
|
||||
|
||||
interface ArgumentParserOptions {
|
||||
description? : string;
|
||||
epilog? : string;
|
||||
addHelp? : boolean;
|
||||
argumentDefault? : any;
|
||||
parents? : ArgumentParser[];
|
||||
prefixChars? : string;
|
||||
formatterClass? : {new() : HelpFormatter|ArgumentDefaultsHelpFormatter|RawDescriptionHelpFormatter|RawTextHelpFormatter};
|
||||
prog? : string;
|
||||
usage? : string;
|
||||
version? : string;
|
||||
}
|
||||
|
||||
interface ArgumentGroupOptions {
|
||||
prefixChars? : string;
|
||||
argumentDefault? : any;
|
||||
title? : string;
|
||||
description? : string;
|
||||
}
|
||||
declare export class ArgumentParser extends ArgumentGroup {
|
||||
constructor(options?: ArgumentParserOptions);
|
||||
|
||||
export class HelpFormatter {}
|
||||
export class ArgumentDefaultsHelpFormatter {}
|
||||
export class RawDescriptionHelpFormatter {}
|
||||
export class RawTextHelpFormatter {}
|
||||
|
||||
interface ArgumentOptions {
|
||||
action? : string;
|
||||
optionStrings? : string[];
|
||||
dest? : string;
|
||||
nargs? : string|number;
|
||||
constant? : any;
|
||||
defaultValue? : any;
|
||||
type? : string|Function;
|
||||
choices? : string|string[];
|
||||
required? : boolean;
|
||||
help? : string;
|
||||
metavar? : string;
|
||||
}
|
||||
addSubparsers(options?: SubparserOptions): SubParser;
|
||||
parseArgs(args?: string[], ns?: Namespace | Object): any;
|
||||
printUsage(): void;
|
||||
printHelp(): void;
|
||||
formatUsage(): string;
|
||||
formatHelp(): string;
|
||||
parseKnownArgs(args?: string[], ns?: Namespace | Object): any[];
|
||||
convertArgLineToArg(argLine: string): string[];
|
||||
exit(status: number, message: string): void;
|
||||
error(err: string | Error): void;
|
||||
}
|
||||
|
||||
interface Namespace { }
|
||||
|
||||
declare class SubParser {
|
||||
addParser(name: string, options?: SubArgumentParserOptions): ArgumentParser;
|
||||
}
|
||||
|
||||
declare class ArgumentGroup {
|
||||
addArgument(args: string[], options?: ArgumentOptions): void;
|
||||
addArgumentGroup(options?: ArgumentGroupOptions): ArgumentGroup;
|
||||
addMutuallyExclusiveGroup(options?: { required: boolean }): ArgumentGroup;
|
||||
setDefaults(options?: {}): void;
|
||||
getDefault(dest: string): any;
|
||||
}
|
||||
|
||||
interface SubparserOptions {
|
||||
title?: string;
|
||||
description?: string;
|
||||
prog?: string;
|
||||
parserClass?: { new (): any };
|
||||
action?: string;
|
||||
dest?: string;
|
||||
help?: string;
|
||||
metavar?: string;
|
||||
}
|
||||
|
||||
interface SubArgumentParserOptions extends ArgumentParserOptions {
|
||||
aliases?: string[];
|
||||
help?: string;
|
||||
}
|
||||
|
||||
interface ArgumentParserOptions {
|
||||
description?: string;
|
||||
epilog?: string;
|
||||
addHelp?: boolean;
|
||||
argumentDefault?: any;
|
||||
parents?: ArgumentParser[];
|
||||
prefixChars?: string;
|
||||
formatterClass?: { new (): HelpFormatter | ArgumentDefaultsHelpFormatter | RawDescriptionHelpFormatter | RawTextHelpFormatter };
|
||||
prog?: string;
|
||||
usage?: string;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
interface ArgumentGroupOptions {
|
||||
prefixChars?: string;
|
||||
argumentDefault?: any;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
declare export class HelpFormatter { }
|
||||
declare export class ArgumentDefaultsHelpFormatter { }
|
||||
declare export class RawDescriptionHelpFormatter { }
|
||||
declare export class RawTextHelpFormatter { }
|
||||
|
||||
interface ArgumentOptions {
|
||||
action?: string;
|
||||
optionStrings?: string[];
|
||||
dest?: string;
|
||||
nargs?: string | number;
|
||||
constant?: any;
|
||||
defaultValue?: any;
|
||||
type?: string | Function;
|
||||
choices?: string | string[];
|
||||
required?: boolean;
|
||||
help?: string;
|
||||
metavar?: string;
|
||||
}
|
||||
|
||||
4778
asana/asana.d.ts
vendored
4778
asana/asana.d.ts
vendored
File diff suppressed because it is too large
Load Diff
11
aspnet-identity-pw/aspnet-identity-pw.d.ts
vendored
11
aspnet-identity-pw/aspnet-identity-pw.d.ts
vendored
@ -3,11 +3,10 @@
|
||||
// Definitions by: jt000 <https://github.com/jt000>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "aspnet-identity-pw" {
|
||||
|
||||
export function hashPassword(password: string): string;
|
||||
export function hashPassword(password: string, callback: (err: any, result: string)=>void): void;
|
||||
|
||||
export function validatePassword(password: string, hashedPass: string): boolean;
|
||||
export function validatePassword(password: string, hashedPass: string, callback: (err: any, result: boolean) => void): void;
|
||||
}
|
||||
declare export function hashPassword(password: string): string;
|
||||
declare export function hashPassword(password: string, callback: (err: any, result: string) => void): void;
|
||||
|
||||
declare export function validatePassword(password: string, hashedPass: string): boolean;
|
||||
declare export function validatePassword(password: string, hashedPass: string, callback: (err: any, result: boolean) => void): void;
|
||||
|
||||
17
assertion-error/assertion-error.d.ts
vendored
17
assertion-error/assertion-error.d.ts
vendored
@ -3,13 +3,12 @@
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'assertion-error' {
|
||||
class AssertionError implements Error {
|
||||
constructor(message: string, props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
}
|
||||
export = AssertionError;
|
||||
|
||||
declare class AssertionError implements Error {
|
||||
constructor(message: string, props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
}
|
||||
export = AssertionError;
|
||||
|
||||
29
assertsharp/assertsharp.d.ts
vendored
29
assertsharp/assertsharp.d.ts
vendored
@ -3,19 +3,18 @@
|
||||
// Definitions by: Bruno Leonardo Michels <https://github.com/brunolm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "assertsharp" {
|
||||
export default class Assert {
|
||||
static AreEqual<T>(expected: T, actual: T, message?: string): void;
|
||||
static AreNotEqual<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreNotSame<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreSequenceEqual<T>(expected: T[], actual: T[], equals?: (x: any, y: any) => boolean, message?: string): void;
|
||||
static Fail(message?: string): void;
|
||||
static IsFalse(actual: boolean, message?: string): void;
|
||||
static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void;
|
||||
static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void;
|
||||
static IsNotNull(actual: any, message?: string): void;
|
||||
static IsNull(actual: any, message?: string): void;
|
||||
static IsTrue(actual: boolean, message?: string): void;
|
||||
static Throws(fn: () => void, message?: string): void;
|
||||
}
|
||||
|
||||
declare export default class Assert {
|
||||
static AreEqual<T>(expected: T, actual: T, message?: string): void;
|
||||
static AreNotEqual<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreNotSame<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreSequenceEqual<T>(expected: T[], actual: T[], equals?: (x: any, y: any) => boolean, message?: string): void;
|
||||
static Fail(message?: string): void;
|
||||
static IsFalse(actual: boolean, message?: string): void;
|
||||
static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void;
|
||||
static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void;
|
||||
static IsNotNull(actual: any, message?: string): void;
|
||||
static IsNull(actual: any, message?: string): void;
|
||||
static IsTrue(actual: boolean, message?: string): void;
|
||||
static Throws(fn: () => void, message?: string): void;
|
||||
}
|
||||
|
||||
27
async-lock/async-lock.d.ts
vendored
27
async-lock/async-lock.d.ts
vendored
@ -3,28 +3,27 @@
|
||||
// Definitions by: Elisée MAURER <https://github.com/elisee/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "async-lock" {
|
||||
interface AsyncLockDoneCallback {
|
||||
(err?: Error, ret?: any): void;
|
||||
}
|
||||
|
||||
interface AsyncLockOptions {
|
||||
interface AsyncLockDoneCallback {
|
||||
(err?: Error, ret?: any): void;
|
||||
}
|
||||
|
||||
interface AsyncLockOptions {
|
||||
timeout?: number;
|
||||
maxPending?: number;
|
||||
domainReentrant?: boolean;
|
||||
Promise?: any;
|
||||
}
|
||||
}
|
||||
|
||||
class AsyncLock {
|
||||
declare class AsyncLock {
|
||||
constructor(options?: AsyncLockOptions);
|
||||
|
||||
acquire(key: string|string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void;
|
||||
acquire(key: string|string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike<any>;
|
||||
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void;
|
||||
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, opts?: AsyncLockOptions): PromiseLike<any>;
|
||||
|
||||
isBusy(): boolean;
|
||||
}
|
||||
|
||||
namespace AsyncLock {}
|
||||
|
||||
export = AsyncLock;
|
||||
}
|
||||
|
||||
declare namespace AsyncLock { }
|
||||
|
||||
export = AsyncLock;
|
||||
|
||||
121
async-writer/async-writer.d.ts
vendored
121
async-writer/async-writer.d.ts
vendored
@ -5,74 +5,73 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'async-writer' {
|
||||
import stream = require('stream');
|
||||
import events = require('events');
|
||||
|
||||
namespace async_writer {
|
||||
interface EventFunction {
|
||||
(event: string, callback: Function): void;
|
||||
}
|
||||
import stream = require('stream');
|
||||
import events = require('events');
|
||||
|
||||
class StringWriter {
|
||||
constructor(events: events.EventEmitter);
|
||||
end(): void;
|
||||
write(what: string): StringWriter;
|
||||
toString(): string;
|
||||
}
|
||||
declare namespace async_writer {
|
||||
interface EventFunction {
|
||||
(event: string, callback: Function): void;
|
||||
}
|
||||
|
||||
class BufferedWriter {
|
||||
constructor(wrappedStream: stream.Stream);
|
||||
flush(): void;
|
||||
on(event: string, callback: Function): BufferedWriter;
|
||||
once(event: string, callback: Function): BufferedWriter;
|
||||
clear(): void;
|
||||
end(): void;
|
||||
write(what: string): BufferedWriter;
|
||||
}
|
||||
class StringWriter {
|
||||
constructor(events: events.EventEmitter);
|
||||
end(): void;
|
||||
write(what: string): StringWriter;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface BeginAsyncOptions {
|
||||
last?: boolean;
|
||||
timeout?: number;
|
||||
name?: string;
|
||||
}
|
||||
class BufferedWriter {
|
||||
constructor(wrappedStream: stream.Stream);
|
||||
flush(): void;
|
||||
on(event: string, callback: Function): BufferedWriter;
|
||||
once(event: string, callback: Function): BufferedWriter;
|
||||
clear(): void;
|
||||
end(): void;
|
||||
write(what: string): BufferedWriter;
|
||||
}
|
||||
|
||||
class AsyncWriter {
|
||||
static enableAsyncStackTrace():void;
|
||||
interface BeginAsyncOptions {
|
||||
last?: boolean;
|
||||
timeout?: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
constructor(writer?: any, global?: {[s: string]: any}, async?: boolean, buffer?: boolean);
|
||||
isAsyncWriter: AsyncWriter;
|
||||
sync(): void;
|
||||
getAttributes(): {[s: string]: any};
|
||||
getAttribute(): any;
|
||||
write(str: string): AsyncWriter;
|
||||
getOutput(): string;
|
||||
captureString(func: Function, thisObj: Object): string;
|
||||
swapWriter(newWriter: StringWriter | BufferedWriter, func: Function, thisObj: Object): void;
|
||||
createNestedWriter(writer: StringWriter | BufferedWriter): AsyncWriter;
|
||||
beginAsync(options?: number | BeginAsyncOptions): AsyncWriter;
|
||||
handleBeginAsync(options: number | BeginAsyncOptions, parent: AsyncWriter): void;
|
||||
on(event: string, callback: Function): AsyncWriter;
|
||||
once(event: string, callback: Function): AsyncWriter;
|
||||
onLast(callback: Function): AsyncWriter;
|
||||
emit(arg: any): AsyncWriter;
|
||||
removeListener(): AsyncWriter;
|
||||
pipe(stream: stream.Stream): AsyncWriter;
|
||||
error(e: Error): void;
|
||||
end(data?: any): AsyncWriter;
|
||||
handleEnd(isAsync: boolean): void;
|
||||
_finish(): void;
|
||||
flush(): void;
|
||||
}
|
||||
class AsyncWriter {
|
||||
static enableAsyncStackTrace(): void;
|
||||
|
||||
interface AsyncWriterOptions {
|
||||
global?: {[s: string]: any};
|
||||
buffer?: boolean;
|
||||
}
|
||||
constructor(writer?: any, global?: { [s: string]: any }, async?: boolean, buffer?: boolean);
|
||||
isAsyncWriter: AsyncWriter;
|
||||
sync(): void;
|
||||
getAttributes(): { [s: string]: any };
|
||||
getAttribute(): any;
|
||||
write(str: string): AsyncWriter;
|
||||
getOutput(): string;
|
||||
captureString(func: Function, thisObj: Object): string;
|
||||
swapWriter(newWriter: StringWriter | BufferedWriter, func: Function, thisObj: Object): void;
|
||||
createNestedWriter(writer: StringWriter | BufferedWriter): AsyncWriter;
|
||||
beginAsync(options?: number | BeginAsyncOptions): AsyncWriter;
|
||||
handleBeginAsync(options: number | BeginAsyncOptions, parent: AsyncWriter): void;
|
||||
on(event: string, callback: Function): AsyncWriter;
|
||||
once(event: string, callback: Function): AsyncWriter;
|
||||
onLast(callback: Function): AsyncWriter;
|
||||
emit(arg: any): AsyncWriter;
|
||||
removeListener(): AsyncWriter;
|
||||
pipe(stream: stream.Stream): AsyncWriter;
|
||||
error(e: Error): void;
|
||||
end(data?: any): AsyncWriter;
|
||||
handleEnd(isAsync: boolean): void;
|
||||
_finish(): void;
|
||||
flush(): void;
|
||||
}
|
||||
|
||||
function create(writer?: any, options?: AsyncWriterOptions): AsyncWriter;
|
||||
function enableAsyncStackTrace(): void;
|
||||
}
|
||||
interface AsyncWriterOptions {
|
||||
global?: { [s: string]: any };
|
||||
buffer?: boolean;
|
||||
}
|
||||
|
||||
export = async_writer;
|
||||
function create(writer?: any, options?: AsyncWriterOptions): AsyncWriter;
|
||||
function enableAsyncStackTrace(): void;
|
||||
}
|
||||
|
||||
export = async_writer;
|
||||
|
||||
96
asyncblock/asyncblock.d.ts
vendored
96
asyncblock/asyncblock.d.ts
vendored
@ -4,70 +4,68 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "asyncblock" {
|
||||
function asyncblock<T>(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void;
|
||||
|
||||
namespace asyncblock {
|
||||
declare function asyncblock<T>(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void;
|
||||
|
||||
declare namespace asyncblock {
|
||||
export function nostack<T>(f: (flow: asyncblock.IFlow) => void, callback?: (err: any, res: T) => void): void;
|
||||
|
||||
export interface IFlow {
|
||||
add(responseFormat?: string[]): IExecuteFunction;
|
||||
add(key: string, responseFormat?: string[]): IExecuteFunction;
|
||||
add(key: number, responseFormat?: string[]): IExecuteFunction;
|
||||
add(options: IFlowOptions): IExecuteFunction;
|
||||
callback(responseFormat?: string[]): IExecuteFunction;
|
||||
callback(key: string, responseFormat?: string[]): IExecuteFunction;
|
||||
callback(key: number, responseFormat?: string[]): IExecuteFunction;
|
||||
callback(options: IFlowOptions): IExecuteFunction;
|
||||
wait<T>(key?: string): T;
|
||||
wait<T>(key?: number): T;
|
||||
add(responseFormat?: string[]): IExecuteFunction;
|
||||
add(key: string, responseFormat?: string[]): IExecuteFunction;
|
||||
add(key: number, responseFormat?: string[]): IExecuteFunction;
|
||||
add(options: IFlowOptions): IExecuteFunction;
|
||||
callback(responseFormat?: string[]): IExecuteFunction;
|
||||
callback(key: string, responseFormat?: string[]): IExecuteFunction;
|
||||
callback(key: number, responseFormat?: string[]): IExecuteFunction;
|
||||
callback(options: IFlowOptions): IExecuteFunction;
|
||||
wait<T>(key?: string): T;
|
||||
wait<T>(key?: number): T;
|
||||
|
||||
get<T>(key: string): T;
|
||||
set(key: string, responseFormat?: string[]): IExecuteFunction;
|
||||
set(options: IFlowOptions): IExecuteFunction;
|
||||
del(key: string): void;
|
||||
get<T>(key: string): T;
|
||||
set(key: string, responseFormat?: string[]): IExecuteFunction;
|
||||
set(options: IFlowOptions): IExecuteFunction;
|
||||
del(key: string): void;
|
||||
|
||||
sync<T>(task: any): T;
|
||||
queue(toExecute: IExecuteFunction): void;
|
||||
queue(key: string, toExecute: IExecuteFunction): void;
|
||||
queue(key: number, toExecute: IExecuteFunction): void;
|
||||
queue(responseFormat: string[], toExecute: IExecuteFunction): void;
|
||||
queue(key: string, responseFormat: string[], toExecute: IExecuteFunction): void;
|
||||
queue(key: number, responseFormat: string[], toExecute: IExecuteFunction): void;
|
||||
queue(options: IFlowOptions, toExecute: IExecuteFunction): void;
|
||||
doneAdding(): void;
|
||||
forceWait<T>(): T;
|
||||
sync<T>(task: any): T;
|
||||
queue(toExecute: IExecuteFunction): void;
|
||||
queue(key: string, toExecute: IExecuteFunction): void;
|
||||
queue(key: number, toExecute: IExecuteFunction): void;
|
||||
queue(responseFormat: string[], toExecute: IExecuteFunction): void;
|
||||
queue(key: string, responseFormat: string[], toExecute: IExecuteFunction): void;
|
||||
queue(key: number, responseFormat: string[], toExecute: IExecuteFunction): void;
|
||||
queue(options: IFlowOptions, toExecute: IExecuteFunction): void;
|
||||
doneAdding(): void;
|
||||
forceWait<T>(): T;
|
||||
|
||||
maxParallel: number;
|
||||
errorCallback: (err: any) => void;
|
||||
taskTimeout: number;
|
||||
timeoutIsError: boolean;
|
||||
maxParallel: number;
|
||||
errorCallback: (err: any) => void;
|
||||
taskTimeout: number;
|
||||
timeoutIsError: boolean;
|
||||
}
|
||||
|
||||
export interface IFlowOptions {
|
||||
ignoreError?: boolean; // default false
|
||||
key?: string; // string | number
|
||||
responseFormat?: string[];
|
||||
timeout?: number;
|
||||
timeoutIsError?: boolean;
|
||||
dontWait?: boolean;
|
||||
firstArgIsError?: boolean; // default true
|
||||
ignoreError?: boolean; // default false
|
||||
key?: string; // string | number
|
||||
responseFormat?: string[];
|
||||
timeout?: number;
|
||||
timeoutIsError?: boolean;
|
||||
dontWait?: boolean;
|
||||
firstArgIsError?: boolean; // default true
|
||||
}
|
||||
|
||||
export interface IExecuteFunction {
|
||||
<T1, T2, T3>(err: any, res1: T1, res2: T2, res3: T3): any;
|
||||
<T1, T2>(err: any, res1: T1, res2: T2): any;
|
||||
<T>(err: any, res: T): any;
|
||||
(err: any): any;
|
||||
<T1, T2, T3>(err: any, res1: T1, res2: T2, res3: T3): any;
|
||||
<T1, T2>(err: any, res1: T1, res2: T2): any;
|
||||
<T>(err: any, res: T): any;
|
||||
(err: any): any;
|
||||
|
||||
// firstArgIsError === false
|
||||
<T1, T2, T3>(res1: T1, res2: T2, res3: T3): any;
|
||||
<T1, T2>(res1: T1, res2: T2): any;
|
||||
<T>(res: T): any;
|
||||
// firstArgIsError === false
|
||||
<T1, T2, T3>(res1: T1, res2: T2, res3: T3): any;
|
||||
<T1, T2>(res1: T1, res2: T2): any;
|
||||
<T>(res: T): any;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export = asyncblock;
|
||||
}
|
||||
|
||||
export = asyncblock;
|
||||
|
||||
21
atpl/atpl.d.ts
vendored
21
atpl/atpl.d.ts
vendored
@ -5,16 +5,15 @@
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/atpl.d.ts
|
||||
|
||||
declare module "atpl" {
|
||||
export function compile(templateString: string, options: any): (context:any) => string;
|
||||
export function __express(filename: string, options: any, callback: Function): any;
|
||||
|
||||
export function registerExtension(items: any): void;
|
||||
export function registerTags(items: any): void;
|
||||
export function registerFunctions(items: any): void;
|
||||
export function registerFilters(items: any): void;
|
||||
export function registerTests(items: any): void;
|
||||
declare export function compile(templateString: string, options: any): (context: any) => string;
|
||||
declare export function __express(filename: string, options: any, callback: Function): any;
|
||||
|
||||
export function renderFileSync(viewsPath: string, filename: string, parameters: any, cache: boolean ): string;
|
||||
export function renderFile(viewsPath: string, filename: string, parameters: any, cache: boolean, done: (err: Error, result?: string) => void): void;
|
||||
}
|
||||
declare export function registerExtension(items: any): void;
|
||||
declare export function registerTags(items: any): void;
|
||||
declare export function registerFunctions(items: any): void;
|
||||
declare export function registerFilters(items: any): void;
|
||||
declare export function registerTests(items: any): void;
|
||||
|
||||
declare export function renderFileSync(viewsPath: string, filename: string, parameters: any, cache: boolean): string;
|
||||
declare export function renderFile(viewsPath: string, filename: string, parameters: any, cache: boolean, done: (err: Error, result?: string) => void): void;
|
||||
|
||||
73
autoprefixer-core/autoprefixer-core.d.ts
vendored
73
autoprefixer-core/autoprefixer-core.d.ts
vendored
@ -3,42 +3,41 @@
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "autoprefixer-core" {
|
||||
interface Config {
|
||||
browsers?: string[];
|
||||
cascade?: boolean;
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
from?: string;
|
||||
to?: string;
|
||||
safe?: boolean;
|
||||
map?: {
|
||||
inline?: boolean;
|
||||
prev?: string | Object;
|
||||
}
|
||||
}
|
||||
|
||||
interface Result {
|
||||
css: string;
|
||||
map: string;
|
||||
opts: Options;
|
||||
}
|
||||
|
||||
interface Processor {
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
interface Exports {
|
||||
(config: Config): Processor;
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
var exports: Exports;
|
||||
export = exports;
|
||||
interface Config {
|
||||
browsers?: string[];
|
||||
cascade?: boolean;
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
from?: string;
|
||||
to?: string;
|
||||
safe?: boolean;
|
||||
map?: {
|
||||
inline?: boolean;
|
||||
prev?: string | Object;
|
||||
}
|
||||
}
|
||||
|
||||
interface Result {
|
||||
css: string;
|
||||
map: string;
|
||||
opts: Options;
|
||||
}
|
||||
|
||||
interface Processor {
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
interface Exports {
|
||||
(config: Config): Processor;
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
declare var exports: Exports;
|
||||
export = exports;
|
||||
|
||||
2365
aws-sdk/aws-sdk.d.ts
vendored
2365
aws-sdk/aws-sdk.d.ts
vendored
File diff suppressed because it is too large
Load Diff
3653
azure/azure.d.ts
vendored
3653
azure/azure.d.ts
vendored
File diff suppressed because it is too large
Load Diff
29
barcode/barcode.d.ts
vendored
29
barcode/barcode.d.ts
vendored
@ -5,21 +5,20 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "barcode" {
|
||||
|
||||
interface BarcodeOptions {
|
||||
data:string|number;
|
||||
width:number;
|
||||
height:number;
|
||||
}
|
||||
|
||||
interface BarcodeResult {
|
||||
getStream(callback:(err:NodeJS.ErrnoException, stream:NodeJS.ReadableStream) => void):void;
|
||||
saveImage(outputfilePath:string, callback:(err:NodeJS.ErrnoException) => void):void;
|
||||
getBase64(callback:(err:NodeJS.ErrnoException, base64String:string) => void):void;
|
||||
}
|
||||
|
||||
function barcode(type:string, options:BarcodeOptions):BarcodeResult;
|
||||
|
||||
export = barcode;
|
||||
interface BarcodeOptions {
|
||||
data: string | number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface BarcodeResult {
|
||||
getStream(callback: (err: NodeJS.ErrnoException, stream: NodeJS.ReadableStream) => void): void;
|
||||
saveImage(outputfilePath: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
getBase64(callback: (err: NodeJS.ErrnoException, base64String: string) => void): void;
|
||||
}
|
||||
|
||||
declare function barcode(type: string, options: BarcodeOptions): BarcodeResult;
|
||||
|
||||
export = barcode;
|
||||
|
||||
17
basic-auth/basic-auth.d.ts
vendored
17
basic-auth/basic-auth.d.ts
vendored
@ -5,15 +5,14 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "basic-auth" {
|
||||
function auth(req: Express.Request): auth.BasicAuthResult;
|
||||
|
||||
namespace auth {
|
||||
interface BasicAuthResult {
|
||||
name: string;
|
||||
pass: string;
|
||||
}
|
||||
declare function auth(req: Express.Request): auth.BasicAuthResult;
|
||||
|
||||
declare namespace auth {
|
||||
interface BasicAuthResult {
|
||||
name: string;
|
||||
pass: string;
|
||||
}
|
||||
|
||||
export = auth;
|
||||
}
|
||||
|
||||
export = auth;
|
||||
|
||||
15
batch-stream/batch-stream.d.ts
vendored
15
batch-stream/batch-stream.d.ts
vendored
@ -5,20 +5,19 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "batch-stream" {
|
||||
import stream = require('stream');
|
||||
|
||||
interface Options {
|
||||
import stream = require('stream');
|
||||
|
||||
interface Options {
|
||||
size?: number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
}
|
||||
|
||||
class BatchStream extends stream.Transform {
|
||||
declare class BatchStream extends stream.Transform {
|
||||
size: number;
|
||||
batch: any[];
|
||||
|
||||
constructor(options: Options);
|
||||
}
|
||||
}
|
||||
|
||||
export = BatchStream;
|
||||
}
|
||||
export = BatchStream;
|
||||
|
||||
111
bcrypt-nodejs/bcrypt-nodejs.d.ts
vendored
111
bcrypt-nodejs/bcrypt-nodejs.d.ts
vendored
@ -3,66 +3,65 @@
|
||||
// Definitions by: David Broder-Rodgers <https://github.com/DavidBR-SW/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bcrypt-nodejs" {
|
||||
/**
|
||||
* Generate a salt synchronously
|
||||
* @param rounds Number of rounds to process the data for (default - 10)
|
||||
* @return Generated salt
|
||||
*/
|
||||
export function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* Generate a salt asynchronously
|
||||
* @param rounds Number of rounds to process the data for (default - 10)
|
||||
* @param callback Callback with error and resulting salt, to be fired once the salt has been generated
|
||||
*/
|
||||
export function genSalt(rounds: number, callback: (error: Error, result: string) => void): void;
|
||||
/**
|
||||
* Generate a salt synchronously
|
||||
* @param rounds Number of rounds to process the data for (default - 10)
|
||||
* @return Generated salt
|
||||
*/
|
||||
declare export function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* Generate a hash synchronously
|
||||
* @param data Data to be encrypted
|
||||
* @param salt Salt to be used in encryption (default - new salt generated with 10 rounds)
|
||||
* @return Generated hash
|
||||
*/
|
||||
export function hashSync(data: string, salt?: string): string;
|
||||
/**
|
||||
* Generate a salt asynchronously
|
||||
* @param rounds Number of rounds to process the data for (default - 10)
|
||||
* @param callback Callback with error and resulting salt, to be fired once the salt has been generated
|
||||
*/
|
||||
declare export function genSalt(rounds: number, callback: (error: Error, result: string) => void): void;
|
||||
|
||||
/**
|
||||
* Generate a hash asynchronously
|
||||
* @param data Data to be encrypted
|
||||
* @param salt Salt to be used in encryption
|
||||
* @param callback Callback with error and hashed result, to be fired once the data has been encrypted
|
||||
*/
|
||||
export function hash(data: string, salt: string, callback: (error: Error, result: string) => void): void;
|
||||
/**
|
||||
* Generate a hash synchronously
|
||||
* @param data Data to be encrypted
|
||||
* @param salt Salt to be used in encryption (default - new salt generated with 10 rounds)
|
||||
* @return Generated hash
|
||||
*/
|
||||
declare export function hashSync(data: string, salt?: string): string;
|
||||
|
||||
/**
|
||||
* Generate a hash asynchronously
|
||||
* @param data Data to be encrypted
|
||||
* @param salt Salt to be used in encryption
|
||||
* @param progressCallback Callback to be fired multiple times during the hash calculation to signify progress
|
||||
* @param callback Callback with error and hashed result, to be fired once the data has been encrypted
|
||||
*/
|
||||
export function hash(data: string, salt: string, progressCallback: () => void, callback: (error: Error, result: string) => void): void;
|
||||
/**
|
||||
* Generate a hash asynchronously
|
||||
* @param data Data to be encrypted
|
||||
* @param salt Salt to be used in encryption
|
||||
* @param callback Callback with error and hashed result, to be fired once the data has been encrypted
|
||||
*/
|
||||
declare export function hash(data: string, salt: string, callback: (error: Error, result: string) => void): void;
|
||||
|
||||
/**
|
||||
* Compares data with a hash synchronously
|
||||
* @param data Data to be compared
|
||||
* @param hash Hash to be compared to
|
||||
* @return true if matching, false otherwise
|
||||
*/
|
||||
export function compareSync(data: string, hash: string): boolean;
|
||||
/**
|
||||
* Generate a hash asynchronously
|
||||
* @param data Data to be encrypted
|
||||
* @param salt Salt to be used in encryption
|
||||
* @param progressCallback Callback to be fired multiple times during the hash calculation to signify progress
|
||||
* @param callback Callback with error and hashed result, to be fired once the data has been encrypted
|
||||
*/
|
||||
declare export function hash(data: string, salt: string, progressCallback: () => void, callback: (error: Error, result: string) => void): void;
|
||||
|
||||
/**
|
||||
* Compares data with a hash asynchronously
|
||||
* @param data Data to be compared
|
||||
* @param hash Hash to be compared to
|
||||
* @param callback Callback with error and match result, to be fired once the data has been compared
|
||||
*/
|
||||
export function compare(data: string, hash: string, callback: (error: Error, result: boolean) => void): void;
|
||||
/**
|
||||
* Compares data with a hash synchronously
|
||||
* @param data Data to be compared
|
||||
* @param hash Hash to be compared to
|
||||
* @return true if matching, false otherwise
|
||||
*/
|
||||
declare export function compareSync(data: string, hash: string): boolean;
|
||||
|
||||
/**
|
||||
* Get number of rounds used for hash
|
||||
* @param hash Hash from which the number of rounds used should be extracted
|
||||
* @return number of rounds used to encrypt a given hash
|
||||
*/
|
||||
export function getRounds(hash: string): number;
|
||||
}
|
||||
/**
|
||||
* Compares data with a hash asynchronously
|
||||
* @param data Data to be compared
|
||||
* @param hash Hash to be compared to
|
||||
* @param callback Callback with error and match result, to be fired once the data has been compared
|
||||
*/
|
||||
declare export function compare(data: string, hash: string, callback: (error: Error, result: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Get number of rounds used for hash
|
||||
* @param hash Hash from which the number of rounds used should be extracted
|
||||
* @return number of rounds used to encrypt a given hash
|
||||
*/
|
||||
declare export function getRounds(hash: string): number;
|
||||
|
||||
107
bcrypt/bcrypt.d.ts
vendored
107
bcrypt/bcrypt.d.ts
vendored
@ -3,63 +3,62 @@
|
||||
// Definitions by: Peter Harris <https://github.com/codeanimal>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bcrypt" {
|
||||
/**
|
||||
* @param rounds The cost of processing the data. Default 10.
|
||||
*/
|
||||
export function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* @param rounds The cost of processing the data. Default 10.
|
||||
* @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void;
|
||||
/**
|
||||
* @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function genSalt(callback: (err: Error, salt: string) => void): void;
|
||||
/**
|
||||
* @param rounds The cost of processing the data. Default 10.
|
||||
*/
|
||||
declare export function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param salt The salt to be used in encryption.
|
||||
*/
|
||||
export function hashSync(data: any, salt: string): string;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param rounds A salt will be generated using the rounds specified.
|
||||
*/
|
||||
export function hashSync(data: any, rounds: number): string;
|
||||
/**
|
||||
* @param rounds The cost of processing the data. Default 10.
|
||||
* @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous.
|
||||
*/
|
||||
declare export function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void;
|
||||
/**
|
||||
* @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous.
|
||||
*/
|
||||
declare export function genSalt(callback: (err: Error, salt: string) => void): void;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param salt The salt to be used in encryption.
|
||||
* @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function hash(data: any, salt: string, callback: (err: Error, encrypted: string) => void): void;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param rounds A salt will be generated using the rounds specified.
|
||||
* @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function hash(data: any, rounds: number, callback: (err: Error, encrypted: string) => void): void;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param salt The salt to be used in encryption.
|
||||
*/
|
||||
declare export function hashSync(data: any, salt: string): string;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param rounds A salt will be generated using the rounds specified.
|
||||
*/
|
||||
declare export function hashSync(data: any, rounds: number): string;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param encrypted The data to be compared against.
|
||||
*/
|
||||
export function compareSync(data: any, encrypted: string): boolean;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param salt The salt to be used in encryption.
|
||||
* @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.
|
||||
*/
|
||||
declare export function hash(data: any, salt: string, callback: (err: Error, encrypted: string) => void): void;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param rounds A salt will be generated using the rounds specified.
|
||||
* @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.
|
||||
*/
|
||||
declare export function hash(data: any, rounds: number, callback: (err: Error, encrypted: string) => void): void;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param encrypted The data to be compared against.
|
||||
* @param callback A callback to be fire once the data has been compared. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function compare(data: any, encrypted: string, callback: (err: Error, same: boolean) => void): void;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param encrypted The data to be compared against.
|
||||
*/
|
||||
declare export function compareSync(data: any, encrypted: string): boolean;
|
||||
|
||||
/**
|
||||
* Return the number of rounds used to encrypt a given hash
|
||||
*
|
||||
* @param encrypted Hash from which the number of rounds used should be extracted.
|
||||
*/
|
||||
export function getRounds(encrypted: string): number;
|
||||
}
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param encrypted The data to be compared against.
|
||||
* @param callback A callback to be fire once the data has been compared. Uses eio making it asynchronous.
|
||||
*/
|
||||
declare export function compare(data: any, encrypted: string, callback: (err: Error, same: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Return the number of rounds used to encrypt a given hash
|
||||
*
|
||||
* @param encrypted Hash from which the number of rounds used should be extracted.
|
||||
*/
|
||||
declare export function getRounds(encrypted: string): number;
|
||||
|
||||
133
bcryptjs/bcryptjs.d.ts
vendored
133
bcryptjs/bcryptjs.d.ts
vendored
@ -3,80 +3,79 @@
|
||||
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bcryptjs" {
|
||||
|
||||
/**
|
||||
* Sets the pseudo random number generator to use as a fallback if neither node's crypto module nor the Web Crypto API is available.
|
||||
* Please note: It is highly important that the PRNG used is cryptographically secure and that it is seeded properly!
|
||||
* @param random Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values.
|
||||
*/
|
||||
export function setRandomFallback(random: (random: number) => number[]): void;
|
||||
|
||||
/**
|
||||
* Synchronously generates a salt.
|
||||
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
||||
* @return Resulting salt
|
||||
*/
|
||||
export function genSaltSync(rounds?: number): string;
|
||||
/**
|
||||
* Sets the pseudo random number generator to use as a fallback if neither node's crypto module nor the Web Crypto API is available.
|
||||
* Please note: It is highly important that the PRNG used is cryptographically secure and that it is seeded properly!
|
||||
* @param random Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values.
|
||||
*/
|
||||
declare export function setRandomFallback(random: (random: number) => number[]): void;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a salt.
|
||||
* @param callback Callback receiving the error, if any, and the resulting salt
|
||||
*/
|
||||
export function genSalt(callback: (err: Error, salt: string) => void): void;
|
||||
/**
|
||||
* Synchronously generates a salt.
|
||||
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
||||
* @return Resulting salt
|
||||
*/
|
||||
declare export function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a salt.
|
||||
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
||||
* @param callback Callback receiving the error, if any, and the resulting salt
|
||||
*/
|
||||
export function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void;
|
||||
/**
|
||||
* Asynchronously generates a salt.
|
||||
* @param callback Callback receiving the error, if any, and the resulting salt
|
||||
*/
|
||||
declare export function genSalt(callback: (err: Error, salt: string) => void): void;
|
||||
|
||||
/**
|
||||
* Synchronously generates a hash for the given string.
|
||||
* @param s String to hash
|
||||
* @param salt Salt length to generate or salt to use, default to 10
|
||||
* @return Resulting hash
|
||||
*/
|
||||
export function hashSync(s: string, salt?: number | string): string;
|
||||
/**
|
||||
* Asynchronously generates a salt.
|
||||
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
||||
* @param callback Callback receiving the error, if any, and the resulting salt
|
||||
*/
|
||||
declare export function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a hash for the given string.
|
||||
* @param s String to hash
|
||||
* @param salt Salt length to generate or salt to use
|
||||
* @param callback Callback receiving the error, if any, and the resulting hash
|
||||
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
||||
*/
|
||||
export function hash(s: string, salt: number | string, callback: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void;
|
||||
/**
|
||||
* Synchronously generates a hash for the given string.
|
||||
* @param s String to hash
|
||||
* @param salt Salt length to generate or salt to use, default to 10
|
||||
* @return Resulting hash
|
||||
*/
|
||||
declare export function hashSync(s: string, salt?: number | string): string;
|
||||
|
||||
/**
|
||||
* Synchronously tests a string against a hash.
|
||||
* @param s String to compare
|
||||
* @param hash Hash to test against
|
||||
* @return true if matching, otherwise false
|
||||
*/
|
||||
export function compareSync(s: string, hash: string): boolean;
|
||||
/**
|
||||
* Asynchronously generates a hash for the given string.
|
||||
* @param s String to hash
|
||||
* @param salt Salt length to generate or salt to use
|
||||
* @param callback Callback receiving the error, if any, and the resulting hash
|
||||
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
||||
*/
|
||||
declare export function hash(s: string, salt: number | string, callback: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void;
|
||||
|
||||
/**
|
||||
* Asynchronously compares the given data against the given hash.
|
||||
* @param s Data to compare
|
||||
* @param hash Data to be compared to
|
||||
* @param callback Callback receiving the error, if any, otherwise the result
|
||||
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
||||
*/
|
||||
export function compare(s: string, hash: string, callback: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void;
|
||||
/**
|
||||
* Synchronously tests a string against a hash.
|
||||
* @param s String to compare
|
||||
* @param hash Hash to test against
|
||||
* @return true if matching, otherwise false
|
||||
*/
|
||||
declare export function compareSync(s: string, hash: string): boolean;
|
||||
|
||||
/**
|
||||
* Gets the number of rounds used to encrypt the specified hash.
|
||||
* @param hash Hash to extract the used number of rounds from
|
||||
* @return Number of rounds used
|
||||
*/
|
||||
export function getRounds(hash: string): number;
|
||||
/**
|
||||
* Asynchronously compares the given data against the given hash.
|
||||
* @param s Data to compare
|
||||
* @param hash Data to be compared to
|
||||
* @param callback Callback receiving the error, if any, otherwise the result
|
||||
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
||||
*/
|
||||
declare export function compare(s: string, hash: string, callback: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void;
|
||||
|
||||
/**
|
||||
* Gets the salt portion from a hash. Does not validate the hash.
|
||||
* @param hash Hash to extract the salt from
|
||||
* @return Extracted salt part
|
||||
*/
|
||||
export function getSalt(hash: string): string;
|
||||
}
|
||||
/**
|
||||
* Gets the number of rounds used to encrypt the specified hash.
|
||||
* @param hash Hash to extract the used number of rounds from
|
||||
* @return Number of rounds used
|
||||
*/
|
||||
declare export function getRounds(hash: string): number;
|
||||
|
||||
/**
|
||||
* Gets the salt portion from a hash. Does not validate the hash.
|
||||
* @param hash Hash to extract the salt from
|
||||
* @return Extracted salt part
|
||||
*/
|
||||
declare export function getSalt(hash: string): string;
|
||||
|
||||
351
benchmark/benchmark.d.ts
vendored
351
benchmark/benchmark.d.ts
vendored
@ -3,190 +3,189 @@
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "benchmark" {
|
||||
class Benchmark {
|
||||
static deepClone<T>(value: T): T;
|
||||
static each(obj: Object | any[], callback: Function, thisArg?: any): void;
|
||||
static extend(destination: Object, ...sources: Object[]): Object;
|
||||
static filter<T>(arr: T[], callback: (value: T) => any, thisArg?: any): T[];
|
||||
static filter<T>(arr: T[], filter: string, thisArg?: any): T[];
|
||||
static forEach<T>(arr: T[], callback: (value: T) => any, thisArg?: any): void;
|
||||
static formatNumber(num: number): string;
|
||||
static forOwn(obj: Object, callback: Function, thisArg?: any): void;
|
||||
static hasKey(obj: Object, key: string): boolean;
|
||||
static indexOf<T>(arr: T[], value: T, fromIndex?: number): number;
|
||||
static interpolate(template: string, values: Object): string;
|
||||
static invoke(benches: Benchmark[], name: string | Object, ...args: any[]): any[];
|
||||
static join(obj: Object, separator1?: string, separator2?: string): string;
|
||||
static map<T, K>(arr: T[], callback: (value: T) => K, thisArg?: any): K[];
|
||||
static pluck<T, K>(arr: T[], key: string): K[];
|
||||
static reduce<T, K>(arr: T[], callback: (accumulator: K, value: T) => K, thisArg?: any): K;
|
||||
|
||||
static options: Benchmark.Options;
|
||||
static platform: Benchmark.Platform;
|
||||
static support: Benchmark.Support;
|
||||
static version: string;
|
||||
declare class Benchmark {
|
||||
static deepClone<T>(value: T): T;
|
||||
static each(obj: Object | any[], callback: Function, thisArg?: any): void;
|
||||
static extend(destination: Object, ...sources: Object[]): Object;
|
||||
static filter<T>(arr: T[], callback: (value: T) => any, thisArg?: any): T[];
|
||||
static filter<T>(arr: T[], filter: string, thisArg?: any): T[];
|
||||
static forEach<T>(arr: T[], callback: (value: T) => any, thisArg?: any): void;
|
||||
static formatNumber(num: number): string;
|
||||
static forOwn(obj: Object, callback: Function, thisArg?: any): void;
|
||||
static hasKey(obj: Object, key: string): boolean;
|
||||
static indexOf<T>(arr: T[], value: T, fromIndex?: number): number;
|
||||
static interpolate(template: string, values: Object): string;
|
||||
static invoke(benches: Benchmark[], name: string | Object, ...args: any[]): any[];
|
||||
static join(obj: Object, separator1?: string, separator2?: string): string;
|
||||
static map<T, K>(arr: T[], callback: (value: T) => K, thisArg?: any): K[];
|
||||
static pluck<T, K>(arr: T[], key: string): K[];
|
||||
static reduce<T, K>(arr: T[], callback: (accumulator: K, value: T) => K, thisArg?: any): K;
|
||||
|
||||
constructor(fn: Function | string, options?: Benchmark.Options);
|
||||
constructor(name: string, fn: Function | string, options?: Benchmark.Options);
|
||||
constructor(name: string, options?: Benchmark.Options);
|
||||
constructor(options: Benchmark.Options);
|
||||
static options: Benchmark.Options;
|
||||
static platform: Benchmark.Platform;
|
||||
static support: Benchmark.Support;
|
||||
static version: string;
|
||||
|
||||
aborted: boolean;
|
||||
compiled: Function | string;
|
||||
count: number;
|
||||
cycles: number;
|
||||
error: Error;
|
||||
fn: Function | string;
|
||||
hz: number;
|
||||
running: boolean;
|
||||
setup: Function | string;
|
||||
teardown: Function | string;
|
||||
constructor(fn: Function | string, options?: Benchmark.Options);
|
||||
constructor(name: string, fn: Function | string, options?: Benchmark.Options);
|
||||
constructor(name: string, options?: Benchmark.Options);
|
||||
constructor(options: Benchmark.Options);
|
||||
|
||||
stats: Benchmark.Stats;
|
||||
times: Benchmark.Times;
|
||||
aborted: boolean;
|
||||
compiled: Function | string;
|
||||
count: number;
|
||||
cycles: number;
|
||||
error: Error;
|
||||
fn: Function | string;
|
||||
hz: number;
|
||||
running: boolean;
|
||||
setup: Function | string;
|
||||
teardown: Function | string;
|
||||
|
||||
abort(): Benchmark;
|
||||
clone(options: Benchmark.Options): Benchmark;
|
||||
compare(benchmark: Benchmark): number;
|
||||
emit(type: string | Object): any;
|
||||
listeners(type: string): Function[];
|
||||
off(type?: string, listener?: Function): Benchmark;
|
||||
off(types: string[]): Benchmark;
|
||||
on(type?: string, listener?: Function): Benchmark;
|
||||
on(types: string[]): Benchmark;
|
||||
reset(): Benchmark;
|
||||
run(options?: Benchmark.Options): Benchmark;
|
||||
stats: Benchmark.Stats;
|
||||
times: Benchmark.Times;
|
||||
|
||||
abort(): Benchmark;
|
||||
clone(options: Benchmark.Options): Benchmark;
|
||||
compare(benchmark: Benchmark): number;
|
||||
emit(type: string | Object): any;
|
||||
listeners(type: string): Function[];
|
||||
off(type?: string, listener?: Function): Benchmark;
|
||||
off(types: string[]): Benchmark;
|
||||
on(type?: string, listener?: Function): Benchmark;
|
||||
on(types: string[]): Benchmark;
|
||||
reset(): Benchmark;
|
||||
run(options?: Benchmark.Options): Benchmark;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
declare namespace Benchmark {
|
||||
export interface Options {
|
||||
async?: boolean;
|
||||
defer?: boolean;
|
||||
delay?: number;
|
||||
id?: string;
|
||||
initCount?: number;
|
||||
maxTime?: number;
|
||||
minSamples?: number;
|
||||
minTime?: number;
|
||||
name?: string;
|
||||
onAbort?: Function;
|
||||
onComplete?: Function;
|
||||
onCycle?: Function;
|
||||
onError?: Function;
|
||||
onReset?: Function;
|
||||
onStart?: Function;
|
||||
setup?: Function | string;
|
||||
teardown?: Function | string;
|
||||
fn?: Function | string;
|
||||
queued?: boolean;
|
||||
}
|
||||
|
||||
export interface Platform {
|
||||
description: string;
|
||||
layout: string;
|
||||
manufacturer: string;
|
||||
name: string;
|
||||
os: string;
|
||||
prerelease: string;
|
||||
product: string;
|
||||
version: string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
namespace Benchmark {
|
||||
export interface Options {
|
||||
async?: boolean;
|
||||
defer?: boolean;
|
||||
delay?: number;
|
||||
id?: string;
|
||||
initCount?: number;
|
||||
maxTime?: number;
|
||||
minSamples?: number;
|
||||
minTime?: number;
|
||||
name?: string;
|
||||
onAbort?: Function;
|
||||
onComplete?: Function;
|
||||
onCycle?: Function;
|
||||
onError?: Function;
|
||||
onReset?: Function;
|
||||
onStart?: Function;
|
||||
setup?: Function | string;
|
||||
teardown?: Function | string;
|
||||
fn?: Function | string;
|
||||
queued?: boolean;
|
||||
}
|
||||
|
||||
export interface Platform {
|
||||
description: string;
|
||||
layout: string;
|
||||
manufacturer: string;
|
||||
name: string;
|
||||
os: string;
|
||||
prerelease: string;
|
||||
product: string;
|
||||
version: string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export interface Support {
|
||||
air: boolean;
|
||||
argumentsClass: boolean;
|
||||
browser: boolean;
|
||||
charByIndex: boolean;
|
||||
charByOwnIndex: boolean;
|
||||
decompilation: boolean;
|
||||
descriptors: boolean;
|
||||
getAllKeys: boolean;
|
||||
iteratesOwnFirst: boolean;
|
||||
java: boolean;
|
||||
nodeClass: boolean;
|
||||
timeout: boolean;
|
||||
}
|
||||
|
||||
export interface Stats {
|
||||
deviation: number;
|
||||
mean: number;
|
||||
moe: number;
|
||||
rme: number;
|
||||
sample: any[];
|
||||
sem: number;
|
||||
variance: number;
|
||||
}
|
||||
|
||||
export interface Times {
|
||||
cycle: number;
|
||||
elapsed: number;
|
||||
period: number;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
export class Deferred {
|
||||
constructor(clone: Benchmark);
|
||||
|
||||
benchmark: Benchmark;
|
||||
cycles: number;
|
||||
elapsed: number;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
export class Event {
|
||||
constructor(type: string | Object);
|
||||
|
||||
aborted: boolean;
|
||||
cancelled: boolean;
|
||||
currentTarget: Object;
|
||||
result: any;
|
||||
target: Object;
|
||||
timeStamp: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export class Suite {
|
||||
static options: { name: string };
|
||||
|
||||
constructor(name?: string, options?: Options);
|
||||
|
||||
aborted: boolean;
|
||||
length: number;
|
||||
running: boolean;
|
||||
abort(): Suite;
|
||||
add(name: string, fn: Function | string, options?: Options): Suite;
|
||||
add(fn: Function | string, options?: Options): Suite;
|
||||
add(name: string, options?: Options): Suite;
|
||||
add(options: Options): Suite;
|
||||
clone(options: Options): Suite;
|
||||
emit(type: string | Object): any;
|
||||
filter(callback: Function | string): Suite;
|
||||
forEach(callback: Function): Suite;
|
||||
indexOf(value: any): number;
|
||||
invoke(name: string, ...args: any[]): any[];
|
||||
join(separator?: string): string;
|
||||
listeners(type: string): Function[];
|
||||
map(callback: Function): any[];
|
||||
off(type?: string, callback?: Function): Benchmark;
|
||||
off(types: string[]): Benchmark;
|
||||
on(type?: string, callback?: Function): Benchmark;
|
||||
on(types: string[]): Benchmark;
|
||||
pluck(property: string): any[];
|
||||
pop(): Function;
|
||||
push(benchmark: Benchmark): number;
|
||||
reduce<T>(callback: Function, accumulator: T): T;
|
||||
reset(): Suite;
|
||||
reverse(): any[];
|
||||
run(options?: Options): Suite;
|
||||
shift(): Benchmark;
|
||||
slice(start: number, end: number): any[];
|
||||
slice(start: number, deleteCount: number, ...values: any[]): any[];
|
||||
unshift(benchmark: Benchmark): number;
|
||||
}
|
||||
export interface Support {
|
||||
air: boolean;
|
||||
argumentsClass: boolean;
|
||||
browser: boolean;
|
||||
charByIndex: boolean;
|
||||
charByOwnIndex: boolean;
|
||||
decompilation: boolean;
|
||||
descriptors: boolean;
|
||||
getAllKeys: boolean;
|
||||
iteratesOwnFirst: boolean;
|
||||
java: boolean;
|
||||
nodeClass: boolean;
|
||||
timeout: boolean;
|
||||
}
|
||||
|
||||
export = Benchmark;
|
||||
export interface Stats {
|
||||
deviation: number;
|
||||
mean: number;
|
||||
moe: number;
|
||||
rme: number;
|
||||
sample: any[];
|
||||
sem: number;
|
||||
variance: number;
|
||||
}
|
||||
|
||||
export interface Times {
|
||||
cycle: number;
|
||||
elapsed: number;
|
||||
period: number;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
export class Deferred {
|
||||
constructor(clone: Benchmark);
|
||||
|
||||
benchmark: Benchmark;
|
||||
cycles: number;
|
||||
elapsed: number;
|
||||
timeStamp: number;
|
||||
}
|
||||
|
||||
export class Event {
|
||||
constructor(type: string | Object);
|
||||
|
||||
aborted: boolean;
|
||||
cancelled: boolean;
|
||||
currentTarget: Object;
|
||||
result: any;
|
||||
target: Object;
|
||||
timeStamp: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export class Suite {
|
||||
static options: { name: string };
|
||||
|
||||
constructor(name?: string, options?: Options);
|
||||
|
||||
aborted: boolean;
|
||||
length: number;
|
||||
running: boolean;
|
||||
abort(): Suite;
|
||||
add(name: string, fn: Function | string, options?: Options): Suite;
|
||||
add(fn: Function | string, options?: Options): Suite;
|
||||
add(name: string, options?: Options): Suite;
|
||||
add(options: Options): Suite;
|
||||
clone(options: Options): Suite;
|
||||
emit(type: string | Object): any;
|
||||
filter(callback: Function | string): Suite;
|
||||
forEach(callback: Function): Suite;
|
||||
indexOf(value: any): number;
|
||||
invoke(name: string, ...args: any[]): any[];
|
||||
join(separator?: string): string;
|
||||
listeners(type: string): Function[];
|
||||
map(callback: Function): any[];
|
||||
off(type?: string, callback?: Function): Benchmark;
|
||||
off(types: string[]): Benchmark;
|
||||
on(type?: string, callback?: Function): Benchmark;
|
||||
on(types: string[]): Benchmark;
|
||||
pluck(property: string): any[];
|
||||
pop(): Function;
|
||||
push(benchmark: Benchmark): number;
|
||||
reduce<T>(callback: Function, accumulator: T): T;
|
||||
reset(): Suite;
|
||||
reverse(): any[];
|
||||
run(options?: Options): Suite;
|
||||
shift(): Benchmark;
|
||||
slice(start: number, end: number): any[];
|
||||
slice(start: number, deleteCount: number, ...values: any[]): any[];
|
||||
unshift(benchmark: Benchmark): number;
|
||||
}
|
||||
}
|
||||
|
||||
export = Benchmark;
|
||||
|
||||
14
bitwise-xor/bitwise-xor.d.ts
vendored
14
bitwise-xor/bitwise-xor.d.ts
vendored
@ -4,14 +4,12 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "bitwise-xor" {
|
||||
|
||||
/**
|
||||
* Bitwise XOR between two Buffers or Strings, returns a Buffer
|
||||
*/
|
||||
function xor(b1: Buffer, b2: Buffer): Buffer;
|
||||
function xor(s1: string, s2: string): Buffer;
|
||||
|
||||
export = xor;
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
|
||||
export = xor;
|
||||
|
||||
55
bl/bl.d.ts
vendored
55
bl/bl.d.ts
vendored
@ -5,36 +5,35 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'bl' {
|
||||
import stream = require('stream');
|
||||
|
||||
class BufferList extends stream.Duplex {
|
||||
new (callback?:(err:Error, buffer:Buffer) => void): void;
|
||||
import stream = require('stream');
|
||||
|
||||
append(buffer: Buffer):void;
|
||||
get(index: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
copy(dest: Buffer, destStart?: number, srcStart?: number, srcEnd?: number): void;
|
||||
duplicate(): BufferList;
|
||||
consume(bytes?: number): void;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
length: number;
|
||||
declare class BufferList extends stream.Duplex {
|
||||
new(callback?: (err: Error, buffer: Buffer) => void): void;
|
||||
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readInt8(offset: number, noAssert?: boolean): number;
|
||||
readUInt8(offset: number, noAssert?: boolean): number;
|
||||
}
|
||||
append(buffer: Buffer): void;
|
||||
get(index: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
copy(dest: Buffer, destStart?: number, srcStart?: number, srcEnd?: number): void;
|
||||
duplicate(): BufferList;
|
||||
consume(bytes?: number): void;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
length: number;
|
||||
|
||||
export = BufferList;
|
||||
readDoubleBE(offset: number, noAssert?: boolean): number;
|
||||
readDoubleLE(offset: number, noAssert?: boolean): number;
|
||||
readFloatBE(offset: number, noAssert?: boolean): number;
|
||||
readFloatLE(offset: number, noAssert?: boolean): number;
|
||||
readInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt32LE(offset: number, noAssert?: boolean): number;
|
||||
readInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readInt8(offset: number, noAssert?: boolean): number;
|
||||
readUInt8(offset: number, noAssert?: boolean): number;
|
||||
}
|
||||
|
||||
export = BufferList;
|
||||
|
||||
7
blue-tape/blue-tape.d.ts
vendored
7
blue-tape/blue-tape.d.ts
vendored
@ -6,7 +6,6 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../tape/tape.d.ts" />
|
||||
|
||||
declare module 'blue-tape' {
|
||||
import tape = require('tape');
|
||||
export = tape;
|
||||
}
|
||||
|
||||
import tape = require('tape');
|
||||
export = tape;
|
||||
|
||||
25
bluebird-retry/bluebird-retry.d.ts
vendored
25
bluebird-retry/bluebird-retry.d.ts
vendored
@ -4,21 +4,20 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
declare module "bluebird-retry" {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
function retry<T>(func:(param:T)=>void, options?:retry.Options):Promise<T>;
|
||||
import Promise = require('bluebird');
|
||||
|
||||
namespace retry {
|
||||
export interface Options {
|
||||
interval?:number;
|
||||
backoff?:number;
|
||||
max_interval?:number;
|
||||
timeout?:number;
|
||||
max_tries?:number;
|
||||
}
|
||||
declare function retry<T>(func: (param: T) => void, options?: retry.Options): Promise<T>;
|
||||
|
||||
}
|
||||
declare namespace retry {
|
||||
export interface Options {
|
||||
interval?: number;
|
||||
backoff?: number;
|
||||
max_interval?: number;
|
||||
timeout?: number;
|
||||
max_tries?: number;
|
||||
}
|
||||
|
||||
export = retry;
|
||||
}
|
||||
|
||||
export = retry;
|
||||
|
||||
5
blueimp-md5/blueimp-md5.d.ts
vendored
5
blueimp-md5/blueimp-md5.d.ts
vendored
@ -2,6 +2,5 @@
|
||||
// Project: https://github.com/blueimp/JavaScript-MD5
|
||||
// Definitions by: Ray Martone <https://github.com/rmartone>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module 'blueimp-md5' {
|
||||
export function md5(value: string, key?: string, raw?: boolean): string;
|
||||
}
|
||||
|
||||
declare export function md5(value: string, key?: string, raw?: boolean): string;
|
||||
|
||||
203
body-parser/body-parser.d.ts
vendored
203
body-parser/body-parser.d.ts
vendored
@ -5,15 +5,43 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "body-parser" {
|
||||
import * as express from "express";
|
||||
|
||||
import * as express from "express";
|
||||
|
||||
/**
|
||||
* bodyParser: use individual json/urlencoded middlewares
|
||||
* @deprecated
|
||||
*/
|
||||
|
||||
declare function bodyParser(options?: {
|
||||
/**
|
||||
* bodyParser: use individual json/urlencoded middlewares
|
||||
* @deprecated
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
|
||||
function bodyParser(options?: {
|
||||
declare namespace bodyParser {
|
||||
export function json(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
@ -22,6 +50,10 @@ declare module "body-parser" {
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'json')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
@ -34,105 +66,72 @@ declare module "body-parser" {
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
/**
|
||||
* parse extended syntax with the qs module. (default: true)
|
||||
*/
|
||||
extended?: boolean;
|
||||
}): express.RequestHandler;
|
||||
|
||||
namespace bodyParser {
|
||||
export function json(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'json')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* only parse objects and arrays. (default: true)
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* passed to JSON.parse().
|
||||
*/
|
||||
receiver?: (key: string, value: any) => any;
|
||||
}): express.RequestHandler;
|
||||
export function raw(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'application/octet-stream')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function raw(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'application/octet-stream')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
}): express.RequestHandler;
|
||||
export function text(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'text/plain')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
|
||||
*/
|
||||
defaultCharset?: string;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function text(options?: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'text/plain')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* the default charset to parse as, if not specified in content-type. (default: 'utf-8')
|
||||
*/
|
||||
defaultCharset?: string;
|
||||
}): express.RequestHandler;
|
||||
|
||||
export function urlencoded(options: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'urlencoded')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* parse extended syntax with the qs module.
|
||||
*/
|
||||
extended: boolean;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export = bodyParser;
|
||||
export function urlencoded(options: {
|
||||
/**
|
||||
* if deflated bodies will be inflated. (default: true)
|
||||
*/
|
||||
inflate?: boolean;
|
||||
/**
|
||||
* maximum request body size. (default: '100kb')
|
||||
*/
|
||||
limit?: any;
|
||||
/**
|
||||
* request content-type to parse, passed directly to the type-is library. (default: 'urlencoded')
|
||||
*/
|
||||
type?: any;
|
||||
/**
|
||||
* function to verify body content, the parsing can be aborted by throwing an error.
|
||||
*/
|
||||
verify?: (req: express.Request, res: express.Response, buf: Buffer, encoding: string) => void;
|
||||
/**
|
||||
* parse extended syntax with the qs module.
|
||||
*/
|
||||
extended: boolean;
|
||||
}): express.RequestHandler;
|
||||
}
|
||||
|
||||
export = bodyParser;
|
||||
|
||||
601
bookshelf/bookshelf.d.ts
vendored
601
bookshelf/bookshelf.d.ts
vendored
@ -7,308 +7,307 @@
|
||||
/// <reference path='../lodash/lodash-3.10.d.ts' />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
|
||||
declare module 'bookshelf' {
|
||||
import knex = require('knex');
|
||||
import Promise = require('bluebird');
|
||||
import Lodash = require('lodash');
|
||||
|
||||
interface Bookshelf extends Bookshelf.Events<any> {
|
||||
VERSION : string;
|
||||
knex : knex;
|
||||
Model : typeof Bookshelf.Model;
|
||||
Collection : typeof Bookshelf.Collection;
|
||||
import knex = require('knex');
|
||||
import Promise = require('bluebird');
|
||||
import Lodash = require('lodash');
|
||||
|
||||
plugin(name: string) : Bookshelf;
|
||||
transaction<T>(callback : (transaction : knex.Transaction) => T) : Promise<T>;
|
||||
}
|
||||
interface Bookshelf extends Bookshelf.Events<any> {
|
||||
VERSION: string;
|
||||
knex: knex;
|
||||
Model: typeof Bookshelf.Model;
|
||||
Collection: typeof Bookshelf.Collection;
|
||||
|
||||
function Bookshelf(knex : knex) : Bookshelf;
|
||||
|
||||
namespace Bookshelf {
|
||||
abstract class Events<T> {
|
||||
on(event? : string, callback? : EventFunction<T>, context? : any) : void;
|
||||
off(event? : string) : void;
|
||||
trigger(event? : string, ...args : any[]) : void;
|
||||
triggerThen(name : string, ...args : any[]) : Promise<any>;
|
||||
once(event : string, callback : EventFunction<T>, context? : any) : void;
|
||||
}
|
||||
|
||||
interface IModelBase {
|
||||
/** Should be declared as a getter instead of a plain property. */
|
||||
hasTimestamps? : boolean|string[];
|
||||
/** Should be declared as a getter instead of a plain property. Should be required, but cannot have abstract properties yet. */
|
||||
tableName? : string;
|
||||
}
|
||||
|
||||
abstract class ModelBase<T extends Model<any>> extends Events<T|Collection<T>> implements IModelBase {
|
||||
/** If overriding, must use a getter instead of a plain property. */
|
||||
idAttribute : string;
|
||||
|
||||
constructor(attributes? : any, options? : ModelOptions);
|
||||
|
||||
clear() : T;
|
||||
clone() : T;
|
||||
escape(attribute : string) : string;
|
||||
format(attributes : any) : any;
|
||||
get(attribute : string) : any;
|
||||
has(attribute : string) : boolean;
|
||||
hasChanged(attribute? : string) : boolean;
|
||||
isNew() : boolean;
|
||||
parse(response : any) : any;
|
||||
previousAttributes() : any;
|
||||
previous(attribute : string) : any;
|
||||
related<R extends Model<any>>(relation : string) : R | Collection<R>;
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
set(attribute?: {[key : string] : any}, options? : SetOptions) : T;
|
||||
set(attribute : string, value? : any, options? : SetOptions) : T;
|
||||
timestamp(options? : TimestampOptions) : any;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
unset(attribute : string) : T;
|
||||
|
||||
// lodash methods
|
||||
invert<R extends {}>() : R;
|
||||
keys() : string[];
|
||||
omit<R extends {}>(predicate? : Lodash.ObjectIterator<any, boolean>, thisArg? : any) : R;
|
||||
omit<R extends {}>(...attributes : string[]) : R;
|
||||
pairs() : any[][];
|
||||
pick<R extends {}>(predicate? : Lodash.ObjectIterator<any, boolean>, thisArg? : any) : R;
|
||||
pick<R extends {}>(...attributes : string[]) : R;
|
||||
values() : any[];
|
||||
}
|
||||
|
||||
class Model<T extends Model<any>> extends ModelBase<T> {
|
||||
static collection<T extends Model<any>>(models? : T[], options? : CollectionOptions<T>) : Collection<T>;
|
||||
static count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T extends Model<any>>(prototypeProperties? : any, classProperties? : any) : Function; // should return a type
|
||||
static fetchAll<T extends Model<any>>() : Promise<Collection<T>>;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
belongsTo<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
belongsToMany<R extends Model<any>>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection<R>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
destroy(options? : SyncOptions) : Promise<T>;
|
||||
fetch(options? : FetchOptions) : Promise<T>;
|
||||
fetchAll(options? : FetchAllOptions) : Promise<Collection<T>>;
|
||||
hasMany<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : Collection<R>;
|
||||
hasOne<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
load(relations : string|string[], options? : LoadOptions) : Promise<T>;
|
||||
morphMany<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : Collection<R>;
|
||||
morphOne<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : R;
|
||||
morphTo(name : string, columnNames? : string[], ...target : typeof Model[]) : T;
|
||||
morphTo(name : string, ...target : typeof Model[]) : T;
|
||||
query(...query : string[]) : T;
|
||||
query(query : {[key : string] : any}) : T;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : T;
|
||||
query() : knex.QueryBuilder;
|
||||
refresh(options? : FetchOptions) : Promise<T>;
|
||||
resetQuery() : T;
|
||||
save(key? : string, val? : string, options? : SaveOptions) : Promise<T>;
|
||||
save(attrs? : {[key : string] : any}, options? : SaveOptions) : Promise<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
where(properties : {[key : string] : any}) : T;
|
||||
where(key : string, operatorOrValue : string|number|boolean, valueIfOperator? : string|number|boolean) : T;
|
||||
}
|
||||
|
||||
abstract class CollectionBase<T extends Model<any>> extends Events<T> {
|
||||
add(models : T[]|{[key : string] : any}[], options? : CollectionAddOptions) : Collection<T>;
|
||||
at(index : number) : T;
|
||||
clone() : Collection<T>;
|
||||
fetch(options? : CollectionFetchOptions) : Promise<Collection<T>>;
|
||||
findWhere(match : {[key : string] : any}) : T;
|
||||
get(id : any) : T;
|
||||
invokeThen(name : string, ...args : any[]) : Promise<any>;
|
||||
parse(response : any) : any;
|
||||
pluck(attribute : string) : any[];
|
||||
pop() : void;
|
||||
push(model : any) : Collection<T>;
|
||||
reduceThen<R>(iterator : (prev : R, cur : T, idx : number, array : T[]) => R, initialValue : R, context : any) : Promise<R>;
|
||||
remove(model : T, options? : EventOptions) : T;
|
||||
remove(model : T[], options? : EventOptions) : T[];
|
||||
reset(model : any[], options? : CollectionAddOptions) : T[];
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
set(models : T[]|{[key : string] : any}[], options? : CollectionSetOptions) : Collection<T>;
|
||||
shift(options? : EventOptions) : void;
|
||||
slice(begin? : number, end? : number) : void;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
unshift(model : any, options? : CollectionAddOptions) : void;
|
||||
where(match : {[key : string] : any}, firstOnly : boolean) : T|Collection<T>;
|
||||
|
||||
// lodash methods
|
||||
all(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
all<R extends {}>(predicate? : R) : boolean;
|
||||
any(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
any<R extends {}>(predicate? : R) : boolean;
|
||||
chain() : Lodash.LoDashExplicitObjectWrapper<T>;
|
||||
collect(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
collect<R extends {}>(predicate? : R) : T[];
|
||||
contains(value : any, fromIndex? : number) : boolean;
|
||||
countBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : Lodash.Dictionary<number>;
|
||||
countBy<R extends {}>(predicate? : R) : Lodash.Dictionary<number>;
|
||||
detect(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
detect<R extends {}>(predicate? : R) : T;
|
||||
difference(...values : T[]) : T[];
|
||||
drop(n? : number) : T[];
|
||||
each(callback? : Lodash.ListIterator<T, void>, thisArg? : any) : Lodash.List<T>;
|
||||
each(callback? : Lodash.DictionaryIterator<T, void>, thisArg? : any) : Lodash.Dictionary<T>;
|
||||
each(callback? : Lodash.ObjectIterator<T, void>, thisArg? : any) : T;
|
||||
every(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
every<R extends {}>(predicate? : R) : boolean;
|
||||
filter(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
filter<R extends {}>(predicate? : R) : T[];
|
||||
find(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
find<R extends {}>(predicate? : R) : T;
|
||||
first() : T;
|
||||
foldl<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
foldr<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
forEach(callback? : Lodash.ListIterator<T, void>, thisArg? : any) : Lodash.List<T>;
|
||||
forEach(callback? : Lodash.DictionaryIterator<T, void>, thisArg? : any) : Lodash.Dictionary<T>;
|
||||
forEach(callback? : Lodash.ObjectIterator<T, void>, thisArg? : any) : T;
|
||||
groupBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : Lodash.Dictionary<T[]>;
|
||||
groupBy<R extends {}>(predicate? : R) : Lodash.Dictionary<T[]>;
|
||||
head() : T;
|
||||
include(value : any, fromIndex? : number) : boolean;
|
||||
indexOf(value : any, fromIndex? : number) : number;
|
||||
initial() : T[];
|
||||
inject<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
invoke(methodName : string|Function, ...args : any[]) : any;
|
||||
isEmpty() : boolean;
|
||||
keys() : string[];
|
||||
last() : T;
|
||||
lastIndexOf(value : any, fromIndex? : number) : number;
|
||||
map(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
map<R extends {}>(predicate? : R) : T[];
|
||||
max(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
max<R extends {}>(predicate? : R) : T;
|
||||
min(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
min<R extends {}>(predicate? : R) : T;
|
||||
reduce<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
reduceRight<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
reject(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
reject<R extends {}>(predicate? : R) : T[];
|
||||
rest() : T[];
|
||||
select(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
select<R extends {}>(predicate? : R) : T[];
|
||||
shuffle() : T[];
|
||||
size() : number;
|
||||
some(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
some<R extends {}>(predicate? : R) : boolean;
|
||||
sortBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
sortBy<R extends {}>(predicate? : R) : T[];
|
||||
tail() : T[];
|
||||
take(n? : number) : T[];
|
||||
toArray() : T[];
|
||||
without(...values : any[]) : T[];
|
||||
}
|
||||
|
||||
class Collection<T extends Model<any>> extends CollectionBase<T> {
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T>(prototypeProperties? : any, classProperties? : any) : Function;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
attach(ids : any[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
create(model : {[key : string] : any}, options? : CollectionCreateOptions) : Promise<T>;
|
||||
detach(ids : any[], options? : SyncOptions) : Promise<any>;
|
||||
fetchOne(options? : CollectionFetchOneOptions) : Promise<T>;
|
||||
load(relations : string|string[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
query(...query : string[]) : Collection<T>;
|
||||
query(query : {[key : string] : any}) : Collection<T>;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : Collection<T>;
|
||||
query() : knex.QueryBuilder;
|
||||
resetQuery() : Collection<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
updatePivot(attributes : any, options? : PivotOptions) : Promise<number>;
|
||||
withPivot(columns : string[]) : Collection<T>;
|
||||
}
|
||||
|
||||
interface ModelOptions {
|
||||
tableName? : string;
|
||||
hasTimestamps? : boolean;
|
||||
parse? : boolean;
|
||||
}
|
||||
|
||||
interface LoadOptions extends SyncOptions {
|
||||
withRelated: string|any|any[];
|
||||
}
|
||||
|
||||
interface FetchOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
withRelated? : string|any|any[];
|
||||
}
|
||||
|
||||
interface FetchAllOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SaveOptions extends SyncOptions {
|
||||
method? : string;
|
||||
defaults? : string;
|
||||
patch? : boolean;
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SerializeOptions {
|
||||
shallow? : boolean;
|
||||
omitPivot? : boolean;
|
||||
}
|
||||
|
||||
interface SetOptions {
|
||||
unset? : boolean;
|
||||
}
|
||||
|
||||
interface TimestampOptions {
|
||||
method? : string;
|
||||
}
|
||||
|
||||
interface SyncOptions {
|
||||
transacting? : knex.Transaction;
|
||||
debug? : boolean;
|
||||
}
|
||||
|
||||
interface CollectionOptions<T> {
|
||||
comparator? : boolean|string|((a : T, b : T) => number);
|
||||
}
|
||||
|
||||
interface CollectionAddOptions extends EventOptions {
|
||||
at? : number;
|
||||
merge? : boolean;
|
||||
}
|
||||
|
||||
interface CollectionFetchOptions {
|
||||
require? : boolean;
|
||||
withRelated? : string|string[];
|
||||
}
|
||||
|
||||
interface CollectionFetchOneOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
}
|
||||
|
||||
interface CollectionSetOptions extends EventOptions {
|
||||
add? : boolean;
|
||||
remove? : boolean;
|
||||
merge?: boolean;
|
||||
}
|
||||
|
||||
interface PivotOptions {
|
||||
query? : Function|any;
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface EventOptions {
|
||||
silent? : boolean;
|
||||
}
|
||||
|
||||
interface EventFunction<T> {
|
||||
(model: T, attrs: any, options: any) : Promise<any>|void;
|
||||
}
|
||||
|
||||
interface CollectionCreateOptions extends ModelOptions, SyncOptions, CollectionAddOptions, SaveOptions {}
|
||||
}
|
||||
|
||||
export = Bookshelf;
|
||||
plugin(name: string): Bookshelf;
|
||||
transaction<T>(callback: (transaction: knex.Transaction) => T): Promise<T>;
|
||||
}
|
||||
|
||||
declare function Bookshelf(knex: knex): Bookshelf;
|
||||
|
||||
declare namespace Bookshelf {
|
||||
abstract class Events<T> {
|
||||
on(event?: string, callback?: EventFunction<T>, context?: any): void;
|
||||
off(event?: string): void;
|
||||
trigger(event?: string, ...args: any[]): void;
|
||||
triggerThen(name: string, ...args: any[]): Promise<any>;
|
||||
once(event: string, callback: EventFunction<T>, context?: any): void;
|
||||
}
|
||||
|
||||
interface IModelBase {
|
||||
/** Should be declared as a getter instead of a plain property. */
|
||||
hasTimestamps?: boolean | string[];
|
||||
/** Should be declared as a getter instead of a plain property. Should be required, but cannot have abstract properties yet. */
|
||||
tableName?: string;
|
||||
}
|
||||
|
||||
abstract class ModelBase<T extends Model<any>> extends Events<T | Collection<T>> implements IModelBase {
|
||||
/** If overriding, must use a getter instead of a plain property. */
|
||||
idAttribute: string;
|
||||
|
||||
constructor(attributes?: any, options?: ModelOptions);
|
||||
|
||||
clear(): T;
|
||||
clone(): T;
|
||||
escape(attribute: string): string;
|
||||
format(attributes: any): any;
|
||||
get(attribute: string): any;
|
||||
has(attribute: string): boolean;
|
||||
hasChanged(attribute?: string): boolean;
|
||||
isNew(): boolean;
|
||||
parse(response: any): any;
|
||||
previousAttributes(): any;
|
||||
previous(attribute: string): any;
|
||||
related<R extends Model<any>>(relation: string): R | Collection<R>;
|
||||
serialize(options?: SerializeOptions): any;
|
||||
set(attribute?: { [key: string]: any }, options?: SetOptions): T;
|
||||
set(attribute: string, value?: any, options?: SetOptions): T;
|
||||
timestamp(options?: TimestampOptions): any;
|
||||
toJSON(options?: SerializeOptions): any;
|
||||
unset(attribute: string): T;
|
||||
|
||||
// lodash methods
|
||||
invert<R extends {}>(): R;
|
||||
keys(): string[];
|
||||
omit<R extends {}>(predicate?: Lodash.ObjectIterator<any, boolean>, thisArg?: any): R;
|
||||
omit<R extends {}>(...attributes: string[]): R;
|
||||
pairs(): any[][];
|
||||
pick<R extends {}>(predicate?: Lodash.ObjectIterator<any, boolean>, thisArg?: any): R;
|
||||
pick<R extends {}>(...attributes: string[]): R;
|
||||
values(): any[];
|
||||
}
|
||||
|
||||
class Model<T extends Model<any>> extends ModelBase<T> {
|
||||
static collection<T extends Model<any>>(models?: T[], options?: CollectionOptions<T>): Collection<T>;
|
||||
static count(column?: string, options?: SyncOptions): Promise<number>;
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T extends Model<any>>(prototypeProperties?: any, classProperties?: any): Function; // should return a type
|
||||
static fetchAll<T extends Model<any>>(): Promise<Collection<T>>;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes?: any, options?: ModelOptions): T;
|
||||
|
||||
belongsTo<R extends Model<any>>(target: { new (...args: any[]): R }, foreignKey?: string): R;
|
||||
belongsToMany<R extends Model<any>>(target: { new (...args: any[]): R }, table?: string, foreignKey?: string, otherKey?: string): Collection<R>;
|
||||
count(column?: string, options?: SyncOptions): Promise<number>;
|
||||
destroy(options?: SyncOptions): Promise<T>;
|
||||
fetch(options?: FetchOptions): Promise<T>;
|
||||
fetchAll(options?: FetchAllOptions): Promise<Collection<T>>;
|
||||
hasMany<R extends Model<any>>(target: { new (...args: any[]): R }, foreignKey?: string): Collection<R>;
|
||||
hasOne<R extends Model<any>>(target: { new (...args: any[]): R }, foreignKey?: string): R;
|
||||
load(relations: string | string[], options?: LoadOptions): Promise<T>;
|
||||
morphMany<R extends Model<any>>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): Collection<R>;
|
||||
morphOne<R extends Model<any>>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): R;
|
||||
morphTo(name: string, columnNames?: string[], ...target: typeof Model[]): T;
|
||||
morphTo(name: string, ...target: typeof Model[]): T;
|
||||
query(...query: string[]): T;
|
||||
query(query: { [key: string]: any }): T;
|
||||
query(callback: (qb: knex.QueryBuilder) => void): T;
|
||||
query(): knex.QueryBuilder;
|
||||
refresh(options?: FetchOptions): Promise<T>;
|
||||
resetQuery(): T;
|
||||
save(key?: string, val?: string, options?: SaveOptions): Promise<T>;
|
||||
save(attrs?: { [key: string]: any }, options?: SaveOptions): Promise<T>;
|
||||
through<R extends Model<any>>(interim: typeof Model, throughForeignKey?: string, otherKey?: string): R | Collection<R>;
|
||||
where(properties: { [key: string]: any }): T;
|
||||
where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T;
|
||||
}
|
||||
|
||||
abstract class CollectionBase<T extends Model<any>> extends Events<T> {
|
||||
add(models: T[] | { [key: string]: any }[], options?: CollectionAddOptions): Collection<T>;
|
||||
at(index: number): T;
|
||||
clone(): Collection<T>;
|
||||
fetch(options?: CollectionFetchOptions): Promise<Collection<T>>;
|
||||
findWhere(match: { [key: string]: any }): T;
|
||||
get(id: any): T;
|
||||
invokeThen(name: string, ...args: any[]): Promise<any>;
|
||||
parse(response: any): any;
|
||||
pluck(attribute: string): any[];
|
||||
pop(): void;
|
||||
push(model: any): Collection<T>;
|
||||
reduceThen<R>(iterator: (prev: R, cur: T, idx: number, array: T[]) => R, initialValue: R, context: any): Promise<R>;
|
||||
remove(model: T, options?: EventOptions): T;
|
||||
remove(model: T[], options?: EventOptions): T[];
|
||||
reset(model: any[], options?: CollectionAddOptions): T[];
|
||||
serialize(options?: SerializeOptions): any;
|
||||
set(models: T[] | { [key: string]: any }[], options?: CollectionSetOptions): Collection<T>;
|
||||
shift(options?: EventOptions): void;
|
||||
slice(begin?: number, end?: number): void;
|
||||
toJSON(options?: SerializeOptions): any;
|
||||
unshift(model: any, options?: CollectionAddOptions): void;
|
||||
where(match: { [key: string]: any }, firstOnly: boolean): T | Collection<T>;
|
||||
|
||||
// lodash methods
|
||||
all(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): boolean;
|
||||
all<R extends {}>(predicate?: R): boolean;
|
||||
any(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): boolean;
|
||||
any<R extends {}>(predicate?: R): boolean;
|
||||
chain(): Lodash.LoDashExplicitObjectWrapper<T>;
|
||||
collect(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T[];
|
||||
collect<R extends {}>(predicate?: R): T[];
|
||||
contains(value: any, fromIndex?: number): boolean;
|
||||
countBy(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): Lodash.Dictionary<number>;
|
||||
countBy<R extends {}>(predicate?: R): Lodash.Dictionary<number>;
|
||||
detect(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T;
|
||||
detect<R extends {}>(predicate?: R): T;
|
||||
difference(...values: T[]): T[];
|
||||
drop(n?: number): T[];
|
||||
each(callback?: Lodash.ListIterator<T, void>, thisArg?: any): Lodash.List<T>;
|
||||
each(callback?: Lodash.DictionaryIterator<T, void>, thisArg?: any): Lodash.Dictionary<T>;
|
||||
each(callback?: Lodash.ObjectIterator<T, void>, thisArg?: any): T;
|
||||
every(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): boolean;
|
||||
every<R extends {}>(predicate?: R): boolean;
|
||||
filter(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T[];
|
||||
filter<R extends {}>(predicate?: R): T[];
|
||||
find(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T;
|
||||
find<R extends {}>(predicate?: R): T;
|
||||
first(): T;
|
||||
foldl<R>(callback?: Lodash.MemoIterator<T, R>, accumulator?: R, thisArg?: any): R;
|
||||
foldr<R>(callback?: Lodash.MemoIterator<T, R>, accumulator?: R, thisArg?: any): R;
|
||||
forEach(callback?: Lodash.ListIterator<T, void>, thisArg?: any): Lodash.List<T>;
|
||||
forEach(callback?: Lodash.DictionaryIterator<T, void>, thisArg?: any): Lodash.Dictionary<T>;
|
||||
forEach(callback?: Lodash.ObjectIterator<T, void>, thisArg?: any): T;
|
||||
groupBy(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): Lodash.Dictionary<T[]>;
|
||||
groupBy<R extends {}>(predicate?: R): Lodash.Dictionary<T[]>;
|
||||
head(): T;
|
||||
include(value: any, fromIndex?: number): boolean;
|
||||
indexOf(value: any, fromIndex?: number): number;
|
||||
initial(): T[];
|
||||
inject<R>(callback?: Lodash.MemoIterator<T, R>, accumulator?: R, thisArg?: any): R;
|
||||
invoke(methodName: string | Function, ...args: any[]): any;
|
||||
isEmpty(): boolean;
|
||||
keys(): string[];
|
||||
last(): T;
|
||||
lastIndexOf(value: any, fromIndex?: number): number;
|
||||
map(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T[];
|
||||
map<R extends {}>(predicate?: R): T[];
|
||||
max(predicate?: Lodash.ListIterator<T, boolean> | string, thisArg?: any): T;
|
||||
max<R extends {}>(predicate?: R): T;
|
||||
min(predicate?: Lodash.ListIterator<T, boolean> | string, thisArg?: any): T;
|
||||
min<R extends {}>(predicate?: R): T;
|
||||
reduce<R>(callback?: Lodash.MemoIterator<T, R>, accumulator?: R, thisArg?: any): R;
|
||||
reduceRight<R>(callback?: Lodash.MemoIterator<T, R>, accumulator?: R, thisArg?: any): R;
|
||||
reject(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T[];
|
||||
reject<R extends {}>(predicate?: R): T[];
|
||||
rest(): T[];
|
||||
select(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T[];
|
||||
select<R extends {}>(predicate?: R): T[];
|
||||
shuffle(): T[];
|
||||
size(): number;
|
||||
some(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): boolean;
|
||||
some<R extends {}>(predicate?: R): boolean;
|
||||
sortBy(predicate?: Lodash.ListIterator<T, boolean> | Lodash.DictionaryIterator<T, boolean> | string, thisArg?: any): T[];
|
||||
sortBy<R extends {}>(predicate?: R): T[];
|
||||
tail(): T[];
|
||||
take(n?: number): T[];
|
||||
toArray(): T[];
|
||||
without(...values: any[]): T[];
|
||||
}
|
||||
|
||||
class Collection<T extends Model<any>> extends CollectionBase<T> {
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T>(prototypeProperties?: any, classProperties?: any): Function;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes?: any, options?: ModelOptions): T;
|
||||
|
||||
attach(ids: any[], options?: SyncOptions): Promise<Collection<T>>;
|
||||
count(column?: string, options?: SyncOptions): Promise<number>;
|
||||
create(model: { [key: string]: any }, options?: CollectionCreateOptions): Promise<T>;
|
||||
detach(ids: any[], options?: SyncOptions): Promise<any>;
|
||||
fetchOne(options?: CollectionFetchOneOptions): Promise<T>;
|
||||
load(relations: string | string[], options?: SyncOptions): Promise<Collection<T>>;
|
||||
query(...query: string[]): Collection<T>;
|
||||
query(query: { [key: string]: any }): Collection<T>;
|
||||
query(callback: (qb: knex.QueryBuilder) => void): Collection<T>;
|
||||
query(): knex.QueryBuilder;
|
||||
resetQuery(): Collection<T>;
|
||||
through<R extends Model<any>>(interim: typeof Model, throughForeignKey?: string, otherKey?: string): R | Collection<R>;
|
||||
updatePivot(attributes: any, options?: PivotOptions): Promise<number>;
|
||||
withPivot(columns: string[]): Collection<T>;
|
||||
}
|
||||
|
||||
interface ModelOptions {
|
||||
tableName?: string;
|
||||
hasTimestamps?: boolean;
|
||||
parse?: boolean;
|
||||
}
|
||||
|
||||
interface LoadOptions extends SyncOptions {
|
||||
withRelated: string | any | any[];
|
||||
}
|
||||
|
||||
interface FetchOptions extends SyncOptions {
|
||||
require?: boolean;
|
||||
columns?: string | string[];
|
||||
withRelated?: string | any | any[];
|
||||
}
|
||||
|
||||
interface FetchAllOptions extends SyncOptions {
|
||||
require?: boolean;
|
||||
}
|
||||
|
||||
interface SaveOptions extends SyncOptions {
|
||||
method?: string;
|
||||
defaults?: string;
|
||||
patch?: boolean;
|
||||
require?: boolean;
|
||||
}
|
||||
|
||||
interface SerializeOptions {
|
||||
shallow?: boolean;
|
||||
omitPivot?: boolean;
|
||||
}
|
||||
|
||||
interface SetOptions {
|
||||
unset?: boolean;
|
||||
}
|
||||
|
||||
interface TimestampOptions {
|
||||
method?: string;
|
||||
}
|
||||
|
||||
interface SyncOptions {
|
||||
transacting?: knex.Transaction;
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
interface CollectionOptions<T> {
|
||||
comparator?: boolean | string | ((a: T, b: T) => number);
|
||||
}
|
||||
|
||||
interface CollectionAddOptions extends EventOptions {
|
||||
at?: number;
|
||||
merge?: boolean;
|
||||
}
|
||||
|
||||
interface CollectionFetchOptions {
|
||||
require?: boolean;
|
||||
withRelated?: string | string[];
|
||||
}
|
||||
|
||||
interface CollectionFetchOneOptions {
|
||||
require?: boolean;
|
||||
columns?: string | string[];
|
||||
}
|
||||
|
||||
interface CollectionSetOptions extends EventOptions {
|
||||
add?: boolean;
|
||||
remove?: boolean;
|
||||
merge?: boolean;
|
||||
}
|
||||
|
||||
interface PivotOptions {
|
||||
query?: Function | any;
|
||||
require?: boolean;
|
||||
}
|
||||
|
||||
interface EventOptions {
|
||||
silent?: boolean;
|
||||
}
|
||||
|
||||
interface EventFunction<T> {
|
||||
(model: T, attrs: any, options: any): Promise<any> | void;
|
||||
}
|
||||
|
||||
interface CollectionCreateOptions extends ModelOptions, SyncOptions, CollectionAddOptions, SaveOptions { }
|
||||
}
|
||||
|
||||
export = Bookshelf;
|
||||
|
||||
7
boolify-string/boolify-string.d.ts
vendored
7
boolify-string/boolify-string.d.ts
vendored
@ -2,7 +2,6 @@
|
||||
// Project: https://github.com/sanemat/node-boolify-string
|
||||
// Definitions by: Tobias Henöckl <http://www.sisyphus.de/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
declare module "boolify-string" {
|
||||
function boolifyString(obj: any): boolean;
|
||||
export = boolifyString;
|
||||
}
|
||||
|
||||
declare function boolifyString(obj: any): boolean;
|
||||
export = boolifyString;
|
||||
|
||||
111
bounce.js/bounce.d.ts
vendored
111
bounce.js/bounce.d.ts
vendored
@ -5,62 +5,61 @@
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module 'bounce.js' {
|
||||
export default Bounce
|
||||
|
||||
interface Point2D {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
export default Bounce
|
||||
|
||||
interface BounceOptions<T> {
|
||||
from: T
|
||||
to: T
|
||||
duration?: number
|
||||
delay?: number
|
||||
easing?: string
|
||||
bounces?: number
|
||||
stiffness?: number
|
||||
}
|
||||
|
||||
interface AnimationOptions {
|
||||
loop?: boolean
|
||||
remove?: boolean
|
||||
onComplete?: () => void
|
||||
}
|
||||
|
||||
interface SerailizedComponent<T> {
|
||||
type: string
|
||||
from: T
|
||||
to: T
|
||||
duration: number
|
||||
delay: number
|
||||
easing: string
|
||||
bounces: number
|
||||
stiffness: number
|
||||
}
|
||||
|
||||
class Bounce {
|
||||
static FPS: number
|
||||
static counter: number
|
||||
|
||||
static isSupported(): boolean
|
||||
|
||||
constructor();
|
||||
|
||||
scale(options: BounceOptions<Point2D>): Bounce
|
||||
rotate(options: BounceOptions<number>): Bounce
|
||||
translate(options: BounceOptions<Point2D>): Bounce
|
||||
skew(options: BounceOptions<Point2D>): Bounce
|
||||
|
||||
serialize(): SerailizedComponent<number|Point2D>[]
|
||||
deserialize(serailized: SerailizedComponent<number|Point2D>[]): Bounce
|
||||
|
||||
applyTo(element: Element, options?: AnimationOptions): void
|
||||
applyTo(elements: Element[], options?: AnimationOptions): void
|
||||
applyTo(elements: JQuery, options?: AnimationOptions): JQueryPromise<void>
|
||||
|
||||
define(name: string): Bounce
|
||||
remove(): void
|
||||
}
|
||||
interface Point2D {
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
|
||||
interface BounceOptions<T> {
|
||||
from: T
|
||||
to: T
|
||||
duration?: number
|
||||
delay?: number
|
||||
easing?: string
|
||||
bounces?: number
|
||||
stiffness?: number
|
||||
}
|
||||
|
||||
interface AnimationOptions {
|
||||
loop?: boolean
|
||||
remove?: boolean
|
||||
onComplete?: () => void
|
||||
}
|
||||
|
||||
interface SerailizedComponent<T> {
|
||||
type: string
|
||||
from: T
|
||||
to: T
|
||||
duration: number
|
||||
delay: number
|
||||
easing: string
|
||||
bounces: number
|
||||
stiffness: number
|
||||
}
|
||||
|
||||
declare class Bounce {
|
||||
static FPS: number
|
||||
static counter: number
|
||||
|
||||
static isSupported(): boolean
|
||||
|
||||
constructor();
|
||||
|
||||
scale(options: BounceOptions<Point2D>): Bounce
|
||||
rotate(options: BounceOptions<number>): Bounce
|
||||
translate(options: BounceOptions<Point2D>): Bounce
|
||||
skew(options: BounceOptions<Point2D>): Bounce
|
||||
|
||||
serialize(): SerailizedComponent<number | Point2D>[]
|
||||
deserialize(serailized: SerailizedComponent<number | Point2D>[]): Bounce
|
||||
|
||||
applyTo(element: Element, options?: AnimationOptions): void
|
||||
applyTo(elements: Element[], options?: AnimationOptions): void
|
||||
applyTo(elements: JQuery, options?: AnimationOptions): JQueryPromise<void>
|
||||
|
||||
define(name: string): Bounce
|
||||
remove(): void
|
||||
}
|
||||
|
||||
39
brorand/brorand.d.ts
vendored
39
brorand/brorand.d.ts
vendored
@ -5,26 +5,25 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "brorand" {
|
||||
type rand = {getByte: () => number};
|
||||
|
||||
interface RandStatic {
|
||||
new (rand: rand): RandInstance;
|
||||
}
|
||||
type rand = { getByte: () => number };
|
||||
|
||||
interface RandInstance {
|
||||
rand: rand;
|
||||
generate(len: number): Buffer|Uint8Array;
|
||||
}
|
||||
|
||||
interface BrorandStatic {
|
||||
(len: number): Buffer|Uint8Array;
|
||||
Rand: RandStatic;
|
||||
}
|
||||
|
||||
namespace Brorand {}
|
||||
|
||||
let Brorand: BrorandStatic;
|
||||
|
||||
export = Brorand;
|
||||
interface RandStatic {
|
||||
new (rand: rand): RandInstance;
|
||||
}
|
||||
|
||||
interface RandInstance {
|
||||
rand: rand;
|
||||
generate(len: number): Buffer | Uint8Array;
|
||||
}
|
||||
|
||||
interface BrorandStatic {
|
||||
(len: number): Buffer | Uint8Array;
|
||||
Rand: RandStatic;
|
||||
}
|
||||
|
||||
declare namespace Brorand { }
|
||||
|
||||
declare let Brorand: BrorandStatic;
|
||||
|
||||
export = Brorand;
|
||||
|
||||
243
browser-harness/browser-harness.d.ts
vendored
243
browser-harness/browser-harness.d.ts
vendored
@ -5,129 +5,128 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "browser-harness" {
|
||||
import _events = require('events');
|
||||
|
||||
interface HarnessEvents extends _events.EventEmitter {
|
||||
once(event: string, listener: (driver: Driver) => void): this;
|
||||
once(event: 'ready', listener: (driver: Driver) => void): this;
|
||||
import _events = require('events');
|
||||
|
||||
on(event: string, listener: (driver: Driver) => void): this;
|
||||
on(event: 'ready', listener: (driver: Driver) => void): this;
|
||||
}
|
||||
interface HarnessEvents extends _events.EventEmitter {
|
||||
once(event: string, listener: (driver: Driver) => void): this;
|
||||
once(event: 'ready', listener: (driver: Driver) => void): this;
|
||||
|
||||
interface DriverEvents extends _events.EventEmitter {
|
||||
once(event: string, listener: (text: string) => void): this;
|
||||
once(event: 'console.log', listener: (text: string) => void): this;
|
||||
once(event: 'console.warn', listener: (text: string) => void): this;
|
||||
once(event: 'console.error', listener: (text: string) => void): this;
|
||||
once(event: 'window.onerror', listener: (text: string) => void): this;
|
||||
|
||||
on(event: string, listener: (text: string) => void): this;
|
||||
on(event: 'console.log', listener: (text: string) => void): this;
|
||||
on(event: 'console.warn', listener: (text: string) => void): this;
|
||||
on(event: 'console.error', listener: (text: string) => void): this;
|
||||
on(event: 'window.onerror', listener: (text: string) => void): this;
|
||||
}
|
||||
|
||||
export interface Driver {
|
||||
exec(args: { func: Function; args?: any[]}, callback?: Function) : any;
|
||||
exec(func: Function, callback?: Function) : any;
|
||||
|
||||
setUrl(url: string, callback?: Function);
|
||||
|
||||
waitFor(args: { condition: Function; exec?: Function; timeoutMS?: number }, callback?: Function);
|
||||
waitFor(condition: Function, callback?: Function);
|
||||
|
||||
findElement(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy;
|
||||
findElements(selector: string, callback?: (err: Error, elements: ElementProxy) => void): ElementProxy;
|
||||
|
||||
findVisible(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy;
|
||||
findVisibles(selector: string, callback?: (err: Error, elements: ElementProxy) => void): ElementProxy;
|
||||
find(selector: string, callback?: (err: Error, elements: ElementProxy) => void): ElementProxy;
|
||||
|
||||
events: DriverEvents;
|
||||
}
|
||||
|
||||
export interface ElementProxy {
|
||||
click(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
focus(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
blur(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
val(value?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
attr(name: string, value?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
removeAttr(name: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
prop(name: string, value?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
removeProp(name: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
html(value?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
text(value?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
hasClass(className: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
addClass(className: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
removeClass(className: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
toggleClass(className: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
|
||||
trigger(event: string, extraParameters?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
triggerHandler(event: string, extraParameters?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
|
||||
css(name: string, value?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
height(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
innerHeight(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
outerHeight(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
width(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
innerWidth(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
outerWidth(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
offset(value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
position(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
scrollLeft(value?: number, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
scrollTop(value?: number, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
|
||||
hide(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
show(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
toggle(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
|
||||
children(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
closest(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
contents(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
find(selector: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
findElements(selector: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
findElement(selector: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
findVisible(selector: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
findVisibles(selector: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
isActionable(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
first(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
has(arg: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
is(arg: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
last(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
next(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
nextAll(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
nextUntil(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
offsetParent(callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
parent(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
parents(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
parentsUntil(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
prev(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
prevAll(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
prevUntil(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
siblings(selector?: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
|
||||
|
||||
data(name: string, value?: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
removeData(name: string, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
|
||||
filter(selector: any, callback?: (err: Error, element: ElementProxy) => void) : ElementProxy
|
||||
}
|
||||
|
||||
export class Browser {
|
||||
//constructor(args: { type: string; location?: string; args?: string[] });
|
||||
constructor(args: { type: string; location?: string; args?: any; });
|
||||
|
||||
open(harnessUrl: string, serverUrl?: string);
|
||||
close();
|
||||
}
|
||||
|
||||
export function listen(port: number, callback?: Function)
|
||||
export var events: HarnessEvents;
|
||||
export var config: {
|
||||
timeoutMS: number;
|
||||
retryMS: number;
|
||||
};
|
||||
on(event: string, listener: (driver: Driver) => void): this;
|
||||
on(event: 'ready', listener: (driver: Driver) => void): this;
|
||||
}
|
||||
|
||||
interface DriverEvents extends _events.EventEmitter {
|
||||
once(event: string, listener: (text: string) => void): this;
|
||||
once(event: 'console.log', listener: (text: string) => void): this;
|
||||
once(event: 'console.warn', listener: (text: string) => void): this;
|
||||
once(event: 'console.error', listener: (text: string) => void): this;
|
||||
once(event: 'window.onerror', listener: (text: string) => void): this;
|
||||
|
||||
on(event: string, listener: (text: string) => void): this;
|
||||
on(event: 'console.log', listener: (text: string) => void): this;
|
||||
on(event: 'console.warn', listener: (text: string) => void): this;
|
||||
on(event: 'console.error', listener: (text: string) => void): this;
|
||||
on(event: 'window.onerror', listener: (text: string) => void): this;
|
||||
}
|
||||
|
||||
export interface Driver {
|
||||
exec(args: { func: Function; args?: any[] }, callback?: Function): any;
|
||||
exec(func: Function, callback?: Function): any;
|
||||
|
||||
setUrl(url: string, callback?: Function);
|
||||
|
||||
waitFor(args: { condition: Function; exec?: Function; timeoutMS?: number }, callback?: Function);
|
||||
waitFor(condition: Function, callback?: Function);
|
||||
|
||||
findElement(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy;
|
||||
findElements(selector: string, callback?: (err: Error, elements: ElementProxy) => void): ElementProxy;
|
||||
|
||||
findVisible(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy;
|
||||
findVisibles(selector: string, callback?: (err: Error, elements: ElementProxy) => void): ElementProxy;
|
||||
find(selector: string, callback?: (err: Error, elements: ElementProxy) => void): ElementProxy;
|
||||
|
||||
events: DriverEvents;
|
||||
}
|
||||
|
||||
export interface ElementProxy {
|
||||
click(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
focus(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
blur(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
val(value?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
attr(name: string, value?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
removeAttr(name: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
prop(name: string, value?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
removeProp(name: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
html(value?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
text(value?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
hasClass(className: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
addClass(className: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
removeClass(className: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
toggleClass(className: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
|
||||
trigger(event: string, extraParameters?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
triggerHandler(event: string, extraParameters?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
|
||||
css(name: string, value?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
height(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
innerHeight(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
outerHeight(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
width(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
innerWidth(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
outerWidth(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
offset(value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
position(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
scrollLeft(value?: number, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
scrollTop(value?: number, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
|
||||
hide(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
show(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
toggle(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
|
||||
children(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
closest(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
contents(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
find(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
findElements(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
findElement(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
findVisible(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
findVisibles(selector: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
isActionable(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
first(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
has(arg: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
is(arg: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
last(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
next(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
nextAll(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
nextUntil(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
offsetParent(callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
parent(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
parents(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
parentsUntil(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
prev(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
prevAll(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
prevUntil(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
siblings(selector?: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
|
||||
|
||||
data(name: string, value?: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
removeData(name: string, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
|
||||
filter(selector: any, callback?: (err: Error, element: ElementProxy) => void): ElementProxy
|
||||
}
|
||||
|
||||
declare export class Browser {
|
||||
//constructor(args: { type: string; location?: string; args?: string[] });
|
||||
constructor(args: { type: string; location?: string; args?: any; });
|
||||
|
||||
open(harnessUrl: string, serverUrl?: string);
|
||||
close();
|
||||
}
|
||||
|
||||
declare export function listen(port: number, callback?: Function)
|
||||
declare export var events: HarnessEvents;
|
||||
declare export var config: {
|
||||
timeoutMS: number;
|
||||
retryMS: number;
|
||||
};
|
||||
|
||||
815
browser-sync/browser-sync.d.ts
vendored
815
browser-sync/browser-sync.d.ts
vendored
@ -7,416 +7,415 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../micromatch/micromatch.d.ts" />
|
||||
|
||||
declare module "browser-sync" {
|
||||
import chokidar = require("chokidar");
|
||||
import fs = require("fs");
|
||||
import http = require("http");
|
||||
import mm = require("micromatch");
|
||||
|
||||
namespace browserSync {
|
||||
interface Options {
|
||||
/**
|
||||
* Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls
|
||||
* all devices, push sync updates and much more.
|
||||
*
|
||||
* port - Default: 3001
|
||||
* weinre.port - Default: 8080
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
ui?: UIOptions;
|
||||
/**
|
||||
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
|
||||
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
|
||||
* patterns.
|
||||
* Default: false
|
||||
*/
|
||||
files?: string | string[];
|
||||
/**
|
||||
* File watching options that get passed along to Chokidar. Check their docs for available options
|
||||
* Default: undefined
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
watchOptions?: chokidar.WatchOptions;
|
||||
/**
|
||||
* Use the built-in static server for basic HTML/JS/CSS websites.
|
||||
* Default: false
|
||||
*/
|
||||
server?: ServerOptions;
|
||||
/**
|
||||
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
|
||||
* target - Default: undefined
|
||||
* ws - Default: undefined
|
||||
* middleware - Default: undefined
|
||||
* reqHeaders - Default: undefined
|
||||
* proxyRes - Default: undefined
|
||||
*/
|
||||
proxy?: string | boolean | ProxyOptions;
|
||||
/**
|
||||
* Use a specific port (instead of the one auto-detected by Browsersync)
|
||||
* Default: 3000
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Add additional directories from which static files should be served.
|
||||
* Should only be used in proxy or snippet mode.
|
||||
* Default: []
|
||||
* Note: requires at least version 2.8.0
|
||||
*/
|
||||
serveStatic?: string[];
|
||||
/**
|
||||
* Enable https for localhost development.
|
||||
* Note - this is not needed for proxy option as it will be inferred from your target url.
|
||||
* Note: requires at least version 1.3.0
|
||||
*/
|
||||
https?: boolean;
|
||||
/**
|
||||
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
|
||||
* clicks - Default: true
|
||||
* scroll - Default: true
|
||||
* forms - Default: true
|
||||
*/
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
/**
|
||||
* Can be either "info", "debug", "warn", or "silent"
|
||||
* Default: info
|
||||
*/
|
||||
logLevel?: string;
|
||||
/**
|
||||
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
|
||||
* Default: BS
|
||||
* Note: requires at least version 1.5.1
|
||||
*/
|
||||
logPrefix?: string;
|
||||
/**
|
||||
* Whether or not to log connections
|
||||
* Default: false
|
||||
*/
|
||||
logConnections?: boolean;
|
||||
/**
|
||||
* Whether or not to log information about changed files
|
||||
* Default: false
|
||||
*/
|
||||
logFileChanges?: boolean;
|
||||
/**
|
||||
* Log the snippet to the console when you're in snippet mode (no proxy/server)
|
||||
* Default: true
|
||||
* Note: requires at least version 1.5.2
|
||||
*/
|
||||
logSnippet?: boolean;
|
||||
/**
|
||||
* You can control how the snippet is injected onto each page via a custom regex + function.
|
||||
* You can also provide patterns for certain urls that should be ignored from the snippet injection.
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
snippetOptions?: SnippetOptions;
|
||||
/**
|
||||
* Add additional HTML rewriting rules.
|
||||
* Default: false
|
||||
* Note: requires at least version 2.4.0
|
||||
*/
|
||||
rewriteRules?: boolean | RewriteRules[];
|
||||
/**
|
||||
* Tunnel the Browsersync server through a random Public URL
|
||||
* Default: null
|
||||
*/
|
||||
tunnel?: string | boolean;
|
||||
/**
|
||||
* Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're
|
||||
* working offline, you can reduce start-up time by setting this option to false
|
||||
*/
|
||||
online?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
|
||||
* Can be true, local, external, ui, ui-external, tunnel or false
|
||||
*/
|
||||
open?: string | boolean;
|
||||
/**
|
||||
* The browser(s) to open
|
||||
* Default: default
|
||||
*/
|
||||
browser?: string | string[];
|
||||
/**
|
||||
* Requires an internet connection - useful for services such as Typekit as it allows you to configure
|
||||
* domains such as *.xip.io in your kit settings
|
||||
* Default: false
|
||||
*/
|
||||
xip?: boolean;
|
||||
/**
|
||||
* Reload each browser when Browsersync is restarted.
|
||||
* Default: false
|
||||
*/
|
||||
reloadOnRestart?: boolean;
|
||||
/**
|
||||
* The small pop-over notifications in the browser are not always needed/wanted.
|
||||
* Default: true
|
||||
*/
|
||||
notify?: boolean;
|
||||
/**
|
||||
* scrollProportionally: false // Sync viewports to TOP position
|
||||
* Default: true
|
||||
*/
|
||||
scrollProportionally?: boolean;
|
||||
/**
|
||||
* How often to send scroll events
|
||||
* Default: 0
|
||||
*/
|
||||
scrollThrottle?: number;
|
||||
/**
|
||||
* Decide which technique should be used to restore scroll position following a reload.
|
||||
* Can be window.name or cookie
|
||||
* Default: 'window.name'
|
||||
*/
|
||||
scrollRestoreTechnique?: string;
|
||||
/**
|
||||
* Sync the scroll position of any element on the page. Add any amount of CSS selectors
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
*/
|
||||
scrollElements?: string[];
|
||||
/**
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
* Sync the scroll position of any element on the page - where any scrolled element will cause
|
||||
* all others to match scroll position. This is helpful when a breakpoint alters which element
|
||||
* is actually scrolling
|
||||
*/
|
||||
scrollElementMapping?: string[];
|
||||
/**
|
||||
* Time, in milliseconds, to wait before instructing the browser to reload/inject following a file
|
||||
* change event
|
||||
* Default: 0
|
||||
*/
|
||||
reloadDelay?: number;
|
||||
/**
|
||||
* Restrict the frequency in which browser:reload events can be emitted to connected clients
|
||||
* Default: 0
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
reloadDebounce?: number;
|
||||
/**
|
||||
* User provided plugins
|
||||
* Default: []
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Whether to inject changes (rather than a page refresh)
|
||||
* Default: true
|
||||
*/
|
||||
injectChanges?: boolean;
|
||||
/**
|
||||
* The initial path to load
|
||||
*/
|
||||
startPath?: string;
|
||||
/**
|
||||
* Whether to minify the client script
|
||||
* Default: true
|
||||
*/
|
||||
minify?: boolean;
|
||||
/**
|
||||
* Override host detection if you know the correct IP to use
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* Send file-change events to the browser
|
||||
* Default: true
|
||||
*/
|
||||
codeSync?: boolean;
|
||||
/**
|
||||
* Append timestamps to injected files
|
||||
* Default: true
|
||||
*/
|
||||
timestamps?: boolean;
|
||||
/**
|
||||
* Alter the script path for complete control over where the Browsersync Javascript is served
|
||||
* from. Whatever you return from this function will be used as the script path.
|
||||
* Note: requires at least version 1.5.0
|
||||
*/
|
||||
scriptPath?: (path: string) => string;
|
||||
/**
|
||||
* Configure the Socket.IO path and namespace & domain to avoid collisions.
|
||||
* path - Default: "/browser-sync/socket.io"
|
||||
* clientPath - Default: "/browser-sync"
|
||||
* namespace - Default: "/browser-sync"
|
||||
* domain - Default: undefined
|
||||
* port - Default: undefined
|
||||
* clients.heartbeatTimeout - Default: 5000
|
||||
* Note: requires at least version 1.6.2
|
||||
*/
|
||||
socket?: SocketOptions;
|
||||
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
||||
}
|
||||
import chokidar = require("chokidar");
|
||||
import fs = require("fs");
|
||||
import http = require("http");
|
||||
import mm = require("micromatch");
|
||||
|
||||
interface Hash<T> {
|
||||
[path: string]: T;
|
||||
}
|
||||
|
||||
interface UIOptions {
|
||||
/** set the default port */
|
||||
port?: number;
|
||||
/** set the default weinre port */
|
||||
weinre?: {
|
||||
port?: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
/** set base directory */
|
||||
baseDir?: string | string[];
|
||||
/** enable directory listing */
|
||||
directory?: boolean;
|
||||
/** set index filename */
|
||||
index?: string;
|
||||
/**
|
||||
* key-value object hash, where the key is the url to match,
|
||||
* and the value is the folder to serve (relative to your working directory)
|
||||
*/
|
||||
routes?: Hash<string>;
|
||||
/** configure custom middleware */
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface ProxyOptions {
|
||||
target?: string;
|
||||
middleware?: MiddlewareHandler;
|
||||
ws: boolean;
|
||||
reqHeaders: (config: any) => Hash<any>;
|
||||
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any };
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
domain?: string;
|
||||
port?: number;
|
||||
clients?: { heartbeatTimeout?: number; };
|
||||
}
|
||||
|
||||
interface RewriteRules {
|
||||
match: RegExp;
|
||||
fn: (match: string) => string;
|
||||
}
|
||||
|
||||
interface StreamOptions {
|
||||
once?: boolean;
|
||||
match?: mm.Pattern | mm.Pattern[];
|
||||
}
|
||||
|
||||
interface BrowserSyncStatic extends BrowserSyncInstance {
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Create a Browsersync instance
|
||||
* @param name an identifier that can used for retrieval later
|
||||
*/
|
||||
create(name?: string): BrowserSyncInstance;
|
||||
/**
|
||||
* Get a single instance by name. This is useful if you have your build scripts in separate files
|
||||
* @param name the identifier used for retrieval
|
||||
*/
|
||||
get(name: string): BrowserSyncInstance;
|
||||
/**
|
||||
* Check if an instance has been created.
|
||||
* @param name the name of the instance
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
}
|
||||
|
||||
interface BrowserSyncInstance {
|
||||
/** the name of this instance of browser-sync */
|
||||
name: string;
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Reload the browser
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(): void;
|
||||
/**
|
||||
* Reload a single file
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(file: string): void;
|
||||
/**
|
||||
* Reload multiple files
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(files: string[]): void;
|
||||
/**
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(options: { stream: boolean }): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* The stream method returns a transform stream and can act once or on many files.
|
||||
* @param opts Configuration for the stream method
|
||||
*/
|
||||
stream(opts?: StreamOptions): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* Helper method for browser notifications
|
||||
* @param message Can be a simple message such as 'Connected' or HTML
|
||||
* @param timeout How long the message will remain in the browser. @since 1.3.0
|
||||
*/
|
||||
notify(message: string, timeout?: number): void;
|
||||
/**
|
||||
* This method will close any running server, stop file watching & exit the current process.
|
||||
*/
|
||||
exit(): void;
|
||||
/**
|
||||
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
|
||||
*/
|
||||
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
|
||||
: NodeJS.EventEmitter;
|
||||
/**
|
||||
* Method to pause file change events
|
||||
*/
|
||||
pause(): void;
|
||||
/**
|
||||
* Method to resume paused watchers
|
||||
*/
|
||||
resume(): void;
|
||||
/**
|
||||
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
|
||||
* this to emit your own events, such as changed files, logging etc.
|
||||
*/
|
||||
emitter: NodeJS.EventEmitter;
|
||||
/**
|
||||
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
|
||||
*/
|
||||
active: boolean;
|
||||
/**
|
||||
* A simple true/false flag to determine if the current instance is paused
|
||||
*/
|
||||
paused: boolean;
|
||||
}
|
||||
declare namespace browserSync {
|
||||
interface Options {
|
||||
/**
|
||||
* Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls
|
||||
* all devices, push sync updates and much more.
|
||||
*
|
||||
* port - Default: 3001
|
||||
* weinre.port - Default: 8080
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
ui?: UIOptions;
|
||||
/**
|
||||
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
|
||||
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
|
||||
* patterns.
|
||||
* Default: false
|
||||
*/
|
||||
files?: string | string[];
|
||||
/**
|
||||
* File watching options that get passed along to Chokidar. Check their docs for available options
|
||||
* Default: undefined
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
watchOptions?: chokidar.WatchOptions;
|
||||
/**
|
||||
* Use the built-in static server for basic HTML/JS/CSS websites.
|
||||
* Default: false
|
||||
*/
|
||||
server?: ServerOptions;
|
||||
/**
|
||||
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
|
||||
* target - Default: undefined
|
||||
* ws - Default: undefined
|
||||
* middleware - Default: undefined
|
||||
* reqHeaders - Default: undefined
|
||||
* proxyRes - Default: undefined
|
||||
*/
|
||||
proxy?: string | boolean | ProxyOptions;
|
||||
/**
|
||||
* Use a specific port (instead of the one auto-detected by Browsersync)
|
||||
* Default: 3000
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Add additional directories from which static files should be served.
|
||||
* Should only be used in proxy or snippet mode.
|
||||
* Default: []
|
||||
* Note: requires at least version 2.8.0
|
||||
*/
|
||||
serveStatic?: string[];
|
||||
/**
|
||||
* Enable https for localhost development.
|
||||
* Note - this is not needed for proxy option as it will be inferred from your target url.
|
||||
* Note: requires at least version 1.3.0
|
||||
*/
|
||||
https?: boolean;
|
||||
/**
|
||||
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
|
||||
* clicks - Default: true
|
||||
* scroll - Default: true
|
||||
* forms - Default: true
|
||||
*/
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
/**
|
||||
* Can be either "info", "debug", "warn", or "silent"
|
||||
* Default: info
|
||||
*/
|
||||
logLevel?: string;
|
||||
/**
|
||||
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
|
||||
* Default: BS
|
||||
* Note: requires at least version 1.5.1
|
||||
*/
|
||||
logPrefix?: string;
|
||||
/**
|
||||
* Whether or not to log connections
|
||||
* Default: false
|
||||
*/
|
||||
logConnections?: boolean;
|
||||
/**
|
||||
* Whether or not to log information about changed files
|
||||
* Default: false
|
||||
*/
|
||||
logFileChanges?: boolean;
|
||||
/**
|
||||
* Log the snippet to the console when you're in snippet mode (no proxy/server)
|
||||
* Default: true
|
||||
* Note: requires at least version 1.5.2
|
||||
*/
|
||||
logSnippet?: boolean;
|
||||
/**
|
||||
* You can control how the snippet is injected onto each page via a custom regex + function.
|
||||
* You can also provide patterns for certain urls that should be ignored from the snippet injection.
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
snippetOptions?: SnippetOptions;
|
||||
/**
|
||||
* Add additional HTML rewriting rules.
|
||||
* Default: false
|
||||
* Note: requires at least version 2.4.0
|
||||
*/
|
||||
rewriteRules?: boolean | RewriteRules[];
|
||||
/**
|
||||
* Tunnel the Browsersync server through a random Public URL
|
||||
* Default: null
|
||||
*/
|
||||
tunnel?: string | boolean;
|
||||
/**
|
||||
* Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're
|
||||
* working offline, you can reduce start-up time by setting this option to false
|
||||
*/
|
||||
online?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
|
||||
* Can be true, local, external, ui, ui-external, tunnel or false
|
||||
*/
|
||||
open?: string | boolean;
|
||||
/**
|
||||
* The browser(s) to open
|
||||
* Default: default
|
||||
*/
|
||||
browser?: string | string[];
|
||||
/**
|
||||
* Requires an internet connection - useful for services such as Typekit as it allows you to configure
|
||||
* domains such as *.xip.io in your kit settings
|
||||
* Default: false
|
||||
*/
|
||||
xip?: boolean;
|
||||
/**
|
||||
* Reload each browser when Browsersync is restarted.
|
||||
* Default: false
|
||||
*/
|
||||
reloadOnRestart?: boolean;
|
||||
/**
|
||||
* The small pop-over notifications in the browser are not always needed/wanted.
|
||||
* Default: true
|
||||
*/
|
||||
notify?: boolean;
|
||||
/**
|
||||
* scrollProportionally: false // Sync viewports to TOP position
|
||||
* Default: true
|
||||
*/
|
||||
scrollProportionally?: boolean;
|
||||
/**
|
||||
* How often to send scroll events
|
||||
* Default: 0
|
||||
*/
|
||||
scrollThrottle?: number;
|
||||
/**
|
||||
* Decide which technique should be used to restore scroll position following a reload.
|
||||
* Can be window.name or cookie
|
||||
* Default: 'window.name'
|
||||
*/
|
||||
scrollRestoreTechnique?: string;
|
||||
/**
|
||||
* Sync the scroll position of any element on the page. Add any amount of CSS selectors
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
*/
|
||||
scrollElements?: string[];
|
||||
/**
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
* Sync the scroll position of any element on the page - where any scrolled element will cause
|
||||
* all others to match scroll position. This is helpful when a breakpoint alters which element
|
||||
* is actually scrolling
|
||||
*/
|
||||
scrollElementMapping?: string[];
|
||||
/**
|
||||
* Time, in milliseconds, to wait before instructing the browser to reload/inject following a file
|
||||
* change event
|
||||
* Default: 0
|
||||
*/
|
||||
reloadDelay?: number;
|
||||
/**
|
||||
* Restrict the frequency in which browser:reload events can be emitted to connected clients
|
||||
* Default: 0
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
reloadDebounce?: number;
|
||||
/**
|
||||
* User provided plugins
|
||||
* Default: []
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Whether to inject changes (rather than a page refresh)
|
||||
* Default: true
|
||||
*/
|
||||
injectChanges?: boolean;
|
||||
/**
|
||||
* The initial path to load
|
||||
*/
|
||||
startPath?: string;
|
||||
/**
|
||||
* Whether to minify the client script
|
||||
* Default: true
|
||||
*/
|
||||
minify?: boolean;
|
||||
/**
|
||||
* Override host detection if you know the correct IP to use
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* Send file-change events to the browser
|
||||
* Default: true
|
||||
*/
|
||||
codeSync?: boolean;
|
||||
/**
|
||||
* Append timestamps to injected files
|
||||
* Default: true
|
||||
*/
|
||||
timestamps?: boolean;
|
||||
/**
|
||||
* Alter the script path for complete control over where the Browsersync Javascript is served
|
||||
* from. Whatever you return from this function will be used as the script path.
|
||||
* Note: requires at least version 1.5.0
|
||||
*/
|
||||
scriptPath?: (path: string) => string;
|
||||
/**
|
||||
* Configure the Socket.IO path and namespace & domain to avoid collisions.
|
||||
* path - Default: "/browser-sync/socket.io"
|
||||
* clientPath - Default: "/browser-sync"
|
||||
* namespace - Default: "/browser-sync"
|
||||
* domain - Default: undefined
|
||||
* port - Default: undefined
|
||||
* clients.heartbeatTimeout - Default: 5000
|
||||
* Note: requires at least version 1.6.2
|
||||
*/
|
||||
socket?: SocketOptions;
|
||||
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
||||
}
|
||||
|
||||
const browserSync: browserSync.BrowserSyncStatic;
|
||||
export = browserSync;
|
||||
interface Hash<T> {
|
||||
[path: string]: T;
|
||||
}
|
||||
|
||||
interface UIOptions {
|
||||
/** set the default port */
|
||||
port?: number;
|
||||
/** set the default weinre port */
|
||||
weinre?: {
|
||||
port?: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
/** set base directory */
|
||||
baseDir?: string | string[];
|
||||
/** enable directory listing */
|
||||
directory?: boolean;
|
||||
/** set index filename */
|
||||
index?: string;
|
||||
/**
|
||||
* key-value object hash, where the key is the url to match,
|
||||
* and the value is the folder to serve (relative to your working directory)
|
||||
*/
|
||||
routes?: Hash<string>;
|
||||
/** configure custom middleware */
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface ProxyOptions {
|
||||
target?: string;
|
||||
middleware?: MiddlewareHandler;
|
||||
ws: boolean;
|
||||
reqHeaders: (config: any) => Hash<any>;
|
||||
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any };
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
domain?: string;
|
||||
port?: number;
|
||||
clients?: { heartbeatTimeout?: number; };
|
||||
}
|
||||
|
||||
interface RewriteRules {
|
||||
match: RegExp;
|
||||
fn: (match: string) => string;
|
||||
}
|
||||
|
||||
interface StreamOptions {
|
||||
once?: boolean;
|
||||
match?: mm.Pattern | mm.Pattern[];
|
||||
}
|
||||
|
||||
interface BrowserSyncStatic extends BrowserSyncInstance {
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Create a Browsersync instance
|
||||
* @param name an identifier that can used for retrieval later
|
||||
*/
|
||||
create(name?: string): BrowserSyncInstance;
|
||||
/**
|
||||
* Get a single instance by name. This is useful if you have your build scripts in separate files
|
||||
* @param name the identifier used for retrieval
|
||||
*/
|
||||
get(name: string): BrowserSyncInstance;
|
||||
/**
|
||||
* Check if an instance has been created.
|
||||
* @param name the name of the instance
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
}
|
||||
|
||||
interface BrowserSyncInstance {
|
||||
/** the name of this instance of browser-sync */
|
||||
name: string;
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Reload the browser
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(): void;
|
||||
/**
|
||||
* Reload a single file
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(file: string): void;
|
||||
/**
|
||||
* Reload multiple files
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(files: string[]): void;
|
||||
/**
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(options: { stream: boolean }): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* The stream method returns a transform stream and can act once or on many files.
|
||||
* @param opts Configuration for the stream method
|
||||
*/
|
||||
stream(opts?: StreamOptions): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* Helper method for browser notifications
|
||||
* @param message Can be a simple message such as 'Connected' or HTML
|
||||
* @param timeout How long the message will remain in the browser. @since 1.3.0
|
||||
*/
|
||||
notify(message: string, timeout?: number): void;
|
||||
/**
|
||||
* This method will close any running server, stop file watching & exit the current process.
|
||||
*/
|
||||
exit(): void;
|
||||
/**
|
||||
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
|
||||
*/
|
||||
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
|
||||
: NodeJS.EventEmitter;
|
||||
/**
|
||||
* Method to pause file change events
|
||||
*/
|
||||
pause(): void;
|
||||
/**
|
||||
* Method to resume paused watchers
|
||||
*/
|
||||
resume(): void;
|
||||
/**
|
||||
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
|
||||
* this to emit your own events, such as changed files, logging etc.
|
||||
*/
|
||||
emitter: NodeJS.EventEmitter;
|
||||
/**
|
||||
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
|
||||
*/
|
||||
active: boolean;
|
||||
/**
|
||||
* A simple true/false flag to determine if the current instance is paused
|
||||
*/
|
||||
paused: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const browserSync: browserSync.BrowserSyncStatic;
|
||||
export = browserSync;
|
||||
|
||||
9
bs58/bs58.d.ts
vendored
9
bs58/bs58.d.ts
vendored
@ -5,10 +5,9 @@
|
||||
|
||||
/// <reference path="../base-x/base-x.d.ts" />
|
||||
|
||||
declare module "bs58" {
|
||||
namespace base58 {}
|
||||
|
||||
let base58: BaseX.BaseConverter;
|
||||
declare namespace base58 { }
|
||||
|
||||
export = base58;
|
||||
}
|
||||
declare let base58: BaseX.BaseConverter;
|
||||
|
||||
export = base58;
|
||||
|
||||
210
bson/bson.d.ts
vendored
210
bson/bson.d.ts
vendored
@ -6,128 +6,126 @@
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
|
||||
declare module 'bson' {
|
||||
|
||||
namespace bson {
|
||||
|
||||
export module BSONPure {
|
||||
|
||||
export interface DeserializeOptions {
|
||||
/** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. */
|
||||
evalFunctions?: boolean;
|
||||
/** {Boolean, default:false}, cache evaluated functions for reuse. */
|
||||
cacheFunctions?: boolean;
|
||||
/** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. */
|
||||
cacheFunctionsCrc32?: boolean;
|
||||
/** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. */
|
||||
promoteBuffers?: boolean;
|
||||
}
|
||||
export class BSON {
|
||||
/**
|
||||
* @param {Object} object the Javascript object to serialize.
|
||||
* @param {Boolean} checkKeys the serializer will check if keys are valid.
|
||||
* @param {Boolean} asBuffer return the serialized object as a Buffer object (ignore).
|
||||
* @param {Boolean} serializeFunctions serialize the javascript functions (default:false)
|
||||
* @return {Buffer} returns a TypedArray or Array depending on what your browser supports
|
||||
*/
|
||||
serialize(object: any, checkKeys?: boolean, asBuffer?: boolean, serializeFunctions?: boolean): Buffer;
|
||||
deserialize(buffer: Buffer, options?: DeserializeOptions, isArray?: boolean): any;
|
||||
}
|
||||
|
||||
|
||||
export interface Binary {}
|
||||
export interface BinaryStatic {
|
||||
SUBTYPE_DEFAULT: number;
|
||||
SUBTYPE_FUNCTION: number;
|
||||
SUBTYPE_BYTE_ARRAY: number;
|
||||
SUBTYPE_UUID_OLD: number;
|
||||
SUBTYPE_UUID: number;
|
||||
SUBTYPE_MD5: number;
|
||||
SUBTYPE_USER_DEFINED: number;
|
||||
declare namespace bson {
|
||||
|
||||
new (buffer: Buffer, subType?: number): Binary;
|
||||
}
|
||||
export let Binary: BinaryStatic;
|
||||
export module BSONPure {
|
||||
|
||||
export interface Code {}
|
||||
export interface CodeStatic {
|
||||
new (code: string | Function, scope?: any): Code;
|
||||
}
|
||||
export let Code: CodeStatic;
|
||||
export interface DeserializeOptions {
|
||||
/** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. */
|
||||
evalFunctions?: boolean;
|
||||
/** {Boolean, default:false}, cache evaluated functions for reuse. */
|
||||
cacheFunctions?: boolean;
|
||||
/** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. */
|
||||
cacheFunctionsCrc32?: boolean;
|
||||
/** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. */
|
||||
promoteBuffers?: boolean;
|
||||
}
|
||||
export class BSON {
|
||||
/**
|
||||
* @param {Object} object the Javascript object to serialize.
|
||||
* @param {Boolean} checkKeys the serializer will check if keys are valid.
|
||||
* @param {Boolean} asBuffer return the serialized object as a Buffer object (ignore).
|
||||
* @param {Boolean} serializeFunctions serialize the javascript functions (default:false)
|
||||
* @return {Buffer} returns a TypedArray or Array depending on what your browser supports
|
||||
*/
|
||||
serialize(object: any, checkKeys?: boolean, asBuffer?: boolean, serializeFunctions?: boolean): Buffer;
|
||||
deserialize(buffer: Buffer, options?: DeserializeOptions, isArray?: boolean): any;
|
||||
}
|
||||
|
||||
export interface DBRef {}
|
||||
export interface DBRefStatic {
|
||||
new (namespace: string, oid: ObjectID, db?: string): DBRef;
|
||||
}
|
||||
export let DBRef: DBRefStatic;
|
||||
|
||||
export interface Double {}
|
||||
export interface DoubleStatic {
|
||||
new (value: number): Double;
|
||||
}
|
||||
export let Double: DoubleStatic;
|
||||
export interface Binary { }
|
||||
export interface BinaryStatic {
|
||||
SUBTYPE_DEFAULT: number;
|
||||
SUBTYPE_FUNCTION: number;
|
||||
SUBTYPE_BYTE_ARRAY: number;
|
||||
SUBTYPE_UUID_OLD: number;
|
||||
SUBTYPE_UUID: number;
|
||||
SUBTYPE_MD5: number;
|
||||
SUBTYPE_USER_DEFINED: number;
|
||||
|
||||
export interface Long {}
|
||||
export interface LongStatic {
|
||||
new (low: number, high: number): Long;
|
||||
fromInt(i: number): Long;
|
||||
fromNumber(n: number): Long;
|
||||
fromBits(lowBits: number, highBits: number): Long;
|
||||
fromString(s: string, opt_radix?: number): Long;
|
||||
}
|
||||
export let Long: LongStatic;
|
||||
new (buffer: Buffer, subType?: number): Binary;
|
||||
}
|
||||
export let Binary: BinaryStatic;
|
||||
|
||||
export interface MaxKey {}
|
||||
export interface MaxKeyStatic {
|
||||
new (): MaxKey;
|
||||
}
|
||||
export let MaxKey: MaxKeyStatic;
|
||||
export interface Code { }
|
||||
export interface CodeStatic {
|
||||
new (code: string | Function, scope?: any): Code;
|
||||
}
|
||||
export let Code: CodeStatic;
|
||||
|
||||
export interface MinKey {}
|
||||
export interface MinKeyStatic {
|
||||
new (): MinKey;
|
||||
}
|
||||
export let MinKey: MinKeyStatic;
|
||||
export interface DBRef { }
|
||||
export interface DBRefStatic {
|
||||
new (namespace: string, oid: ObjectID, db?: string): DBRef;
|
||||
}
|
||||
export let DBRef: DBRefStatic;
|
||||
|
||||
export interface ObjectID {}
|
||||
export interface ObjectIDStatic {
|
||||
new (id?: number | string | ObjectID): ObjectID;
|
||||
createPk(): ObjectID;
|
||||
createFromTime(time: number): ObjectID;
|
||||
createFromHexString(hexString: string): ObjectID;
|
||||
isValid(id: number | string | ObjectID): boolean;
|
||||
}
|
||||
export let ObjectID: ObjectIDStatic;
|
||||
export let ObjectId: ObjectIDStatic;
|
||||
export interface Double { }
|
||||
export interface DoubleStatic {
|
||||
new (value: number): Double;
|
||||
}
|
||||
export let Double: DoubleStatic;
|
||||
|
||||
export interface BSONRegExp {}
|
||||
export interface BSONRegExpStatic {
|
||||
new (pattern: string, options: string): BSONRegExp;
|
||||
}
|
||||
export let BSONRegExp: BSONRegExpStatic;
|
||||
export interface Long { }
|
||||
export interface LongStatic {
|
||||
new (low: number, high: number): Long;
|
||||
fromInt(i: number): Long;
|
||||
fromNumber(n: number): Long;
|
||||
fromBits(lowBits: number, highBits: number): Long;
|
||||
fromString(s: string, opt_radix?: number): Long;
|
||||
}
|
||||
export let Long: LongStatic;
|
||||
|
||||
export interface Symbol {}
|
||||
export interface SymbolStatic {
|
||||
new (value: string): Symbol;
|
||||
}
|
||||
export let Symbol: SymbolStatic;
|
||||
export interface MaxKey { }
|
||||
export interface MaxKeyStatic {
|
||||
new (): MaxKey;
|
||||
}
|
||||
export let MaxKey: MaxKeyStatic;
|
||||
|
||||
export interface Timestamp {}
|
||||
export interface TimestampStatic {
|
||||
new (low: number, high: number): Timestamp;
|
||||
fromInt(i: number): Timestamp;
|
||||
fromNumber(n: number): Timestamp;
|
||||
fromBits(lowBits: number, highBits: number): Timestamp;
|
||||
fromString(s: string, opt_radix?: number): Timestamp;
|
||||
}
|
||||
export let Timestamp: TimestampStatic;
|
||||
export interface MinKey { }
|
||||
export interface MinKeyStatic {
|
||||
new (): MinKey;
|
||||
}
|
||||
export let MinKey: MinKeyStatic;
|
||||
|
||||
}
|
||||
export interface ObjectID { }
|
||||
export interface ObjectIDStatic {
|
||||
new (id?: number | string | ObjectID): ObjectID;
|
||||
createPk(): ObjectID;
|
||||
createFromTime(time: number): ObjectID;
|
||||
createFromHexString(hexString: string): ObjectID;
|
||||
isValid(id: number | string | ObjectID): boolean;
|
||||
}
|
||||
export let ObjectID: ObjectIDStatic;
|
||||
export let ObjectId: ObjectIDStatic;
|
||||
|
||||
export let BSONNative: typeof BSONPure;
|
||||
export interface BSONRegExp { }
|
||||
export interface BSONRegExpStatic {
|
||||
new (pattern: string, options: string): BSONRegExp;
|
||||
}
|
||||
export let BSONRegExp: BSONRegExpStatic;
|
||||
|
||||
}
|
||||
export interface Symbol { }
|
||||
export interface SymbolStatic {
|
||||
new (value: string): Symbol;
|
||||
}
|
||||
export let Symbol: SymbolStatic;
|
||||
|
||||
export interface Timestamp { }
|
||||
export interface TimestampStatic {
|
||||
new (low: number, high: number): Timestamp;
|
||||
fromInt(i: number): Timestamp;
|
||||
fromNumber(n: number): Timestamp;
|
||||
fromBits(lowBits: number, highBits: number): Timestamp;
|
||||
fromString(s: string, opt_radix?: number): Timestamp;
|
||||
}
|
||||
export let Timestamp: TimestampStatic;
|
||||
|
||||
}
|
||||
|
||||
export let BSONNative: typeof BSONPure;
|
||||
|
||||
export = bson;
|
||||
}
|
||||
|
||||
export = bson;
|
||||
|
||||
19
buffer-compare/buffer-compare.d.ts
vendored
19
buffer-compare/buffer-compare.d.ts
vendored
@ -3,15 +3,14 @@
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "buffer-compare" {
|
||||
interface List {
|
||||
[index: number]: any;
|
||||
length: number
|
||||
}
|
||||
|
||||
function compare(cmp: List, to: List): number;
|
||||
function compare<T>(cmp: T, to: T): number;
|
||||
function compare<C, T>(cmp: C, to: T): number;
|
||||
|
||||
export = compare;
|
||||
interface List {
|
||||
[index: number]: any;
|
||||
length: number
|
||||
}
|
||||
|
||||
declare function compare(cmp: List, to: List): number;
|
||||
declare function compare<T>(cmp: T, to: T): number;
|
||||
declare function compare<C, T>(cmp: C, to: T): number;
|
||||
|
||||
export = compare;
|
||||
|
||||
7
buffer-equal/buffer-equal.d.ts
vendored
7
buffer-equal/buffer-equal.d.ts
vendored
@ -5,7 +5,6 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'buffer-equal' {
|
||||
function bufferEqual(actual:Buffer, expected:Buffer): boolean;
|
||||
export = bufferEqual;
|
||||
}
|
||||
|
||||
declare function bufferEqual(actual: Buffer, expected: Buffer): boolean;
|
||||
export = bufferEqual;
|
||||
|
||||
50
buffers/buffers.d.ts
vendored
50
buffers/buffers.d.ts
vendored
@ -5,32 +5,30 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "buffers" {
|
||||
|
||||
interface BuffersStatics {
|
||||
new (bufs?: Buffer[]|Buffers): Buffers;
|
||||
(bufs?: Buffer[]| Buffers): Buffers;
|
||||
prototype: Buffers;
|
||||
}
|
||||
|
||||
interface Buffers {
|
||||
buffers: Buffer[];
|
||||
length: number;
|
||||
|
||||
push(...items: Buffer[]): number;
|
||||
unshift(...items: Buffer[]): number;
|
||||
slice(i?: number, j?: number): Buffer;
|
||||
splice(i: number, howMany?: number, ...items: Buffer[]): Buffers;
|
||||
copy(dst: Buffer, dstStart?: number, start?: number, end?: number): number;
|
||||
get(i: number): any;
|
||||
set(i: number, b: any): void;
|
||||
indexOf(needle: string|Buffer, offset?: number): number;
|
||||
toBuffer(): Buffer;
|
||||
toString(encoding?: any, start?: number, end?: number): string;
|
||||
}
|
||||
|
||||
var Buffers: BuffersStatics;
|
||||
|
||||
export = Buffers;
|
||||
|
||||
interface BuffersStatics {
|
||||
new (bufs?: Buffer[] | Buffers): Buffers;
|
||||
(bufs?: Buffer[] | Buffers): Buffers;
|
||||
prototype: Buffers;
|
||||
}
|
||||
|
||||
interface Buffers {
|
||||
buffers: Buffer[];
|
||||
length: number;
|
||||
|
||||
push(...items: Buffer[]): number;
|
||||
unshift(...items: Buffer[]): number;
|
||||
slice(i?: number, j?: number): Buffer;
|
||||
splice(i: number, howMany?: number, ...items: Buffer[]): Buffers;
|
||||
copy(dst: Buffer, dstStart?: number, start?: number, end?: number): number;
|
||||
get(i: number): any;
|
||||
set(i: number, b: any): void;
|
||||
indexOf(needle: string | Buffer, offset?: number): number;
|
||||
toBuffer(): Buffer;
|
||||
toString(encoding?: any, start?: number, end?: number): string;
|
||||
}
|
||||
|
||||
declare var Buffers: BuffersStatics;
|
||||
|
||||
export = Buffers;
|
||||
|
||||
11
bunyan-logentries/bunyan-logentries.d.ts
vendored
11
bunyan-logentries/bunyan-logentries.d.ts
vendored
@ -6,12 +6,11 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bunyan/bunyan.d.ts" />
|
||||
|
||||
declare module "bunyan-logentries" {
|
||||
import bunyan = require("bunyan");
|
||||
|
||||
interface StreamOptions {
|
||||
import bunyan = require("bunyan");
|
||||
|
||||
interface StreamOptions {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export function createStream(options: StreamOptions): NodeJS.WritableStream;
|
||||
}
|
||||
|
||||
declare export function createStream(options: StreamOptions): NodeJS.WritableStream;
|
||||
|
||||
43
bunyan-prettystream/bunyan-prettystream.d.ts
vendored
43
bunyan-prettystream/bunyan-prettystream.d.ts
vendored
@ -5,26 +5,25 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "bunyan-prettystream" {
|
||||
import stream = require("stream");
|
||||
class PrettyStream extends stream.Writable {
|
||||
/**
|
||||
* @param options.mode Output format, can be either `long`, `short`, or `dev`,
|
||||
* defaults to `long`.
|
||||
* @param options.useColor Indicates whether or not output should be colored,
|
||||
* defaults to `true`.
|
||||
*/
|
||||
constructor(options?: { mode?: string; useColor?: boolean });
|
||||
|
||||
/**
|
||||
* Pipes data from this stream to another.
|
||||
*
|
||||
* @param destination Stream to write data to.
|
||||
* @param options.end Indicates whether `end()` should be called on the `destination`
|
||||
* stream when this stream emits `end`, defaults to `true`.
|
||||
* @return The `destination` stream.
|
||||
*/
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
}
|
||||
export = PrettyStream;
|
||||
}
|
||||
import stream = require("stream");
|
||||
declare class PrettyStream extends stream.Writable {
|
||||
/**
|
||||
* @param options.mode Output format, can be either `long`, `short`, or `dev`,
|
||||
* defaults to `long`.
|
||||
* @param options.useColor Indicates whether or not output should be colored,
|
||||
* defaults to `true`.
|
||||
*/
|
||||
constructor(options?: { mode?: string; useColor?: boolean });
|
||||
|
||||
/**
|
||||
* Pipes data from this stream to another.
|
||||
*
|
||||
* @param destination Stream to write data to.
|
||||
* @param options.end Indicates whether `end()` should be called on the `destination`
|
||||
* stream when this stream emits `end`, defaults to `true`.
|
||||
* @return The `destination` stream.
|
||||
*/
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
}
|
||||
export = PrettyStream;
|
||||
|
||||
183
bunyan/bunyan.d.ts
vendored
183
bunyan/bunyan.d.ts
vendored
@ -5,101 +5,100 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "bunyan" {
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
class Logger extends EventEmitter {
|
||||
constructor(options:LoggerOptions);
|
||||
addStream(stream:Stream):void;
|
||||
addSerializers(serializers:Serializers):void;
|
||||
child(options:LoggerOptions, simple?:boolean):Logger;
|
||||
child(obj:Object, simple?:boolean):Logger;
|
||||
reopenFileStreams():void;
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
level():string|number;
|
||||
level(value: number | string):void;
|
||||
levels(name: number | string, value: number | string):void;
|
||||
declare class Logger extends EventEmitter {
|
||||
constructor(options: LoggerOptions);
|
||||
addStream(stream: Stream): void;
|
||||
addSerializers(serializers: Serializers): void;
|
||||
child(options: LoggerOptions, simple?: boolean): Logger;
|
||||
child(obj: Object, simple?: boolean): Logger;
|
||||
reopenFileStreams(): void;
|
||||
|
||||
fields:any;
|
||||
src:boolean;
|
||||
level(): string | number;
|
||||
level(value: number | string): void;
|
||||
levels(name: number | string, value: number | string): void;
|
||||
|
||||
trace(error:Error, format?:any, ...params:any[]):void;
|
||||
trace(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
trace(obj:Object, format?:any, ...params:any[]):void;
|
||||
trace(format:string, ...params:any[]):void;
|
||||
debug(error:Error, format?:any, ...params:any[]):void;
|
||||
debug(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
debug(obj:Object, format?:any, ...params:any[]):void;
|
||||
debug(format:string, ...params:any[]):void;
|
||||
info(error:Error, format?:any, ...params:any[]):void;
|
||||
info(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
info(obj:Object, format?:any, ...params:any[]):void;
|
||||
info(format:string, ...params:any[]):void;
|
||||
warn(error:Error, format?:any, ...params:any[]):void;
|
||||
warn(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
warn(obj:Object, format?:any, ...params:any[]):void;
|
||||
warn(format:string, ...params:any[]):void;
|
||||
error(error:Error, format?:any, ...params:any[]):void;
|
||||
error(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
error(obj:Object, format?:any, ...params:any[]):void;
|
||||
error(format:string, ...params:any[]):void;
|
||||
fatal(error:Error, format?:any, ...params:any[]):void;
|
||||
fatal(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
fatal(obj:Object, format?:any, ...params:any[]):void;
|
||||
fatal(format:string, ...params:any[]):void;
|
||||
}
|
||||
fields: any;
|
||||
src: boolean;
|
||||
|
||||
interface LoggerOptions {
|
||||
name: string;
|
||||
streams?: Stream[];
|
||||
level?: string | number;
|
||||
stream?: NodeJS.WritableStream;
|
||||
serializers?: Serializers;
|
||||
src?: boolean;
|
||||
}
|
||||
|
||||
interface Serializers {
|
||||
[key:string]: (input:any) => string;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
type?: string;
|
||||
level?: number | string;
|
||||
path?: string;
|
||||
stream?: NodeJS.WritableStream | Stream;
|
||||
closeOnExit?: boolean;
|
||||
period?: string;
|
||||
count?: number;
|
||||
}
|
||||
|
||||
export var stdSerializers:Serializers;
|
||||
|
||||
export var TRACE:number;
|
||||
export var DEBUG:number;
|
||||
export var INFO:number;
|
||||
export var WARN:number;
|
||||
export var ERROR:number;
|
||||
export var FATAL:number;
|
||||
|
||||
export function resolveLevel(value: number | string):number;
|
||||
|
||||
export function createLogger(options:LoggerOptions):Logger;
|
||||
|
||||
class RingBuffer extends EventEmitter {
|
||||
constructor(options:RingBufferOptions);
|
||||
|
||||
writable:boolean;
|
||||
records:any[];
|
||||
|
||||
write(record:any):void;
|
||||
end(record?:any):void;
|
||||
destroy():void;
|
||||
destroySoon():void;
|
||||
}
|
||||
|
||||
interface RingBufferOptions {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export function safeCycles():(key:string, value:any) => any;
|
||||
trace(error: Error, format?: any, ...params: any[]): void;
|
||||
trace(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
trace(obj: Object, format?: any, ...params: any[]): void;
|
||||
trace(format: string, ...params: any[]): void;
|
||||
debug(error: Error, format?: any, ...params: any[]): void;
|
||||
debug(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
debug(obj: Object, format?: any, ...params: any[]): void;
|
||||
debug(format: string, ...params: any[]): void;
|
||||
info(error: Error, format?: any, ...params: any[]): void;
|
||||
info(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
info(obj: Object, format?: any, ...params: any[]): void;
|
||||
info(format: string, ...params: any[]): void;
|
||||
warn(error: Error, format?: any, ...params: any[]): void;
|
||||
warn(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
warn(obj: Object, format?: any, ...params: any[]): void;
|
||||
warn(format: string, ...params: any[]): void;
|
||||
error(error: Error, format?: any, ...params: any[]): void;
|
||||
error(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
error(obj: Object, format?: any, ...params: any[]): void;
|
||||
error(format: string, ...params: any[]): void;
|
||||
fatal(error: Error, format?: any, ...params: any[]): void;
|
||||
fatal(buffer: Buffer, format?: any, ...params: any[]): void;
|
||||
fatal(obj: Object, format?: any, ...params: any[]): void;
|
||||
fatal(format: string, ...params: any[]): void;
|
||||
}
|
||||
|
||||
interface LoggerOptions {
|
||||
name: string;
|
||||
streams?: Stream[];
|
||||
level?: string | number;
|
||||
stream?: NodeJS.WritableStream;
|
||||
serializers?: Serializers;
|
||||
src?: boolean;
|
||||
}
|
||||
|
||||
interface Serializers {
|
||||
[key: string]: (input: any) => string;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
type?: string;
|
||||
level?: number | string;
|
||||
path?: string;
|
||||
stream?: NodeJS.WritableStream | Stream;
|
||||
closeOnExit?: boolean;
|
||||
period?: string;
|
||||
count?: number;
|
||||
}
|
||||
|
||||
declare export var stdSerializers: Serializers;
|
||||
|
||||
declare export var TRACE: number;
|
||||
declare export var DEBUG: number;
|
||||
declare export var INFO: number;
|
||||
declare export var WARN: number;
|
||||
declare export var ERROR: number;
|
||||
declare export var FATAL: number;
|
||||
|
||||
declare export function resolveLevel(value: number | string): number;
|
||||
|
||||
declare export function createLogger(options: LoggerOptions): Logger;
|
||||
|
||||
declare class RingBuffer extends EventEmitter {
|
||||
constructor(options: RingBufferOptions);
|
||||
|
||||
writable: boolean;
|
||||
records: any[];
|
||||
|
||||
write(record: any): void;
|
||||
end(record?: any): void;
|
||||
destroy(): void;
|
||||
destroySoon(): void;
|
||||
}
|
||||
|
||||
interface RingBufferOptions {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
declare export function safeCycles(): (key: string, value: any) => any;
|
||||
|
||||
55
byline/byline.d.ts
vendored
55
byline/byline.d.ts
vendored
@ -5,34 +5,33 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "byline" {
|
||||
import stream = require("stream");
|
||||
|
||||
export interface LineStreamOptions extends stream.TransformOptions {
|
||||
keepEmptyLines?: boolean;
|
||||
}
|
||||
import stream = require("stream");
|
||||
|
||||
export interface LineStream extends stream.Transform {
|
||||
}
|
||||
|
||||
export interface LineStreamCreatable extends LineStream {
|
||||
new (options?:LineStreamOptions):LineStream
|
||||
}
|
||||
|
||||
//TODO is it possible to declare static factory functions without name (directly on the module)
|
||||
//
|
||||
// JS:
|
||||
// // convinience API
|
||||
// module.exports = function(readStream, options) {
|
||||
// return module.exports.createStream(readStream, options);
|
||||
// };
|
||||
//
|
||||
// TS:
|
||||
// ():LineStream; // same as createStream():LineStream
|
||||
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
|
||||
|
||||
export function createStream():LineStream;
|
||||
export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream;
|
||||
|
||||
export var LineStream:LineStreamCreatable;
|
||||
export interface LineStreamOptions extends stream.TransformOptions {
|
||||
keepEmptyLines?: boolean;
|
||||
}
|
||||
|
||||
export interface LineStream extends stream.Transform {
|
||||
}
|
||||
|
||||
export interface LineStreamCreatable extends LineStream {
|
||||
new (options?: LineStreamOptions): LineStream
|
||||
}
|
||||
|
||||
//TODO is it possible to declare static factory functions without name (directly on the module)
|
||||
//
|
||||
// JS:
|
||||
// // convinience API
|
||||
// module.exports = function(readStream, options) {
|
||||
// return module.exports.createStream(readStream, options);
|
||||
// };
|
||||
//
|
||||
// TS:
|
||||
// ():LineStream; // same as createStream():LineStream
|
||||
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
|
||||
|
||||
declare export function createStream(): LineStream;
|
||||
declare export function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
|
||||
|
||||
declare export var LineStream: LineStreamCreatable;
|
||||
|
||||
91
bytes/bytes.d.ts
vendored
91
bytes/bytes.d.ts
vendored
@ -3,60 +3,59 @@
|
||||
// Definitions by: Zhiyuan Wang <https://github.com/danny8002/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'bytes' {
|
||||
|
||||
|
||||
/**
|
||||
*Convert the given value in bytes into a string.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {{
|
||||
* thousandsSeparator: [string]
|
||||
* }} [options] bytes options.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
declare function bytes(value: number, options?: { thousandsSeparator: string }): string;
|
||||
|
||||
/**
|
||||
*Parse string to an integer in bytes.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {number}
|
||||
*/
|
||||
declare function bytes(value: string): number;
|
||||
|
||||
declare namespace bytes {
|
||||
|
||||
/**
|
||||
*Convert the given value in bytes into a string.
|
||||
* Format the given value in bytes into a string.
|
||||
*
|
||||
* If the value is negative, take Math.abs(). If it is a float,
|
||||
* it is rounded.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {{
|
||||
* thousandsSeparator: [string]
|
||||
* }} [options] bytes options.
|
||||
*
|
||||
* @returns {string}
|
||||
* @param {BytesFormatOptions} [options]
|
||||
*/
|
||||
function bytes(value: number, options?: { thousandsSeparator: string }): string;
|
||||
|
||||
function format(value: number, options?: { thousandsSeparator: string }): string;
|
||||
|
||||
/**
|
||||
*Parse string to an integer in bytes.
|
||||
* Just return the input number value.
|
||||
*
|
||||
* @param {number} value
|
||||
* @return {number}
|
||||
*/
|
||||
function parse(value: number): number;
|
||||
|
||||
/**
|
||||
* Parse the string value into an integer in bytes.
|
||||
*
|
||||
* If no unit is given, it is assumed the value is in bytes.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {number}
|
||||
* @return {number}
|
||||
*/
|
||||
function bytes(value: string): number;
|
||||
|
||||
namespace bytes {
|
||||
|
||||
/**
|
||||
* Format the given value in bytes into a string.
|
||||
*
|
||||
* If the value is negative, take Math.abs(). If it is a float,
|
||||
* it is rounded.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {BytesFormatOptions} [options]
|
||||
*/
|
||||
|
||||
function format(value: number, options?: { thousandsSeparator: string }): string;
|
||||
|
||||
/**
|
||||
* Just return the input number value.
|
||||
*
|
||||
* @param {number} value
|
||||
* @return {number}
|
||||
*/
|
||||
function parse(value: number): number;
|
||||
|
||||
/**
|
||||
* Parse the string value into an integer in bytes.
|
||||
*
|
||||
* If no unit is given, it is assumed the value is in bytes.
|
||||
*
|
||||
* @param {string} value
|
||||
* @return {number}
|
||||
*/
|
||||
function parse(value: string): number;
|
||||
}
|
||||
|
||||
export = bytes;
|
||||
function parse(value: string): number;
|
||||
}
|
||||
|
||||
export = bytes;
|
||||
|
||||
41
callsite/callsite.d.ts
vendored
41
callsite/callsite.d.ts
vendored
@ -3,28 +3,27 @@
|
||||
// Definitions by: newclear <https://github.com/newclear>
|
||||
// Definitions: https://github.com/newclear/DefinitelyTyped
|
||||
|
||||
declare module "callsite" {
|
||||
|
||||
namespace Callsite{
|
||||
|
||||
interface CallSite {
|
||||
getThis(): any;
|
||||
getTypeName(): string;
|
||||
getFunctionName(): string;
|
||||
getMethodName(): string;
|
||||
getFileName(): string;
|
||||
getLineNumber(): number;
|
||||
getColumnNumber(): number;
|
||||
getFunction(): Function;
|
||||
getEvalOrigin(): string;
|
||||
isNative(): boolean;
|
||||
isToplevel(): boolean;
|
||||
isEval(): boolean;
|
||||
isConstructor(): boolean;
|
||||
}
|
||||
declare namespace Callsite {
|
||||
|
||||
interface CallSite {
|
||||
getThis(): any;
|
||||
getTypeName(): string;
|
||||
getFunctionName(): string;
|
||||
getMethodName(): string;
|
||||
getFileName(): string;
|
||||
getLineNumber(): number;
|
||||
getColumnNumber(): number;
|
||||
getFunction(): Function;
|
||||
getEvalOrigin(): string;
|
||||
isNative(): boolean;
|
||||
isToplevel(): boolean;
|
||||
isEval(): boolean;
|
||||
isConstructor(): boolean;
|
||||
}
|
||||
|
||||
function Callsite(): Callsite.CallSite[];
|
||||
|
||||
export = Callsite;
|
||||
}
|
||||
|
||||
declare function Callsite(): Callsite.CallSite[];
|
||||
|
||||
export = Callsite;
|
||||
|
||||
7
camel-case/camel-case.d.ts
vendored
7
camel-case/camel-case.d.ts
vendored
@ -3,7 +3,6 @@
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "camel-case" {
|
||||
function camelCase(string: string, locale?: string): string;
|
||||
export = camelCase;
|
||||
}
|
||||
|
||||
declare function camelCase(string: string, locale?: string): string;
|
||||
export = camelCase;
|
||||
|
||||
9
camelcase/camelcase.d.ts
vendored
9
camelcase/camelcase.d.ts
vendored
@ -3,8 +3,7 @@
|
||||
// Definitions by: Sam Verschueren <https://github.com/samverschueren>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "camelcase" {
|
||||
function camelcase(...args: string[]): string;
|
||||
namespace camelcase {}
|
||||
export = camelcase;
|
||||
}
|
||||
|
||||
declare function camelcase(...args: string[]): string;
|
||||
declare namespace camelcase { }
|
||||
export = camelcase;
|
||||
|
||||
254
camo/camo.d.ts
vendored
254
camo/camo.d.ts
vendored
@ -3,137 +3,135 @@
|
||||
// Definitions by: Lucas Matías Ciruzzi <https://github.com/lucasmciruzzi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "camo" {
|
||||
|
||||
type TypeOrArray<Type> = Type | Type[];
|
||||
|
||||
/**
|
||||
* Supported type constructors for document properties
|
||||
*/
|
||||
export type SchemaTypeConstructor =
|
||||
TypeOrArray<StringConstructor> |
|
||||
TypeOrArray<NumberConstructor> |
|
||||
TypeOrArray<BooleanConstructor> |
|
||||
TypeOrArray<DateConstructor> |
|
||||
TypeOrArray<ObjectConstructor> |
|
||||
TypeOrArray<ArrayConstructor>;
|
||||
type TypeOrArray<Type> = Type | Type[];
|
||||
|
||||
/**
|
||||
* Supported types for document properties
|
||||
*/
|
||||
export type SchemaType = TypeOrArray<string | number | boolean | Date | Object>;
|
||||
/**
|
||||
* Supported type constructors for document properties
|
||||
*/
|
||||
export type SchemaTypeConstructor =
|
||||
TypeOrArray<StringConstructor> |
|
||||
TypeOrArray<NumberConstructor> |
|
||||
TypeOrArray<BooleanConstructor> |
|
||||
TypeOrArray<DateConstructor> |
|
||||
TypeOrArray<ObjectConstructor> |
|
||||
TypeOrArray<ArrayConstructor>;
|
||||
|
||||
/**
|
||||
* Document property with options
|
||||
*/
|
||||
export interface SchemaTypeOptions<Type> {
|
||||
/**
|
||||
* Type of data
|
||||
*/
|
||||
type: SchemaTypeConstructor;
|
||||
/**
|
||||
* Default value
|
||||
*/
|
||||
default?: Type;
|
||||
/**
|
||||
* Min value (only with Number)
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Max value (only with Number)
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* Posible options
|
||||
*/
|
||||
choices?: Type[];
|
||||
/**
|
||||
* RegEx to match value
|
||||
*/
|
||||
match?: RegExp;
|
||||
/**
|
||||
* Validation function
|
||||
*
|
||||
* @param value Value taken
|
||||
* @returns true (validation ok) or false (validation wrong)
|
||||
*/
|
||||
validate?(value: Type): boolean;
|
||||
/**
|
||||
* Unique value (like ids)
|
||||
*/
|
||||
unique?: boolean;
|
||||
/**
|
||||
* Required field
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document property type or options
|
||||
*/
|
||||
export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions<SchemaType>;
|
||||
|
||||
/**
|
||||
* Schema passed to Document.create()
|
||||
*/
|
||||
interface DocumentSchema {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaType;
|
||||
/**
|
||||
* Document id
|
||||
*/
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document instance
|
||||
*/
|
||||
class DocumentInstance<Schema extends DocumentSchema> {
|
||||
public save(): Promise<Schema>;
|
||||
public loadOne(): Promise<Schema>;
|
||||
public loadMany(): Promise<Schema>;
|
||||
public delete(): Promise<Schema>;
|
||||
public deleteOne(): Promise<Schema>;
|
||||
public deleteMany(): Promise<Schema>;
|
||||
public loadOneAndDelete(): Promise<Schema>;
|
||||
public count(): Promise<Schema>;
|
||||
public preValidate(): Promise<Schema>;
|
||||
public postValidate(): Promise<Schema>;
|
||||
public preSave(): Promise<Schema>;
|
||||
public postSave(): Promise<Schema>;
|
||||
public preDelete(): Promise<Schema>;
|
||||
public postDelete(): Promise<Schema>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document
|
||||
*/
|
||||
export class Document {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaTypeExtended | string | DocumentInstance<any>;
|
||||
/**
|
||||
* Static method to define the collection name
|
||||
*
|
||||
* @returns The collection name
|
||||
*/
|
||||
static collectionName(): string;
|
||||
/**
|
||||
* Creates a camo document instance
|
||||
*
|
||||
* @returns A camo document instance
|
||||
*/
|
||||
static create<Schema extends DocumentSchema>(schema: Schema): DocumentInstance<Schema>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect function
|
||||
*
|
||||
* @param uri Connection URI
|
||||
*/
|
||||
export function connect (uri: string): Promise<any>;
|
||||
/**
|
||||
* Supported types for document properties
|
||||
*/
|
||||
export type SchemaType = TypeOrArray<string | number | boolean | Date | Object>;
|
||||
|
||||
/**
|
||||
* Document property with options
|
||||
*/
|
||||
export interface SchemaTypeOptions<Type> {
|
||||
/**
|
||||
* Type of data
|
||||
*/
|
||||
type: SchemaTypeConstructor;
|
||||
/**
|
||||
* Default value
|
||||
*/
|
||||
default?: Type;
|
||||
/**
|
||||
* Min value (only with Number)
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Max value (only with Number)
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* Posible options
|
||||
*/
|
||||
choices?: Type[];
|
||||
/**
|
||||
* RegEx to match value
|
||||
*/
|
||||
match?: RegExp;
|
||||
/**
|
||||
* Validation function
|
||||
*
|
||||
* @param value Value taken
|
||||
* @returns true (validation ok) or false (validation wrong)
|
||||
*/
|
||||
validate?(value: Type): boolean;
|
||||
/**
|
||||
* Unique value (like ids)
|
||||
*/
|
||||
unique?: boolean;
|
||||
/**
|
||||
* Required field
|
||||
*/
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Document property type or options
|
||||
*/
|
||||
export type SchemaTypeExtended = SchemaTypeConstructor | SchemaTypeOptions<SchemaType>;
|
||||
|
||||
/**
|
||||
* Schema passed to Document.create()
|
||||
*/
|
||||
interface DocumentSchema {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaType;
|
||||
/**
|
||||
* Document id
|
||||
*/
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document instance
|
||||
*/
|
||||
declare class DocumentInstance<Schema extends DocumentSchema> {
|
||||
public save(): Promise<Schema>;
|
||||
public loadOne(): Promise<Schema>;
|
||||
public loadMany(): Promise<Schema>;
|
||||
public delete(): Promise<Schema>;
|
||||
public deleteOne(): Promise<Schema>;
|
||||
public deleteMany(): Promise<Schema>;
|
||||
public loadOneAndDelete(): Promise<Schema>;
|
||||
public count(): Promise<Schema>;
|
||||
public preValidate(): Promise<Schema>;
|
||||
public postValidate(): Promise<Schema>;
|
||||
public preSave(): Promise<Schema>;
|
||||
public postSave(): Promise<Schema>;
|
||||
public preDelete(): Promise<Schema>;
|
||||
public postDelete(): Promise<Schema>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Camo document
|
||||
*/
|
||||
declare export class Document {
|
||||
/**
|
||||
* Index signature
|
||||
*/
|
||||
[property: string]: SchemaTypeExtended | string | DocumentInstance<any>;
|
||||
/**
|
||||
* Static method to define the collection name
|
||||
*
|
||||
* @returns The collection name
|
||||
*/
|
||||
static collectionName(): string;
|
||||
/**
|
||||
* Creates a camo document instance
|
||||
*
|
||||
* @returns A camo document instance
|
||||
*/
|
||||
static create<Schema extends DocumentSchema>(schema: Schema): DocumentInstance<Schema>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect function
|
||||
*
|
||||
* @param uri Connection URI
|
||||
*/
|
||||
declare export function connect(uri: string): Promise<any>;
|
||||
|
||||
67
change-case/change-case.d.ts
vendored
67
change-case/change-case.d.ts
vendored
@ -3,37 +3,36 @@
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "change-case" {
|
||||
function dot(s: string): string;
|
||||
function dotCase(s: string): string;
|
||||
function swap(s: string): string;
|
||||
function swapCase(s: string): string;
|
||||
function path(s: string): string;
|
||||
function pathCase(s: string): string;
|
||||
function upper(s: string): string;
|
||||
function upperCase(s: string): string;
|
||||
function lower(s: string): string;
|
||||
function lowerCase(s: string): string;
|
||||
function camel(s: string): string;
|
||||
function camelCase(s: string): string;
|
||||
function snake(s: string): string;
|
||||
function snakeCase(s: string): string;
|
||||
function title(s: string): string;
|
||||
function titleCase(s: string): string;
|
||||
function param(s: string): string;
|
||||
function paramCase(s: string): string;
|
||||
function pascal(s: string): string;
|
||||
function pascalCase(s: string): string;
|
||||
function constant(s: string): string;
|
||||
function constantCase(s: string): string;
|
||||
function sentence(s: string): string;
|
||||
function sentenceCase(s: string): string;
|
||||
function isUpper(s: string): boolean;
|
||||
function isUpperCase(s: string): boolean;
|
||||
function isLower(s: string): boolean;
|
||||
function isLowerCase(s: string): boolean;
|
||||
function ucFirst(s: string): string;
|
||||
function upperCaseFirst(s: string): string;
|
||||
function lcFirst(s: string): string;
|
||||
function lowerCaseFirst(s: string): string;
|
||||
}
|
||||
|
||||
declare function dot(s: string): string;
|
||||
declare function dotCase(s: string): string;
|
||||
declare function swap(s: string): string;
|
||||
declare function swapCase(s: string): string;
|
||||
declare function path(s: string): string;
|
||||
declare function pathCase(s: string): string;
|
||||
declare function upper(s: string): string;
|
||||
declare function upperCase(s: string): string;
|
||||
declare function lower(s: string): string;
|
||||
declare function lowerCase(s: string): string;
|
||||
declare function camel(s: string): string;
|
||||
declare function camelCase(s: string): string;
|
||||
declare function snake(s: string): string;
|
||||
declare function snakeCase(s: string): string;
|
||||
declare function title(s: string): string;
|
||||
declare function titleCase(s: string): string;
|
||||
declare function param(s: string): string;
|
||||
declare function paramCase(s: string): string;
|
||||
declare function pascal(s: string): string;
|
||||
declare function pascalCase(s: string): string;
|
||||
declare function constant(s: string): string;
|
||||
declare function constantCase(s: string): string;
|
||||
declare function sentence(s: string): string;
|
||||
declare function sentenceCase(s: string): string;
|
||||
declare function isUpper(s: string): boolean;
|
||||
declare function isUpperCase(s: string): boolean;
|
||||
declare function isLower(s: string): boolean;
|
||||
declare function isLowerCase(s: string): boolean;
|
||||
declare function ucFirst(s: string): string;
|
||||
declare function upperCaseFirst(s: string): string;
|
||||
declare function lcFirst(s: string): string;
|
||||
declare function lowerCaseFirst(s: string): string;
|
||||
|
||||
69
checksum/checksum.d.ts
vendored
69
checksum/checksum.d.ts
vendored
@ -3,42 +3,41 @@
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "checksum" {
|
||||
|
||||
namespace checksum {
|
||||
/**
|
||||
* Options object for all functions
|
||||
*/
|
||||
interface ChecksumOptions {
|
||||
/**
|
||||
* Algorithm to use, default 'sha1'
|
||||
* Can be 'sha1' or 'md5' (see module 'crypto').
|
||||
*/
|
||||
algorithm?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, callback: (error: Error, hash: string) => void): void;
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param options Options object to indicate hash algo
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, options: ChecksumOptions, callback: (error: Error, hash: string) => void): void;
|
||||
}
|
||||
declare namespace checksum {
|
||||
/**
|
||||
* Options object for all functions
|
||||
*/
|
||||
interface ChecksumOptions {
|
||||
/**
|
||||
* Algorithm to use, default 'sha1'
|
||||
* Can be 'sha1' or 'md5' (see module 'crypto').
|
||||
*/
|
||||
algorithm?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a checksum for the given value
|
||||
* @param value Any value
|
||||
* @param options Allows to set the algorithm
|
||||
* @returns Checksum
|
||||
*/
|
||||
function checksum(value: any, options?: checksum.ChecksumOptions): string;
|
||||
|
||||
export = checksum;
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, callback: (error: Error, hash: string) => void): void;
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param options Options object to indicate hash algo
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, options: ChecksumOptions, callback: (error: Error, hash: string) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a checksum for the given value
|
||||
* @param value Any value
|
||||
* @param options Allows to set the algorithm
|
||||
* @returns Checksum
|
||||
*/
|
||||
declare function checksum(value: any, options?: checksum.ChecksumOptions): string;
|
||||
|
||||
export = checksum;
|
||||
|
||||
13
circular-json/circular-json.d.ts
vendored
13
circular-json/circular-json.d.ts
vendored
@ -3,13 +3,12 @@
|
||||
// Definitions by: Jonathan Pevarnek <https://github.com/jpevarnek/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'circular-json' {
|
||||
interface ICircularJSON extends JSON {
|
||||
|
||||
interface ICircularJSON extends JSON {
|
||||
parse(text: string, reviver?: (key: any, value: any) => any): any;
|
||||
stringify(value: any, replacer?: ((key: string, value: any) => any) | any[], space?: any, placeholder?: boolean): string;
|
||||
}
|
||||
|
||||
var CircularJSON: ICircularJSON;
|
||||
|
||||
export = CircularJSON;
|
||||
}
|
||||
|
||||
declare var CircularJSON: ICircularJSON;
|
||||
|
||||
export = CircularJSON;
|
||||
|
||||
135
clean-css/clean-css.d.ts
vendored
135
clean-css/clean-css.d.ts
vendored
@ -3,107 +3,106 @@
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'clean-css' {
|
||||
namespace CleanCSS {
|
||||
|
||||
declare namespace CleanCSS {
|
||||
interface Options {
|
||||
// Set to false to disable advanced optimizations - selector & property merging, reduction, etc.
|
||||
advanced?: boolean;
|
||||
// Set to false to disable advanced optimizations - selector & property merging, reduction, etc.
|
||||
advanced?: boolean;
|
||||
|
||||
// Set to false to disable aggressive merging of properties.
|
||||
aggressiveMerging?: boolean;
|
||||
// Set to false to disable aggressive merging of properties.
|
||||
aggressiveMerging?: boolean;
|
||||
|
||||
// Turns on benchmarking mode measuring time spent on cleaning up (run npm run bench to see example)
|
||||
benchmark?: boolean;
|
||||
// Turns on benchmarking mode measuring time spent on cleaning up (run npm run bench to see example)
|
||||
benchmark?: boolean;
|
||||
|
||||
// Enables compatibility mode
|
||||
compatibility?: Object;
|
||||
// Enables compatibility mode
|
||||
compatibility?: Object;
|
||||
|
||||
// Set to true to get minification statistics under stats property (see test/custom-test.js for examples)
|
||||
debug?: boolean;
|
||||
// Set to true to get minification statistics under stats property (see test/custom-test.js for examples)
|
||||
debug?: boolean;
|
||||
|
||||
// A hash of options for @import inliner, see test/protocol-imports-test.js for examples, or this comment for a proxy use case.
|
||||
inliner?: Object;
|
||||
// A hash of options for @import inliner, see test/protocol-imports-test.js for examples, or this comment for a proxy use case.
|
||||
inliner?: Object;
|
||||
|
||||
// Whether to keep line breaks (default is false)
|
||||
keepBreaks?: boolean;
|
||||
// Whether to keep line breaks (default is false)
|
||||
keepBreaks?: boolean;
|
||||
|
||||
// * for keeping all (default), 1 for keeping first one only, 0 for removing all
|
||||
keepSpecialComments?: string | number;
|
||||
// * for keeping all (default), 1 for keeping first one only, 0 for removing all
|
||||
keepSpecialComments?: string | number;
|
||||
|
||||
// Whether to merge @media at-rules (default is true)
|
||||
mediaMerging?: boolean;
|
||||
// Whether to merge @media at-rules (default is true)
|
||||
mediaMerging?: boolean;
|
||||
|
||||
// Whether to process @import rules
|
||||
processImport?: boolean;
|
||||
// Whether to process @import rules
|
||||
processImport?: boolean;
|
||||
|
||||
// A list of @import rules, can be ['all'] (default), ['local'], ['remote'], or a blacklisted path e.g. ['!fonts.googleapis.com']
|
||||
processImportFrom?: Array<string>;
|
||||
// A list of @import rules, can be ['all'] (default), ['local'], ['remote'], or a blacklisted path e.g. ['!fonts.googleapis.com']
|
||||
processImportFrom?: Array<string>;
|
||||
|
||||
// Set to false to skip URL rebasing
|
||||
rebase?: boolean;
|
||||
// Set to false to skip URL rebasing
|
||||
rebase?: boolean;
|
||||
|
||||
// Path to resolve relative @import rules and URLs
|
||||
relativeTo?: string;
|
||||
// Path to resolve relative @import rules and URLs
|
||||
relativeTo?: string;
|
||||
|
||||
// Set to false to disable restructuring in advanced optimizations
|
||||
restructuring?: boolean;
|
||||
// Set to false to disable restructuring in advanced optimizations
|
||||
restructuring?: boolean;
|
||||
|
||||
// Path to resolve absolute @import rules and rebase relative URLs
|
||||
root?: string;
|
||||
// Path to resolve absolute @import rules and rebase relative URLs
|
||||
root?: string;
|
||||
|
||||
// Rounding precision; defaults to 2; -1 disables rounding
|
||||
roundingPrecision?: number;
|
||||
// Rounding precision; defaults to 2; -1 disables rounding
|
||||
roundingPrecision?: number;
|
||||
|
||||
// Set to true to enable semantic merging mode which assumes BEM-like content (default is false as it's highly likely this will break your stylesheets - use with caution!)
|
||||
semanticMerging?: boolean;
|
||||
// Set to true to enable semantic merging mode which assumes BEM-like content (default is false as it's highly likely this will break your stylesheets - use with caution!)
|
||||
semanticMerging?: boolean;
|
||||
|
||||
// Set to false to skip shorthand compacting (default is true unless sourceMap is set when it's false)
|
||||
shorthandCompacting?: boolean;
|
||||
// Set to false to skip shorthand compacting (default is true unless sourceMap is set when it's false)
|
||||
shorthandCompacting?: boolean;
|
||||
|
||||
// Exposes source map under sourceMap property, e.g. new CleanCSS().minify(source).sourceMap (default is false) If input styles are a product of CSS preprocessor (Less, Sass) an input source map can be passed as a string.
|
||||
sourceMap?: boolean | string;
|
||||
// Exposes source map under sourceMap property, e.g. new CleanCSS().minify(source).sourceMap (default is false) If input styles are a product of CSS preprocessor (Less, Sass) an input source map can be passed as a string.
|
||||
sourceMap?: boolean | string;
|
||||
|
||||
// Set to true to inline sources inside a source map's sourcesContent field (defaults to false) It is also required to process inlined sources from input source maps.
|
||||
sourceMapInlineSources?: boolean;
|
||||
// Set to true to inline sources inside a source map's sourcesContent field (defaults to false) It is also required to process inlined sources from input source maps.
|
||||
sourceMapInlineSources?: boolean;
|
||||
|
||||
// Path to a folder or an output file to which rebase all URLs
|
||||
target?: string;
|
||||
// Path to a folder or an output file to which rebase all URLs
|
||||
target?: string;
|
||||
}
|
||||
|
||||
interface Output {
|
||||
// Optimized output CSS as a string
|
||||
styles: string;
|
||||
// Optimized output CSS as a string
|
||||
styles: string;
|
||||
|
||||
// Output source map (if requested with sourceMap option)
|
||||
sourceMap: string;
|
||||
// Output source map (if requested with sourceMap option)
|
||||
sourceMap: string;
|
||||
|
||||
// A list of errors raised
|
||||
errors: Array<string>;
|
||||
// A list of errors raised
|
||||
errors: Array<string>;
|
||||
|
||||
// A list of warnings raised
|
||||
warnings: Array<string>;
|
||||
// A list of warnings raised
|
||||
warnings: Array<string>;
|
||||
|
||||
// A hash of statistic information (if requested with debug option)
|
||||
stats: {
|
||||
// Original content size (after import inlining)
|
||||
originalSize: number;
|
||||
// A hash of statistic information (if requested with debug option)
|
||||
stats: {
|
||||
// Original content size (after import inlining)
|
||||
originalSize: number;
|
||||
|
||||
// Optimized content size
|
||||
minifiedSize: number;
|
||||
// Optimized content size
|
||||
minifiedSize: number;
|
||||
|
||||
// Time spent on optimizations
|
||||
timeSpent: number;
|
||||
// Time spent on optimizations
|
||||
timeSpent: number;
|
||||
|
||||
// A ratio of output size to input size (e.g. 25% if content was reduced from 100 bytes to 75 bytes)
|
||||
efficiency: number;
|
||||
};
|
||||
// A ratio of output size to input size (e.g. 25% if content was reduced from 100 bytes to 75 bytes)
|
||||
efficiency: number;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CleanCSS {
|
||||
declare class CleanCSS {
|
||||
constructor(options?: CleanCSS.Options);
|
||||
minify(sources: string | Array<string> | Object, callback?: (error: any, minified: CleanCSS.Output) => void): CleanCSS.Output;
|
||||
}
|
||||
|
||||
export = CleanCSS;
|
||||
}
|
||||
|
||||
export = CleanCSS;
|
||||
|
||||
115
cli/cli.d.ts
vendored
115
cli/cli.d.ts
vendored
@ -5,62 +5,61 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "cli" {
|
||||
interface CLI {
|
||||
app: string;
|
||||
version: string;
|
||||
argv: string[];
|
||||
argc: number;
|
||||
options: any;
|
||||
args: string[];
|
||||
command: string;
|
||||
width: number;
|
||||
option_width: number;
|
||||
native: any;
|
||||
output(message?: any, ...optionalParams: any[]): void;
|
||||
exit(code: number): void;
|
||||
no_color: boolean;
|
||||
enable(...plugins: string[]): CLI;
|
||||
disable(...plugins: string[]): CLI;
|
||||
setArgv(argv: string | Array<any>, keepArg0?: boolean): void;
|
||||
next(): string;
|
||||
parse(opts?: { [long: string]: { 0: string | boolean, 1: string, 2?: string, 3?: any } },
|
||||
commands?: { [name: string]: string } | string[]): any;
|
||||
autocompleteCommand(command: string): string;
|
||||
info(msg: string): void;
|
||||
error(msg: string): void;
|
||||
ok(msg: string): void;
|
||||
debug(msg: string): void;
|
||||
fatal(msg: string): void;
|
||||
setApp(appName: string, version: string): CLI;
|
||||
setApp(packageJson: string): CLI;
|
||||
parsePackageJson(path?: string): void;
|
||||
setUsage(usage: string): CLI;
|
||||
getUsage(code?: number): void;
|
||||
getOptError(expects: string, type: string): string;
|
||||
getValue(defaultVal: string, validateFunc: (value: any) => any, errMsg: string): void;
|
||||
getInt(defaultVal: number): number;
|
||||
getDate(defaultVal: Date): Date;
|
||||
getFloat(defaultVal: number): number;
|
||||
getUrl(defautltVal: string, identifier?: string): string;
|
||||
getEmail(defaultVal: string): string;
|
||||
getIp(defaultVal: string): string;
|
||||
getPath(defaultVal: string, identifier?: string): string;
|
||||
getArrayValue<T>(arr: T[], defaultVal: T): T;
|
||||
withStdin(callback: (data: string) => void): void;
|
||||
withStdin(encoding: string, callback: (text: string) => void): void;
|
||||
withStdinLines(callback: (lines: string[], newline: string) => void): void;
|
||||
withInput(file: string, encoding: string, callback: (line: string, newline: string, eof: boolean) => void): void;
|
||||
withInput(file: string, callback: (line: string, newline: string, eof: boolean) => void): void;
|
||||
withInput(callback: (line: string, newline: string, eof: boolean) => void): void;
|
||||
toType(object: any): string;
|
||||
daemon(arg: string, callback: () => void): void;
|
||||
main(callback: (args: string[], options: any) => void): void;
|
||||
createServer(...args: any[]): any;
|
||||
exec(cmd: string, callback?: (lines: string[]) => void, errback?: (err: any, stdout: string) => void): void;
|
||||
progress(progress: number, decimals?: number, stream?: NodeJS.WritableStream): void;
|
||||
spinner(prefix?: string | boolean, end?: boolean, stream?: NodeJS.WritableStream): void;
|
||||
}
|
||||
const cli: CLI;
|
||||
export = cli;
|
||||
|
||||
interface CLI {
|
||||
app: string;
|
||||
version: string;
|
||||
argv: string[];
|
||||
argc: number;
|
||||
options: any;
|
||||
args: string[];
|
||||
command: string;
|
||||
width: number;
|
||||
option_width: number;
|
||||
native: any;
|
||||
output(message?: any, ...optionalParams: any[]): void;
|
||||
exit(code: number): void;
|
||||
no_color: boolean;
|
||||
enable(...plugins: string[]): CLI;
|
||||
disable(...plugins: string[]): CLI;
|
||||
setArgv(argv: string | Array<any>, keepArg0?: boolean): void;
|
||||
next(): string;
|
||||
parse(opts?: { [long: string]: { 0: string | boolean, 1: string, 2?: string, 3?: any } },
|
||||
commands?: { [name: string]: string } | string[]): any;
|
||||
autocompleteCommand(command: string): string;
|
||||
info(msg: string): void;
|
||||
error(msg: string): void;
|
||||
ok(msg: string): void;
|
||||
debug(msg: string): void;
|
||||
fatal(msg: string): void;
|
||||
setApp(appName: string, version: string): CLI;
|
||||
setApp(packageJson: string): CLI;
|
||||
parsePackageJson(path?: string): void;
|
||||
setUsage(usage: string): CLI;
|
||||
getUsage(code?: number): void;
|
||||
getOptError(expects: string, type: string): string;
|
||||
getValue(defaultVal: string, validateFunc: (value: any) => any, errMsg: string): void;
|
||||
getInt(defaultVal: number): number;
|
||||
getDate(defaultVal: Date): Date;
|
||||
getFloat(defaultVal: number): number;
|
||||
getUrl(defautltVal: string, identifier?: string): string;
|
||||
getEmail(defaultVal: string): string;
|
||||
getIp(defaultVal: string): string;
|
||||
getPath(defaultVal: string, identifier?: string): string;
|
||||
getArrayValue<T>(arr: T[], defaultVal: T): T;
|
||||
withStdin(callback: (data: string) => void): void;
|
||||
withStdin(encoding: string, callback: (text: string) => void): void;
|
||||
withStdinLines(callback: (lines: string[], newline: string) => void): void;
|
||||
withInput(file: string, encoding: string, callback: (line: string, newline: string, eof: boolean) => void): void;
|
||||
withInput(file: string, callback: (line: string, newline: string, eof: boolean) => void): void;
|
||||
withInput(callback: (line: string, newline: string, eof: boolean) => void): void;
|
||||
toType(object: any): string;
|
||||
daemon(arg: string, callback: () => void): void;
|
||||
main(callback: (args: string[], options: any) => void): void;
|
||||
createServer(...args: any[]): any;
|
||||
exec(cmd: string, callback?: (lines: string[]) => void, errback?: (err: any, stdout: string) => void): void;
|
||||
progress(progress: number, decimals?: number, stream?: NodeJS.WritableStream): void;
|
||||
spinner(prefix?: string | boolean, end?: boolean, stream?: NodeJS.WritableStream): void;
|
||||
}
|
||||
declare const cli: CLI;
|
||||
export = cli;
|
||||
|
||||
27
clone/clone.d.ts
vendored
27
clone/clone.d.ts
vendored
@ -6,20 +6,19 @@
|
||||
/**
|
||||
* See clone JS source for API docs
|
||||
*/
|
||||
declare module "clone" {
|
||||
|
||||
/**
|
||||
* @param val the value that you want to clone, any type allowed
|
||||
* @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj.
|
||||
* @param depth to wich the object is to be cloned (optional, defaults to infinity)
|
||||
*/
|
||||
declare function clone<T>(val: T, circular?: boolean, depth?: number): T;
|
||||
|
||||
declare namespace clone {
|
||||
/**
|
||||
* @param val the value that you want to clone, any type allowed
|
||||
* @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj.
|
||||
* @param depth to wich the object is to be cloned (optional, defaults to infinity)
|
||||
* @param obj the object that you want to clone
|
||||
*/
|
||||
function clone<T>(val: T, circular?: boolean, depth?: number): T;
|
||||
|
||||
namespace clone {
|
||||
/**
|
||||
* @param obj the object that you want to clone
|
||||
*/
|
||||
function clonePrototype<T>(obj: T): T;
|
||||
}
|
||||
|
||||
export = clone
|
||||
function clonePrototype<T>(obj: T): T;
|
||||
}
|
||||
|
||||
export = clone
|
||||
|
||||
11
closure-compiler/closure-compiler.d.ts
vendored
11
closure-compiler/closure-compiler.d.ts
vendored
@ -3,9 +3,8 @@
|
||||
// Definitions by: Martin Probst <https://github.com/mprobst>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'closure-compiler' {
|
||||
type Callback = (err: Error, stdout: string, stderr: string) => any;
|
||||
function compile(src: string, callback: Callback): void;
|
||||
function compile(src: string, options: {[k: string]: string | string[]},
|
||||
callback: Callback): void;
|
||||
}
|
||||
|
||||
type Callback = (err: Error, stdout: string, stderr: string) => any;
|
||||
declare function compile(src: string, callback: Callback): void;
|
||||
declare function compile(src: string, options: { [k: string]: string | string[] },
|
||||
callback: Callback): void;
|
||||
|
||||
44
coffeeify/coffeeify.d.ts
vendored
44
coffeeify/coffeeify.d.ts
vendored
@ -5,33 +5,31 @@
|
||||
|
||||
/// <reference path="../through/through.d.ts" />
|
||||
|
||||
declare module "coffeeify" {
|
||||
import through = require('through');
|
||||
|
||||
namespace coffeeify {
|
||||
interface Coffeeify {
|
||||
isCoffee(file: string): boolean;
|
||||
isLiterate(file: string): boolean;
|
||||
sourceMap: boolean;
|
||||
compile(file: string, data: string, callback: Callback): void;
|
||||
(file: string): through.ThroughStream;
|
||||
}
|
||||
import through = require('through');
|
||||
|
||||
interface Callback {
|
||||
(error: ParseError, compiled: string): void;
|
||||
}
|
||||
|
||||
interface ParseError extends SyntaxError {
|
||||
new(error: any, src: string, file: string): ParseError;
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
annotated: string;
|
||||
}
|
||||
declare namespace coffeeify {
|
||||
interface Coffeeify {
|
||||
isCoffee(file: string): boolean;
|
||||
isLiterate(file: string): boolean;
|
||||
sourceMap: boolean;
|
||||
compile(file: string, data: string, callback: Callback): void;
|
||||
(file: string): through.ThroughStream;
|
||||
}
|
||||
|
||||
var coffeeify: coffeeify.Coffeeify;
|
||||
interface Callback {
|
||||
(error: ParseError, compiled: string): void;
|
||||
}
|
||||
|
||||
export = coffeeify;
|
||||
interface ParseError extends SyntaxError {
|
||||
new (error: any, src: string, file: string): ParseError;
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
annotated: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var coffeeify: coffeeify.Coffeeify;
|
||||
|
||||
export = coffeeify;
|
||||
|
||||
7
compare-version/compare-version.d.ts
vendored
7
compare-version/compare-version.d.ts
vendored
@ -4,8 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module 'compare-version' {
|
||||
function compare(a: string, b: string): number;
|
||||
|
||||
export = compare;
|
||||
}
|
||||
declare function compare(a: string, b: string): number;
|
||||
|
||||
export = compare;
|
||||
|
||||
389
complex/complex.d.ts
vendored
389
complex/complex.d.ts
vendored
@ -3,236 +3,235 @@
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'complex' {
|
||||
export default class Complex {
|
||||
/**
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
constructor(real: number, im: number);
|
||||
|
||||
/**
|
||||
* A in line function like Number.from.
|
||||
*
|
||||
* Examples:
|
||||
* var z = Complex.from(2, 4);
|
||||
* var z = Complex.from(5);
|
||||
* var z = Complex.from('2+5i');
|
||||
*
|
||||
* @param real A string representation of the number, for example 1+4i
|
||||
*/
|
||||
static from(real: string): Complex;
|
||||
declare export default class Complex {
|
||||
/**
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
constructor(real: number, im: number);
|
||||
|
||||
/**
|
||||
* A in line function like Number.from.
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
static from(real: number, im?: number): Complex;
|
||||
/**
|
||||
* A in line function like Number.from.
|
||||
*
|
||||
* Examples:
|
||||
* var z = Complex.from(2, 4);
|
||||
* var z = Complex.from(5);
|
||||
* var z = Complex.from('2+5i');
|
||||
*
|
||||
* @param real A string representation of the number, for example 1+4i
|
||||
*/
|
||||
static from(real: string): Complex;
|
||||
|
||||
/**
|
||||
* Creates a complex instance from a polar representation
|
||||
* @param r The radius/magnitude of the number
|
||||
* @param phi The angle/phase of the number
|
||||
*/
|
||||
static fromPolar(r: number, phi: number): Complex;
|
||||
/**
|
||||
* A in line function like Number.from.
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
static from(real: number, im?: number): Complex;
|
||||
|
||||
/**
|
||||
* A instance of the imaginary unit
|
||||
*/
|
||||
static i: Complex;
|
||||
/**
|
||||
* Creates a complex instance from a polar representation
|
||||
* @param r The radius/magnitude of the number
|
||||
* @param phi The angle/phase of the number
|
||||
*/
|
||||
static fromPolar(r: number, phi: number): Complex;
|
||||
|
||||
/**
|
||||
* A instance for the real number
|
||||
*/
|
||||
static one: Complex;
|
||||
/**
|
||||
* A instance of the imaginary unit
|
||||
*/
|
||||
static i: Complex;
|
||||
|
||||
/**
|
||||
* Set the real and imaginary properties a and b from a + bi.
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
fromRect(real: number, im: number): Complex;
|
||||
/**
|
||||
* A instance for the real number
|
||||
*/
|
||||
static one: Complex;
|
||||
|
||||
/**
|
||||
* Set the a and b in a + bi from a polar representation.
|
||||
* @param r The radius/magnitude of the number
|
||||
* @param phi The angle/phase of the number
|
||||
*/
|
||||
fromPolar(r: number, phi: number): Complex;
|
||||
/**
|
||||
* Set the real and imaginary properties a and b from a + bi.
|
||||
* @param real The real part of the number
|
||||
* @param im The imaginary part of the number
|
||||
*/
|
||||
fromRect(real: number, im: number): Complex;
|
||||
|
||||
/**
|
||||
* Set the precision of the numbers. Similar to Number.prototype.toPrecision. Useful before printing the number with the toString method.
|
||||
* @param k An integer specifying the number of significant digits
|
||||
*/
|
||||
toPrecision(k: number): Complex;
|
||||
/**
|
||||
* Set the a and b in a + bi from a polar representation.
|
||||
* @param r The radius/magnitude of the number
|
||||
* @param phi The angle/phase of the number
|
||||
*/
|
||||
fromPolar(r: number, phi: number): Complex;
|
||||
|
||||
/**
|
||||
* Format a number using fixed-point notation. Similar to Number.prototype.toFixed. Useful before printing the number with the toString method.
|
||||
* @param k The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0.
|
||||
*/
|
||||
toFixed(k: number): Complex;
|
||||
/**
|
||||
* Set the precision of the numbers. Similar to Number.prototype.toPrecision. Useful before printing the number with the toString method.
|
||||
* @param k An integer specifying the number of significant digits
|
||||
*/
|
||||
toPrecision(k: number): Complex;
|
||||
|
||||
/**
|
||||
* Finalize the instance. The number will not change and any other method call will return a new instance. Very useful when a complex instance should stay constant. For example the Complex.i variable is a finalized instance.
|
||||
*/
|
||||
finalize(): Complex;
|
||||
/**
|
||||
* Format a number using fixed-point notation. Similar to Number.prototype.toFixed. Useful before printing the number with the toString method.
|
||||
* @param k The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive, and implementations may optionally support a larger range of values. If this argument is omitted, it is treated as 0.
|
||||
*/
|
||||
toFixed(k: number): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the magnitude of the complex number
|
||||
*/
|
||||
magnitude(): number;
|
||||
/**
|
||||
* Finalize the instance. The number will not change and any other method call will return a new instance. Very useful when a complex instance should stay constant. For example the Complex.i variable is a finalized instance.
|
||||
*/
|
||||
finalize(): Complex;
|
||||
|
||||
/**
|
||||
* Alias for magnitude(). Calculate the magnitude of the complex number.
|
||||
*/
|
||||
abs(): number;
|
||||
/**
|
||||
* Calculate the magnitude of the complex number
|
||||
*/
|
||||
magnitude(): number;
|
||||
|
||||
/**
|
||||
* Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
angle(): number;
|
||||
/**
|
||||
* Alias for magnitude(). Calculate the magnitude of the complex number.
|
||||
*/
|
||||
abs(): number;
|
||||
|
||||
/**
|
||||
* Alias for angle(). Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
arg(): number;
|
||||
/**
|
||||
* Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
angle(): number;
|
||||
|
||||
/**
|
||||
* Alias for angle(). Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
phase(): number;
|
||||
/**
|
||||
* Alias for angle(). Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
arg(): number;
|
||||
|
||||
/**
|
||||
* Calculate the conjugate of the complex number (multiplies the imaginary part with -1)
|
||||
*/
|
||||
conjugate(): Complex;
|
||||
/**
|
||||
* Alias for angle(). Calculate the angle with respect to the real axis, in radians.
|
||||
*/
|
||||
phase(): number;
|
||||
|
||||
/**
|
||||
* Negate the number (multiplies both the real and imaginary part with -1)
|
||||
*/
|
||||
negate(): Complex;
|
||||
/**
|
||||
* Calculate the conjugate of the complex number (multiplies the imaginary part with -1)
|
||||
*/
|
||||
conjugate(): Complex;
|
||||
|
||||
/**
|
||||
* Multiply the number with a real or complex number
|
||||
* @param z The number to multiply with
|
||||
*/
|
||||
multiply(z: number | Complex): Complex;
|
||||
/**
|
||||
* Negate the number (multiplies both the real and imaginary part with -1)
|
||||
*/
|
||||
negate(): Complex;
|
||||
|
||||
/**
|
||||
* Alias for multiply(). Multiply the number with a real or complex number
|
||||
* @param z The number to multiply with
|
||||
*/
|
||||
mult(z: number | Complex): Complex;
|
||||
/**
|
||||
* Multiply the number with a real or complex number
|
||||
* @param z The number to multiply with
|
||||
*/
|
||||
multiply(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Divide the number by a real or complex number
|
||||
* @param z The number to divide by
|
||||
*/
|
||||
divide(z: number | Complex): Complex;
|
||||
/**
|
||||
* Alias for multiply(). Multiply the number with a real or complex number
|
||||
* @param z The number to multiply with
|
||||
*/
|
||||
mult(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Alias for divide(). Divide the number by a real or complex number
|
||||
* @param z The number to divide by
|
||||
*/
|
||||
div(z: number | Complex): Complex;
|
||||
/**
|
||||
* Divide the number by a real or complex number
|
||||
* @param z The number to divide by
|
||||
*/
|
||||
divide(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Add a real or complex number
|
||||
* @param z The number to add
|
||||
*/
|
||||
add(z: number | Complex): Complex;
|
||||
/**
|
||||
* Alias for divide(). Divide the number by a real or complex number
|
||||
* @param z The number to divide by
|
||||
*/
|
||||
div(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Subtract a real or complex number
|
||||
* @param z The number to subtract
|
||||
*/
|
||||
subtract(z: number | Complex): Complex;
|
||||
/**
|
||||
* Add a real or complex number
|
||||
* @param z The number to add
|
||||
*/
|
||||
add(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Alias for subtract(). Subtract a real or complex number
|
||||
* @param z The number to subtract
|
||||
*/
|
||||
sub(z: number | Complex): Complex;
|
||||
/**
|
||||
* Subtract a real or complex number
|
||||
* @param z The number to subtract
|
||||
*/
|
||||
subtract(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Return the base to the exponent
|
||||
* @param z The exponent
|
||||
*/
|
||||
pow(z: number | Complex): Complex;
|
||||
/**
|
||||
* Alias for subtract(). Subtract a real or complex number
|
||||
* @param z The number to subtract
|
||||
*/
|
||||
sub(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Return the square root
|
||||
*/
|
||||
sqrt(): Complex;
|
||||
/**
|
||||
* Return the base to the exponent
|
||||
* @param z The exponent
|
||||
*/
|
||||
pow(z: number | Complex): Complex;
|
||||
|
||||
/**
|
||||
* Return the natural logarithm (base E)
|
||||
* @param k The actual answer has a multiplicity (ln(z) = ln|z| + arg(z)) where arg(z) can return the same for different angles (every 2*pi), with this argument you can define which answer is required
|
||||
*/
|
||||
log(k?: number): Complex;
|
||||
/**
|
||||
* Return the square root
|
||||
*/
|
||||
sqrt(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the e^z where the base is E and the exponential the complex number.
|
||||
*/
|
||||
exp(): Complex;
|
||||
/**
|
||||
* Return the natural logarithm (base E)
|
||||
* @param k The actual answer has a multiplicity (ln(z) = ln|z| + arg(z)) where arg(z) can return the same for different angles (every 2*pi), with this argument you can define which answer is required
|
||||
*/
|
||||
log(k?: number): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the sine of the complex number
|
||||
*/
|
||||
sin(): Complex;
|
||||
/**
|
||||
* Calculate the e^z where the base is E and the exponential the complex number.
|
||||
*/
|
||||
exp(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the cosine of the complex number
|
||||
*/
|
||||
cos(): Complex;
|
||||
/**
|
||||
* Calculate the sine of the complex number
|
||||
*/
|
||||
sin(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the tangent of the complex number
|
||||
*/
|
||||
tan(): Complex;
|
||||
/**
|
||||
* Calculate the cosine of the complex number
|
||||
*/
|
||||
cos(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the hyperbolic sine of the complex number
|
||||
*/
|
||||
sinh(): Complex
|
||||
/**
|
||||
* Calculate the tangent of the complex number
|
||||
*/
|
||||
tan(): Complex;
|
||||
|
||||
/**
|
||||
* Calculate the hyperbolic cosine of the complex number
|
||||
*/
|
||||
cosh(): Complex
|
||||
/**
|
||||
* Calculate the hyperbolic sine of the complex number
|
||||
*/
|
||||
sinh(): Complex
|
||||
|
||||
/**
|
||||
* Calculate the hyperbolic tangent of the complex number
|
||||
*/
|
||||
tanh(): Complex
|
||||
/**
|
||||
* Calculate the hyperbolic cosine of the complex number
|
||||
*/
|
||||
cosh(): Complex
|
||||
|
||||
/**
|
||||
* Return a new Complex instance with the same real and imaginary properties
|
||||
*/
|
||||
clone(): Complex;
|
||||
/**
|
||||
* Calculate the hyperbolic tangent of the complex number
|
||||
*/
|
||||
tanh(): Complex
|
||||
|
||||
/**
|
||||
* Return a string representation of the complex number
|
||||
*
|
||||
* Examples:
|
||||
* new Complex(1, 2).toString(); // 1+2i
|
||||
* new Complex(0, 1).toString(); // i
|
||||
* new Complex(4, 0).toString(); // 4
|
||||
* new Complex(1, 1).toString(); // 1+i
|
||||
* 'my Complex Number is: ' + (new Complex(3, 5)); // 'my Complex Number is: 3+5i
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Return a new Complex instance with the same real and imaginary properties
|
||||
*/
|
||||
clone(): Complex;
|
||||
|
||||
/**
|
||||
* Check if the real and imaginary components are equal to the passed in compelex components.
|
||||
*
|
||||
* Examples:
|
||||
* new Complex(1, 4).equals(new Complex(1, 4)); // true
|
||||
* new Complex(1, 4).equals(new Complex(1, 3)); // false
|
||||
*
|
||||
* @param z The complex number to compare with
|
||||
*/
|
||||
equals(z: number | Complex): boolean;
|
||||
}
|
||||
/**
|
||||
* Return a string representation of the complex number
|
||||
*
|
||||
* Examples:
|
||||
* new Complex(1, 2).toString(); // 1+2i
|
||||
* new Complex(0, 1).toString(); // i
|
||||
* new Complex(4, 0).toString(); // 4
|
||||
* new Complex(1, 1).toString(); // 1+i
|
||||
* 'my Complex Number is: ' + (new Complex(3, 5)); // 'my Complex Number is: 3+5i
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Check if the real and imaginary components are equal to the passed in compelex components.
|
||||
*
|
||||
* Examples:
|
||||
* new Complex(1, 4).equals(new Complex(1, 4)); // true
|
||||
* new Complex(1, 4).equals(new Complex(1, 3)); // false
|
||||
*
|
||||
* @param z The complex number to compare with
|
||||
*/
|
||||
equals(z: number | Complex): boolean;
|
||||
}
|
||||
|
||||
47
compose-function/compose-function.d.ts
vendored
47
compose-function/compose-function.d.ts
vendored
@ -3,29 +3,28 @@
|
||||
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "compose-function" {
|
||||
// Hardcoded signatures for 2-4 parameters
|
||||
function f<A, B, C>(
|
||||
f1: (b: B) => C,
|
||||
f2: (a: A) => B
|
||||
): (a: A) => C
|
||||
function f<A, B, C, D>(
|
||||
f1: (b: C) => D,
|
||||
f2: (a: B) => C,
|
||||
f3: (a: A) => B
|
||||
): (a: A) => D
|
||||
function f<A, B, C, D, E>(
|
||||
f1: (b: D) => E,
|
||||
f2: (a: C) => D,
|
||||
f3: (a: B) => C,
|
||||
f4: (a: A) => B
|
||||
): (a: A) => E
|
||||
|
||||
// Minimal typing for more than 4 parameters
|
||||
function f<Result>(
|
||||
f1: (a: any) => Result,
|
||||
...functions: Function[]
|
||||
): (a: any) => Result
|
||||
// Hardcoded signatures for 2-4 parameters
|
||||
declare function f<A, B, C>(
|
||||
f1: (b: B) => C,
|
||||
f2: (a: A) => B
|
||||
): (a: A) => C
|
||||
declare function f<A, B, C, D>(
|
||||
f1: (b: C) => D,
|
||||
f2: (a: B) => C,
|
||||
f3: (a: A) => B
|
||||
): (a: A) => D
|
||||
declare function f<A, B, C, D, E>(
|
||||
f1: (b: D) => E,
|
||||
f2: (a: C) => D,
|
||||
f3: (a: B) => C,
|
||||
f4: (a: A) => B
|
||||
): (a: A) => E
|
||||
|
||||
export = f;
|
||||
}
|
||||
// Minimal typing for more than 4 parameters
|
||||
declare function f<Result>(
|
||||
f1: (a: any) => Result,
|
||||
...functions: Function[]
|
||||
): (a: any) => Result
|
||||
|
||||
export = f;
|
||||
|
||||
19
compression/compression.d.ts
vendored
19
compression/compression.d.ts
vendored
@ -5,16 +5,15 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "compression" {
|
||||
import express = require('express');
|
||||
|
||||
namespace e {
|
||||
interface CompressionOptions {
|
||||
threshold?: number;
|
||||
filter?: Function;
|
||||
}
|
||||
import express = require('express');
|
||||
|
||||
declare namespace e {
|
||||
interface CompressionOptions {
|
||||
threshold?: number;
|
||||
filter?: Function;
|
||||
}
|
||||
|
||||
function e(options?: e.CompressionOptions): express.RequestHandler;
|
||||
export = e;
|
||||
}
|
||||
|
||||
declare function e(options?: e.CompressionOptions): express.RequestHandler;
|
||||
export = e;
|
||||
|
||||
63
confidence/confidence.d.ts
vendored
63
confidence/confidence.d.ts
vendored
@ -9,40 +9,39 @@
|
||||
* serving values based on object path ('/a/b/c' translates to a.b.c). In addition,
|
||||
* confidence defines special $-prefixed keys used to filter values for a given criteria.
|
||||
*/
|
||||
declare module 'confidence' {
|
||||
|
||||
export class Store {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {any} document - the configuration document for this document store
|
||||
*/
|
||||
constructor(document?: any);
|
||||
|
||||
/**
|
||||
* Validates the provided configuration, clears any existing configuration, then loads the configuration where:
|
||||
* @param {any} document - an object containing a confidence configuration object generated from a parsed JSON document. If the document is invlaid, will throw an error.
|
||||
*/
|
||||
load(document: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves a value from the configuration document after applying the provided criteria where:
|
||||
* @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document.
|
||||
* @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}.
|
||||
*
|
||||
* @return {any} Returns the value found after applying the criteria. If the key is invalid or not found, returns undefined.
|
||||
*/
|
||||
get(key: string, criteria?: any): any;
|
||||
declare export class Store {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {any} document - the configuration document for this document store
|
||||
*/
|
||||
constructor(document?: any);
|
||||
|
||||
/**
|
||||
* Validates the provided configuration, clears any existing configuration, then loads the configuration where:
|
||||
* @param {any} document - an object containing a confidence configuration object generated from a parsed JSON document. If the document is invlaid, will throw an error.
|
||||
*/
|
||||
load(document: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the metadata (if any) from the configuration document after applying the provided criteria where:
|
||||
* @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document.
|
||||
* @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}.
|
||||
*
|
||||
* @return {any} Returns the metadata found after applying the criteria. If the key is invalid or not found, or if no metadata is available, returns undefined.
|
||||
*/
|
||||
meta(key: string, criteria?: any): any;
|
||||
}
|
||||
/**
|
||||
* Retrieves a value from the configuration document after applying the provided criteria where:
|
||||
* @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document.
|
||||
* @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}.
|
||||
*
|
||||
* @return {any} Returns the value found after applying the criteria. If the key is invalid or not found, returns undefined.
|
||||
*/
|
||||
get(key: string, criteria?: any): any;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the metadata (if any) from the configuration document after applying the provided criteria where:
|
||||
* @param {string} key - the requested key path. All keys must begin with '/'. '/' returns the the entire document.
|
||||
* @param {any} criteria - optional object used as criteria for applying filters in the configuration document. Defaults to {}.
|
||||
*
|
||||
* @return {any} Returns the metadata found after applying the criteria. If the key is invalid or not found, or if no metadata is available, returns undefined.
|
||||
*/
|
||||
meta(key: string, criteria?: any): any;
|
||||
}
|
||||
|
||||
53
config/config.d.ts
vendored
53
config/config.d.ts
vendored
@ -3,42 +3,41 @@
|
||||
// Definitions by: Roman Korneev <https://github.com/RWander>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "config" {
|
||||
|
||||
var c: c.IConfig;
|
||||
|
||||
namespace c {
|
||||
declare var c: c.IConfig;
|
||||
|
||||
// see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities
|
||||
interface IUtil {
|
||||
// Extend an object (and any object it contains) with one or more objects (and objects contained in them).
|
||||
extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any;
|
||||
declare namespace c {
|
||||
|
||||
// Return a deep copy of the specified object.
|
||||
cloneDeep(copyFrom: any, depth?: number): any;
|
||||
// see https://github.com/lorenwest/node-config/wiki/Using-Config-Utilities
|
||||
interface IUtil {
|
||||
// Extend an object (and any object it contains) with one or more objects (and objects contained in them).
|
||||
extendDeep(mergeInto: any, mergeFrom: any, depth?: number): any;
|
||||
|
||||
// Return true if two objects have equal contents.
|
||||
equalsDeep(object1: any, object2: any, dept?: number): boolean;
|
||||
// Return a deep copy of the specified object.
|
||||
cloneDeep(copyFrom: any, depth?: number): any;
|
||||
|
||||
// Returns an object containing all elements that differ between two objects.
|
||||
diffDeep(object1: any, object2: any, depth?: number): any;
|
||||
// Return true if two objects have equal contents.
|
||||
equalsDeep(object1: any, object2: any, dept?: number): boolean;
|
||||
|
||||
// Make a javascript object property immutable (assuring it cannot be changed from the current value).
|
||||
makeImmutable(object: any, propertyName?: string, propertyValue?: string): any;
|
||||
// Returns an object containing all elements that differ between two objects.
|
||||
diffDeep(object1: any, object2: any, depth?: number): any;
|
||||
|
||||
// Make an object property hidden so it doesn't appear when enumerating elements of the object.
|
||||
makeHidden(object: any, propertyName: string, propertyValue?: string): any;
|
||||
// Make a javascript object property immutable (assuring it cannot be changed from the current value).
|
||||
makeImmutable(object: any, propertyName?: string, propertyValue?: string): any;
|
||||
|
||||
// Get the current value of a config environment variable
|
||||
getEnv(varName: string): string;
|
||||
}
|
||||
// Make an object property hidden so it doesn't appear when enumerating elements of the object.
|
||||
makeHidden(object: any, propertyName: string, propertyValue?: string): any;
|
||||
|
||||
interface IConfig {
|
||||
get<T>(setting: string): T;
|
||||
has(setting: string): boolean;
|
||||
util: IUtil;
|
||||
}
|
||||
}
|
||||
// Get the current value of a config environment variable
|
||||
getEnv(varName: string): string;
|
||||
}
|
||||
|
||||
export = c;
|
||||
interface IConfig {
|
||||
get<T>(setting: string): T;
|
||||
has(setting: string): boolean;
|
||||
util: IUtil;
|
||||
}
|
||||
}
|
||||
|
||||
export = c;
|
||||
|
||||
57
configstore/configstore.d.ts
vendored
57
configstore/configstore.d.ts
vendored
@ -3,36 +3,35 @@
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'configstore' {
|
||||
/*
|
||||
Set an item
|
||||
*/
|
||||
export function set(key: string, val: any): void;
|
||||
|
||||
/*
|
||||
Get an item
|
||||
*/
|
||||
export function get(key: string): any;
|
||||
/*
|
||||
Set an item
|
||||
*/
|
||||
declare export function set(key: string, val: any): void;
|
||||
|
||||
/*
|
||||
Delete an item
|
||||
*/
|
||||
export function del(key: string): void;
|
||||
/*
|
||||
Get an item
|
||||
*/
|
||||
declare export function get(key: string): any;
|
||||
|
||||
/*
|
||||
Get all items as an object or replace the current config with an object:
|
||||
/*
|
||||
Delete an item
|
||||
*/
|
||||
declare export function del(key: string): void;
|
||||
|
||||
conf.all = {
|
||||
hello: 'world'
|
||||
};
|
||||
*/
|
||||
export var all: Object;
|
||||
/*
|
||||
Get the item count
|
||||
*/
|
||||
export var size: number;
|
||||
/*
|
||||
Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.
|
||||
*/
|
||||
export var path: string;
|
||||
}
|
||||
/*
|
||||
Get all items as an object or replace the current config with an object:
|
||||
|
||||
conf.all = {
|
||||
hello: 'world'
|
||||
};
|
||||
*/
|
||||
declare export var all: Object;
|
||||
/*
|
||||
Get the item count
|
||||
*/
|
||||
declare export var size: number;
|
||||
/*
|
||||
Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.
|
||||
*/
|
||||
declare export var path: string;
|
||||
|
||||
45
connect-livereload/connect-livereload.d.ts
vendored
45
connect-livereload/connect-livereload.d.ts
vendored
@ -5,34 +5,33 @@
|
||||
|
||||
/// <reference path="../connect/connect.d.ts" />
|
||||
|
||||
declare module "connect-livereload" {
|
||||
import { HandleFunction } from "connect";
|
||||
|
||||
function livereload(): HandleFunction;
|
||||
function livereload(options: livereload.Options): HandleFunction;
|
||||
import { HandleFunction } from "connect";
|
||||
|
||||
namespace livereload {
|
||||
export type FileMatcher = string | RegExp;
|
||||
declare function livereload(): HandleFunction;
|
||||
declare function livereload(options: livereload.Options): HandleFunction;
|
||||
|
||||
export interface Rule {
|
||||
match: RegExp;
|
||||
fn: (w: string, s: string) => string;
|
||||
}
|
||||
declare namespace livereload {
|
||||
export type FileMatcher = string | RegExp;
|
||||
|
||||
export interface Options {
|
||||
ignore?: FileMatcher[];
|
||||
excludeList?: FileMatcher[];
|
||||
export interface Rule {
|
||||
match: RegExp;
|
||||
fn: (w: string, s: string) => string;
|
||||
}
|
||||
|
||||
include?: FileMatcher[];
|
||||
html?: (val: string) => boolean;
|
||||
rules?: Rule[];
|
||||
disableCompression?: boolean;
|
||||
export interface Options {
|
||||
ignore?: FileMatcher[];
|
||||
excludeList?: FileMatcher[];
|
||||
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
src?: string;
|
||||
}
|
||||
}
|
||||
include?: FileMatcher[];
|
||||
html?: (val: string) => boolean;
|
||||
rules?: Rule[];
|
||||
disableCompression?: boolean;
|
||||
|
||||
export = livereload;
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
src?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = livereload;
|
||||
|
||||
9
connect-modrewrite/connect-modrewrite.d.ts
vendored
9
connect-modrewrite/connect-modrewrite.d.ts
vendored
@ -5,8 +5,7 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module 'connect-modrewrite' {
|
||||
import express = require('express');
|
||||
function modrewrite(rewrites: string[]): express.RequestHandler;
|
||||
export = modrewrite;
|
||||
}
|
||||
|
||||
import express = require('express');
|
||||
declare function modrewrite(rewrites: string[]): express.RequestHandler;
|
||||
export = modrewrite;
|
||||
|
||||
171
connect-mongo/connect-mongo.d.ts
vendored
171
connect-mongo/connect-mongo.d.ts
vendored
@ -8,106 +8,105 @@
|
||||
/// <reference path="../mongodb/mongodb.d.ts" />
|
||||
/// <reference path="../express-session/express-session.d.ts" />
|
||||
|
||||
declare module "connect-mongo" {
|
||||
import * as express from 'express';
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongodb from 'mongodb';
|
||||
import * as session from 'express-session';
|
||||
|
||||
function connectMongo(connect: (options?: session.SessionOptions) => express.RequestHandler): connectMongo.MongoStoreFactory;
|
||||
import * as express from 'express';
|
||||
import * as mongoose from 'mongoose';
|
||||
import * as mongodb from 'mongodb';
|
||||
import * as session from 'express-session';
|
||||
|
||||
namespace connectMongo {
|
||||
declare function connectMongo(connect: (options?: session.SessionOptions) => express.RequestHandler): connectMongo.MongoStoreFactory;
|
||||
|
||||
export interface DefaultOptions{
|
||||
/**
|
||||
* The hostname of the database you are connecting to.
|
||||
* (Default: '127.0.0.1')
|
||||
*/
|
||||
host?: string;
|
||||
declare namespace connectMongo {
|
||||
|
||||
/**
|
||||
* The port number to connect to.
|
||||
* (Default: 27017)
|
||||
*/
|
||||
port?: string;
|
||||
export interface DefaultOptions {
|
||||
/**
|
||||
* The hostname of the database you are connecting to.
|
||||
* (Default: '127.0.0.1')
|
||||
*/
|
||||
host?: string;
|
||||
|
||||
/**
|
||||
* (Default: false)
|
||||
*/
|
||||
autoReconnect?: boolean;
|
||||
/**
|
||||
* The port number to connect to.
|
||||
* (Default: 27017)
|
||||
*/
|
||||
port?: string;
|
||||
|
||||
/**
|
||||
* (Default: true)
|
||||
*/
|
||||
ssl?: boolean;
|
||||
/**
|
||||
* (Default: false)
|
||||
*/
|
||||
autoReconnect?: boolean;
|
||||
|
||||
/**
|
||||
* (Default: 1)
|
||||
*/
|
||||
w?: number;
|
||||
/**
|
||||
* (Default: true)
|
||||
*/
|
||||
ssl?: boolean;
|
||||
|
||||
/**
|
||||
* The colletion of the database you are connecting to.
|
||||
* (Default: sessions)
|
||||
*/
|
||||
collection?: string;
|
||||
/**
|
||||
* (Default: 1)
|
||||
*/
|
||||
w?: number;
|
||||
|
||||
/**
|
||||
* Serialize sessions using JSON.stringify and deserialize them with JSON.parse.
|
||||
* (Default: true)
|
||||
*/
|
||||
stringify?: boolean;
|
||||
/**
|
||||
* The colletion of the database you are connecting to.
|
||||
* (Default: sessions)
|
||||
*/
|
||||
collection?: string;
|
||||
|
||||
/**
|
||||
* Default: false
|
||||
*/
|
||||
hash?: boolean;
|
||||
/**
|
||||
* Serialize sessions using JSON.stringify and deserialize them with JSON.parse.
|
||||
* (Default: true)
|
||||
*/
|
||||
stringify?: boolean;
|
||||
|
||||
/**
|
||||
* Default: 14 days (60 * 60 * 24 * 14)
|
||||
*/
|
||||
ttl?: number;
|
||||
/**
|
||||
* Default: false
|
||||
*/
|
||||
hash?: boolean;
|
||||
|
||||
/**
|
||||
* Automatically remove expired sessions.
|
||||
* (Default: 'native')
|
||||
*/
|
||||
autoRemove?: string;
|
||||
/**
|
||||
* Default: 14 days (60 * 60 * 24 * 14)
|
||||
*/
|
||||
ttl?: number;
|
||||
|
||||
/**
|
||||
* (Default: 10)
|
||||
*/
|
||||
autoRemoveInterval?: number;
|
||||
}
|
||||
/**
|
||||
* Automatically remove expired sessions.
|
||||
* (Default: 'native')
|
||||
*/
|
||||
autoRemove?: string;
|
||||
|
||||
export interface MongoUrlOptions extends DefaultOptions {
|
||||
url: string;
|
||||
mongoOptions?: mongoose.ConnectionOptions;
|
||||
}
|
||||
|
||||
export interface MogooseConnectionOptions extends DefaultOptions {
|
||||
mongooseConnection: mongoose.Connection;
|
||||
}
|
||||
|
||||
export interface NaitiveMongoOptions extends DefaultOptions {
|
||||
db: mongodb.Db;
|
||||
}
|
||||
|
||||
export interface MongoStoreFactory {
|
||||
new (options: MongoUrlOptions): MongoStore;
|
||||
new (options: MogooseConnectionOptions): MongoStore;
|
||||
new (options: NaitiveMongoOptions): MongoStore;
|
||||
}
|
||||
|
||||
export class MongoStore extends session.Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
|
||||
set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback: (err: any) => void) => void;
|
||||
length: (callback: (err: any, length: number) => void) => void;
|
||||
clear: (callback: (err: any) => void) => void;
|
||||
touch: (sid: string, session: Express.Session, callback:(err: any) => void) => void;
|
||||
}
|
||||
/**
|
||||
* (Default: 10)
|
||||
*/
|
||||
autoRemoveInterval?: number;
|
||||
}
|
||||
|
||||
export = connectMongo;
|
||||
export interface MongoUrlOptions extends DefaultOptions {
|
||||
url: string;
|
||||
mongoOptions?: mongoose.ConnectionOptions;
|
||||
}
|
||||
|
||||
export interface MogooseConnectionOptions extends DefaultOptions {
|
||||
mongooseConnection: mongoose.Connection;
|
||||
}
|
||||
|
||||
export interface NaitiveMongoOptions extends DefaultOptions {
|
||||
db: mongodb.Db;
|
||||
}
|
||||
|
||||
export interface MongoStoreFactory {
|
||||
new (options: MongoUrlOptions): MongoStore;
|
||||
new (options: MogooseConnectionOptions): MongoStore;
|
||||
new (options: NaitiveMongoOptions): MongoStore;
|
||||
}
|
||||
|
||||
export class MongoStore extends session.Store {
|
||||
get: (sid: string, callback: (err: any, session: Express.Session) => void) => void;
|
||||
set: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
|
||||
destroy: (sid: string, callback: (err: any) => void) => void;
|
||||
length: (callback: (err: any, length: number) => void) => void;
|
||||
clear: (callback: (err: any) => void) => void;
|
||||
touch: (sid: string, session: Express.Session, callback: (err: any) => void) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = connectMongo;
|
||||
|
||||
35
connect-slashes/connect-slashes.d.ts
vendored
35
connect-slashes/connect-slashes.d.ts
vendored
@ -15,26 +15,25 @@
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
|
||||
declare module "connect-slashes" {
|
||||
import express = require('express');
|
||||
|
||||
import express = require('express');
|
||||
|
||||
/**
|
||||
* @see https://github.com/avinoamr/connect-slashes#usage
|
||||
*/
|
||||
declare function slashes(addTrailingSlashes?: boolean, options?: slashes.Options): express.RequestHandler;
|
||||
|
||||
declare namespace slashes {
|
||||
|
||||
/**
|
||||
* @see https://github.com/avinoamr/connect-slashes#usage
|
||||
* Additional settings
|
||||
* @see https://github.com/avinoamr/connect-slashes#additional-settings
|
||||
*/
|
||||
function slashes (addTrailingSlashes?: boolean, options?: slashes.Options): express.RequestHandler;
|
||||
|
||||
namespace slashes {
|
||||
|
||||
/**
|
||||
* Additional settings
|
||||
* @see https://github.com/avinoamr/connect-slashes#additional-settings
|
||||
*/
|
||||
interface Options {
|
||||
base?: string;
|
||||
code?: number;
|
||||
headers?: {[field: string]: string};
|
||||
}
|
||||
interface Options {
|
||||
base?: string;
|
||||
code?: number;
|
||||
headers?: { [field: string]: string };
|
||||
}
|
||||
|
||||
export = slashes;
|
||||
}
|
||||
|
||||
export = slashes;
|
||||
|
||||
153
connect/connect.d.ts
vendored
153
connect/connect.d.ts
vendored
@ -5,88 +5,87 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "connect" {
|
||||
import * as http from "http";
|
||||
|
||||
/**
|
||||
* Create a new connect server.
|
||||
* @public
|
||||
*/
|
||||
function createServer(): createServer.Server;
|
||||
import * as http from "http";
|
||||
|
||||
namespace createServer {
|
||||
export type ServerHandle = HandleFunction | http.Server;
|
||||
/**
|
||||
* Create a new connect server.
|
||||
* @public
|
||||
*/
|
||||
declare function createServer(): createServer.Server;
|
||||
|
||||
export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
||||
export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
||||
declare namespace createServer {
|
||||
export type ServerHandle = HandleFunction | http.Server;
|
||||
|
||||
export interface ServerStackItem {
|
||||
route: string;
|
||||
handle: ServerHandle;
|
||||
}
|
||||
export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
||||
export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
||||
|
||||
export interface Server extends NodeJS.EventEmitter {
|
||||
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
||||
|
||||
route: string;
|
||||
stack: ServerStackItem[];
|
||||
|
||||
/**
|
||||
* Utilize the given middleware `handle` to the given `route`,
|
||||
* defaulting to _/_. This "route" is the mount-point for the
|
||||
* middleware, when given a value other than _/_ the middleware
|
||||
* is only effective when that segment is present in the request's
|
||||
* pathname.
|
||||
*
|
||||
* For example if we were to mount a function at _/admin_, it would
|
||||
* be invoked on _/admin_, and _/admin/settings_, however it would
|
||||
* not be invoked for _/_, or _/posts_.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
use(fn: HandleFunction): Server;
|
||||
use(route: string, fn: HandleFunction): Server;
|
||||
|
||||
/**
|
||||
* Handle server requests, punting them down
|
||||
* the middleware stack.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
||||
|
||||
/**
|
||||
* Listen for connections.
|
||||
*
|
||||
* This method takes the same arguments
|
||||
* as node's `http.Server#listen()`.
|
||||
*
|
||||
* HTTP and HTTPS:
|
||||
*
|
||||
* If you run your application both as HTTP
|
||||
* and HTTPS you may wrap them individually,
|
||||
* since your Connect "server" is really just
|
||||
* a JavaScript `Function`.
|
||||
*
|
||||
* var connect = require('connect')
|
||||
* , http = require('http')
|
||||
* , https = require('https');
|
||||
*
|
||||
* var app = connect();
|
||||
*
|
||||
* http.createServer(app).listen(80);
|
||||
* https.createServer(options, app).listen(443);
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
||||
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
||||
listen(path: string, callback?: Function): http.Server;
|
||||
listen(handle: any, listeningListener?: Function): http.Server;
|
||||
}
|
||||
export interface ServerStackItem {
|
||||
route: string;
|
||||
handle: ServerHandle;
|
||||
}
|
||||
|
||||
export = createServer;
|
||||
export interface Server extends NodeJS.EventEmitter {
|
||||
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
||||
|
||||
route: string;
|
||||
stack: ServerStackItem[];
|
||||
|
||||
/**
|
||||
* Utilize the given middleware `handle` to the given `route`,
|
||||
* defaulting to _/_. This "route" is the mount-point for the
|
||||
* middleware, when given a value other than _/_ the middleware
|
||||
* is only effective when that segment is present in the request's
|
||||
* pathname.
|
||||
*
|
||||
* For example if we were to mount a function at _/admin_, it would
|
||||
* be invoked on _/admin_, and _/admin/settings_, however it would
|
||||
* not be invoked for _/_, or _/posts_.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
use(fn: HandleFunction): Server;
|
||||
use(route: string, fn: HandleFunction): Server;
|
||||
|
||||
/**
|
||||
* Handle server requests, punting them down
|
||||
* the middleware stack.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
||||
|
||||
/**
|
||||
* Listen for connections.
|
||||
*
|
||||
* This method takes the same arguments
|
||||
* as node's `http.Server#listen()`.
|
||||
*
|
||||
* HTTP and HTTPS:
|
||||
*
|
||||
* If you run your application both as HTTP
|
||||
* and HTTPS you may wrap them individually,
|
||||
* since your Connect "server" is really just
|
||||
* a JavaScript `Function`.
|
||||
*
|
||||
* var connect = require('connect')
|
||||
* , http = require('http')
|
||||
* , https = require('https');
|
||||
*
|
||||
* var app = connect();
|
||||
*
|
||||
* http.createServer(app).listen(80);
|
||||
* https.createServer(options, app).listen(443);
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
||||
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
||||
listen(path: string, callback?: Function): http.Server;
|
||||
listen(handle: any, listeningListener?: Function): http.Server;
|
||||
}
|
||||
}
|
||||
|
||||
export = createServer;
|
||||
|
||||
67
console-stamp/console-stamp.d.ts
vendored
67
console-stamp/console-stamp.d.ts
vendored
@ -3,44 +3,43 @@
|
||||
// Definitions by: Eric Byers <https://github.com/ericbyers/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'console-stamp' {
|
||||
|
||||
function consoleStamp(console:{}, options?: {
|
||||
/**
|
||||
* A string with date format based on Javascript Date Format
|
||||
*/
|
||||
pattern?: string
|
||||
|
||||
/**
|
||||
* If true it will show the label (LOG | INFO | WARN | ERROR)
|
||||
*/
|
||||
label?: boolean;
|
||||
declare function consoleStamp(console: {}, options?: {
|
||||
/**
|
||||
* A string with date format based on Javascript Date Format
|
||||
*/
|
||||
pattern?: string
|
||||
|
||||
/**
|
||||
* An array containing the methods to include in the patch
|
||||
*/
|
||||
include?: any;
|
||||
/**
|
||||
* If true it will show the label (LOG | INFO | WARN | ERROR)
|
||||
*/
|
||||
label?: boolean;
|
||||
|
||||
/**
|
||||
* An array containing the methods to exclude in the patch)
|
||||
*/
|
||||
exclude?: any;
|
||||
/**
|
||||
* An array containing the methods to include in the patch
|
||||
*/
|
||||
include?: any;
|
||||
|
||||
/**
|
||||
* Types can be String, Object (interpreted with util.inspect), or Function. See the test-metadata.js for examples.
|
||||
* Note that metadata can still be sent as the third parameter (as in vesion 1.6) as a backward compatibillity feature, but this is deprecated.
|
||||
*/
|
||||
metadata?: any;
|
||||
/**
|
||||
* An array containing the methods to exclude in the patch)
|
||||
*/
|
||||
exclude?: any;
|
||||
|
||||
/**
|
||||
* An object representing a color theme. More info https://www.npmjs.com/package/colors
|
||||
*/
|
||||
colors?: {
|
||||
stamp?: any;
|
||||
label?: any;
|
||||
metadata?: any;
|
||||
};
|
||||
}): void;
|
||||
/**
|
||||
* Types can be String, Object (interpreted with util.inspect), or Function. See the test-metadata.js for examples.
|
||||
* Note that metadata can still be sent as the third parameter (as in vesion 1.6) as a backward compatibillity feature, but this is deprecated.
|
||||
*/
|
||||
metadata?: any;
|
||||
|
||||
export = consoleStamp;
|
||||
}
|
||||
/**
|
||||
* An object representing a color theme. More info https://www.npmjs.com/package/colors
|
||||
*/
|
||||
colors?: {
|
||||
stamp?: any;
|
||||
label?: any;
|
||||
metadata?: any;
|
||||
};
|
||||
}): void;
|
||||
|
||||
export = consoleStamp;
|
||||
|
||||
119
consolidate/consolidate.d.ts
vendored
119
consolidate/consolidate.d.ts
vendored
@ -8,68 +8,67 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
declare module "consolidate" {
|
||||
var cons: Consolidate;
|
||||
|
||||
export = cons;
|
||||
declare var cons: Consolidate;
|
||||
|
||||
interface Consolidate {
|
||||
/**
|
||||
* expose the instance of the engine
|
||||
*/
|
||||
requires: Object;
|
||||
export = cons;
|
||||
|
||||
/**
|
||||
* Clear the cache.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
clearCache(): void;
|
||||
// template engines
|
||||
atpl: RendererInterface;
|
||||
dot: RendererInterface;
|
||||
dust: RendererInterface;
|
||||
eco: RendererInterface;
|
||||
ejs: RendererInterface;
|
||||
ect: RendererInterface;
|
||||
haml: RendererInterface;
|
||||
// TODO figure out how to do haml-coffee
|
||||
hamlet: RendererInterface;
|
||||
handlebars: RendererInterface;
|
||||
hogan: RendererInterface;
|
||||
htmling: RendererInterface;
|
||||
jade: RendererInterface;
|
||||
jazz: RendererInterface;
|
||||
jqtpl: RendererInterface;
|
||||
just: RendererInterface;
|
||||
liquid: RendererInterface;
|
||||
liquor: RendererInterface;
|
||||
lodash: RendererInterface;
|
||||
mote: RendererInterface;
|
||||
mustache: RendererInterface;
|
||||
nunjucks: RendererInterface;
|
||||
qejs: RendererInterface;
|
||||
ractive: RendererInterface;
|
||||
react: RendererInterface;
|
||||
swig: RendererInterface;
|
||||
templayed: RendererInterface;
|
||||
toffee: RendererInterface;
|
||||
underscore: RendererInterface;
|
||||
walrus: RendererInterface;
|
||||
whiskers: RendererInterface;
|
||||
}
|
||||
interface Consolidate {
|
||||
/**
|
||||
* expose the instance of the engine
|
||||
*/
|
||||
requires: Object;
|
||||
|
||||
interface RendererInterface {
|
||||
render(path: String, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
render(path: String, options: {cache?: boolean, [otherOptions: string]: any}, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
render(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise<String>;
|
||||
|
||||
(path: String, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
(path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise<String>;
|
||||
}
|
||||
/**
|
||||
* Clear the cache.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
clearCache(): void;
|
||||
// template engines
|
||||
atpl: RendererInterface;
|
||||
dot: RendererInterface;
|
||||
dust: RendererInterface;
|
||||
eco: RendererInterface;
|
||||
ejs: RendererInterface;
|
||||
ect: RendererInterface;
|
||||
haml: RendererInterface;
|
||||
// TODO figure out how to do haml-coffee
|
||||
hamlet: RendererInterface;
|
||||
handlebars: RendererInterface;
|
||||
hogan: RendererInterface;
|
||||
htmling: RendererInterface;
|
||||
jade: RendererInterface;
|
||||
jazz: RendererInterface;
|
||||
jqtpl: RendererInterface;
|
||||
just: RendererInterface;
|
||||
liquid: RendererInterface;
|
||||
liquor: RendererInterface;
|
||||
lodash: RendererInterface;
|
||||
mote: RendererInterface;
|
||||
mustache: RendererInterface;
|
||||
nunjucks: RendererInterface;
|
||||
qejs: RendererInterface;
|
||||
ractive: RendererInterface;
|
||||
react: RendererInterface;
|
||||
swig: RendererInterface;
|
||||
templayed: RendererInterface;
|
||||
toffee: RendererInterface;
|
||||
underscore: RendererInterface;
|
||||
walrus: RendererInterface;
|
||||
whiskers: RendererInterface;
|
||||
}
|
||||
|
||||
interface RendererInterface {
|
||||
render(path: String, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
render(path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
render(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise<String>;
|
||||
|
||||
(path: String, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
(path: String, options: { cache?: boolean, [otherOptions: string]: any }, fn: (err: Error, html: String) => any): any;
|
||||
|
||||
(path: String, options?: { cache?: boolean, [otherOptions: string]: any }): Promise<String>;
|
||||
}
|
||||
|
||||
7
constant-case/constant-case.d.ts
vendored
7
constant-case/constant-case.d.ts
vendored
@ -3,7 +3,6 @@
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "constant-case" {
|
||||
function constantCase(string: string, locale?: string): string;
|
||||
export = constantCase;
|
||||
}
|
||||
|
||||
declare function constantCase(string: string, locale?: string): string;
|
||||
export = constantCase;
|
||||
|
||||
2051
consul/consul.d.ts
vendored
2051
consul/consul.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,6 @@
|
||||
// Definitions by: Anton Karsten <https://github.com/antonkarsten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'contentful-resolve-response' {
|
||||
function resolveResponse(response: any): any;
|
||||
export = resolveResponse;
|
||||
}
|
||||
|
||||
declare function resolveResponse(response: any): any;
|
||||
export = resolveResponse;
|
||||
|
||||
51
contextjs/contextjs.d.ts
vendored
51
contextjs/contextjs.d.ts
vendored
@ -3,31 +3,30 @@
|
||||
// Definitions by: Kern Handa <https://github.com/kernhanda>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "contextjs" {
|
||||
interface MenuObject {
|
||||
action?: (e: Event) => void;
|
||||
divider?: boolean;
|
||||
header?: string;
|
||||
href?: string;
|
||||
subMenu?: MenuObject[];
|
||||
target?: string;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
interface InitSettings {
|
||||
above?: string | boolean;
|
||||
compress?: boolean;
|
||||
fadeSpeed?: number;
|
||||
filter?: (e: Element) => void;
|
||||
preventDoubleContext?: boolean;
|
||||
}
|
||||
|
||||
namespace context {
|
||||
function init(settings?: InitSettings): void;
|
||||
function destroy(selector: any): void;
|
||||
function attach(selector: any, menuObjects: MenuObject[]): void;
|
||||
function settings(settings: InitSettings): void;
|
||||
}
|
||||
|
||||
export = context;
|
||||
interface MenuObject {
|
||||
action?: (e: Event) => void;
|
||||
divider?: boolean;
|
||||
header?: string;
|
||||
href?: string;
|
||||
subMenu?: MenuObject[];
|
||||
target?: string;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
interface InitSettings {
|
||||
above?: string | boolean;
|
||||
compress?: boolean;
|
||||
fadeSpeed?: number;
|
||||
filter?: (e: Element) => void;
|
||||
preventDoubleContext?: boolean;
|
||||
}
|
||||
|
||||
declare namespace context {
|
||||
function init(settings?: InitSettings): void;
|
||||
function destroy(selector: any): void;
|
||||
function attach(selector: any, menuObjects: MenuObject[]): void;
|
||||
function settings(settings: InitSettings): void;
|
||||
}
|
||||
|
||||
export = context;
|
||||
|
||||
35
convert-source-map/convert-source-map.d.ts
vendored
35
convert-source-map/convert-source-map.d.ts
vendored
@ -3,25 +3,24 @@
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "convert-source-map" {
|
||||
export interface SourceMapConverter {
|
||||
toObject(): any;
|
||||
toJSON(space?: any): string;
|
||||
toBase64(): string;
|
||||
toComment(): string;
|
||||
|
||||
addProperty(key: string, value: any): SourceMapConverter;
|
||||
setProperty(key: string, value: any): SourceMapConverter;
|
||||
export interface SourceMapConverter {
|
||||
toObject(): any;
|
||||
toJSON(space?: any): string;
|
||||
toBase64(): string;
|
||||
toComment(): string;
|
||||
|
||||
getProperty(key: string): any;
|
||||
}
|
||||
addProperty(key: string, value: any): SourceMapConverter;
|
||||
setProperty(key: string, value: any): SourceMapConverter;
|
||||
|
||||
export function removeComments(src: string): string;
|
||||
export var commentRegex: RegExp;
|
||||
|
||||
export function fromObject(obj: any): SourceMapConverter;
|
||||
export function fromJSON(json: string): SourceMapConverter;
|
||||
export function fromBase64(base64: string): SourceMapConverter;
|
||||
export function fromComment(comment: string): SourceMapConverter;
|
||||
export function fromSource(source: string): SourceMapConverter;
|
||||
getProperty(key: string): any;
|
||||
}
|
||||
|
||||
declare export function removeComments(src: string): string;
|
||||
declare export var commentRegex: RegExp;
|
||||
|
||||
declare export function fromObject(obj: any): SourceMapConverter;
|
||||
declare export function fromJSON(json: string): SourceMapConverter;
|
||||
declare export function fromBase64(base64: string): SourceMapConverter;
|
||||
declare export function fromComment(comment: string): SourceMapConverter;
|
||||
declare export function fromSource(source: string): SourceMapConverter;
|
||||
|
||||
132
convict/convict.d.ts
vendored
132
convict/convict.d.ts
vendored
@ -3,75 +3,73 @@
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "convict" {
|
||||
namespace convict {
|
||||
|
||||
interface Format {
|
||||
name?: string;
|
||||
validate?: (val: any) => void;
|
||||
coerce?: (val: any) => any;
|
||||
}
|
||||
declare namespace convict {
|
||||
|
||||
interface Schema {
|
||||
[name: string]: convict.Schema | {
|
||||
default: any;
|
||||
doc?: string;
|
||||
/**
|
||||
* From the implementation:
|
||||
*
|
||||
* format can be a:
|
||||
* - predefine type, as seen below
|
||||
* - an array of enumerated values, e.g. ["production", "development", "testing"]
|
||||
* - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean
|
||||
* - or if omitted, the Object.prototype.toString.call of the default value
|
||||
*
|
||||
* The docs also state that any function that validates is ok too
|
||||
*/
|
||||
format?: string | Array<any> | Function;
|
||||
env?: string;
|
||||
arg?: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface Config {
|
||||
get(name: string): any;
|
||||
default(name: string): any;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: any): void;
|
||||
load(conf: Object): void;
|
||||
loadFile(file: string): void;
|
||||
loadFile(files: string[]): void;
|
||||
validate(): void;
|
||||
/**
|
||||
* Exports all the properties (that is the keys and their current values) as a {JSON} {Object}
|
||||
* @returns {Object} A {JSON} compliant {Object}
|
||||
*/
|
||||
getProperties() : Object;
|
||||
/**
|
||||
* Exports the schema as a {JSON} {Object}
|
||||
* @returns {Object} A {JSON} compliant {Object}
|
||||
*/
|
||||
getSchema() : Object;
|
||||
|
||||
/**
|
||||
* Exports all the properties (that is the keys and their current values) as a JSON string.
|
||||
* @returns {String} a string representing this object
|
||||
*/
|
||||
toString() : string;
|
||||
|
||||
/**
|
||||
* Exports the schema as a JSON string.
|
||||
* @returns {String} a string representing the schema of this {Config}
|
||||
*/
|
||||
getSchemaString() : string;
|
||||
}
|
||||
interface Format {
|
||||
name?: string;
|
||||
validate?: (val: any) => void;
|
||||
coerce?: (val: any) => any;
|
||||
}
|
||||
interface convict {
|
||||
addFormat(format: convict.Format): void;
|
||||
addFormats(formats: { [name: string]: convict.Format }): void;
|
||||
(config: convict.Schema): convict.Config;
|
||||
|
||||
interface Schema {
|
||||
[name: string]: convict.Schema | {
|
||||
default: any;
|
||||
doc?: string;
|
||||
/**
|
||||
* From the implementation:
|
||||
*
|
||||
* format can be a:
|
||||
* - predefine type, as seen below
|
||||
* - an array of enumerated values, e.g. ["production", "development", "testing"]
|
||||
* - built-in JavaScript type, i.e. Object, Array, String, Number, Boolean
|
||||
* - or if omitted, the Object.prototype.toString.call of the default value
|
||||
*
|
||||
* The docs also state that any function that validates is ok too
|
||||
*/
|
||||
format?: string | Array<any> | Function;
|
||||
env?: string;
|
||||
arg?: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface Config {
|
||||
get(name: string): any;
|
||||
default(name: string): any;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: any): void;
|
||||
load(conf: Object): void;
|
||||
loadFile(file: string): void;
|
||||
loadFile(files: string[]): void;
|
||||
validate(): void;
|
||||
/**
|
||||
* Exports all the properties (that is the keys and their current values) as a {JSON} {Object}
|
||||
* @returns {Object} A {JSON} compliant {Object}
|
||||
*/
|
||||
getProperties(): Object;
|
||||
/**
|
||||
* Exports the schema as a {JSON} {Object}
|
||||
* @returns {Object} A {JSON} compliant {Object}
|
||||
*/
|
||||
getSchema(): Object;
|
||||
|
||||
/**
|
||||
* Exports all the properties (that is the keys and their current values) as a JSON string.
|
||||
* @returns {String} a string representing this object
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Exports the schema as a JSON string.
|
||||
* @returns {String} a string representing the schema of this {Config}
|
||||
*/
|
||||
getSchemaString(): string;
|
||||
}
|
||||
var convict : convict;
|
||||
export = convict;
|
||||
}
|
||||
|
||||
interface convict {
|
||||
addFormat(format: convict.Format): void;
|
||||
addFormats(formats: { [name: string]: convict.Format }): void;
|
||||
(config: convict.Schema): convict.Config;
|
||||
}
|
||||
declare var convict: convict;
|
||||
export = convict;
|
||||
|
||||
11
cookie-parser/cookie-parser.d.ts
vendored
11
cookie-parser/cookie-parser.d.ts
vendored
@ -5,9 +5,8 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "cookie-parser" {
|
||||
import express = require('express');
|
||||
function e(secret?: string, options?: any): express.RequestHandler;
|
||||
namespace e{}
|
||||
export = e;
|
||||
}
|
||||
|
||||
import express = require('express');
|
||||
declare function e(secret?: string, options?: any): express.RequestHandler;
|
||||
declare namespace e { }
|
||||
export = e;
|
||||
|
||||
171
cookies/cookies.d.ts
vendored
171
cookies/cookies.d.ts
vendored
@ -5,96 +5,95 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "cookies" {
|
||||
import * as http from "http"
|
||||
|
||||
namespace cookies {
|
||||
interface ICookies {
|
||||
/**
|
||||
* This extracts the cookie with the given name from the
|
||||
* Cookie header in the request. If such a cookie exists,
|
||||
* its value is returned. Otherwise, nothing is returned.
|
||||
*/
|
||||
get(name: string): string;
|
||||
/**
|
||||
* This extracts the cookie with the given name from the
|
||||
* Cookie header in the request. If such a cookie exists,
|
||||
* its value is returned. Otherwise, nothing is returned.
|
||||
*/
|
||||
get(name: string, opts: IOptions): string;
|
||||
import * as http from "http"
|
||||
|
||||
/**
|
||||
* This sets the given cookie in the response and returns
|
||||
* the current context to allow chaining.If the value is omitted,
|
||||
* an outbound header with an expired date is used to delete the cookie.
|
||||
*/
|
||||
set(name: string, value: string): ICookies;
|
||||
/**
|
||||
* This sets the given cookie in the response and returns
|
||||
* the current context to allow chaining.If the value is omitted,
|
||||
* an outbound header with an expired date is used to delete the cookie.
|
||||
*/
|
||||
set(name: string, value: string, opts: IOptions): ICookies;
|
||||
}
|
||||
declare namespace cookies {
|
||||
interface ICookies {
|
||||
/**
|
||||
* This extracts the cookie with the given name from the
|
||||
* Cookie header in the request. If such a cookie exists,
|
||||
* its value is returned. Otherwise, nothing is returned.
|
||||
*/
|
||||
get(name: string): string;
|
||||
/**
|
||||
* This extracts the cookie with the given name from the
|
||||
* Cookie header in the request. If such a cookie exists,
|
||||
* its value is returned. Otherwise, nothing is returned.
|
||||
*/
|
||||
get(name: string, opts: IOptions): string;
|
||||
|
||||
interface IOptions {
|
||||
/**
|
||||
* a number representing the milliseconds from Date.now() for expiry
|
||||
*/
|
||||
maxAge?: number;
|
||||
/**
|
||||
* a Date object indicating the cookie's expiration
|
||||
* date (expires at the end of session by default).
|
||||
*/
|
||||
expires?: Date;
|
||||
/**
|
||||
* a string indicating the path of the cookie (/ by default).
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* a string indicating the domain of the cookie (no default).
|
||||
*/
|
||||
domain?: string;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent
|
||||
* over HTTPS (false by default for HTTP, true by default for HTTPS).
|
||||
*/
|
||||
secure?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent
|
||||
* over HTTPS (use this if you handle SSL not in your node process).
|
||||
*/
|
||||
secureProxy?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent over HTTP(S),
|
||||
* and not made available to client JavaScript (true by default).
|
||||
*/
|
||||
httpOnly?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is to be signed (false by default).
|
||||
* If this is true, another cookie of the same name with the .sig suffix
|
||||
* appended will also be sent, with a 27-byte url-safe base64 SHA1 value
|
||||
* representing the hash of cookie-name=cookie-value against the first Keygrip key.
|
||||
* This signature key is used to detect tampering the next time a cookie is received.
|
||||
*/
|
||||
signed?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether to overwrite previously set
|
||||
* cookies of the same name (false by default). If this is true,
|
||||
* all cookies set during the same request with the same
|
||||
* name (regardless of path or domain) are filtered out of
|
||||
* the Set-Cookie header when setting this cookie.
|
||||
*/
|
||||
overwrite?: boolean;
|
||||
}
|
||||
/**
|
||||
* This sets the given cookie in the response and returns
|
||||
* the current context to allow chaining.If the value is omitted,
|
||||
* an outbound header with an expired date is used to delete the cookie.
|
||||
*/
|
||||
set(name: string, value: string): ICookies;
|
||||
/**
|
||||
* This sets the given cookie in the response and returns
|
||||
* the current context to allow chaining.If the value is omitted,
|
||||
* an outbound header with an expired date is used to delete the cookie.
|
||||
*/
|
||||
set(name: string, value: string, opts: IOptions): ICookies;
|
||||
}
|
||||
|
||||
interface CookiesStatic {
|
||||
new (request: http.IncomingMessage, response: http.ServerResponse): cookies.ICookies;
|
||||
new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array<string>): cookies.ICookies;
|
||||
interface IOptions {
|
||||
/**
|
||||
* a number representing the milliseconds from Date.now() for expiry
|
||||
*/
|
||||
maxAge?: number;
|
||||
/**
|
||||
* a Date object indicating the cookie's expiration
|
||||
* date (expires at the end of session by default).
|
||||
*/
|
||||
expires?: Date;
|
||||
/**
|
||||
* a string indicating the path of the cookie (/ by default).
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* a string indicating the domain of the cookie (no default).
|
||||
*/
|
||||
domain?: string;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent
|
||||
* over HTTPS (false by default for HTTP, true by default for HTTPS).
|
||||
*/
|
||||
secure?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent
|
||||
* over HTTPS (use this if you handle SSL not in your node process).
|
||||
*/
|
||||
secureProxy?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is only to be sent over HTTP(S),
|
||||
* and not made available to client JavaScript (true by default).
|
||||
*/
|
||||
httpOnly?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether the cookie is to be signed (false by default).
|
||||
* If this is true, another cookie of the same name with the .sig suffix
|
||||
* appended will also be sent, with a 27-byte url-safe base64 SHA1 value
|
||||
* representing the hash of cookie-name=cookie-value against the first Keygrip key.
|
||||
* This signature key is used to detect tampering the next time a cookie is received.
|
||||
*/
|
||||
signed?: boolean;
|
||||
/**
|
||||
* a boolean indicating whether to overwrite previously set
|
||||
* cookies of the same name (false by default). If this is true,
|
||||
* all cookies set during the same request with the same
|
||||
* name (regardless of path or domain) are filtered out of
|
||||
* the Set-Cookie header when setting this cookie.
|
||||
*/
|
||||
overwrite?: boolean;
|
||||
}
|
||||
|
||||
const cookies: CookiesStatic;
|
||||
|
||||
export = cookies
|
||||
}
|
||||
|
||||
interface CookiesStatic {
|
||||
new (request: http.IncomingMessage, response: http.ServerResponse): cookies.ICookies;
|
||||
new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array<string>): cookies.ICookies;
|
||||
}
|
||||
|
||||
declare const cookies: CookiesStatic;
|
||||
|
||||
export = cookies
|
||||
|
||||
77
copy-paste/copy-paste.d.ts
vendored
77
copy-paste/copy-paste.d.ts
vendored
@ -3,44 +3,43 @@
|
||||
// Definitions by: Tobias Kahlert <https://github.com/SrTobi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'copy-paste' {
|
||||
|
||||
export type CopyCallback = (err: Error) => void;
|
||||
export type PasteCallback = (err: Error, content: string) => void;
|
||||
|
||||
/**
|
||||
* Asynchronously replaces the current contents of the clip board with text.
|
||||
*
|
||||
* @param {T} content Takes either a string, array, object, or readable stream.
|
||||
* @return {T} Returns the same value passed in.
|
||||
*/
|
||||
export function copy<T>(content: T): T;
|
||||
|
||||
/**
|
||||
* Asynchronously replaces the current contents of the clip board with text.
|
||||
*
|
||||
* @param {T} content Takes either a string, array, object, or readable stream.
|
||||
* @param {CopyCallback} callback will fire when the copy operation is complete.
|
||||
* @return {T} Returns the same value passed in.
|
||||
*/
|
||||
export function copy<T>(content: T, callback: CopyCallback): T;
|
||||
|
||||
|
||||
/**
|
||||
* Synchronously returns the current contents of the system clip board.
|
||||
*
|
||||
* Note: The synchronous version of paste is not always availabled.
|
||||
* An error message is shown if the synchronous version of paste is used on an unsupported platform.
|
||||
* The asynchronous version of paste is always available.
|
||||
*
|
||||
* @return {string} Returns the current contents of the system clip board.
|
||||
*/
|
||||
export function paste(): string;
|
||||
|
||||
/**
|
||||
* Asynchronously returns the current contents of the system clip board.
|
||||
*
|
||||
* @param {PasteCallback} callback The contents of the system clip board are passed to the callback as the second parameter.
|
||||
*/
|
||||
export function paste(callback: PasteCallback): void;
|
||||
}
|
||||
export type CopyCallback = (err: Error) => void;
|
||||
export type PasteCallback = (err: Error, content: string) => void;
|
||||
|
||||
/**
|
||||
* Asynchronously replaces the current contents of the clip board with text.
|
||||
*
|
||||
* @param {T} content Takes either a string, array, object, or readable stream.
|
||||
* @return {T} Returns the same value passed in.
|
||||
*/
|
||||
declare export function copy<T>(content: T): T;
|
||||
|
||||
/**
|
||||
* Asynchronously replaces the current contents of the clip board with text.
|
||||
*
|
||||
* @param {T} content Takes either a string, array, object, or readable stream.
|
||||
* @param {CopyCallback} callback will fire when the copy operation is complete.
|
||||
* @return {T} Returns the same value passed in.
|
||||
*/
|
||||
declare export function copy<T>(content: T, callback: CopyCallback): T;
|
||||
|
||||
|
||||
/**
|
||||
* Synchronously returns the current contents of the system clip board.
|
||||
*
|
||||
* Note: The synchronous version of paste is not always availabled.
|
||||
* An error message is shown if the synchronous version of paste is used on an unsupported platform.
|
||||
* The asynchronous version of paste is always available.
|
||||
*
|
||||
* @return {string} Returns the current contents of the system clip board.
|
||||
*/
|
||||
declare export function paste(): string;
|
||||
|
||||
/**
|
||||
* Asynchronously returns the current contents of the system clip board.
|
||||
*
|
||||
* @param {PasteCallback} callback The contents of the system clip board are passed to the callback as the second parameter.
|
||||
*/
|
||||
declare export function paste(callback: PasteCallback): void;
|
||||
|
||||
257
core-decorators/core-decorators.d.ts
vendored
257
core-decorators/core-decorators.d.ts
vendored
@ -3,134 +3,133 @@
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "core-decorators" {
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
|
||||
export interface ParameterDecorator {
|
||||
(target: Object, propertyKey: string|symbol, parameterIndex: number): void;
|
||||
}
|
||||
|
||||
export interface PropertyDecorator {
|
||||
(target: Object, propertyKey: string|symbol): void;
|
||||
}
|
||||
|
||||
export interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>|void;
|
||||
}
|
||||
|
||||
export interface PropertyOrMethodDecorator extends MethodDecorator, PropertyDecorator {
|
||||
(target: Object, propertyKey: string|symbol): void;
|
||||
}
|
||||
|
||||
export interface Deprecate extends MethodDecorator {
|
||||
(message?: string, option?: DeprecateOption): MethodDecorator;
|
||||
}
|
||||
|
||||
export interface DeprecateOption {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface ThrottleOptions {
|
||||
/** allows to trigger function on the leading. */
|
||||
leading?: boolean;
|
||||
/** allows to trigger function on the trailing edge of the wait interval. */
|
||||
trailing?: boolean;
|
||||
}
|
||||
|
||||
export interface Console {
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces invocations of this function to always have this refer to the class instance,
|
||||
* even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method;
|
||||
*/
|
||||
var autobind: Function;
|
||||
/**
|
||||
* Marks a property or method as not being writable.
|
||||
*/
|
||||
var readonly: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain.
|
||||
*/
|
||||
var override: MethodDecorator;
|
||||
/**
|
||||
* Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading.
|
||||
*/
|
||||
var deprecate: Deprecate;
|
||||
/**
|
||||
* Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading.
|
||||
*/
|
||||
var deprecated: Deprecate;
|
||||
/**
|
||||
* Creates a new debounced function which will be invoked after wait milliseconds since the time it was invoked. Default timeout is 300 ms.
|
||||
*/
|
||||
var debounce: (wait: number) => MethodDecorator;
|
||||
/**
|
||||
* Creates a new throttled function which will be invoked in every wait milliseconds. Default timeout is 300 ms.
|
||||
*/
|
||||
var throttle: (wait: number, options?: ThrottleOptions) => MethodDecorator;
|
||||
/**
|
||||
* Suppresses any JavaScript console.warn() call while the decorated function is called. (i.e. on the stack)
|
||||
*/
|
||||
var suppressWarnings: MethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being enumerable.
|
||||
*/
|
||||
var nonenumerable: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being writable.
|
||||
*/
|
||||
var nonconfigurable: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Initial implementation included, likely slow. WIP.
|
||||
*/
|
||||
var memoize: MethodDecorator;
|
||||
/**
|
||||
* Immediately applies the provided function and arguments to the method, allowing you to wrap methods with arbitrary helpers like those provided by lodash.
|
||||
* The first argument is the function to apply, all further arguments will be passed to that decorating function.
|
||||
*/
|
||||
var decorate: (func: Function, ...args: any[]) => MethodDecorator;
|
||||
/**
|
||||
* Prevents a property initializer from running until the decorated property is actually looked up.
|
||||
* Useful to prevent excess allocations that might otherwise not be used, but be careful not to over-optimize things.
|
||||
*/
|
||||
var lazyInitialize: PropertyDecorator;
|
||||
/**
|
||||
* Mixes in all property descriptors from the provided Plain Old JavaScript Objects (aka POJOs) as arguments.
|
||||
* Mixins are applied in the order they are passed, but do not override descriptors already on the class, including those inherited traditionally.
|
||||
*/
|
||||
var mixin: (...mixins: any[]) => ClassDecorator;
|
||||
/**
|
||||
* Mixes in all property descriptors from the provided Plain Old JavaScript Objects (aka POJOs) as arguments.
|
||||
* Mixins are applied in the order they are passed, but do not override descriptors already on the class, including those inherited traditionally.
|
||||
*/
|
||||
var mixins: (...mixins: any[]) => ClassDecorator;
|
||||
/**
|
||||
* Uses console.time and console.timeEnd to provide function timings with a unique label whose default prefix is ClassName.method. Supply a first argument to override the prefix:
|
||||
*/
|
||||
var time: (label: string, console?: Console) => MethodDecorator;
|
||||
|
||||
export {
|
||||
autobind,
|
||||
readonly,
|
||||
override,
|
||||
deprecate,
|
||||
deprecated,
|
||||
debounce,
|
||||
throttle,
|
||||
suppressWarnings,
|
||||
nonenumerable,
|
||||
nonconfigurable,
|
||||
memoize,
|
||||
decorate,
|
||||
lazyInitialize,
|
||||
mixin,
|
||||
mixins,
|
||||
time,
|
||||
};
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction | void;
|
||||
}
|
||||
|
||||
export interface ParameterDecorator {
|
||||
(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||
}
|
||||
|
||||
export interface PropertyDecorator {
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
}
|
||||
|
||||
export interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
|
||||
}
|
||||
|
||||
export interface PropertyOrMethodDecorator extends MethodDecorator, PropertyDecorator {
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
}
|
||||
|
||||
export interface Deprecate extends MethodDecorator {
|
||||
(message?: string, option?: DeprecateOption): MethodDecorator;
|
||||
}
|
||||
|
||||
export interface DeprecateOption {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface ThrottleOptions {
|
||||
/** allows to trigger function on the leading. */
|
||||
leading?: boolean;
|
||||
/** allows to trigger function on the trailing edge of the wait interval. */
|
||||
trailing?: boolean;
|
||||
}
|
||||
|
||||
export interface Console {
|
||||
log(message?: any, ...optionalParams: any[]): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces invocations of this function to always have this refer to the class instance,
|
||||
* even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method;
|
||||
*/
|
||||
declare var autobind: Function;
|
||||
/**
|
||||
* Marks a property or method as not being writable.
|
||||
*/
|
||||
declare var readonly: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain.
|
||||
*/
|
||||
declare var override: MethodDecorator;
|
||||
/**
|
||||
* Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading.
|
||||
*/
|
||||
declare var deprecate: Deprecate;
|
||||
/**
|
||||
* Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading.
|
||||
*/
|
||||
declare var deprecated: Deprecate;
|
||||
/**
|
||||
* Creates a new debounced function which will be invoked after wait milliseconds since the time it was invoked. Default timeout is 300 ms.
|
||||
*/
|
||||
declare var debounce: (wait: number) => MethodDecorator;
|
||||
/**
|
||||
* Creates a new throttled function which will be invoked in every wait milliseconds. Default timeout is 300 ms.
|
||||
*/
|
||||
declare var throttle: (wait: number, options?: ThrottleOptions) => MethodDecorator;
|
||||
/**
|
||||
* Suppresses any JavaScript console.warn() call while the decorated function is called. (i.e. on the stack)
|
||||
*/
|
||||
declare var suppressWarnings: MethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being enumerable.
|
||||
*/
|
||||
declare var nonenumerable: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being writable.
|
||||
*/
|
||||
declare var nonconfigurable: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Initial implementation included, likely slow. WIP.
|
||||
*/
|
||||
declare var memoize: MethodDecorator;
|
||||
/**
|
||||
* Immediately applies the provided function and arguments to the method, allowing you to wrap methods with arbitrary helpers like those provided by lodash.
|
||||
* The first argument is the function to apply, all further arguments will be passed to that decorating function.
|
||||
*/
|
||||
declare var decorate: (func: Function, ...args: any[]) => MethodDecorator;
|
||||
/**
|
||||
* Prevents a property initializer from running until the decorated property is actually looked up.
|
||||
* Useful to prevent excess allocations that might otherwise not be used, but be careful not to over-optimize things.
|
||||
*/
|
||||
declare var lazyInitialize: PropertyDecorator;
|
||||
/**
|
||||
* Mixes in all property descriptors from the provided Plain Old JavaScript Objects (aka POJOs) as arguments.
|
||||
* Mixins are applied in the order they are passed, but do not override descriptors already on the class, including those inherited traditionally.
|
||||
*/
|
||||
declare var mixin: (...mixins: any[]) => ClassDecorator;
|
||||
/**
|
||||
* Mixes in all property descriptors from the provided Plain Old JavaScript Objects (aka POJOs) as arguments.
|
||||
* Mixins are applied in the order they are passed, but do not override descriptors already on the class, including those inherited traditionally.
|
||||
*/
|
||||
declare var mixins: (...mixins: any[]) => ClassDecorator;
|
||||
/**
|
||||
* Uses console.time and console.timeEnd to provide function timings with a unique label whose default prefix is ClassName.method. Supply a first argument to override the prefix:
|
||||
*/
|
||||
declare var time: (label: string, console?: Console) => MethodDecorator;
|
||||
|
||||
export {
|
||||
autobind,
|
||||
readonly,
|
||||
override,
|
||||
deprecate,
|
||||
deprecated,
|
||||
debounce,
|
||||
throttle,
|
||||
suppressWarnings,
|
||||
nonenumerable,
|
||||
nonconfigurable,
|
||||
memoize,
|
||||
decorate,
|
||||
lazyInitialize,
|
||||
mixin,
|
||||
mixins,
|
||||
time,
|
||||
};
|
||||
|
||||
27
cors/cors.d.ts
vendored
27
cors/cors.d.ts
vendored
@ -5,20 +5,19 @@
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
declare module "cors" {
|
||||
import express = require('express');
|
||||
|
||||
namespace e {
|
||||
interface CorsOptions {
|
||||
origin?: any;
|
||||
methods?: any;
|
||||
allowedHeaders?: any;
|
||||
exposedHeaders?: any;
|
||||
credentials?: boolean;
|
||||
maxAge?: number;
|
||||
}
|
||||
import express = require('express');
|
||||
|
||||
declare namespace e {
|
||||
interface CorsOptions {
|
||||
origin?: any;
|
||||
methods?: any;
|
||||
allowedHeaders?: any;
|
||||
exposedHeaders?: any;
|
||||
credentials?: boolean;
|
||||
maxAge?: number;
|
||||
}
|
||||
|
||||
function e(options?: e.CorsOptions): express.RequestHandler;
|
||||
export = e;
|
||||
}
|
||||
|
||||
declare function e(options?: e.CorsOptions): express.RequestHandler;
|
||||
export = e;
|
||||
|
||||
2039
couchbase/couchbase.d.ts
vendored
2039
couchbase/couchbase.d.ts
vendored
File diff suppressed because it is too large
Load Diff
227
cradle/cradle.d.ts
vendored
227
cradle/cradle.d.ts
vendored
@ -3,120 +3,119 @@
|
||||
// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "cradle" {
|
||||
interface Options {
|
||||
host?: string;
|
||||
hostname?: string;
|
||||
cache?: boolean;
|
||||
raw?: boolean;
|
||||
forceSave?: boolean;
|
||||
auth?: string | {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
ca?: string;
|
||||
secure?: boolean;
|
||||
retries?: number;
|
||||
retryTimeout?: number;
|
||||
maxSockets?: number;
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
(error: any, response: any): void;
|
||||
interface Options {
|
||||
host?: string;
|
||||
hostname?: string;
|
||||
cache?: boolean;
|
||||
raw?: boolean;
|
||||
forceSave?: boolean;
|
||||
auth?: string | {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface ErrorCallback {
|
||||
(error: any): void;
|
||||
}
|
||||
|
||||
export class Connection {
|
||||
constructor(uri?: string, port?: number, options?: Options);
|
||||
database(name: string): Database;
|
||||
databases(Callback: Callback): void;
|
||||
config(callback: Callback): void;
|
||||
info(callback: Callback): void;
|
||||
stats(callback: Callback): void;
|
||||
activeTasks(callback: Callback): void;
|
||||
uuids(callback: Callback): void;
|
||||
uuids(count: number, callback: Callback): void;
|
||||
replicate(options: {
|
||||
source: string | {
|
||||
url: string;
|
||||
};
|
||||
target: string | {
|
||||
url: string;
|
||||
};
|
||||
cancel?: boolean;
|
||||
continuous?: boolean;
|
||||
create_target?: boolean;
|
||||
doc_ids?: string[];
|
||||
filter?: string;
|
||||
proxy?: string;
|
||||
query_params?: any;
|
||||
}, callback: Callback): void;
|
||||
}
|
||||
|
||||
export interface ChangesOptions {
|
||||
since: number;
|
||||
}
|
||||
|
||||
export class Database {
|
||||
name: string;
|
||||
get(id: string, callback: (error: any, document: any) => void): void;
|
||||
get<T>(id: string, callback: (error: any, document: T) => void): void;
|
||||
get(id: string, rev: string, callback: (error: any, document: any) => void): void;
|
||||
get<T>(id: string, rev: string, callback: (error: any, document: T) => void): void;
|
||||
get(ids: string[], callback: Callback): void;
|
||||
save(document: any, callback: Callback): void;
|
||||
save(id: string, document: any, callback: Callback): void;
|
||||
save(id: string, revision: string, document: any,
|
||||
callback: Callback): void;
|
||||
save<T>(document: T, callback: Callback): void;
|
||||
save<T>(id: string, document: T, callback: Callback): void;
|
||||
save<T>(id: string, revision: string, document: T,
|
||||
callback: Callback): void;
|
||||
save(documents: any[], callback: Callback): void;
|
||||
merge(id: string, document: any, callback: Callback): void;
|
||||
merge<T>(id: string, document: T, callback: Callback): void;
|
||||
remove(id: string, revision: string, callback: Callback): void;
|
||||
update(name: string, id: string, queryObject: any, documentBody: any,
|
||||
callback: Callback): void;
|
||||
view(name: string, callback: Callback): void;
|
||||
view(name: string, options: {
|
||||
group?: boolean;
|
||||
reduce?: boolean;
|
||||
key?: string;
|
||||
startkey?: any;
|
||||
endkey?: any;
|
||||
include_docs?: boolean;
|
||||
limit?: number;
|
||||
descending?: boolean;
|
||||
}, callback: Callback): void;
|
||||
temporaryView(view: any, callback: Callback): void;
|
||||
create(callback: ErrorCallback): void;
|
||||
exists(callback: (error: any, exists: boolean) => void): void;
|
||||
destroy(callback: ErrorCallback): void;
|
||||
changes(options: ChangesOptions): any;
|
||||
changes(callback: (error: any, list: any[]) => void): void;
|
||||
changes(options: ChangesOptions, callback: (error: any,
|
||||
list: any[]) => void): void;
|
||||
saveAttachment(idAndRevData: {
|
||||
id: string;
|
||||
rev: string;
|
||||
}, attachmentData: any, callback: Callback): void;
|
||||
getAttachment(id: string, attachmentName: string,
|
||||
callback: Callback): void;
|
||||
removeAttachment(id: string, attachmentName: string,
|
||||
callback: Callback): void;
|
||||
info(callback: Callback): void;
|
||||
all(callback: Callback): void;
|
||||
all(options: any, callback: Callback): void;
|
||||
compact(callback: Callback): void;
|
||||
compact(design: string, callback: Callback): void;
|
||||
viewCleanup(callback: Callback): void;
|
||||
replicate(target: string, callback: Callback): void;
|
||||
replicate(target: string, options: any, callback: Callback): void;
|
||||
}
|
||||
|
||||
export function setup(options: Options): void;
|
||||
ca?: string;
|
||||
secure?: boolean;
|
||||
retries?: number;
|
||||
retryTimeout?: number;
|
||||
maxSockets?: number;
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
(error: any, response: any): void;
|
||||
}
|
||||
|
||||
interface ErrorCallback {
|
||||
(error: any): void;
|
||||
}
|
||||
|
||||
declare export class Connection {
|
||||
constructor(uri?: string, port?: number, options?: Options);
|
||||
database(name: string): Database;
|
||||
databases(Callback: Callback): void;
|
||||
config(callback: Callback): void;
|
||||
info(callback: Callback): void;
|
||||
stats(callback: Callback): void;
|
||||
activeTasks(callback: Callback): void;
|
||||
uuids(callback: Callback): void;
|
||||
uuids(count: number, callback: Callback): void;
|
||||
replicate(options: {
|
||||
source: string | {
|
||||
url: string;
|
||||
};
|
||||
target: string | {
|
||||
url: string;
|
||||
};
|
||||
cancel?: boolean;
|
||||
continuous?: boolean;
|
||||
create_target?: boolean;
|
||||
doc_ids?: string[];
|
||||
filter?: string;
|
||||
proxy?: string;
|
||||
query_params?: any;
|
||||
}, callback: Callback): void;
|
||||
}
|
||||
|
||||
export interface ChangesOptions {
|
||||
since: number;
|
||||
}
|
||||
|
||||
declare export class Database {
|
||||
name: string;
|
||||
get(id: string, callback: (error: any, document: any) => void): void;
|
||||
get<T>(id: string, callback: (error: any, document: T) => void): void;
|
||||
get(id: string, rev: string, callback: (error: any, document: any) => void): void;
|
||||
get<T>(id: string, rev: string, callback: (error: any, document: T) => void): void;
|
||||
get(ids: string[], callback: Callback): void;
|
||||
save(document: any, callback: Callback): void;
|
||||
save(id: string, document: any, callback: Callback): void;
|
||||
save(id: string, revision: string, document: any,
|
||||
callback: Callback): void;
|
||||
save<T>(document: T, callback: Callback): void;
|
||||
save<T>(id: string, document: T, callback: Callback): void;
|
||||
save<T>(id: string, revision: string, document: T,
|
||||
callback: Callback): void;
|
||||
save(documents: any[], callback: Callback): void;
|
||||
merge(id: string, document: any, callback: Callback): void;
|
||||
merge<T>(id: string, document: T, callback: Callback): void;
|
||||
remove(id: string, revision: string, callback: Callback): void;
|
||||
update(name: string, id: string, queryObject: any, documentBody: any,
|
||||
callback: Callback): void;
|
||||
view(name: string, callback: Callback): void;
|
||||
view(name: string, options: {
|
||||
group?: boolean;
|
||||
reduce?: boolean;
|
||||
key?: string;
|
||||
startkey?: any;
|
||||
endkey?: any;
|
||||
include_docs?: boolean;
|
||||
limit?: number;
|
||||
descending?: boolean;
|
||||
}, callback: Callback): void;
|
||||
temporaryView(view: any, callback: Callback): void;
|
||||
create(callback: ErrorCallback): void;
|
||||
exists(callback: (error: any, exists: boolean) => void): void;
|
||||
destroy(callback: ErrorCallback): void;
|
||||
changes(options: ChangesOptions): any;
|
||||
changes(callback: (error: any, list: any[]) => void): void;
|
||||
changes(options: ChangesOptions, callback: (error: any,
|
||||
list: any[]) => void): void;
|
||||
saveAttachment(idAndRevData: {
|
||||
id: string;
|
||||
rev: string;
|
||||
}, attachmentData: any, callback: Callback): void;
|
||||
getAttachment(id: string, attachmentName: string,
|
||||
callback: Callback): void;
|
||||
removeAttachment(id: string, attachmentName: string,
|
||||
callback: Callback): void;
|
||||
info(callback: Callback): void;
|
||||
all(callback: Callback): void;
|
||||
all(options: any, callback: Callback): void;
|
||||
compact(callback: Callback): void;
|
||||
compact(design: string, callback: Callback): void;
|
||||
viewCleanup(callback: Callback): void;
|
||||
replicate(target: string, callback: Callback): void;
|
||||
replicate(target: string, options: any, callback: Callback): void;
|
||||
}
|
||||
|
||||
declare export function setup(options: Options): void;
|
||||
|
||||
23
create-error/create-error.d.ts
vendored
23
create-error/create-error.d.ts
vendored
@ -3,19 +3,18 @@
|
||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'create-error' {
|
||||
// FIXME See Global type references https://github.com/Microsoft/TypeScript/issues/983
|
||||
type Err = Error;
|
||||
|
||||
namespace createError {
|
||||
// FIXME See Global type references https://github.com/Microsoft/TypeScript/issues/983
|
||||
type Err = Error;
|
||||
|
||||
declare namespace createError {
|
||||
interface Error<T extends Err> extends Err {
|
||||
new (message?: string, obj?: any): T;
|
||||
new (message?: string, obj?: any): T;
|
||||
}
|
||||
}
|
||||
|
||||
function createError(): createError.Error<Error>;
|
||||
function createError<T extends createError.Error<Error>>(name: string, properties?: any): T;
|
||||
function createError<T extends createError.Error<Error>>(Target: createError.Error<Error>, name?: string, properties?: any): T;
|
||||
|
||||
export = createError;
|
||||
}
|
||||
|
||||
declare function createError(): createError.Error<Error>;
|
||||
declare function createError<T extends createError.Error<Error>>(name: string, properties?: any): T;
|
||||
declare function createError<T extends createError.Error<Error>>(Target: createError.Error<Error>, name?: string, properties?: any): T;
|
||||
|
||||
export = createError;
|
||||
|
||||
16
credential/credential.d.ts
vendored
16
credential/credential.d.ts
vendored
@ -3,16 +3,14 @@
|
||||
// Definitions by: Phú <https://github.com/phuvo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'credential' {
|
||||
|
||||
type HashCallback = (err: Error, hash: string) => void;
|
||||
type VerifyCallback = (err: Error, isValid: boolean) => void;
|
||||
|
||||
namespace credential {
|
||||
function hash(password: string, callback: HashCallback): void;
|
||||
function verify(hash: string, password: string, callback: VerifyCallback): void;
|
||||
}
|
||||
|
||||
export = credential;
|
||||
type HashCallback = (err: Error, hash: string) => void;
|
||||
type VerifyCallback = (err: Error, isValid: boolean) => void;
|
||||
|
||||
declare namespace credential {
|
||||
function hash(password: string, callback: HashCallback): void;
|
||||
function verify(hash: string, password: string, callback: VerifyCallback): void;
|
||||
}
|
||||
|
||||
export = credential;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user