mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -14,6 +14,9 @@ traverse(ast, {
|
||||
if (t.isIdentifier(node, { name: "n" })) {
|
||||
node.name = "x";
|
||||
}
|
||||
if (t.isFunctionExpression(node)) {
|
||||
node.params = [t.identifier('param')];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,3 +27,5 @@ if (t.isBinaryExpression(ast)) {
|
||||
}
|
||||
t.assertBinaryExpression(ast);
|
||||
t.assertBinaryExpression(ast, { operator: "*" });
|
||||
|
||||
var exp: t.Expression = t.nullLiteral();
|
||||
|
||||
Vendored
+19
-19
@@ -1,6 +1,6 @@
|
||||
// Type definitions for babel-types v6.7
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-types
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>, Sam Baxter <https://github.com/baxtersa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Comment {
|
||||
@@ -88,7 +88,7 @@ export interface CallExpression extends Node {
|
||||
|
||||
export interface CatchClause extends Node {
|
||||
type: "CatchClause";
|
||||
param: Pattern;
|
||||
param: Identifier;
|
||||
body: BlockStatement;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export interface ForStatement extends Node {
|
||||
export interface FunctionDeclaration extends Node {
|
||||
type: "FunctionDeclaration";
|
||||
id: Identifier;
|
||||
params: Pattern[];
|
||||
params: Array<LVal>;
|
||||
body: BlockStatement;
|
||||
generator: boolean;
|
||||
async: boolean;
|
||||
@@ -159,7 +159,7 @@ export interface FunctionDeclaration extends Node {
|
||||
export interface FunctionExpression extends Node {
|
||||
type: "FunctionExpression";
|
||||
id: Identifier;
|
||||
params: Pattern[];
|
||||
params: Array<LVal>;
|
||||
body: BlockStatement;
|
||||
generator: boolean;
|
||||
async: boolean;
|
||||
@@ -252,7 +252,7 @@ export interface ObjectMethod extends Node {
|
||||
value: Expression;
|
||||
decorators?: Decorator[];
|
||||
id: Identifier;
|
||||
params: Pattern[];
|
||||
params: Array<LVal>;
|
||||
body: BlockStatement;
|
||||
generator: boolean;
|
||||
async: boolean;
|
||||
@@ -353,20 +353,20 @@ export interface WithStatement extends Node {
|
||||
|
||||
export interface AssignmentPattern extends Node {
|
||||
type: "AssignmentPattern";
|
||||
left: Pattern;
|
||||
left: Identifier;
|
||||
right: Expression;
|
||||
}
|
||||
|
||||
export interface ArrayPattern extends Node {
|
||||
type: "ArrayPattern";
|
||||
elements: Array<Pattern>;
|
||||
elements: Array<Expression>;
|
||||
typeAnnotation?: TypeAnnotation;
|
||||
}
|
||||
|
||||
export interface ArrowFunctionExpression extends Node {
|
||||
type: "ArrowFunctionExpression";
|
||||
id: Identifier;
|
||||
params: Pattern[];
|
||||
params: Array<LVal>;
|
||||
body: BlockStatement | Expression;
|
||||
generator: boolean;
|
||||
async: boolean;
|
||||
@@ -472,7 +472,7 @@ export interface ClassMethod extends Node {
|
||||
static: boolean;
|
||||
decorators?: Decorator[];
|
||||
id: Identifier;
|
||||
params: Pattern[];
|
||||
params: Array<LVal>;
|
||||
body: BlockStatement;
|
||||
generator: boolean;
|
||||
async: boolean;
|
||||
@@ -870,7 +870,7 @@ export interface SpreadProperty extends Node {
|
||||
argument: Expression;
|
||||
}
|
||||
|
||||
export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | BooleanLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | TypeCastExpression | JSXElement | JSXEmptyExpression | JSXIdentifier | JSXMemberExpression | ParenthesizedExpression | AwaitExpression | BindExpression | DoExpression;
|
||||
export type Expression = ArrayExpression | AssignmentExpression | BinaryExpression | CallExpression | ConditionalExpression | FunctionExpression | Identifier | StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | RegExpLiteral | LogicalExpression | MemberExpression | NewExpression | ObjectExpression | SequenceExpression | ThisExpression | UnaryExpression | UpdateExpression | ArrowFunctionExpression | ClassExpression | MetaProperty | Super | TaggedTemplateExpression | TemplateLiteral | YieldExpression | TypeCastExpression | JSXElement | JSXEmptyExpression | JSXIdentifier | JSXMemberExpression | ParenthesizedExpression | AwaitExpression | BindExpression | DoExpression;
|
||||
export type Binary = BinaryExpression | LogicalExpression;
|
||||
export type Scopable = BlockStatement | CatchClause | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ClassDeclaration | ClassExpression | ForOfStatement | ClassMethod;
|
||||
export type BlockParent = BlockStatement | DoWhileStatement | ForInStatement | ForStatement | FunctionDeclaration | FunctionExpression | Program | ObjectMethod | SwitchStatement | WhileStatement | ArrowFunctionExpression | ForOfStatement | ClassMethod;
|
||||
@@ -886,11 +886,11 @@ export type For = ForInStatement | ForStatement | ForOfStatement;
|
||||
export type ForXStatement = ForInStatement | ForOfStatement;
|
||||
export type Function = FunctionDeclaration | FunctionExpression | ObjectMethod | ArrowFunctionExpression | ClassMethod;
|
||||
export type FunctionParent = FunctionDeclaration | FunctionExpression | Program | ObjectMethod | ArrowFunctionExpression | ClassMethod;
|
||||
export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | BooleanLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression;
|
||||
export type Pureish = FunctionDeclaration | FunctionExpression | StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | ArrowFunctionExpression | ClassDeclaration | ClassExpression;
|
||||
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ImportDeclaration | DeclareClass | DeclareFunction | DeclareInterface | DeclareModule | DeclareTypeAlias | DeclareVariable | InterfaceDeclaration | TypeAlias;
|
||||
export type LVal = Identifier | MemberExpression | RestElement | AssignmentPattern | ArrayPattern | ObjectPattern;
|
||||
export type Literal = StringLiteral | NumericLiteral | BooleanLiteral | RegExpLiteral | TemplateLiteral;
|
||||
export type Immutable = StringLiteral | NumericLiteral | BooleanLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXOpeningElement;
|
||||
export type Literal = StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | RegExpLiteral | TemplateLiteral;
|
||||
export type Immutable = StringLiteral | NumericLiteral | BooleanLiteral | NullLiteral | JSXAttribute | JSXClosingElement | JSXElement | JSXExpressionContainer | JSXOpeningElement;
|
||||
export type UserWhitespacable = ObjectMethod | ObjectProperty | ObjectTypeCallProperty | ObjectTypeIndexer | ObjectTypeProperty;
|
||||
export type Method = ObjectMethod | ClassMethod;
|
||||
export type ObjectMember = ObjectMethod | ObjectProperty;
|
||||
@@ -925,8 +925,8 @@ export function expressionStatement(expression?: Expression): ExpressionStatemen
|
||||
export function file(program?: Program, comments?: Comment[], tokens?: any[]): File;
|
||||
export function forInStatement(left?: VariableDeclaration | LVal, right?: Expression, body?: Statement): ForInStatement;
|
||||
export function forStatement(init?: VariableDeclaration | Expression, test?: Expression, update?: Expression, body?: Statement): ForStatement;
|
||||
export function functionDeclaration(id?: Identifier, params?: Pattern[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionDeclaration;
|
||||
export function functionExpression(id?: Identifier, params?: Pattern[], body?: BlockStatement, generator?: boolean, async?: boolean): FunctionExpression;
|
||||
export function functionDeclaration(id?: Identifier, params?: Array<LVal>, body?: BlockStatement, generator?: boolean, async?: boolean): FunctionDeclaration;
|
||||
export function functionExpression(id?: Identifier, params?: Array<LVal>, body?: BlockStatement, generator?: boolean, async?: boolean): FunctionExpression;
|
||||
export function identifier(name?: string): Identifier;
|
||||
export function ifStatement(test?: Expression, consequent?: Statement, alternate?: Statement): IfStatement;
|
||||
export function labeledStatement(label?: Identifier, body?: Statement): LabeledStatement;
|
||||
@@ -940,7 +940,7 @@ export function memberExpression(object?: Expression | Super, property?: Express
|
||||
export function newExpression(callee?: Expression | Super, _arguments?: Array<Expression | SpreadElement>): NewExpression;
|
||||
export function program(body?: Array<Statement | ModuleDeclaration>, directives?: Directive[]): Program;
|
||||
export function objectExpression(properties?: Array<ObjectProperty | ObjectMethod | SpreadProperty>): ObjectExpression;
|
||||
export function objectMethod(kind?: "get" | "set" | "method", key?: Expression, params?: Pattern[], body?: BlockStatement, computed?: boolean): ObjectMethod;
|
||||
export function objectMethod(kind?: "get" | "set" | "method", key?: Expression, params?: Array<LVal>, body?: BlockStatement, computed?: boolean): ObjectMethod;
|
||||
export function objectProperty(key?: Expression, value?: Expression, computed?: boolean, shorthand?: boolean, decorators?: Decorator[]): ObjectProperty;
|
||||
export function restElement(argument?: LVal, typeAnnotation?: TypeAnnotation): RestElement;
|
||||
export function returnStatement(argument?: Expression): ReturnStatement;
|
||||
@@ -957,8 +957,8 @@ export function variableDeclarator(id?: LVal, init?: Expression): VariableDeclar
|
||||
export function whileStatement(test?: Expression, body?: BlockStatement | Statement): WhileStatement;
|
||||
export function withStatement(object?: Expression, body?: BlockStatement | Statement): WithStatement;
|
||||
export function assignmentPattern(left?: Identifier, right?: Expression): AssignmentPattern;
|
||||
export function arrayPattern(elements?: Array<Pattern>, typeAnnotation?: TypeAnnotation): ArrayPattern;
|
||||
export function arrowFunctionExpression(params?: Pattern[], body?: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression;
|
||||
export function arrayPattern(elements?: Array<Expression>, typeAnnotation?: TypeAnnotation): ArrayPattern;
|
||||
export function arrowFunctionExpression(params?: Array<LVal>, body?: BlockStatement | Expression, async?: boolean): ArrowFunctionExpression;
|
||||
export function classBody(body?: Array<ClassMethod | ClassProperty>): ClassBody;
|
||||
export function classDeclaration(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassDeclaration;
|
||||
export function classExpression(id?: Identifier, superClass?: Expression, body?: ClassBody, decorators?: Decorator[]): ClassExpression;
|
||||
@@ -972,7 +972,7 @@ export function importDefaultSpecifier(local?: Identifier): ImportDefaultSpecifi
|
||||
export function importNamespaceSpecifier(local?: Identifier): ImportNamespaceSpecifier;
|
||||
export function importSpecifier(local?: Identifier, imported?: Identifier): ImportSpecifier;
|
||||
export function metaProperty(meta?: string, property?: string): MetaProperty;
|
||||
export function classMethod(kind?: "constructor" | "method" | "get" | "set", key?: Expression, params?: Pattern[], body?: BlockStatement, computed?: boolean, _static?: boolean): ClassMethod;
|
||||
export function classMethod(kind?: "constructor" | "method" | "get" | "set", key?: Expression, params?: Array<LVal>, body?: BlockStatement, computed?: boolean, _static?: boolean): ClassMethod;
|
||||
export function objectPattern(properties?: Array<AssignmentProperty | RestProperty>, typeAnnotation?: TypeAnnotation): ObjectPattern;
|
||||
export function spreadElement(argument?: Expression): SpreadElement;
|
||||
export function taggedTemplateExpression(tag?: Expression, quasi?: TemplateLiteral): TaggedTemplateExpression;
|
||||
|
||||
@@ -292,6 +292,14 @@ function RegionTests() {
|
||||
|
||||
}
|
||||
|
||||
function ViewTests() {
|
||||
const v = new MyView(new MyModel());
|
||||
const isDestroyed: boolean = v.isDestroyed();
|
||||
const isRendered: boolean = v.isRendered();
|
||||
const isAttached: boolean = v.isAttached();
|
||||
const vv: Marionette.View<Backbone.Model> = v.delegateEntityEvents();
|
||||
}
|
||||
|
||||
function CollectionViewTests() {
|
||||
var cv = new MyCollectionView();
|
||||
cv.collection.add(new MyModel());
|
||||
|
||||
Vendored
+4
-1
@@ -856,7 +856,10 @@ declare namespace Marionette {
|
||||
/**
|
||||
* Internal properties extended in Marionette.View.
|
||||
*/
|
||||
isDestroyed: boolean;
|
||||
isDestroyed(): boolean;
|
||||
isRendered(): boolean;
|
||||
isAttached(): boolean;
|
||||
delegateEntityEvents(): View<TModel>;
|
||||
supportsRenderLifecycle: boolean;
|
||||
supportsDestroyLifecycle: boolean;
|
||||
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
import * as bonjour from 'bonjour';
|
||||
|
||||
var bonjourOptions: bonjour.BonjourOptions;
|
||||
var bonjourInstance: bonjour.Bonjour;
|
||||
let bonjourOptions: bonjour.BonjourOptions;
|
||||
let bonjourInstance: bonjour.Bonjour;
|
||||
|
||||
var serviceOptions: bonjour.ServiceOptions;
|
||||
var service: bonjour.Service;
|
||||
let serviceOptions: bonjour.ServiceOptions;
|
||||
let service: bonjour.Service;
|
||||
|
||||
var browserOptions: bonjour.BrowserOptions;
|
||||
var browser: bonjour.Browser;
|
||||
let browserOptions: bonjour.BrowserOptions;
|
||||
let browser: bonjour.Browser;
|
||||
|
||||
bonjourOptions = { interface: '192.168.1.1', port: 5353 };
|
||||
bonjourInstance = new bonjour.Bonjour(bonjourOptions);
|
||||
bonjourOptions = {};
|
||||
bonjourInstance = bonjour(bonjourOptions);
|
||||
|
||||
serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 };
|
||||
// Publish a dummy server under name 'My Website' type http port 3000
|
||||
serviceOptions = { name: 'My Website', type: 'http', port: 3000 };
|
||||
service = bonjourInstance.publish(serviceOptions);
|
||||
|
||||
browserOptions = { protocol: 'tcp', type: 'http' };
|
||||
browser = bonjour.find(browserOptions);
|
||||
|
||||
// Look for the server
|
||||
browser = bonjourInstance.findOne(browserOptions, (srv: bonjour.Service) => {
|
||||
// You can test here if the found server (srv) name is 'My Website'
|
||||
});
|
||||
|
||||
Vendored
+78
-64
@@ -1,68 +1,82 @@
|
||||
// Type definitions for bonjour v3.5.0
|
||||
// Type definitions for bonjour 3.5
|
||||
// Project: https://github.com/watson/bonjour
|
||||
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>
|
||||
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>, Nicolas Voigt <https://github.com/octo-sniffle>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
///<reference types="node" />
|
||||
|
||||
export interface BonjourOptions {
|
||||
multicast?: boolean;
|
||||
interface?: string;
|
||||
port?: number;
|
||||
ip?: string;
|
||||
ttl?: number;
|
||||
loopback?: boolean;
|
||||
reuseAddr?: boolean;
|
||||
declare function bonjour(opts?: bonjour.BonjourOptions): bonjour.Bonjour;
|
||||
export = bonjour;
|
||||
declare namespace bonjour {
|
||||
/**
|
||||
* Start a browser
|
||||
*
|
||||
* The browser listens for services by querying for PTR records of a given
|
||||
* type, protocol and domain, e.g. _http._tcp.local.
|
||||
*
|
||||
* If no type is given, a wild card search is performed.
|
||||
*
|
||||
* An internal list of online services is kept which starts out empty. When
|
||||
* ever a new service is discovered, it's added to the list and an "up" event
|
||||
* is emitted with that service. When it's discovered that the service is no
|
||||
* longer available, it is removed from the list and a "down" event is emitted
|
||||
* with that service.
|
||||
*/
|
||||
interface Browser extends NodeJS.EventEmitter {
|
||||
services: Service[];
|
||||
start(): void;
|
||||
update(): void;
|
||||
stop(): void;
|
||||
on(event: 'up' | 'down', listener: (service: Service) => void): this;
|
||||
once(event: 'up' | 'down', listener: (service: Service) => void): this;
|
||||
removeListener(event: 'up' | 'down', listener: (service: Service) => void): this;
|
||||
removeAllListeners(event: 'up' | 'down'): this;
|
||||
}
|
||||
interface BrowserOptions {
|
||||
type?: string;
|
||||
subtypes?: string[];
|
||||
protocol?: string;
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
interface ServiceOptions {
|
||||
name: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: string;
|
||||
subtypes?: string[];
|
||||
protocol?: 'udp'|'tcp';
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
interface Service extends NodeJS.EventEmitter {
|
||||
name: string;
|
||||
type: string;
|
||||
subtypes: string[];
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
fqdn: string;
|
||||
txt: Object;
|
||||
published: boolean;
|
||||
|
||||
stop(cb: () => any): void;
|
||||
start(): void;
|
||||
}
|
||||
interface BonjourOptions {
|
||||
multicast?: boolean;
|
||||
interface?: string;
|
||||
port?: number;
|
||||
ip?: string;
|
||||
ttl?: number;
|
||||
loopback?: boolean;
|
||||
reuseAddr?: boolean;
|
||||
}
|
||||
interface Bonjour {
|
||||
(opts?: BonjourOptions): Bonjour;
|
||||
publish(options: ServiceOptions): Service;
|
||||
unpublishAll(cb?: () => void): void;
|
||||
find(options: BrowserOptions, onUp?: (service: Service) => void): Browser;
|
||||
findOne(options: BrowserOptions, cb?: (service: Service) => void): Browser;
|
||||
destroy(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export interface BrowserOptions {
|
||||
type?: string;
|
||||
subtypes?: string[];
|
||||
protocol?: string;
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface ServiceOptions {
|
||||
name: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: string;
|
||||
subtypes?: string[];
|
||||
protocol?: 'udp'|'tcp';
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface Service {
|
||||
name: string;
|
||||
type: string;
|
||||
subtypes: string[];
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
fqdn: string;
|
||||
rawTxt: Object;
|
||||
txt: Object;
|
||||
published: boolean;
|
||||
|
||||
stop: (cb: ()=>any) => void;
|
||||
start: () => void;
|
||||
}
|
||||
|
||||
export class Bonjour {
|
||||
|
||||
constructor(opts: BonjourOptions);
|
||||
publish(options: ServiceOptions):Service;
|
||||
unpublishAll(cb: ()=>any): void;
|
||||
find(options:BrowserOptions, onUp: ()=>any): Browser;
|
||||
findOne(options:any, cb: (service: Service)=>any): Browser;
|
||||
destroy():void;
|
||||
}
|
||||
|
||||
export class Browser {
|
||||
services: Service[];
|
||||
|
||||
start():void;
|
||||
update():void;
|
||||
stop():void;
|
||||
}
|
||||
|
||||
export function find(options: BrowserOptions, onUp?: ()=>any): Browser;
|
||||
export function findOne(options: BrowserOptions): Browser;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -178,7 +178,7 @@ declare namespace CodeMirror {
|
||||
/** Remove a CSS class from a line.line can be a line handle or number.
|
||||
where should be one of "text", "background", or "wrap"(see addLineClass).
|
||||
class can be left off to remove all classes for the specified node, or be a string to remove only a specific class. */
|
||||
removeLineClass(line: any, where: string, class_: string): CodeMirror.LineHandle;
|
||||
removeLineClass(line: any, where: string, class_?: string): CodeMirror.LineHandle;
|
||||
|
||||
/**
|
||||
* Compute the line at the given pixel height.
|
||||
|
||||
Vendored
+7
@@ -67,6 +67,13 @@ declare namespace Color {
|
||||
hex(color: string): Color;
|
||||
hex(): string;
|
||||
rgb(): Color;
|
||||
hsl(): Color;
|
||||
hsv(): Color;
|
||||
hwb(): Color;
|
||||
hcg(): Color;
|
||||
cmyk(): Color;
|
||||
xyz(): Color;
|
||||
lab(): Color;
|
||||
rgbNumber(): number;
|
||||
luminosity(): number;
|
||||
contrast(color: Color): number;
|
||||
|
||||
Vendored
+5
@@ -131,6 +131,11 @@ declare namespace cropperjs {
|
||||
*/
|
||||
rotatable?: boolean;
|
||||
/**
|
||||
* Enable to restore the cropped area after resizing the window.
|
||||
* @default true
|
||||
*/
|
||||
restore?: boolean;
|
||||
/**
|
||||
* Enable to scale the image.
|
||||
* @default true
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
|
||||
|
||||
// tslint:disable:no-var only-arrow-functions
|
||||
import jsdiff = require('diff');
|
||||
|
||||
var one = 'beep boop';
|
||||
var other = 'beep boob blah';
|
||||
|
||||
var diff = jsdiff.diffChars(one, other);
|
||||
|
||||
diff.forEach(function (part) {
|
||||
diff.forEach(function(part) {
|
||||
var mark = part.added ? '+' :
|
||||
part.removed ? '-' : ' ';
|
||||
console.log(mark + " " + part.value);
|
||||
@@ -16,11 +14,11 @@ diff.forEach(function (part) {
|
||||
// --------------------------
|
||||
|
||||
class LineDiffWithoutWhitespace extends jsdiff.Diff {
|
||||
tokenize(value:string):any {
|
||||
tokenize(value: string): any {
|
||||
return value.split(/^/m);
|
||||
}
|
||||
|
||||
equals(left:string, right:string):boolean {
|
||||
equals(left: string, right: string): boolean {
|
||||
return left.trim() === right.trim();
|
||||
}
|
||||
}
|
||||
@@ -29,8 +27,8 @@ var obj = new LineDiffWithoutWhitespace(true);
|
||||
var diff = obj.diff(one, other);
|
||||
printDiff(diff);
|
||||
|
||||
function printDiff(diff:jsdiff.IDiffResult[]) {
|
||||
function addLineHeader(decorator:string, str:string) {
|
||||
function printDiff(diff: jsdiff.IDiffResult[]) {
|
||||
function addLineHeader(decorator: string, str: string) {
|
||||
return str.split("\n").map((line, index, array) => {
|
||||
if (index === array.length - 1 && line === "") {
|
||||
return line;
|
||||
@@ -40,7 +38,7 @@ function printDiff(diff:jsdiff.IDiffResult[]) {
|
||||
}).join("\n");
|
||||
}
|
||||
|
||||
diff.forEach((part)=> {
|
||||
diff.forEach((part) => {
|
||||
if (part.added) {
|
||||
console.log(addLineHeader("+", part.value));
|
||||
} else if (part.removed) {
|
||||
|
||||
Vendored
+24
-20
@@ -1,7 +1,8 @@
|
||||
// Type definitions for diff
|
||||
// Type definitions for diff 3.2
|
||||
// Project: https://github.com/kpdecker/jsdiff
|
||||
// Definitions by: vvakame <https://github.com/vvakame/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = JsDiff;
|
||||
export as namespace JsDiff;
|
||||
@@ -36,34 +37,37 @@ declare namespace JsDiff {
|
||||
}
|
||||
|
||||
class Diff {
|
||||
ignoreWhitespace:boolean;
|
||||
ignoreWhitespace: boolean;
|
||||
|
||||
constructor(ignoreWhitespace?:boolean);
|
||||
constructor(ignoreWhitespace?: boolean);
|
||||
|
||||
diff(oldString:string, newString:string):IDiffResult[];
|
||||
diff(oldString: string, newString: string): IDiffResult[];
|
||||
|
||||
pushComponent(components:IDiffResult[], value:string, added:boolean, removed:boolean):void;
|
||||
pushComponent(components: IDiffResult[], value: string, added: boolean, removed: boolean): void;
|
||||
|
||||
extractCommon(basePath:IBestPath, newString:string, oldString:string, diagonalPath:number):number;
|
||||
extractCommon(basePath: IBestPath, newString: string, oldString: string, diagonalPath: number): number;
|
||||
|
||||
equals(left:string, right:string):boolean;
|
||||
equals(left: string, right: string): boolean;
|
||||
|
||||
join(left:string, right:string):string;
|
||||
join(left: string, right: string): string;
|
||||
|
||||
tokenize(value:string):any; // return types are string or string[]
|
||||
tokenize(value: string): any; // return types are string or string[]
|
||||
}
|
||||
|
||||
function diffChars(oldStr:string, newStr:string):IDiffResult[];
|
||||
function diffChars(oldStr: string, newStr: string): IDiffResult[];
|
||||
|
||||
function diffWords(oldStr:string, newStr:string):IDiffResult[];
|
||||
function diffWords(oldStr: string, newStr: string): IDiffResult[];
|
||||
|
||||
function diffWordsWithSpace(oldStr:string, newStr:string):IDiffResult[];
|
||||
function diffWordsWithSpace(oldStr: string, newStr: string): IDiffResult[];
|
||||
|
||||
function diffJson(oldObj: Object, newObj: Object): IDiffResult[];
|
||||
function diffJson(oldObj: object, newObj: object): IDiffResult[];
|
||||
|
||||
function diffLines(oldStr:string, newStr:string):IDiffResult[];
|
||||
function diffLines(oldStr: string, newStr: string, options?: {
|
||||
ignoreWhitespace?: boolean,
|
||||
newlineIsToken?: boolean,
|
||||
}): IDiffResult[];
|
||||
|
||||
function diffCss(oldStr:string, newStr:string):IDiffResult[];
|
||||
function diffCss(oldStr: string, newStr: string): IDiffResult[];
|
||||
|
||||
function createPatch(fileName: string, oldStr: string, newStr: string, oldHeader: string, newHeader: string, options?: {context: number}): string;
|
||||
|
||||
@@ -74,14 +78,14 @@ declare namespace JsDiff {
|
||||
function applyPatch(oldStr: string, uniDiff: string | IUniDiff | IUniDiff[]): string;
|
||||
|
||||
function applyPatches(uniDiff: IUniDiff[], options: {
|
||||
loadFile: (index: number, callback: (err: Error, data: string) => void) => void,
|
||||
patched: (index: number, content: string) => void,
|
||||
complete: (err?: Error) => void
|
||||
loadFile(index: number, callback: (err: Error, data: string) => void): void,
|
||||
patched(index: number, content: string): void,
|
||||
complete(err?: Error): void
|
||||
}): void;
|
||||
|
||||
function parsePatch(diffStr: string, options?: {strict: boolean}): IUniDiff[];
|
||||
|
||||
function convertChangesToXML(changes:IDiffResult[]):string;
|
||||
function convertChangesToXML(changes: IDiffResult[]): string;
|
||||
|
||||
function convertChangesToDMP(changes:IDiffResult[]):{0: number; 1:string;}[];
|
||||
function convertChangesToDMP(changes: IDiffResult[]): Array<{0: number; 1: string; }>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": false,
|
||||
"export-just-namespace": false
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,25 @@ const docker6 = new Docker({
|
||||
key: 'key'
|
||||
});
|
||||
|
||||
const docker7 = new Docker({
|
||||
Promise
|
||||
});
|
||||
|
||||
async function foo() {
|
||||
const containers = await docker7.listContainers();
|
||||
for (const container of containers) {
|
||||
const foo = await docker7.getContainer(container.Id);
|
||||
const inspect = await foo.inspect();
|
||||
}
|
||||
|
||||
const images = await docker5.listImages();
|
||||
for (const image of images) {
|
||||
const foo = await docker5.getImage(image.Id);
|
||||
const inspect = await foo.inspect();
|
||||
await foo.remove();
|
||||
}
|
||||
}
|
||||
|
||||
const container = docker.getContainer('container-id');
|
||||
container.inspect((err, data) => {
|
||||
// NOOP
|
||||
@@ -47,6 +66,10 @@ docker.listContainers((err, containers) => {
|
||||
});
|
||||
});
|
||||
|
||||
docker.listContainers().then(containers => {
|
||||
return containers.map(container => docker.getContainer(container.Id));
|
||||
});
|
||||
|
||||
docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => {
|
||||
// NOOP
|
||||
});
|
||||
|
||||
Vendored
+106
-2
@@ -12,69 +12,93 @@ declare namespace Dockerode {
|
||||
interface Container {
|
||||
inspect(options: {}, callback: Callback<ContainerInspectInfo>): void;
|
||||
inspect(callback: Callback<ContainerInspectInfo>): void;
|
||||
inspect(options?: {}): { id: string };
|
||||
inspect(options?: {}): Promise<ContainerInspectInfo>;
|
||||
|
||||
rename(options: {}, callback: Callback<any>): void;
|
||||
rename(options: {}): Promise<any>;
|
||||
|
||||
update(options: {}, callback: Callback<any>): void;
|
||||
update(options: {}): Promise<any>;
|
||||
|
||||
top(options: {}, callback: Callback<any>): void;
|
||||
top(callback: Callback<any>): void;
|
||||
top(options?: {}): Promise<any>;
|
||||
|
||||
changes(callback: Callback<any>): void;
|
||||
changes(): Promise<any>;
|
||||
|
||||
export(callback: Callback<NodeJS.ReadableStream>): void;
|
||||
export(): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
start(options: {}, callback: Callback<any>): void;
|
||||
start(callback: Callback<any>): void;
|
||||
start(options?: {}): Promise<any>;
|
||||
|
||||
pause(options: {}, callback: Callback<any>): void;
|
||||
pause(callback: Callback<any>): void;
|
||||
pause(options?: {}): Promise<any>;
|
||||
|
||||
unpause(options: {}, callback: Callback<any>): void;
|
||||
unpause(callback: Callback<any>): void;
|
||||
unpause(options?: {}): Promise<any>;
|
||||
|
||||
exec(options: {}, callback: Callback<any>): void;
|
||||
exec(options: {}): Promise<any>;
|
||||
|
||||
commit(options: {}, callback: Callback<any>): void;
|
||||
commit(callback: Callback<any>): void;
|
||||
commit(options?: {}): Promise<any>;
|
||||
|
||||
stop(options: {}, callback: Callback<any>): void;
|
||||
stop(callback: Callback<any>): void;
|
||||
stop(options?: {}): Promise<any>;
|
||||
|
||||
restart(options: {}, callback: Callback<any>): void;
|
||||
restart(callback: Callback<any>): void;
|
||||
restart(options?: {}): Promise<any>;
|
||||
|
||||
kill(options: {}, callback: Callback<any>): void;
|
||||
kill(callback: Callback<any>): void;
|
||||
kill(options?: {}): Promise<any>;
|
||||
|
||||
resize(options: {}, callback: Callback<any>): void;
|
||||
resize(callback: Callback<any>): void;
|
||||
resize(options?: {}): Promise<any>;
|
||||
|
||||
wait(callback: Callback<any>): void;
|
||||
wait(): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
/** Deprecated since RAPI v1.20 */
|
||||
copy(options: {}, callback: Callback<any>): void;
|
||||
/** Deprecated since RAPI v1.20 */
|
||||
copy(callback: Callback<any>): void;
|
||||
/** Deprecated since RAPI v1.20 */
|
||||
copy(options?: {}): Promise<any>;
|
||||
|
||||
getArchive(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
getArchive(options: {}): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
infoArchive(options: {}, callback: Callback<any>): void;
|
||||
infoArchive(options: {}): Promise<any>;
|
||||
|
||||
/** @param file Filename (will read synchronously), Buffer or stream */
|
||||
putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}, callback: Callback<NodeJS.WritableStream>): void;
|
||||
putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise<NodeJS.ReadWriteStream>;
|
||||
|
||||
logs(options: { stdout?: boolean, stderr?: boolean, follow?: boolean, since?: number, details?: boolean, tail?: number, timestamps?: boolean }, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
logs(options: ContainerLogsOptions, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
logs(callback: Callback<NodeJS.ReadableStream>): void;
|
||||
logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
stats(options: {}, callback: Callback<any>): void;
|
||||
stats(callback: Callback<any>): void;
|
||||
stats(options?: {}): Promise<any>;
|
||||
|
||||
attach(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
attach(options: {}): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -82,19 +106,25 @@ declare namespace Dockerode {
|
||||
|
||||
interface Image {
|
||||
inspect(callback: Callback<ImageInspectInfo>): void;
|
||||
inspect(): Promise<ImageInspectInfo>;
|
||||
|
||||
history(callback: Callback<any>): void;
|
||||
history(): Promise<any>;
|
||||
|
||||
get(callback: Callback<NodeJS.ReadableStream>): void;
|
||||
get(): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
push(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
push(callback: Callback<NodeJS.ReadableStream>): void;
|
||||
push(options?: {}): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
tag(options: {}, callback: Callback<any>): void;
|
||||
tag(callback: Callback<any>): void;
|
||||
tag(options?: {}): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<ImageRemoveInfo>): void;
|
||||
remove(callback: Callback<ImageRemoveInfo>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -102,9 +132,11 @@ declare namespace Dockerode {
|
||||
|
||||
interface Volume {
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
name?: string;
|
||||
@@ -112,11 +144,14 @@ declare namespace Dockerode {
|
||||
|
||||
interface Service {
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
update(options: {}, callback: Callback<any>): void;
|
||||
update(options: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -124,6 +159,7 @@ declare namespace Dockerode {
|
||||
|
||||
interface Task {
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -131,6 +167,7 @@ declare namespace Dockerode {
|
||||
|
||||
interface Node {
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -142,38 +179,50 @@ declare namespace Dockerode {
|
||||
remote: any;
|
||||
|
||||
inspect(callback: Callback<PluginInspectInfo>): void;
|
||||
inspect(): Promise<PluginInspectInfo>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
privileges(callback: Callback<any>): void;
|
||||
privileges(): Promise<any>;
|
||||
|
||||
pull(options: {}, callback: Callback<any>): void;
|
||||
pull(options: {}): Promise<any>;
|
||||
|
||||
enable(options: {}, callback: Callback<any>): void;
|
||||
enable(callback: Callback<any>): void;
|
||||
enable(options?: {}): Promise<any>;
|
||||
|
||||
disable(options: {}, callback: Callback<any>): void;
|
||||
disable(callback: Callback<any>): void;
|
||||
disable(options?: {}): Promise<any>;
|
||||
|
||||
push(options: {}, callback: Callback<any>): void;
|
||||
push(callback: Callback<any>): void;
|
||||
push(options?: {}): Promise<any>;
|
||||
|
||||
configure(options: {}, callback: Callback<any>): void;
|
||||
configure(callback: Callback<any>): void;
|
||||
configure(options?: {}): Promise<any>;
|
||||
|
||||
upgrade(auth: any, options: {}, callback: Callback<any>): void;
|
||||
upgrade(auth: any, callback: Callback<any>): void;
|
||||
upgrade(auth: any, options?: {}): Promise<any>;
|
||||
}
|
||||
|
||||
interface Secret {
|
||||
inspect(callback: Callback<SecretInfo>): void;
|
||||
inspect(): Promise<SecretInfo>;
|
||||
|
||||
update(options: {}, callback: Callback<any>): void;
|
||||
update(callback: Callback<any>): void;
|
||||
update(options?: {}): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -181,15 +230,19 @@ declare namespace Dockerode {
|
||||
|
||||
interface Network {
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
remove(options: {}, callback: Callback<any>): void;
|
||||
remove(callback: Callback<any>): void;
|
||||
remove(options?: {}): Promise<any>;
|
||||
|
||||
connect(options: {}, callback: Callback<any>): void;
|
||||
connect(callback: Callback<any>): void;
|
||||
connect(options?: {}): Promise<any>;
|
||||
|
||||
disconnect(options: {}, callback: Callback<any>): void;
|
||||
disconnect(callback: Callback<any>): void;
|
||||
disconnect(options?: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -197,10 +250,13 @@ declare namespace Dockerode {
|
||||
|
||||
interface Exec {
|
||||
inspect(callback: Callback<any>): void;
|
||||
inspect(): Promise<any>;
|
||||
|
||||
start(options: {}, callback: Callback<any>): void;
|
||||
start(options: {}): Promise<any>;
|
||||
|
||||
resize(options: {}, callback: Callback<any>): void;
|
||||
resize(options: {}): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
id?: string;
|
||||
@@ -587,6 +643,7 @@ declare namespace Dockerode {
|
||||
key?: string;
|
||||
protocol?: "https" | "http";
|
||||
timeout?: number;
|
||||
Promise?: typeof Promise;
|
||||
}
|
||||
|
||||
interface SecretVersion {
|
||||
@@ -719,6 +776,16 @@ declare namespace Dockerode {
|
||||
interface PruneNetworksInfo {
|
||||
NetworksDeleted: string[];
|
||||
}
|
||||
|
||||
interface ContainerLogsOptions {
|
||||
stdout?: boolean;
|
||||
stderr?: boolean;
|
||||
follow?: boolean;
|
||||
since?: number;
|
||||
details?: boolean;
|
||||
tail?: number;
|
||||
timestamps?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
type Callback<T> = (error?: any, result?: T) => void;
|
||||
@@ -727,20 +794,27 @@ declare class Dockerode {
|
||||
constructor(options?: Dockerode.DockerOptions);
|
||||
|
||||
createContainer(options: Dockerode.ContainerCreateOptions, callback: Callback<Dockerode.Container>): void;
|
||||
createContainer(options: Dockerode.ContainerCreateOptions): Promise<Dockerode.Container>;
|
||||
|
||||
createImage(options: {}, callback: Callback<Dockerode.Image>): void;
|
||||
createImage(auth: any, options: {}, callback: Callback<Dockerode.Image>): void;
|
||||
createImage(options: {}): Promise<Dockerode.Image>;
|
||||
createImage(auth: any, options: {}): Promise<Dockerode.Image>;
|
||||
|
||||
loadImage(file: string, options: {}, callback: Callback<any>): void;
|
||||
loadImage(file: string, callback: Callback<any>): void;
|
||||
loadImage(file: string, options?: {}): Promise<any>;
|
||||
|
||||
importImage(file: string, options: {}, callback: Callback<any>): void;
|
||||
importImage(file: string, callback: Callback<any>): void;
|
||||
importImage(file: string, options?: {}): Promise<any>;
|
||||
|
||||
checkAuth(options: any, callback: Callback<any>): void;
|
||||
checkAuth(options: any): Promise<any>;
|
||||
|
||||
buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback<any>): void;
|
||||
buildImage(file: string | NodeJS.ReadableStream, callback: Callback<any>): void;
|
||||
buildImage(file: string | NodeJS.ReadableStream, options?: {}): Promise<any>;
|
||||
|
||||
getContainer(id: string): Dockerode.Container;
|
||||
|
||||
@@ -764,80 +838,110 @@ declare class Dockerode {
|
||||
|
||||
listContainers(options: {}, callback: Callback<Dockerode.ContainerInfo[]>): void;
|
||||
listContainers(callback: Callback<Dockerode.ContainerInfo[]>): void;
|
||||
listContainers(options?: {}): Promise<Dockerode.ContainerInfo[]>;
|
||||
|
||||
listImages(options: {}, callback: Callback<Dockerode.ImageInfo[]>): void;
|
||||
listImages(callback: Callback<Dockerode.ImageInfo[]>): void;
|
||||
listImages(options?: {}): Promise<Dockerode.ImageInfo[]>;
|
||||
|
||||
listServices(options: {}, callback: Callback<any[]>): void;
|
||||
listServices(callback: Callback<any[]>): void;
|
||||
listServices(options?: {}): Promise<any[]>;
|
||||
|
||||
listNodes(options: {}, callback: Callback<any[]>): void;
|
||||
listNodes(callback: Callback<any[]>): void;
|
||||
listNodes(options?: {}): Promise<any[]>;
|
||||
|
||||
listTasks(options: {}, callback: Callback<any[]>): void;
|
||||
listTasks(callback: Callback<any[]>): void;
|
||||
listTasks(options?: {}): Promise<any[]>;
|
||||
|
||||
listSecrets(options: {}, callback: Callback<Dockerode.SecretInfo[]>): void;
|
||||
listSecrets(callback: Callback<Dockerode.SecretInfo[]>): void;
|
||||
listSecrets(options?: {}): Promise<Dockerode.SecretInfo[]>;
|
||||
|
||||
listPlugins(options: {}, callback: Callback<Dockerode.PluginInfo[]>): void;
|
||||
listPlugins(callback: Callback<Dockerode.PluginInfo[]>): void;
|
||||
listPlugins(options?: {}): Promise<Dockerode.PluginInfo[]>;
|
||||
|
||||
listVolumes(options: {}, callback: Callback<any[]>): void;
|
||||
listVolumes(callback: Callback<any[]>): void;
|
||||
listVolumes(options?: {}): Promise<any[]>;
|
||||
|
||||
listNetworks(options: {}, callback: Callback<any[]>): void;
|
||||
listNetworks(callback: Callback<any[]>): void;
|
||||
listNetworks(options?: {}): Promise<any[]>;
|
||||
|
||||
createSecret(options: {}, callback: Callback<any>): void;
|
||||
createSecret(options: {}): Promise<any>;
|
||||
|
||||
createPlugin(options: {}, callback: Callback<any>): void;
|
||||
createPlugin(options: {}): Promise<any>;
|
||||
|
||||
createVolume(options: {}, callback: Callback<any>): void;
|
||||
createVolume(options: {}): Promise<any>;
|
||||
|
||||
createService(options: {}, callback: Callback<any>): void;
|
||||
createService(options: {}): Promise<any>;
|
||||
|
||||
createNetwork(options: {}, callback: Callback<any>): void;
|
||||
createNetwork(options: {}): Promise<any>;
|
||||
|
||||
searchImages(options: {}, callback: Callback<any>): void;
|
||||
searchImages(options: {}): Promise<any>;
|
||||
|
||||
pruneImages(options: {}, callback: Callback<Dockerode.PruneImagesInfo>): void;
|
||||
pruneImages(callback: Callback<Dockerode.PruneImagesInfo>): void;
|
||||
pruneImages(options?: {}): Promise<Dockerode.PruneImagesInfo>;
|
||||
|
||||
pruneContainers(options: {}, callback: Callback<Dockerode.PruneContainersInfo>): void;
|
||||
pruneContainers(callback: Callback<Dockerode.PruneContainersInfo>): void;
|
||||
pruneContainers(options?: {}): Promise<Dockerode.PruneContainersInfo>;
|
||||
|
||||
pruneVolumes(options: {}, callback: Callback<Dockerode.PruneVolumesInfo>): void;
|
||||
pruneVolumes(callback: Callback<Dockerode.PruneVolumesInfo>): void;
|
||||
pruneVolumes(options?: {}): Promise<Dockerode.PruneVolumesInfo>;
|
||||
|
||||
pruneNetworks(options: {}, callback: Callback<Dockerode.PruneNetworksInfo>): void;
|
||||
pruneNetworks(callback: Callback<Dockerode.PruneNetworksInfo>): void;
|
||||
pruneNetworks(options?: {}): Promise<Dockerode.PruneNetworksInfo>;
|
||||
|
||||
info(callback: Callback<any>): void;
|
||||
info(): Promise<any>;
|
||||
|
||||
version(callback: Callback<any>): void;
|
||||
version(): Promise<any>;
|
||||
|
||||
ping(callback: Callback<any>): void;
|
||||
ping(): Promise<any>;
|
||||
|
||||
getEvents(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
|
||||
getEvents(callback: Callback<NodeJS.ReadableStream>): void;
|
||||
getEvents(options?: {}): Promise<NodeJS.ReadableStream>;
|
||||
|
||||
pull(repoTag: string, options: {}, callback: Callback<any>, auth?: {}): Dockerode.Image;
|
||||
pull(repoTag: string, options: {}, auth?: {}): Promise<any>;
|
||||
|
||||
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, startOptions: {}, callback: Callback<any>): events.EventEmitter;
|
||||
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, startOptions: {}, callback: Callback<any>): events.EventEmitter;
|
||||
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, callback: Callback<any>): events.EventEmitter;
|
||||
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions: {}, callback: Callback<any>): events.EventEmitter;
|
||||
run(image: string, cmd: string[], outputStream: NodeJS.WritableStream, createOptions?: {}, startOptions?: {}): Promise<any>;
|
||||
|
||||
swarmInit(options: {}, callback: Callback<any>): void;
|
||||
swarmInit(options: {}): Promise<any>;
|
||||
|
||||
swarmJoin(options: {}, callback: Callback<any>): void;
|
||||
swarmJoin(options: {}): Promise<any>;
|
||||
|
||||
swarmLeave(options: {}, callback: Callback<any>): void;
|
||||
swarmLeave(options: {}): Promise<any>;
|
||||
|
||||
swarmUpdate(options: {}, callback: Callback<any>): void;
|
||||
swarmUpdate(options: {}): Promise<any>;
|
||||
|
||||
swarmInspect(callback: Callback<any>): void;
|
||||
swarmInspect(): Promise<any>;
|
||||
|
||||
modem: any;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
|
||||
Vendored
+29
@@ -1,6 +1,7 @@
|
||||
// Type definitions for Ember.js 2.7
|
||||
// Project: http://emberjs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>
|
||||
// bttf <https://github.com/bttf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
@@ -1571,6 +1572,34 @@ declare namespace Ember {
|
||||
@return {Promise}
|
||||
*/
|
||||
finally<V>(callback: (a: T) => V, label?: string): Promise<V, U>;
|
||||
|
||||
static all<Q, R>(promises: GlobalArray<(Q | Thenable<Q, R>)>): Promise<Q[], R>;
|
||||
static race<Q, R>(promises: GlobalArray<Promise<Q, R>>): Promise<Q, R>;
|
||||
|
||||
/**
|
||||
@method resolve
|
||||
@param {Any} value value that the returned promise will be resolved with
|
||||
@param {String} label optional string for identifying the returned promise.
|
||||
Useful for tooling.
|
||||
@return {Promise} a promise that will become fulfilled with the given
|
||||
`value`
|
||||
*/
|
||||
static resolve<Q, R>(object?: Q | Thenable<Q, R>): Promise<Q, R>;
|
||||
|
||||
/**
|
||||
@method cast (Deprecated in favor of resolve
|
||||
@param {Any} value value that the returned promise will be resolved with
|
||||
@param {String} label optional string for identifying the returned promise.
|
||||
Useful for tooling.
|
||||
@return {Promise} a promise that will become fulfilled with the given
|
||||
`value`
|
||||
*/
|
||||
static cast<Q, R>(object: Q | Thenable<Q, R>, label?: string): Promise<Q, R>;
|
||||
|
||||
/**
|
||||
`RSVP.Promise.reject` returns a promise rejected with the passed `reason`.
|
||||
*/
|
||||
static reject(reason?: any): Promise<any, any>;
|
||||
}
|
||||
|
||||
function all(promises: GlobalArray<Promise<any, any>>): Promise<any, any>;
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
|
||||
|
||||
|
||||
/// Module
|
||||
function ModuleTest(): void {
|
||||
Module.environment = "WEB";
|
||||
Module.environment = "NODE";
|
||||
Module.noInitialRun = false;
|
||||
Module.logReadFiles = false;
|
||||
Module.filePackagePrefixURL = "http://www.example.org/";
|
||||
Module.preinitializedWebGLContext = new WebGLRenderingContext();
|
||||
|
||||
let package: ArrayBuffer = Module.getPreloadedPackage("package-name", 100);
|
||||
let exports: WebAssembly.Exports = Module.instantiateWasm(
|
||||
[{name: "func-name", kind: "function"}],
|
||||
(module: WebAssembly.Module) => {}
|
||||
);
|
||||
let memFile: string = Module.locateFile("http://www.example.org/file.mem");
|
||||
Module.onCustomMessage(new MessageEvent("TestType"));
|
||||
|
||||
Module.print = function(text) { alert('stdout: ' + text) };
|
||||
|
||||
var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number'])
|
||||
@@ -16,6 +28,7 @@ function ModuleTest(): void {
|
||||
Module.HEAPU8.set(myTypedArray, buf);
|
||||
Module.ccall('my_function', 'number', ['number'], [buf]);
|
||||
Module._free(buf);
|
||||
Module.destroy({});
|
||||
}
|
||||
|
||||
/// FS
|
||||
|
||||
Vendored
+22
-1
@@ -1,7 +1,11 @@
|
||||
// Type definitions for Emscripten
|
||||
// Project: http://kripken.github.io/emscripten-site/index.html
|
||||
// Definitions by: Kensuke Matsuzaki <https://github.com/zakki>
|
||||
// Periklis Tsirakidis <https://github.com/periklis>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="webassembly-js-api" />
|
||||
|
||||
declare namespace Emscripten {
|
||||
interface FileSystemType {
|
||||
@@ -9,13 +13,30 @@ declare namespace Emscripten {
|
||||
}
|
||||
|
||||
declare namespace Module {
|
||||
type EnvironmentType = "WEB" | "NODE" | "SHELL" | "WORKER";
|
||||
|
||||
function print(str: string): void;
|
||||
function printErr(str: string): void;
|
||||
var arguments: string[];
|
||||
var environment: EnvironmentType;
|
||||
var preInit: { (): void }[];
|
||||
var preRun: { (): void }[];
|
||||
var postRun: { (): void }[];
|
||||
var preinitializedWebGLContext: WebGLRenderingContext;
|
||||
var noInitialRun: boolean;
|
||||
var noExitRuntime: boolean;
|
||||
var logReadFiles: boolean;
|
||||
var filePackagePrefixURL: string;
|
||||
var wasmBinary: ArrayBuffer;
|
||||
|
||||
function destroy(object: object): void;
|
||||
function getPreloadedPackage(remotePackageName: string, remotePackageSize: number): ArrayBuffer;
|
||||
function instantiateWasm(
|
||||
imports: WebAssembly.Imports,
|
||||
successCallback: (module: WebAssembly.Module) => void
|
||||
): WebAssembly.Exports;
|
||||
function locateFile(url: string): string;
|
||||
function onCustomMessage(event: MessageEvent): void;
|
||||
|
||||
var Runtime: any;
|
||||
|
||||
@@ -65,7 +86,7 @@ declare namespace Module {
|
||||
function addOnExit(cb: () => any): void;
|
||||
function addOnPostRun(cb: () => any): void;
|
||||
|
||||
// Tools
|
||||
// Tools
|
||||
function intArrayFromString(stringy: string, dontAddNull?: boolean, length?: number): number[];
|
||||
function intArrayToString(array: number[]): string;
|
||||
function writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as fabric from "fabric";
|
||||
|
||||
function sample1() {
|
||||
const canvas = new fabric.Canvas('c', {
|
||||
hoverCursor: 'pointer',
|
||||
@@ -124,11 +122,12 @@ function sample3() {
|
||||
}
|
||||
});
|
||||
|
||||
fabric.Image.fromURL('../assets/printio.png', img => {
|
||||
const image = fabric.Image.fromURL('../assets/printio.png', img => {
|
||||
const oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9);
|
||||
canvas.add(oImg).renderAll();
|
||||
canvas.setActiveObject(oImg);
|
||||
});
|
||||
image.setSrc('../assets/printio.png');
|
||||
|
||||
$('grayscale').onclick = function(this: HTMLInputElement) {
|
||||
applyFilter(0, this.checked && new f.Grayscale());
|
||||
@@ -260,18 +259,18 @@ function sample4() {
|
||||
});
|
||||
}
|
||||
|
||||
declare module "fabric" {
|
||||
export interface CircleWithLineInfos extends Circle {
|
||||
line1?: Line;
|
||||
line2?: Line;
|
||||
line3?: Line;
|
||||
line4?: Line;
|
||||
namespace myfabric {
|
||||
export interface CircleWithLineInfos extends fabric.Circle {
|
||||
line1?: fabric.Line;
|
||||
line2?: fabric.Line;
|
||||
line3?: fabric.Line;
|
||||
line4?: fabric.Line;
|
||||
}
|
||||
}
|
||||
|
||||
function sample5() {
|
||||
const makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => {
|
||||
const c = <fabric.CircleWithLineInfos> new fabric.Circle({
|
||||
const c = <myfabric.CircleWithLineInfos> new fabric.Circle({
|
||||
left,
|
||||
top,
|
||||
strokeWidth: 5,
|
||||
@@ -318,7 +317,7 @@ function sample5() {
|
||||
);
|
||||
|
||||
canvas.on('object:moving', e => {
|
||||
const p = <fabric.CircleWithLineInfos> e.target;
|
||||
const p = <myfabric.CircleWithLineInfos> e.target;
|
||||
p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top });
|
||||
p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top });
|
||||
p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top });
|
||||
@@ -352,8 +351,8 @@ function sample6() {
|
||||
});
|
||||
}
|
||||
|
||||
declare module "fabric" {
|
||||
export interface ImageWithInfo extends Image {
|
||||
namespace myfabric {
|
||||
export interface ImageWithInfo extends fabric.Image {
|
||||
movingLeft: boolean;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +362,7 @@ function sample7() {
|
||||
|
||||
setInterval(() => {
|
||||
fabric.Image.fromURL('../assets/ladybug.png', obj => {
|
||||
const img = <fabric.ImageWithInfo> obj;
|
||||
const img = <myfabric.ImageWithInfo> obj;
|
||||
img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50);
|
||||
img.movingLeft = !!Math.round(Math.random());
|
||||
canvas.add(img);
|
||||
@@ -372,7 +371,7 @@ function sample7() {
|
||||
|
||||
const animate = (function animate() {
|
||||
canvas.forEachObject(obj => {
|
||||
const img = <fabric.ImageWithInfo> obj;
|
||||
const img = <myfabric.ImageWithInfo> obj;
|
||||
img.left += (img.movingLeft ? -1 : 1);
|
||||
img.top += 1;
|
||||
if (img.left > 900 || img.top > 500) {
|
||||
@@ -609,7 +608,7 @@ function sample8() {
|
||||
const activeGroup = canvas.getActiveGroup();
|
||||
|
||||
if (activeObject || activeGroup) {
|
||||
(activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100);
|
||||
(activeObject || activeGroup).setOpacity(parseInt((<HTMLInputElement> this).value, 10) / 100);
|
||||
canvas.renderAll();
|
||||
}
|
||||
};
|
||||
@@ -640,7 +639,7 @@ function sample8() {
|
||||
const activeGroup = canvas.getActiveGroup();
|
||||
|
||||
if (activeObject || activeGroup) {
|
||||
(activeObject || activeGroup).setFill(this.value);
|
||||
(activeObject || activeGroup).setFill((<HTMLInputElement> this).value);
|
||||
canvas.renderAll();
|
||||
}
|
||||
};
|
||||
@@ -849,16 +848,16 @@ function sample8() {
|
||||
const activeObject = canvas.getActiveObject();
|
||||
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
this.value = (<fabric.Text> activeObject).text;
|
||||
(<HTMLInputElement> this).value = (<fabric.Text> activeObject).text;
|
||||
}
|
||||
};
|
||||
textEl.onkeyup = function(e) {
|
||||
const activeObject = canvas.getActiveObject();
|
||||
if (activeObject) {
|
||||
if (!this.value) {
|
||||
if (!(<HTMLInputElement> this).value) {
|
||||
canvas.discardActiveObject();
|
||||
} else {
|
||||
(<fabric.Text> activeObject).text = this.value;
|
||||
(<fabric.Text> activeObject).text = (<HTMLInputElement> this).value;
|
||||
}
|
||||
canvas.renderAll();
|
||||
}
|
||||
@@ -1006,7 +1005,7 @@ function sample8() {
|
||||
slider.onchange = function() {
|
||||
const activeObject = <fabric.Text> canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
activeObject.lineHeight = +this.value;
|
||||
activeObject.lineHeight = +(<HTMLInputElement> this).value;
|
||||
canvas.renderAll();
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -1866,7 +1866,7 @@ export class Image {
|
||||
* @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied)
|
||||
* @param {Object} [options] Options object
|
||||
*/
|
||||
setSrc(src: string, callback: Function, options: IImageOptions): Image;
|
||||
setSrc(src: string, callback?: Function, options?: IImageOptions): Image;
|
||||
|
||||
/**
|
||||
* Creates an instance of fabric.Image from an URL string
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import ffmpeg = require("fluent-ffmpeg")
|
||||
import * as ffmpeg from "fluent-ffmpeg";
|
||||
|
||||
let source: string, format: string, output: string
|
||||
let source: string;
|
||||
let format: string;
|
||||
let output: string;
|
||||
|
||||
ffmpeg({ source: source }).format(format).save(output)
|
||||
ffmpeg({ source }).format(format).save(output);
|
||||
|
||||
Vendored
+239
-250
@@ -1,315 +1,304 @@
|
||||
// Type definitions for node-fluent-ffmpeg
|
||||
// Type definitions for node-fluent-ffmpeg 2.1
|
||||
// Project: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg
|
||||
// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk <http://github.com/tcaesvk/>
|
||||
// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk <http://github.com/tcaesvk/>, DingWeizhe <https://github.com/DingWeizhe>
|
||||
// Definitions: https://github.com/DefinitelyType/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare module "fluent-ffmpeg" {
|
||||
import * as events from "events"
|
||||
import * as stream from "stream"
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
|
||||
declare namespace Ffmpeg {
|
||||
interface FfmpegCommandLogger {
|
||||
error(...data: any[]): void
|
||||
warning(...data: any[]): void
|
||||
info(...data: any[]): void
|
||||
debug(...data: any[]): void
|
||||
error(...data: any[]): void;
|
||||
warning(...data: any[]): void;
|
||||
info(...data: any[]): void;
|
||||
debug(...data: any[]): void;
|
||||
}
|
||||
|
||||
interface FfmpegCommandOptions {
|
||||
logger?: FfmpegCommandLogger
|
||||
niceness?: number
|
||||
priority?: number
|
||||
presets?: string
|
||||
preset?: string
|
||||
stdoutLines?: number
|
||||
timeout?: number
|
||||
source?: string | stream.Readable
|
||||
logger?: FfmpegCommandLogger;
|
||||
niceness?: number;
|
||||
priority?: number;
|
||||
presets?: string;
|
||||
preset?: string;
|
||||
stdoutLines?: number;
|
||||
timeout?: number;
|
||||
source?: string | stream.Readable;
|
||||
}
|
||||
|
||||
interface FilterSpecification {
|
||||
filter: string
|
||||
inputs: string | string[]
|
||||
outputs: string | string[]
|
||||
options?: Object | string | any[]
|
||||
filter: string;
|
||||
inputs: string | string[];
|
||||
outputs: string | string[];
|
||||
options?: any | string | any[];
|
||||
}
|
||||
|
||||
interface GetPreset {
|
||||
(command: FfmpegCommand): string
|
||||
}
|
||||
type GetPreset = (command: FfmpegCommand) => string;
|
||||
|
||||
interface Filter {
|
||||
description: string
|
||||
input: string
|
||||
multipleInputs: boolean
|
||||
output: string
|
||||
multipleOutputs: boolean
|
||||
description: string;
|
||||
input: string;
|
||||
multipleInputs: boolean;
|
||||
output: string;
|
||||
multipleOutputs: boolean;
|
||||
}
|
||||
interface Filters {
|
||||
[key: string]: Filter
|
||||
}
|
||||
interface FiltersCallback {
|
||||
(err: Error, filters: Filters): void
|
||||
[key: string]: Filter;
|
||||
}
|
||||
type FiltersCallback = (err: Error, filters: Filters) => void;
|
||||
|
||||
interface Codec {
|
||||
type: string
|
||||
description: string
|
||||
canDecode: boolean
|
||||
canEncode: boolean
|
||||
drawHorizBand?: boolean
|
||||
directRendering?: boolean
|
||||
weirdFrameTruncation?: boolean
|
||||
intraFrameOnly?: boolean
|
||||
isLossy?: boolean
|
||||
isLossless?: boolean
|
||||
type: string;
|
||||
description: string;
|
||||
canDecode: boolean;
|
||||
canEncode: boolean;
|
||||
drawHorizBand?: boolean;
|
||||
directRendering?: boolean;
|
||||
weirdFrameTruncation?: boolean;
|
||||
intraFrameOnly?: boolean;
|
||||
isLossy?: boolean;
|
||||
isLossless?: boolean;
|
||||
}
|
||||
interface Codecs {
|
||||
[key: string]: Codec
|
||||
}
|
||||
interface CodecsCallback {
|
||||
(err: Error, codecs: Codecs): void
|
||||
[key: string]: Codec;
|
||||
}
|
||||
type CodecsCallback = (err: Error, codecs: Codecs) => void;
|
||||
|
||||
interface Encoder {
|
||||
type: string
|
||||
description: string
|
||||
frameMT: boolean
|
||||
sliceMT: boolean
|
||||
experimental: boolean
|
||||
drawHorizBand: boolean
|
||||
directRendering: boolean
|
||||
type: string;
|
||||
description: string;
|
||||
frameMT: boolean;
|
||||
sliceMT: boolean;
|
||||
experimental: boolean;
|
||||
drawHorizBand: boolean;
|
||||
directRendering: boolean;
|
||||
}
|
||||
interface Encoders {
|
||||
[key: string]: Encoder
|
||||
}
|
||||
interface EncodersCallback {
|
||||
(err: Error, encoders: Encoders): void
|
||||
[key: string]: Encoder;
|
||||
}
|
||||
type EncodersCallback = (err: Error, encoders: Encoders) => void;
|
||||
|
||||
interface Format {
|
||||
description: string
|
||||
canDemux: boolean
|
||||
canMux: boolean
|
||||
description: string;
|
||||
canDemux: boolean;
|
||||
canMux: boolean;
|
||||
}
|
||||
interface Formats {
|
||||
[key: string]: Format
|
||||
}
|
||||
interface FormatsCallback {
|
||||
(err: Error, formats: Formats): void
|
||||
[key: string]: Format;
|
||||
}
|
||||
type FormatsCallback = (err: Error, formats: Formats) => void;
|
||||
|
||||
interface FfprobeData {
|
||||
stream: any[]
|
||||
format: any
|
||||
chapters: any[]
|
||||
stream: any[];
|
||||
format: any;
|
||||
chapters: any[];
|
||||
}
|
||||
|
||||
interface ScreenshotsConfig {
|
||||
count?: number
|
||||
folder?: string
|
||||
filename?: string
|
||||
timemarks?: number[] | string[]
|
||||
timestamps?: number[] | string[]
|
||||
fastSeek?: boolean
|
||||
size?: string
|
||||
count?: number;
|
||||
folder?: string;
|
||||
filename?: string;
|
||||
timemarks?: number[] | string[];
|
||||
timestamps?: number[] | string[];
|
||||
fastSeek?: boolean;
|
||||
size?: string;
|
||||
}
|
||||
|
||||
interface FfmpegCommand extends events.EventEmitter {
|
||||
constructor(): FfmpegCommand
|
||||
constructor(options: FfmpegCommandOptions): FfmpegCommand
|
||||
constructor(input: string | stream.Readable, options: FfmpegCommandOptions): FfmpegCommand
|
||||
class FfmpegCommand extends events.EventEmitter {
|
||||
constructor(options?: FfmpegCommandOptions);
|
||||
constructor(input?: string | stream.Readable, options?: FfmpegCommandOptions);
|
||||
|
||||
// options/inputs
|
||||
mergeAdd(source: string | stream.Readable): FfmpegCommand
|
||||
addInput(source: string | stream.Readable): FfmpegCommand
|
||||
input(source: string | stream.Readable): FfmpegCommand
|
||||
withInputFormat(format: string): FfmpegCommand
|
||||
inputFormat(format: string): FfmpegCommand
|
||||
fromFormat(format: string): FfmpegCommand
|
||||
withInputFps(fps: number): FfmpegCommand
|
||||
withInputFPS(fps: number): FfmpegCommand
|
||||
withFpsInput(fps: number): FfmpegCommand
|
||||
withFPSInput(fps: number): FfmpegCommand
|
||||
inputFPS(fps: number): FfmpegCommand
|
||||
inputFps(fps: number): FfmpegCommand
|
||||
fpsInput(fps: number): FfmpegCommand
|
||||
FPSInput(fps: number): FfmpegCommand
|
||||
nativeFramerate(): FfmpegCommand
|
||||
withNativeFramerate(): FfmpegCommand
|
||||
native(): FfmpegCommand
|
||||
setStartTime(seek: string | number): FfmpegCommand
|
||||
seekInput(seek: string | number): FfmpegCommand
|
||||
loop(duration: string | number): FfmpegCommand
|
||||
mergeAdd(source: string | stream.Readable): FfmpegCommand;
|
||||
addInput(source: string | stream.Readable): FfmpegCommand;
|
||||
input(source: string | stream.Readable): FfmpegCommand;
|
||||
withInputFormat(format: string): FfmpegCommand;
|
||||
inputFormat(format: string): FfmpegCommand;
|
||||
fromFormat(format: string): FfmpegCommand;
|
||||
withInputFps(fps: number): FfmpegCommand;
|
||||
withInputFPS(fps: number): FfmpegCommand;
|
||||
withFpsInput(fps: number): FfmpegCommand;
|
||||
withFPSInput(fps: number): FfmpegCommand;
|
||||
inputFPS(fps: number): FfmpegCommand;
|
||||
inputFps(fps: number): FfmpegCommand;
|
||||
fpsInput(fps: number): FfmpegCommand;
|
||||
FPSInput(fps: number): FfmpegCommand;
|
||||
nativeFramerate(): FfmpegCommand;
|
||||
withNativeFramerate(): FfmpegCommand;
|
||||
native(): FfmpegCommand;
|
||||
setStartTime(seek: string | number): FfmpegCommand;
|
||||
seekInput(seek: string | number): FfmpegCommand;
|
||||
loop(duration: string | number): FfmpegCommand;
|
||||
|
||||
// options/audio
|
||||
withNoAudio(): FfmpegCommand
|
||||
noAudio(): FfmpegCommand
|
||||
withAudioCodec(codec: string): FfmpegCommand
|
||||
audioCodec(codec: string): FfmpegCommand
|
||||
withAudioBitrate(bitrate: string | number): FfmpegCommand
|
||||
audioBitrate(bitrate: string | number): FfmpegCommand
|
||||
withAudioChannels(channels: number): FfmpegCommand
|
||||
audioChannels(channels: number): FfmpegCommand
|
||||
withAudioFrequency(freq: number): FfmpegCommand
|
||||
audioFrequency(freq: number): FfmpegCommand
|
||||
withAudioQuality(quality: number): FfmpegCommand
|
||||
audioQuality(quality: number): FfmpegCommand
|
||||
withAudioFilter(filters: { filter: string, options: any }): FfmpegCommand
|
||||
withAudioFilters(filters: { filter: string, options: any }): FfmpegCommand
|
||||
audioFilter(filters: { filter: string, options: any }): FfmpegCommand
|
||||
audioFilters(filters: { filter: string, options: any }): FfmpegCommand
|
||||
withNoAudio(): FfmpegCommand;
|
||||
noAudio(): FfmpegCommand;
|
||||
withAudioCodec(codec: string): FfmpegCommand;
|
||||
audioCodec(codec: string): FfmpegCommand;
|
||||
withAudioBitrate(bitrate: string | number): FfmpegCommand;
|
||||
audioBitrate(bitrate: string | number): FfmpegCommand;
|
||||
withAudioChannels(channels: number): FfmpegCommand;
|
||||
audioChannels(channels: number): FfmpegCommand;
|
||||
withAudioFrequency(freq: number): FfmpegCommand;
|
||||
audioFrequency(freq: number): FfmpegCommand;
|
||||
withAudioQuality(quality: number): FfmpegCommand;
|
||||
audioQuality(quality: number): FfmpegCommand;
|
||||
withAudioFilter(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
withAudioFilters(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
audioFilter(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
audioFilters(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
|
||||
// options/video
|
||||
withNoVideo(): FfmpegCommand
|
||||
noVideo(): FfmpegCommand
|
||||
withVideoCodec(codec: string): FfmpegCommand
|
||||
videoCodec(codec: string): FfmpegCommand
|
||||
withVideoBitrate(bitrate: string | number): FfmpegCommand
|
||||
videoBitrate(bitrate: string | number): FfmpegCommand
|
||||
withVideoFilter(filters: { filter: string, options: any }): FfmpegCommand
|
||||
withVideoFilters(filters: { filter: string, options: any }): FfmpegCommand
|
||||
videoFilter(filters: { filter: string, options: any }): FfmpegCommand
|
||||
videoFilters(filters: { filter: string, options: any }): FfmpegCommand
|
||||
withOutputFps(fps: number): FfmpegCommand
|
||||
withOutputFPS(fps: number): FfmpegCommand
|
||||
withFpsOutput(fps: number): FfmpegCommand
|
||||
withFPSOutput(fps: number): FfmpegCommand
|
||||
withFps(fps: number): FfmpegCommand
|
||||
withFPS(fps: number): FfmpegCommand
|
||||
outputFPS(fps: number): FfmpegCommand
|
||||
outputFps(fps: number): FfmpegCommand
|
||||
fpsOutput(fps: number): FfmpegCommand
|
||||
FPSOutput(fps: number): FfmpegCommand
|
||||
fps(fps: number): FfmpegCommand
|
||||
FPS(fps: number): FfmpegCommand
|
||||
takeFrames(frames: number): FfmpegCommand
|
||||
withFrames(frames: number): FfmpegCommand
|
||||
frames(frames: number): FfmpegCommand
|
||||
// options/video;
|
||||
withNoVideo(): FfmpegCommand;
|
||||
noVideo(): FfmpegCommand;
|
||||
withVideoCodec(codec: string): FfmpegCommand;
|
||||
videoCodec(codec: string): FfmpegCommand;
|
||||
withVideoBitrate(bitrate: string | number): FfmpegCommand;
|
||||
videoBitrate(bitrate: string | number): FfmpegCommand;
|
||||
withVideoFilter(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
withVideoFilters(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
videoFilter(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
videoFilters(filters: { filter: string, options: any }): FfmpegCommand;
|
||||
withOutputFps(fps: number): FfmpegCommand;
|
||||
withOutputFPS(fps: number): FfmpegCommand;
|
||||
withFpsOutput(fps: number): FfmpegCommand;
|
||||
withFPSOutput(fps: number): FfmpegCommand;
|
||||
withFps(fps: number): FfmpegCommand;
|
||||
withFPS(fps: number): FfmpegCommand;
|
||||
outputFPS(fps: number): FfmpegCommand;
|
||||
outputFps(fps: number): FfmpegCommand;
|
||||
fpsOutput(fps: number): FfmpegCommand;
|
||||
FPSOutput(fps: number): FfmpegCommand;
|
||||
fps(fps: number): FfmpegCommand;
|
||||
FPS(fps: number): FfmpegCommand;
|
||||
takeFrames(frames: number): FfmpegCommand;
|
||||
withFrames(frames: number): FfmpegCommand;
|
||||
frames(frames: number): FfmpegCommand;
|
||||
|
||||
// options/videosize
|
||||
keepPixelAspect(): FfmpegCommand
|
||||
keepDisplayAspect(): FfmpegCommand
|
||||
keepDisplayAspectRatio(): FfmpegCommand
|
||||
keepDAR(): FfmpegCommand
|
||||
withSize(size: string): FfmpegCommand
|
||||
setSize(size: string): FfmpegCommand
|
||||
size(size: string): FfmpegCommand
|
||||
withAspect(aspect: string | number): FfmpegCommand
|
||||
withAspectRatio(aspect: string | number): FfmpegCommand
|
||||
setAspect(aspect: string | number): FfmpegCommand
|
||||
setAspectRatio(aspect: string | number): FfmpegCommand
|
||||
aspect(aspect: string | number): FfmpegCommand
|
||||
aspectRatio(aspect: string | number): FfmpegCommand
|
||||
applyAutopadding(pad: boolean, color: string): FfmpegCommand
|
||||
applyAutoPadding(pad: boolean, color: string): FfmpegCommand
|
||||
applyAutopad(pad: boolean, color: string): FfmpegCommand
|
||||
applyAutoPad(pad: boolean, color: string): FfmpegCommand
|
||||
withAutopadding(pad: boolean, color: string): FfmpegCommand
|
||||
withAutoPadding(pad: boolean, color: string): FfmpegCommand
|
||||
withAutopad(pad: boolean, color: string): FfmpegCommand
|
||||
withAutoPad(pad: boolean, color: string): FfmpegCommand
|
||||
autoPad(pad: boolean, color: string): FfmpegCommand
|
||||
autopad(pad: boolean, color: string): FfmpegCommand
|
||||
keepPixelAspect(): FfmpegCommand;
|
||||
keepDisplayAspect(): FfmpegCommand;
|
||||
keepDisplayAspectRatio(): FfmpegCommand;
|
||||
keepDAR(): FfmpegCommand;
|
||||
withSize(size: string): FfmpegCommand;
|
||||
setSize(size: string): FfmpegCommand;
|
||||
size(size: string): FfmpegCommand;
|
||||
withAspect(aspect: string | number): FfmpegCommand;
|
||||
withAspectRatio(aspect: string | number): FfmpegCommand;
|
||||
setAspect(aspect: string | number): FfmpegCommand;
|
||||
setAspectRatio(aspect: string | number): FfmpegCommand;
|
||||
aspect(aspect: string | number): FfmpegCommand;
|
||||
aspectRatio(aspect: string | number): FfmpegCommand;
|
||||
applyAutopadding(pad: boolean, color: string): FfmpegCommand;
|
||||
applyAutoPadding(pad: boolean, color: string): FfmpegCommand;
|
||||
applyAutopad(pad: boolean, color: string): FfmpegCommand;
|
||||
applyAutoPad(pad: boolean, color: string): FfmpegCommand;
|
||||
withAutopadding(pad: boolean, color: string): FfmpegCommand;
|
||||
withAutoPadding(pad: boolean, color: string): FfmpegCommand;
|
||||
withAutopad(pad: boolean, color: string): FfmpegCommand;
|
||||
withAutoPad(pad: boolean, color: string): FfmpegCommand;
|
||||
autoPad(pad: boolean, color: string): FfmpegCommand;
|
||||
autopad(pad: boolean, color: string): FfmpegCommand;
|
||||
|
||||
// options/output
|
||||
addOutput(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand
|
||||
output(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand
|
||||
seekOutput(seek: string | number): FfmpegCommand
|
||||
seek(seek: string | number): FfmpegCommand
|
||||
withDuration(duration: string | number): FfmpegCommand
|
||||
setDuration(duration: string | number): FfmpegCommand
|
||||
duration(duration: string | number): FfmpegCommand
|
||||
toFormat(format: string): FfmpegCommand
|
||||
withOutputFormat(format: string): FfmpegCommand
|
||||
outputFormat(format: string): FfmpegCommand
|
||||
format(format: string): FfmpegCommand
|
||||
map(spec: string): FfmpegCommand
|
||||
updateFlvMetadata(): FfmpegCommand
|
||||
flvmeta(): FfmpegCommand
|
||||
addOutput(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand;
|
||||
output(target: string | stream.Writable, pipeopts?: { end?: boolean }): FfmpegCommand;
|
||||
seekOutput(seek: string | number): FfmpegCommand;
|
||||
seek(seek: string | number): FfmpegCommand;
|
||||
withDuration(duration: string | number): FfmpegCommand;
|
||||
setDuration(duration: string | number): FfmpegCommand;
|
||||
duration(duration: string | number): FfmpegCommand;
|
||||
toFormat(format: string): FfmpegCommand;
|
||||
withOutputFormat(format: string): FfmpegCommand;
|
||||
outputFormat(format: string): FfmpegCommand;
|
||||
format(format: string): FfmpegCommand;
|
||||
map(spec: string): FfmpegCommand;
|
||||
updateFlvMetadata(): FfmpegCommand;
|
||||
flvmeta(): FfmpegCommand;
|
||||
|
||||
// options/custom
|
||||
addInputOption(options: string[]): FfmpegCommand
|
||||
addInputOption(...options: string[]): FfmpegCommand
|
||||
addInputOptions(options: string[]): FfmpegCommand
|
||||
addInputOptions(...options: string[]): FfmpegCommand
|
||||
withInputOption(options: string[]): FfmpegCommand
|
||||
withInputOption(...options: string[]): FfmpegCommand
|
||||
withInputOptions(options: string[]): FfmpegCommand
|
||||
withInputOptions(...options: string[]): FfmpegCommand
|
||||
inputOption(options: string[]): FfmpegCommand
|
||||
inputOption(...options: string[]): FfmpegCommand
|
||||
inputOptions(options: string[]): FfmpegCommand
|
||||
inputOptions(...options: string[]): FfmpegCommand
|
||||
addOutputOption(options: string[]): FfmpegCommand
|
||||
addOutputOption(...options: string[]): FfmpegCommand
|
||||
addOutputOptions(options: string[]): FfmpegCommand
|
||||
addOutputOptions(...options: string[]): FfmpegCommand
|
||||
addOption(options: string[]): FfmpegCommand
|
||||
addOption(...options: string[]): FfmpegCommand
|
||||
addOptions(options: string[]): FfmpegCommand
|
||||
addOptions(...options: string[]): FfmpegCommand
|
||||
withOutputOption(options: string[]): FfmpegCommand
|
||||
withOutputOption(...options: string[]): FfmpegCommand
|
||||
withOutputOptions(options: string[]): FfmpegCommand
|
||||
withOutputOptions(...options: string[]): FfmpegCommand
|
||||
withOption(options: string[]): FfmpegCommand
|
||||
withOption(...options: string[]): FfmpegCommand
|
||||
withOptions(options: string[]): FfmpegCommand
|
||||
withOptions(...options: string[]): FfmpegCommand
|
||||
outputOption(options: string[]): FfmpegCommand
|
||||
outputOption(...options: string[]): FfmpegCommand
|
||||
outputOptions(options: string[]): FfmpegCommand
|
||||
outputOptions(...options: string[]): FfmpegCommand
|
||||
filterGraph(spec: string | FilterSpecification[], map: string[]): FfmpegCommand
|
||||
complexFilter(spec: string | FilterSpecification[], map: string[]): FfmpegCommand
|
||||
addInputOption(options: string[]): FfmpegCommand;
|
||||
addInputOption(...options: string[]): FfmpegCommand;
|
||||
addInputOptions(options: string[]): FfmpegCommand;
|
||||
addInputOptions(...options: string[]): FfmpegCommand;
|
||||
withInputOption(options: string[]): FfmpegCommand;
|
||||
withInputOption(...options: string[]): FfmpegCommand;
|
||||
withInputOptions(options: string[]): FfmpegCommand;
|
||||
withInputOptions(...options: string[]): FfmpegCommand;
|
||||
inputOption(options: string[]): FfmpegCommand;
|
||||
inputOption(...options: string[]): FfmpegCommand;
|
||||
inputOptions(options: string[]): FfmpegCommand;
|
||||
inputOptions(...options: string[]): FfmpegCommand;
|
||||
addOutputOption(options: string[]): FfmpegCommand;
|
||||
addOutputOption(...options: string[]): FfmpegCommand;
|
||||
addOutputOptions(options: string[]): FfmpegCommand;
|
||||
addOutputOptions(...options: string[]): FfmpegCommand;
|
||||
addOption(options: string[]): FfmpegCommand;
|
||||
addOption(...options: string[]): FfmpegCommand;
|
||||
addOptions(options: string[]): FfmpegCommand;
|
||||
addOptions(...options: string[]): FfmpegCommand;
|
||||
withOutputOption(options: string[]): FfmpegCommand;
|
||||
withOutputOption(...options: string[]): FfmpegCommand;
|
||||
withOutputOptions(options: string[]): FfmpegCommand;
|
||||
withOutputOptions(...options: string[]): FfmpegCommand;
|
||||
withOption(options: string[]): FfmpegCommand;
|
||||
withOption(...options: string[]): FfmpegCommand;
|
||||
withOptions(options: string[]): FfmpegCommand;
|
||||
withOptions(...options: string[]): FfmpegCommand;
|
||||
outputOption(options: string[]): FfmpegCommand;
|
||||
outputOption(...options: string[]): FfmpegCommand;
|
||||
outputOptions(options: string[]): FfmpegCommand;
|
||||
outputOptions(...options: string[]): FfmpegCommand;
|
||||
filterGraph(spec: string | FilterSpecification[], map: string[]): FfmpegCommand;
|
||||
complexFilter(spec: string | FilterSpecification[], map: string[]): FfmpegCommand;
|
||||
|
||||
// options/misc
|
||||
usingPreset(proset: string | GetPreset): FfmpegCommand
|
||||
pnreset(proset: string | GetPreset): FfmpegCommand
|
||||
usingPreset(proset: string | GetPreset): FfmpegCommand;
|
||||
pnreset(proset: string | GetPreset): FfmpegCommand;
|
||||
|
||||
// processor
|
||||
renice(niceness: number): FfmpegCommand
|
||||
kill(signal: string): FfmpegCommand
|
||||
renice(niceness: number): FfmpegCommand;
|
||||
kill(signal: string): FfmpegCommand;
|
||||
|
||||
// capabilities
|
||||
setFfmpegPath(path: string): FfmpegCommand
|
||||
setFfprobePath(path: string): FfmpegCommand
|
||||
setFlvtoolPath(path: string): FfmpegCommand
|
||||
availableFilters(callback: FiltersCallback): void
|
||||
getAvailableFilters(callback: FiltersCallback): void
|
||||
availableCodecs(callback: CodecsCallback): void
|
||||
getAvailableCodecs(callback: CodecsCallback): void
|
||||
availableEncoders(callback: EncodersCallback): void
|
||||
getAvailableEncoders(callback: EncodersCallback): void
|
||||
availableFormats(callback: FormatsCallback): void
|
||||
getAvailableFormats(callback: FormatsCallback): void
|
||||
setFfmpegPath(path: string): FfmpegCommand;
|
||||
setFfprobePath(path: string): FfmpegCommand;
|
||||
setFlvtoolPath(path: string): FfmpegCommand;
|
||||
availableFilters(callback: FiltersCallback): void;
|
||||
getAvailableFilters(callback: FiltersCallback): void;
|
||||
availableCodecs(callback: CodecsCallback): void;
|
||||
getAvailableCodecs(callback: CodecsCallback): void;
|
||||
availableEncoders(callback: EncodersCallback): void;
|
||||
getAvailableEncoders(callback: EncodersCallback): void;
|
||||
availableFormats(callback: FormatsCallback): void;
|
||||
getAvailableFormats(callback: FormatsCallback): void;
|
||||
|
||||
// ffprobe
|
||||
ffprobe(callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void
|
||||
ffprobe(index: number, callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void
|
||||
ffprobe(options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void
|
||||
ffprobe(index: number, options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void
|
||||
/* tslint:disable:unified-signatures */
|
||||
ffprobe(callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void;
|
||||
ffprobe(index: number, callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void;
|
||||
ffprobe(options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void;
|
||||
ffprobe(index: number, options: string[], callback: (err: any, data: FfprobeData) => void): (err: any, data: FfprobeData) => void;
|
||||
/* tslint:enable:unified-signatures */
|
||||
|
||||
// recipes
|
||||
saveToFile(output: string): FfmpegCommand
|
||||
save(output: string): FfmpegCommand
|
||||
writeToStream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable
|
||||
pipe(stream: stream.Writable, options?: { end?: boolean }): stream.Writable
|
||||
stream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable
|
||||
takeScreenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand
|
||||
thumbnail(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand
|
||||
thumbnails(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand
|
||||
screenshot(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand
|
||||
screenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand
|
||||
mergeToFile(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand
|
||||
concatenate(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand
|
||||
concat(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand
|
||||
saveToFile(output: string): FfmpegCommand;
|
||||
save(output: string): FfmpegCommand;
|
||||
writeToStream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable;
|
||||
pipe(stream: stream.Writable, options?: { end?: boolean }): stream.Writable;
|
||||
stream(stream: stream.Writable, options?: { end?: boolean }): stream.Writable;
|
||||
takeScreenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
|
||||
thumbnail(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
|
||||
thumbnails(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
|
||||
screenshot(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
|
||||
screenshots(config: number | ScreenshotsConfig, folder?: string): FfmpegCommand;
|
||||
mergeToFile(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand;
|
||||
concatenate(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand;
|
||||
concat(target: string | stream.Writable, options?: { end?: boolean }): FfmpegCommand;
|
||||
}
|
||||
|
||||
function Ffmpeg(): FfmpegCommand
|
||||
function Ffmpeg(options: FfmpegCommandOptions): FfmpegCommand
|
||||
function Ffmpeg(input: string | stream.Readable, options: FfmpegCommandOptions): FfmpegCommand
|
||||
|
||||
export = Ffmpeg
|
||||
}
|
||||
declare function Ffmpeg(options?: Ffmpeg.FfmpegCommandOptions): Ffmpeg.FfmpegCommand;
|
||||
declare function Ffmpeg(input?: string | stream.Readable, options?: Ffmpeg.FfmpegCommandOptions): Ffmpeg.FfmpegCommand;
|
||||
|
||||
export = Ffmpeg;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
import flux = require('flux')
|
||||
import FluxUtils = require('flux/utils')
|
||||
import React = require('react')
|
||||
|
||||
var Component = React.Component
|
||||
var Container = FluxUtils.Container
|
||||
|
||||
//
|
||||
// Basic dispatcher usage
|
||||
//
|
||||
|
||||
var basicDispatcher = new flux.Dispatcher<any>()
|
||||
|
||||
// register(callback: (payload: any) => void): string
|
||||
var id: string = basicDispatcher.register((payload) => {
|
||||
// payload is type: any
|
||||
payload.anything
|
||||
})
|
||||
|
||||
// unregister(id: string): void
|
||||
basicDispatcher.unregister(id)
|
||||
|
||||
// waitFor(ids: string[]): void
|
||||
basicDispatcher.waitFor([id])
|
||||
|
||||
// dispatch(payload: any): void
|
||||
basicDispatcher.dispatch({ msg: 'hello' })
|
||||
|
||||
// isDispatching(): boolean
|
||||
var dispatcherIsDispatching: boolean = basicDispatcher.isDispatching()
|
||||
|
||||
//
|
||||
// Typed payload
|
||||
//
|
||||
|
||||
enum ActionSource { Server, View }
|
||||
enum ActionType { Create, Update, Delete }
|
||||
|
||||
interface Action {
|
||||
source: ActionSource
|
||||
type: ActionType
|
||||
data: Object
|
||||
}
|
||||
|
||||
var typedDispatcher = new flux.Dispatcher<Action>()
|
||||
|
||||
var typedPayload: Action
|
||||
|
||||
var typedStore = {
|
||||
dispatcherID: typedDispatcher.register((payload) => {
|
||||
typedPayload = payload
|
||||
})
|
||||
}
|
||||
|
||||
typedDispatcher.dispatch(typedPayload)
|
||||
|
||||
//
|
||||
// Derived dispatcher
|
||||
//
|
||||
|
||||
class CustomDispatcher extends flux.Dispatcher<Action> {
|
||||
|
||||
// Dispatch an action with server as source
|
||||
handleServerAction(type: ActionType, data: Object) {
|
||||
this.dispatch({
|
||||
source: ActionSource.Server,
|
||||
type: type,
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// Dispatch an action with view as source
|
||||
handleViewAction(type: ActionType, data: Object) {
|
||||
this.dispatch({
|
||||
source: ActionSource.View,
|
||||
type: type,
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var customDispatcher = new CustomDispatcher()
|
||||
|
||||
export = customDispatcher
|
||||
|
||||
|
||||
// Sample Reduce Store
|
||||
class CounterStore extends FluxUtils.ReduceStore<number, any> {
|
||||
getInitialState(): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
reduce(state: number, action: any): number {
|
||||
switch (action.type) {
|
||||
case 'increment':
|
||||
return state + 1;
|
||||
|
||||
case 'square':
|
||||
return state * state;
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Store = new CounterStore(basicDispatcher);
|
||||
|
||||
// Sample Flux container with CounterStore
|
||||
class CounterContainer extends Component<any, any> {
|
||||
static getStores() {
|
||||
return [Store];
|
||||
}
|
||||
|
||||
static calculateState(prevState: any) {
|
||||
return {
|
||||
counter: Store.getState(),
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.state.counter;
|
||||
}
|
||||
}
|
||||
|
||||
const container = Container.create(CounterContainer);
|
||||
Vendored
+8
-65
@@ -1,69 +1,12 @@
|
||||
// Type definitions for Flux 3.0
|
||||
// Type definitions for Flux 3.1
|
||||
// Project: http://facebook.github.io/flux/
|
||||
// Definitions by: Steve Baker <https://github.com/stkb/>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas/>
|
||||
// Definitions by: Steve Baker <https://github.com/stkb/>
|
||||
// Giedrius Grabauskas <https://github.com/GiedriusGrabauskas/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="react" />
|
||||
/// <reference types="fbemitter" />
|
||||
import * as Dispatcher from "./lib/Dispatcher";
|
||||
|
||||
export = Flux;
|
||||
|
||||
declare namespace Flux {
|
||||
|
||||
/**
|
||||
* Dispatcher class
|
||||
* Create an instance to use throughout the application.
|
||||
* Or extend it to create a derived dispatcher class.
|
||||
*
|
||||
* Specify a type in the 'TPayload' generic argument to use strongly-typed payloads,
|
||||
* otherwise specify 'any'
|
||||
*
|
||||
* Examples:
|
||||
* var dispatcher = new flux.Dispatcher<any>()
|
||||
* var typedDispatcher = new flux.Dispatcher<MyCustomActionType>()
|
||||
* class DerivedDispatcher extends flux.Dispatcher<MyCustomActionType> { }
|
||||
*/
|
||||
export class Dispatcher<TPayload> {
|
||||
|
||||
/**
|
||||
* Create an instance of the Dispatcher class to use throughout the application.
|
||||
*
|
||||
* Specify a type in the 'TPayload' generic argument to use strongly-typed payloads,
|
||||
* otherwise specify 'any'
|
||||
*
|
||||
* Examples:
|
||||
* var dispatcher = new flux.Dispatcher<any>()
|
||||
* var typedDispatcher = new flux.Dispatcher<MyCustomActionType>()
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Registers a callback that will be invoked with every payload sent to the dispatcher.
|
||||
* Returns a string token to identify the callback to be used with waitFor() or unregister.
|
||||
*/
|
||||
register(callback: (payload: TPayload) => void): string;
|
||||
|
||||
/**
|
||||
* Unregisters a callback with the given ID token
|
||||
*/
|
||||
unregister(id: string): void;
|
||||
|
||||
/**
|
||||
* Waits for the callbacks with the specified IDs to be invoked before continuing execution
|
||||
* of the current callback. This method should only be used by a callback in response
|
||||
* to a dispatched payload.
|
||||
*/
|
||||
waitFor(IDs: string[]): void;
|
||||
|
||||
/**
|
||||
* Dispatches a payload to all registered callbacks
|
||||
*/
|
||||
dispatch(payload: TPayload): void;
|
||||
|
||||
/**
|
||||
* Gets whether the dispatcher is currently dispatching
|
||||
*/
|
||||
isDispatching(): boolean;
|
||||
}
|
||||
}
|
||||
export {
|
||||
Dispatcher
|
||||
};
|
||||
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
declare namespace Dispatcher { }
|
||||
|
||||
declare class Dispatcher<TPayload> {
|
||||
/**
|
||||
* Create an instance of the Dispatcher class to use throughout the application.
|
||||
*
|
||||
* Specify a type in the 'TPayload' generic argument to use strongly-typed payloads,
|
||||
* otherwise specify 'any'
|
||||
*
|
||||
* Examples:
|
||||
* var dispatcher = new flux.Dispatcher<any>()
|
||||
* var typedDispatcher = new flux.Dispatcher<MyCustomActionType>()
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Registers a callback that will be invoked with every payload sent to the dispatcher.
|
||||
* Returns a string token to identify the callback to be used with waitFor() or unregister.
|
||||
*/
|
||||
register(callback: (payload: TPayload) => void): string;
|
||||
|
||||
/**
|
||||
* Unregisters a callback with the given ID token
|
||||
*/
|
||||
unregister(id: string): void;
|
||||
|
||||
/**
|
||||
* Waits for the callbacks with the specified IDs to be invoked before continuing execution
|
||||
* of the current callback. This method should only be used by a callback in response
|
||||
* to a dispatched payload.
|
||||
*/
|
||||
waitFor(IDs: string[]): void;
|
||||
|
||||
/**
|
||||
* Dispatches a payload to all registered callbacks
|
||||
*/
|
||||
dispatch(payload: TPayload): void;
|
||||
|
||||
/**
|
||||
* Gets whether the dispatcher is currently dispatching
|
||||
*/
|
||||
isDispatching(): boolean;
|
||||
}
|
||||
|
||||
export = Dispatcher;
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
import * as Dispatcher from "./Dispatcher";
|
||||
import * as FluxStore from "./FluxStore";
|
||||
import * as React from "react";
|
||||
|
||||
/**
|
||||
* A FluxContainer is used to subscribe a react component to multiple stores.
|
||||
* The stores that are used must be returned from a static `getStores()` method.
|
||||
*
|
||||
* The component receives information from the stores via state. The state
|
||||
* is generated using a static `calculateState()` method that each container must implement.
|
||||
*/
|
||||
/**
|
||||
* Default options to create a Container.
|
||||
*
|
||||
* @interface RealOptions
|
||||
*/
|
||||
export interface RealOptions {
|
||||
/**
|
||||
* Default value: true
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
pure?: boolean;
|
||||
/**
|
||||
* Default value: false
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
withProps?: boolean;
|
||||
/**
|
||||
* Default value: false
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
withContext?: boolean;
|
||||
}
|
||||
|
||||
export type ComponentConstructor<TProps> = React.ComponentClass<TProps> | React.StatelessComponent<TProps>;
|
||||
|
||||
export interface ComponentStatic<TProps, TState, TContext> {
|
||||
getStores(maybeProps?: TProps, maybeContext?: TContext): Array<FluxStore<any>>;
|
||||
calculateState(prevState: TState, maybeProps?: TProps, maybeContext?: TContext): TState;
|
||||
}
|
||||
|
||||
export type Component<TProps, TState, TContext> = ComponentConstructor<TProps> & ComponentStatic<TProps, TState, TContext>;
|
||||
|
||||
/**
|
||||
* Create is used to transform a react class into a container
|
||||
* that updates its state when relevant stores change.
|
||||
* The provided base class must have static methods getStores() and calculateState().
|
||||
*/
|
||||
export function create<TProps>(base: Component<TProps, any, any>, options?: RealOptions): Component<TProps, any, any>;
|
||||
export function create<TProps, TState>(base: Component<TProps, TState, any>, options?: RealOptions): Component<TProps, TState, any>;
|
||||
export function create<TProps, TState, TContext>(base: Component<TProps, TState, TContext>, options?: RealOptions): Component<TProps, TState, TContext>;
|
||||
export function create<TProps, TState, TContext, TStatic>(base: Component<TProps, TState, TContext> & TStatic, options?: RealOptions): Component<TProps, TState, TContext> & TStatic;
|
||||
|
||||
/**
|
||||
* This is a way to connect stores to a functional stateless view.
|
||||
*/
|
||||
export function createFunctional<TProps, TState>(
|
||||
viewFn: (props: TProps) => React.ReactElement<TState>,
|
||||
getStores: (maybeProps?: TProps, maybeContext?: any) => Array<FluxStore<any>>,
|
||||
calculateState: (prevState?: TState, maybeProps?: TProps, maybeContext?: any) => TState,
|
||||
options?: RealOptions
|
||||
): Component<TProps, TState, any>;
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
import * as FluxStore from "./FluxStore";
|
||||
|
||||
declare namespace FluxMixinLegacy {
|
||||
interface Options {
|
||||
withProps?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* `FluxContainer` should be preferred over this mixin, but it requires using
|
||||
* react with classes. So this mixin is provided where it is not yet possible
|
||||
* to convert a container to be a class.
|
||||
*
|
||||
* This mixin should be used for React components that have state based purely
|
||||
* on stores. `this.props` will not be available inside of `calculateState()`.
|
||||
*
|
||||
* This mixin will only `setState` not replace it, so you should always return
|
||||
* every key in your state unless you know what you are doing.
|
||||
*
|
||||
* On the second calculateState when prevState is not null, the state will be
|
||||
* updated to contain the previous foo AND the bar that was just returned. Only
|
||||
* returning bar will not delete foo.
|
||||
*/
|
||||
declare function FluxMixinLegacy(stores: Array<FluxStore<any>>, options?: FluxMixinLegacy.Options): any;
|
||||
|
||||
export = FluxMixinLegacy;
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
import * as Store from "./FluxStore";
|
||||
|
||||
declare namespace FluxReduceStore { }
|
||||
|
||||
/**
|
||||
* This is the basic building block of a Flux application. All of your stores
|
||||
* should extend this class.
|
||||
*/
|
||||
declare abstract class FluxReduceStore<TState, TPayload> extends Store<TPayload> {
|
||||
/**
|
||||
* Getter that exposes the entire state of this store.
|
||||
* If your state is not immutable you should override this and not expose state directly.
|
||||
*/
|
||||
getState(): TState;
|
||||
|
||||
/**
|
||||
* Constructs the initial state for this store.
|
||||
* This is called once during construction of the store.
|
||||
*/
|
||||
abstract getInitialState(): TState;
|
||||
|
||||
/**
|
||||
* Reduces the current state, and an action to the new state of this store.
|
||||
* All subclasses must implement this method.
|
||||
* This method should be pure and have no side-effects.
|
||||
*/
|
||||
abstract reduce(state: TState, action: TPayload): TState;
|
||||
|
||||
/**
|
||||
* Checks if two versions of state are the same.
|
||||
* You do not need to override this if your state is immutable.
|
||||
*/
|
||||
areEqual(one: TState, two: TState): boolean;
|
||||
}
|
||||
|
||||
export = FluxReduceStore;
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
import * as Dispatcher from "./Dispatcher";
|
||||
import * as fbEmitter from "fbemitter";
|
||||
|
||||
declare namespace FluxStore { }
|
||||
|
||||
/**
|
||||
* This class represents the most basic functionality for a FluxStore. Do not
|
||||
* extend this store directly; instead extend FluxReduceStore when creating a
|
||||
* new store.
|
||||
*/
|
||||
declare abstract class FluxStore<TPayload> {
|
||||
/**
|
||||
* Constructs and registers an instance of this store with the given dispatcher.
|
||||
*/
|
||||
constructor(dispatcher: Dispatcher<TPayload>);
|
||||
|
||||
/**
|
||||
* Adds a listener to the store, when the store changes the given callback will be called.
|
||||
* A token is returned that can be used to remove the listener.
|
||||
* Calling the remove() function on the returned token will remove the listener.
|
||||
*/
|
||||
addListener(callback: () => void): fbEmitter.EventSubscription;
|
||||
|
||||
/**
|
||||
* Returns the dispatcher this store is registered with.
|
||||
*/
|
||||
getDispatcher(): Dispatcher<TPayload>;
|
||||
|
||||
/**
|
||||
* Returns the dispatch token that the dispatcher recognizes this store by.
|
||||
* Can be used to waitFor() this store.
|
||||
*/
|
||||
getDispatchToken(): string;
|
||||
|
||||
/**
|
||||
* Ask if a store has changed during the current dispatch.
|
||||
* Can only be invoked while dispatching.
|
||||
* This can be used for constructing derived stores that depend on data from other stores.
|
||||
*/
|
||||
hasChanged(): boolean;
|
||||
|
||||
/**
|
||||
* Emit an event notifying all listeners that this store has changed.
|
||||
* This can only be invoked when dispatching.
|
||||
* Changes are de-duplicated and resolved at the end of this store's __onDispatch function.
|
||||
*/
|
||||
protected __emitChange(): void;
|
||||
|
||||
/**
|
||||
* This method encapsulates all logic for invoking __onDispatch. It should
|
||||
* be used for things like catching changes and emitting them after the
|
||||
* subclass has handled a payload.
|
||||
*/
|
||||
protected __invokeOnDispatch(payload: TPayload): void;
|
||||
|
||||
/**
|
||||
* Subclasses must override this method.
|
||||
* This is how the store receives actions from the dispatcher.
|
||||
* All state mutation logic must be done during this method.
|
||||
*/
|
||||
protected __onDispatch(payload: TPayload): void;
|
||||
|
||||
protected __changed: boolean;
|
||||
|
||||
protected __changeEvent: string;
|
||||
|
||||
protected __className: string;
|
||||
|
||||
protected __dispatcher: Dispatcher<TPayload>;
|
||||
|
||||
protected __emitter: fbEmitter.EventEmitter;
|
||||
}
|
||||
|
||||
export = FluxStore;
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Dispatcher } from "flux";
|
||||
|
||||
enum ActionSource {
|
||||
Server,
|
||||
View
|
||||
}
|
||||
enum ActionType {
|
||||
Create,
|
||||
Update,
|
||||
Delete
|
||||
}
|
||||
|
||||
interface Action {
|
||||
source: ActionSource;
|
||||
type: ActionType;
|
||||
data: {};
|
||||
}
|
||||
|
||||
function dispatcherCallback(payload: Action) {
|
||||
let source: ActionSource = payload.source;
|
||||
let type: ActionType = payload.type;
|
||||
let data: {} = payload.data;
|
||||
}
|
||||
|
||||
let dispatcherIsDispatching: boolean;
|
||||
let dispatcherToken: string;
|
||||
|
||||
const actionPayload = {
|
||||
data: {},
|
||||
source: ActionSource.Server,
|
||||
type: ActionType.Create
|
||||
};
|
||||
|
||||
/**
|
||||
* Basic dispatcher
|
||||
*/
|
||||
const basicDispatcher: Dispatcher<Action> = new Dispatcher<Action>();
|
||||
dispatcherToken = basicDispatcher.register(dispatcherCallback);
|
||||
basicDispatcher.unregister(dispatcherToken);
|
||||
basicDispatcher.waitFor([dispatcherToken]);
|
||||
basicDispatcher.dispatch(actionPayload);
|
||||
dispatcherIsDispatching = basicDispatcher.isDispatching();
|
||||
|
||||
/**
|
||||
* Custom dispatcher
|
||||
*/
|
||||
class CustomDispatcher extends Dispatcher<Action> {
|
||||
// Dispatch an action with server as source
|
||||
handleServerAction(type: ActionType, data: {}) {
|
||||
this.dispatch({
|
||||
source: ActionSource.Server,
|
||||
type,
|
||||
data
|
||||
});
|
||||
}
|
||||
// Dispatch an action with view as source
|
||||
handleViewAction(type: ActionType, data: {}) {
|
||||
this.dispatch({
|
||||
source: ActionSource.View,
|
||||
type,
|
||||
data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const customDispatcher: CustomDispatcher = new CustomDispatcher();
|
||||
dispatcherToken = customDispatcher.register(dispatcherCallback);
|
||||
customDispatcher.unregister(dispatcherToken);
|
||||
customDispatcher.dispatch(actionPayload);
|
||||
customDispatcher.waitFor([dispatcherToken]);
|
||||
dispatcherIsDispatching = customDispatcher.isDispatching();
|
||||
@@ -0,0 +1,80 @@
|
||||
import { Dispatcher } from "flux";
|
||||
import { ReduceStore, Container } from "flux/utils";
|
||||
import * as React from "react";
|
||||
|
||||
interface Payload {
|
||||
type: string;
|
||||
}
|
||||
|
||||
const basicDispatcher = new Dispatcher<Payload>();
|
||||
|
||||
// Sample Reduce Store
|
||||
class CounterStore extends ReduceStore<number, any> {
|
||||
getInitialState(): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
reduce(state: number, action: Payload): number {
|
||||
switch (action.type) {
|
||||
case 'increment':
|
||||
return state + 1;
|
||||
case 'square':
|
||||
return state * state;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
const Store = new CounterStore(basicDispatcher);
|
||||
|
||||
// Sample Flux container with Store
|
||||
interface Props {
|
||||
a: string;
|
||||
b: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
counter: number;
|
||||
}
|
||||
|
||||
class CounterContainer extends React.Component<Props, State> {
|
||||
static getStores() {
|
||||
return [Store];
|
||||
}
|
||||
|
||||
static a: string = "asd";
|
||||
|
||||
static calculateState(prevState: State, props: Props): State {
|
||||
return {
|
||||
counter: Store.getState() - (props.b ? 0 : 1)
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
{this.state.counter}
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
|
||||
const ContainerComponent1 = Container.create(CounterContainer, { withProps: true });
|
||||
<ContainerComponent1 a="string" b={false} />;
|
||||
|
||||
const ContainerComponent2 = Container.create<Props>(CounterContainer, { withProps: true });
|
||||
<ContainerComponent2 a="string" b={false} />;
|
||||
|
||||
const ContainerComponent3 = Container.create<Props, State>(CounterContainer, { withProps: true });
|
||||
<ContainerComponent3 a="string" b={false} />;
|
||||
|
||||
// Functional flux container with Store
|
||||
const FunctionalContainerComponent = Container.createFunctional<Props, State>(
|
||||
(props) => {
|
||||
return <div>
|
||||
{props.a} {props.b}
|
||||
</div>;
|
||||
},
|
||||
() => [Store],
|
||||
(prevState) => ({ counter: Store.getState() })
|
||||
);
|
||||
|
||||
<FunctionalContainerComponent a="string" b={true} />;
|
||||
@@ -5,20 +5,27 @@
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"jsx": "react",
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"utils/index.d.ts",
|
||||
"flux-tests.ts"
|
||||
"utils.d.ts",
|
||||
"lib/Dispatcher.d.ts",
|
||||
"lib/FluxContainer.d.ts",
|
||||
"lib/FluxMixinLegacy.d.ts",
|
||||
"lib/FluxReduceStore.d.ts",
|
||||
"lib/FluxStore.d.ts",
|
||||
"test/Flux.ts",
|
||||
"test/FluxUtils.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import * as Container from "./lib/FluxContainer";
|
||||
import * as Mixin from "./lib/FluxMixinLegacy";
|
||||
import * as ReduceStore from "./lib/FluxReduceStore";
|
||||
import * as Store from "./lib/FluxStore";
|
||||
|
||||
export {
|
||||
Container,
|
||||
Mixin,
|
||||
ReduceStore,
|
||||
Store
|
||||
};
|
||||
Vendored
-140
@@ -1,140 +0,0 @@
|
||||
// Type definitions for Flux Utils 3.0
|
||||
// Project: http://facebook.github.io/flux/
|
||||
// Definitions by: Steve Baker <https://github.com/stkb/>, Giedrius Grabauskas <https://github.com/GiedriusGrabauskas/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="react" />
|
||||
/// <reference types="flux" />
|
||||
/// <reference types="fbemitter" />
|
||||
|
||||
import * as React from 'react';
|
||||
import * as Flux from 'flux';
|
||||
import * as fbEmitter from 'fbemitter';
|
||||
|
||||
export = FluxUtils;
|
||||
|
||||
declare namespace FluxUtils {
|
||||
/**
|
||||
* Default options to create a Container with
|
||||
*
|
||||
* @interface RealOptions
|
||||
*/
|
||||
interface RealOptions {
|
||||
/**
|
||||
* Default value: true
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
pure?: boolean;
|
||||
/**
|
||||
* Default value: false
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
withProps?: boolean;
|
||||
/**
|
||||
* Default value: false
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
withContext?: boolean;
|
||||
}
|
||||
|
||||
export class Container {
|
||||
constructor();
|
||||
/**
|
||||
* Create is used to transform a react class into a container
|
||||
* that updates its state when relevant stores change.
|
||||
* The provided base class must have static methods getStores() and calculateState().
|
||||
*/
|
||||
static create<TComponent>(base: React.ComponentClass<TComponent>, options?: RealOptions): React.ComponentClass<TComponent>;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is a way to connect stores to a functional stateless view
|
||||
*/
|
||||
static createFunctional<Props, State>(
|
||||
viewFn: (props: State) => React.ReactElement<State>,
|
||||
getStores: (props?: Props, context?: any) => FluxUtils.Store<any>[],
|
||||
calculateState: (prevState?: State, props?: Props, context?: any) => State,
|
||||
options?: RealOptions
|
||||
): React.ComponentClass<Props>;
|
||||
}
|
||||
|
||||
export class ReduceStore<T, TPayload> extends Store<TPayload> {
|
||||
/**
|
||||
* Getter that exposes the entire state of this store.
|
||||
* If your state is not immutable you should override this and not expose state directly.
|
||||
*/
|
||||
getState(): T;
|
||||
|
||||
/**
|
||||
* Constructs the initial state for this store.
|
||||
* This is called once during construction of the store.
|
||||
*/
|
||||
getInitialState(): T;
|
||||
|
||||
/**
|
||||
* Reduces the current state, and an action to the new state of this store.
|
||||
* All subclasses must implement this method.
|
||||
* This method should be pure and have no side-effects.
|
||||
*/
|
||||
reduce(state: T, action: TPayload): T;
|
||||
|
||||
/**
|
||||
* Checks if two versions of state are the same.
|
||||
* You do not need to override this if your state is immutable.
|
||||
*/
|
||||
areEqual(one: T, two: T): boolean;
|
||||
|
||||
}
|
||||
|
||||
export class Store<TPayload> {
|
||||
|
||||
/**
|
||||
* Constructs and registers an instance of this store with the given dispatcher.
|
||||
*/
|
||||
constructor(dispatcher: Flux.Dispatcher<TPayload>);
|
||||
|
||||
/**
|
||||
* Adds a listener to the store, when the store changes the given callback will be called.
|
||||
* A token is returned that can be used to remove the listener.
|
||||
* Calling the remove() function on the returned token will remove the listener.
|
||||
*/
|
||||
addListener(callback: Function): fbEmitter.EventSubscription;
|
||||
|
||||
/**
|
||||
* Returns the dispatcher this store is registered with.
|
||||
*/
|
||||
getDispatcher(): Flux.Dispatcher<TPayload>;
|
||||
|
||||
/**
|
||||
* Returns the dispatch token that the dispatcher recognizes this store by.
|
||||
* Can be used to waitFor() this store.
|
||||
*/
|
||||
getDispatchToken(): string;
|
||||
|
||||
/**
|
||||
* Ask if a store has changed during the current dispatch.
|
||||
* Can only be invoked while dispatching.
|
||||
* This can be used for constructing derived stores that depend on data from other stores.
|
||||
*/
|
||||
hasChanged(): boolean;
|
||||
|
||||
/**
|
||||
*Emit an event notifying all listeners that this store has changed.
|
||||
* This can only be invoked when dispatching.
|
||||
* Changes are de-duplicated and resolved at the end of this store's __onDispatch function.
|
||||
*/
|
||||
__emitChange(): void;
|
||||
|
||||
/**
|
||||
* Subclasses must override this method.
|
||||
* This is how the store receives actions from the dispatcher.
|
||||
* All state mutation logic must be done during this method.
|
||||
*/
|
||||
__onDispatch(payload: TPayload): void;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -148,7 +148,9 @@ declare namespace gapi.client {
|
||||
/**
|
||||
* The scopes to request, as a space-delimited string.
|
||||
*/
|
||||
scope?: string
|
||||
scope?: string,
|
||||
|
||||
hosted_domain?: string;
|
||||
}): Promise<void>;
|
||||
|
||||
interface RequestOptions {
|
||||
|
||||
Vendored
+1
-1
@@ -51,7 +51,7 @@ export class GraphQLSchema {
|
||||
getQueryType(): GraphQLObjectType;
|
||||
getMutationType(): GraphQLObjectType;
|
||||
getSubscriptionType(): GraphQLObjectType;
|
||||
getTypeMap(): GraphQLNamedType;
|
||||
getTypeMap(): { [typeName: string]: GraphQLNamedType };
|
||||
getType(name: string): GraphQLType;
|
||||
getPossibleTypes(abstractType: GraphQLAbstractType): Array<GraphQLObjectType>;
|
||||
|
||||
|
||||
Vendored
+5
-2
@@ -79,7 +79,8 @@ declare namespace __Handsontable {
|
||||
selectCellByProp(row: number, prop: string, endRow?: number, endProp?: string, scrollToCell?: boolean): boolean;
|
||||
setCellMeta(row: number, col: number, key: string, val: string): void;
|
||||
setCellMetaObject(row: number, col: number, prop: Object): void;
|
||||
setDataAtCell(row: number|any[], col: number, value: string, source?: string): void;
|
||||
setDataAtCell(row: number, col: number, value: string, source?: string): void;
|
||||
setDataAtCell(changes: Array<[number, number, any]>): void;
|
||||
setDataAtRowProp(row: number|any[], prop: string, value: string, source?: string): void;
|
||||
spliceCol(col: number, index: number, amount: number, elements?: any): void;
|
||||
spliceRow(row: number, index: number, amount: number, elements?: any): void;
|
||||
@@ -218,7 +219,7 @@ declare namespace Handsontable {
|
||||
// hooks
|
||||
afterAutofillApplyValues?(startArea: any[], entireArea: any[]): void;
|
||||
afterCellMetaReset?(): void;
|
||||
afterChange?(changes: any[], source: string): void;
|
||||
afterChange?(changes: Array<[number, number|string, any, any]>, source?: string): void;
|
||||
afterChangesObserved?(): void;
|
||||
afterColumnMove?(startColumn: number, endColumn: number): void;
|
||||
afterColumnResize?(currentColumn: number, newSize: number, isDoubleClick: boolean): void;
|
||||
@@ -241,6 +242,7 @@ declare namespace Handsontable {
|
||||
afterInit?(): void;
|
||||
afterLoadData?(firstTime: boolean): void;
|
||||
afterMomentumScroll?(): void;
|
||||
afterOnCellCornerDblClick?(event: Object): void;
|
||||
afterOnCellCornerMouseDown?(event: Object): void;
|
||||
afterOnCellMouseDown?(event: Object, coords: Object, TD: Element): void;
|
||||
afterOnCellMouseOver?(event: Object, coords: Object, TD: Element): void;
|
||||
@@ -412,6 +414,7 @@ declare namespace Handsontable {
|
||||
getWindowScrollTop(): number;
|
||||
outerHeight(element: HTMLElement): number;
|
||||
hasClass(element: HTMLElement, className: string): boolean | undefined;
|
||||
empty(element: HTMLElement): void;
|
||||
}
|
||||
|
||||
interface ArrayMapper {
|
||||
|
||||
@@ -122,7 +122,7 @@ function test_HandsontableInit() {
|
||||
// Hooks
|
||||
afterAutofillApplyValues: () => {return; },
|
||||
afterCellMetaReset: () => {return; },
|
||||
afterChange: () => {return; },
|
||||
afterChange: (changes) => {return; },
|
||||
afterChangesObserved: () => {return; },
|
||||
afterColumnMove: () => {return; },
|
||||
afterColumnResize: () => {return; },
|
||||
@@ -145,6 +145,7 @@ function test_HandsontableInit() {
|
||||
afterInit: () => {return; },
|
||||
afterLoadData: () => {return; },
|
||||
afterMomentumScroll: () => {return; },
|
||||
afterOnCellCornerDblClick: () => {return; },
|
||||
afterOnCellCornerMouseDown: () => {return; },
|
||||
afterOnCellMouseDown: () => {return; },
|
||||
afterOnCellMouseOver: () => {return; },
|
||||
@@ -276,6 +277,7 @@ function test_HandsontableMethods() {
|
||||
hot.setCellMeta(123, 123, 'foo', 'foo');
|
||||
hot.setCellMetaObject(123, 123, {});
|
||||
hot.setDataAtCell(123, 123, 'foo', 'foo');
|
||||
hot.setDataAtCell([[123, 123, 'foo'], [123, 123, 'foo']]);
|
||||
hot.setDataAtRowProp(123, 'foo', 'foo', 'foo');
|
||||
hot.spliceCol(123, 123, 123, 'foo');
|
||||
hot.spliceRow(123, 123, 123, 'foo');
|
||||
@@ -290,6 +292,7 @@ function test_HandsontableMethods() {
|
||||
Handsontable.renderers.NumericRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {});
|
||||
Handsontable.renderers.TextRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {});
|
||||
Handsontable.Dom.addEvent(new HTMLElement(), "eventName", () => { return; });
|
||||
Handsontable.Dom.empty(new HTMLElement());
|
||||
}
|
||||
|
||||
class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin {
|
||||
|
||||
@@ -124,7 +124,7 @@ function test_HandsontableInit() {
|
||||
// Hooks
|
||||
afterAutofillApplyValues: () => {return; },
|
||||
afterCellMetaReset: () => {return; },
|
||||
afterChange: () => {return; },
|
||||
afterChange: (changes) => {return; },
|
||||
afterChangesObserved: () => {return; },
|
||||
afterColumnMove: () => {return; },
|
||||
afterColumnResize: () => {return; },
|
||||
@@ -147,6 +147,7 @@ function test_HandsontableInit() {
|
||||
afterInit: () => {return; },
|
||||
afterLoadData: () => {return; },
|
||||
afterMomentumScroll: () => {return; },
|
||||
afterOnCellCornerDblClick: () => {return; },
|
||||
afterOnCellCornerMouseDown: () => {return; },
|
||||
afterOnCellMouseDown: () => {return; },
|
||||
afterOnCellMouseOver: () => {return; },
|
||||
@@ -278,6 +279,7 @@ function test_HandsontableMethods() {
|
||||
hot.setCellMeta(123, 123, 'foo', 'foo');
|
||||
hot.setCellMetaObject(123, 123, {});
|
||||
hot.setDataAtCell(123, 123, 'foo', 'foo');
|
||||
hot.setDataAtCell([[123, 123, 'foo'], [123, 123, 'foo']]);
|
||||
hot.setDataAtRowProp(123, 'foo', 'foo', 'foo');
|
||||
hot.spliceCol(123, 123, 123, 'foo');
|
||||
hot.spliceRow(123, 123, 123, 'foo');
|
||||
@@ -292,6 +294,7 @@ function test_HandsontableMethods() {
|
||||
Handsontable.renderers.NumericRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {});
|
||||
Handsontable.renderers.TextRenderer(hot, new HTMLTableDataCellElement(), 0, 0, "prop", 1.235, {});
|
||||
Handsontable.Dom.addEvent(new HTMLElement(), "eventName", () => { return; });
|
||||
Handsontable.Dom.empty(new HTMLElement());
|
||||
}
|
||||
|
||||
class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin {
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
import { Path, Location, LocationDescriptor } from './index';
|
||||
import { Path, Location, LocationDescriptorObject } from './index';
|
||||
|
||||
export function addLeadingSlash(path: Path): Path;
|
||||
export function stripLeadingSlash(path: Path): Path;
|
||||
export function stripPrefix(path: Path, prefix: string): Path;
|
||||
export function parsePath(path: Path): Location;
|
||||
export function createPath(location: LocationDescriptor): Path;
|
||||
export function createPath(location: LocationDescriptorObject): Path;
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ export interface History {
|
||||
goForward(): void;
|
||||
block(prompt?: boolean): UnregisterCallback;
|
||||
listen(listener: LocationListener): UnregisterCallback;
|
||||
createHref(location: Path | LocationDescriptorObject): Href;
|
||||
createHref(location: LocationDescriptorObject): Href;
|
||||
}
|
||||
|
||||
export interface Location {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import * as images from "images";
|
||||
|
||||
// from https://github.com/zhangyuanwei/node-images/blob/master/demo/uploadServer.js
|
||||
let tmp_path = "tmp_path";
|
||||
let out_path = "out_path";
|
||||
let photo = images(tmp_path);
|
||||
|
||||
photo.size(800)
|
||||
.draw(images('./logo.png'), 800 - 421, photo.height() - 117)
|
||||
.save(out_path, { quality: 80 });
|
||||
|
||||
// from https://github.com/zhangyuanwei/node-images/blob/master/test/index.js
|
||||
images("input.png")
|
||||
.resize(200)
|
||||
.save("output_new.png");
|
||||
|
||||
images("input.png")
|
||||
.size(200)
|
||||
.save("output_old.png");
|
||||
|
||||
images("input.jpg")
|
||||
.resize(200)
|
||||
.save("output_new.jpg");
|
||||
|
||||
images("input.jpg")
|
||||
.size(200)
|
||||
.save("output_old.jpg");
|
||||
|
||||
images("input.gif")
|
||||
.resize(200)
|
||||
.save("output_new_gif.jpg");
|
||||
|
||||
images("input.gif")
|
||||
.size(200)
|
||||
.save("output_old_gif.jpg");
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for images 2.2
|
||||
// Project: https://github.com/zhangyuanwei/node-images
|
||||
// Definitions by: Ding Weizhe <https://github.com/DingWeizhe/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace images {
|
||||
interface ImagesConfig {
|
||||
[key: string]: any;
|
||||
}
|
||||
type SupportType = "png" | "jpg" | "gif" | "bmp" | "raw" | "webp";
|
||||
class ImagesStatic {
|
||||
fill(red: number, green: number, blue: number, alpha?: number): ImagesStatic;
|
||||
draw(image: ImagesStatic, x: number, y: number): ImagesStatic;
|
||||
loadFromBuffer(buffer: Buffer): ImagesStatic;
|
||||
encode(type: string, config?: ImagesConfig): void;
|
||||
save(file: string, type?: SupportType, config?: ImagesConfig): void;
|
||||
save(file: string, config?: ImagesConfig): void;
|
||||
size(): { width: number, height: number };
|
||||
size(width: number, height?: number): ImagesStatic;
|
||||
resize(width: number, height?: number, filter?: string): ImagesStatic;
|
||||
resize(width: number, height: number, filter?: string): ImagesStatic;
|
||||
width(): number;
|
||||
width(width: number): ImagesStatic;
|
||||
height(): number;
|
||||
height(height: number): ImagesStatic;
|
||||
setLimit(width: number, height: number): void;
|
||||
setGCThreshold(value: number): void;
|
||||
getUsedMemory(): void;
|
||||
gc(): void;
|
||||
}
|
||||
}
|
||||
|
||||
/* tslint:disable:unified-signatures */
|
||||
declare function images(file: string): images.ImagesStatic;
|
||||
declare function images(width: number, height: number): images.ImagesStatic;
|
||||
declare function images(buffer: Buffer, start?: number, end?: number): images.ImagesStatic;
|
||||
declare function images(image: images.ImagesStatic): images.ImagesStatic;
|
||||
declare function images(image: images.ImagesStatic, x: number, y: number, width: number, height: number): images.ImagesStatic;
|
||||
/* tslint:enable:unified-signatures */
|
||||
|
||||
export = images;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"images-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+8
@@ -1657,6 +1657,14 @@ interface JQuery {
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName}
|
||||
*/
|
||||
css(propertyName: string): string;
|
||||
/**
|
||||
* Get the value of style properties for the first element in the set of matched elements.
|
||||
* Results in an object of property-value pairs.
|
||||
*
|
||||
* @param propertyNames An array of one or more CSS properties.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyNames}
|
||||
*/
|
||||
css(propertyNames: string[]): any;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
|
||||
Vendored
+14
-16
@@ -1,21 +1,23 @@
|
||||
// Type definitions for js-schema
|
||||
// Project: https://github.com/molnarg/js-schema
|
||||
// Definitions by: Marcin Porebski <https://github.com/marcinporebski>
|
||||
// Definitions by: Marcin Porebski <https://github.com/marcinporebski>, Robin Labat <https://github.com/roblabat>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module 'js-schema'
|
||||
{
|
||||
export interface Schema
|
||||
{
|
||||
(obj: any): boolean; // test obj against the schema
|
||||
function schema(definition: any): schema.Schema;
|
||||
|
||||
namespace schema {
|
||||
interface Schema {
|
||||
(obj: any): boolean; // test obj against the schema
|
||||
}
|
||||
}
|
||||
|
||||
export default function schema(definition: any): Schema
|
||||
export = schema;
|
||||
}
|
||||
|
||||
interface NumberConstructor
|
||||
{
|
||||
interface NumberConstructor {
|
||||
min(n: number): NumberConstructor;
|
||||
max(n: number): NumberConstructor;
|
||||
below(n: number): NumberConstructor;
|
||||
@@ -23,28 +25,24 @@ interface NumberConstructor
|
||||
step(n: number): NumberConstructor;
|
||||
}
|
||||
|
||||
interface StringConstructor
|
||||
{
|
||||
interface StringConstructor {
|
||||
of(charset: string): StringConstructor;
|
||||
of(length: number, charset: string): StringConstructor;
|
||||
of(minLength: number, maxLength: number, charset: string): StringConstructor;
|
||||
}
|
||||
|
||||
interface ArrayConstructor
|
||||
{
|
||||
interface ArrayConstructor {
|
||||
like(arr: Array<any>): ArrayConstructor;
|
||||
of(pattern: any): ArrayConstructor;
|
||||
of(length: number, pattern: any): ArrayConstructor;
|
||||
of(minLength: number, maxLength: number, pattern: any): ArrayConstructor;
|
||||
}
|
||||
|
||||
interface ObjectConstructor
|
||||
{
|
||||
interface ObjectConstructor {
|
||||
like(obj: any): ObjectConstructor;
|
||||
reference(obj: any): ObjectConstructor;
|
||||
}
|
||||
|
||||
interface FunctionConstructor
|
||||
{
|
||||
interface FunctionConstructor {
|
||||
reference(func: Function): FunctionConstructor;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import {default as schema} from 'js-schema';
|
||||
import * as schema from 'js-schema';
|
||||
|
||||
var Duck = schema({ // A duck
|
||||
swim : Function, // - can swim
|
||||
|
||||
Vendored
+14
-11
@@ -9,24 +9,27 @@ declare namespace L {
|
||||
|
||||
namespace Control {
|
||||
|
||||
export interface Fullscreen extends L.Control {}
|
||||
|
||||
export class Fullscreen extends L.Control {
|
||||
constructor(options?: Control.FullscreenOptions);
|
||||
options: FullscreenOptions;
|
||||
}
|
||||
export interface FullscreenOptions {
|
||||
content?: string,
|
||||
position?: string,
|
||||
title?: string,
|
||||
titleCancel?: string,
|
||||
forceSeparateButton?: boolean,
|
||||
forcePseudoFullscreen?: boolean
|
||||
position?: L.ControlPosition,
|
||||
title?: string,
|
||||
titleCancel?: string,
|
||||
forceSeparateButton?: boolean,
|
||||
forcePseudoFullscreen?: boolean,
|
||||
pseudoFullscreen?:boolean
|
||||
}
|
||||
}
|
||||
|
||||
namespace control {
|
||||
|
||||
/**
|
||||
* Creates a fullscreen control.
|
||||
*/
|
||||
export function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen;
|
||||
/**
|
||||
* Creates a fullscreen control.
|
||||
*/
|
||||
export function fullscreen(options?: Control.FullscreenOptions): L.Control.Fullscreen;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+10
-7
@@ -3,22 +3,25 @@
|
||||
// Definitions by: Bas Pennings <https://github.com/basp/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="levelup" />
|
||||
import * as levelup from "levelup";
|
||||
|
||||
export = sublevel
|
||||
|
||||
declare var sublevel: sublevel.Constructor;
|
||||
|
||||
declare namespace sublevel {
|
||||
interface Hook {
|
||||
(ch: any, add: (op: Batch|boolean) => void): void;
|
||||
}
|
||||
|
||||
interface Batch {
|
||||
interface Batch extends levelup.Batch {
|
||||
prefix?: Sublevel;
|
||||
}
|
||||
|
||||
interface Sublevel extends LevelUp {
|
||||
interface Sublevel extends levelup.LevelUpBase<Batch> {
|
||||
sublevel(key: string): Sublevel;
|
||||
pre(hook: Hook): Function;
|
||||
}
|
||||
|
||||
declare module "level-sublevel" {
|
||||
function sublevel(levelup: LevelUp): Sublevel;
|
||||
export = sublevel;
|
||||
}
|
||||
type Constructor = (levelup: levelup.LevelUp) => Sublevel
|
||||
}
|
||||
|
||||
Vendored
+145
@@ -0,0 +1,145 @@
|
||||
// Type definitions for LevelDown 1.7
|
||||
// Project: https://github.com/level/leveldown
|
||||
// Definitions by: Thiago de Arruda <https://github.com/tarruda>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export = leveldown;
|
||||
|
||||
declare var leveldown: leveldown.Constructor;
|
||||
|
||||
declare namespace leveldown {
|
||||
type Bytes = string | Buffer;
|
||||
type ErrCallback = (error: any) => void;
|
||||
type ErrNumberCallback = (error: any, value: number) => void;
|
||||
type ErrBufferCallback = (error: any, value: Buffer) => void;
|
||||
type ErrStringCallback = (error: any, value: string) => void;
|
||||
type KeyAsStringCallback = (error: any, key: string, value: Buffer) => void;
|
||||
type ValueAsStringCallback = (error: any, key: Buffer, value: string) => void;
|
||||
type KeyAndValueAsStringCallback = (error: any, key: string, value: string) => void;
|
||||
type KeyAndValueAsBufferCallback = (error: any, key: Buffer, value: Buffer) => void;
|
||||
|
||||
interface PutBatch {
|
||||
type: "put";
|
||||
key: Bytes;
|
||||
value: Bytes;
|
||||
}
|
||||
|
||||
interface DelBatch {
|
||||
type: "del";
|
||||
key: Bytes;
|
||||
}
|
||||
|
||||
type Batch = PutBatch | DelBatch;
|
||||
|
||||
interface OpenOptions {
|
||||
createIfMissing?: boolean;
|
||||
errorIfExists?: boolean;
|
||||
compression?: boolean;
|
||||
cacheSize?: number;
|
||||
}
|
||||
|
||||
interface OpenAdvancedOptions extends OpenOptions {
|
||||
writeBufferSize?: number;
|
||||
blockSize?: number;
|
||||
maxOpenFiles?: number;
|
||||
blockRestartInterval?: number;
|
||||
maxFileSize?: number;
|
||||
}
|
||||
|
||||
interface WriteOptions {
|
||||
sync?: boolean;
|
||||
}
|
||||
|
||||
interface ReadOptions {
|
||||
fillCache?: boolean;
|
||||
}
|
||||
|
||||
interface BufferReadOptions extends ReadOptions {
|
||||
asBuffer?: true;
|
||||
}
|
||||
|
||||
interface StringReadOptions extends ReadOptions {
|
||||
asBuffer: false;
|
||||
}
|
||||
|
||||
interface IteratorOptions {
|
||||
gt?: Bytes;
|
||||
lt?: Bytes;
|
||||
gte?: Bytes;
|
||||
lte?: Bytes;
|
||||
reverse?: boolean;
|
||||
keys?: boolean;
|
||||
values?: boolean;
|
||||
limit?: number;
|
||||
fillCache?: boolean;
|
||||
}
|
||||
|
||||
interface KeyAsStringIteratorOptions extends IteratorOptions {
|
||||
keyAsBuffer: false;
|
||||
valueAsBuffer?: true;
|
||||
}
|
||||
|
||||
interface ValueAsStringIteratorOptions extends IteratorOptions {
|
||||
keyAsBuffer?: true;
|
||||
valueAsBuffer: false;
|
||||
}
|
||||
|
||||
interface KeyAndValueAsStringIteratorOptions extends IteratorOptions {
|
||||
keyAsBuffer: false;
|
||||
valueAsBuffer: false;
|
||||
}
|
||||
|
||||
interface KeyAndValueAsBufferIteratorOptions extends IteratorOptions {
|
||||
keyAsBuffer?: true;
|
||||
valueAsBuffer?: true;
|
||||
}
|
||||
|
||||
interface Iterator {
|
||||
seek(key: Bytes): void;
|
||||
end(callback: ErrCallback): void;
|
||||
}
|
||||
|
||||
interface KeyAsStringIterator extends Iterator {
|
||||
next(callback: KeyAsStringCallback): void;
|
||||
}
|
||||
|
||||
interface ValueAsStringIterator extends Iterator {
|
||||
next(callback: ValueAsStringCallback): void;
|
||||
}
|
||||
|
||||
interface KeyAndValueAsStringIterator extends Iterator {
|
||||
next(callback: KeyAndValueAsStringCallback): void;
|
||||
}
|
||||
|
||||
interface KeyAndValueAsBufferIterator extends Iterator {
|
||||
next(callback: KeyAndValueAsBufferCallback): void;
|
||||
}
|
||||
|
||||
interface LevelDown {
|
||||
open(callback: ErrCallback): void;
|
||||
open(options: OpenOptions, callback: ErrCallback): void;
|
||||
close(callback?: ErrCallback): void;
|
||||
put(key: Bytes, value: Bytes, callback: ErrCallback): void;
|
||||
put(key: Bytes, value: Bytes, options: WriteOptions, callback: ErrCallback): void;
|
||||
get(key: Bytes, callback: ErrBufferCallback): void;
|
||||
get(key: Bytes, options: BufferReadOptions, callback: ErrBufferCallback): void;
|
||||
get(key: Bytes, options: StringReadOptions, callback: ErrStringCallback): void;
|
||||
del(key: Bytes, callback?: ErrCallback): void;
|
||||
del(key: Bytes, options: WriteOptions, callback?: ErrCallback): void;
|
||||
batch(operations: Batch[], callback?: ErrCallback): void;
|
||||
batch(operations: Batch[], options?: WriteOptions, callback?: ErrCallback): void;
|
||||
approximateSize(start: Bytes, end: Bytes, callback: ErrNumberCallback): void;
|
||||
compactRange(start: Bytes, end: Bytes, callback: ErrCallback): void;
|
||||
getProperty(property: string): string;
|
||||
iterator(options?: KeyAsStringIteratorOptions): KeyAsStringIterator;
|
||||
iterator(options?: ValueAsStringIteratorOptions): ValueAsStringIterator;
|
||||
iterator(options?: KeyAndValueAsStringIteratorOptions): KeyAndValueAsStringIterator;
|
||||
iterator(options?: KeyAndValueAsBufferIteratorOptions): KeyAndValueAsBufferIterator;
|
||||
destroy(location: string, callback: ErrCallback): void;
|
||||
repair(location: string, callback: ErrCallback): void;
|
||||
}
|
||||
|
||||
type Constructor = (location: string) => LevelDown;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import * as leveldown from "leveldown";
|
||||
|
||||
let db = leveldown("db1");
|
||||
|
||||
db.open((err) => {});
|
||||
db.open({createIfMissing: true}, (err) => {});
|
||||
|
||||
db.put("key", "value", (err) => {});
|
||||
db.put(Buffer.from("key"), Buffer.from("value"), (err) => {});
|
||||
db.put("key", "value", {sync: true}, (err) => {});
|
||||
|
||||
db.get("key", {asBuffer: false}, (error, val) => {
|
||||
console.log(val.toUpperCase());
|
||||
});
|
||||
db.get("key", {fillCache: true}, (error, val) => {
|
||||
console.log(val.readUInt32BE(0));
|
||||
});
|
||||
db.get("key", (error, val) => {
|
||||
console.log(val.readUInt32BE(0));
|
||||
});
|
||||
|
||||
db.del("key");
|
||||
db.del("key", (error) => {});
|
||||
db.del("key", {sync: true}, (error) => {});
|
||||
|
||||
db.batch([{
|
||||
type: "put", key: "k", value: "v"
|
||||
}, {
|
||||
type: "del", key: "k"
|
||||
}], (error) => {});
|
||||
|
||||
const keyAsStringIterator = db.iterator({keyAsBuffer: false});
|
||||
keyAsStringIterator.next((err, k, v) => {
|
||||
console.log(k.toUpperCase());
|
||||
console.log(v.readUInt32BE(0));
|
||||
});
|
||||
|
||||
const valueAsStringIterator = db.iterator({valueAsBuffer: false});
|
||||
valueAsStringIterator.next((err, k, v) => {
|
||||
console.log(k.readUInt32BE(0));
|
||||
console.log(v.toUpperCase());
|
||||
});
|
||||
|
||||
const keyAndValueAsStringIterator = db.iterator({keyAsBuffer: false, valueAsBuffer: false});
|
||||
keyAndValueAsStringIterator.next((err, k, v) => {
|
||||
console.log(k.toUpperCase());
|
||||
console.log(v.toUpperCase());
|
||||
});
|
||||
|
||||
const keyAndValueAsBufferIterator1 = db.iterator({keyAsBuffer: true, valueAsBuffer: true});
|
||||
keyAndValueAsBufferIterator1.next((err, k, v) => {
|
||||
console.log(k.readUInt32BE(0));
|
||||
console.log(v.readUInt32BE(0));
|
||||
});
|
||||
|
||||
const keyAndValueAsBufferIterator2 = db.iterator({keyAsBuffer: true});
|
||||
keyAndValueAsBufferIterator2.next((err, k, v) => {
|
||||
console.log(k.readUInt32BE(0));
|
||||
console.log(v.readUInt32BE(0));
|
||||
});
|
||||
|
||||
const keyAndValueAsBufferIterator3 = db.iterator({valueAsBuffer: true});
|
||||
keyAndValueAsBufferIterator3.next((err, k, v) => {
|
||||
console.log(k.readUInt32BE(0));
|
||||
console.log(v.readUInt32BE(0));
|
||||
});
|
||||
|
||||
const keyAndValueAsBufferIterator4 = db.iterator({});
|
||||
keyAndValueAsBufferIterator4.next((err, k, v) => {
|
||||
console.log(k.readUInt32BE(0));
|
||||
console.log(v.readUInt32BE(0));
|
||||
});
|
||||
|
||||
keyAndValueAsBufferIterator4.seek("k");
|
||||
keyAndValueAsBufferIterator4.end((err) => {});
|
||||
|
||||
let s: string = db.getProperty("leveldb.stats");
|
||||
|
||||
db.approximateSize("k1", "k2", (err, size) => {
|
||||
console.log(size.toExponential());
|
||||
});
|
||||
|
||||
db.compactRange("k1", "k2", (err) => {});
|
||||
|
||||
db.destroy("/path/to/db", (err) => {});
|
||||
db.repair("/path/to/db", (err) => {});
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"leveldown-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+17
-14
@@ -5,6 +5,14 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as leveldown from "leveldown";
|
||||
|
||||
export = levelup;
|
||||
|
||||
declare var levelup: levelup.LevelUpConstructor;
|
||||
|
||||
declare namespace levelup {
|
||||
|
||||
interface CustomEncoding {
|
||||
encode(val: any): Buffer| string;
|
||||
decode(val: Buffer | string): any;
|
||||
@@ -21,7 +29,8 @@ interface Batch {
|
||||
keyEncoding?: Encoding;
|
||||
valueEncoding?: Encoding;
|
||||
}
|
||||
interface LevelUp {
|
||||
|
||||
interface LevelUpBase<BatchType extends Batch> {
|
||||
open(callback ?: (error : any) => any): void;
|
||||
close(callback ?: (error : any) => any): void;
|
||||
put(key: any, value: any, callback ?: (error: any) => any): void;
|
||||
@@ -33,8 +42,8 @@ interface LevelUp {
|
||||
del(key: any, options ?: { keyEncoding?: Encoding; sync?: boolean }, callback ?: (error: any) => any): void;
|
||||
|
||||
|
||||
batch(array: Batch[], options?: { keyEncoding?: Encoding; valueEncoding?: Encoding; sync?: boolean }, callback?: (error?: any)=>any): void;
|
||||
batch(array: Batch[], callback?: (error?: any)=>any): void;
|
||||
batch(array: BatchType[], options?: { keyEncoding?: Encoding; valueEncoding?: Encoding; sync?: boolean }, callback?: (error?: any)=>any): void;
|
||||
batch(array: BatchType[], callback?: (error?: any)=>any): void;
|
||||
batch():LevelUpChain;
|
||||
isOpen():boolean;
|
||||
isClosed():boolean;
|
||||
@@ -46,6 +55,8 @@ interface LevelUp {
|
||||
repair(location: string, callback?: Function): void;
|
||||
}
|
||||
|
||||
type LevelUp = LevelUpBase<Batch>
|
||||
|
||||
interface LevelUpChain {
|
||||
put(key: any, value: any): LevelUpChain;
|
||||
put(key: any, value: any, options?: { sync?: boolean }): LevelUpChain;
|
||||
@@ -62,18 +73,10 @@ interface levelupOptions {
|
||||
cacheSize?: number;
|
||||
keyEncoding?: Encoding;
|
||||
valueEncoding?: Encoding;
|
||||
db?: string
|
||||
db?: leveldown.Constructor;
|
||||
}
|
||||
|
||||
declare module "levelup" {
|
||||
|
||||
function levelup(hostname: string, options?: levelupOptions): LevelUp;
|
||||
|
||||
export = levelup;
|
||||
interface LevelUpConstructor {
|
||||
(hostname: string, options?: levelupOptions): LevelUp;
|
||||
}
|
||||
|
||||
declare module "leveldown" {
|
||||
|
||||
export function destroy(location: string, callback?: Function): void;
|
||||
export function repair(location: string, callback?: Function): void;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import levelup = require("levelup");
|
||||
import * as levelup from "levelup";
|
||||
|
||||
interface BufferEncoding {
|
||||
encode(val: any): Buffer;
|
||||
@@ -82,7 +82,3 @@ db.createReadStream()
|
||||
.on('end', function () {
|
||||
console.log('Stream closed')
|
||||
})
|
||||
|
||||
import leveldown = require('leveldown');
|
||||
leveldown.destroy('mypath', ()=>{});
|
||||
leveldown.repair('mypath', ()=>{});
|
||||
|
||||
Vendored
+9
-9
@@ -18522,7 +18522,7 @@ declare namespace _ {
|
||||
* @param defaultValue The default value.
|
||||
* @returns Returns the resolved value.
|
||||
*/
|
||||
defaultTo<T>(value: T, defaultValue: T): T;
|
||||
defaultTo<T>(value: T | null | undefined, defaultValue: T): T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapperBase<T, TWrapper> {
|
||||
@@ -19591,20 +19591,20 @@ declare namespace _ {
|
||||
|
||||
type ListIterator<T, TResult> = (value: T, index: number, collection: List<T>) => TResult;
|
||||
|
||||
type DictionaryIterator<T, TResult> = (value: T, key?: string, collection?: Dictionary<T>) => TResult;
|
||||
type DictionaryIterator<T, TResult> = (value: T, key: string, collection: Dictionary<T>) => TResult;
|
||||
|
||||
type NumericDictionaryIterator<T, TResult> = (value: T, key?: number, collection?: Dictionary<T>) => TResult;
|
||||
type NumericDictionaryIterator<T, TResult> = (value: T, key: number, collection: Dictionary<T>) => TResult;
|
||||
|
||||
type ObjectIterator<T, TResult> = (element: T, key?: string, collection?: any) => TResult;
|
||||
type ObjectIterator<T, TResult> = (element: T, key: string, collection: any) => TResult;
|
||||
|
||||
type StringIterator<TResult> = (char: string, index?: number, string?: string) => TResult;
|
||||
type StringIterator<TResult> = (char: string, index: number, string: string) => TResult;
|
||||
|
||||
type MemoVoidIterator<T, TResult> = (prev: TResult, curr: T, indexOrKey?: any, list?: T[]) => void;
|
||||
type MemoVoidIterator<T, TResult> = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => void;
|
||||
|
||||
type MemoIterator<T, TResult> = (prev: TResult, curr: T, indexOrKey?: any, list?: T[]) => TResult;
|
||||
type MemoIterator<T, TResult> = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult;
|
||||
|
||||
type MemoVoidArrayIterator<T, TResult> = (acc: TResult, curr: T, index?: number, arr?: T[]) => void;
|
||||
type MemoVoidDictionaryIterator<T, TResult> = (acc: TResult, curr: T, key?: string, dict?: Dictionary<T>) => void;
|
||||
type MemoVoidArrayIterator<T, TResult> = (acc: TResult, curr: T, index: number, arr: T[]) => void;
|
||||
type MemoVoidDictionaryIterator<T, TResult> = (acc: TResult, curr: T, key: string, dict: Dictionary<T>) => void;
|
||||
|
||||
// Common interface between Arrays and jQuery objects
|
||||
interface List<T> {
|
||||
|
||||
+542
-535
File diff suppressed because it is too large
Load Diff
@@ -299,7 +299,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for material-ui v0.17.5
|
||||
// Type definitions for material-ui v0.17.51
|
||||
// Project: https://github.com/callemall/material-ui
|
||||
// Definitions by: Nathan Brown <https://github.com/ngbrown>, Igor Belagorudsky <https://github.com/theigor>, Ali Taheri Moghaddar <https://github.com/alitaheri>, Oliver Herrmann <https://github.com/herrmanno>, Daniel Roth <https://github.com/DaIgeb>, Aurelién Allienne <https://github.com/allienna>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -1019,7 +1019,7 @@ declare namespace __MaterialUI {
|
||||
overlayStyle?: React.CSSProperties;
|
||||
style?: React.CSSProperties;
|
||||
swipeAreaWidth?: number;
|
||||
width?: number;
|
||||
width?: number | string;
|
||||
zDepth?: number;
|
||||
}
|
||||
export class Drawer extends React.Component<DrawerProps, {}> {
|
||||
|
||||
@@ -1662,7 +1662,7 @@ class DrawerOpenRightExample extends React.Component<{}, {open?: boolean}> {
|
||||
label="Toggle Drawer"
|
||||
onTouchTap={this.handleToggle}
|
||||
/>
|
||||
<Drawer width={200} openSecondary={true} open={this.state.open}>
|
||||
<Drawer width="20%" openSecondary={true} open={this.state.open}>
|
||||
<AppBar title="AppBar"/>
|
||||
</Drawer>
|
||||
</div>
|
||||
|
||||
Vendored
+6
@@ -1,6 +1,7 @@
|
||||
// Type definitions for node-mysql
|
||||
// Project: https://github.com/felixge/node-mysql
|
||||
// Definitions by: William Johnston <https://github.com/wjohnsto>
|
||||
// Kacper Polak <https://github.com/kacepe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference types="node" />
|
||||
@@ -497,6 +498,11 @@ interface IError extends Error {
|
||||
* Boolean, indicating if this error is terminal to the connection object.
|
||||
*/
|
||||
fatal: boolean;
|
||||
|
||||
/**
|
||||
* SQL of failed query
|
||||
*/
|
||||
sql?: string;
|
||||
}
|
||||
|
||||
declare const enum FieldType {
|
||||
|
||||
Vendored
+88
-21
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Node.js v7.x
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
|
||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>, Parambir Singh <https://github.com/parambirs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/************************************************
|
||||
@@ -1091,18 +1091,25 @@ declare module "zlib" {
|
||||
export function createUnzip(options?: ZlibOptions): Unzip;
|
||||
|
||||
export function deflate(buf: Buffer | string, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function deflate(buf: Buffer | string, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function deflateSync(buf: Buffer | string, options?: ZlibOptions): Buffer;
|
||||
export function deflateRaw(buf: Buffer | string, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function deflateRaw(buf: Buffer | string, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function deflateRawSync(buf: Buffer | string, options?: ZlibOptions): Buffer;
|
||||
export function gzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function gzip(buf: Buffer, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function gzipSync(buf: Buffer, options?: ZlibOptions): Buffer;
|
||||
export function gunzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function gunzip(buf: Buffer, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function gunzipSync(buf: Buffer, options?: ZlibOptions): Buffer;
|
||||
export function inflate(buf: Buffer, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function inflate(buf: Buffer, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function inflateSync(buf: Buffer, options?: ZlibOptions): Buffer;
|
||||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function inflateRaw(buf: Buffer, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function inflateRawSync(buf: Buffer, options?: ZlibOptions): Buffer;
|
||||
export function unzip(buf: Buffer, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function unzip(buf: Buffer, options: ZlibOptions, callback: (error: Error, result: Buffer) => void): void;
|
||||
export function unzipSync(buf: Buffer, options?: ZlibOptions): Buffer;
|
||||
|
||||
export namespace constants {
|
||||
@@ -1886,11 +1893,6 @@ declare module "url" {
|
||||
}
|
||||
|
||||
declare module "dns" {
|
||||
export interface MxRecord {
|
||||
exchange: string,
|
||||
priority: number
|
||||
}
|
||||
|
||||
// Supported getaddrinfo flags.
|
||||
export const ADDRCONFIG: number;
|
||||
export const V4MAPPED: number;
|
||||
@@ -1914,22 +1916,87 @@ declare module "dns" {
|
||||
family: number;
|
||||
}
|
||||
|
||||
export function lookup(domain: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(domain: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(domain: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void;
|
||||
export function lookup(domain: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
|
||||
export function lookup(domain: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void;
|
||||
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
|
||||
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: MxRecord[]) => void): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[][]) => void): string[][];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
|
||||
export interface ResolveOptions {
|
||||
ttl: boolean;
|
||||
}
|
||||
|
||||
export interface ResolveWithTtlOptions extends ResolveOptions {
|
||||
ttl: true;
|
||||
}
|
||||
|
||||
export interface RecordWithTtl {
|
||||
address: string;
|
||||
ttl: number;
|
||||
}
|
||||
|
||||
export interface MxRecord {
|
||||
priority: number;
|
||||
exchange: string;
|
||||
}
|
||||
|
||||
export interface NaptrRecord {
|
||||
flags: string;
|
||||
service: string;
|
||||
regexp: string;
|
||||
replacement: string;
|
||||
order: number;
|
||||
preference: number;
|
||||
}
|
||||
|
||||
export interface SoaRecord {
|
||||
nsname: string;
|
||||
hostmaster: string;
|
||||
serial: number;
|
||||
refresh: number;
|
||||
retry: number;
|
||||
expire: number;
|
||||
minttl: number;
|
||||
}
|
||||
|
||||
export interface SrvRecord {
|
||||
priority: number;
|
||||
weight: number;
|
||||
port: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void;
|
||||
|
||||
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void;
|
||||
export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void;
|
||||
|
||||
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException, addresses: RecordWithTtl[]) => void): void;
|
||||
export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException, addresses: string[] | RecordWithTtl[]) => void): void;
|
||||
|
||||
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void;
|
||||
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void;
|
||||
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void;
|
||||
|
||||
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void;
|
||||
export function setServers(servers: string[]): void;
|
||||
|
||||
//Error codes
|
||||
|
||||
@@ -534,19 +534,25 @@ const compressMe = new Buffer("some data");
|
||||
const compressMeString = "compress me!";
|
||||
|
||||
zlib.deflate(compressMe, (err: Error, result: Buffer) => zlib.inflate(result, (err: Error, result: Buffer) => result));
|
||||
zlib.deflate(compressMe, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => zlib.inflate(result, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => result));
|
||||
zlib.deflate(compressMeString, (err: Error, result: Buffer) => zlib.inflate(result, (err: Error, result: Buffer) => result));
|
||||
zlib.deflate(compressMeString, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => zlib.inflate(result, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => result));
|
||||
const inflated = zlib.inflateSync(zlib.deflateSync(compressMe));
|
||||
const inflatedString = zlib.inflateSync(zlib.deflateSync(compressMeString));
|
||||
|
||||
zlib.deflateRaw(compressMe, (err: Error, result: Buffer) => zlib.inflateRaw(result, (err: Error, result: Buffer) => result));
|
||||
zlib.deflateRaw(compressMe, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => zlib.inflateRaw(result, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => result));
|
||||
zlib.deflateRaw(compressMeString, (err: Error, result: Buffer) => zlib.inflateRaw(result, (err: Error, result: Buffer) => result));
|
||||
zlib.deflateRaw(compressMeString, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => zlib.inflateRaw(result, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => result));
|
||||
const inflatedRaw: Buffer = zlib.inflateRawSync(zlib.deflateRawSync(compressMe));
|
||||
const inflatedRawString: Buffer = zlib.inflateRawSync(zlib.deflateRawSync(compressMeString));
|
||||
|
||||
zlib.gzip(compressMe, (err: Error, result: Buffer) => zlib.gunzip(result, (err: Error, result: Buffer) => result));
|
||||
zlib.gzip(compressMe, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => zlib.gunzip(result, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => result));
|
||||
const gunzipped: Buffer = zlib.gunzipSync(zlib.gzipSync(compressMe));
|
||||
|
||||
zlib.unzip(compressMe, (err: Error, result: Buffer) => result);
|
||||
zlib.unzip(compressMe, { finishFlush: zlib.Z_SYNC_FLUSH }, (err: Error, result: Buffer) => result);
|
||||
const unzipped: Buffer = zlib.unzipSync(compressMe);
|
||||
|
||||
// Simplified constructors
|
||||
@@ -2179,6 +2185,45 @@ namespace dns_tests {
|
||||
const _addresses: string | dns.LookupAddress[] = addresses;
|
||||
const _family: number | undefined = family;
|
||||
});
|
||||
|
||||
dns.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "A", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve4("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve4("nodejs.org", {ttl: true}, (err, addresses) => {
|
||||
const _addresses: dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
{
|
||||
const ttl = false;
|
||||
dns.resolve4("nodejs.org", {ttl: ttl}, (err, addresses) => {
|
||||
const _addresses: string[] | dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
}
|
||||
|
||||
dns.resolve6("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve6("nodejs.org", {ttl: true}, (err, addresses) => {
|
||||
const _addresses: dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
{
|
||||
const ttl = false;
|
||||
dns.resolve6("nodejs.org", {ttl: ttl}, (err, addresses) => {
|
||||
const _addresses: string[] | dns.RecordWithTtl[] = addresses;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Vendored
+87
-15
@@ -1265,22 +1265,94 @@ declare module "dns" {
|
||||
family: number;
|
||||
}
|
||||
|
||||
export function lookup(domain: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(domain: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(domain: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void;
|
||||
export function lookup(domain: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
|
||||
export function lookup(domain: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void;
|
||||
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
|
||||
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) =>void ): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) =>void ): string[];
|
||||
export interface MxRecord {
|
||||
priority: number;
|
||||
exchange: string;
|
||||
}
|
||||
|
||||
export interface NaptrRecord {
|
||||
flags: string;
|
||||
service: string;
|
||||
regexp: string;
|
||||
replacement: string;
|
||||
order: number;
|
||||
preference: number;
|
||||
}
|
||||
|
||||
export interface SoaRecord {
|
||||
nsname: string;
|
||||
hostmaster: string;
|
||||
serial: number;
|
||||
refresh: number;
|
||||
retry: number;
|
||||
expire: number;
|
||||
minttl: number;
|
||||
}
|
||||
|
||||
export interface SrvRecord {
|
||||
priority: number;
|
||||
weight: number;
|
||||
port: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void;
|
||||
|
||||
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void;
|
||||
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void;
|
||||
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void;
|
||||
|
||||
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void;
|
||||
export function setServers(servers: string[]): void;
|
||||
|
||||
//Error codes
|
||||
export var NODATA: string;
|
||||
export var FORMERR: string;
|
||||
export var SERVFAIL: string;
|
||||
export var NOTFOUND: string;
|
||||
export var NOTIMP: string;
|
||||
export var REFUSED: string;
|
||||
export var BADQUERY: string;
|
||||
export var BADNAME: string;
|
||||
export var BADFAMILY: string;
|
||||
export var BADRESP: string;
|
||||
export var CONNREFUSED: string;
|
||||
export var TIMEOUT: string;
|
||||
export var EOF: string;
|
||||
export var FILE: string;
|
||||
export var NOMEM: string;
|
||||
export var DESTRUCTION: string;
|
||||
export var BADSTR: string;
|
||||
export var BADFLAGS: string;
|
||||
export var NONAME: string;
|
||||
export var BADHINTS: string;
|
||||
export var NOTINITIALIZED: string;
|
||||
export var LOADIPHLPAPI: string;
|
||||
export var ADDRGETNETWORKPARAMS: string;
|
||||
export var CANCELLED: string;
|
||||
}
|
||||
|
||||
declare module "net" {
|
||||
|
||||
@@ -1021,4 +1021,25 @@ namespace dns_tests {
|
||||
const _addresses: string | dns.LookupAddress[] = addresses;
|
||||
const _family: number | undefined = family;
|
||||
});
|
||||
|
||||
dns.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "A", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve4("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve6("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+61
-20
@@ -1807,11 +1807,6 @@ declare module "url" {
|
||||
}
|
||||
|
||||
declare module "dns" {
|
||||
export interface MxRecord {
|
||||
exchange: string,
|
||||
priority: number
|
||||
}
|
||||
|
||||
// Supported getaddrinfo flags.
|
||||
export const ADDRCONFIG: number;
|
||||
export const V4MAPPED: number;
|
||||
@@ -1835,22 +1830,68 @@ declare module "dns" {
|
||||
family: number;
|
||||
}
|
||||
|
||||
export function lookup(domain: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(domain: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(domain: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void;
|
||||
export function lookup(domain: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
|
||||
export function lookup(domain: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException, addresses: LookupAddress[]) => void): void;
|
||||
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
|
||||
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
|
||||
|
||||
export function resolve(domain: string, rrtype: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve4(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolve6(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveMx(domain: string, callback: (err: Error, addresses: MxRecord[]) => void): string[];
|
||||
export function resolveTxt(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveSrv(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
|
||||
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
|
||||
export interface MxRecord {
|
||||
priority: number;
|
||||
exchange: string;
|
||||
}
|
||||
|
||||
export interface NaptrRecord {
|
||||
flags: string;
|
||||
service: string;
|
||||
regexp: string;
|
||||
replacement: string;
|
||||
order: number;
|
||||
preference: number;
|
||||
}
|
||||
|
||||
export interface SoaRecord {
|
||||
nsname: string;
|
||||
hostmaster: string;
|
||||
serial: number;
|
||||
refresh: number;
|
||||
retry: number;
|
||||
expire: number;
|
||||
minttl: number;
|
||||
}
|
||||
|
||||
export interface SrvRecord {
|
||||
priority: number;
|
||||
weight: number;
|
||||
port: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "A", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "AAAA", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "CNAME", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "MX", callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NAPTR", callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "NS", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "PTR", callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "SOA", callback: (err: NodeJS.ErrnoException, addresses: SoaRecord) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "SRV", callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: "TXT", callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void;
|
||||
export function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][]) => void): void;
|
||||
|
||||
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: MxRecord[]) => void): void;
|
||||
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: NaptrRecord[]) => void): void;
|
||||
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[]) => void): void;
|
||||
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException, address: SoaRecord) => void): void;
|
||||
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: SrvRecord[]) => void): void;
|
||||
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException, addresses: string[][]) => void): void;
|
||||
|
||||
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException, hostnames: string[]) => void): void;
|
||||
export function setServers(servers: string[]): void;
|
||||
|
||||
//Error codes
|
||||
|
||||
@@ -2091,6 +2091,27 @@ namespace dns_tests {
|
||||
const _addresses: string | dns.LookupAddress[] = addresses;
|
||||
const _family: number | undefined = family;
|
||||
});
|
||||
|
||||
dns.resolve("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "A", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "AAAA", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
dns.resolve("nodejs.org", "MX", (err, addresses) => {
|
||||
const _addresses: dns.MxRecord[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve4("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
|
||||
dns.resolve6("nodejs.org", (err, addresses) => {
|
||||
const _addresses: string[] = addresses;
|
||||
});
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Vendored
-1
@@ -2412,7 +2412,6 @@ declare module OfficeExtension {
|
||||
constructor(context: ClientRequestContext, parentObject: ClientObject, name: string, eventInfo: EventInfo<T>);
|
||||
add(handler: (args: T) => IPromise<any>): EventHandlerResult<T>;
|
||||
remove(handler: (args: T) => IPromise<any>): void;
|
||||
removeAll(): void;
|
||||
}
|
||||
|
||||
export class EventHandlerResult<T> {
|
||||
|
||||
Vendored
+1
-1
@@ -30,7 +30,7 @@ interface IOwlCarouselOptions {
|
||||
paginationNumbers?: boolean;
|
||||
responsive?: boolean;
|
||||
responsiveRefreshRate?: number;
|
||||
responsiveBaseWidth?: JQuery;
|
||||
responsiveBaseWidth?: JQuery | string;
|
||||
baseClass?: string;
|
||||
theme?: string;
|
||||
lazyLoad?: boolean;
|
||||
|
||||
Vendored
+1
@@ -1808,3 +1808,4 @@ declare namespace R {
|
||||
}
|
||||
|
||||
export = R;
|
||||
export as namespace R;
|
||||
|
||||
Vendored
+3
-1
@@ -4,7 +4,8 @@
|
||||
// Christian Droulers <https://github.com/cdroulers>,
|
||||
// Fedor Nezhivoi <https://github.com/gyzerok>,
|
||||
// Till Wolff <https://github.com/tillwolff>,
|
||||
// Karol Janyst <https://github.com/LKay>
|
||||
// Karol Janyst <https://github.com/LKay>,
|
||||
// Brian Houser <https://github.com/bhouser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
@@ -186,6 +187,7 @@ declare namespace ReactIntl {
|
||||
messages?: any;
|
||||
defaultLocale?: string;
|
||||
defaultFormats?: any;
|
||||
textComponent?: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// Type definitions for react-monaco-editor 0.8
|
||||
// Project: https://github.com/superRaytin/react-monaco-editor
|
||||
// Definitions by: Joshua Netterfield <https://github.com/jnetterf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="monaco-editor" />
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export interface ReactMonacoEditorProps {
|
||||
/**
|
||||
* Width of editor. Defaults to 100%.
|
||||
*/
|
||||
width?: string | number;
|
||||
|
||||
/**
|
||||
* Height of editor. Defaults to 500.
|
||||
*/
|
||||
height?: string | number;
|
||||
|
||||
/**
|
||||
* Value of the auto created model in the editor.
|
||||
* If you specify value property, the component behaves in controlled mode. Otherwise, it behaves in uncontrolled mode.
|
||||
*/
|
||||
value?: string;
|
||||
|
||||
/**
|
||||
* The initial value of the auto created model in the editor.
|
||||
*/
|
||||
defaultValue?: string;
|
||||
|
||||
/**
|
||||
* The initial language of the auto created model in the editor.
|
||||
*/
|
||||
language?: string;
|
||||
|
||||
/**
|
||||
* Theme to be used for rendering.
|
||||
* The current out-of-the-box available themes are: 'vs' (default), 'vs-dark', 'hc-black'.
|
||||
* You can create custom themes via `monaco.editor.defineTheme`.
|
||||
*/
|
||||
theme?: string;
|
||||
|
||||
/**
|
||||
* Refer to Monaco interface IEditorOptions.
|
||||
*/
|
||||
options?: monaco.editor.IEditorOptions;
|
||||
|
||||
/**
|
||||
* An event emitted when the editor has been mounted (similar to componentDidMount of React).
|
||||
*/
|
||||
editorDidMount?(editor: monaco.editor.ICodeEditor, monacoModule: typeof monaco): void;
|
||||
|
||||
/**
|
||||
* An event emitted before the editor mounted (similar to componentWillMount of React).
|
||||
*/
|
||||
editorWillMount?(monacoModule: typeof monaco): void;
|
||||
|
||||
/**
|
||||
* An event emitted when the content of the current model has changed.
|
||||
*/
|
||||
onChange?(val: string, ev: monaco.editor.IModelContentChangedEvent2): void;
|
||||
|
||||
/**
|
||||
* Optional, allow to config loader url and relative path of module, refer to require.config.
|
||||
*/
|
||||
requireConfig?: object;
|
||||
|
||||
/**
|
||||
* Optional, allow to pass a different context then the global window onto which the monaco instance will be loaded. Useful if you want to load the editor in an iframe.
|
||||
*/
|
||||
context?: object;
|
||||
}
|
||||
|
||||
export default class ReactMonacoEditor extends React.Component<ReactMonacoEditorProps, void> {
|
||||
editor: monaco.editor.ICodeEditor;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"monaco-editor": "0.8.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
// Adapted from https://github.com/superRaytin/react-monaco-editor/blob/master/examples/index.js
|
||||
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import MonacoEditor from 'react-monaco-editor';
|
||||
|
||||
interface CodeEditorState {
|
||||
code?: string;
|
||||
}
|
||||
|
||||
// Using with webpack
|
||||
class CodeEditor extends React.Component<object, CodeEditorState> {
|
||||
constructor(props: object) {
|
||||
super(props);
|
||||
this.state = {
|
||||
code: '// type your code... \n',
|
||||
};
|
||||
}
|
||||
editor: monaco.editor.ICodeEditor;
|
||||
editorDidMount = (editor: monaco.editor.ICodeEditor) => {
|
||||
console.log('editorDidMount', editor, editor.getValue(), editor.getModel());
|
||||
this.editor = editor;
|
||||
}
|
||||
onChange = (newValue: string, e: monaco.editor.IModelContentChangedEvent2) => {
|
||||
console.log('onChange', newValue, e);
|
||||
this.setState({
|
||||
code: newValue,
|
||||
});
|
||||
}
|
||||
changeEditorValue = () => {
|
||||
if (this.editor) {
|
||||
this.editor.setValue('// code changed! \n');
|
||||
}
|
||||
}
|
||||
changeBySetState = () => {
|
||||
this.setState({code: '// code changed by setState! \n'});
|
||||
}
|
||||
render() {
|
||||
const code = this.state.code;
|
||||
const options = {
|
||||
selectOnLineNumbers: true,
|
||||
roundedSelection: false,
|
||||
readOnly: false,
|
||||
theme: 'vs',
|
||||
cursorStyle: 'line',
|
||||
automaticLayout: false,
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<button onClick={this.changeEditorValue}>Change value</button>
|
||||
<button onClick={this.changeBySetState}>Change by setState</button>
|
||||
</div>
|
||||
<hr />
|
||||
<MonacoEditor
|
||||
height="500"
|
||||
language="javascript"
|
||||
value={code}
|
||||
options={options}
|
||||
onChange={this.onChange}
|
||||
editorDidMount={this.editorDidMount}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Using with require.config
|
||||
class AnotherEditor extends React.Component<object, CodeEditorState> {
|
||||
constructor(props: object) {
|
||||
super(props);
|
||||
const jsonCode = [
|
||||
'{',
|
||||
' "$schema": "http://myserver/foo-schema.json"',
|
||||
"}"
|
||||
].join('\n');
|
||||
this.state = {
|
||||
code: jsonCode,
|
||||
};
|
||||
}
|
||||
editorWillMount = (monacoModule: typeof monaco) => {
|
||||
monacoModule.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||
schemas: [{
|
||||
uri: "http://myserver/foo-schema.json",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
p1: {
|
||||
enum: [ "v1", "v2"]
|
||||
},
|
||||
p2: {
|
||||
$ref: "http://myserver/bar-schema.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
uri: "http://myserver/bar-schema.json",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
q1: {
|
||||
enum: [ "x1", "x2"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
render() {
|
||||
const code = this.state.code;
|
||||
const requireConfig = {
|
||||
url: 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.1/require.min.js',
|
||||
paths: {
|
||||
vs: 'https://as.alipayobjects.com/g/cicada/monaco-editor-mirror/0.6.1/min/vs'
|
||||
}
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<MonacoEditor
|
||||
width="800"
|
||||
height="600"
|
||||
language="json"
|
||||
defaultValue={code}
|
||||
requireConfig={requireConfig}
|
||||
editorWillMount={this.editorWillMount}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class App extends React.Component<any, any> {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h2>Monaco Editor Sample (controlled mode)</h2>
|
||||
<CodeEditor />
|
||||
<hr />
|
||||
<h2>Another editor (uncontrolled mode)</h2>
|
||||
<AnotherEditor />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
render(
|
||||
<App />,
|
||||
document.getElementById('root')
|
||||
);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-monaco-editor-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+410
@@ -0,0 +1,410 @@
|
||||
// Type definitions for react-native-goby 0.04
|
||||
// Project: https://gitlab.com/MessageDream/react-native-goby
|
||||
// Definitions by: jaydenzhao <https://github.com/MessageDream/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export type DownloadProgressCallback = (progress: DownloadProgress) => void;
|
||||
export type SyncStatusChangedCallback = (status: Goby.SyncStatus) => void;
|
||||
|
||||
export interface GobyOptions extends SyncOptions {
|
||||
/**
|
||||
* Specifies when you would like to synchronize updates with the Goby server.
|
||||
* Defaults to goby.CheckFrequency.ON_APP_START.
|
||||
*/
|
||||
checkFrequency: Goby.CheckFrequency;
|
||||
}
|
||||
|
||||
export interface DownloadProgress {
|
||||
/**
|
||||
* The total number of bytes expected to be received for this update.
|
||||
*/
|
||||
totalBytes: number;
|
||||
|
||||
/**
|
||||
* The number of bytes downloaded thus far.
|
||||
*/
|
||||
receivedBytes: number;
|
||||
}
|
||||
|
||||
export interface LocalPackage extends Package {
|
||||
/**
|
||||
* Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app.
|
||||
*
|
||||
* @param installMode Indicates when you would like the update changes to take affect for the end-user.
|
||||
* @param minimumBackgroundDuration For resume-based installs, this specifies the number of seconds the app needs to be in the background before forcing a restart. Defaults to 0 if unspecified.
|
||||
*/
|
||||
install(installMode: Goby.InstallMode, minimumBackgroundDuration?: number): Promise<void>;
|
||||
}
|
||||
|
||||
export interface Package {
|
||||
/**
|
||||
* The app binary version that this update is dependent on. This is the value that was
|
||||
* specified via the appStoreVersion parameter when calling the CLI's release command.
|
||||
*/
|
||||
appVersion: string;
|
||||
|
||||
/**
|
||||
* The deployment key that was used to originally download this update.
|
||||
*/
|
||||
deploymentKey: string;
|
||||
|
||||
/**
|
||||
* The description of the update. This is the same value that you specified in the CLI when you released the update.
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* Indicates whether this update has been previously installed but was rolled back.
|
||||
*/
|
||||
failedInstall: boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether this is the first time the update has been run after being installed.
|
||||
*/
|
||||
isFirstRun: boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released.
|
||||
*/
|
||||
isMandatory: boolean;
|
||||
|
||||
/**
|
||||
* Indicates whether this update is in a "pending" state. When true, that means the update has been downloaded and installed, but the app restart
|
||||
* needed to apply it hasn't occurred yet, and therefore, its changes aren't currently visible to the end-user.
|
||||
*/
|
||||
isPending: boolean;
|
||||
|
||||
/**
|
||||
* The internal label automatically given to the update by the Goby server. This value uniquely identifies the update within its deployment.
|
||||
*/
|
||||
label: string;
|
||||
|
||||
/**
|
||||
* The SHA hash value of the update.
|
||||
*/
|
||||
packageHash: string;
|
||||
|
||||
/**
|
||||
* The size of the code contained within the update, in bytes.
|
||||
*/
|
||||
packageSize: number;
|
||||
}
|
||||
|
||||
export interface RemotePackage extends Package {
|
||||
/**
|
||||
* Downloads the available update from the Goby service.
|
||||
*
|
||||
* @param downloadProgressCallback An optional callback that allows tracking the progress of the update while it is being downloaded.
|
||||
*/
|
||||
download(downloadProgressCallback?: DownloadProgressCallback): Promise<LocalPackage>;
|
||||
|
||||
/**
|
||||
* The URL at which the package is available for download.
|
||||
*/
|
||||
downloadUrl: string;
|
||||
}
|
||||
|
||||
export interface SyncOptions {
|
||||
/**
|
||||
* Specifies the deployment key you want to query for an update against. By default, this value is derived from the Info.plist
|
||||
* file (iOS) and MainActivity.java file (Android), but this option allows you to override it from the script-side if you need to
|
||||
* dynamically use a different deployment for a specific call to sync.
|
||||
*/
|
||||
deploymentKey?: string;
|
||||
|
||||
/**
|
||||
* Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory).
|
||||
* Defaults to goby.InstallMode.ON_NEXT_RESTART.
|
||||
*/
|
||||
installMode?: Goby.InstallMode;
|
||||
|
||||
/**
|
||||
* Specifies when you would like to install updates which are marked as mandatory.
|
||||
* Defaults to goby.InstallMode.IMMEDIATE.
|
||||
*/
|
||||
mandatoryInstallMode?: Goby.InstallMode;
|
||||
|
||||
/**
|
||||
* Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property
|
||||
* only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME`, and can be useful for getting your update in front
|
||||
* of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a
|
||||
* resume, regardless how long it was in the background.
|
||||
*/
|
||||
minimumBackgroundDuration?: number;
|
||||
|
||||
/**
|
||||
* An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available,
|
||||
* and if so, what strings to use. Defaults to null, which has the effect of disabling the dialog completely. Setting this to any truthy
|
||||
* value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as
|
||||
* overriding one or more of the default strings.
|
||||
*/
|
||||
updateDialog?: UpdateDialog;
|
||||
}
|
||||
|
||||
export interface UpdateDialog {
|
||||
/**
|
||||
* Indicates whether you would like to append the description of an available release to the
|
||||
* notification message which is displayed to the end user. Defaults to false.
|
||||
*/
|
||||
appendReleaseDescription?: boolean;
|
||||
|
||||
/**
|
||||
* Indicates the string you would like to prefix the release description with, if any, when
|
||||
* displaying the update notification to the end user. Defaults to " Description: "
|
||||
*/
|
||||
descriptionPrefix?: string;
|
||||
|
||||
/**
|
||||
* The text to use for the button the end user must press in order to install a mandatory update. Defaults to "Continue".
|
||||
*/
|
||||
mandatoryContinueButtonLabel?: string;
|
||||
|
||||
/**
|
||||
* The text used as the body of an update notification, when the update is specified as mandatory.
|
||||
* Defaults to "An update is available that must be installed.".
|
||||
*/
|
||||
mandatoryUpdateMessage?: string;
|
||||
|
||||
/**
|
||||
* The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to "Ignore".
|
||||
*/
|
||||
optionalIgnoreButtonLabel?: string;
|
||||
|
||||
/**
|
||||
* The text to use for the button the end user can press in order to install an optional update. Defaults to "Install".
|
||||
*/
|
||||
optionalInstallButtonLabel?: string;
|
||||
|
||||
/**
|
||||
* The text used as the body of an update notification, when the update is optional. Defaults to "An update is available. Would you like to install it?".
|
||||
*/
|
||||
optionalUpdateMessage?: string;
|
||||
|
||||
/**
|
||||
* The text used as the header of an update notification that is displayed to the end user. Defaults to "Update available".
|
||||
*/
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export interface StatusReport {
|
||||
/**
|
||||
* Whether the deployment succeeded or failed.
|
||||
*/
|
||||
status: Goby.DeploymentStatus;
|
||||
|
||||
/**
|
||||
* The version of the app that was deployed (for a native app upgrade).
|
||||
*/
|
||||
appVersion?: string;
|
||||
|
||||
/**
|
||||
* Details of the package that was deployed (or attempted to).
|
||||
*/
|
||||
package?: Package;
|
||||
|
||||
/**
|
||||
* Deployment key used when deploying the previous package.
|
||||
*/
|
||||
previousDeploymentKey?: string;
|
||||
|
||||
/**
|
||||
* The label (v#) of the package that was upgraded from.
|
||||
*/
|
||||
previousLabelOrAppVersion?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorates a React Component configuring it to sync for updates with the Goby server.
|
||||
*
|
||||
* @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show an prompt?, install the update immediately?).
|
||||
*/
|
||||
declare function Goby(options?: GobyOptions): Function;
|
||||
|
||||
declare namespace Goby {
|
||||
/**
|
||||
* Represents the default settings that will be used by the sync method if
|
||||
* an update dialog is configured to be displayed.
|
||||
*/
|
||||
var DEFAULT_UPDATE_DIALOG: UpdateDialog;
|
||||
|
||||
/**
|
||||
* Asks the Goby service whether the configured app deployment has an update available.
|
||||
*
|
||||
* @param deploymentKey The deployment key to use to query the Goby server for an update.
|
||||
*/
|
||||
function checkForUpdate(deploymentKey?: string): Promise<RemotePackage>;
|
||||
|
||||
/**
|
||||
* Retrieves the metadata for an installed update (e.g. description, mandatory).
|
||||
*
|
||||
* @param updateState The state of the update you want to retrieve the metadata for. Defaults to UpdateState.RUNNING.
|
||||
*/
|
||||
function getUpdateMetadata(updateState?: UpdateState): Promise<LocalPackage>;
|
||||
|
||||
/**
|
||||
* Notifies the Goby runtime that an installed update is considered successful.
|
||||
*/
|
||||
function notifyAppReady(): Promise<StatusReport>;
|
||||
|
||||
/**
|
||||
* Allow Goby to restart the app.
|
||||
*/
|
||||
function allowRestart(): void;
|
||||
|
||||
/**
|
||||
* Forbid Goby to restart the app.
|
||||
*/
|
||||
function disallowRestart(): void;
|
||||
|
||||
/**
|
||||
* Immediately restarts the app.
|
||||
*
|
||||
* @param onlyIfUpdateIsPending Indicates whether you want the restart to no-op if there isn't currently a pending update.
|
||||
*/
|
||||
function restartApp(onlyIfUpdateIsPending?: boolean): void;
|
||||
|
||||
/**
|
||||
* Allows checking for an update, downloading it and installing it, all with a single call.
|
||||
*
|
||||
* @param options Options used to configure the end-user update experience (e.g. show an prompt?, install the update immediately?).
|
||||
* @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise.
|
||||
* @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded.
|
||||
*/
|
||||
function sync(options?: SyncOptions, syncStatusChangedCallback?: SyncStatusChangedCallback, downloadProgressCallback?: DownloadProgressCallback): Promise<SyncStatus>;
|
||||
|
||||
/**
|
||||
* Indicates when you would like an installed update to actually be applied.
|
||||
*/
|
||||
enum InstallMode {
|
||||
/**
|
||||
* Indicates that you want to install the update and restart the app immediately.
|
||||
*/
|
||||
IMMEDIATE,
|
||||
|
||||
/**
|
||||
* Indicates that you want to install the update, but not forcibly restart the app.
|
||||
*/
|
||||
ON_NEXT_RESTART,
|
||||
|
||||
/**
|
||||
* Indicates that you want to install the update, but don't want to restart the
|
||||
* app until the next time the end user resumes it from the background.
|
||||
*/
|
||||
ON_NEXT_RESUME
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the current status of a sync operation.
|
||||
*/
|
||||
enum SyncStatus {
|
||||
/**
|
||||
* The Goby server is being queried for an update.
|
||||
*/
|
||||
CHECKING_FOR_UPDATE,
|
||||
|
||||
/**
|
||||
* An update is available, and a confirmation dialog was shown
|
||||
* to the end user. (This is only applicable when the updateDialog is used)
|
||||
*/
|
||||
AWAITING_USER_ACTION,
|
||||
|
||||
/**
|
||||
* An available update is being downloaded from the Goby server.
|
||||
*/
|
||||
DOWNLOADING_PACKAGE,
|
||||
|
||||
/**
|
||||
* An available update was downloaded and is about to be installed.
|
||||
*/
|
||||
INSTALLING_UPDATE,
|
||||
|
||||
/**
|
||||
* The app is up-to-date with the Goby server.
|
||||
*/
|
||||
UP_TO_DATE,
|
||||
|
||||
/**
|
||||
* The app had an optional update which the end user chose to ignore.
|
||||
* (This is only applicable when the updateDialog is used)
|
||||
*/
|
||||
UPDATE_IGNORED,
|
||||
|
||||
/**
|
||||
* An available update has been installed and will be run either immediately after the
|
||||
* syncStatusChangedCallback function returns or the next time the app resumes/restarts,
|
||||
* depending on the InstallMode specified in SyncOptions
|
||||
*/
|
||||
UPDATE_INSTALLED,
|
||||
|
||||
/**
|
||||
* There is an ongoing sync operation running which prevents the current call from being executed.
|
||||
*/
|
||||
SYNC_IN_PROGRESS,
|
||||
|
||||
/**
|
||||
* The sync operation encountered an unknown error.
|
||||
*/
|
||||
UNKNOWN_ERROR
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the state that an update is currently in.
|
||||
*/
|
||||
enum UpdateState {
|
||||
/**
|
||||
* Indicates that an update represents the
|
||||
* version of the app that is currently running.
|
||||
*/
|
||||
RUNNING,
|
||||
|
||||
/**
|
||||
* Indicates than an update has been installed, but the
|
||||
* app hasn't been restarted yet in order to apply it.
|
||||
*/
|
||||
PENDING,
|
||||
|
||||
/**
|
||||
* Indicates than an update represents the latest available
|
||||
* release, and can be either currently running or pending.
|
||||
*/
|
||||
LATEST
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the status of a deployment (after installing and restarting).
|
||||
*/
|
||||
enum DeploymentStatus {
|
||||
/**
|
||||
* The deployment failed (and was rolled back).
|
||||
*/
|
||||
FAILED,
|
||||
|
||||
/**
|
||||
* The deployment succeeded.
|
||||
*/
|
||||
SUCCEEDED
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates when you would like to check for (and install) updates from the Goby server.
|
||||
*/
|
||||
enum CheckFrequency {
|
||||
/**
|
||||
* When the app is fully initialized (or more specifically, when the root component is mounted).
|
||||
*/
|
||||
ON_APP_START,
|
||||
|
||||
/**
|
||||
* When the app re-enters the foreground.
|
||||
*/
|
||||
ON_APP_RESUME,
|
||||
|
||||
/**
|
||||
* Don't automatically check for updates, but only do it when goby.sync() is manully called inside app code.
|
||||
*/
|
||||
MANUAL
|
||||
}
|
||||
}
|
||||
|
||||
export default Goby;
|
||||
@@ -0,0 +1,23 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import {
|
||||
View,
|
||||
AppRegistry
|
||||
} from 'react-native';
|
||||
|
||||
import Goby from "react-native-goby";
|
||||
|
||||
class Home extends React.Component<any, any> {
|
||||
render() {
|
||||
return (
|
||||
<View></View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AppRegistry.registerComponent('home', () => Goby({
|
||||
updateDialog: false,
|
||||
checkFrequency: Goby.CheckFrequency.ON_APP_RESUME,
|
||||
installMode: Goby.InstallMode.IMMEDIATE
|
||||
})(Home));
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-goby-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// Lowercase `object` is available in TypeScript 2.2 only.
|
||||
"ban-types": false,
|
||||
// Below are all TODO
|
||||
"align": false,
|
||||
"array-type": false,
|
||||
"comment-format": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"no-misused-new": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-empty-interface": false,
|
||||
"no-padding": false,
|
||||
"no-var": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-method-signature": false,
|
||||
"semicolon": false,
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
Vendored
+29
-5
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-native 0.43
|
||||
// Type definitions for react-native 0.44
|
||||
// Project: https://github.com/facebook/react-native
|
||||
// Definitions by: Eloy Durán <https://github.com/alloy>, Fedor Nezhivoi <https://github.com/gyzerok>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -3123,9 +3123,9 @@ export interface ImageStyle extends FlexStyle, TransformsStyle, ShadowStyleIOS {
|
||||
}
|
||||
|
||||
/*
|
||||
* @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js
|
||||
*/
|
||||
interface ImageURISource {
|
||||
* @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js
|
||||
*/
|
||||
export interface ImageURISource {
|
||||
/**
|
||||
* `uri` is a string representing the resource identifier for the image, which
|
||||
* could be an http address, a local file path, or the name of a static image
|
||||
@@ -3435,6 +3435,13 @@ export interface FlatListProperties<ItemT> {
|
||||
*/
|
||||
data: ItemT[] | null;
|
||||
|
||||
/**
|
||||
* A marker property for telling the list to re-render (since it implements PureComponent).
|
||||
* If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop,
|
||||
* stick it here and treat it immutably.
|
||||
*/
|
||||
extraData?: any
|
||||
|
||||
/**
|
||||
* `getItemLayout` is an optional optimization that lets us skip measurement of dynamic
|
||||
* content if you know the height of items a priori. getItemLayout is the most efficient,
|
||||
@@ -3598,6 +3605,13 @@ export interface SectionListProperties<ItemT> extends ScrollViewProperties {
|
||||
*/
|
||||
SectionSeparatorComponent?: React.ComponentClass<any> | null
|
||||
|
||||
/**
|
||||
* A marker property for telling the list to re-render (since it implements PureComponent).
|
||||
* If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop,
|
||||
* stick it here and treat it immutably.
|
||||
*/
|
||||
extraData?: any
|
||||
|
||||
/**
|
||||
* Used to extract a unique key for a given item at the specified index. Key is used for caching
|
||||
* and as the react key to track item re-ordering. The default extractor checks `item.key`, then
|
||||
@@ -5083,6 +5097,11 @@ export interface TabBarItemProperties extends ViewProperties {
|
||||
*/
|
||||
badge?: string | number
|
||||
|
||||
/**
|
||||
* Background color for the badge. Available since iOS 10.
|
||||
*/
|
||||
badgeColor?: string
|
||||
|
||||
/**
|
||||
* A custom icon for the tab. It is ignored when a system icon is defined.
|
||||
*/
|
||||
@@ -5168,6 +5187,11 @@ export interface TabBarIOSProperties extends ViewProperties {
|
||||
* Color of text on unselected tabs
|
||||
*/
|
||||
unselectedTintColor?: string
|
||||
|
||||
/**
|
||||
* Color of unselected tab icons. Available since iOS 10.
|
||||
*/
|
||||
unselectedItemTintColor?: string
|
||||
}
|
||||
|
||||
export interface TabBarIOSStatic extends React.ComponentClass<TabBarIOSProperties> {
|
||||
@@ -5769,7 +5793,7 @@ export interface ScrollViewPropertiesIOS {
|
||||
* This can be used for paginating through children that have lengths smaller than the scroll view.
|
||||
* Used in combination with snapToAlignment.
|
||||
*/
|
||||
snapToInterval?: number[]
|
||||
snapToInterval?: number
|
||||
|
||||
/**
|
||||
* An array of child indices determining which children get docked to the
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
ScrollView,
|
||||
ScrollViewProps,
|
||||
RefreshControl,
|
||||
TabBarIOS,
|
||||
} from 'react-native';
|
||||
|
||||
function testDimensions() {
|
||||
@@ -255,3 +256,30 @@ class ScrollerListComponentTest extends React.Component<{}, { dataSource: ListVi
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TabBarTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return (
|
||||
<TabBarIOS
|
||||
barTintColor="darkslateblue"
|
||||
itemPositioning="center"
|
||||
tintColor="white"
|
||||
translucent={ true }
|
||||
unselectedTintColor="black"
|
||||
unselectedItemTintColor="red">
|
||||
<TabBarIOS.Item
|
||||
badge={ 0 }
|
||||
badgeColor="red"
|
||||
icon={{uri: undefined}}
|
||||
selected={ true }
|
||||
onPress={() => {}}
|
||||
renderAsOriginal={ true }
|
||||
selectedIcon={ undefined }
|
||||
systemIcon="history"
|
||||
title="Item 1">
|
||||
</TabBarIOS.Item>
|
||||
</TabBarIOS>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+13
-8
@@ -12,6 +12,7 @@
|
||||
// Tanguy Krotoff <https://github.com/tkrotoff>
|
||||
// Huy Nguyen <https://github.com/huy-nguyen>
|
||||
// Jérémy Fauvel <https://github.com/grmiade>
|
||||
// Daniel Roth <https://github.com/DaIgeb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -36,13 +37,13 @@ export interface MemoryRouterProps {
|
||||
keyLength?: number;
|
||||
}
|
||||
|
||||
export class MemoryRouter extends React.Component<MemoryRouterProps, void> {}
|
||||
export class MemoryRouter extends React.Component<MemoryRouterProps, void> { }
|
||||
|
||||
export interface PromptProps {
|
||||
message: string | ((location: H.Location) => void);
|
||||
when?: boolean;
|
||||
}
|
||||
export class Prompt extends React.Component<PromptProps, void> {}
|
||||
export class Prompt extends React.Component<PromptProps, void> { }
|
||||
|
||||
export interface RedirectProps {
|
||||
to: H.LocationDescriptor;
|
||||
@@ -52,7 +53,7 @@ export interface RedirectProps {
|
||||
exact?: boolean;
|
||||
strict?: boolean;
|
||||
}
|
||||
export class Redirect extends React.Component<RedirectProps, void> {}
|
||||
export class Redirect extends React.Component<RedirectProps, void> { }
|
||||
|
||||
export interface RouteComponentProps<P> {
|
||||
match: match<P>;
|
||||
@@ -69,12 +70,12 @@ export interface RouteProps {
|
||||
exact?: boolean;
|
||||
strict?: boolean;
|
||||
}
|
||||
export class Route extends React.Component<RouteProps, undefined> {}
|
||||
export class Route extends React.Component<RouteProps, {}> { }
|
||||
|
||||
export interface RouterProps {
|
||||
history: any;
|
||||
}
|
||||
export class Router extends React.Component<RouterProps, undefined> {}
|
||||
export class Router extends React.Component<RouterProps, {}> { }
|
||||
|
||||
export interface StaticRouterProps {
|
||||
basename?: string;
|
||||
@@ -82,8 +83,12 @@ export interface StaticRouterProps {
|
||||
context?: object;
|
||||
}
|
||||
|
||||
export class StaticRouter extends React.Component<StaticRouterProps, undefined> {}
|
||||
export class Switch extends React.Component<RouteProps, undefined> {}
|
||||
export class StaticRouter extends React.Component<StaticRouterProps, {}> { }
|
||||
export interface SwitchProps {
|
||||
children?: React.ReactNode;
|
||||
location?: H.Location;
|
||||
}
|
||||
export class Switch extends React.Component<SwitchProps, {}> { }
|
||||
|
||||
export interface match<P> {
|
||||
params: P;
|
||||
@@ -93,4 +98,4 @@ export interface match<P> {
|
||||
}
|
||||
|
||||
export function matchPath<P>(pathname: string, props: RouteProps): match<P> | null;
|
||||
export function withRouter(component: React.SFC<RouteComponentProps<any>> | React.ComponentClass<RouteComponentProps<any>>): React.ComponentClass<any>;
|
||||
export function withRouter<P>(component: React.SFC<RouteComponentProps<any> & P> | React.ComponentClass<RouteComponentProps<any> & P>): React.ComponentClass<P>;
|
||||
|
||||
@@ -2,12 +2,18 @@ import * as React from 'react';
|
||||
import { BrowserRouter, Redirect, Route, Switch } from 'react-router-dom';
|
||||
|
||||
const Home = () => <h2>Home</h2>;
|
||||
const About = () => <h2>About</h2>;
|
||||
const User = () => <h2>User</h2>;
|
||||
|
||||
const SwitchTest = () => (
|
||||
<BrowserRouter>
|
||||
<Switch>
|
||||
<Redirect exact from="/" to="/home"/>
|
||||
<Route path="/home" component={Home}/>
|
||||
{[
|
||||
<Route path="/user" component={User}/>,
|
||||
<Route path="/about" component={About}/>
|
||||
]}
|
||||
</Switch>
|
||||
</BrowserRouter>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
||||
|
||||
interface TOwnProps {
|
||||
username: string;
|
||||
}
|
||||
|
||||
const Component = (props: TOwnProps & RouteComponentProps<{}>) => <h2>Welcome {props.username}</h2>;
|
||||
|
||||
const WithRouterComponent = withRouter<TOwnProps>(Component);
|
||||
|
||||
const WithRouterTest = () => (<WithRouterComponent username="John" />);
|
||||
|
||||
export default WithRouterTest;
|
||||
@@ -28,6 +28,7 @@
|
||||
"test/Recursive.tsx",
|
||||
"test/RouteConfig.tsx",
|
||||
"test/Sidebar.tsx",
|
||||
"test/Switch.tsx"
|
||||
"test/Switch.tsx",
|
||||
"test/WithRouter.tsx"
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -50,7 +50,7 @@ declare namespace request {
|
||||
del(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
||||
del(uri: string, callback?: RequestCallback): TRequest;
|
||||
del(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
||||
|
||||
|
||||
delete(uri: string, options?: TOptions, callback?: RequestCallback): TRequest;
|
||||
delete(uri: string, callback?: RequestCallback): TRequest;
|
||||
delete(options: TUriUrlOptions & TOptions, callback?: RequestCallback): TRequest;
|
||||
@@ -237,6 +237,7 @@ declare namespace request {
|
||||
consumer_secret?: string;
|
||||
token?: string;
|
||||
token_secret?: string;
|
||||
transport_method?: 'body' | 'header' | 'query';
|
||||
verifier?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ str = oauth.consumer_key;
|
||||
str = oauth.consumer_secret;
|
||||
str = oauth.token;
|
||||
str = oauth.token_secret;
|
||||
str = oauth.transport_method;
|
||||
str = oauth.verifier;
|
||||
|
||||
var options: request.Options = {
|
||||
@@ -434,6 +435,7 @@ oauth =
|
||||
{ callback: 'http://mysite.com/callback/'
|
||||
, consumer_key: CONSUMER_KEY
|
||||
, consumer_secret: CONSUMER_SECRET
|
||||
, transport_method: 'header'
|
||||
}
|
||||
, url = 'https://api.twitter.com/oauth/request_token'
|
||||
;
|
||||
|
||||
Vendored
+1
@@ -76,6 +76,7 @@ declare namespace restangular {
|
||||
customDELETE(path: string, params?: any, headers?: any): IPromise<any>;
|
||||
customPOST(elem?: any, path?: string, params?: any, headers?: any): IPromise<any>;
|
||||
customPUT(elem?: any, path?: string, params?: any, headers?: any): IPromise<any>;
|
||||
customPATCH(elem?: any, path?: string, params?: any, headers?: any): IPromise<any>;
|
||||
customOperation(operation: string, path: string, params?: any, headers?: any, elem?: any): IPromise<any>;
|
||||
addRestangularMethod(name: string, operation: string, path?: string, params?: any, headers?: any, elem?: any): IPromise<any>;
|
||||
}
|
||||
|
||||
Vendored
+13
-1
@@ -3211,7 +3211,7 @@ declare namespace sequelize {
|
||||
* https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group
|
||||
*/
|
||||
group?: string | string[] | Object;
|
||||
|
||||
|
||||
/**
|
||||
* Apply DISTINCT(col) for FindAndCount(all)
|
||||
*/
|
||||
@@ -3371,6 +3371,13 @@ declare namespace sequelize {
|
||||
* Defaults to false;
|
||||
*/
|
||||
cascade?: boolean;
|
||||
|
||||
/**
|
||||
* Delete instead of setting deletedAt to current timestamp (only applicable if paranoid is enabled)
|
||||
*
|
||||
* Defaults to false;
|
||||
*/
|
||||
force?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4750,6 +4757,11 @@ declare namespace sequelize {
|
||||
*/
|
||||
fields?: Array<string | { attribute: string, length: number, order: string, collate: string }>;
|
||||
|
||||
/**
|
||||
* Condition for partioal index
|
||||
*/
|
||||
where?: WhereOptions;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -992,6 +992,9 @@ User.bulkCreate( [{ name : 'foo', code : '123' }, { code : '1234' }], { fields :
|
||||
User.bulkCreate( [{ name : 'a', c : 'b' }, { name : 'e', c : 'f' }], { fields : ['e', 'f'], ignoreDuplicates : true } );
|
||||
|
||||
User.truncate();
|
||||
User.truncate( { cascade : true } );
|
||||
User.truncate( { force : true } );
|
||||
User.truncate( { cascade: true, force : true } );
|
||||
|
||||
User.destroy( { where : { client_id : 13 } } ).then( ( a ) => a.toFixed() );
|
||||
User.destroy( { force : true } );
|
||||
@@ -1258,7 +1261,7 @@ s.define( 'UserWithUniqueUsername', {
|
||||
username : { type : Sequelize.STRING, unique : { name : 'user_and_email', msg : 'User and email must be unique' } },
|
||||
email : { type : Sequelize.STRING, unique : 'user_and_email' }
|
||||
} );
|
||||
/* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590
|
||||
|
||||
s.define( 'UserWithUniqueUsername', {
|
||||
user_id : { type : Sequelize.INTEGER },
|
||||
email : { type : Sequelize.STRING }
|
||||
@@ -1266,13 +1269,15 @@ s.define( 'UserWithUniqueUsername', {
|
||||
indexes : [
|
||||
{
|
||||
name : 'user_and_email_index',
|
||||
msg : 'User and email must be unique',
|
||||
unique : true,
|
||||
method : 'BTREE',
|
||||
fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }]
|
||||
fields : ['user_id', { attribute : 'email', collate : 'en_US', order : 'DESC', length : 5 }],
|
||||
where : {
|
||||
user_id : { $not: null }
|
||||
}
|
||||
}]
|
||||
} );
|
||||
*/
|
||||
|
||||
s.define( 'TaskBuild', {
|
||||
title : { type : Sequelize.STRING, defaultValue : 'a task!' },
|
||||
foo : { type : Sequelize.INTEGER, defaultValue : 2 },
|
||||
|
||||
Vendored
+19
-17
@@ -1,35 +1,37 @@
|
||||
// Type definitions for watch
|
||||
// Type definitions for watch 1.0
|
||||
// Project: https://github.com/mikeal/watch
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>, Gyusun Yeom <https://github.com/Perlmint>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/watch.d.ts
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
import fs = require("fs");
|
||||
import events = require("events");
|
||||
|
||||
export interface Monitor extends events.EventEmitter {
|
||||
// event: created
|
||||
// event: removed
|
||||
// event: changed
|
||||
export type FileOrFiles = fs.Stats | {[key: string]: fs.Stats};
|
||||
|
||||
// export function onCreated(callback, function(f, stat: fs.Stats) { });
|
||||
// export function onChanged(callback, function(f, curr: fs.Stats, prev: fs.Stats) { });
|
||||
// export function onRemoved(callback, function(f, stat: fs.Stats) { });
|
||||
export interface Monitor extends events.EventEmitter {
|
||||
files: {[key: string]: fs.Stats};
|
||||
|
||||
on(event: "created" | "removed", listener: (f: FileOrFiles, stat: fs.Stats) => void): this;
|
||||
on(event: "changed", listener: (f: FileOrFiles, current: fs.Stats, prev: fs.Stats) => void): this;
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
persistent?: boolean;
|
||||
ignoreDotFiles?: boolean;
|
||||
filter?: any;
|
||||
filter?(path: string, stat: fs.Stats): boolean;
|
||||
interval?: number;
|
||||
ignoreUnreadableDir?: boolean;
|
||||
ignoreNotPermitted?: boolean;
|
||||
ignoreDirectoryPattern?: boolean;
|
||||
}
|
||||
|
||||
export declare function watchTree(root: string, callback: (f: any, curr: fs.Stats, prev: fs.Stats) => void): void;
|
||||
export declare function watchTree(root: string, options: Options, callback: (f: any, curr: fs.Stats, prev: fs.Stats) => void): void;
|
||||
export declare function unwatchTree(root: string): void;
|
||||
export declare function createMonitor(root: string, callback: (monitor: Monitor) => void): void;
|
||||
export declare function createMonitor(root: string, options: Options, callback: (monitor: Monitor) => void): void;
|
||||
export function watchTree(root: string, callback: (f: FileOrFiles, curr: fs.Stats, prev: fs.Stats) => void): void;
|
||||
export function watchTree(root: string, options: Options, callback: (f: FileOrFiles, curr: fs.Stats, prev: fs.Stats) => void): void;
|
||||
export function unwatchTree(root: string): void;
|
||||
export function createMonitor(root: string, callback: (monitor: Monitor) => void): void;
|
||||
export function createMonitor(root: string, options: Options, callback: (monitor: Monitor) => void): void;
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"watch-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+27
-22
@@ -1,32 +1,37 @@
|
||||
|
||||
import watch = require('watch');
|
||||
import fs = require('fs');
|
||||
|
||||
var value: any;
|
||||
var str: string;
|
||||
var num: number;
|
||||
var bool: boolean;
|
||||
|
||||
var mon: watch.Monitor;
|
||||
var opts: watch.Options = {
|
||||
ignoreDotFiles: bool,
|
||||
filter: value
|
||||
};
|
||||
|
||||
mon.on('foo', () => {
|
||||
|
||||
watch.watchTree('/some_path', (f: any, curr: fs.Stats, prev: fs.Stats) => {
|
||||
});
|
||||
|
||||
watch.watchTree(str, (f: any, curr: fs.Stats, prev: fs.Stats) => {
|
||||
|
||||
watch.watchTree('/home/mikeal', (f, curr, prev) => {
|
||||
if (typeof f === "object" && prev === null && curr === null) {
|
||||
// Finished walking the tree
|
||||
} else if (prev === null) {
|
||||
// f is a new file
|
||||
} else if (curr.nlink === 0) {
|
||||
// f was removed
|
||||
} else {
|
||||
// f was changed
|
||||
}
|
||||
});
|
||||
watch.watchTree(str, opts, (f: any, curr: fs.Stats, prev: fs.Stats) => {
|
||||
|
||||
watch.unwatchTree('/some_path');
|
||||
watch.createMonitor('/home/mikeal', (monitor) => {
|
||||
monitor.files['/home/mikeal/.zshrc']; // Stat object for my zshrc.
|
||||
monitor.on("created", (f, stat) => {
|
||||
// Handle new files
|
||||
});
|
||||
monitor.on("changed", (f, curr, prev) => {
|
||||
// Handle file changes
|
||||
});
|
||||
monitor.on("removed", (f, stat) => {
|
||||
// Handle removed files
|
||||
});
|
||||
monitor.stop(); // Stop watching
|
||||
});
|
||||
watch.unwatchTree(str);
|
||||
watch.createMonitor(str, (monitor: watch.Monitor) => {
|
||||
|
||||
});
|
||||
watch.createMonitor(str, opts, (monitor: watch.Monitor) => {
|
||||
|
||||
watch.createMonitor('/some/path', {
|
||||
ignoreDotFiles: true
|
||||
}, (monitor: watch.Monitor) => {
|
||||
});
|
||||
|
||||
Vendored
+16
-10
@@ -1,6 +1,8 @@
|
||||
// Type definitions for WebAssembly v1 (MVP)
|
||||
// Project: https://github.com/winksaville/test-webassembly-js-ts
|
||||
// Definitions by: 01alchemist <https://twitter.com/01alchemist>, Wink Saville <wink@saville.com>
|
||||
// Definitions by: 01alchemist <https://twitter.com/01alchemist>
|
||||
// Wink Saville <wink@saville.com>
|
||||
// Periklis Tsirakidis <https://github.com/periklis>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
@@ -9,21 +11,25 @@
|
||||
* for more information.
|
||||
*/
|
||||
declare namespace WebAssembly {
|
||||
type Imports = Array<{
|
||||
name: string;
|
||||
kind: string;
|
||||
}>;
|
||||
|
||||
type Exports = Array<{
|
||||
module: string;
|
||||
name: string;
|
||||
kind: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* WebAssembly.Module
|
||||
*/
|
||||
class Module {
|
||||
constructor(bufferSource: ArrayBuffer | Uint8Array);
|
||||
static customSections(module: Module, sectionName: string): ArrayBuffer[];
|
||||
static exports(module: Module): Array<{
|
||||
name: string;
|
||||
kind: string;
|
||||
}>;
|
||||
static imports(module: Module): Array<{
|
||||
module: string;
|
||||
name: string;
|
||||
kind: string;
|
||||
}>;
|
||||
static exports(module: Module): Imports;
|
||||
static imports(module: Module): Exports;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user