mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #1 from DefinitelyTyped/master
Merge Definitelytyped_master to gsipos:master
This commit is contained in:
@@ -1119,6 +1119,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame)
|
||||
* [:link:](simplebar/simplebar.d.ts) [simplebar.js](https://github.com/Grsmto/simplebar) by [Gregor Woiwode](https://github.com/gregonnet)
|
||||
* [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR)
|
||||
* [:link:](simpleStorage/simplestorage.js.d.ts) [simpleStorage](https://github.com/andris9/simpleStorage) by [Áxel Costas Pena](https://github.com/axelcostaspena)
|
||||
* [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u)
|
||||
* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao)
|
||||
* [:link:](sinon-chrome/sinon-chrome.d.ts) [Sinon-Chrome](https://github.com/vitalets/sinon-chrome) by [Tim Perry](https://github.com/pimterry)
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
/// <reference path="./openjscad.d.ts" />
|
||||
|
||||
function test() {
|
||||
|
||||
var gProcessor: OpenJsCad.Processor = null;
|
||||
|
||||
// Show all exceptions to the user:
|
||||
OpenJsCad.AlertUserOfUncaughtExceptions();
|
||||
|
||||
function onload()
|
||||
{
|
||||
gProcessor = new OpenJsCad.Processor(<HTMLDivElement>document.getElementById("viewer"));
|
||||
updateSolid();
|
||||
}
|
||||
|
||||
function updateSolid()
|
||||
{
|
||||
gProcessor.setJsCad((<HTMLTextAreaElement>document.getElementById('code')).value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
// Main entry point; here we construct our solid:
|
||||
var gear = involuteGear(
|
||||
15,
|
||||
10,
|
||||
20,
|
||||
0,
|
||||
5
|
||||
);
|
||||
var centerhole = CSG.cylinder({start: [0,0,-5], end: [0,0,5], radius: 2, resolution: 16});
|
||||
gear = gear.subtract(centerhole);
|
||||
return gear;
|
||||
}
|
||||
|
||||
function involuteGear(numTeeth: number, circularPitch: number, pressureAngle: number, clearance: number, thickness: number)
|
||||
{
|
||||
// default values:
|
||||
if(arguments.length < 3) pressureAngle = 20;
|
||||
if(arguments.length < 4) clearance = 0;
|
||||
if(arguments.length < 4) thickness = 1;
|
||||
|
||||
var addendum = circularPitch / Math.PI;
|
||||
var dedendum = addendum + clearance;
|
||||
|
||||
// radiuses of the 4 circles:
|
||||
var pitchRadius = numTeeth * circularPitch / (2 * Math.PI);
|
||||
var baseRadius = pitchRadius * Math.cos(Math.PI * pressureAngle / 180);
|
||||
var outerRadius = pitchRadius + addendum;
|
||||
var rootRadius = pitchRadius - dedendum;
|
||||
|
||||
var maxtanlength = Math.sqrt(outerRadius*outerRadius - baseRadius*baseRadius);
|
||||
var maxangle = maxtanlength / baseRadius;
|
||||
|
||||
var tl_at_pitchcircle = Math.sqrt(pitchRadius*pitchRadius - baseRadius*baseRadius);
|
||||
var angle_at_pitchcircle = tl_at_pitchcircle / baseRadius;
|
||||
var diffangle = angle_at_pitchcircle - Math.atan(angle_at_pitchcircle);
|
||||
var angularToothWidthAtBase = Math.PI / numTeeth + 2*diffangle;
|
||||
|
||||
// build a single 2d tooth in the 'points' array:
|
||||
var resolution = 5;
|
||||
var points = [new CSG.Vector2D(0,0)];
|
||||
for(var i = 0; i <= resolution; i++)
|
||||
{
|
||||
// first side of the tooth:
|
||||
var angle = maxangle * i / resolution;
|
||||
var tanlength = angle * baseRadius;
|
||||
var radvector = CSG.Vector2D.fromAngle(angle);
|
||||
var tanvector = radvector.normal();
|
||||
var p = radvector.times(baseRadius).plus(tanvector.times(tanlength));
|
||||
points[i+1] = p;
|
||||
|
||||
// opposite side of the tooth:
|
||||
radvector = CSG.Vector2D.fromAngle(angularToothWidthAtBase - angle);
|
||||
tanvector = radvector.normal().negated();
|
||||
p = radvector.times(baseRadius).plus(tanvector.times(tanlength));
|
||||
points[2 * resolution + 2 - i] = p;
|
||||
}
|
||||
|
||||
// create the polygon and extrude into 3D:
|
||||
var tooth3d = new CSG.Polygon2D(points).extrude({offset: [0, 0, thickness]});
|
||||
|
||||
var allteeth = new CSG();
|
||||
for(var i = 0; i < numTeeth; i++)
|
||||
{
|
||||
var angle = i*360/numTeeth;
|
||||
var rotatedtooth = <CSG>tooth3d.rotateZ(angle);
|
||||
allteeth = allteeth.unionForNonIntersecting(rotatedtooth);
|
||||
}
|
||||
|
||||
// build the root circle:
|
||||
points = [];
|
||||
var toothAngle = 2 * Math.PI / numTeeth;
|
||||
var toothCenterAngle = 0.5 * angularToothWidthAtBase;
|
||||
for(var i = 0; i < numTeeth; i++)
|
||||
{
|
||||
var angle = toothCenterAngle + i * toothAngle;
|
||||
var p = CSG.Vector2D.fromAngle(angle).times(rootRadius);
|
||||
points.push(p);
|
||||
}
|
||||
|
||||
// create the polygon and extrude into 3D:
|
||||
var rootcircle = new CSG.Polygon2D(points).extrude({offset: [0, 0, thickness]});
|
||||
|
||||
var result = rootcircle.union(allteeth);
|
||||
|
||||
// center at origin:
|
||||
result = <CSG>result.translate([0, 0, -thickness/2]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
var cylresolution=16;
|
||||
|
||||
|
||||
function main2()
|
||||
{
|
||||
var params =
|
||||
{
|
||||
quality: 0,
|
||||
diameter1: 12.2,
|
||||
shaftlength1: 15,
|
||||
outerlength1: 20,
|
||||
nutradius1: 4.65,
|
||||
nutthickness1: 4.2,
|
||||
screwdiameter1: 5,
|
||||
diameter2: 9.5,
|
||||
shaftlength2: 10,
|
||||
outerlength2: 15,
|
||||
nutradius2: 3.2,
|
||||
nutthickness2: 2.6,
|
||||
screwdiameter2: 3,
|
||||
outerdiameter: 30,
|
||||
spiderlength: 12,
|
||||
spidermargin: 0,
|
||||
numteeth: 2
|
||||
};
|
||||
|
||||
|
||||
cylresolution=(params.quality == 1)? 64:16;
|
||||
|
||||
var outerdiameter=params.outerdiameter;
|
||||
outerdiameter=Math.max(outerdiameter, params.diameter1+0.5);
|
||||
outerdiameter=Math.max(outerdiameter, params.diameter2+0.5);
|
||||
|
||||
var spidercenterdiameter=outerdiameter/2;
|
||||
|
||||
var part1=makeShaft(params.diameter1, outerdiameter,spidercenterdiameter,params.shaftlength1,params.outerlength1,params.spiderlength, params.nutradius1, params.nutthickness1, params.screwdiameter1, params.numteeth);
|
||||
var part2=makeShaft(params.diameter2, outerdiameter,spidercenterdiameter,params.shaftlength2,params.outerlength2,params.spiderlength, params.nutradius2, params.nutthickness2, params.screwdiameter2, params.numteeth);
|
||||
var spider=makeSpider(outerdiameter, spidercenterdiameter, params.spiderlength, params.numteeth);
|
||||
|
||||
if(params.spidermargin > 0)
|
||||
{
|
||||
spider=spider.contract(params.spidermargin, 4);
|
||||
}
|
||||
|
||||
// rotate shaft parts for better 3d printing:
|
||||
part1=<CSG>part1.rotateX(180).translate([0,0,params.outerlength1+params.spiderlength]);
|
||||
part2=<CSG>part2.rotateX(180).translate([0,0,params.outerlength2+params.spiderlength]);
|
||||
|
||||
var result=<CSG>part1.translate([-outerdiameter-5,0,0]);
|
||||
result=result.union(<CSG>part2.translate([0,0,0]));
|
||||
result=result.union(<CSG>spider.translate([outerdiameter+5,0,-params.spidermargin]));
|
||||
return result;
|
||||
}
|
||||
|
||||
function makeShaft(innerdiameter: number, outerdiameter: number, spidercenterdiameter: number, shaftlength: number, outerlength: number, spiderlength: number, nutradius: number, nutthickness: number, screwdiameter: number, numteeth: number)
|
||||
{
|
||||
var result=CSG.cylinder({start:[0,0,0], end:[0,0,outerlength], radius:outerdiameter/2, resolution:cylresolution});
|
||||
|
||||
for(var i=0; i < numteeth; i++)
|
||||
{
|
||||
var angle=i*360/numteeth;
|
||||
var pie=makePie(outerdiameter/2, spiderlength,angle-45/numteeth, angle+45/numteeth);
|
||||
pie=<CSG>pie.translate([0,0,outerlength]);
|
||||
result=result.union(pie);
|
||||
}
|
||||
var spidercylinder=CSG.cylinder({start:[0,0,outerlength], end:[0,0,outerlength+spiderlength],radius:spidercenterdiameter/2,resolution:cylresolution});
|
||||
result=result.subtract(spidercylinder);
|
||||
var shaftcylinder=CSG.cylinder({start:[0,0,0], end:[0,0,shaftlength], radius:innerdiameter/2, resolution:cylresolution});
|
||||
result=result.subtract(shaftcylinder);
|
||||
|
||||
var screwz=shaftlength/2;
|
||||
if(screwz < nutradius) screwz=nutradius;
|
||||
var nutcutout = <CSG>hexagon(nutradius, nutthickness).translate([0,0,-nutthickness/2]);
|
||||
var grubnutradiusAtFlatSide = nutradius * Math.cos(Math.PI / 180 * 30);
|
||||
var nutcutoutrectangle = CSG.cube({
|
||||
radius: [outerlength/2, grubnutradiusAtFlatSide, nutthickness/2],
|
||||
center: [outerlength/2, 0, 0],
|
||||
});
|
||||
nutcutout = nutcutout.union(nutcutoutrectangle);
|
||||
nutcutout = <CSG>nutcutout.rotateY(90);
|
||||
nutcutout = <CSG>nutcutout.translate([(outerdiameter+innerdiameter)/4, 0, screwz]);
|
||||
result = result.subtract(nutcutout);
|
||||
|
||||
var screwcutout=CSG.cylinder({
|
||||
start: [outerdiameter/2, 0, screwz],
|
||||
end: [0, 0, screwz],
|
||||
radius: screwdiameter/2,
|
||||
resolution:cylresolution
|
||||
});
|
||||
result=result.subtract(screwcutout);
|
||||
|
||||
//return nutcutout;
|
||||
// nutcutout = nutcutout.translate([-grubnutheight/2 - centerholeradius - nutdistance,0,0]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function makePie(radius: number, height: number, startangle: number, endangle: number)
|
||||
{
|
||||
var absangle=Math.abs(startangle-endangle);
|
||||
if(absangle >= 180)
|
||||
{
|
||||
throw new Error("Pie angle must be less than 180 degrees");
|
||||
}
|
||||
var numsteps=cylresolution*absangle/360;
|
||||
if(numsteps < 1) numsteps=1;
|
||||
var points: CSG.Vector2D[] = [];
|
||||
for(var i=0; i <= numsteps; i++)
|
||||
{
|
||||
var angle=startangle+i/numsteps*(endangle-startangle);
|
||||
var vec = CSG.Vector2D.fromAngleDegrees(angle).times(radius);
|
||||
points.push(vec);
|
||||
}
|
||||
points.push(new CSG.Vector2D(0,0));
|
||||
var shape2d=new CSG.Polygon2D(points);
|
||||
var extruded=shape2d.extrude({
|
||||
offset: [0,0,height], // direction for extrusion
|
||||
});
|
||||
return extruded;
|
||||
}
|
||||
|
||||
function hexagon(radius: number, height: number)
|
||||
{
|
||||
var vertices: CSG.Vertex[] = [];
|
||||
for(var i=0; i < 6; i++)
|
||||
{
|
||||
var point=CSG.Vector2D.fromAngleDegrees(-i*60).times(radius).toVector3D(0);
|
||||
vertices.push(new CSG.Vertex(point));
|
||||
}
|
||||
var polygon=new CSG.Polygon(vertices);
|
||||
var hexagon=polygon.extrude([0,0,height]);
|
||||
return hexagon;
|
||||
}
|
||||
|
||||
function makeSpider(outerdiameter: number, spidercenterdiameter: number, spiderlength: number, numteeth: number)
|
||||
{
|
||||
var result=new CSG();
|
||||
var numspiderteeth=numteeth*2; // spider has twice the number of teeth
|
||||
for(var i=0; i < numspiderteeth; i++)
|
||||
{
|
||||
var angle=i*360/numspiderteeth;
|
||||
var pie=makePie(outerdiameter/2, spiderlength,angle-90/numspiderteeth, angle+90/numspiderteeth);
|
||||
pie=<CSG>pie.translate([0,0,0]);
|
||||
result=result.union(pie);
|
||||
}
|
||||
|
||||
var centercylinder=CSG.cylinder({start:[0,0,0], end:[0,0,spiderlength], radius:spidercenterdiameter/2, resolution:cylresolution});
|
||||
result=result.union(centercylinder);
|
||||
|
||||
return result;
|
||||
}
|
||||
Vendored
+912
@@ -0,0 +1,912 @@
|
||||
// Type definitions for OpenJsCad.js
|
||||
// Project: https://github.com/joostn/OpenJsCad
|
||||
// Definitions by: Dan Marshall <https://github.com/danmarshall>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
/// <reference path="../threejs/three.d.ts" />
|
||||
|
||||
declare module THREE {
|
||||
var CSG: {
|
||||
fromCSG: (csg: CSG, defaultColor: any) => {
|
||||
colorMesh: Mesh;
|
||||
wireframe: Mesh;
|
||||
boundLen: number;
|
||||
};
|
||||
getGeometryVertex: (geometry: any, vertex_position: any) => number;
|
||||
};
|
||||
function OrbitControls(object: any, domElement: any): void;
|
||||
function SpriteCanvasMaterial(parameters?: any): void;
|
||||
interface ICanvasRendererOptions {
|
||||
canvas?: HTMLCanvasElement;
|
||||
alpha?: boolean;
|
||||
}
|
||||
class CanvasRenderer implements Renderer {
|
||||
domElement: HTMLCanvasElement;
|
||||
private pixelRatio;
|
||||
private autoClear;
|
||||
private sortObjects;
|
||||
private sortElements;
|
||||
private info;
|
||||
private _projector;
|
||||
private _renderData;
|
||||
private _elements;
|
||||
private _lights;
|
||||
private _canvas;
|
||||
private _canvasWidth;
|
||||
private _canvasHeight;
|
||||
private _canvasWidthHalf;
|
||||
private _canvasHeightHalf;
|
||||
private _viewportX;
|
||||
private _viewportY;
|
||||
private _viewportWidth;
|
||||
private _viewportHeight;
|
||||
private _context;
|
||||
private _clearColor;
|
||||
private _clearAlpha;
|
||||
private _contextGlobalAlpha;
|
||||
private _contextGlobalCompositeOperation;
|
||||
private _contextStrokeStyle;
|
||||
private _camera;
|
||||
private _contextFillStyle;
|
||||
private _contextLineWidth;
|
||||
private _contextLineCap;
|
||||
private _contextLineJoin;
|
||||
private _contextLineDash;
|
||||
private _v1;
|
||||
private _v2;
|
||||
private _v3;
|
||||
private _v4;
|
||||
private _v5;
|
||||
private _v6;
|
||||
private _v1x;
|
||||
private _v1y;
|
||||
private _v2x;
|
||||
private _v2y;
|
||||
private _v3x;
|
||||
private _v3y;
|
||||
private _v4x;
|
||||
private _v4y;
|
||||
private _v5x;
|
||||
private _v5y;
|
||||
private _v6x;
|
||||
private _v6y;
|
||||
private _color;
|
||||
private _color1;
|
||||
private _color2;
|
||||
private _color3;
|
||||
private _color4;
|
||||
private _diffuseColor;
|
||||
private _emissiveColor;
|
||||
private _lightColor;
|
||||
private _patterns;
|
||||
private _image;
|
||||
private _uvs;
|
||||
private _uv1x;
|
||||
private _uv1y;
|
||||
private _uv2x;
|
||||
private _uv2y;
|
||||
private _uv3x;
|
||||
private _uv3y;
|
||||
private _clipBox;
|
||||
private _clearBox;
|
||||
private _elemBox;
|
||||
private _ambientLight;
|
||||
private _directionalLights;
|
||||
private _pointLights;
|
||||
private _vector3;
|
||||
private _centroid;
|
||||
private _normal;
|
||||
private _normalViewMatrix;
|
||||
constructor(parameters: ICanvasRendererOptions);
|
||||
supportsVertexTextures(): void;
|
||||
setFaceCulling: () => void;
|
||||
getPixelRatio(): number;
|
||||
setPixelRatio(value: any): void;
|
||||
setSize(width: any, height: any, updateStyle: any): void;
|
||||
setViewport(x: any, y: any, width: any, height: any): void;
|
||||
setScissor(): void;
|
||||
enableScissorTest(): void;
|
||||
setClearColor(color: any, alpha: any): void;
|
||||
setClearColorHex(hex: any, alpha: any): void;
|
||||
getClearColor(): Color;
|
||||
getClearAlpha(): number;
|
||||
getMaxAnisotropy(): number;
|
||||
clear(): void;
|
||||
clearColor(): void;
|
||||
clearDepth(): void;
|
||||
clearStencil(): void;
|
||||
render(scene: Scene, camera: Camera, renderTarget?: RenderTarget, forceClear?: boolean): void;
|
||||
calculateLights(): void;
|
||||
calculateLight(position: any, normal: any, color: any): void;
|
||||
renderSprite(v1: any, element: any, material: any): void;
|
||||
renderLine(v1: any, v2: any, element: any, material: any): void;
|
||||
renderFace3(v1: any, v2: any, v3: any, uv1: any, uv2: any, uv3: any, element: any, material: any): void;
|
||||
drawTriangle(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any): void;
|
||||
strokePath(color: any, linewidth: any, linecap: any, linejoin: any): void;
|
||||
fillPath(color: any): void;
|
||||
onTextureUpdate(event: any): void;
|
||||
textureToPattern(texture: any): void;
|
||||
patternPath(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, u0: any, v0: any, u1: any, v1: any, u2: any, v2: any, texture: any): void;
|
||||
clipImage(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, u0: any, v0: any, u1: any, v1: any, u2: any, v2: any, image: any): void;
|
||||
expand(v1: any, v2: any, pixels: any): void;
|
||||
setOpacity(value: any): void;
|
||||
setBlending(value: any): void;
|
||||
setLineWidth(value: any): void;
|
||||
setLineCap(value: any): void;
|
||||
setLineJoin(value: any): void;
|
||||
setStrokeStyle(value: any): void;
|
||||
setFillStyle(value: any): void;
|
||||
setLineDash(value: any): void;
|
||||
}
|
||||
function RenderableObject(): void;
|
||||
function RenderableFace(): void;
|
||||
function RenderableVertex(): void;
|
||||
function RenderableLine(): void;
|
||||
function RenderableSprite(): void;
|
||||
function Projector(): void;
|
||||
}
|
||||
declare module OpenJsCad {
|
||||
interface ILog {
|
||||
(x: string): void;
|
||||
prevLogTime?: number;
|
||||
}
|
||||
var log: ILog;
|
||||
interface IViewerOptions {
|
||||
drawLines?: boolean;
|
||||
drawFaces?: boolean;
|
||||
color?: number[];
|
||||
bgColor?: number;
|
||||
noWebGL?: boolean;
|
||||
}
|
||||
interface ProcessorOptions extends IViewerOptions {
|
||||
verbose?: boolean;
|
||||
viewerwidth?: number;
|
||||
viewerheight?: number;
|
||||
viewerheightratio?: number;
|
||||
}
|
||||
class Viewer {
|
||||
private perspective;
|
||||
private drawOptions;
|
||||
private size;
|
||||
private defaultColor_;
|
||||
private bgColor_;
|
||||
private containerElm_;
|
||||
private scene_;
|
||||
private camera_;
|
||||
private controls_;
|
||||
private renderer_;
|
||||
private canvas;
|
||||
private pauseRender_;
|
||||
private requestID_;
|
||||
constructor(containerElm: any, size: any, options: IViewerOptions);
|
||||
createScene(drawAxes: any, axLen: any): void;
|
||||
createCamera(): void;
|
||||
createControls(canvas: any): void;
|
||||
webGLAvailable(): boolean;
|
||||
createRenderer(bool_noWebGL: any): void;
|
||||
render(): void;
|
||||
animate(): void;
|
||||
cancelAnimate(): void;
|
||||
refreshRenderer(bool_noWebGL: any): void;
|
||||
drawAxes(axLen: any): void;
|
||||
setCsg(csg: any, resetZoom: any): void;
|
||||
applyDrawOptions(): void;
|
||||
clear(): void;
|
||||
getUserMeshes(str?: any): THREE.Object3D[];
|
||||
resetZoom(r: any): void;
|
||||
parseSizeParams(): void;
|
||||
handleResize(): void;
|
||||
}
|
||||
function makeAbsoluteUrl(url: any, baseurl: any): any;
|
||||
function isChrome(): boolean;
|
||||
function runMainInWorker(mainParameters: any): void;
|
||||
function expandResultObjectArray(result: any): any;
|
||||
function checkResult(result: any): void;
|
||||
function resultToCompactBinary(resultin: any): any;
|
||||
function resultFromCompactBinary(resultin: any): any;
|
||||
function parseJsCadScriptSync(script: any, mainParameters: any, debugging: any): any;
|
||||
function parseJsCadScriptASync(script: any, mainParameters: any, options: any, callback: any): Worker;
|
||||
function getWindowURL(): URL;
|
||||
function textToBlobUrl(txt: any): string;
|
||||
function revokeBlobUrl(url: any): void;
|
||||
function FileSystemApiErrorHandler(fileError: any, operation: any): void;
|
||||
function AlertUserOfUncaughtExceptions(): void;
|
||||
function getParamDefinitions(script: any): any[];
|
||||
interface EventHandler {
|
||||
(ev?: Event): any;
|
||||
}
|
||||
/**
|
||||
* options parameter:
|
||||
* - drawLines: display wireframe lines
|
||||
* - drawFaces: display surfaces
|
||||
* - bgColor: canvas background color
|
||||
* - color: object color
|
||||
* - viewerwidth, viewerheight: set rendering size. Works with any css unit.
|
||||
* viewerheight can also be specified as a ratio to width, ie number e (0, 1]
|
||||
* - noWebGL: force render without webGL
|
||||
* - verbose: show additional info (currently only time used for rendering)
|
||||
*/
|
||||
interface ViewerSize {
|
||||
widthDefault: string;
|
||||
heightDefault: string;
|
||||
width: number;
|
||||
height: number;
|
||||
heightratio: number;
|
||||
}
|
||||
class Processor {
|
||||
private containerdiv;
|
||||
private options;
|
||||
private onchange;
|
||||
private static widthDefault;
|
||||
private static heightDefault;
|
||||
private viewerdiv;
|
||||
private viewer;
|
||||
private viewerSize;
|
||||
private processing;
|
||||
private currentObject;
|
||||
private hasValidCurrentObject;
|
||||
private hasOutputFile;
|
||||
private worker;
|
||||
private paramDefinitions;
|
||||
private paramControls;
|
||||
private script;
|
||||
private hasError;
|
||||
private debugging;
|
||||
private errordiv;
|
||||
private errorpre;
|
||||
private statusdiv;
|
||||
private controldiv;
|
||||
private statusspan;
|
||||
private statusbuttons;
|
||||
private abortbutton;
|
||||
private renderedElementDropdown;
|
||||
private formatDropdown;
|
||||
private generateOutputFileButton;
|
||||
private downloadOutputFileLink;
|
||||
private parametersdiv;
|
||||
private parameterstable;
|
||||
private currentFormat;
|
||||
private filename;
|
||||
private currentObjects;
|
||||
private currentObjectIndex;
|
||||
private isFirstRender_;
|
||||
private outputFileDirEntry;
|
||||
private outputFileBlobUrl;
|
||||
constructor(containerdiv: HTMLDivElement, options?: ProcessorOptions, onchange?: EventHandler);
|
||||
static convertToSolid(obj: any): any;
|
||||
cleanOption(option: any, deflt: any): any;
|
||||
toggleDrawOption(str: any): boolean;
|
||||
setDrawOption(str: any, bool: any): void;
|
||||
handleResize(): void;
|
||||
createElements(): void;
|
||||
getFilenameForRenderedObject(): string;
|
||||
setRenderedObjects(obj: any): void;
|
||||
setSelectedObjectIndex(index: number): void;
|
||||
selectedFormat(): any;
|
||||
selectedFormatInfo(): any;
|
||||
updateDownloadLink(): void;
|
||||
clearViewer(): void;
|
||||
abort(): void;
|
||||
enableItems(): void;
|
||||
setOpenJsCadPath(path: string): void;
|
||||
addLibrary(lib: any): void;
|
||||
setError(txt: string): void;
|
||||
setDebugging(debugging: boolean): void;
|
||||
setJsCad(script: string, filename?: string): void;
|
||||
getParamValues(): {};
|
||||
rebuildSolid(): void;
|
||||
hasSolid(): boolean;
|
||||
isProcessing(): boolean;
|
||||
clearOutputFile(): void;
|
||||
generateOutputFile(): void;
|
||||
currentObjectToBlob(): any;
|
||||
supportedFormatsForCurrentObject(): string[];
|
||||
formatInfo(format: any): any;
|
||||
downloadLinkTextForCurrentObject(): string;
|
||||
generateOutputFileBlobUrl(): void;
|
||||
generateOutputFileFileSystem(): void;
|
||||
createParamControls(): void;
|
||||
}
|
||||
}
|
||||
interface Window {
|
||||
Worker: Worker;
|
||||
// URL: URL;
|
||||
webkitURL: URL;
|
||||
requestFileSystem: any;
|
||||
webkitRequestFileSystem: any;
|
||||
}
|
||||
interface IAMFStringOptions {
|
||||
unit: string;
|
||||
}
|
||||
declare class CxG {
|
||||
toStlString(): string;
|
||||
toStlBinary(): void;
|
||||
toAMFString(AMFStringOptions?: IAMFStringOptions): void;
|
||||
getBounds(): CxG[];
|
||||
transform(matrix4x4: CSG.Matrix4x4): CxG;
|
||||
mirrored(plane: CSG.Plane): CxG;
|
||||
mirroredX(): CxG;
|
||||
mirroredY(): CxG;
|
||||
mirroredZ(): CxG;
|
||||
translate(v: number[]): CxG;
|
||||
translate(v: CSG.Vector3D): CxG;
|
||||
scale(f: CSG.Vector3D): CxG;
|
||||
rotateX(deg: number): CxG;
|
||||
rotateY(deg: number): CxG;
|
||||
rotateZ(deg: number): CxG;
|
||||
rotate(rotationCenter: CSG.Vector3D, rotationAxis: CSG.Vector3D, degrees: number): CxG;
|
||||
rotateEulerAngles(alpha: number, beta: number, gamma: number, position: number[]): CxG;
|
||||
}
|
||||
interface ICenter {
|
||||
center(cAxes: string[]): CxG;
|
||||
}
|
||||
declare class CSG extends CxG implements ICenter {
|
||||
polygons: CSG.Polygon[];
|
||||
properties: CSG.Properties;
|
||||
isCanonicalized: boolean;
|
||||
isRetesselated: boolean;
|
||||
cachedBoundingBox: CSG.Vector3D[];
|
||||
static defaultResolution2D: number;
|
||||
static defaultResolution3D: number;
|
||||
static fromPolygons(polygons: CSG.Polygon[]): CSG;
|
||||
static fromSlices(options: any): CSG;
|
||||
static fromObject(obj: any): CSG;
|
||||
static fromCompactBinary(bin: any): CSG;
|
||||
toPolygons(): CSG.Polygon[];
|
||||
union(csg: CSG[]): CSG;
|
||||
union(csg: CSG): CSG;
|
||||
unionSub(csg: CSG, retesselate?: boolean, canonicalize?: boolean): CSG;
|
||||
unionForNonIntersecting(csg: CSG): CSG;
|
||||
subtract(csg: CSG[]): CSG;
|
||||
subtract(csg: CSG): CSG;
|
||||
subtractSub(csg: CSG, retesselate: boolean, canonicalize: boolean): CSG;
|
||||
intersect(csg: CSG[]): CSG;
|
||||
intersect(csg: CSG): CSG;
|
||||
intersectSub(csg: CSG, retesselate?: boolean, canonicalize?: boolean): CSG;
|
||||
invert(): CSG;
|
||||
transform1(matrix4x4: CSG.Matrix4x4): CSG;
|
||||
transform(matrix4x4: CSG.Matrix4x4): CSG;
|
||||
toString(): string;
|
||||
expand(radius: number, resolution: number): CSG;
|
||||
contract(radius: number, resolution: number): CSG;
|
||||
stretchAtPlane(normal: number[], point: number[], length: number): CSG;
|
||||
expandedShell(radius: number, resolution: number, unionWithThis: boolean): CSG;
|
||||
canonicalized(): CSG;
|
||||
reTesselated(): CSG;
|
||||
getBounds(): CSG.Vector3D[];
|
||||
mayOverlap(csg: CSG): boolean;
|
||||
cutByPlane(plane: CSG.Plane): CSG;
|
||||
connectTo(myConnector: CSG.Connector, otherConnector: CSG.Connector, mirror: boolean, normalrotation: number): CSG;
|
||||
setShared(shared: CSG.Polygon.Shared): CSG;
|
||||
setColor(args: any): CSG;
|
||||
toCompactBinary(): {
|
||||
"class": string;
|
||||
numPolygons: number;
|
||||
numVerticesPerPolygon: Uint32Array;
|
||||
polygonPlaneIndexes: Uint32Array;
|
||||
polygonSharedIndexes: Uint32Array;
|
||||
polygonVertices: Uint32Array;
|
||||
vertexData: Float64Array;
|
||||
planeData: Float64Array;
|
||||
shared: CSG.Polygon.Shared[];
|
||||
};
|
||||
toPointCloud(cuberadius: any): CSG;
|
||||
getTransformationAndInverseTransformationToFlatLying(): any;
|
||||
getTransformationToFlatLying(): any;
|
||||
lieFlat(): CSG;
|
||||
projectToOrthoNormalBasis(orthobasis: CSG.OrthoNormalBasis): CAG;
|
||||
sectionCut(orthobasis: CSG.OrthoNormalBasis): CAG;
|
||||
fixTJunctions(): CSG;
|
||||
toTriangles(): any[];
|
||||
getFeatures(features: any): any;
|
||||
center(cAxes: string[]): CxG;
|
||||
toX3D(): Blob;
|
||||
toStlBinary(): Blob;
|
||||
toStlString(): string;
|
||||
toAMFString(m: IAMFStringOptions): Blob;
|
||||
}
|
||||
declare module CSG {
|
||||
function fnNumberSort(a: any, b: any): number;
|
||||
function parseOption(options: any, optionname: any, defaultvalue: any): any;
|
||||
function parseOptionAs3DVector(options: any, optionname: any, defaultvalue: any): Vector3D;
|
||||
function parseOptionAs3DVectorList(options: any, optionname: any, defaultvalue: any): any;
|
||||
function parseOptionAs2DVector(options: any, optionname: any, defaultvalue: any): any;
|
||||
function parseOptionAsFloat(options: any, optionname: any, defaultvalue: any): any;
|
||||
function parseOptionAsInt(options: any, optionname: any, defaultvalue: any): any;
|
||||
function parseOptionAsBool(options: any, optionname: any, defaultvalue: any): any;
|
||||
function cube(options: any): CSG;
|
||||
function sphere(options: any): CSG;
|
||||
function cylinder(options: any): CSG;
|
||||
function roundedCylinder(options: any): CSG;
|
||||
function roundedCube(options: any): CSG;
|
||||
/**
|
||||
* polyhedron accepts openscad style arguments. I.e. define face vertices clockwise looking from outside
|
||||
*/
|
||||
function polyhedron(options: any): CSG;
|
||||
function IsFloat(n: any): boolean;
|
||||
function solve2Linear(a: any, b: any, c: any, d: any, u: any, v: any): number[];
|
||||
class Vector3D extends CxG {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
constructor(v3: Vector3D);
|
||||
constructor(v2: Vector2D);
|
||||
constructor(v2: number[]);
|
||||
constructor(x: number, y: number);
|
||||
constructor(x: number, y: number, z: number);
|
||||
static Create(x: number, y: number, z: number): Vector3D;
|
||||
clone(): Vector3D;
|
||||
negated(): Vector3D;
|
||||
abs(): Vector3D;
|
||||
plus(a: Vector3D): Vector3D;
|
||||
minus(a: Vector3D): Vector3D;
|
||||
times(a: number): Vector3D;
|
||||
dividedBy(a: number): Vector3D;
|
||||
dot(a: Vector3D): number;
|
||||
lerp(a: Vector3D, t: number): Vector3D;
|
||||
lengthSquared(): number;
|
||||
length(): number;
|
||||
unit(): Vector3D;
|
||||
cross(a: Vector3D): Vector3D;
|
||||
distanceTo(a: Vector3D): number;
|
||||
distanceToSquared(a: Vector3D): number;
|
||||
equals(a: Vector3D): boolean;
|
||||
multiply4x4(matrix4x4: Matrix4x4): Vector3D;
|
||||
transform(matrix4x4: Matrix4x4): Vector3D;
|
||||
toString(): string;
|
||||
randomNonParallelVector(): Vector3D;
|
||||
min(p: Vector3D): Vector3D;
|
||||
max(p: Vector3D): Vector3D;
|
||||
toStlString(): string;
|
||||
toAMFString(): string;
|
||||
}
|
||||
class Vertex extends CxG {
|
||||
pos: Vector3D;
|
||||
tag: number;
|
||||
constructor(pos: Vector3D);
|
||||
static fromObject(obj: any): Vertex;
|
||||
flipped(): Vertex;
|
||||
getTag(): number;
|
||||
interpolate(other: Vertex, t: number): Vertex;
|
||||
transform(matrix4x4: Matrix4x4): Vertex;
|
||||
toString(): string;
|
||||
toStlString(): string;
|
||||
toAMFString(): string;
|
||||
}
|
||||
class Plane extends CxG {
|
||||
normal: Vector3D;
|
||||
w: number;
|
||||
tag: number;
|
||||
constructor(normal: Vector3D, w: number);
|
||||
static fromObject(obj: any): Plane;
|
||||
static EPSILON: number;
|
||||
static fromVector3Ds(a: Vector3D, b: Vector3D, c: Vector3D): Plane;
|
||||
static anyPlaneFromVector3Ds(a: Vector3D, b: Vector3D, c: Vector3D): Plane;
|
||||
static fromPoints(a: Vector3D, b: Vector3D, c: Vector3D): Plane;
|
||||
static fromNormalAndPoint(normal: Vector3D, point: Vector3D): Plane;
|
||||
static fromNormalAndPoint(normal: number[], point: number[]): Plane;
|
||||
flipped(): Plane;
|
||||
getTag(): number;
|
||||
equals(n: Plane): boolean;
|
||||
transform(matrix4x4: Matrix4x4): Plane;
|
||||
splitPolygon(polygon: Polygon): {
|
||||
type: any;
|
||||
front: any;
|
||||
back: any;
|
||||
};
|
||||
splitLineBetweenPoints(p1: Vector3D, p2: Vector3D): Vector3D;
|
||||
intersectWithLine(line3d: Line3D): Vector3D;
|
||||
intersectWithPlane(plane: Plane): Line3D;
|
||||
signedDistanceToPoint(point: Vector3D): number;
|
||||
toString(): string;
|
||||
mirrorPoint(point3d: Vector3D): Vector3D;
|
||||
}
|
||||
class Polygon extends CxG {
|
||||
vertices: Vertex[];
|
||||
shared: Polygon.Shared;
|
||||
plane: Plane;
|
||||
cachedBoundingSphere: any;
|
||||
cachedBoundingBox: Vector3D[];
|
||||
static defaultShared: CSG.Polygon.Shared;
|
||||
constructor(vertices: Vector3D, shared?: Polygon.Shared, plane?: Plane);
|
||||
constructor(vertices: Vertex[], shared?: Polygon.Shared, plane?: Plane);
|
||||
static fromObject(obj: any): Polygon;
|
||||
checkIfConvex(): void;
|
||||
setColor(args: any): Polygon;
|
||||
getSignedVolume(): number;
|
||||
getArea(): number;
|
||||
getTetraFeatures(features: any): any[];
|
||||
extrude(offsetvector: any): CSG;
|
||||
boundingSphere(): any;
|
||||
boundingBox(): Vector3D[];
|
||||
flipped(): Polygon;
|
||||
transform(matrix4x4: Matrix4x4): Polygon;
|
||||
toString(): string;
|
||||
projectToOrthoNormalBasis(orthobasis: OrthoNormalBasis): CAG;
|
||||
/**
|
||||
* Creates solid from slices (CSG.Polygon) by generating walls
|
||||
* @param {Object} options Solid generating options
|
||||
* - numslices {Number} Number of slices to be generated
|
||||
* - callback(t, slice) {Function} Callback function generating slices.
|
||||
* arguments: t = [0..1], slice = [0..numslices - 1]
|
||||
* return: CSG.Polygon or null to skip
|
||||
* - loop {Boolean} no flats, only walls, it's used to generate solids like a tor
|
||||
*/
|
||||
solidFromSlices(options: any): CSG;
|
||||
/**
|
||||
*
|
||||
* @param walls Array of wall polygons
|
||||
* @param bottom Bottom polygon
|
||||
* @param top Top polygon
|
||||
*/
|
||||
private _addWalls(walls, bottom, top, bFlipped);
|
||||
static verticesConvex(vertices: Vertex[], planenormal: any): boolean;
|
||||
static createFromPoints(points: number[][], shared?: CSG.Polygon.Shared, plane?: Plane): Polygon;
|
||||
static isConvexPoint(prevpoint: any, point: any, nextpoint: any, normal: any): boolean;
|
||||
static isStrictlyConvexPoint(prevpoint: any, point: any, nextpoint: any, normal: any): boolean;
|
||||
toStlString(): string;
|
||||
}
|
||||
}
|
||||
declare module CSG.Polygon {
|
||||
class Shared {
|
||||
color: any;
|
||||
tag: any;
|
||||
constructor(color: any);
|
||||
static fromObject(obj: any): Shared;
|
||||
static fromColor(args: any): Shared;
|
||||
getTag(): any;
|
||||
getHash(): any;
|
||||
}
|
||||
}
|
||||
declare module CSG {
|
||||
class PolygonTreeNode {
|
||||
parent: any;
|
||||
children: any;
|
||||
polygon: Polygon;
|
||||
removed: boolean;
|
||||
constructor();
|
||||
addPolygons(polygons: any): void;
|
||||
remove(): void;
|
||||
isRemoved(): boolean;
|
||||
isRootNode(): boolean;
|
||||
invert(): void;
|
||||
getPolygon(): Polygon;
|
||||
getPolygons(result: Polygon[]): void;
|
||||
splitByPlane(plane: any, coplanarfrontnodes: any, coplanarbacknodes: any, frontnodes: any, backnodes: any): void;
|
||||
_splitByPlane(plane: any, coplanarfrontnodes: any, coplanarbacknodes: any, frontnodes: any, backnodes: any): void;
|
||||
addChild(polygon: Polygon): PolygonTreeNode;
|
||||
invertSub(): void;
|
||||
recursivelyInvalidatePolygon(): void;
|
||||
}
|
||||
class Tree {
|
||||
polygonTree: PolygonTreeNode;
|
||||
rootnode: Node;
|
||||
constructor(polygons: Polygon[]);
|
||||
invert(): void;
|
||||
clipTo(tree: Tree, alsoRemovecoplanarFront?: boolean): void;
|
||||
allPolygons(): Polygon[];
|
||||
addPolygons(polygons: Polygon[]): void;
|
||||
}
|
||||
class Node {
|
||||
parent: Node;
|
||||
plane: Plane;
|
||||
front: any;
|
||||
back: any;
|
||||
polygontreenodes: PolygonTreeNode[];
|
||||
constructor(parent: Node);
|
||||
invert(): void;
|
||||
clipPolygons(polygontreenodes: PolygonTreeNode[], alsoRemovecoplanarFront: boolean): void;
|
||||
clipTo(tree: Tree, alsoRemovecoplanarFront: boolean): void;
|
||||
addPolygonTreeNodes(polygontreenodes: PolygonTreeNode[]): void;
|
||||
getParentPlaneNormals(normals: Vector3D[], maxdepth: number): void;
|
||||
}
|
||||
class Matrix4x4 {
|
||||
elements: number[];
|
||||
constructor(elements?: number[]);
|
||||
plus(m: Matrix4x4): Matrix4x4;
|
||||
minus(m: Matrix4x4): Matrix4x4;
|
||||
multiply(m: Matrix4x4): Matrix4x4;
|
||||
clone(): Matrix4x4;
|
||||
rightMultiply1x3Vector(v: Vector3D): Vector3D;
|
||||
leftMultiply1x3Vector(v: Vector3D): Vector3D;
|
||||
rightMultiply1x2Vector(v: Vector2D): Vector2D;
|
||||
leftMultiply1x2Vector(v: Vector2D): Vector2D;
|
||||
isMirroring(): boolean;
|
||||
static unity(): Matrix4x4;
|
||||
static rotationX(degrees: number): Matrix4x4;
|
||||
static rotationY(degrees: number): Matrix4x4;
|
||||
static rotationZ(degrees: number): Matrix4x4;
|
||||
static rotation(rotationCenter: CSG.Vector3D, rotationAxis: CSG.Vector3D, degrees: number): Matrix4x4;
|
||||
static translation(v: number[]): Matrix4x4;
|
||||
static translation(v: Vector3D): Matrix4x4;
|
||||
static mirroring(plane: Plane): Matrix4x4;
|
||||
static scaling(v: number[]): Matrix4x4;
|
||||
static scaling(v: Vector3D): Matrix4x4;
|
||||
}
|
||||
class Vector2D extends CxG {
|
||||
x: number;
|
||||
y: number;
|
||||
constructor(x: number, y: number);
|
||||
constructor(x: number[]);
|
||||
constructor(x: Vector2D);
|
||||
static fromAngle(radians: number): Vector2D;
|
||||
static fromAngleDegrees(degrees: number): Vector2D;
|
||||
static fromAngleRadians(radians: number): Vector2D;
|
||||
static Create(x: number, y: number): Vector2D;
|
||||
toVector3D(z: number): Vector3D;
|
||||
equals(a: Vector2D): boolean;
|
||||
clone(): Vector2D;
|
||||
negated(): Vector2D;
|
||||
plus(a: Vector2D): Vector2D;
|
||||
minus(a: Vector2D): Vector2D;
|
||||
times(a: number): Vector2D;
|
||||
dividedBy(a: number): Vector2D;
|
||||
dot(a: Vector2D): number;
|
||||
lerp(a: Vector2D, t: number): Vector2D;
|
||||
length(): number;
|
||||
distanceTo(a: Vector2D): number;
|
||||
distanceToSquared(a: Vector2D): number;
|
||||
lengthSquared(): number;
|
||||
unit(): Vector2D;
|
||||
cross(a: Vector2D): number;
|
||||
normal(): Vector2D;
|
||||
multiply4x4(matrix4x4: Matrix4x4): Vector2D;
|
||||
transform(matrix4x4: Matrix4x4): Vector2D;
|
||||
angle(): number;
|
||||
angleDegrees(): number;
|
||||
angleRadians(): number;
|
||||
min(p: Vector2D): Vector2D;
|
||||
max(p: Vector2D): Vector2D;
|
||||
toString(): string;
|
||||
abs(): Vector2D;
|
||||
}
|
||||
class Line2D extends CxG {
|
||||
normal: Vector2D;
|
||||
w: number;
|
||||
constructor(normal: Vector2D, w: number);
|
||||
static fromPoints(p1: Vector2D, p2: Vector2D): Line2D;
|
||||
reverse(): Line2D;
|
||||
equals(l: Line2D): boolean;
|
||||
origin(): Vector2D;
|
||||
direction(): Vector2D;
|
||||
xAtY(y: number): number;
|
||||
absDistanceToPoint(point: Vector2D): number;
|
||||
intersectWithLine(line2d: Line2D): Vector2D;
|
||||
transform(matrix4x4: Matrix4x4): Line2D;
|
||||
}
|
||||
class Line3D extends CxG {
|
||||
point: Vector3D;
|
||||
direction: Vector3D;
|
||||
constructor(point: Vector3D, direction: Vector3D);
|
||||
static fromPoints(p1: Vector3D, p2: Vector3D): Line3D;
|
||||
static fromPlanes(p1: Plane, p2: Plane): Line3D;
|
||||
intersectWithPlane(plane: Plane): Vector3D;
|
||||
clone(): Line3D;
|
||||
reverse(): Line3D;
|
||||
transform(matrix4x4: Matrix4x4): Line3D;
|
||||
closestPointOnLine(point: Vector3D): Vector3D;
|
||||
distanceToPoint(point: Vector3D): number;
|
||||
equals(line3d: Line3D): boolean;
|
||||
}
|
||||
class OrthoNormalBasis extends CxG {
|
||||
v: Vector3D;
|
||||
u: Vector3D;
|
||||
plane: Plane;
|
||||
planeorigin: Vector3D;
|
||||
constructor(plane: Plane, rightvector?: Vector3D);
|
||||
static GetCartesian(xaxisid: string, yaxisid: string): OrthoNormalBasis;
|
||||
static Z0Plane(): OrthoNormalBasis;
|
||||
getProjectionMatrix(): Matrix4x4;
|
||||
getInverseProjectionMatrix(): Matrix4x4;
|
||||
to2D(vec3: Vector3D): Vector2D;
|
||||
to3D(vec2: Vector2D): Vector3D;
|
||||
line3Dto2D(line3d: Line3D): Line2D;
|
||||
line2Dto3D(line2d: Line2D): Line3D;
|
||||
transform(matrix4x4: Matrix4x4): OrthoNormalBasis;
|
||||
}
|
||||
function interpolateBetween2DPointsForY(point1: Vector2D, point2: Vector2D, y: number): number;
|
||||
function reTesselateCoplanarPolygons(sourcepolygons: CSG.Polygon[], destpolygons: CSG.Polygon[]): void;
|
||||
class fuzzyFactory {
|
||||
multiplier: number;
|
||||
lookuptable: any;
|
||||
constructor(numdimensions: number, tolerance: number);
|
||||
lookupOrCreate(els: any, creatorCallback: any): any;
|
||||
}
|
||||
class fuzzyCSGFactory {
|
||||
vertexfactory: fuzzyFactory;
|
||||
planefactory: fuzzyFactory;
|
||||
polygonsharedfactory: any;
|
||||
constructor();
|
||||
getPolygonShared(sourceshared: Polygon.Shared): Polygon.Shared;
|
||||
getVertex(sourcevertex: Vertex): Vertex;
|
||||
getPlane(sourceplane: Plane): Plane;
|
||||
getPolygon(sourcepolygon: Polygon): Polygon;
|
||||
getCSG(sourcecsg: CSG): CSG;
|
||||
}
|
||||
var staticTag: number;
|
||||
function getTag(): number;
|
||||
class Properties {
|
||||
cube: Properties;
|
||||
center: any;
|
||||
facecenters: any[];
|
||||
roundedCube: Properties;
|
||||
cylinder: Properties;
|
||||
start: any;
|
||||
end: any;
|
||||
facepointH: any;
|
||||
facepointH90: any;
|
||||
sphere: Properties;
|
||||
facepoint: any;
|
||||
roundedCylinder: any;
|
||||
_transform(matrix4x4: Matrix4x4): Properties;
|
||||
_merge(otherproperties: Properties): Properties;
|
||||
static transformObj(source: any, result: any, matrix4x4: Matrix4x4): void;
|
||||
static cloneObj(source: any, result: any): void;
|
||||
static addFrom(result: any, otherproperties: Properties): void;
|
||||
}
|
||||
class Connector extends CxG {
|
||||
point: Vector3D;
|
||||
axisvector: Vector3D;
|
||||
normalvector: Vector3D;
|
||||
constructor(point: number[], axisvector: Vector3D, normalvector: number[]);
|
||||
constructor(point: number[], axisvector: number[], normalvector: number[]);
|
||||
constructor(point: number[], axisvector: number[], normalvector: Vector3D);
|
||||
constructor(point: Vector3D, axisvector: number[], normalvector: Vector3D);
|
||||
constructor(point: Vector3D, axisvector: number[], normalvector: number[]);
|
||||
constructor(point: Vector3D, axisvector: Vector3D, normalvector: Vector3D);
|
||||
normalized(): Connector;
|
||||
transform(matrix4x4: Matrix4x4): Connector;
|
||||
getTransformationTo(other: Connector, mirror: boolean, normalrotation: number): Matrix4x4;
|
||||
axisLine(): Line3D;
|
||||
extend(distance: number): Connector;
|
||||
}
|
||||
class ConnectorList {
|
||||
connectors_: Connector[];
|
||||
closed: boolean;
|
||||
constructor(connectors: Connector[]);
|
||||
static defaultNormal: number[];
|
||||
static fromPath2D(path2D: CSG.Path2D, arg1: any, arg2: any): ConnectorList;
|
||||
static _fromPath2DTangents(path2D: any, start: any, end: any): ConnectorList;
|
||||
static _fromPath2DExplicit(path2D: any, angleIsh: any): ConnectorList;
|
||||
setClosed(bool: boolean): void;
|
||||
appendConnector(conn: Connector): void;
|
||||
followWith(cagish: any): CSG;
|
||||
verify(): void;
|
||||
}
|
||||
interface IRadiusOptions {
|
||||
radius?: number;
|
||||
resolution?: number;
|
||||
}
|
||||
interface ICircleOptions extends IRadiusOptions {
|
||||
center?: Vector2D | number[];
|
||||
}
|
||||
interface IArcOptions extends ICircleOptions {
|
||||
startangle?: number;
|
||||
endangle?: number;
|
||||
maketangent?: boolean;
|
||||
}
|
||||
interface IEllpiticalArcOptions extends IRadiusOptions {
|
||||
clockwise?: boolean;
|
||||
large?: boolean;
|
||||
xaxisrotation?: number;
|
||||
xradius?: number;
|
||||
yradius?: number;
|
||||
}
|
||||
interface IRectangleOptions {
|
||||
center?: Vector2D;
|
||||
corner1?: Vector2D;
|
||||
corner2?: Vector2D;
|
||||
radius?: Vector2D;
|
||||
}
|
||||
interface IRoundRectangleOptions {
|
||||
roundradius: number;
|
||||
resolution?: number;
|
||||
}
|
||||
class Path2D extends CxG {
|
||||
closed: boolean;
|
||||
points: Vector2D[];
|
||||
lastBezierControlPoint: Vector2D;
|
||||
constructor(points: number[], closed?: boolean);
|
||||
constructor(points: Vector2D[], closed?: boolean);
|
||||
static arc(options: IArcOptions): Path2D;
|
||||
concat(otherpath: Path2D): Path2D;
|
||||
appendPoint(point: Vector2D): Path2D;
|
||||
appendPoints(points: Vector2D[]): Path2D;
|
||||
close(): Path2D;
|
||||
rectangularExtrude(width: number, height: number, resolution: number): CSG;
|
||||
expandToCAG(pathradius: number, resolution: number): CAG;
|
||||
innerToCAG(): CAG;
|
||||
transform(matrix4x4: Matrix4x4): Path2D;
|
||||
appendBezier(controlpoints: any, options: any): Path2D;
|
||||
appendArc(endpoint: Vector2D, options: IEllpiticalArcOptions): Path2D;
|
||||
}
|
||||
}
|
||||
declare class CAG extends CxG implements ICenter {
|
||||
sides: CAG.Side[];
|
||||
isCanonicalized: boolean;
|
||||
constructor();
|
||||
static fromSides(sides: CAG.Side[]): CAG;
|
||||
static fromPoints(points: CSG.Vector2D[]): CAG;
|
||||
static fromPointsNoCheck(points: CSG.Vector2D[]): CAG;
|
||||
static fromFakeCSG(csg: CSG): CAG;
|
||||
static linesIntersect(p0start: CSG.Vector2D, p0end: CSG.Vector2D, p1start: CSG.Vector2D, p1end: CSG.Vector2D): boolean;
|
||||
static circle(options: CSG.ICircleOptions): CAG;
|
||||
static rectangle(options: CSG.IRectangleOptions): CAG;
|
||||
static roundedRectangle(options: any): CAG;
|
||||
static fromCompactBinary(bin: any): CAG;
|
||||
toString(): string;
|
||||
_toCSGWall(z0: any, z1: any): CSG;
|
||||
_toVector3DPairs(m: CSG.Matrix4x4): CSG.Vector3D[][];
|
||||
_toPlanePolygons(options: any): CSG.Polygon[];
|
||||
_toWallPolygons(options: any): any[];
|
||||
union(cag: CAG[]): CAG;
|
||||
union(cag: CAG): CAG;
|
||||
subtract(cag: CAG[]): CAG;
|
||||
subtract(cag: CAG): CAG;
|
||||
intersect(cag: CAG[]): CAG;
|
||||
intersect(cag: CAG): CAG;
|
||||
transform(matrix4x4: CSG.Matrix4x4): CAG;
|
||||
area(): number;
|
||||
flipped(): CAG;
|
||||
getBounds(): CSG.Vector2D[];
|
||||
isSelfIntersecting(): boolean;
|
||||
expandedShell(radius: number, resolution: number): CAG;
|
||||
expand(radius: number, resolution: number): CAG;
|
||||
contract(radius: number, resolution: number): CAG;
|
||||
extrudeInOrthonormalBasis(orthonormalbasis: CSG.OrthoNormalBasis, depth: number, options?: any): CSG;
|
||||
extrudeInPlane(axis1: any, axis2: any, depth: any, options: any): CSG;
|
||||
extrude(options: CAG_extrude_options): CSG;
|
||||
rotateExtrude(options: any): CSG;
|
||||
check(): void;
|
||||
canonicalized(): CAG;
|
||||
toCompactBinary(): {
|
||||
'class': string;
|
||||
sideVertexIndices: Uint32Array;
|
||||
vertexData: Float64Array;
|
||||
};
|
||||
getOutlinePaths(): CSG.Path2D[];
|
||||
overCutInsideCorners(cutterradius: any): CAG;
|
||||
center(cAxes: string[]): CxG;
|
||||
toDxf(): Blob;
|
||||
static PathsToDxf(paths: CSG.Path2D[]): Blob;
|
||||
}
|
||||
declare module CAG {
|
||||
class Vertex {
|
||||
pos: CSG.Vector2D;
|
||||
tag: number;
|
||||
constructor(pos: CSG.Vector2D);
|
||||
toString(): string;
|
||||
getTag(): number;
|
||||
}
|
||||
class Side extends CxG {
|
||||
vertex0: Vertex;
|
||||
vertex1: Vertex;
|
||||
tag: number;
|
||||
constructor(vertex0: Vertex, vertex1: Vertex);
|
||||
static _fromFakePolygon(polygon: CSG.Polygon): Side;
|
||||
toString(): string;
|
||||
toPolygon3D(z0: any, z1: any): CSG.Polygon;
|
||||
transform(matrix4x4: CSG.Matrix4x4): Side;
|
||||
flipped(): Side;
|
||||
direction(): CSG.Vector2D;
|
||||
getTag(): number;
|
||||
lengthSquared(): number;
|
||||
length(): number;
|
||||
}
|
||||
class fuzzyCAGFactory {
|
||||
vertexfactory: CSG.fuzzyFactory;
|
||||
constructor();
|
||||
getVertex(sourcevertex: Vertex): Vertex;
|
||||
getSide(sourceside: Side): Side;
|
||||
getCAG(sourcecag: CAG): CAG;
|
||||
}
|
||||
}
|
||||
interface CAG_extrude_options {
|
||||
offset?: number[];
|
||||
twistangle?: number;
|
||||
twiststeps?: number;
|
||||
}
|
||||
declare module CSG {
|
||||
class Polygon2D extends CAG {
|
||||
constructor(points: Vector2D[]);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
/// <reference path="amqplib.d.ts" />
|
||||
|
||||
// promise api tests
|
||||
import amqp = require("amqplib");
|
||||
|
||||
var msg = "Hello World";
|
||||
|
||||
// test promise api
|
||||
amqp.connect("amqp://localhost")
|
||||
.then(connection => {
|
||||
return connection.createChannel()
|
||||
@@ -19,3 +21,47 @@ amqp.connect("amqp://localhost")
|
||||
.then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())))
|
||||
.ensure(() => connection.close());
|
||||
});
|
||||
|
||||
// test promise api properties
|
||||
var amqpMessage: amqp.Message;
|
||||
amqpMessage.properties.contentType = "application/json";
|
||||
var amqpAssertExchangeOptions: amqp.Options.AssertExchange;
|
||||
var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
|
||||
|
||||
|
||||
// callback api tests
|
||||
import amqpcb = require("amqplib/callback_api");
|
||||
|
||||
amqpcb.connect("amqp://localhost", (err, connection) => {
|
||||
if(!err) {
|
||||
connection.createChannel((err, channel) => {
|
||||
if (!err) {
|
||||
channel.assertQueue("myQueue", {}, (err, ok) => {
|
||||
if(!err) {
|
||||
channel.sendToQueue("myQueue", new Buffer(msg));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
amqpcb.connect("amqp://localhost", (err, connection) => {
|
||||
if(!err) {
|
||||
connection.createChannel((err, channel) => {
|
||||
if (!err) {
|
||||
channel.assertQueue("myQueue", {}, (err, ok) => {
|
||||
if(!err) {
|
||||
channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// test callback api properties
|
||||
var amqpcbMessage: amqpcb.Message;
|
||||
amqpcbMessage.properties.contentType = "application/json";
|
||||
var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
|
||||
var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
|
||||
Vendored
+91
-17
@@ -1,22 +1,12 @@
|
||||
// Type definitions for amqplib 0.3.x
|
||||
// Project: https://github.com/squaremo/amqp.node
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>
|
||||
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../when/when.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "amqplib" {
|
||||
|
||||
import events = require("events");
|
||||
import when = require("when");
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
close(): when.Promise<void>;
|
||||
createChannel(): when.Promise<Channel>;
|
||||
createConfirmChannel(): when.Promise<Channel>;
|
||||
}
|
||||
|
||||
declare module "amqplib/properties" {
|
||||
module Replies {
|
||||
interface Empty {
|
||||
}
|
||||
@@ -25,6 +15,9 @@ declare module "amqplib" {
|
||||
messageCount: number;
|
||||
consumerCount: number;
|
||||
}
|
||||
interface PurgeQueue {
|
||||
messageCount: number;
|
||||
}
|
||||
interface DeleteQueue {
|
||||
messageCount: number;
|
||||
}
|
||||
@@ -73,7 +66,7 @@ declare module "amqplib" {
|
||||
|
||||
contentType?: string;
|
||||
contentEncoding?: string;
|
||||
headers?: Object;
|
||||
headers?: any;
|
||||
priority?: number;
|
||||
correlationId?: string;
|
||||
replyTo?: string;
|
||||
@@ -88,7 +81,7 @@ declare module "amqplib" {
|
||||
noAck?: boolean;
|
||||
exclusive?: boolean;
|
||||
priority?: number;
|
||||
arguments?: Object;
|
||||
arguments?: any;
|
||||
}
|
||||
interface Get {
|
||||
noAck?: boolean;
|
||||
@@ -97,8 +90,24 @@ declare module "amqplib" {
|
||||
|
||||
interface Message {
|
||||
content: Buffer;
|
||||
fields: Object;
|
||||
properties: Object;
|
||||
fields: any;
|
||||
properties: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "amqplib" {
|
||||
|
||||
import events = require("events");
|
||||
import when = require("when");
|
||||
import shared = require("amqplib/properties")
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
close(): when.Promise<void>;
|
||||
createChannel(): when.Promise<Channel>;
|
||||
createConfirmChannel(): when.Promise<Channel>;
|
||||
}
|
||||
|
||||
interface Channel extends events.EventEmitter {
|
||||
@@ -108,7 +117,7 @@ declare module "amqplib" {
|
||||
checkQueue(queue: string): when.Promise<Replies.AssertQueue>;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise<Replies.DeleteQueue>;
|
||||
purgeQueue(queue: string): when.Promise<Replies.DeleteQueue>;
|
||||
purgeQueue(queue: string): when.Promise<Replies.PurgeQueue>;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
|
||||
@@ -142,3 +151,68 @@ declare module "amqplib" {
|
||||
|
||||
function connect(url: string, socketOptions?: any): when.Promise<Connection>;
|
||||
}
|
||||
|
||||
declare module "amqplib/callback_api" {
|
||||
|
||||
import events = require("events");
|
||||
import shared = require("amqplib/properties")
|
||||
export import Replies = shared.Replies;
|
||||
export import Options = shared.Options;
|
||||
export import Message = shared.Message;
|
||||
|
||||
interface Connection extends events.EventEmitter {
|
||||
close(callback?: (err: any) => void): void;
|
||||
createChannel(callback: (err: any, channel: Channel) => void): void;
|
||||
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
|
||||
}
|
||||
|
||||
interface Channel extends events.EventEmitter {
|
||||
close(callback: (err: any) => void): void;
|
||||
|
||||
assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void;
|
||||
checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void;
|
||||
|
||||
deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void;
|
||||
purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void;
|
||||
|
||||
bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void;
|
||||
checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
|
||||
|
||||
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
|
||||
|
||||
cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void;
|
||||
|
||||
ack(message: Message, allUpTo?: boolean): void;
|
||||
ackAll(): void;
|
||||
|
||||
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
|
||||
nackAll(requeue?: boolean): void;
|
||||
reject(message: Message, requeue?: boolean): void;
|
||||
|
||||
prefetch(count: number, global?: boolean): void;
|
||||
recover(callback?: (err: any, ok: Replies.Empty) => void): void;
|
||||
}
|
||||
|
||||
interface ConfirmChannel extends Channel {
|
||||
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
|
||||
sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
|
||||
|
||||
waitForConfirms(callback?: (err: any) => void): void;
|
||||
}
|
||||
|
||||
function connect(callback: (err: any, connection: Connection) => void): void;
|
||||
function connect(url: string, callback: (err: any, connection: Connection) => void): void;
|
||||
function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="angular-dialog-service.d.ts" />
|
||||
|
||||
|
||||
var options : angular.dialogservice.IDialogOptions = {};
|
||||
options.animation = true;
|
||||
options.backdrop = true;
|
||||
options.keyboard = true;
|
||||
options.backdropClass = "some-css-class";
|
||||
options.windowClass = "some-css-class";
|
||||
options.size = 'md';
|
||||
|
||||
var dialogs : angular.dialogservice.IDialogService;
|
||||
dialogs.error('Error','An unknown error occurred preventing the completion of the requested action.');
|
||||
dialogs.wait('Creating User','Please wait while we attempt to create user "Michael Conroy."<br><br>This should only take a moment.',50);
|
||||
dialogs.notify('Something Happened','Something happened at this point in the application that I wish to let you know about');
|
||||
dialogs.create('url/to/a/template','ctrlrToUse',{},{});
|
||||
@@ -0,0 +1,82 @@
|
||||
// Type definitions for Angular Dialog Service 5.2.8
|
||||
// Project: https://github.com/m-e-conroy/angular-dialog-service
|
||||
// Definitions by: William Comartin <https://github.com/wcomartin>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts"/>
|
||||
/// <reference path="../angular-ui-bootstrap/angular-ui-bootstrap.d.ts"/>
|
||||
|
||||
declare module angular.dialogservice {
|
||||
|
||||
interface IDialogOptions {
|
||||
/**
|
||||
* Set to false to disable animations on new modal/backdrop. Does not toggle animations for modals/backdrops that are already displayed.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
animation?: boolean;
|
||||
|
||||
/**
|
||||
* controls the presence of a backdrop
|
||||
* Allowed values:
|
||||
* - true (default)
|
||||
* - false (no backdrop)
|
||||
* - 'static' backdrop is present but modal window is not closed when clicking outside of the modal window
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
backdrop?: boolean | string;
|
||||
|
||||
/**
|
||||
* indicates whether the dialog should be closable by hitting the ESC key
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* additional CSS class(es) to be added to a modal backdrop template
|
||||
*
|
||||
* @default 'dialogs-backdrop-default'
|
||||
*/
|
||||
backdropClass?: string;
|
||||
|
||||
/**
|
||||
* additional CSS class(es) to be added to a modal window template
|
||||
*
|
||||
* @default 'dialogs-default'
|
||||
*/
|
||||
windowClass?: string;
|
||||
|
||||
/**
|
||||
* Optional suffix of modal window class. The value used is appended to the `modal-` class, i.e. a value of `sm` gives `modal-sm`.
|
||||
*
|
||||
* @default 'lg'
|
||||
*/
|
||||
size?: string;
|
||||
}
|
||||
|
||||
interface IDialogService {
|
||||
/**
|
||||
* Opens a new error modal instance.
|
||||
*/
|
||||
error(header: string, msg: string, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance
|
||||
/**
|
||||
* Opens a new wait modal instance.
|
||||
*/
|
||||
wait(header: string, msg: string, progress: number, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance
|
||||
/**
|
||||
* Opens a new notify modal instance.
|
||||
*/
|
||||
notify(header: string, msg: string, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance
|
||||
/**
|
||||
* Opens a new confirm modal instance.
|
||||
*/
|
||||
confirm(header: string, msg: string, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance
|
||||
/**
|
||||
* Opens a new custom modal instance.
|
||||
*/
|
||||
create(url: string, ctrlr: string, data: any, opts?: IDialogOptions): ng.ui.bootstrap.IModalServiceInstance
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+13
-1
@@ -297,6 +297,18 @@ declare module AngularFormly {
|
||||
bound?: any;
|
||||
expression?: any;
|
||||
value?: any;
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This allows you to place attributes with string values on the ng-model element.
|
||||
* Easy to use alternative to ngModelAttrs option.
|
||||
*
|
||||
* see http://docs.angular-formly.com/docs/field-configuration-object#ngmodelelattrs-object
|
||||
*/
|
||||
ngModelElAttrs?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -571,4 +583,4 @@ declare module AngularFormly {
|
||||
messages: { [key: string]: ($viewValue: any, $modelValue: any, scope: ITemplateScope) => string };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/// <reference path="./angular-httpi.d.ts" />
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
var app = angular.module("Demo", ["httpi"]);
|
||||
// -------------------------------------------------- //
|
||||
// -------------------------------------------------- //
|
||||
// I control the main demo.
|
||||
app.controller(
|
||||
"DemoController",
|
||||
function($scope: ng.IScope, httpi: Httpi.HttpiFactory) {
|
||||
|
||||
console.warn("None of the API endpoints exist - they will all throw 404.");
|
||||
// NOTE: The (.|.) notation will be stripped out automatically; it's only
|
||||
// here to improve readability of the "happy paths" for interpolation
|
||||
// labels. The following urls are pre-processed to be identical:
|
||||
// --
|
||||
// api/friends/( :listCommand | :id/:itemCommand )
|
||||
// api/friends/:listCommand:id/:itemCommand
|
||||
var resource = httpi.resource("api/friends/( :listCommand | :id/:itemCommand )");
|
||||
// Clear list of friends - matching listCommand.
|
||||
resource.post({
|
||||
data: {
|
||||
listCommand: "reset"
|
||||
}
|
||||
});
|
||||
// Create a new friend - no matching URL parameters.
|
||||
resource.post({
|
||||
data: {
|
||||
name: "Tricia"
|
||||
}
|
||||
});
|
||||
// Get a given friend - ID matching.
|
||||
resource.get({
|
||||
data: {
|
||||
id: 4
|
||||
}
|
||||
});
|
||||
// Make best friend - ID, itemCommand matching.
|
||||
resource.post({
|
||||
data: {
|
||||
id: 4,
|
||||
itemCommand: "make-best-friend"
|
||||
}
|
||||
});
|
||||
// Get gets friends - no matching URL parameters.
|
||||
resource.get({
|
||||
params: {
|
||||
limit: "besties"
|
||||
}
|
||||
});
|
||||
// Get a friend as a JSONP request.
|
||||
// --
|
||||
// NOTE: The "resource" will auto-inject the "JSON_CALLBACK" marker that
|
||||
// AngularJS will automatically replace with an internal callback name.
|
||||
resource.jsonp({
|
||||
data: {
|
||||
id: 43
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
})();
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for angular-httpi
|
||||
// Project: https://github.com/bennadel/httpi
|
||||
// Definitions by: Andrew Camilleri <https://github.com/Kukks>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module Httpi {
|
||||
export interface HttpiPayload extends ng.IRequestShortcutConfig {
|
||||
method?: string;
|
||||
url?: string;
|
||||
params?: {};
|
||||
data?: {};
|
||||
keepTrailingSlash?: boolean;
|
||||
}
|
||||
|
||||
export interface HttpiFactory {
|
||||
|
||||
(config: HttpiPayload): ng.IHttpPromise<{}>;
|
||||
|
||||
resource(url: string): HttpiResource;
|
||||
}
|
||||
|
||||
export class HttpiResource {
|
||||
|
||||
constructor(http: ng.IHttpService, url: string);
|
||||
|
||||
delete<T>(config: HttpiPayload): ng.IHttpPromise<T>;
|
||||
|
||||
get<T>(config: HttpiPayload): ng.IHttpPromise<T>;
|
||||
|
||||
head<T>(config: HttpiPayload): ng.IHttpPromise<T>;
|
||||
|
||||
jsonp<T>(config: HttpiPayload): ng.IHttpPromise<T>;
|
||||
|
||||
post<T>(config: HttpiPayload): ng.IHttpPromise<T>;
|
||||
|
||||
put<T>(config: HttpiPayload): ng.IHttpPromise<T>;
|
||||
|
||||
setKeepTrailingSlash(newKeepTrailingSlash: boolean): HttpiResource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="angular-modal.d.ts" />
|
||||
|
||||
var btfModal: angularModal.AngularModalFactory;
|
||||
|
||||
// Using template URL
|
||||
function withTemplateUrl() {
|
||||
btfModal({
|
||||
controller: 'SomeController',
|
||||
controllerAs: 'vm',
|
||||
templateUrl: 'some-template.html'
|
||||
});
|
||||
}
|
||||
|
||||
// Using template
|
||||
function withTemplate() {
|
||||
btfModal({
|
||||
controller: 'SomeController',
|
||||
controllerAs: 'vm',
|
||||
template: '<div></div>'
|
||||
});
|
||||
}
|
||||
|
||||
// Using controller function
|
||||
function withControllerAsFunction() {
|
||||
btfModal({
|
||||
controller: function () {},
|
||||
template: '<div></div>'
|
||||
})
|
||||
}
|
||||
|
||||
// Using constructor function
|
||||
function withControllerClass() {
|
||||
class TestController {
|
||||
constructor(dependency1:any, dependency2:any) {}
|
||||
}
|
||||
btfModal({
|
||||
controller: TestController,
|
||||
template: '<div></div>'
|
||||
});
|
||||
}
|
||||
|
||||
// With container as selector
|
||||
function withContainerAsString() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: '.container'
|
||||
});
|
||||
}
|
||||
|
||||
// With container as jQuery element
|
||||
function withContainerAsJquery() {
|
||||
var container: JQuery = $('body');
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as DOM Element
|
||||
function withContainerAsDom() {
|
||||
var container: Element = document.getElementById('container');
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as DOM Element Array
|
||||
function withContainerAsDomArray() {
|
||||
var container: Element[] = [document.getElementById('container'), document.getElementById('container2')];
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: container
|
||||
});
|
||||
}
|
||||
|
||||
// With container as function
|
||||
function withContainerAsFunction() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: function() {}
|
||||
});
|
||||
}
|
||||
|
||||
// With container as array
|
||||
function withContainerAsArray() {
|
||||
btfModal({
|
||||
template: '<div></div>',
|
||||
container: ['1', 2]
|
||||
});
|
||||
}
|
||||
|
||||
// Calling return values
|
||||
function callingValues() {
|
||||
var modal: angularModal.AngularModal = btfModal({
|
||||
template: '<div></div>'
|
||||
});
|
||||
modal.activate().then(() => {}, () => {});
|
||||
modal.deactivate().then(() => {}, () => {});
|
||||
var isActive: boolean = modal.active();
|
||||
}
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for angular-modal 0.5.0
|
||||
// Project: https://github.com/btford/angular-modal
|
||||
// Definitions by: Paul Lessing <https://github.com/paullessing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module angularModal {
|
||||
|
||||
type AngularModalControllerDefinition = (new (...args: any[]) => any) | Function | string; // Possible arguments to IControllerService
|
||||
|
||||
type AngularModalJQuerySelector = string | Element | Element[] | JQuery | Function | any[] | {}; // Possible arguments to IAugmentedJQueryStatic
|
||||
|
||||
interface AngularModalSettings {
|
||||
controller?: AngularModalControllerDefinition;
|
||||
controllerAs?: string;
|
||||
container?: AngularModalJQuerySelector;
|
||||
}
|
||||
|
||||
export interface AngularModalSettingsWithTemplate extends AngularModalSettings {
|
||||
template: any;
|
||||
}
|
||||
|
||||
export interface AngularModalSettingsWithTemplateUrl extends AngularModalSettings {
|
||||
templateUrl: string;
|
||||
}
|
||||
|
||||
export interface AngularModal {
|
||||
activate(): angular.IPromise<void>;
|
||||
deactivate(): angular.IPromise<void>;
|
||||
active(): boolean;
|
||||
}
|
||||
|
||||
export interface AngularModalFactory {
|
||||
(settings: AngularModalSettingsWithTemplate | AngularModalSettingsWithTemplateUrl): AngularModal;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -235,10 +235,10 @@ declare module angular.ui {
|
||||
*/
|
||||
go(to: string, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
go(to: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): ng.IPromise<any>;
|
||||
transitionTo(state: IState, params?: {}, updateLocation?: boolean): ng.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): ng.IPromise<any>;
|
||||
transitionTo(state: IState, params?: {}, options?: IStateOptions): ng.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): angular.IPromise<any>;
|
||||
transitionTo(state: IState, params?: {}, updateLocation?: boolean): angular.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
transitionTo(state: IState, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
is(state:string, params?: {}): boolean;
|
||||
is(state: IState, params?: {}): boolean;
|
||||
@@ -250,10 +250,10 @@ declare module angular.ui {
|
||||
current: IState;
|
||||
/** A param object, e.g. {sectionId: section.id)}, that you'd like to test against the current active state. */
|
||||
params: IStateParamsService;
|
||||
reload(): ng.IPromise<any>;
|
||||
reload(): angular.IPromise<any>;
|
||||
|
||||
/** Currently pending transition. A promise that'll resolve or reject. */
|
||||
transition: ng.IPromise<{}>;
|
||||
transition: angular.IPromise<{}>;
|
||||
|
||||
$current: IResolvedState;
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa
|
||||
|
||||
**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces.
|
||||
|
||||
Bellow is an example of how to use the interfaces:
|
||||
Below is an example of how to use the interfaces:
|
||||
```ts
|
||||
function MainController($scope: ng.IScope, $http: ng.IHttpService) {
|
||||
// code assistance will now be available for $scope and $http
|
||||
|
||||
Vendored
+1
-1
@@ -121,7 +121,7 @@ declare module angular.animate {
|
||||
}
|
||||
|
||||
/**
|
||||
* AngularProvider
|
||||
* AnimateProvider
|
||||
* see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider
|
||||
*/
|
||||
interface IAnimateProvider {
|
||||
|
||||
@@ -8,11 +8,24 @@ interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource>
|
||||
///////////////////////////////////////
|
||||
var actionDescriptor: angular.resource.IActionDescriptor;
|
||||
|
||||
actionDescriptor.url = '/api/test-url/'
|
||||
actionDescriptor.headers = { header: 'value' };
|
||||
actionDescriptor.isArray = true;
|
||||
actionDescriptor.method = 'method action';
|
||||
actionDescriptor.params = { key: 'value' };
|
||||
angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactoryService, $timeout: angular.ITimeoutService) {
|
||||
actionDescriptor.method = 'method action';
|
||||
actionDescriptor.params = { key: 'value' };
|
||||
actionDescriptor.url = '/api/test-url/';
|
||||
actionDescriptor.isArray = true;
|
||||
actionDescriptor.transformRequest = function () { };
|
||||
actionDescriptor.transformRequest = [function () { }];
|
||||
actionDescriptor.transformResponse = function () { };
|
||||
actionDescriptor.transformResponse = [function () { }];
|
||||
actionDescriptor.headers = { header: 'value' };
|
||||
actionDescriptor.cache = true;
|
||||
actionDescriptor.cache = $cacheFactory('cacheId');
|
||||
actionDescriptor.timeout = 1000;
|
||||
actionDescriptor.timeout = $timeout(function () { });
|
||||
actionDescriptor.withCredentials = true;
|
||||
actionDescriptor.responseType = 'response type';
|
||||
actionDescriptor.interceptor = { key: 'value' };
|
||||
});
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
|
||||
Vendored
+9
-2
@@ -46,11 +46,18 @@ declare module angular.resource {
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
interface IActionDescriptor {
|
||||
url?: string;
|
||||
method: string;
|
||||
isArray?: boolean;
|
||||
params?: any;
|
||||
url?: string;
|
||||
isArray?: boolean;
|
||||
transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[];
|
||||
transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[];
|
||||
headers?: any;
|
||||
cache?: boolean | angular.ICacheObject;
|
||||
timeout?: number | angular.IPromise<any>;
|
||||
withCredentials?: boolean;
|
||||
responseType?: string;
|
||||
interceptor?: any;
|
||||
}
|
||||
|
||||
// Baseclass for everyresource with default actions.
|
||||
|
||||
Vendored
+5
-4
@@ -620,7 +620,7 @@ declare module angular {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularProvider
|
||||
// AnimateProvider
|
||||
// see http://docs.angularjs.org/api/ng/provider/$animateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateProvider {
|
||||
@@ -774,7 +774,7 @@ declare module angular {
|
||||
* @param reverse Reverse the order of the array.
|
||||
* @return Reverse the order of the array.
|
||||
*/
|
||||
<T>(array: T[], expression: string|string[]|((value: T) => any)|((value: T) => any)[], reverse?: boolean): T[];
|
||||
<T>(array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1390,7 +1390,7 @@ declare module angular {
|
||||
}
|
||||
|
||||
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
|
||||
interface IHttpResquestTransformer {
|
||||
interface IHttpRequestTransformer {
|
||||
(data: any, headersGetter: IHttpHeadersGetter): any;
|
||||
}
|
||||
|
||||
@@ -1427,7 +1427,7 @@ declare module angular {
|
||||
* headers and returns its transformed (typically serialized) version.
|
||||
* @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses}
|
||||
*/
|
||||
transformRequest?: IHttpResquestTransformer |IHttpResquestTransformer[];
|
||||
transformRequest?: IHttpRequestTransformer |IHttpRequestTransformer[];
|
||||
|
||||
/**
|
||||
* Transform function or an array of such functions. The transform function takes the http response body and
|
||||
@@ -1660,6 +1660,7 @@ declare module angular {
|
||||
restrict?: string;
|
||||
scope?: any;
|
||||
template?: any;
|
||||
templateNamespace?: string;
|
||||
templateUrl?: any;
|
||||
terminal?: boolean;
|
||||
transclude?: any;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/// Type definitions for Angular JS 1.0 (ngCookies module)
|
||||
// Type definitions for Angular JS 1.0 (ngCookies module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular Scenario Testing 1.0 (ngScenario module)
|
||||
// Project: [http://angularjs.org]
|
||||
// Definitions by: [RomanoLindano]
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: RomanoLindano <https://github.com/RomanoLindano>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module angularScenario {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
/// <reference path="anydb-sql-migrations" />
|
||||
import anydbsql = require('anydb-sql');
|
||||
import { Table, Column } from 'anydb-sql'
|
||||
import migrator = require('anydb-sql-migrations');
|
||||
|
||||
function do_not_run() {
|
||||
|
||||
var db = anydbsql({
|
||||
url: 'postgres://user:pass@host:port/database',
|
||||
connections: { min: 2, max: 20 }
|
||||
});
|
||||
|
||||
migrator
|
||||
.create(db, '/path/to/migrations/dir')
|
||||
.run();
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for anydb-sql-migrations
|
||||
// Project: https://github.com/spion/anydb-sql-migrations
|
||||
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../anydb-sql/anydb-sql.d.ts" />
|
||||
|
||||
declare module "anydb-sql-migrations" {
|
||||
import Promise = require('bluebird');
|
||||
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
|
||||
export interface Migration {
|
||||
version: string;
|
||||
}
|
||||
export interface MigrationsTable extends Table<Migration> {
|
||||
version: Column<string>;
|
||||
}
|
||||
export interface MigFn {
|
||||
(tx: Transaction): Promise<any>;
|
||||
}
|
||||
export interface MigrationTask {
|
||||
up: MigFn;
|
||||
down: MigFn;
|
||||
name: string;
|
||||
}
|
||||
export function create(db: AnydbSql, tasks: any): {
|
||||
run: () => Promise<any>;
|
||||
migrateTo: (target?: string) => Promise<any>;
|
||||
check: (f: (m: {
|
||||
type: string;
|
||||
items: MigrationTask[];
|
||||
}) => any) => Promise<any>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path="anydb-sql.d.ts" />
|
||||
import anydbsql = require('anydb-sql');
|
||||
import { Table, Column } from 'anydb-sql'
|
||||
|
||||
function do_not_run() {
|
||||
|
||||
var db = anydbsql({
|
||||
url: 'postgres://user:pass@host:port/database',
|
||||
connections: { min: 2, max: 20 }
|
||||
});
|
||||
|
||||
// Table Post
|
||||
|
||||
interface Post {
|
||||
content: string;
|
||||
userId: string;
|
||||
date: string;
|
||||
}
|
||||
|
||||
interface PostTable extends Table<Post> {
|
||||
content: Column<string>;
|
||||
userId: Column<string>;
|
||||
date: Column<string>;
|
||||
}
|
||||
|
||||
var post = <PostTable>db.define<Post>({
|
||||
name: 'posts',
|
||||
columns: {
|
||||
content: {},
|
||||
userId: {},
|
||||
date: {}
|
||||
}
|
||||
});
|
||||
|
||||
// Table User
|
||||
|
||||
interface User {
|
||||
id: string;
|
||||
email: string;
|
||||
password: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface UserTable extends Table<User> {
|
||||
id: Column<string>;
|
||||
email: Column<string>;
|
||||
password: Column<string>;
|
||||
name: Column<string>;
|
||||
}
|
||||
|
||||
var user = <UserTable>db.define<User>({
|
||||
name: 'users',
|
||||
columns: {
|
||||
id: { primaryKey: true },
|
||||
email: {},
|
||||
password: {},
|
||||
name: {},
|
||||
date: {}
|
||||
},
|
||||
has: {
|
||||
posts: { from: 'posts', many: true },
|
||||
group: { from: 'groups'}
|
||||
}
|
||||
});
|
||||
|
||||
user.select(user.name, post.content)
|
||||
.from(user.join(post).on(user.id.equals(post.userId)))
|
||||
.where(post.date.gt('123'))
|
||||
.all()
|
||||
}
|
||||
Vendored
+194
@@ -0,0 +1,194 @@
|
||||
// Type definitions for anydb-sql
|
||||
// Project: https://github.com/doxout/anydb-sql
|
||||
// Definitions by: Gorgi Kosev <https://github.com/spion>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
declare module "anydb-sql" {
|
||||
import Promise = require('bluebird');
|
||||
|
||||
interface AnyDBPool extends anydbSQL.DatabaseConnection {
|
||||
query:(text:string, values:any[], callback:(err:Error, result:any)=>void)=>void
|
||||
begin:()=>anydbSQL.Transaction
|
||||
close:(err:Error)=>void
|
||||
}
|
||||
|
||||
interface Dictionary<T> { [key:string]:T; }
|
||||
|
||||
module anydbSQL {
|
||||
export interface OrderByValueNode {}
|
||||
export interface ColumnDefinition {
|
||||
primaryKey?:boolean;
|
||||
dataType?:string;
|
||||
references?: {table:string; column: string}
|
||||
notNull?:boolean
|
||||
}
|
||||
|
||||
export interface TableDefinition {
|
||||
name:string
|
||||
columns:Dictionary<ColumnDefinition>
|
||||
has?:Dictionary<{from:string; many?:boolean}>
|
||||
}
|
||||
|
||||
|
||||
export interface QueryLike {
|
||||
query:string;
|
||||
values: any[]
|
||||
text:string
|
||||
}
|
||||
export interface DatabaseConnection {
|
||||
queryAsync<T>(query:string, ...params:any[]):Promise<{rowCount:number;rows:T[]}>
|
||||
queryAsync<T>(query:QueryLike):Promise<{rowCount:number;rows:T[]}>
|
||||
}
|
||||
|
||||
export interface Transaction extends DatabaseConnection {
|
||||
rollback():void
|
||||
commitAsync():Promise<void>
|
||||
}
|
||||
|
||||
export interface SubQuery<T> {
|
||||
select(node:Column<T>):SubQuery<T>
|
||||
where(...nodes:any[]):SubQuery<T>
|
||||
from(table:TableNode):SubQuery<T>
|
||||
group(...nodes:any[]):SubQuery<T>
|
||||
order(criteria:OrderByValueNode):SubQuery<T>
|
||||
notExists(subQuery:SubQuery<any>):SubQuery<T>
|
||||
}
|
||||
|
||||
interface Executable<T> {
|
||||
get():Promise<T>
|
||||
getWithin(tx:DatabaseConnection):Promise<T>
|
||||
exec():Promise<void>
|
||||
all():Promise<T[]>
|
||||
execWithin(tx:DatabaseConnection):Promise<void>
|
||||
allWithin(tx:DatabaseConnection):Promise<T[]>
|
||||
toQuery():QueryLike;
|
||||
}
|
||||
|
||||
interface Queryable<T> {
|
||||
where(...nodes:any[]):Query<T>
|
||||
delete():ModifyingQuery
|
||||
select<U>(...nodes:any[]):Query<U>
|
||||
selectDeep<U>(table: Table<T>): Query<T>
|
||||
selectDeep<U>(...nodesOrTables:any[]):Query<U>
|
||||
}
|
||||
|
||||
export interface Query<T> extends Executable<T>, Queryable<T> {
|
||||
from(table:TableNode):Query<T>
|
||||
update(o:Dictionary<any>):ModifyingQuery
|
||||
update(o:{}):ModifyingQuery
|
||||
group(...nodes:any[]):Query<T>
|
||||
order(...criteria:OrderByValueNode[]):Query<T>
|
||||
limit(l:number):Query<T>
|
||||
offset(o:number):Query<T>
|
||||
}
|
||||
|
||||
export interface ModifyingQuery extends Executable<void> {
|
||||
returning<U>(...nodes:any[]):Query<U>
|
||||
where(...nodes:any[]):ModifyingQuery
|
||||
}
|
||||
|
||||
export interface TableNode {
|
||||
join(table:TableNode):JoinTableNode
|
||||
leftJoin(table:TableNode):JoinTableNode
|
||||
}
|
||||
|
||||
export interface JoinTableNode extends TableNode {
|
||||
on(filter:BinaryNode):TableNode
|
||||
on(filter:string):TableNode
|
||||
}
|
||||
|
||||
interface CreateQuery extends Executable<void> {
|
||||
ifNotExists():Executable<void>
|
||||
}
|
||||
interface DropQuery extends Executable<void> {
|
||||
ifExists():Executable<void>
|
||||
}
|
||||
export interface Table<T> extends TableNode, Queryable<T> {
|
||||
create():CreateQuery
|
||||
drop():DropQuery
|
||||
as(name:string):Table<T>
|
||||
update(o:any):ModifyingQuery
|
||||
insert(row:T):ModifyingQuery
|
||||
insert(rows:T[]):ModifyingQuery
|
||||
select():Query<T>
|
||||
select<U>(...nodes:any[]):Query<U>
|
||||
from<U>(table:TableNode):Query<U>
|
||||
star():Column<any>
|
||||
subQuery<U>():SubQuery<U>
|
||||
eventEmitter:{emit:(type:string, ...args:any[])=>void
|
||||
on:(eventName:string, handler:Function)=>void}
|
||||
columns:Column<any>[]
|
||||
sql: SQL;
|
||||
alter():AlterQuery<T>
|
||||
}
|
||||
export interface AlterQuery<T> extends Executable<void> {
|
||||
addColumn(column:Column<any>): AlterQuery<T>;
|
||||
addColumn(name: string, options:string): AlterQuery<T>;
|
||||
dropColumn(column: Column<any>): AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newColumn: Column<any>):AlterQuery<T>;
|
||||
renameColumn(column: Column<any>, newName: string):AlterQuery<T>;
|
||||
renameColumn(name: string, newName: string):AlterQuery<T>;
|
||||
rename(newName: string): AlterQuery<T>
|
||||
}
|
||||
|
||||
export interface SQL {
|
||||
functions: {
|
||||
LOWER(c:Column<string>):Column<string>
|
||||
}
|
||||
}
|
||||
|
||||
export interface BinaryNode {
|
||||
and(node:BinaryNode):BinaryNode
|
||||
or(node:BinaryNode):BinaryNode
|
||||
}
|
||||
|
||||
export interface Column<T> {
|
||||
in(arr:T[]):BinaryNode
|
||||
in(subQuery:SubQuery<T>):BinaryNode
|
||||
notIn(arr:T[]):BinaryNode
|
||||
equals(node:any):BinaryNode
|
||||
notEquals(node:any):BinaryNode
|
||||
gte(node:any):BinaryNode
|
||||
lte(node:any):BinaryNode
|
||||
gt(node:any):BinaryNode
|
||||
lt(node:any):BinaryNode
|
||||
like(str:string):BinaryNode
|
||||
multiply:{
|
||||
(node:Column<T>):Column<T>
|
||||
(n:number):Column<number>
|
||||
}
|
||||
isNull():BinaryNode
|
||||
isNotNull():BinaryNode
|
||||
sum():Column<number>
|
||||
count():Column<number>
|
||||
count(name:string):Column<number>
|
||||
distinct():Column<T>
|
||||
as(name:string):Column<T>
|
||||
ascending:OrderByValueNode
|
||||
descending:OrderByValueNode
|
||||
asc:OrderByValueNode
|
||||
desc:OrderByValueNode
|
||||
}
|
||||
|
||||
export interface AnydbSql extends DatabaseConnection {
|
||||
define<T>(map:TableDefinition):Table<T>;
|
||||
transaction<T>(fn:(tx:Transaction)=>Promise<T>):Promise<T>
|
||||
allOf(...tables:Table<any>[]):any
|
||||
models:Dictionary<Table<any>>
|
||||
functions:{LOWER:(name:Column<string>)=>Column<string>
|
||||
RTRIM:(name:Column<string>)=>Column<string>}
|
||||
makeFunction(name:string):Function
|
||||
begin():Transaction
|
||||
open():void;
|
||||
close():void;
|
||||
getPool():AnyDBPool;
|
||||
dialect():string;
|
||||
}
|
||||
}
|
||||
|
||||
function anydbSQL(config:Object):anydbSQL.AnydbSql;
|
||||
|
||||
export = anydbSQL;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ appInsights.client.trackEvent("custom event", {customProperty: "custom property
|
||||
appInsights.client.trackException(new Error("handled exceptions can be logged with this method"));
|
||||
appInsights.client.trackMetric("custom metric", 3);
|
||||
appInsights.client.trackTrace("trace message");
|
||||
appInsights.client.trackDependency("dependency name", "commandName", 500, true);
|
||||
|
||||
// assign common properties to all telemetry
|
||||
appInsights.client.commonProperties = {
|
||||
|
||||
+14
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Application Insights v0.15.1
|
||||
// Type definitions for Application Insights v0.15.7
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-node.js
|
||||
// Definitions by: Scott Southwood <https://github.com/scsouthw/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -342,6 +342,19 @@ interface Client {
|
||||
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
/**
|
||||
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
|
||||
* @param name The name of the dependency (i.e. "myDatabse")
|
||||
* @param commandname The name of the command executed on the dependency
|
||||
* @param elapsedTimeMs The amount of time in ms that the dependency took to return the result
|
||||
* @param success True if the dependency succeeded, false otherwise
|
||||
* @param dependencyTypeName The type of the dependency (i.e. "SQL" "HTTP"). Defaults to empty.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param dependencyKind ContractsModule.DependencyKind of this dependency. Defaults to Other.
|
||||
* @param async True if the dependency was executed asynchronously, false otherwise. Defaults to false
|
||||
* @param dependencySource ContractsModule.DependencySourceType of this dependency. Defaults to Undefined.
|
||||
*/
|
||||
trackDependency(name: string, commandName: string, elapsedTimeMs: number, success: boolean, dependencyTypeName?: string, properties?: {}, dependencyKind?: any, async?: boolean, dependencySource?: number): void;
|
||||
/**
|
||||
* Immediately send all queued telemetry.
|
||||
*/
|
||||
|
||||
Vendored
+3
-2
@@ -16,12 +16,13 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "archiver" {
|
||||
import * as FS from 'fs';
|
||||
import * as STREAM from 'stream';
|
||||
|
||||
interface nameInterface {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Archiver {
|
||||
interface Archiver extends STREAM.Transform {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(readStream: FS.ReadStream, name: nameInterface): void;
|
||||
finalize(): void;
|
||||
@@ -38,4 +39,4 @@ declare module "archiver" {
|
||||
}
|
||||
|
||||
export = archiver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="./assertsharp.d.ts" />
|
||||
|
||||
import Assert from "assertsharp";
|
||||
|
||||
Assert.AreEqual(0, 0, "Pass");
|
||||
Assert.AreNotEqual(0, 1, "Pass");
|
||||
Assert.AreNotSame(new Date(), new Date(), "Pass");
|
||||
Assert.AreSequenceEqual([0], [0], (x, y) => x === y, "Pass");
|
||||
Assert.Fail("Should fail");
|
||||
Assert.IsFalse(false, "Pass");
|
||||
Assert.IsInstanceOfType(new Date(), Date, "Pass");
|
||||
Assert.IsNotInstanceOfType(true, Date, "Pass");
|
||||
Assert.IsNotNull(new Date(), "Pass");
|
||||
Assert.IsNull(null, "Pass");
|
||||
Assert.IsTrue(true, "Pass");
|
||||
Assert.Throws(() => { throw ""; }, "Pass");
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for assertsharp
|
||||
// Project: https://www.npmjs.com/package/assertsharp
|
||||
// Definitions by: Bruno Leonardo Michels <https://github.com/brunolm>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "assertsharp" {
|
||||
export default class Assert {
|
||||
static AreEqual<T>(expected: T, actual: T, message?: string): void;
|
||||
static AreNotEqual<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreNotSame<T>(notExpected: T, actual: T, message?: string): void;
|
||||
static AreSequenceEqual<T>(expected: T[], actual: T[], equals?: (x: any, y: any) => boolean, message?: string): void;
|
||||
static Fail(message?: string): void;
|
||||
static IsFalse(actual: boolean, message?: string): void;
|
||||
static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void;
|
||||
static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void;
|
||||
static IsNotNull(actual: any, message?: string): void;
|
||||
static IsNull(actual: any, message?: string): void;
|
||||
static IsTrue(actual: boolean, message?: string): void;
|
||||
static Throws(fn: () => void, message?: string): void;
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
@@ -76,11 +76,11 @@ interface Async {
|
||||
each<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
eachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOf(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOf<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOfSeries(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOfSeries<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOfLimit<T>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
|
||||
+248
-5
@@ -1,13 +1,256 @@
|
||||
/// <reference path="aws-sdk.d.ts" />
|
||||
|
||||
import awsSdk = require('aws-sdk');
|
||||
import AWS = require('aws-sdk');
|
||||
|
||||
var str: string;
|
||||
|
||||
var creds: awsSdk.Credentials;
|
||||
var creds: AWS.Credentials;
|
||||
|
||||
creds = new awsSdk.Credentials(str, str);
|
||||
creds = new awsSdk.Credentials(str, str, str);
|
||||
creds = new AWS.Credentials(str, str);
|
||||
creds = new AWS.Credentials(str, str, str);
|
||||
str = creds.accessKeyId;
|
||||
|
||||
// more
|
||||
|
||||
/*
|
||||
* SQS
|
||||
*/
|
||||
var sqs:AWS.SQS
|
||||
|
||||
//Default constructor
|
||||
sqs = new AWS.SQS();
|
||||
|
||||
//Locking the API Version
|
||||
sqs = new AWS.SQS({apiVersion: '2012-11-05'});
|
||||
|
||||
// Locking the API Version Globally
|
||||
AWS.config.apiVersions = {
|
||||
sqs: '2012-11-05',
|
||||
// other service API versions
|
||||
};
|
||||
|
||||
sqs.addPermission({
|
||||
AWSAccountIds: [ /* required */
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
Actions: [ /* required */
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
Label: 'STRING_VALUE', /* required */
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.changeMessageVisibility({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE', /* required */
|
||||
VisibilityTimeout: 0 /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.changeMessageVisibilityBatch({
|
||||
Entries: [ /* required */
|
||||
{
|
||||
Id: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE', /* required */
|
||||
VisibilityTimeout: 0
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.createQueue({
|
||||
QueueName: 'STRING_VALUE', /* required */
|
||||
Attributes: {
|
||||
someKey: 'STRING_VALUE',
|
||||
/* anotherKey: ... */
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.deleteMessage({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.deleteMessageBatch({
|
||||
Entries: [ /* required */
|
||||
{
|
||||
Id: 'STRING_VALUE', /* required */
|
||||
ReceiptHandle: 'STRING_VALUE' /* required */
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.deleteQueue({
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.getQueueAttributes({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
AttributeNames: [
|
||||
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
|
||||
/* more items */
|
||||
]
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.getQueueUrl({
|
||||
QueueName: 'STRING_VALUE', /* required */
|
||||
QueueOwnerAWSAccountId: 'STRING_VALUE'
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.listDeadLetterSourceQueues({
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.listQueues({
|
||||
QueueNamePrefix: 'STRING_VALUE'
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.purgeQueue({
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.receiveMessage({
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
AttributeNames: [
|
||||
'Policy | VisibilityTimeout | MaximumMessageSize | MessageRetentionPeriod | ApproximateNumberOfMessages | ApproximateNumberOfMessagesNotVisible | CreatedTimestamp | LastModifiedTimestamp | QueueArn | ApproximateNumberOfMessagesDelayed | DelaySeconds | ReceiveMessageWaitTimeSeconds | RedrivePolicy',
|
||||
/* more items */
|
||||
],
|
||||
MaxNumberOfMessages: 0,
|
||||
MessageAttributeNames: [
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
VisibilityTimeout: 0,
|
||||
WaitTimeSeconds: 0
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.removePermission({
|
||||
Label: 'STRING_VALUE', /* required */
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.sendMessage({
|
||||
MessageBody: 'STRING_VALUE', /* required */
|
||||
QueueUrl: 'STRING_VALUE', /* required */
|
||||
DelaySeconds: 0,
|
||||
MessageAttributes: {
|
||||
someKey: {
|
||||
DataType: 'STRING_VALUE', /* required */
|
||||
BinaryListValues: [
|
||||
new Buffer('...') || 'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
BinaryValue: new Buffer('...') || 'STRING_VALUE',
|
||||
StringListValues: [
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
StringValue: 'STRING_VALUE'
|
||||
},
|
||||
/* anotherKey: ... */
|
||||
}
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.sendMessageBatch({
|
||||
Entries: [ /* required */
|
||||
{
|
||||
Id: 'STRING_VALUE', /* required */
|
||||
MessageBody: 'STRING_VALUE', /* required */
|
||||
DelaySeconds: 0,
|
||||
MessageAttributes: {
|
||||
someKey: {
|
||||
DataType: 'STRING_VALUE', /* required */
|
||||
BinaryListValues: [
|
||||
new Buffer('...') ,
|
||||
/* more items */
|
||||
],
|
||||
BinaryValue: new Buffer('...'),
|
||||
StringListValues: [
|
||||
'STRING_VALUE',
|
||||
/* more items */
|
||||
],
|
||||
StringValue: 'STRING_VALUE'
|
||||
},
|
||||
/* anotherKey: ... */
|
||||
}
|
||||
},
|
||||
/* more items */
|
||||
],
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
},
|
||||
function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
sqs.setQueueAttributes({
|
||||
Attributes: { /* required */
|
||||
someKey: 'STRING_VALUE',
|
||||
/* anotherKey: ... */
|
||||
},
|
||||
QueueUrl: 'STRING_VALUE' /* required */
|
||||
}, function(err, data) {
|
||||
if (err) console.log(err, err.stack); // an error occurred
|
||||
else console.log(data); // successful response
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
Vendored
+156
-55
@@ -30,6 +30,16 @@ declare module "aws-sdk" {
|
||||
xhrAsync?: boolean;
|
||||
xhrWithCredentials?: boolean;
|
||||
}
|
||||
|
||||
export class Endpoint {
|
||||
constructor(endpoint:string);
|
||||
|
||||
host:string;
|
||||
hostname:string;
|
||||
href:string;
|
||||
port:number;
|
||||
protocol:string;
|
||||
}
|
||||
|
||||
export interface Services {
|
||||
autoscaling?: any;
|
||||
@@ -99,7 +109,25 @@ declare module "aws-sdk" {
|
||||
|
||||
export class SQS {
|
||||
constructor(options?: any);
|
||||
public client: Sqs.Client;
|
||||
endpoint:Endpoint;
|
||||
|
||||
addPermission(params: SQS.AddPermissionParams, callback: (err:Error, data:any) => void): void;
|
||||
changeMessageVisibility(params: SQS.ChangeMessageVisibilityParams, callback: (err:Error, data:any) => void): void;
|
||||
changeMessageVisibilityBatch(params: SQS.ChangeMessageVisibilityBatchParams, callback: (err:Error, data:SQS.ChangeMessageVisibilityBatchResponse) => void): void;
|
||||
createQueue(params: SQS.CreateQueueParams, callback: (err: Error, data: SQS.CreateQueueResult) => void): void;
|
||||
deleteMessage(params: SQS.DeleteMessageParams, callback: (err: Error, data: any) => void): void;
|
||||
deleteMessageBatch(params: SQS.DeleteMessageBatchParams, callback: (err: Error, data: SQS.DeleteMessageBatchResult) => void): void;
|
||||
deleteQueue(params: { QueueUrl: string; }, callback: (err: Error, data: any) => void): void;
|
||||
getQueueAttributes(params: SQS.GetQueueAttributesParams, callback: (err: Error, data: SQS.GetQueueAttributesResult) => void): void;
|
||||
getQueueUrl(params: SQS.GetQueueUrlParams, callback: (err: Error, data: { QueueUrl: string; }) => void): void;
|
||||
listDeadLetterSourceQueues(params: {QueueUrl:string}, callback: (err: Error, data: {queueUrls: string[]}) => void): void;
|
||||
listQueues(params: {QueueNamePrefix?:string}, callback: (err: Error, data: {QueueUrls: string[]}) => void): void;
|
||||
purgeQueue(params: {QueueUrl: string}, callback: (err: Error, data: any) => void): void;
|
||||
receiveMessage(params: SQS.ReceiveMessageParams, callback: (err: Error, data: SQS.ReceiveMessageResult) => void): void;
|
||||
removePermission(params: {QueueUrl: string, Label: string}, callback: (err: Error, data: any) => void): void;
|
||||
sendMessage(params: SQS.SendMessageParams, callback: (err: Error, data: SQS.SendMessageResult) => void): void;
|
||||
sendMessageBatch(params: SQS.SendMessageBatchParams, callback: (err: Error, data: SQS.SendMessageBatchResult) => void): void;
|
||||
setQueueAttributes(params: SQS.SetQueueAttributesParams, callback: (err: Error, data: any) => void): void;
|
||||
}
|
||||
|
||||
export class SES {
|
||||
@@ -126,36 +154,77 @@ declare module "aws-sdk" {
|
||||
constructor(options?: any);
|
||||
}
|
||||
|
||||
export module Sqs {
|
||||
|
||||
export interface Client {
|
||||
config: ClientConfig;
|
||||
|
||||
sendMessage(params: SendMessageRequest, callback: (err: any, data: SendMessageResult) => void): void;
|
||||
sendMessageBatch(params: SendMessageBatchRequest, callback: (err: any, data: SendMessageBatchResult) => void): void;
|
||||
receiveMessage(params: ReceiveMessageRequest, callback: (err: any, data: ReceiveMessageResult) => void): void;
|
||||
deleteMessage(params: DeleteMessageRequest, callback: (err: any, data: any) => void): void;
|
||||
deleteMessageBatch(params: DeleteMessageBatchRequest, callback: (err: any, data: DeleteMessageBatchResult) => void): void;
|
||||
createQueue(params: CreateQueueRequest, callback: (err: any, data: CreateQueueResult) => void): void;
|
||||
deleteQueue(params: DeleteQueueRequest, callback: (err: any, data: any) => void): void;
|
||||
export module SQS {
|
||||
|
||||
export interface SqsOptions {
|
||||
params?: any;
|
||||
endpoint?: string;
|
||||
accessKeyId?: string;
|
||||
secretAccessKey?: string;
|
||||
sessionToken?: Credentials;
|
||||
credentials?: Credentials;
|
||||
credentialProvider?: any;
|
||||
region?: string;
|
||||
maxRetries?: number;
|
||||
maxRedirects?: number;
|
||||
sslEnabled?: boolean;
|
||||
paramValidation?: boolean;
|
||||
computeChecksums?: boolean;
|
||||
convertResponseTypes?: boolean;
|
||||
correctClockSkew?: boolean;
|
||||
s3ForcePathStyle?: boolean;
|
||||
s3BucketEndpoint?: boolean;
|
||||
httpOptions?: HttpOptions;
|
||||
apiVersion?: string;
|
||||
apiVersions?: { [serviceName:string]: string};
|
||||
logger?: Logger;
|
||||
systemClockOffset?: number;
|
||||
signatureVersion?: string;
|
||||
signatureCache?: boolean;
|
||||
}
|
||||
|
||||
export interface AddPermissionParams {
|
||||
QueueUrl: string;
|
||||
Label: string;
|
||||
AWSAccountIds:string[];
|
||||
Actions:string[];
|
||||
}
|
||||
|
||||
export interface ChangeMessageVisibilityParams {
|
||||
QueueUrl: string,
|
||||
ReceiptHandle: string,
|
||||
VisibilityTimeout: number
|
||||
}
|
||||
|
||||
export interface ChangeMessageVisibilityBatchParams {
|
||||
QueueUrl: string,
|
||||
Entries: { Id: string; ReceiptHandle: string; VisibilityTimeout?: number; }[]
|
||||
}
|
||||
|
||||
export interface ChangeMessageVisibilityBatchResponse {
|
||||
Successful: { Id:string }[];
|
||||
Failed: BatchResultErrorEntry[];
|
||||
}
|
||||
|
||||
export interface SendMessageRequest {
|
||||
QueueUrl?: string;
|
||||
MessageBody?: string;
|
||||
export interface SendMessageParams {
|
||||
QueueUrl: string;
|
||||
MessageBody: string;
|
||||
DelaySeconds?: number;
|
||||
MessageAttributes?: { [name:string]: MessageAttribute; }
|
||||
}
|
||||
|
||||
export interface ReceiveMessageRequest {
|
||||
QueueUrl?: string;
|
||||
export interface ReceiveMessageParams {
|
||||
QueueUrl: string;
|
||||
MaxNumberOfMessages?: number;
|
||||
VisibilityTimeout?: number;
|
||||
AttributeNames?: string[];
|
||||
MessageAttributeNames?: string[];
|
||||
WaitTimeSeconds?:number;
|
||||
}
|
||||
|
||||
export interface DeleteMessageBatchRequest {
|
||||
QueueUrl?: string;
|
||||
Entries?: DeleteMessageBatchRequestEntry[];
|
||||
export interface DeleteMessageBatchParams {
|
||||
QueueUrl: string;
|
||||
Entries: DeleteMessageBatchRequestEntry[];
|
||||
}
|
||||
|
||||
export interface DeleteMessageBatchRequestEntry {
|
||||
@@ -163,85 +232,117 @@ declare module "aws-sdk" {
|
||||
ReceiptHandle: string;
|
||||
}
|
||||
|
||||
export interface DeleteMessageRequest {
|
||||
QueueUrl?: string;
|
||||
ReceiptHandle?: string;
|
||||
export interface DeleteMessageParams {
|
||||
QueueUrl: string;
|
||||
ReceiptHandle: string;
|
||||
}
|
||||
|
||||
export class Attribute {
|
||||
Name: string;
|
||||
Value: string;
|
||||
export interface SendMessageBatchParams {
|
||||
QueueUrl: string;
|
||||
Entries: SendMessageBatchRequestEntry[];
|
||||
}
|
||||
|
||||
export interface SendMessageBatchRequest {
|
||||
QueueUrl?: string;
|
||||
Entries?: SendMessageBatchRequestEntry[];
|
||||
}
|
||||
|
||||
export class SendMessageBatchRequestEntry {
|
||||
export interface SendMessageBatchRequestEntry {
|
||||
Id: string;
|
||||
MessageBody: string;
|
||||
DelaySeconds: number;
|
||||
}
|
||||
|
||||
export interface CreateQueueRequest {
|
||||
QueueName?: string;
|
||||
DefaultVisibilityTimeout?: number;
|
||||
DelaySeconds?: number;
|
||||
Attributes?: Attribute[];
|
||||
MessageAttributes?: { [name:string]: MessageAttribute; }
|
||||
}
|
||||
|
||||
export interface DeleteQueueRequest {
|
||||
QueueUrl?: string;
|
||||
export interface CreateQueueParams {
|
||||
QueueName: string;
|
||||
Attributes: QueueAttributes;
|
||||
}
|
||||
|
||||
export class SendMessageResult {
|
||||
|
||||
export interface QueueAttributes {
|
||||
[name:string]: any;
|
||||
DelaySeconds?: number;
|
||||
MaximumMessageSize?: number;
|
||||
MessageRetentionPeriod?: number;
|
||||
Policy?: any;
|
||||
ReceiveMessageWaitTimeSeconds?: number;
|
||||
VisibilityTimeout?: number;
|
||||
RedrivePolicy?: any;
|
||||
}
|
||||
|
||||
export interface GetQueueAttributesParams {
|
||||
QueueUrl: string;
|
||||
AttributeNames: string[];
|
||||
}
|
||||
|
||||
export interface GetQueueAttributesResult {
|
||||
Attributes: {[name:string]: string};
|
||||
}
|
||||
|
||||
export interface GetQueueUrlParams {
|
||||
QueueName: string;
|
||||
QueueOwnerAWSAccountId?: string;
|
||||
}
|
||||
|
||||
export interface SendMessageResult {
|
||||
MessageId: string;
|
||||
MD5OfMessageBody: string;
|
||||
MD5OfMessageAttributes: string;
|
||||
}
|
||||
|
||||
export class ReceiveMessageResult {
|
||||
export interface ReceiveMessageResult {
|
||||
Messages: Message[];
|
||||
}
|
||||
|
||||
export class Message {
|
||||
export interface Message {
|
||||
MessageId: string;
|
||||
ReceiptHandle: string;
|
||||
MD5OfBody: string;
|
||||
Body: string;
|
||||
Attributes: Attribute[];
|
||||
Attributes: { [name:string]:any };
|
||||
MD5OfMessageAttributes:string;
|
||||
MessageAttributes: { [name:string]: MessageAttribute; }
|
||||
}
|
||||
|
||||
export class DeleteMessageBatchResult {
|
||||
export interface MessageAttribute {
|
||||
StringValue?: string;
|
||||
BinaryValue?: any; //(Buffer, Typed Array, Blob, String)
|
||||
StringListValues?: string[];
|
||||
BinaryListValues?: any[];
|
||||
DataType: string;
|
||||
}
|
||||
|
||||
export interface DeleteMessageBatchResult {
|
||||
Successful: DeleteMessageBatchResultEntry[];
|
||||
Failed: BatchResultErrorEntry[];
|
||||
}
|
||||
|
||||
export class DeleteMessageBatchResultEntry {
|
||||
export interface DeleteMessageBatchResultEntry {
|
||||
Id: string;
|
||||
}
|
||||
|
||||
export class BatchResultErrorEntry {
|
||||
export interface BatchResultErrorEntry {
|
||||
Id: string;
|
||||
Code: string;
|
||||
Message: string;
|
||||
SenderFault: string;
|
||||
Message?: string;
|
||||
SenderFault: boolean;
|
||||
}
|
||||
|
||||
export class SendMessageBatchResult {
|
||||
export interface SendMessageBatchResult {
|
||||
Successful: SendMessageBatchResultEntry[];
|
||||
Failed: BatchResultErrorEntry[];
|
||||
}
|
||||
|
||||
export class SendMessageBatchResultEntry {
|
||||
export interface SendMessageBatchResultEntry {
|
||||
Id: string;
|
||||
MessageId: string;
|
||||
MD5OfMessageBody: string;
|
||||
MD5OfMessageAttributes:string;
|
||||
}
|
||||
|
||||
export class CreateQueueResult {
|
||||
export interface CreateQueueResult {
|
||||
QueueUrl: string;
|
||||
}
|
||||
|
||||
export interface SetQueueAttributesParams {
|
||||
QueueUrl: string;
|
||||
Attributes: QueueAttributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vendored
+21
-6
@@ -65,8 +65,21 @@ declare module Backbone {
|
||||
reset?: boolean;
|
||||
}
|
||||
|
||||
interface ObjectHash {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface RoutesHash {
|
||||
[routePattern: string]: string | {(...urlParts: string[]): void};
|
||||
}
|
||||
|
||||
interface EventsHash {
|
||||
[selector: string]: string | {(eventObject: JQueryEventObject): void};
|
||||
}
|
||||
|
||||
class Events {
|
||||
on(eventName: string, callback?: Function, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
off(eventName?: string, callback?: Function, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: Function, context?: any): any;
|
||||
@@ -102,7 +115,7 @@ declare module Backbone {
|
||||
* For assigning an object hash, do it like this: this.defaults = <any>{ attribute: value, ... };
|
||||
* That works only if you set it in the constructor or the initialize method.
|
||||
**/
|
||||
defaults(): any;
|
||||
defaults(): ObjectHash;
|
||||
id: any;
|
||||
idAttribute: string;
|
||||
validationError: any;
|
||||
@@ -272,7 +285,7 @@ declare module Backbone {
|
||||
* For assigning routes as object hash, do it like this: this.routes = <any>{ "route": callback, ... };
|
||||
* That works only if you set it in the constructor or the initialize method.
|
||||
**/
|
||||
routes: any;
|
||||
routes: RoutesHash | any;
|
||||
|
||||
constructor(options?: RouterOptions);
|
||||
initialize(options?: RouterOptions): void;
|
||||
@@ -301,7 +314,7 @@ declare module Backbone {
|
||||
checkUrl(e?: any): void;
|
||||
loadUrl(fragmentOverride: string): boolean;
|
||||
navigate(fragment: string, options?: any): boolean;
|
||||
started: boolean;
|
||||
static started: boolean;
|
||||
options: any;
|
||||
|
||||
private _updateHash(location: Location, fragment: string, replace: boolean): void;
|
||||
@@ -310,7 +323,7 @@ declare module Backbone {
|
||||
interface ViewOptions<TModel extends Model> {
|
||||
model?: TModel;
|
||||
// TODO: quickfix, this can't be fixed easy. The collection does not need to have the same model as the parent view.
|
||||
collection?: Backbone.Collection<any>;
|
||||
collection?: Backbone.Collection<any>; //was: Collection<TModel>;
|
||||
el?: any;
|
||||
id?: string;
|
||||
className?: string;
|
||||
@@ -333,7 +346,7 @@ declare module Backbone {
|
||||
* For assigning events as object hash, do it like this: this.events = <any>{ "event:selector": callback, ... };
|
||||
* That works only if you set it in the constructor or the initialize method.
|
||||
**/
|
||||
events(): any;
|
||||
events(): EventsHash;
|
||||
|
||||
$(selector: string): JQuery;
|
||||
model: TModel;
|
||||
@@ -353,8 +366,10 @@ declare module Backbone {
|
||||
render(): View<TModel>;
|
||||
remove(): View<TModel>;
|
||||
make(tagName: any, attributes?: any, content?: any): any;
|
||||
delegateEvents(events?: any): any;
|
||||
delegateEvents(events?: EventsHash): any;
|
||||
delegate(eventName: string, selector: string, listener: Function): View<TModel>;
|
||||
undelegateEvents(): any;
|
||||
undelegate(eventName: string, selector?: string, listener?: Function): View<TModel>;
|
||||
|
||||
_ensureElement(): void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="barcode.d.ts" />
|
||||
import barcode = require('barcode');
|
||||
import path = require('path');
|
||||
|
||||
var code39 = barcode('code39', {
|
||||
data: "it works",
|
||||
width: 400,
|
||||
height: 100,
|
||||
});
|
||||
|
||||
code39.getStream(function (err, readStream) {
|
||||
if (err) throw err;
|
||||
|
||||
// 'readStream' is an instance of ReadableStream
|
||||
});
|
||||
|
||||
var outfile = path.join(__dirname, 'imgs', 'mycode.png');
|
||||
code39.saveImage(outfile, function (err) {
|
||||
if (err) throw err;
|
||||
|
||||
console.log('File has been written!');
|
||||
});
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for barcode
|
||||
// Project: https://github.com/samt/barcode
|
||||
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "barcode" {
|
||||
|
||||
interface BarcodeOptions {
|
||||
data:string|number;
|
||||
width:number;
|
||||
height:number;
|
||||
}
|
||||
|
||||
interface BarcodeResult {
|
||||
getStream(callback:(err:NodeJS.ErrnoException, stream:NodeJS.ReadableStream) => void):void;
|
||||
saveImage(outputfilePath:string, callback:(err:NodeJS.ErrnoException) => void):void;
|
||||
getBase64(callback:(err:NodeJS.ErrnoException, base64String:string) => void):void;
|
||||
}
|
||||
|
||||
function barcode(type:string, options:BarcodeOptions):BarcodeResult;
|
||||
|
||||
export = barcode;
|
||||
}
|
||||
@@ -4,6 +4,9 @@
|
||||
var noArgument = bigInt(),
|
||||
numberArgument = bigInt( 93 ),
|
||||
stringArgument = bigInt( "75643564363473453456342378564387956906736546456235345" ),
|
||||
baseArgumentInt = bigInt( "101010", 2 ),
|
||||
baseArgumentStr = bigInt( "101010", "2" ),
|
||||
baseArgumentBi = bigInt( "101010", bigInt( 2 ) ),
|
||||
bigIntArgument = bigInt( noArgument );
|
||||
|
||||
// method tests
|
||||
@@ -111,4 +114,4 @@ isNumber = x.toJSNumber();
|
||||
|
||||
isString = x.toString();
|
||||
|
||||
isNumber = x.valueOf();
|
||||
isNumber = x.valueOf();
|
||||
|
||||
Vendored
+2
-2
@@ -214,7 +214,7 @@ interface BigIntegerStatic {
|
||||
/** Parse a Javascript number into a bigInt */
|
||||
( number: number ): BigInteger;
|
||||
/** Parse a string into a bigInt */
|
||||
( string: string ): BigInteger;
|
||||
( string: string, base?: string | number | BigInteger): BigInteger;
|
||||
/** no-op */
|
||||
( bigInt: BigInteger ): BigInteger;
|
||||
}
|
||||
@@ -223,4 +223,4 @@ declare var bigInt: BigIntegerStatic;
|
||||
|
||||
declare module "big-integer" {
|
||||
export = bigInt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
/// <reference path="bignum.d.ts" />
|
||||
|
||||
var bignum = require('bignum');
|
||||
|
||||
// Test constructors.
|
||||
var instance = bignum(16);
|
||||
bignum('16');
|
||||
bignum(instance);
|
||||
|
||||
// Test `toNumber` function.
|
||||
instance.toNumber();
|
||||
|
||||
bignum.toNumber(4);
|
||||
bignum.toNumber('4');
|
||||
bignum.toNumber(bignum(4));
|
||||
|
||||
// Test `toBuffer` function.
|
||||
instance.toBuffer();
|
||||
|
||||
bignum.toBuffer(4);
|
||||
bignum.toBuffer('4');
|
||||
bignum.toBuffer(bignum(4));
|
||||
|
||||
// Test `add` function.
|
||||
instance.add(4);
|
||||
instance.add('4');
|
||||
instance.add(bignum(4));
|
||||
|
||||
bignum.add(instance, 4);
|
||||
bignum.add(instance, '4');
|
||||
bignum.add(instance, bignum(4));
|
||||
|
||||
// Test `sub` function.
|
||||
instance.sub(4);
|
||||
instance.sub('4');
|
||||
instance.sub(bignum(4));
|
||||
|
||||
bignum.sub(instance, 4);
|
||||
bignum.sub(instance, '4');
|
||||
bignum.sub(instance, bignum(4));
|
||||
|
||||
// Test `mul` function.
|
||||
instance.mul(4);
|
||||
instance.mul('4');
|
||||
instance.mul(bignum(4));
|
||||
|
||||
bignum.mul(instance, 4);
|
||||
bignum.mul(instance, '4');
|
||||
bignum.mul(instance, bignum(4));
|
||||
|
||||
// Test `div` function.
|
||||
instance.div(4);
|
||||
instance.div('4');
|
||||
instance.div(bignum(4));
|
||||
|
||||
bignum.div(instance, 4);
|
||||
bignum.div(instance, '4');
|
||||
bignum.div(instance, bignum(4));
|
||||
|
||||
// Test `abs` function.
|
||||
instance.abs();
|
||||
bignum.abs(instance);
|
||||
|
||||
// Test `neg` function.
|
||||
instance.neg();
|
||||
bignum.neg(instance);
|
||||
|
||||
// Test `cmp` function.
|
||||
instance.cmp(4);
|
||||
instance.cmp('4');
|
||||
instance.cmp(bignum(4));
|
||||
|
||||
bignum.cmp(instance, 4);
|
||||
bignum.cmp(instance, '4');
|
||||
bignum.cmp(instance, bignum(4));
|
||||
|
||||
// Test `gt` function.
|
||||
instance.gt(4);
|
||||
instance.gt('4');
|
||||
instance.gt(bignum(4));
|
||||
|
||||
bignum.gt(instance, 4);
|
||||
bignum.gt(instance, '4');
|
||||
bignum.gt(instance, bignum(4));
|
||||
|
||||
// Test `ge` function.
|
||||
instance.ge(4);
|
||||
instance.ge('4');
|
||||
instance.ge(bignum(4));
|
||||
|
||||
bignum.ge(instance, 4);
|
||||
bignum.ge(instance, '4');
|
||||
bignum.ge(instance, bignum(4));
|
||||
|
||||
// Test `eq` function.
|
||||
instance.eq(4);
|
||||
instance.eq('4');
|
||||
instance.eq(bignum(4));
|
||||
|
||||
bignum.eq(instance, 4);
|
||||
bignum.eq(instance, '4');
|
||||
bignum.eq(instance, bignum(4));
|
||||
|
||||
// Test `lt` function.
|
||||
instance.lt(4);
|
||||
instance.lt('4');
|
||||
instance.lt(bignum(4));
|
||||
|
||||
bignum.lt(instance, 4);
|
||||
bignum.lt(instance, '4');
|
||||
bignum.lt(instance, bignum(4));
|
||||
|
||||
// Test `le` function.
|
||||
instance.le(4);
|
||||
instance.le('4');
|
||||
instance.le(bignum(4));
|
||||
|
||||
bignum.le(instance, 4);
|
||||
bignum.le(instance, '4');
|
||||
bignum.le(instance, bignum(4));
|
||||
|
||||
// Test `and` function.
|
||||
instance.and(4);
|
||||
instance.and('4');
|
||||
instance.and(bignum(4));
|
||||
|
||||
bignum.and(instance, 4);
|
||||
bignum.and(instance, '4');
|
||||
bignum.and(instance, bignum(4));
|
||||
|
||||
// Test `or` function.
|
||||
instance.or(4);
|
||||
instance.or('4');
|
||||
instance.or(bignum(4));
|
||||
|
||||
bignum.or(instance, 4);
|
||||
bignum.or(instance, '4');
|
||||
bignum.or(instance, bignum(4));
|
||||
|
||||
// Test `xor` function.
|
||||
instance.xor(4);
|
||||
instance.xor('4');
|
||||
instance.xor(bignum(4));
|
||||
|
||||
bignum.xor(instance, 4);
|
||||
bignum.xor(instance, '4');
|
||||
bignum.xor(instance, bignum(4));
|
||||
|
||||
// Test `mod` function.
|
||||
instance.mod(4);
|
||||
instance.mod('4');
|
||||
instance.mod(bignum(4));
|
||||
|
||||
bignum.mod(instance, 4);
|
||||
bignum.mod(instance, '4');
|
||||
bignum.mod(instance, bignum(4));
|
||||
|
||||
// Test `pow` function.
|
||||
instance.pow(4);
|
||||
instance.pow('4');
|
||||
instance.pow(bignum(4));
|
||||
|
||||
bignum.pow(instance, 4);
|
||||
bignum.pow(instance, '4');
|
||||
bignum.pow(instance, bignum(4));
|
||||
|
||||
// Test `powm` function.
|
||||
instance.powm(4, 4);
|
||||
instance.powm('4', 4);
|
||||
instance.powm(bignum(4), 4);
|
||||
|
||||
bignum.powm(instance, 4, 4);
|
||||
bignum.powm(instance, '4', 4);
|
||||
bignum.powm(instance, bignum(4), 4);
|
||||
|
||||
instance.powm(4, '4');
|
||||
instance.powm('4', '4');
|
||||
instance.powm(bignum(4), '4');
|
||||
|
||||
bignum.powm(instance, 4, '4');
|
||||
bignum.powm(instance, '4', '4');
|
||||
bignum.powm(instance, bignum(4), '4');
|
||||
|
||||
instance.powm(4, bignum(4));
|
||||
instance.powm('4', bignum(4));
|
||||
instance.powm(bignum(4), bignum(4));
|
||||
|
||||
bignum.powm(instance, 4, bignum(4));
|
||||
bignum.powm(instance, '4', bignum(4));
|
||||
bignum.powm(instance, bignum(4), bignum(4));
|
||||
|
||||
// Test `invertm` function.
|
||||
instance.invertm(4);
|
||||
instance.invertm('4');
|
||||
instance.invertm(bignum(4));
|
||||
|
||||
bignum.invertm(instance, 4);
|
||||
bignum.invertm(instance, '4');
|
||||
bignum.invertm(instance, bignum(4));
|
||||
|
||||
// Test `rand` function.
|
||||
instance.rand();
|
||||
instance.rand(20);
|
||||
instance.rand('20');
|
||||
instance.rand(bignum(20));
|
||||
|
||||
bignum.rand(instance);
|
||||
bignum.rand(instance, 20);
|
||||
bignum.rand(instance, '20');
|
||||
bignum.rand(instance, bignum(20));
|
||||
|
||||
// Test `probPrime` function.
|
||||
instance.probPrime();
|
||||
|
||||
bignum.probPrime(instance);
|
||||
|
||||
// Test `shiftLeft` function.
|
||||
instance.shiftLeft(4);
|
||||
instance.shiftLeft('4');
|
||||
instance.shiftLeft(bignum(4));
|
||||
|
||||
bignum.shiftLeft(instance, 4);
|
||||
bignum.shiftLeft(instance, '4');
|
||||
bignum.shiftLeft(instance, bignum(4));
|
||||
|
||||
// Test `shiftRight` function.
|
||||
instance.shiftRight(4);
|
||||
instance.shiftRight('4');
|
||||
instance.shiftRight(bignum(4));
|
||||
|
||||
bignum.shiftRight(instance, 4);
|
||||
bignum.shiftRight(instance, '4');
|
||||
bignum.shiftRight(instance, bignum(4));
|
||||
|
||||
// Test `gcd` function.
|
||||
instance.gcd(bignum(4));
|
||||
|
||||
bignum.gcd(instance, bignum(4));
|
||||
|
||||
// Test `jacobi` function.
|
||||
instance.jacobi(bignum(17));
|
||||
|
||||
bignum.jacobi(instance, bignum(17));
|
||||
|
||||
// Test `bitLength` function.
|
||||
instance.bitLength();
|
||||
|
||||
bignum.bitLength(instance);
|
||||
Vendored
+269
@@ -0,0 +1,269 @@
|
||||
// Type definitions for BigNum
|
||||
// Project: https://github.com/justmoon/node-BigNum
|
||||
// Definitions by: Pat Smuk <https://github.com/Patman64>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare class BigNum {
|
||||
/** Create a new BigNum from n. */
|
||||
constructor(n: number|BigNum);
|
||||
|
||||
/** Create a new BigNum from n and a base. */
|
||||
constructor(n: string, base?: number);
|
||||
|
||||
/**
|
||||
* Create a new BigNum from a Buffer.
|
||||
*
|
||||
* The default options are: {endian: 'big', size: 1}.
|
||||
*/
|
||||
static fromBuffer(buffer: Buffer, options?: BigNum.BufferOptions): BigNum;
|
||||
|
||||
/**
|
||||
* Generate a probable prime of length bits.
|
||||
*
|
||||
* If safe is true, it will be a "safe" prime of the form p=2p'+1 where p' is also prime.
|
||||
*/
|
||||
static prime(bits: number, safe?: boolean): BigNum;
|
||||
|
||||
/** Return true if num is identified as a BigNum instance. Otherwise, return false. */
|
||||
static isBigNum(num: any): boolean;
|
||||
|
||||
/** Print out the BigNum instance in the requested base as a string. Default: base 10 */
|
||||
toString(base?: number): string;
|
||||
|
||||
/**
|
||||
* Turn a BigNum into a Number.
|
||||
*
|
||||
* If the BigNum is too big you'll lose precision or you'll get ±Infinity.
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Return a new Buffer with the data from the BigNum.
|
||||
*
|
||||
* The default options are: {endian: 'big', size: 1}.
|
||||
*/
|
||||
toBuffer(options?: BigNum.BufferOptions): Buffer;
|
||||
|
||||
/** Return a new BigNum containing the instance value plus n. */
|
||||
add(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value minus n. */
|
||||
sub(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value multiplied by n. */
|
||||
mul(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value integrally divided by n. */
|
||||
div(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the absolute value of the instance. */
|
||||
abs(): BigNum;
|
||||
|
||||
/** Return a new BigNum with the negative of the instance value. */
|
||||
neg(): BigNum;
|
||||
|
||||
/**
|
||||
* Compare the instance value to n.
|
||||
*
|
||||
* Return a positive integer if > n, a negative integer if < n, and 0 if == n.
|
||||
*/
|
||||
cmp(n: BigNum.BigNumCompatible): number;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than n (> n). */
|
||||
gt(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */
|
||||
ge(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is equal to n (== n). */
|
||||
eq(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than n (< n). */
|
||||
lt(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than or equal to n (<= n). */
|
||||
le(n: BigNum.BigNumCompatible): boolean;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise AND (&)-ed with n. */
|
||||
and(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise inclusive-OR (|)-ed with n. */
|
||||
or(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise exclusive-OR (^)-ed with n. */
|
||||
xor(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value modulo n. */
|
||||
mod(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power. */
|
||||
pow(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power modulo m. */
|
||||
powm(n: BigNum.BigNumCompatible, m: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Compute the multiplicative inverse modulo m. */
|
||||
invertm(m: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* If upperBound is supplied, return a random BigNum between the instance value and upperBound - 1, inclusive.
|
||||
* Otherwise, return a random BigNum between 0 and the instance value - 1, inclusive.
|
||||
*/
|
||||
rand(upperBound?: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* Return whether the BigNum is:
|
||||
* - certainly prime (true)
|
||||
* - probably prime ('maybe')
|
||||
* - certainly composite (false)
|
||||
*/
|
||||
probPrime(): boolean | string;
|
||||
|
||||
/** Return a new BigNum that is the 2^n multiple. Equivalent of the << operator. */
|
||||
shiftLeft(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum of the value integer divided by 2^n. Equivalent of the >> operator. */
|
||||
shiftRight(n: BigNum.BigNumCompatible): BigNum;
|
||||
|
||||
/** Return the greatest common divisor of the current BigNum with n as a new BigNum. */
|
||||
gcd(n: BigNum): BigNum;
|
||||
|
||||
/**
|
||||
* Return the Jacobi symbol (or Legendre symbol if n is prime) of the current BigNum (= a) over n.
|
||||
* Note that n must be odd and >= 3. 0 <= a < n.
|
||||
*
|
||||
* Returns -1 or 1 as an int (NOT a BigNum). Throws an error on failure.
|
||||
*/
|
||||
jacobi(n: BigNum): number;
|
||||
|
||||
/** Return the number of bits used to represent the current BigNum. */
|
||||
bitLength(): number;
|
||||
}
|
||||
|
||||
declare namespace BigNum {
|
||||
/** Anything that can be converted to BigNum. */
|
||||
type BigNumCompatible = BigNum | number | string;
|
||||
|
||||
export interface BufferOptions {
|
||||
/** Can be either 'big' or 'little'. Also accepts 1 for big and -1 for little. Doesn't matter when size = 1. */
|
||||
endian: string | number;
|
||||
|
||||
/** Number of bytes per word, or 'auto' to flip entire Buffer. */
|
||||
size: number | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a BigNum into a Number.
|
||||
*
|
||||
* If the BigNum is too big you'll lose precision or you'll get ±Infinity.
|
||||
*/
|
||||
export function toNumber(n: BigNumCompatible): number;
|
||||
|
||||
/**
|
||||
* Return a new Buffer with the data from the BigNum.
|
||||
*
|
||||
* The default options are: {endian: 'big', size: 1}.
|
||||
*/
|
||||
export function toBuffer(n: BigNumCompatible, options?: BufferOptions): Buffer;
|
||||
|
||||
/** Return a new BigNum containing the instance value plus n. */
|
||||
export function add(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value minus n. */
|
||||
export function sub(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value multiplied by n. */
|
||||
export function mul(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum containing the instance value integrally divided by n. */
|
||||
export function div(dividend: BigNumCompatible, divisor: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the absolute value of the instance. */
|
||||
export function abs(n: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the negative of the instance value. */
|
||||
export function neg(n: BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* Compare the instance value to n.
|
||||
*
|
||||
* Return a positive integer if > n, a negative integer if < n, and 0 if == n.
|
||||
*/
|
||||
export function cmp(left: BigNumCompatible, right: BigNumCompatible): number;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than n (> n). */
|
||||
export function gt(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */
|
||||
export function ge(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is equal to n (== n). */
|
||||
export function eq(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than n (< n). */
|
||||
export function lt(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a boolean: whether the instance value is less than or equal to n (<= n). */
|
||||
export function le(left: BigNumCompatible, right: BigNumCompatible): boolean;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise AND (&)-ed with n. */
|
||||
export function and(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise inclusive-OR (|)-ed with n. */
|
||||
export function or(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value bitwise exclusive-OR (^)-ed with n. */
|
||||
export function xor(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value modulo n. */
|
||||
export function mod(left: BigNumCompatible, right: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power. */
|
||||
export function pow(base: BigNumCompatible, exponent: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum with the instance value raised to the nth power modulo m. */
|
||||
export function powm(base: BigNumCompatible, exponent: BigNumCompatible, m: BigNumCompatible): BigNum;
|
||||
|
||||
/** Compute the multiplicative inverse modulo m. */
|
||||
export function invertm(n: BigNumCompatible, m: BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* If upperBound is supplied, return a random BigNum between the instance value and upperBound - 1, inclusive.
|
||||
* Otherwise, return a random BigNum between 0 and the instance value - 1, inclusive.
|
||||
*/
|
||||
export function rand(n: BigNumCompatible, upperBound?: BigNumCompatible): BigNum;
|
||||
|
||||
/**
|
||||
* Return whether the BigNum is:
|
||||
* - certainly prime (true)
|
||||
* - probably prime ('maybe')
|
||||
* - certainly composite (false)
|
||||
*/
|
||||
export function probPrime(n: BigNumCompatible): boolean | string;
|
||||
|
||||
/** Return a new BigNum that is the 2^bits multiple. Equivalent of the << operator. */
|
||||
export function shiftLeft(n: BigNumCompatible, bits: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return a new BigNum of the value integer divided by 2^bits. Equivalent of the >> operator. */
|
||||
export function shiftRight(n: BigNumCompatible, bits: BigNumCompatible): BigNum;
|
||||
|
||||
/** Return the greatest common divisor of the current BigNum with n as a new BigNum. */
|
||||
export function gcd(left: BigNumCompatible, right: BigNum): BigNum;
|
||||
|
||||
/**
|
||||
* Return the Jacobi symbol (or Legendre symbol if n is prime) of the current BigNum (= a) over n.
|
||||
* Note that n must be odd and >= 3. 0 <= a < n.
|
||||
*
|
||||
* Returns -1 or 1 as an int (NOT a BigNum). Throws an error on failure.
|
||||
*/
|
||||
export function jacobi(a: BigNumCompatible, n: BigNum): number;
|
||||
|
||||
/** Return the number of bits used to represent the current BigNum. */
|
||||
export function bitLength(n: BigNumCompatible): number;
|
||||
}
|
||||
|
||||
declare module "bignum" {
|
||||
export = BigNum;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
/// <reference path="Microsoft.Maps.AdvancedShapes.d.ts"/>
|
||||
/// <reference path="Microsoft.Maps.Directions.d.ts"/>
|
||||
/// <reference path="Microsoft.Maps.Search.d.ts"/>
|
||||
@@ -55,7 +55,7 @@ module BingMapsTests {
|
||||
locations.push(location);
|
||||
}
|
||||
|
||||
// Sets the view of the map to the smallest size that contains all of the
|
||||
// Sets the view of the map to the smallest size that contains all of the
|
||||
// specified locations (in this case the pusphin locations)
|
||||
map.setView({ bounds: Microsoft.Maps.LocationRect.fromLocations(locations) });
|
||||
}
|
||||
+117
-10
@@ -36,6 +36,9 @@ interface Foo {
|
||||
interface Bar {
|
||||
bar(): string;
|
||||
}
|
||||
interface Baz {
|
||||
baz(): string;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -61,6 +64,7 @@ interface StrBarArrMap {
|
||||
|
||||
var foo: Foo;
|
||||
var bar: Bar;
|
||||
var baz: Baz;
|
||||
|
||||
var fooArr: Foo[];
|
||||
var barArr: Bar[];
|
||||
@@ -76,6 +80,8 @@ var voidProm: Promise<void>;
|
||||
|
||||
var fooProm: Promise<Foo>;
|
||||
var barProm: Promise<Bar>;
|
||||
var fooOrBarProm: Promise<Foo|Bar>;
|
||||
var bazProm: Promise<Baz>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -145,6 +151,7 @@ var BlueBird: typeof Promise;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var nodeCallbackFunc = (callback: (err: any, result: string) => void) => {}
|
||||
var nodeCallbackFuncErrorOnly = (callback: (err: any) => void) => {}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -220,6 +227,21 @@ barProm = fooProm.then((value: Foo) => {
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return barProm;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
@@ -231,36 +253,96 @@ barProm = barProm.then((value: Bar) => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catch((reason: any) => {
|
||||
fooProm = fooProm.catch((reason: any) => {
|
||||
return;
|
||||
});
|
||||
|
||||
fooProm = fooProm.caught((reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.catch((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.caught((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
|
||||
fooProm = fooProm.catch((reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
|
||||
fooProm = fooProm.caught((reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
fooProm = fooProm.catch((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
fooProm = fooProm.caught((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return voidProm;
|
||||
});
|
||||
|
||||
fooProm = fooProm.catch((reason: any) => {
|
||||
//handle multiple valid return types simultaneously
|
||||
if (true) {
|
||||
return;
|
||||
} else if (false) {
|
||||
return voidProm;
|
||||
} else if (foo) {
|
||||
return foo;
|
||||
}
|
||||
});
|
||||
|
||||
fooOrBarProm = fooProm.catch((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught((reason: any) => {
|
||||
fooOrBarProm = fooProm.caught((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
barProm = fooProm.catch((reason: any) => {
|
||||
return bar;
|
||||
fooOrBarProm = fooProm.catch((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught((reason: any) => {
|
||||
return bar;
|
||||
fooOrBarProm = fooProm.caught((error: any) => {
|
||||
return true;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catch(Error, (reason: any) => {
|
||||
fooProm = fooProm.catch(Error, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.caught(Error, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
fooProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
return;
|
||||
});
|
||||
|
||||
fooOrBarProm = fooProm.catch(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
fooOrBarProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Error, (reason: any) => {
|
||||
fooOrBarProm = fooProm.caught(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
fooOrBarProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
@@ -499,6 +581,30 @@ barProm = fooProm.race<Bar>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Promise.all([fooProm, barProm]).then(result => {
|
||||
result[0].foo();
|
||||
result[1].bar();
|
||||
});
|
||||
|
||||
Promise.all([fooProm, fooProm]).then(result => {
|
||||
result[0].foo();
|
||||
result[1].foo();
|
||||
});
|
||||
|
||||
Promise.all([fooProm, barProm, bazProm]).then(result => {
|
||||
result[0].foo();
|
||||
result[1].bar();
|
||||
result[2].baz();
|
||||
});
|
||||
|
||||
Promise.all([fooProm, barProm, fooProm]).then(result => {
|
||||
result[0].foo();
|
||||
result[1].bar();
|
||||
result[2].foo();
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO fix collection inference
|
||||
|
||||
barArrProm = fooProm.map<Foo, Bar>((item: Foo, index: number, arrayLength: number) => {
|
||||
@@ -649,6 +755,7 @@ func = Promise.promisify(f, obj);
|
||||
|
||||
obj = Promise.promisifyAll(obj);
|
||||
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback));
|
||||
anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback));
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
Vendored
+24
-18
@@ -25,19 +25,19 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
/**
|
||||
* Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => U|Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => void|Promise.Thenable<void>, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
catch(onReject?: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
caught(onReject?: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
|
||||
catch<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
catch<U>(onReject?: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
caught<U>(onReject?: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
@@ -46,17 +46,18 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
catch(predicate: (error: any) => boolean, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
caught(predicate: (error: any) => boolean, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
catch(ErrorClass: Function, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
caught(ErrorClass: Function, onReject: (error: any) => R|Promise.Thenable<R>|void|Promise.Thenable<void>): Promise<R>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U|Promise.Thenable<U>): Promise<U|R>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections.
|
||||
@@ -426,7 +427,7 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
/**
|
||||
* Returns a promise that is resolved by a node style callback function.
|
||||
*/
|
||||
static fromNode(resolver: (callback: (err: any, result: any) => void) => void): Promise<any>;
|
||||
static fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise<any>;
|
||||
|
||||
/**
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
@@ -464,6 +465,11 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
static all<R>(values: Promise.Thenable<R[]>): Promise<R[]>;
|
||||
// array with promises of value
|
||||
static all<R>(values: Promise.Thenable<R>[]): Promise<R[]>;
|
||||
// array with promises of different types
|
||||
static all<T1, T2>(values: [Promise.Thenable<T1>, Promise.Thenable<T2>]): Promise<[T1, T2]>;
|
||||
static all<T1, T2, T3>(values: [Promise.Thenable<T1>, Promise.Thenable<T2>, Promise.Thenable<T3>]): Promise<[T1, T2, T3]>;
|
||||
static all<T1, T2, T3, T4>(values: [Promise.Thenable<T1>, Promise.Thenable<T2>, Promise.Thenable<T3>, Promise.Thenable<T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
static all<T1, T2, T3, T4, T5>(values: [Promise.Thenable<T1>, Promise.Thenable<T2>, Promise.Thenable<T3>, Promise.Thenable<T4>, Promise.Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
// array with values
|
||||
static all<R>(values: R[]): Promise<R[]>;
|
||||
|
||||
@@ -666,8 +672,8 @@ declare module Promise {
|
||||
export function OperationalError(): OperationalError;
|
||||
|
||||
export interface Thenable<R> {
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => U|Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => void|Thenable<void>): Thenable<U>;
|
||||
}
|
||||
|
||||
export interface Resolver<R> {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/// <reference path="bookshelf.d.ts" />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
|
||||
import * as Knex from 'knex';
|
||||
import * as Bookshelf from 'bookshelf';
|
||||
|
||||
var knex = Knex({
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: ':memory:',
|
||||
},
|
||||
});
|
||||
|
||||
// Examples
|
||||
|
||||
var bookshelf = Bookshelf(knex);
|
||||
|
||||
class User extends bookshelf.Model<User> {
|
||||
get tableName() { return 'users'; }
|
||||
messages() : Bookshelf.Collection<Posts> {
|
||||
return this.hasMany(Posts);
|
||||
}
|
||||
}
|
||||
|
||||
class Posts extends bookshelf.Model<Posts> {
|
||||
get tableName() { return 'messages'; }
|
||||
tags() : Bookshelf.Collection<Tag> {
|
||||
return this.belongsToMany(Tag);
|
||||
}
|
||||
}
|
||||
|
||||
class Tag extends bookshelf.Model<Tag> {
|
||||
get tableName() { return 'tags'; }
|
||||
}
|
||||
|
||||
new User({}).where('id', 1).fetch({withRelated: ['posts.tags']})
|
||||
.then(user => {
|
||||
console.log(user.related('posts').toJSON());
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
// Associations
|
||||
|
||||
class Book extends bookshelf.Model<Book> {
|
||||
get tableName() { return 'books'; }
|
||||
summary() {
|
||||
return this.hasOne(Summary);
|
||||
}
|
||||
pages() {
|
||||
return this.hasMany(Pages);
|
||||
}
|
||||
authors() {
|
||||
return this.belongsToMany(Author);
|
||||
}
|
||||
}
|
||||
|
||||
class Summary extends bookshelf.Model<Summary> {
|
||||
get tableName() { return 'summaries'; }
|
||||
book() : Book {
|
||||
return this.belongsTo(Book);
|
||||
}
|
||||
}
|
||||
|
||||
class Pages extends bookshelf.Model<Pages> {
|
||||
get tableName() { return 'pages'; }
|
||||
book() {
|
||||
return this.belongsTo(Book);
|
||||
}
|
||||
}
|
||||
|
||||
class Author extends bookshelf.Model<Author> {
|
||||
get tableName() { return 'author'; }
|
||||
books() {
|
||||
return this.belongsToMany(Book);
|
||||
}
|
||||
}
|
||||
|
||||
class Site extends bookshelf.Model<Site> {
|
||||
get tableName() { return 'sites'; }
|
||||
photo() {
|
||||
return this.morphOne(Photo, 'imageable');
|
||||
}
|
||||
}
|
||||
|
||||
class Post extends bookshelf.Model<Post> {
|
||||
get tableName() { return 'posts'; }
|
||||
photos() {
|
||||
return this.morphMany(Photo, 'imageable');
|
||||
}
|
||||
}
|
||||
|
||||
class Photo extends bookshelf.Model<Photo> {
|
||||
get tableName() { return 'photos'; }
|
||||
imageable() {
|
||||
return this.morphTo('imageable', Site, Post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
Vendored
+313
@@ -0,0 +1,313 @@
|
||||
// Type definitions for bookshelfjs v0.8.2
|
||||
// Project: http://bookshelfjs.org/
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../lodash/lodash.d.ts" />
|
||||
/// <reference path="../knex/knex.d.ts" />
|
||||
|
||||
declare module 'bookshelf' {
|
||||
import knex = require('knex');
|
||||
import Promise = require('bluebird');
|
||||
import Lodash = require('lodash');
|
||||
|
||||
interface Bookshelf extends Bookshelf.Events<any> {
|
||||
VERSION : string;
|
||||
knex : knex;
|
||||
Model : typeof Bookshelf.Model;
|
||||
Collection : typeof Bookshelf.Collection;
|
||||
|
||||
transaction<T>(callback : (transaction : knex.Transaction) => T) : Promise<T>;
|
||||
}
|
||||
|
||||
function Bookshelf(knex : knex) : Bookshelf;
|
||||
|
||||
namespace Bookshelf {
|
||||
abstract class Events<T> {
|
||||
on(event? : string, callback? : EventFunction<T>, context? : any) : void;
|
||||
off(event? : string) : void;
|
||||
trigger(event? : string, ...args : any[]) : void;
|
||||
triggerThen(name : string, ...args : any[]) : Promise<any>;
|
||||
once(event : string, callback : EventFunction<T>, context? : any) : void;
|
||||
}
|
||||
|
||||
interface IModelBase {
|
||||
/** Should be declared as a getter instead of a plain property. */
|
||||
hasTimestamps? : boolean|string[];
|
||||
/** Should be declared as a getter instead of a plain property. Should be required, but cannot have abstract properties yet. */
|
||||
tableName? : string;
|
||||
}
|
||||
|
||||
abstract class ModelBase<T extends Model<any>> extends Events<T|Collection<T>> implements IModelBase {
|
||||
/** If overriding, must use a getter instead of a plain property. */
|
||||
idAttribute : string;
|
||||
|
||||
constructor(attributes? : any, options? : ModelOptions);
|
||||
|
||||
clear() : T;
|
||||
clone() : T;
|
||||
escape(attribute : string) : string;
|
||||
format(attributes : any) : any;
|
||||
get(attribute : string) : any;
|
||||
has(attribute : string) : boolean;
|
||||
hasChanged(attribute? : string) : boolean;
|
||||
isNew() : boolean;
|
||||
parse(response : any) : any;
|
||||
previousAttributes() : any;
|
||||
previous(attribute : string) : any;
|
||||
related<R extends Model<any>>(relation : string) : R | Collection<R>;
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
set(attribute?: {[key : string] : any}, options? : SetOptions) : T;
|
||||
set(attribute : string, value? : any, options? : SetOptions) : T;
|
||||
timestamp(options? : TimestampOptions) : any;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
unset(attribute : string) : T;
|
||||
|
||||
// lodash methods
|
||||
invert<R extends {}>() : R;
|
||||
keys() : string[];
|
||||
omit<R extends {}>(predicate? : Lodash.ObjectIterator<any, boolean>, thisArg? : any) : R;
|
||||
omit<R extends {}>(...attributes : string[]) : R;
|
||||
pairs() : any[][];
|
||||
pick<R extends {}>(predicate? : Lodash.ObjectIterator<any, boolean>, thisArg? : any) : R;
|
||||
pick<R extends {}>(...attributes : string[]) : R;
|
||||
values() : any[];
|
||||
}
|
||||
|
||||
class Model<T extends Model<any>> extends ModelBase<T> {
|
||||
static collection<T extends Model<any>>(models? : T[], options? : CollectionOptions<T>) : Collection<T>;
|
||||
static count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T extends Model<any>>(prototypeProperties? : any, classProperties? : any) : Function; // should return a type
|
||||
static fetchAll<T extends Model<any>>() : Promise<Collection<T>>;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
belongsTo<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
belongsToMany<R extends Model<any>>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection<R>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
destroy(options : SyncOptions) : void;
|
||||
fetch(options? : FetchOptions) : Promise<T>;
|
||||
fetchAll(options? : FetchAllOptions) : Promise<Collection<T>>;
|
||||
hasMany<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : Collection<R>;
|
||||
hasOne<R extends Model<any>>(target : {new(...args : any[]) : R}, foreignKey? : string) : R;
|
||||
load(relations : string|string[], options? : LoadOptions) : Promise<T>;
|
||||
morphMany<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : Collection<R>;
|
||||
morphOne<R extends Model<any>>(target : {new(...args : any[]) : R}, name? : string, columnNames? : string[], morphValue? : string) : R;
|
||||
morphTo(name : string, columnNames? : string[], ...target : typeof Model[]) : T;
|
||||
morphTo(name : string, ...target : typeof Model[]) : T;
|
||||
query(...query : string[]) : T;
|
||||
query(query : {[key : string] : any}) : T;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : T;
|
||||
query() : knex.QueryBuilder;
|
||||
refresh(options? : FetchOptions) : Promise<T>;
|
||||
resetQuery() : T;
|
||||
save(key? : string, val? : string, options? : SaveOptions) : Promise<T>;
|
||||
save(attrs? : {[key : string] : any}, options? : SaveOptions) : Promise<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
where(properties : {[key : string] : any}) : T;
|
||||
where(key : string, operatorOrValue : string|number|boolean, valueIfOperator? : string|number|boolean) : T;
|
||||
}
|
||||
|
||||
abstract class CollectionBase<T extends Model<any>> extends Events<T> {
|
||||
add(models : T[]|{[key : string] : any}[], options? : CollectionAddOptions) : Collection<T>;
|
||||
at(index : number) : T;
|
||||
clone() : Collection<T>;
|
||||
fetch(options? : CollectionFetchOptions) : Promise<Collection<T>>;
|
||||
findWhere(match : {[key : string] : any}) : T;
|
||||
get(id : any) : T;
|
||||
invokeThen(name : string, ...args : any[]) : Promise<any>;
|
||||
parse(response : any) : any;
|
||||
pluck(attribute : string) : any[];
|
||||
pop() : void;
|
||||
push(model : any) : Collection<T>;
|
||||
reduceThen<R>(iterator : (prev : R, cur : T, idx : number, array : T[]) => R, initialValue : R, context : any) : Promise<R>;
|
||||
remove(model : T, options? : EventOptions) : T;
|
||||
remove(model : T[], options? : EventOptions) : T[];
|
||||
reset(model : any[], options? : CollectionAddOptions) : T[];
|
||||
serialize(options? : SerializeOptions) : any;
|
||||
set(models : T[]|{[key : string] : any}[], options? : CollectionSetOptions) : Collection<T>;
|
||||
shift(options? : EventOptions) : void;
|
||||
slice(begin? : number, end? : number) : void;
|
||||
toJSON(options? : SerializeOptions) : any;
|
||||
unshift(model : any, options? : CollectionAddOptions) : void;
|
||||
where(match : {[key : string] : any}, firstOnly : boolean) : T|Collection<T>;
|
||||
|
||||
// lodash methods
|
||||
all(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
all<R extends {}>(predicate? : R) : boolean;
|
||||
any(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
any<R extends {}>(predicate? : R) : boolean;
|
||||
chain() : Lodash.LoDashExplicitObjectWrapper<T>;
|
||||
collect(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
collect<R extends {}>(predicate? : R) : T[];
|
||||
contains(value : any, fromIndex? : number) : boolean;
|
||||
countBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : Lodash.Dictionary<number>;
|
||||
countBy<R extends {}>(predicate? : R) : Lodash.Dictionary<number>;
|
||||
detect(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
detect<R extends {}>(predicate? : R) : T;
|
||||
difference(...values : T[]) : T[];
|
||||
drop(n? : number) : T[];
|
||||
each(callback? : Lodash.ListIterator<T, void>, thisArg? : any) : Lodash.List<T>;
|
||||
each(callback? : Lodash.DictionaryIterator<T, void>, thisArg? : any) : Lodash.Dictionary<T>;
|
||||
each(callback? : Lodash.ObjectIterator<T, void>, thisArg? : any) : T;
|
||||
every(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
every<R extends {}>(predicate? : R) : boolean;
|
||||
filter(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
filter<R extends {}>(predicate? : R) : T[];
|
||||
find(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
find<R extends {}>(predicate? : R) : T;
|
||||
first() : T;
|
||||
foldl<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
foldr<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
forEach(callback? : Lodash.ListIterator<T, void>, thisArg? : any) : Lodash.List<T>;
|
||||
forEach(callback? : Lodash.DictionaryIterator<T, void>, thisArg? : any) : Lodash.Dictionary<T>;
|
||||
forEach(callback? : Lodash.ObjectIterator<T, void>, thisArg? : any) : T;
|
||||
groupBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : Lodash.Dictionary<T[]>;
|
||||
groupBy<R extends {}>(predicate? : R) : Lodash.Dictionary<T[]>;
|
||||
head() : T;
|
||||
include(value : any, fromIndex? : number) : boolean;
|
||||
indexOf(value : any, fromIndex? : number) : number;
|
||||
initial() : T[];
|
||||
inject<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
invoke(methodName : string|Function, ...args : any[]) : any;
|
||||
isEmpty() : boolean;
|
||||
keys() : string[];
|
||||
last() : T;
|
||||
lastIndexOf(value : any, fromIndex? : number) : number;
|
||||
map(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
map<R extends {}>(predicate? : R) : T[];
|
||||
max(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
max<R extends {}>(predicate? : R) : T;
|
||||
min(predicate? : Lodash.ListIterator<T, boolean>|string, thisArg? : any) : T;
|
||||
min<R extends {}>(predicate? : R) : T;
|
||||
reduce<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
reduceRight<R>(callback? : Lodash.MemoIterator<T, R>, accumulator? : R, thisArg? : any) : R;
|
||||
reject(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
reject<R extends {}>(predicate? : R) : T[];
|
||||
rest() : T[];
|
||||
select(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
select<R extends {}>(predicate? : R) : T[];
|
||||
shuffle() : T[];
|
||||
size() : number;
|
||||
some(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : boolean;
|
||||
some<R extends {}>(predicate? : R) : boolean;
|
||||
sortBy(predicate? : Lodash.ListIterator<T, boolean>|Lodash.DictionaryIterator<T, boolean>|string, thisArg? : any) : T[];
|
||||
sortBy<R extends {}>(predicate? : R) : T[];
|
||||
tail() : T[];
|
||||
take(n? : number) : T[];
|
||||
toArray() : T[];
|
||||
without(...values : any[]) : T[];
|
||||
}
|
||||
|
||||
class Collection<T extends Model<any>> extends CollectionBase<T> {
|
||||
/** @deprecated use Typescript classes */
|
||||
static extend<T>(prototypeProperties? : any, classProperties? : any) : Function;
|
||||
/** @deprecated should use `new` objects instead. */
|
||||
static forge<T>(attributes? : any, options? : ModelOptions) : T;
|
||||
|
||||
attach(ids : any[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
count(column? : string, options? : SyncOptions) : Promise<number>;
|
||||
create(model : {[key : string] : any}, options? : CollectionCreateOptions) : Promise<T>;
|
||||
detach(ids : any[], options? : SyncOptions) : Promise<any>;
|
||||
fetchOne(options? : CollectionFetchOneOptions) : Promise<T>;
|
||||
load(relations : string|string[], options? : SyncOptions) : Promise<Collection<T>>;
|
||||
query(...query : string[]) : Collection<T>;
|
||||
query(query : {[key : string] : any}) : Collection<T>;
|
||||
query(callback : (qb : knex.QueryBuilder) => void) : Collection<T>;
|
||||
query() : knex.QueryBuilder;
|
||||
resetQuery() : Collection<T>;
|
||||
through<R extends Model<any>>(interim : typeof Model, throughForeignKey? : string, otherKey? : string) : R | Collection<R>;
|
||||
updatePivot(attributes : any, options? : PivotOptions) : Promise<number>;
|
||||
withPivot(columns : string[]) : Collection<T>;
|
||||
}
|
||||
|
||||
interface ModelOptions {
|
||||
tableName? : string;
|
||||
hasTimestamps? : boolean;
|
||||
parse? : boolean;
|
||||
}
|
||||
|
||||
interface LoadOptions extends SyncOptions {
|
||||
withRelated: string|any|any[];
|
||||
}
|
||||
|
||||
interface FetchOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
withRelated? : string|any|any[];
|
||||
}
|
||||
|
||||
interface FetchAllOptions extends SyncOptions {
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SaveOptions extends SyncOptions {
|
||||
method? : string;
|
||||
defaults? : string;
|
||||
patch? : boolean;
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface SerializeOptions {
|
||||
shallow? : boolean;
|
||||
omitPivot? : boolean;
|
||||
}
|
||||
|
||||
interface SetOptions {
|
||||
unset? : boolean;
|
||||
}
|
||||
|
||||
interface TimestampOptions {
|
||||
method? : string;
|
||||
}
|
||||
|
||||
interface SyncOptions {
|
||||
transacting? : knex.Transaction;
|
||||
debug? : boolean;
|
||||
}
|
||||
|
||||
interface CollectionOptions<T> {
|
||||
comparator? : boolean|string|((a : T, b : T) => number);
|
||||
}
|
||||
|
||||
interface CollectionAddOptions extends EventOptions {
|
||||
at? : number;
|
||||
merge? : boolean;
|
||||
}
|
||||
|
||||
interface CollectionFetchOptions {
|
||||
require? : boolean;
|
||||
withRelated? : string|string[];
|
||||
}
|
||||
|
||||
interface CollectionFetchOneOptions {
|
||||
require? : boolean;
|
||||
columns? : string|string[];
|
||||
}
|
||||
|
||||
interface CollectionSetOptions extends EventOptions {
|
||||
add? : boolean;
|
||||
remove? : boolean;
|
||||
merge?: boolean;
|
||||
}
|
||||
|
||||
interface PivotOptions {
|
||||
query? : Function|any;
|
||||
require? : boolean;
|
||||
}
|
||||
|
||||
interface EventOptions {
|
||||
silent? : boolean;
|
||||
}
|
||||
|
||||
interface EventFunction<T> {
|
||||
(model: T, attrs: any, options: any) : Promise<any>|void;
|
||||
}
|
||||
|
||||
interface CollectionCreateOptions extends ModelOptions, SyncOptions, CollectionAddOptions, SaveOptions {}
|
||||
}
|
||||
|
||||
export = Bookshelf;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/// <reference path="bootstrap-maxlength.d.ts"/>
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
// Examples from the projects github page
|
||||
$('input[maxlength]').maxlength();
|
||||
|
||||
$('input.className').maxlength({
|
||||
threshold: 20
|
||||
});
|
||||
|
||||
$('input.className').maxlength({
|
||||
alwaysShow: true,
|
||||
threshold: 10,
|
||||
warningClass: "label label-info",
|
||||
limitReachedClass: "label label-warning",
|
||||
placement: 'top',
|
||||
preText: 'used ',
|
||||
separator: ' of ',
|
||||
postText: ' chars.'
|
||||
});
|
||||
|
||||
$('input.className').maxlength({
|
||||
alwaysShow: true,
|
||||
threshold: 10,
|
||||
warningClass: "label label-info",
|
||||
limitReachedClass: "label label-warning",
|
||||
placement: 'top',
|
||||
message: 'used %charsTyped% of %charsTotal% chars.'
|
||||
});
|
||||
// Testing the events
|
||||
$('input.className').on('maxlength.shown', function(){
|
||||
console.log('shown');
|
||||
});
|
||||
$('input.className').on('maxlength.hidden', function(){
|
||||
console.log('hidden');
|
||||
});
|
||||
$('textarea').on('autosize.resized', function () {
|
||||
$(this).trigger('maxlength.reposition');
|
||||
});
|
||||
|
||||
|
||||
// using message string
|
||||
$('input.className').maxlength({
|
||||
message: 'used %charsTyped% of %charsTotal% chars.'
|
||||
});
|
||||
// using message function
|
||||
$('input.className').maxlength({
|
||||
threshold: 20,
|
||||
message: function (currentText, maxLength) {
|
||||
return '' + Math.ceil(currentText.length / 160) + ' SMS Message(s)';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// placement string
|
||||
$('input.className').maxlength({
|
||||
placement: 'top-left'
|
||||
});
|
||||
// placement object
|
||||
$('input.className').maxlength({
|
||||
placement: {
|
||||
top: 10,
|
||||
left: '30%'
|
||||
}
|
||||
});
|
||||
// placement function
|
||||
$('input.className').maxlength({
|
||||
placement: function (currentInput: JQuery, maxLengthIndicator: JQuery, currentInputPosition: BootstrapMaxlength.PositionParam) {
|
||||
}
|
||||
});
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
// Type definitions for bootstrap-maxlength v1.7.0
|
||||
// Project: https://github.com/mimo84/bootstrap-maxlength
|
||||
// Definitions by: Dan Manastireanu <https://github.com/danmana>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module BootstrapMaxlength {
|
||||
|
||||
/**
|
||||
* Possible options for the position of the counter. (passed to $.fn.css)
|
||||
*/
|
||||
interface PlacementOptions {
|
||||
/**
|
||||
* The top position of the counter (Number of pixels, or a px or percent string)
|
||||
*/
|
||||
top?: Number | string,
|
||||
/**
|
||||
* The right position of the counter (Number of pixels, or a px or percent string)
|
||||
*/
|
||||
right?: Number | string,
|
||||
/**
|
||||
* The bottom position of the counter (Number of pixels, or a px or percent string)
|
||||
*/
|
||||
bottom?: Number | string,
|
||||
/**
|
||||
* The left position of the counter (Number of pixels, or a px or percent string)
|
||||
*/
|
||||
left?: Number | string,
|
||||
/**
|
||||
* The positioning to use. For example 'relative', 'absolute'
|
||||
*/
|
||||
position?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Representation of the current input position
|
||||
*/
|
||||
interface PositionParam {
|
||||
top: Number,
|
||||
right: Number,
|
||||
bottom: Number,
|
||||
left: Number,
|
||||
width: Number,
|
||||
height: Number
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
/**
|
||||
* If true the threshold will be ignored and the remaining length indication will be always showing up while typing or on focus on the input
|
||||
* @default false
|
||||
*/
|
||||
alwaysShow?: Boolean,
|
||||
/**
|
||||
* This is a number indicating how many chars are left to start displaying the indications
|
||||
* @default 10
|
||||
*/
|
||||
threshold?: Number,
|
||||
/**
|
||||
* It's the class of the element with the indicator. By default is the bootstrap "label label-success" but can be changed to anything you'd like.
|
||||
* @default 'label label-success'
|
||||
*/
|
||||
warningClass?: string,
|
||||
/**
|
||||
* It's the class the element gets when the limit is reached. Default is "label label-important label-danger" (to support Bootstrap 2 and 3).
|
||||
* @default 'label label-important label-danger'
|
||||
*/
|
||||
limitReachedClass?: string,
|
||||
/**
|
||||
* Represents the separator between the number of typed chars and total number of available chars.
|
||||
* @default ' / '
|
||||
*/
|
||||
separator?: string,
|
||||
/**
|
||||
* Is a string of text that can be outputted in front of the indicator.
|
||||
* @default ''
|
||||
*/
|
||||
preText?: string,
|
||||
/**
|
||||
* Is a string outputted after the indicator.
|
||||
* @default ''
|
||||
*/
|
||||
postText?: string,
|
||||
/**
|
||||
* If false, will display just the number of typed characters, e.g. will not display the max length.
|
||||
* @default true
|
||||
*/
|
||||
showMaxLength?: Boolean,
|
||||
/**
|
||||
* If false, will display just the remaining length, e.g. will display remaining lenght instead of number of typed characters.
|
||||
* @default true
|
||||
*/
|
||||
showCharsTyped?: Boolean,
|
||||
/**
|
||||
* Is a string, define where to output the counter.
|
||||
* Options: bottom, left, top, right, bottom-right, top-right, top-left, bottom-left and centered-right
|
||||
* @default 'bottom'
|
||||
*/
|
||||
placement?: string | PlacementOptions | ((currentInput: JQuery, maxLengthIndicator: JQuery, currentInputPosition: PositionParam) => void),
|
||||
/**
|
||||
* Appends the maxlength indicator badge to the parent of the input rather than to the body.
|
||||
* @default false
|
||||
*/
|
||||
appendToParent?: boolean,
|
||||
/**
|
||||
* An alternative way to provide the message text.
|
||||
* String example: 'You have typed %charsTyped% chars, %charsRemaining% of %charsTotal% remaining'.
|
||||
* %charsTyped%, %charsRemaining% and %charsTotal% will be replaced by the actual values. This overrides the options separator, preText, postText and showMaxLength.
|
||||
* Alternatively you may supply a function that the current text and max length and returns the string to be displayed.
|
||||
* Function example: function(currentText, maxLength) { return '' + Math.ceil(currentText.length / 160) + ' SMS Message(s)'; }
|
||||
* @default null
|
||||
*/
|
||||
message?: string | ((currentText : string, maxLength: Number) => string),
|
||||
/**
|
||||
* If true the input will count using utf8 bytesize/encoding. For example: the '£' character is counted as two characters.
|
||||
* @default false
|
||||
*/
|
||||
utf8?: boolean,
|
||||
/**
|
||||
* Shows the badge as soon as it is added to the page, similar to alwaysShow
|
||||
* @default false
|
||||
*/
|
||||
showOnReady?: boolean,
|
||||
/**
|
||||
* Count linebreak as 2 characters to match IE/Chrome textarea validation. As well as DB storage.
|
||||
* @default true
|
||||
*/
|
||||
twoCharLinebreak?: boolean,
|
||||
/**
|
||||
* Allows a custom attribute to display indicator without triggering native maxlength behaviour.
|
||||
* Ignored if value greater than a native maxlength attribute.
|
||||
* 'overmax' class gets added when exceeded to allow user to implement form validation.
|
||||
* @default null (use the maxlength attribute and browser functionality)
|
||||
*/
|
||||
customMaxAttribute?: string,
|
||||
/**
|
||||
* Will allow the input to be over the customMaxLength. Useful in soft max situations.
|
||||
* @default false
|
||||
*/
|
||||
allowOverMax?: boolean,
|
||||
/**
|
||||
* If the browser doesn't support the maxlength attribute, attempt to type more than
|
||||
* the indicated chars, will be prevented.
|
||||
* @default false
|
||||
*/
|
||||
validate?: boolean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface JQuery {
|
||||
/** Apply the maxlength plugin on the selected elemens */
|
||||
maxlength(options?: BootstrapMaxlength.Options): JQuery;
|
||||
on(events: 'maxlength.shown', handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
on(events: 'maxlength.hidden', handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
trigger(eventType: 'maxlength.reposition', extraParameters?: any[]|Object): JQuery;
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/// <reference path="bootstrap-notify.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
|
||||
//Test for bootstrap-notify v3.1.3
|
||||
//Copied example directly from Bootstrap-notify site
|
||||
|
||||
|
||||
$.notify({
|
||||
// options
|
||||
icon: 'glyphicon glyphicon-warning-sign',
|
||||
@@ -48,5 +48,5 @@ $.notify({
|
||||
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
|
||||
'</div>' +
|
||||
'<a href="{3}" target="{4}" data-notify="url"></a>' +
|
||||
'</div>'
|
||||
'</div>'
|
||||
});
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="bootstrap-switch.d.ts" />
|
||||
|
||||
function test_cases() {
|
||||
$('#switch').bootstrapSwitch();
|
||||
|
||||
$('#switch').bootstrapSwitch({
|
||||
state: false
|
||||
});
|
||||
|
||||
$('#switch').bootstrapSwitch({
|
||||
state: false,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
//var mySwitch = $('#switch').get(0);
|
||||
//mySwitch.toggleAnimate();
|
||||
|
||||
$('#switch').bootstrapSwitch('state', true, true);
|
||||
|
||||
|
||||
$('#switch').on('switchChange.bootstrapSwitch', (event) => {
|
||||
console.log($(event.target).val());
|
||||
});
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
// Type definitions for Bootstrap Switch
|
||||
// Project: http://www.bootstrap-switch.org/
|
||||
// Definitions by: John M. Baughman <https://github.com/johnmbaughman>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* bootstrap-switch - v3.3.2 Copyright (c) 2012-2013 Mattia Larentis
|
||||
* Available via the Apache license.
|
||||
* see: http://www.bootstrap-switch.org/ or https://github.com/nostalgiaz/bootstrap-switch for details.
|
||||
*/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module BootstrapSwitch {
|
||||
interface BootstrapSwitchChangeEventObject extends JQueryEventObject {
|
||||
state: boolean
|
||||
}
|
||||
|
||||
interface BootstrapSwitchEventObject extends JQueryEventObject { }
|
||||
|
||||
interface BootstrapSwitchOptions {
|
||||
state?: boolean;
|
||||
size?: string;
|
||||
animate?: boolean;
|
||||
disabled?: boolean;
|
||||
readonly?: boolean;
|
||||
indeterminate?: boolean;
|
||||
invers?: boolean;
|
||||
radioAllOff?: boolean;
|
||||
onColor?: string;
|
||||
offColor?: string;
|
||||
onText?: string;
|
||||
offText?: string;
|
||||
labelText?: string;
|
||||
handleWidth?: string;
|
||||
labelWidth?: string;
|
||||
baseClass?: string;
|
||||
wrapperClass?: string;
|
||||
onInit?: any;
|
||||
onSwitchChange?: any;
|
||||
}
|
||||
|
||||
interface Switch {
|
||||
toggleAnimate(): JQuery;
|
||||
toggleDisabled(): JQuery;
|
||||
toggleReadonly(): JQuery;
|
||||
toggleIndeterminate(): JQuery;
|
||||
toggleInverse(): JQuery;
|
||||
destroy(): JQuery;
|
||||
|
||||
state(): boolean;
|
||||
state(value: any): JQuery;
|
||||
state(value: any, skip: boolean): JQuery;
|
||||
toggleState(skip?: boolean): JQuery;
|
||||
radioAllOff(): boolean;
|
||||
radioAllOff(state: boolean): JQuery;
|
||||
size(): string;
|
||||
size(size: string): JQuery;
|
||||
animate(): boolean;
|
||||
animate(state: boolean): JQuery;
|
||||
disabled(): boolean;
|
||||
disabled(state: boolean): JQuery;
|
||||
toggleDisabled(): JQuery;
|
||||
readonly(): boolean;
|
||||
readonly(state: boolean): JQuery;
|
||||
toggleReadOnly(): JQuery;
|
||||
onColor(): string;
|
||||
onColor(color: string): JQuery;
|
||||
offColor(): string;
|
||||
offColor(color: string): JQuery;
|
||||
onText(): string;
|
||||
onText(text: string): JQuery;
|
||||
offText(): string;
|
||||
offText(text: string): JQuery;
|
||||
labelText(): string;
|
||||
labelText(text: string): JQuery;
|
||||
baseClass(): string;
|
||||
baseClass(text: string): JQuery;
|
||||
wrapperClass(): string;
|
||||
wrapperClass(text: string): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
bootstrapSwitch(): JQuery;
|
||||
bootstrapSwitch(options: BootstrapSwitch.BootstrapSwitchOptions): JQuery;
|
||||
bootstrapSwitch(method: string): JQuery;
|
||||
bootstrapSwitch(method: string, param: any): JQuery;
|
||||
bootstrapSwitch(method: string, param1: any, param2: any): JQuery;
|
||||
|
||||
off(events: "init.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
off(events: "init.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
|
||||
off(events: "switchChange.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
off(events: "switchChange.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
|
||||
on(events: "init.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
on(events: "init.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
|
||||
on(events: "switchChange.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
on(events: "switchChange.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
}
|
||||
+2
-2
@@ -44,8 +44,8 @@ interface DatepickerEventObject extends JQueryEventObject {
|
||||
|
||||
interface JQuery {
|
||||
datepicker(): JQuery;
|
||||
datepicker(methodName: string): JQuery;
|
||||
datepicker(methodName: string, params: any): JQuery;
|
||||
datepicker(methodName: string): any;
|
||||
datepicker(methodName: string, params: any): any;
|
||||
datepicker(options: DatepickerOptions): JQuery;
|
||||
|
||||
off(events: "changeDate", selector?: string, handler?: (eventObject: DatepickerEventObject) => any): JQuery;
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
/// <reference path="./browser-sync.d.ts"/>
|
||||
import browserSync = require("browser-sync");
|
||||
|
||||
(() => {
|
||||
//make sure that the interfaces are correctly exposed
|
||||
var bsInstance: browserSync.BrowserSyncInstance;
|
||||
var bsStatic: browserSync.BrowserSyncStatic;
|
||||
var opts: browserSync.Options;
|
||||
})();
|
||||
|
||||
browserSync({
|
||||
server: {
|
||||
baseDir: "./"
|
||||
@@ -78,8 +85,8 @@ bs.init({
|
||||
});
|
||||
|
||||
bs.reload();
|
||||
|
||||
function browserSyncInit() {
|
||||
|
||||
function browserSyncInit(): browserSync.BrowserSyncInstance {
|
||||
var browser = browserSync.create();
|
||||
browser.init();
|
||||
console.log(browser.name);
|
||||
|
||||
Vendored
+398
-396
@@ -11,404 +11,406 @@ declare module "browser-sync" {
|
||||
import fs = require("fs");
|
||||
import http = require("http");
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls
|
||||
* all devices, push sync updates and much more.
|
||||
*
|
||||
* port - Default: 3001
|
||||
* weinre.port - Default: 8080
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
ui?: UIOptions;
|
||||
/**
|
||||
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
|
||||
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
|
||||
* patterns.
|
||||
* Default: false
|
||||
*/
|
||||
files?: string | string[];
|
||||
/**
|
||||
* File watching options that get passed along to Chokidar. Check their docs for available options
|
||||
* Default: undefined
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
watchOptions?: ChokidarOptions;
|
||||
/**
|
||||
* Use the built-in static server for basic HTML/JS/CSS websites.
|
||||
* Default: false
|
||||
*/
|
||||
server?: ServerOptions;
|
||||
/**
|
||||
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
|
||||
* target - Default: undefined
|
||||
* ws - Default: undefined
|
||||
* middleware - Default: undefined
|
||||
* reqHeaders - Default: undefined
|
||||
* proxyRes - Default: undefined
|
||||
*/
|
||||
proxy?: string | boolean | ProxyOptions;
|
||||
/**
|
||||
* Use a specific port (instead of the one auto-detected by Browsersync)
|
||||
* Default: 3000
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* Add additional directories from which static files should be served.
|
||||
* Should only be used in proxy or snippet mode.
|
||||
* Default: []
|
||||
* Note: requires at least version 2.8.0
|
||||
*/
|
||||
serveStatic?: string[];
|
||||
/**
|
||||
* Enable https for localhost development.
|
||||
* Note - this is not needed for proxy option as it will be inferred from your target url.
|
||||
* Note: requires at least version 1.3.0
|
||||
*/
|
||||
https?: boolean;
|
||||
/**
|
||||
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
|
||||
* clicks - Default: true
|
||||
* scroll - Default: true
|
||||
* forms - Default: true
|
||||
*/
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
/**
|
||||
* Can be either "info", "debug", "warn", or "silent"
|
||||
* Default: info
|
||||
*/
|
||||
logLevel?: string;
|
||||
/**
|
||||
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
|
||||
* Default: BS
|
||||
* Note: requires at least version 1.5.1
|
||||
*/
|
||||
logPrefix?: string;
|
||||
/**
|
||||
* Whether or not to log connections
|
||||
* Default: false
|
||||
*/
|
||||
logConnections?: boolean;
|
||||
/**
|
||||
* Whether or not to log information about changed files
|
||||
* Default: false
|
||||
*/
|
||||
logFileChanges?: boolean;
|
||||
/**
|
||||
* Log the snippet to the console when you're in snippet mode (no proxy/server)
|
||||
* Default: true
|
||||
* Note: requires at least version 1.5.2
|
||||
*/
|
||||
logSnippet?: boolean;
|
||||
/**
|
||||
* You can control how the snippet is injected onto each page via a custom regex + function.
|
||||
* You can also provide patterns for certain urls that should be ignored from the snippet injection.
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
snippetOptions?: SnippetOptions;
|
||||
/**
|
||||
* Add additional HTML rewriting rules.
|
||||
* Default: false
|
||||
* Note: requires at least version 2.4.0
|
||||
*/
|
||||
rewriteRules?: boolean | RewriteRules[];
|
||||
/**
|
||||
* Tunnel the Browsersync server through a random Public URL
|
||||
* Default: null
|
||||
*/
|
||||
tunnel?: string | boolean;
|
||||
/**
|
||||
* Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're
|
||||
* working offline, you can reduce start-up time by setting this option to false
|
||||
*/
|
||||
online?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
|
||||
* Can be true, local, external, ui, ui-external, tunnel or false
|
||||
*/
|
||||
open?: string | boolean;
|
||||
/**
|
||||
* The browser(s) to open
|
||||
* Default: default
|
||||
*/
|
||||
browser?: string | string[];
|
||||
/**
|
||||
* Requires an internet connection - useful for services such as Typekit as it allows you to configure
|
||||
* domains such as *.xip.io in your kit settings
|
||||
* Default: false
|
||||
*/
|
||||
xip?: boolean;
|
||||
/**
|
||||
* Reload each browser when Browsersync is restarted.
|
||||
* Default: false
|
||||
*/
|
||||
reloadOnRestart?: boolean;
|
||||
/**
|
||||
* The small pop-over notifications in the browser are not always needed/wanted.
|
||||
* Default: true
|
||||
*/
|
||||
notify?: boolean;
|
||||
/**
|
||||
* scrollProportionally: false // Sync viewports to TOP position
|
||||
* Default: true
|
||||
*/
|
||||
scrollProportionally?: boolean
|
||||
/**
|
||||
* How often to send scroll events
|
||||
* Default: 0
|
||||
*/
|
||||
scrollThrottle?: number;
|
||||
/**
|
||||
* Decide which technique should be used to restore scroll position following a reload.
|
||||
* Can be window.name or cookie
|
||||
* Default: 'window.name'
|
||||
*/
|
||||
scrollRestoreTechnique?: string;
|
||||
/**
|
||||
* Sync the scroll position of any element on the page. Add any amount of CSS selectors
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
*/
|
||||
scrollElements?: string[];
|
||||
/**
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
* Sync the scroll position of any element on the page - where any scrolled element will cause
|
||||
* all others to match scroll position. This is helpful when a breakpoint alters which element
|
||||
* is actually scrolling
|
||||
*/
|
||||
scrollElementMapping?: string[];
|
||||
/**
|
||||
* Time, in milliseconds, to wait before instructing the browser to reload/inject following a file change event
|
||||
* Default: 0
|
||||
*/
|
||||
reloadDelay?: number;
|
||||
/**
|
||||
* Restrict the frequency in which browser:reload events can be emitted to connected clients
|
||||
* Default: 0
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
reloadDebounce?: number;
|
||||
/**
|
||||
* User provided plugins
|
||||
* Default: []
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Whether to inject changes (rather than a page refresh)
|
||||
* Default: true
|
||||
*/
|
||||
injectChanges?: boolean;
|
||||
/**
|
||||
* The initial path to load
|
||||
*/
|
||||
startPath?: string;
|
||||
/**
|
||||
* Whether to minify the client script
|
||||
* Default: true
|
||||
*/
|
||||
minify?: boolean;
|
||||
/**
|
||||
* Override host detection if you know the correct IP to use
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* Send file-change events to the browser
|
||||
* Default: true
|
||||
*/
|
||||
codeSync?: boolean;
|
||||
/**
|
||||
* Append timestamps to injected files
|
||||
* Default: true
|
||||
*/
|
||||
timestamps?: boolean;
|
||||
/**
|
||||
* Alter the script path for complete control over where the Browsersync Javascript is served
|
||||
* from. Whatever you return from this function will be used as the script path.
|
||||
* Note: requires at least version 1.5.0
|
||||
*/
|
||||
scriptPath?: (path: string) => string;
|
||||
/**
|
||||
* Configure the Socket.IO path and namespace & domain to avoid collisions.
|
||||
* path - Default: "/browser-sync/socket.io"
|
||||
* clientPath - Default: "/browser-sync"
|
||||
* namespace - Default: "/browser-sync"
|
||||
* domain - Default: undefined
|
||||
* port - Default: undefined
|
||||
* clients.heartbeatTimeout - Default: 5000
|
||||
* Note: requires at least version 1.6.2
|
||||
*/
|
||||
socket?: SocketOptions;
|
||||
}
|
||||
|
||||
interface Hash<T> {
|
||||
[path: string]: T;
|
||||
}
|
||||
|
||||
interface ChokidarOptions {
|
||||
interval?: number;
|
||||
debounceDelay?: number;
|
||||
mode?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface UIOptions {
|
||||
/** set the default port */
|
||||
port?: number;
|
||||
/** set the default weinre port */
|
||||
weinre?: {
|
||||
namespace browserSync {
|
||||
interface Options {
|
||||
/**
|
||||
* Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls
|
||||
* all devices, push sync updates and much more.
|
||||
*
|
||||
* port - Default: 3001
|
||||
* weinre.port - Default: 8080
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
ui?: UIOptions;
|
||||
/**
|
||||
* Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS
|
||||
* & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob
|
||||
* patterns.
|
||||
* Default: false
|
||||
*/
|
||||
files?: string | string[];
|
||||
/**
|
||||
* File watching options that get passed along to Chokidar. Check their docs for available options
|
||||
* Default: undefined
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
watchOptions?: ChokidarOptions;
|
||||
/**
|
||||
* Use the built-in static server for basic HTML/JS/CSS websites.
|
||||
* Default: false
|
||||
*/
|
||||
server?: ServerOptions;
|
||||
/**
|
||||
* Proxy an EXISTING vhost. Browsersync will wrap your vhost with a proxy URL to view your site.
|
||||
* target - Default: undefined
|
||||
* ws - Default: undefined
|
||||
* middleware - Default: undefined
|
||||
* reqHeaders - Default: undefined
|
||||
* proxyRes - Default: undefined
|
||||
*/
|
||||
proxy?: string | boolean | ProxyOptions;
|
||||
/**
|
||||
* Use a specific port (instead of the one auto-detected by Browsersync)
|
||||
* Default: 3000
|
||||
*/
|
||||
port?: number;
|
||||
};
|
||||
/**
|
||||
* Add additional directories from which static files should be served.
|
||||
* Should only be used in proxy or snippet mode.
|
||||
* Default: []
|
||||
* Note: requires at least version 2.8.0
|
||||
*/
|
||||
serveStatic?: string[];
|
||||
/**
|
||||
* Enable https for localhost development.
|
||||
* Note - this is not needed for proxy option as it will be inferred from your target url.
|
||||
* Note: requires at least version 1.3.0
|
||||
*/
|
||||
https?: boolean;
|
||||
/**
|
||||
* Clicks, Scrolls & Form inputs on any device will be mirrored to all others.
|
||||
* clicks - Default: true
|
||||
* scroll - Default: true
|
||||
* forms - Default: true
|
||||
*/
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
/**
|
||||
* Can be either "info", "debug", "warn", or "silent"
|
||||
* Default: info
|
||||
*/
|
||||
logLevel?: string;
|
||||
/**
|
||||
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
|
||||
* Default: BS
|
||||
* Note: requires at least version 1.5.1
|
||||
*/
|
||||
logPrefix?: string;
|
||||
/**
|
||||
* Whether or not to log connections
|
||||
* Default: false
|
||||
*/
|
||||
logConnections?: boolean;
|
||||
/**
|
||||
* Whether or not to log information about changed files
|
||||
* Default: false
|
||||
*/
|
||||
logFileChanges?: boolean;
|
||||
/**
|
||||
* Log the snippet to the console when you're in snippet mode (no proxy/server)
|
||||
* Default: true
|
||||
* Note: requires at least version 1.5.2
|
||||
*/
|
||||
logSnippet?: boolean;
|
||||
/**
|
||||
* You can control how the snippet is injected onto each page via a custom regex + function.
|
||||
* You can also provide patterns for certain urls that should be ignored from the snippet injection.
|
||||
* Note: requires at least version 2.0.0
|
||||
*/
|
||||
snippetOptions?: SnippetOptions;
|
||||
/**
|
||||
* Add additional HTML rewriting rules.
|
||||
* Default: false
|
||||
* Note: requires at least version 2.4.0
|
||||
*/
|
||||
rewriteRules?: boolean | RewriteRules[];
|
||||
/**
|
||||
* Tunnel the Browsersync server through a random Public URL
|
||||
* Default: null
|
||||
*/
|
||||
tunnel?: string | boolean;
|
||||
/**
|
||||
* Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're
|
||||
* working offline, you can reduce start-up time by setting this option to false
|
||||
*/
|
||||
online?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
|
||||
* Can be true, local, external, ui, ui-external, tunnel or false
|
||||
*/
|
||||
open?: string | boolean;
|
||||
/**
|
||||
* The browser(s) to open
|
||||
* Default: default
|
||||
*/
|
||||
browser?: string | string[];
|
||||
/**
|
||||
* Requires an internet connection - useful for services such as Typekit as it allows you to configure
|
||||
* domains such as *.xip.io in your kit settings
|
||||
* Default: false
|
||||
*/
|
||||
xip?: boolean;
|
||||
/**
|
||||
* Reload each browser when Browsersync is restarted.
|
||||
* Default: false
|
||||
*/
|
||||
reloadOnRestart?: boolean;
|
||||
/**
|
||||
* The small pop-over notifications in the browser are not always needed/wanted.
|
||||
* Default: true
|
||||
*/
|
||||
notify?: boolean;
|
||||
/**
|
||||
* scrollProportionally: false // Sync viewports to TOP position
|
||||
* Default: true
|
||||
*/
|
||||
scrollProportionally?: boolean
|
||||
/**
|
||||
* How often to send scroll events
|
||||
* Default: 0
|
||||
*/
|
||||
scrollThrottle?: number;
|
||||
/**
|
||||
* Decide which technique should be used to restore scroll position following a reload.
|
||||
* Can be window.name or cookie
|
||||
* Default: 'window.name'
|
||||
*/
|
||||
scrollRestoreTechnique?: string;
|
||||
/**
|
||||
* Sync the scroll position of any element on the page. Add any amount of CSS selectors
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
*/
|
||||
scrollElements?: string[];
|
||||
/**
|
||||
* Default: []
|
||||
* Note: requires at least version 2.9.0
|
||||
* Sync the scroll position of any element on the page - where any scrolled element will cause
|
||||
* all others to match scroll position. This is helpful when a breakpoint alters which element
|
||||
* is actually scrolling
|
||||
*/
|
||||
scrollElementMapping?: string[];
|
||||
/**
|
||||
* Time, in milliseconds, to wait before instructing the browser to reload/inject following a file
|
||||
* change event
|
||||
* Default: 0
|
||||
*/
|
||||
reloadDelay?: number;
|
||||
/**
|
||||
* Restrict the frequency in which browser:reload events can be emitted to connected clients
|
||||
* Default: 0
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
reloadDebounce?: number;
|
||||
/**
|
||||
* User provided plugins
|
||||
* Default: []
|
||||
* Note: requires at least version 2.6.0
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Whether to inject changes (rather than a page refresh)
|
||||
* Default: true
|
||||
*/
|
||||
injectChanges?: boolean;
|
||||
/**
|
||||
* The initial path to load
|
||||
*/
|
||||
startPath?: string;
|
||||
/**
|
||||
* Whether to minify the client script
|
||||
* Default: true
|
||||
*/
|
||||
minify?: boolean;
|
||||
/**
|
||||
* Override host detection if you know the correct IP to use
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* Send file-change events to the browser
|
||||
* Default: true
|
||||
*/
|
||||
codeSync?: boolean;
|
||||
/**
|
||||
* Append timestamps to injected files
|
||||
* Default: true
|
||||
*/
|
||||
timestamps?: boolean;
|
||||
/**
|
||||
* Alter the script path for complete control over where the Browsersync Javascript is served
|
||||
* from. Whatever you return from this function will be used as the script path.
|
||||
* Note: requires at least version 1.5.0
|
||||
*/
|
||||
scriptPath?: (path: string) => string;
|
||||
/**
|
||||
* Configure the Socket.IO path and namespace & domain to avoid collisions.
|
||||
* path - Default: "/browser-sync/socket.io"
|
||||
* clientPath - Default: "/browser-sync"
|
||||
* namespace - Default: "/browser-sync"
|
||||
* domain - Default: undefined
|
||||
* port - Default: undefined
|
||||
* clients.heartbeatTimeout - Default: 5000
|
||||
* Note: requires at least version 1.6.2
|
||||
*/
|
||||
socket?: SocketOptions;
|
||||
}
|
||||
|
||||
interface Hash<T> {
|
||||
[path: string]: T;
|
||||
}
|
||||
|
||||
interface ChokidarOptions {
|
||||
interval?: number;
|
||||
debounceDelay?: number;
|
||||
mode?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface UIOptions {
|
||||
/** set the default port */
|
||||
port?: number;
|
||||
/** set the default weinre port */
|
||||
weinre?: {
|
||||
port?: number;
|
||||
};
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
/** set base directory */
|
||||
baseDir?: string | string[];
|
||||
/** enable directory listing */
|
||||
directory?: boolean;
|
||||
/** set index filename */
|
||||
index?: string;
|
||||
/**
|
||||
* key-value object hash, where the key is the url to match,
|
||||
* and the value is the folder to serve (relative to your working directory)
|
||||
*/
|
||||
routes?: Hash<string>;
|
||||
/** configure custom middleware */
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface ProxyOptions {
|
||||
target?: string;
|
||||
middleware?: MiddlewareHandler;
|
||||
ws: boolean;
|
||||
reqHeaders: (config: any) => Hash<any>;
|
||||
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any };
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
domain?: string;
|
||||
port?: number;
|
||||
clients?: { heartbeatTimeout?: number; };
|
||||
}
|
||||
|
||||
interface RewriteRules {
|
||||
match: RegExp;
|
||||
fn: (match: string) => string;
|
||||
}
|
||||
|
||||
interface BrowserSyncStatic extends BrowserSyncInstance {
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Create a Browsersync instance
|
||||
* @param name an identifier that can used for retrieval later
|
||||
*/
|
||||
create(name?: string): BrowserSyncInstance;
|
||||
/**
|
||||
* Get a single instance by name. This is useful if you have your build scripts in separate files
|
||||
* @param name the identifier used for retrieval
|
||||
*/
|
||||
get(name: string): BrowserSyncInstance;
|
||||
}
|
||||
|
||||
interface BrowserSyncInstance {
|
||||
/** the name of this instance of browser-sync */
|
||||
name: string;
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Reload the browser
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(): void;
|
||||
/**
|
||||
* Reload a single file
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(file: string): void;
|
||||
/**
|
||||
* Reload multiple files
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(files: string[]): void;
|
||||
/**
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(options: { stream: boolean }): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* The stream method returns a transform stream and can act once or on many files.
|
||||
* @param opts Configuration for the stream method
|
||||
*/
|
||||
stream(opts: { once: boolean }): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* Helper method for browser notifications
|
||||
* @param message Can be a simple message such as 'Connected' or HTML
|
||||
* @param timeout How long the message will remain in the browser. @since 1.3.0
|
||||
*/
|
||||
notify(message: string, timeout?: number): void;
|
||||
/**
|
||||
* This method will close any running server, stop file watching & exit the current process.
|
||||
*/
|
||||
exit(): void;
|
||||
/**
|
||||
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
|
||||
*/
|
||||
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
|
||||
: NodeJS.EventEmitter;
|
||||
/**
|
||||
* Method to pause file change events
|
||||
*/
|
||||
pause(): void;
|
||||
/**
|
||||
* Method to resume paused watchers
|
||||
*/
|
||||
resume(): void;
|
||||
/**
|
||||
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
|
||||
* this to emit your own events, such as changed files, logging etc.
|
||||
*/
|
||||
emitter: NodeJS.EventEmitter;
|
||||
/**
|
||||
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
|
||||
*/
|
||||
active: boolean;
|
||||
/**
|
||||
* A simple true/false flag to determine if the current instance is paused
|
||||
*/
|
||||
paused: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
/** set base directory */
|
||||
baseDir?: string | string[];
|
||||
/** enable directory listing */
|
||||
directory?: boolean;
|
||||
/** set index filename */
|
||||
index?: string;
|
||||
/**
|
||||
* key-value object hash, where the key is the url to match,
|
||||
* and the value is the folder to serve (relative to your working directory)
|
||||
* */
|
||||
routes?: Hash<string>;
|
||||
/** configure custom middleware */
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface ProxyOptions {
|
||||
target?: string;
|
||||
middleware?: MiddlewareHandler;
|
||||
ws: boolean;
|
||||
reqHeaders: (config: any) => Hash<any>;
|
||||
proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any;
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
domain?: string;
|
||||
port?: number;
|
||||
clients?: { heartbeatTimeout?: number; };
|
||||
}
|
||||
|
||||
interface RewriteRules {
|
||||
match: RegExp;
|
||||
fn: (match: string) => string;
|
||||
}
|
||||
|
||||
interface BrowserSyncStatic extends BrowserSyncInstance {
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Create a Browsersync instance
|
||||
* @param name an identifier that can used for retrieval later
|
||||
*/
|
||||
create(name?: string): BrowserSyncInstance;
|
||||
/**
|
||||
* Get a single instance by name. This is useful if you have your build scripts in separate files
|
||||
* @param name the identifier used for retrieval
|
||||
*/
|
||||
get(name: string): BrowserSyncInstance;
|
||||
}
|
||||
|
||||
interface BrowserSyncInstance {
|
||||
/** the name of this instance of browser-sync */
|
||||
name: string;
|
||||
/**
|
||||
* Start the Browsersync service. This will launch a server, proxy or start the snippet mode
|
||||
* depending on your use-case.
|
||||
*/
|
||||
init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
* Reload the browser
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(): void;
|
||||
/**
|
||||
* Reload a single file
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(file: string): void;
|
||||
/**
|
||||
* Reload multiple files
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(files: string[]): void;
|
||||
/**
|
||||
* The reload method will inform all browsers about changed files and will either cause the browser
|
||||
* to refresh, or inject the files where possible.
|
||||
*/
|
||||
reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* The stream method returns a transform stream and can act once or on many files.
|
||||
* @param opts Configuration for the stream method
|
||||
*/
|
||||
stream(opts: {once: boolean}): NodeJS.ReadWriteStream;
|
||||
/**
|
||||
* Helper method for browser notifications
|
||||
* @param message Can be a simple message such as 'Connected' or HTML
|
||||
* @param timeout How long the message will remain in the browser. @since 1.3.0
|
||||
*/
|
||||
notify(message: string, timeout?: number): void;
|
||||
/**
|
||||
* This method will close any running server, stop file watching & exit the current process.
|
||||
*/
|
||||
exit(): void;
|
||||
/**
|
||||
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
|
||||
*/
|
||||
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
|
||||
: NodeJS.EventEmitter;
|
||||
/**
|
||||
* Method to pause file change events
|
||||
*/
|
||||
pause(): void;
|
||||
/**
|
||||
* Method to resume paused watchers
|
||||
*/
|
||||
resume(): void;
|
||||
/**
|
||||
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
|
||||
* this to emit your own events, such as changed files, logging etc.
|
||||
*/
|
||||
emitter: NodeJS.EventEmitter;
|
||||
/**
|
||||
* A simple true/false flag that you can use to determine if there's a currently-running Browsersync instance.
|
||||
*/
|
||||
active: boolean;
|
||||
/**
|
||||
* A simple true/false flag to determine if the current instance is paused
|
||||
*/
|
||||
paused: boolean;
|
||||
}
|
||||
|
||||
const browserSync: BrowserSyncStatic;
|
||||
|
||||
const browserSync: browserSync.BrowserSyncStatic;
|
||||
export = browserSync;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="./bytes.d.ts"/>
|
||||
|
||||
import bytes = require('bytes');
|
||||
|
||||
// 1024*1024 = 1048576
|
||||
console.log(bytes(104857));
|
||||
console.log(bytes(104857, { thousandsSeparator: ' ' }));
|
||||
|
||||
console.log(bytes.format(104857));
|
||||
console.log(bytes.format(104857, { thousandsSeparator: ' ' }));
|
||||
|
||||
console.log(bytes('1024kb'));
|
||||
console.log(bytes(1024));
|
||||
|
||||
console.log(bytes.parse('1024kb'));
|
||||
console.log(bytes.parse(1024));
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
// Type definitions for bytes v2.1.0
|
||||
// Project: https://github.com/visionmedia/bytes.js
|
||||
// Definitions by: Zhiyuan Wang <https://github.com/danny8002/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'bytes' {
|
||||
|
||||
/**
|
||||
*Convert the given value in bytes into a string.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {{
|
||||
* thousandsSeparator: [string]
|
||||
* }} [options] bytes options.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
function bytes(value: number, options?: { thousandsSeparator: string }): string;
|
||||
|
||||
/**
|
||||
*Parse string to an integer in bytes.
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {number}
|
||||
*/
|
||||
function bytes(value: string): number;
|
||||
|
||||
module bytes {
|
||||
|
||||
/**
|
||||
* Format the given value in bytes into a string.
|
||||
*
|
||||
* If the value is negative, take Math.abs(). If it is a float,
|
||||
* it is rounded.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {BytesFormatOptions} [options]
|
||||
*/
|
||||
|
||||
function format(value: number, options?: { thousandsSeparator: string }): string;
|
||||
|
||||
/**
|
||||
* Just return the input number value.
|
||||
*
|
||||
* @param {number} value
|
||||
* @return {number}
|
||||
*/
|
||||
function parse(value: number): number;
|
||||
|
||||
/**
|
||||
* Parse the string value into an integer in bytes.
|
||||
*
|
||||
* If no unit is given, it is assumed the value is in bytes.
|
||||
*
|
||||
* @param {string} value
|
||||
* @return {number}
|
||||
*/
|
||||
function parse(value: string): number;
|
||||
}
|
||||
|
||||
export = bytes;
|
||||
}
|
||||
Vendored
+8
-8
@@ -177,7 +177,7 @@ declare module c3 {
|
||||
* Set threshold to show/hide labels.
|
||||
*/
|
||||
threshold?: number
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Enable or disable expanding pie pieces.
|
||||
*/
|
||||
@@ -198,7 +198,7 @@ declare module c3 {
|
||||
* Set threshold to show/hide labels.
|
||||
*/
|
||||
threshold?: number
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Enable or disable expanding pie pieces.
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ declare module c3 {
|
||||
* Set formatter for the label on gauge.
|
||||
*/
|
||||
format?: (value: any, ratio: number) => string;
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Enable or disable expanding gauge.
|
||||
*/
|
||||
@@ -686,7 +686,7 @@ declare module c3 {
|
||||
/**
|
||||
* Set custom position for the tooltip. This option can be used to modify the tooltip position by returning object that has top and left.
|
||||
*/
|
||||
position?: (data: any, width: number, height: number, element: any) => { top: number, left: number };
|
||||
position?: (data: any, width: number, height: number, element: any) => { top: number; left: number };
|
||||
/**
|
||||
* Set custom HTML for the tooltip.
|
||||
* Specified function receives data, defaultTitleFormat, defaultValueFormat and color of the data point to show. If tooltip.grouped is true, data includes multiple data points.
|
||||
@@ -909,7 +909,7 @@ declare module c3 {
|
||||
* Remove regions. This API removes regions.
|
||||
* @param args This argument should include classes. If classes is given, the regions that have one of the specified classes will be removed. If args is not given, all of regions will be removed.
|
||||
*/
|
||||
remove(args?: { value?: number | string, class?: string }): void;
|
||||
remove(args?: { value?: number | string; class?: string }): void;
|
||||
};
|
||||
|
||||
data: {
|
||||
@@ -995,7 +995,7 @@ declare module c3 {
|
||||
* Get and set axis min and max value.
|
||||
* @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
|
||||
*/
|
||||
range(range?: { min?: number | { [key: string]: number }, max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }, max: number | { [key: string]: number } }
|
||||
range(range?: { min?: number | { [key: string]: number }; max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } }
|
||||
};
|
||||
|
||||
legend: {
|
||||
@@ -1034,7 +1034,7 @@ declare module c3 {
|
||||
* Resize the chart. If no size is specified it will resize to fit.
|
||||
* @param size This argument should include width and height in pixels.
|
||||
*/
|
||||
resize(size?: { width?: number, height?: number }): void;
|
||||
resize(size?: { width?: number; height?: number }): void;
|
||||
|
||||
/**
|
||||
* Force to redraw.
|
||||
@@ -1062,7 +1062,7 @@ declare module c3 {
|
||||
* Remove x/y grid lines. This API removes x/y grid lines.
|
||||
* @param args This argument should include value or class. If value is given, the x/y grid lines that have specified x/y value will be removed. If class is given, the x/y grid lines that have specified class will be removed. If args is not given, all of x/y grid lines will be removed.
|
||||
*/
|
||||
remove(args?: { class?: string, value?: number | string }): void;
|
||||
remove(args?: { class?: string; value?: number | string }): void;
|
||||
}
|
||||
|
||||
export function generate(config: ChartConfiguration): ChartAPI;
|
||||
|
||||
+1
@@ -8,6 +8,7 @@
|
||||
|
||||
declare module 'chai-as-promised' {
|
||||
function chaiAsPromised(chai: any, utils: any): void;
|
||||
namespace chaiAsPromised {}
|
||||
export = chaiAsPromised;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,3 +34,6 @@ chance.mixin({
|
||||
});
|
||||
|
||||
var timeString: string = chance.time();
|
||||
|
||||
var chanceConstructedWithSeed100 = new Chance(100);
|
||||
var chanceCalledWithSeed100 = Chance()
|
||||
Vendored
+9
-1
@@ -5,7 +5,10 @@
|
||||
declare module Chance {
|
||||
|
||||
interface ChanceStatic {
|
||||
Chance(): Chance;
|
||||
(): Chance
|
||||
(seed: number): Chance
|
||||
(generator: () => any): Chance
|
||||
|
||||
new(): Chance;
|
||||
new(seed: number): Chance;
|
||||
new(generator: () => any): Chance;
|
||||
@@ -209,5 +212,10 @@ declare var Chance: Chance.ChanceStatic;
|
||||
|
||||
// import Chance = require('chance');
|
||||
declare module 'chance' {
|
||||
interface ExportedChance extends Chance.ChanceStatic {
|
||||
Chance: ExportedChance;
|
||||
}
|
||||
var Chance: ExportedChance;
|
||||
|
||||
export = Chance;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="closure-compiler.d.ts"/>
|
||||
import {compile} from 'closure-compiler';
|
||||
|
||||
compile('some.source()', {'check-only': null},
|
||||
(err: Error, stdout: string, stderr: string): void => {
|
||||
console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
|
||||
});
|
||||
|
||||
// No options, Callback wins.
|
||||
compile('some.source()', (err: Error, stdout: string, stderr: string): void => {
|
||||
console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
|
||||
});
|
||||
|
||||
compile(null, {'js': ['a/f.js', 'a/f2.js'], 'check-only': null},
|
||||
(err: Error, stdout: string, stderr: string): void => {
|
||||
console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
|
||||
});
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for closure-compiler
|
||||
// Project: https://github.com/tim-smart/node-closure/
|
||||
// Definitions by: Martin Probst <https://github.com/mprobst>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'closure-compiler' {
|
||||
type Callback = (err: Error, stdout: string, stderr: string) => any;
|
||||
function compile(src: string, callback: Callback): void;
|
||||
function compile(src: string, options: {[k: string]: string | string[]},
|
||||
callback: Callback): void;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/// <reference path="./connect-livereload.d.ts" />
|
||||
|
||||
import * as connect from "connect";
|
||||
import * as livereload from "connect-livereload";
|
||||
|
||||
const app = connect();
|
||||
|
||||
// With no options
|
||||
app.use(livereload());
|
||||
|
||||
// With string options
|
||||
app.use(livereload({
|
||||
port: 35729,
|
||||
ignore: [".js", ".svg"]
|
||||
}));
|
||||
|
||||
// With RegExp options
|
||||
app.use(livereload({
|
||||
port: 35729,
|
||||
ignore: [/\.js(\?.*)?$/, /\.css(\?.*)?$/]
|
||||
}));
|
||||
|
||||
// With default options
|
||||
app.use(livereload({
|
||||
ignore: [
|
||||
/\.js(\?.*)?$/, /\.css(\?.*)?$/, /\.svg(\?.*)?$/, /\.ico(\?.*)?$/, /\.woff(\?.*)?$/,
|
||||
/\.png(\?.*)?$/, /\.jpg(\?.*)?$/, /\.jpeg(\?.*)?$/, /\.gif(\?.*)?$/, /\.pdf(\?.*)?$/
|
||||
],
|
||||
|
||||
// include all urls by default
|
||||
include: [/.*/],
|
||||
|
||||
// this function is used to determine if the content of `res.write` or `res.end` is html.
|
||||
html: function (str) {
|
||||
if (!str) return false;
|
||||
return /<[:_-\w\s\!\/\=\"\']+>/i.test(str);
|
||||
},
|
||||
|
||||
// rules are provided to find the place where the snippet should be inserted.
|
||||
// the main problem is that on the server side it can be tricky to determine if a string will be valid html on the client.
|
||||
// the function `fn` of the first `match` is executed like this `body.replace(rule.match, rule.fn);`
|
||||
// the function `fn` has got the arguments `fn(w, s)` where `w` is the matches string and `s` is the snippet.
|
||||
rules: [{
|
||||
match: /<\/body>(?![\s\S]*<\/body>)/i,
|
||||
fn: prepend
|
||||
}, {
|
||||
match: /<\/html>(?![\s\S]*<\/html>)/i,
|
||||
fn: prepend
|
||||
}, {
|
||||
match: /<\!DOCTYPE.+?>/i,
|
||||
fn: append
|
||||
}],
|
||||
|
||||
// port where the script is loaded
|
||||
port: 35729,
|
||||
|
||||
// location where the script is provided (not by connect-livereload). Change this e.g. when serving livereload with a proxy.
|
||||
src: "http://localhost:35729/livereload.js?snipver=1",
|
||||
|
||||
// Set this option to `true` to set `req.headers['accept-encoding']` to 'identity' (disabling compression)
|
||||
disableCompression: false
|
||||
}));
|
||||
|
||||
function prepend(w: string, s: string): string {
|
||||
return s + w;
|
||||
}
|
||||
function append(w: string, s: string): string {
|
||||
return w + s;
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for connect-livereload v0.5.3
|
||||
// Project: https://github.com/intesso/connect-livereload
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../connect/connect.d.ts" />
|
||||
|
||||
declare module "connect-livereload" {
|
||||
import { HandleFunction } from "connect";
|
||||
|
||||
function livereload(): HandleFunction;
|
||||
function livereload(options: livereload.Options): HandleFunction;
|
||||
|
||||
module livereload {
|
||||
export type FileMatcher = string | RegExp;
|
||||
|
||||
export interface Rule {
|
||||
match: RegExp;
|
||||
fn: (w: string, s: string) => string;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
ignore?: FileMatcher[];
|
||||
excludeList?: FileMatcher[];
|
||||
|
||||
include?: FileMatcher[];
|
||||
html?: (val: string) => boolean;
|
||||
rules?: Rule[];
|
||||
disableCompression?: boolean;
|
||||
|
||||
hostname?: string;
|
||||
port?: number;
|
||||
src?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = livereload;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path="./connect.d.ts" />
|
||||
|
||||
import * as http from "http";
|
||||
import * as connect from "connect";
|
||||
|
||||
const app = connect();
|
||||
|
||||
// log all requests
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
|
||||
console.log(req, res);
|
||||
next();
|
||||
});
|
||||
|
||||
// Stop on errors
|
||||
app.use((err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
|
||||
if (err) {
|
||||
return res.end(`Error: ${err}`);
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
// respond to all requests
|
||||
app.use((req: http.IncomingMessage, res: http.ServerResponse) => {
|
||||
res.end("Hello from Connect!\n");
|
||||
});
|
||||
|
||||
//create node.js http server and listen on port
|
||||
http.createServer(app).listen(3000);
|
||||
|
||||
//create node.js http server and listen on port using connect shortcut
|
||||
app.listen(3000);
|
||||
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
// Type definitions for connect v3.4.0
|
||||
// Project: https://github.com/senchalabs/connect
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "connect" {
|
||||
import * as http from "http";
|
||||
|
||||
/**
|
||||
* Create a new connect server.
|
||||
* @public
|
||||
*/
|
||||
function createServer(): createServer.Server;
|
||||
|
||||
module createServer {
|
||||
export type ServerHandle = HandleFunction | http.Server;
|
||||
|
||||
export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void;
|
||||
export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
|
||||
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
||||
|
||||
export interface ServerStackItem {
|
||||
route: string;
|
||||
handle: ServerHandle;
|
||||
}
|
||||
|
||||
export interface Server extends NodeJS.EventEmitter {
|
||||
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
||||
|
||||
route: string;
|
||||
stack: ServerStackItem[];
|
||||
|
||||
/**
|
||||
* Utilize the given middleware `handle` to the given `route`,
|
||||
* defaulting to _/_. This "route" is the mount-point for the
|
||||
* middleware, when given a value other than _/_ the middleware
|
||||
* is only effective when that segment is present in the request's
|
||||
* pathname.
|
||||
*
|
||||
* For example if we were to mount a function at _/admin_, it would
|
||||
* be invoked on _/admin_, and _/admin/settings_, however it would
|
||||
* not be invoked for _/_, or _/posts_.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
use(fn: HandleFunction): Server;
|
||||
use(route: string, fn: HandleFunction): Server;
|
||||
|
||||
/**
|
||||
* Handle server requests, punting them down
|
||||
* the middleware stack.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
||||
|
||||
/**
|
||||
* Listen for connections.
|
||||
*
|
||||
* This method takes the same arguments
|
||||
* as node's `http.Server#listen()`.
|
||||
*
|
||||
* HTTP and HTTPS:
|
||||
*
|
||||
* If you run your application both as HTTP
|
||||
* and HTTPS you may wrap them individually,
|
||||
* since your Connect "server" is really just
|
||||
* a JavaScript `Function`.
|
||||
*
|
||||
* var connect = require('connect')
|
||||
* , http = require('http')
|
||||
* , https = require('https');
|
||||
*
|
||||
* var app = connect();
|
||||
*
|
||||
* http.createServer(app).listen(80);
|
||||
* https.createServer(options, app).listen(443);
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
||||
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
||||
listen(path: string, callback?: Function): http.Server;
|
||||
listen(handle: any, listeningListener?: Function): http.Server;
|
||||
}
|
||||
}
|
||||
|
||||
export = createServer;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) Microsoft Open Technologies, Inc.
|
||||
// Licensed under the MIT license.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
/// <reference path="cordova.d.ts"/>
|
||||
|
||||
@@ -203,7 +203,7 @@ file.abort();
|
||||
// InAppBrowser plugin
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// signature of window.open() added by InAppBrowser plugin
|
||||
// signature of window.open() added by InAppBrowser plugin
|
||||
// is similar to native window.open signature, so the compiler can's
|
||||
// select proper overload, but we cast result to InAppBrowser manually.
|
||||
var iab = <InAppBrowser>window.open('google.com', '_self');
|
||||
@@ -307,3 +307,28 @@ db.transaction(
|
||||
navigator.notification.vibrate(100);
|
||||
navigator.notification.vibrateWithPattern([100, 200, 200, 150, 50], 3);
|
||||
setTimeout(navigator.notification.cancelVibration, 1000);
|
||||
|
||||
// Keyboard plugin
|
||||
//----------------------------------------------------------------------
|
||||
Keyboard.shrinkView(true);
|
||||
Keyboard.shrinkView(false);
|
||||
Keyboard.hideFormAccessoryBar(true);
|
||||
Keyboard.hideFormAccessoryBar(false);
|
||||
Keyboard.disableScrollingInShrinkView(true);
|
||||
Keyboard.disableScrollingInShrinkView(false);
|
||||
if (Keyboard.isVisible) {
|
||||
console.log('Keyboard is visible');
|
||||
}
|
||||
Keyboard.automaticScrollToTopOnHiding = true;
|
||||
Keyboard.onshow = function () {
|
||||
console.log('onshow');
|
||||
};
|
||||
Keyboard.onhide = function () {
|
||||
console.log('onhide');
|
||||
};
|
||||
Keyboard.onshowing = function () {
|
||||
console.log('onshowing');
|
||||
};
|
||||
Keyboard.onhiding= function () {
|
||||
console.log('onhiding');
|
||||
};
|
||||
|
||||
Vendored
+5
@@ -25,6 +25,7 @@
|
||||
/// <reference path="plugins/StatusBar.d.ts"/>
|
||||
/// <reference path="plugins/Vibration.d.ts"/>
|
||||
/// <reference path="plugins/WebSQL.d.ts"/>
|
||||
/// <reference path="plugins/Keyboard.d.ts"/>
|
||||
|
||||
interface Cordova {
|
||||
/** Invokes native functionality by specifying corresponding service name, action and optional parameters.
|
||||
@@ -94,3 +95,7 @@ interface UrlUtil {
|
||||
|
||||
/** Apache Cordova instance */
|
||||
declare var cordova: Cordova;
|
||||
|
||||
declare module 'cordova' {
|
||||
export = cordova;
|
||||
}
|
||||
|
||||
Vendored
+174
@@ -0,0 +1,174 @@
|
||||
// Type definitions for Apache Cordova Keyboard plugin v0.1.2
|
||||
// Project: https://github.com/apache/cordova-plugins/tree/master/keyboard
|
||||
// Definitions by: Dan Manastireanu <https://github.com/danmana>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* The Keyboard object provides some functions to customize the iOS keyboard.
|
||||
*
|
||||
* <i>Supported Platforms: iOS</i>
|
||||
*
|
||||
* This plugin has only been tested in Cordova 3.2 or greater,
|
||||
* and its use in previous Cordova versions is not recommended
|
||||
* (potential conflict with keyboard customization code present in the core in previous Cordova versions).
|
||||
*
|
||||
* If you do use this plugin in an older Cordova version (again, not recommended),
|
||||
* you have to make sure the HideKeyboardFormAccessoryBar and KeyboardShrinksView preference values are always false,
|
||||
* and only use the API functions to turn things on/off.
|
||||
*
|
||||
* This plugin supports the HideKeyboardFormAccessoryBar (boolean)
|
||||
* and KeyboardShrinksView (boolean) preferences in config.xml.
|
||||
*
|
||||
* Permissions in config.xml
|
||||
* <code>
|
||||
* <feature name="Keyboard">
|
||||
* <param name="ios-package" value="CDVKeyboard" onload="true" />
|
||||
* </feature>
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
interface Keyboard {
|
||||
|
||||
// Methods
|
||||
|
||||
/**
|
||||
* Shrink the WebView when the keyboard comes up.
|
||||
*
|
||||
* Set to true to shrink the WebView when the keyboard comes up.
|
||||
* The WebView shrinks instead of the viewport shrinking and the page scrollable.
|
||||
* This applies to apps that position their elements relative to the bottom of the WebView.
|
||||
* This is the default behaviour on Android, and makes a lot of sense when building apps as opposed to webpages.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.shrinkView(true);
|
||||
* Keyboard.shrinkView(false);
|
||||
* </code>
|
||||
*
|
||||
* @param shrink
|
||||
*/
|
||||
shrinkView(shrink:boolean): void,
|
||||
|
||||
/**
|
||||
* Hide the keyboard toolbar.
|
||||
*
|
||||
* Set to true to hide the additional toolbar that is on top of the keyboard.
|
||||
* This toolbar features the Prev, Next, and Done buttons.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.hideFormAccessoryBar(true);
|
||||
* Keyboard.hideFormAccessoryBar(false);
|
||||
* </code>
|
||||
*
|
||||
* @param hide
|
||||
*/
|
||||
hideFormAccessoryBar(hide:boolean): void,
|
||||
|
||||
/**
|
||||
* Disable scrolling when the the WebView is shrunk.
|
||||
*
|
||||
* Set to true to disable scrolling when the WebView is shrunk.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.disableScrollingInShrinkView(true);
|
||||
* Keyboard.disableScrollingInShrinkView(false);
|
||||
* </code>
|
||||
*
|
||||
* @param disable
|
||||
*/
|
||||
disableScrollingInShrinkView(disable:boolean): void,
|
||||
|
||||
// Properties
|
||||
|
||||
/**
|
||||
* Determine if the keyboard is visible.
|
||||
*
|
||||
* Read this property to determine if the keyboard is visible.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* if (Keyboard.isVisible) {
|
||||
* // do something
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
isVisible: boolean,
|
||||
/**
|
||||
* Specifies whenether content of page would be autoamtically scrolled to the top of the page when keyboard is hiding.
|
||||
*
|
||||
* Set this to true if you need that page scroll to beginning when keyboard is hiding.
|
||||
* This is allows to fix issue with elements declared with position: fixed, after keyboard is hiding.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.automaticScrollToTopOnHiding = true;
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
automaticScrollToTopOnHiding: boolean,
|
||||
|
||||
// Events
|
||||
|
||||
/**
|
||||
* If defined, this function is fired when keyboard fully shown.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is shown.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onshow = function () {
|
||||
* // Describe your logic which will be run each time keyboard is shown.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onshow():void,
|
||||
/**
|
||||
* If defined, this function is fired when keyboard fully closed.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is closed.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onhide = function () {
|
||||
* // Describe your logic which will be run each time keyboard is closed.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onhide():void,
|
||||
/**
|
||||
* If defined, this function is fired before keyboard will be shown.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is about to be shown on the screen.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onshowing = function () {
|
||||
* // Describe your logic which will be run each time when keyboard is about to be shown.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onshowing():void,
|
||||
/**
|
||||
* If defined, this function is fired when keyboard is about to be closed.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is about to be closed.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onhiding = function () {
|
||||
* // Describe your logic which will be run each time when keyboard is about to be closed.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onhiding():void,
|
||||
|
||||
}
|
||||
|
||||
declare var Keyboard:Keyboard;
|
||||
Vendored
+198
-198
@@ -2251,782 +2251,782 @@ declare module "core-js/web/immediate" {
|
||||
declare module "core-js/web/timers" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary" {
|
||||
declare module "core-js/library" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/shim" {
|
||||
declare module "core-js/library/shim" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core" {
|
||||
declare module "core-js/library/core" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/core/$for" {
|
||||
declare module "core-js/library/core/$for" {
|
||||
import $for = core.$for;
|
||||
export = $for;
|
||||
}
|
||||
declare module "core-js/libary/core/_" {
|
||||
declare module "core-js/library/core/_" {
|
||||
var _: typeof core._;
|
||||
export = _;
|
||||
}
|
||||
declare module "core-js/libary/core/array" {
|
||||
declare module "core-js/library/core/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/core/date" {
|
||||
declare module "core-js/library/core/date" {
|
||||
var Date: typeof core.Date;
|
||||
export = Date;
|
||||
}
|
||||
declare module "core-js/libary/core/delay" {
|
||||
declare module "core-js/library/core/delay" {
|
||||
var delay: typeof core.delay;
|
||||
export = delay;
|
||||
}
|
||||
declare module "core-js/libary/core/dict" {
|
||||
declare module "core-js/library/core/dict" {
|
||||
var Dict: typeof core.Dict;
|
||||
export = Dict;
|
||||
}
|
||||
declare module "core-js/libary/core/function" {
|
||||
declare module "core-js/library/core/function" {
|
||||
var Function: typeof core.Function;
|
||||
export = Function;
|
||||
}
|
||||
declare module "core-js/libary/core/global" {
|
||||
declare module "core-js/library/core/global" {
|
||||
var global: typeof core.global;
|
||||
export = global;
|
||||
}
|
||||
declare module "core-js/libary/core/log" {
|
||||
declare module "core-js/library/core/log" {
|
||||
var log: typeof core.log;
|
||||
export = log;
|
||||
}
|
||||
declare module "core-js/libary/core/number" {
|
||||
declare module "core-js/library/core/number" {
|
||||
var Number: typeof core.Number;
|
||||
export = Number;
|
||||
}
|
||||
declare module "core-js/libary/core/object" {
|
||||
declare module "core-js/library/core/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/core/string" {
|
||||
declare module "core-js/library/core/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/fn/$for" {
|
||||
declare module "core-js/library/fn/$for" {
|
||||
import $for = core.$for;
|
||||
export = $for;
|
||||
}
|
||||
declare module "core-js/libary/fn/_" {
|
||||
declare module "core-js/library/fn/_" {
|
||||
var _: typeof core._;
|
||||
export = _;
|
||||
}
|
||||
declare module "core-js/libary/fn/clear-immediate" {
|
||||
declare module "core-js/library/fn/clear-immediate" {
|
||||
var clearImmediate: typeof core.clearImmediate;
|
||||
export = clearImmediate;
|
||||
}
|
||||
declare module "core-js/libary/fn/delay" {
|
||||
declare module "core-js/library/fn/delay" {
|
||||
var delay: typeof core.delay;
|
||||
export = delay;
|
||||
}
|
||||
declare module "core-js/libary/fn/dict" {
|
||||
declare module "core-js/library/fn/dict" {
|
||||
var Dict: typeof core.Dict;
|
||||
export = Dict;
|
||||
}
|
||||
declare module "core-js/libary/fn/get-iterator" {
|
||||
declare module "core-js/library/fn/get-iterator" {
|
||||
var getIterator: typeof core.getIterator;
|
||||
export = getIterator;
|
||||
}
|
||||
declare module "core-js/libary/fn/global" {
|
||||
declare module "core-js/library/fn/global" {
|
||||
var global: typeof core.global;
|
||||
export = global;
|
||||
}
|
||||
declare module "core-js/libary/fn/is-iterable" {
|
||||
declare module "core-js/library/fn/is-iterable" {
|
||||
var isIterable: typeof core.isIterable;
|
||||
export = isIterable;
|
||||
}
|
||||
declare module "core-js/libary/fn/log" {
|
||||
declare module "core-js/library/fn/log" {
|
||||
var log: typeof core.log;
|
||||
export = log;
|
||||
}
|
||||
declare module "core-js/libary/fn/map" {
|
||||
declare module "core-js/library/fn/map" {
|
||||
var Map: typeof core.Map;
|
||||
export = Map;
|
||||
}
|
||||
declare module "core-js/libary/fn/promise" {
|
||||
declare module "core-js/library/fn/promise" {
|
||||
var Promise: typeof core.Promise;
|
||||
export = Promise;
|
||||
}
|
||||
declare module "core-js/libary/fn/set" {
|
||||
declare module "core-js/library/fn/set" {
|
||||
var Set: typeof core.Set;
|
||||
export = Set;
|
||||
}
|
||||
declare module "core-js/libary/fn/set-immediate" {
|
||||
declare module "core-js/library/fn/set-immediate" {
|
||||
var setImmediate: typeof core.setImmediate;
|
||||
export = setImmediate;
|
||||
}
|
||||
declare module "core-js/libary/fn/set-interval" {
|
||||
declare module "core-js/library/fn/set-interval" {
|
||||
var setInterval: typeof core.setInterval;
|
||||
export = setInterval;
|
||||
}
|
||||
declare module "core-js/libary/fn/set-timeout" {
|
||||
declare module "core-js/library/fn/set-timeout" {
|
||||
var setTimeout: typeof core.setTimeout;
|
||||
export = setTimeout;
|
||||
}
|
||||
declare module "core-js/libary/fn/weak-map" {
|
||||
declare module "core-js/library/fn/weak-map" {
|
||||
var WeakMap: typeof core.WeakMap;
|
||||
export = WeakMap;
|
||||
}
|
||||
declare module "core-js/libary/fn/weak-set" {
|
||||
declare module "core-js/library/fn/weak-set" {
|
||||
var WeakSet: typeof core.WeakSet;
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/libary/fn/array" {
|
||||
declare module "core-js/library/fn/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/concat" {
|
||||
declare module "core-js/library/fn/array/concat" {
|
||||
var concat: typeof core.Array.concat;
|
||||
export = concat;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/copy-within" {
|
||||
declare module "core-js/library/fn/array/copy-within" {
|
||||
var copyWithin: typeof core.Array.copyWithin;
|
||||
export = copyWithin;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/entries" {
|
||||
declare module "core-js/library/fn/array/entries" {
|
||||
var entries: typeof core.Array.entries;
|
||||
export = entries;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/every" {
|
||||
declare module "core-js/library/fn/array/every" {
|
||||
var every: typeof core.Array.every;
|
||||
export = every;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/fill" {
|
||||
declare module "core-js/library/fn/array/fill" {
|
||||
var fill: typeof core.Array.fill;
|
||||
export = fill;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/filter" {
|
||||
declare module "core-js/library/fn/array/filter" {
|
||||
var filter: typeof core.Array.filter;
|
||||
export = filter;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/find" {
|
||||
declare module "core-js/library/fn/array/find" {
|
||||
var find: typeof core.Array.find;
|
||||
export = find;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/find-index" {
|
||||
declare module "core-js/library/fn/array/find-index" {
|
||||
var findIndex: typeof core.Array.findIndex;
|
||||
export = findIndex;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/for-each" {
|
||||
declare module "core-js/library/fn/array/for-each" {
|
||||
var forEach: typeof core.Array.forEach;
|
||||
export = forEach;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/from" {
|
||||
declare module "core-js/library/fn/array/from" {
|
||||
var from: typeof core.Array.from;
|
||||
export = from;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/includes" {
|
||||
declare module "core-js/library/fn/array/includes" {
|
||||
var includes: typeof core.Array.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/index-of" {
|
||||
declare module "core-js/library/fn/array/index-of" {
|
||||
var indexOf: typeof core.Array.indexOf;
|
||||
export = indexOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/join" {
|
||||
declare module "core-js/library/fn/array/join" {
|
||||
var join: typeof core.Array.join;
|
||||
export = join;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/keys" {
|
||||
declare module "core-js/library/fn/array/keys" {
|
||||
var keys: typeof core.Array.keys;
|
||||
export = keys;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/last-index-of" {
|
||||
declare module "core-js/library/fn/array/last-index-of" {
|
||||
var lastIndexOf: typeof core.Array.lastIndexOf;
|
||||
export = lastIndexOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/map" {
|
||||
declare module "core-js/library/fn/array/map" {
|
||||
var map: typeof core.Array.map;
|
||||
export = map;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/of" {
|
||||
declare module "core-js/library/fn/array/of" {
|
||||
var of: typeof core.Array.of;
|
||||
export = of;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/pop" {
|
||||
declare module "core-js/library/fn/array/pop" {
|
||||
var pop: typeof core.Array.pop;
|
||||
export = pop;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/push" {
|
||||
declare module "core-js/library/fn/array/push" {
|
||||
var push: typeof core.Array.push;
|
||||
export = push;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/reduce" {
|
||||
declare module "core-js/library/fn/array/reduce" {
|
||||
var reduce: typeof core.Array.reduce;
|
||||
export = reduce;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/reduce-right" {
|
||||
declare module "core-js/library/fn/array/reduce-right" {
|
||||
var reduceRight: typeof core.Array.reduceRight;
|
||||
export = reduceRight;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/reverse" {
|
||||
declare module "core-js/library/fn/array/reverse" {
|
||||
var reverse: typeof core.Array.reverse;
|
||||
export = reverse;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/shift" {
|
||||
declare module "core-js/library/fn/array/shift" {
|
||||
var shift: typeof core.Array.shift;
|
||||
export = shift;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/slice" {
|
||||
declare module "core-js/library/fn/array/slice" {
|
||||
var slice: typeof core.Array.slice;
|
||||
export = slice;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/some" {
|
||||
declare module "core-js/library/fn/array/some" {
|
||||
var some: typeof core.Array.some;
|
||||
export = some;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/sort" {
|
||||
declare module "core-js/library/fn/array/sort" {
|
||||
var sort: typeof core.Array.sort;
|
||||
export = sort;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/splice" {
|
||||
declare module "core-js/library/fn/array/splice" {
|
||||
var splice: typeof core.Array.splice;
|
||||
export = splice;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/turn" {
|
||||
declare module "core-js/library/fn/array/turn" {
|
||||
var turn: typeof core.Array.turn;
|
||||
export = turn;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/unshift" {
|
||||
declare module "core-js/library/fn/array/unshift" {
|
||||
var unshift: typeof core.Array.unshift;
|
||||
export = unshift;
|
||||
}
|
||||
declare module "core-js/libary/fn/array/values" {
|
||||
declare module "core-js/library/fn/array/values" {
|
||||
var values: typeof core.Array.values;
|
||||
export = values;
|
||||
}
|
||||
declare module "core-js/libary/fn/date" {
|
||||
declare module "core-js/library/fn/date" {
|
||||
var Date: typeof core.Date;
|
||||
export = Date;
|
||||
}
|
||||
declare module "core-js/libary/fn/date/add-locale" {
|
||||
declare module "core-js/library/fn/date/add-locale" {
|
||||
var addLocale: typeof core.addLocale;
|
||||
export = addLocale;
|
||||
}
|
||||
declare module "core-js/libary/fn/date/format" {
|
||||
declare module "core-js/library/fn/date/format" {
|
||||
var format: typeof core.Date.format;
|
||||
export = format;
|
||||
}
|
||||
declare module "core-js/libary/fn/date/formatUTC" {
|
||||
declare module "core-js/library/fn/date/formatUTC" {
|
||||
var formatUTC: typeof core.Date.formatUTC;
|
||||
export = formatUTC;
|
||||
}
|
||||
declare module "core-js/libary/fn/function" {
|
||||
declare module "core-js/library/fn/function" {
|
||||
var Function: typeof core.Function;
|
||||
export = Function;
|
||||
}
|
||||
declare module "core-js/libary/fn/function/has-instance" {
|
||||
declare module "core-js/library/fn/function/has-instance" {
|
||||
var hasInstance: (value: any) => boolean;
|
||||
export = hasInstance;
|
||||
}
|
||||
declare module "core-js/libary/fn/function/name" {
|
||||
declare module "core-js/library/fn/function/name" {
|
||||
}
|
||||
declare module "core-js/libary/fn/function/part" {
|
||||
declare module "core-js/library/fn/function/part" {
|
||||
var part: typeof core.Function.part;
|
||||
export = part;
|
||||
}
|
||||
declare module "core-js/libary/fn/math" {
|
||||
declare module "core-js/library/fn/math" {
|
||||
var Math: typeof core.Math;
|
||||
export = Math;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/acosh" {
|
||||
declare module "core-js/library/fn/math/acosh" {
|
||||
var acosh: typeof core.Math.acosh;
|
||||
export = acosh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/asinh" {
|
||||
declare module "core-js/library/fn/math/asinh" {
|
||||
var asinh: typeof core.Math.asinh;
|
||||
export = asinh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/atanh" {
|
||||
declare module "core-js/library/fn/math/atanh" {
|
||||
var atanh: typeof core.Math.atanh;
|
||||
export = atanh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/cbrt" {
|
||||
declare module "core-js/library/fn/math/cbrt" {
|
||||
var cbrt: typeof core.Math.cbrt;
|
||||
export = cbrt;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/clz32" {
|
||||
declare module "core-js/library/fn/math/clz32" {
|
||||
var clz32: typeof core.Math.clz32;
|
||||
export = clz32;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/cosh" {
|
||||
declare module "core-js/library/fn/math/cosh" {
|
||||
var cosh: typeof core.Math.cosh;
|
||||
export = cosh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/expm1" {
|
||||
declare module "core-js/library/fn/math/expm1" {
|
||||
var expm1: typeof core.Math.expm1;
|
||||
export = expm1;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/fround" {
|
||||
declare module "core-js/library/fn/math/fround" {
|
||||
var fround: typeof core.Math.fround;
|
||||
export = fround;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/hypot" {
|
||||
declare module "core-js/library/fn/math/hypot" {
|
||||
var hypot: typeof core.Math.hypot;
|
||||
export = hypot;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/imul" {
|
||||
declare module "core-js/library/fn/math/imul" {
|
||||
var imul: typeof core.Math.imul;
|
||||
export = imul;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/log10" {
|
||||
declare module "core-js/library/fn/math/log10" {
|
||||
var log10: typeof core.Math.log10;
|
||||
export = log10;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/log1p" {
|
||||
declare module "core-js/library/fn/math/log1p" {
|
||||
var log1p: typeof core.Math.log1p;
|
||||
export = log1p;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/log2" {
|
||||
declare module "core-js/library/fn/math/log2" {
|
||||
var log2: typeof core.Math.log2;
|
||||
export = log2;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/sign" {
|
||||
declare module "core-js/library/fn/math/sign" {
|
||||
var sign: typeof core.Math.sign;
|
||||
export = sign;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/sinh" {
|
||||
declare module "core-js/library/fn/math/sinh" {
|
||||
var sinh: typeof core.Math.sinh;
|
||||
export = sinh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/tanh" {
|
||||
declare module "core-js/library/fn/math/tanh" {
|
||||
var tanh: typeof core.Math.tanh;
|
||||
export = tanh;
|
||||
}
|
||||
declare module "core-js/libary/fn/math/trunc" {
|
||||
declare module "core-js/library/fn/math/trunc" {
|
||||
var trunc: typeof core.Math.trunc;
|
||||
export = trunc;
|
||||
}
|
||||
declare module "core-js/libary/fn/number" {
|
||||
declare module "core-js/library/fn/number" {
|
||||
var Number: typeof core.Number;
|
||||
export = Number;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/epsilon" {
|
||||
declare module "core-js/library/fn/number/epsilon" {
|
||||
var EPSILON: typeof core.Number.EPSILON;
|
||||
export = EPSILON;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-finite" {
|
||||
declare module "core-js/library/fn/number/is-finite" {
|
||||
var isFinite: typeof core.Number.isFinite;
|
||||
export = isFinite;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-integer" {
|
||||
declare module "core-js/library/fn/number/is-integer" {
|
||||
var isInteger: typeof core.Number.isInteger;
|
||||
export = isInteger;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-nan" {
|
||||
declare module "core-js/library/fn/number/is-nan" {
|
||||
var isNaN: typeof core.Number.isNaN;
|
||||
export = isNaN;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/is-safe-integer" {
|
||||
declare module "core-js/library/fn/number/is-safe-integer" {
|
||||
var isSafeInteger: typeof core.Number.isSafeInteger;
|
||||
export = isSafeInteger;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/max-safe-integer" {
|
||||
declare module "core-js/library/fn/number/max-safe-integer" {
|
||||
var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER;
|
||||
export = MAX_SAFE_INTEGER;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/min-safe-interger" {
|
||||
declare module "core-js/library/fn/number/min-safe-interger" {
|
||||
var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER;
|
||||
export = MIN_SAFE_INTEGER;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/parse-float" {
|
||||
declare module "core-js/library/fn/number/parse-float" {
|
||||
var parseFloat: typeof core.Number.parseFloat;
|
||||
export = parseFloat;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/parse-int" {
|
||||
declare module "core-js/library/fn/number/parse-int" {
|
||||
var parseInt: typeof core.Number.parseInt;
|
||||
export = parseInt;
|
||||
}
|
||||
declare module "core-js/libary/fn/number/random" {
|
||||
declare module "core-js/library/fn/number/random" {
|
||||
var random: typeof core.Number.random;
|
||||
export = random;
|
||||
}
|
||||
declare module "core-js/libary/fn/object" {
|
||||
declare module "core-js/library/fn/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/assign" {
|
||||
declare module "core-js/library/fn/object/assign" {
|
||||
var assign: typeof core.Object.assign;
|
||||
export = assign;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/classof" {
|
||||
declare module "core-js/library/fn/object/classof" {
|
||||
var classof: typeof core.Object.classof;
|
||||
export = classof;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/create" {
|
||||
declare module "core-js/library/fn/object/create" {
|
||||
var create: typeof core.Object.create;
|
||||
export = create;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/define" {
|
||||
declare module "core-js/library/fn/object/define" {
|
||||
var define: typeof core.Object.define;
|
||||
export = define;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/define-properties" {
|
||||
declare module "core-js/library/fn/object/define-properties" {
|
||||
var defineProperties: typeof core.Object.defineProperties;
|
||||
export = defineProperties;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/define-property" {
|
||||
declare module "core-js/library/fn/object/define-property" {
|
||||
var defineProperty: typeof core.Object.defineProperty;
|
||||
export = defineProperty;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/entries" {
|
||||
declare module "core-js/library/fn/object/entries" {
|
||||
var entries: typeof core.Object.entries;
|
||||
export = entries;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/freeze" {
|
||||
declare module "core-js/library/fn/object/freeze" {
|
||||
var freeze: typeof core.Object.freeze;
|
||||
export = freeze;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-descriptor" {
|
||||
declare module "core-js/library/fn/object/get-own-property-descriptor" {
|
||||
var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor;
|
||||
export = getOwnPropertyDescriptor;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-descriptors" {
|
||||
declare module "core-js/library/fn/object/get-own-property-descriptors" {
|
||||
var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors;
|
||||
export = getOwnPropertyDescriptors;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-names" {
|
||||
declare module "core-js/library/fn/object/get-own-property-names" {
|
||||
var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames;
|
||||
export = getOwnPropertyNames;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-own-property-symbols" {
|
||||
declare module "core-js/library/fn/object/get-own-property-symbols" {
|
||||
var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols;
|
||||
export = getOwnPropertySymbols;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/get-prototype-of" {
|
||||
declare module "core-js/library/fn/object/get-prototype-of" {
|
||||
var getPrototypeOf: typeof core.Object.getPrototypeOf;
|
||||
export = getPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is" {
|
||||
declare module "core-js/library/fn/object/is" {
|
||||
var is: typeof core.Object.is;
|
||||
export = is;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-extensible" {
|
||||
declare module "core-js/library/fn/object/is-extensible" {
|
||||
var isExtensible: typeof core.Object.isExtensible;
|
||||
export = isExtensible;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-frozen" {
|
||||
declare module "core-js/library/fn/object/is-frozen" {
|
||||
var isFrozen: typeof core.Object.isFrozen;
|
||||
export = isFrozen;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-object" {
|
||||
declare module "core-js/library/fn/object/is-object" {
|
||||
var isObject: typeof core.Object.isObject;
|
||||
export = isObject;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/is-sealed" {
|
||||
declare module "core-js/library/fn/object/is-sealed" {
|
||||
var isSealed: typeof core.Object.isSealed;
|
||||
export = isSealed;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/keys" {
|
||||
declare module "core-js/library/fn/object/keys" {
|
||||
var keys: typeof core.Object.keys;
|
||||
export = keys;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/make" {
|
||||
declare module "core-js/library/fn/object/make" {
|
||||
var make: typeof core.Object.make;
|
||||
export = make;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/prevent-extensions" {
|
||||
declare module "core-js/library/fn/object/prevent-extensions" {
|
||||
var preventExtensions: typeof core.Object.preventExtensions;
|
||||
export = preventExtensions;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/seal" {
|
||||
declare module "core-js/library/fn/object/seal" {
|
||||
var seal: typeof core.Object.seal;
|
||||
export = seal;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/set-prototype-of" {
|
||||
declare module "core-js/library/fn/object/set-prototype-of" {
|
||||
var setPrototypeOf: typeof core.Object.setPrototypeOf;
|
||||
export = setPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/object/values" {
|
||||
declare module "core-js/library/fn/object/values" {
|
||||
var values: typeof core.Object.values;
|
||||
export = values;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect" {
|
||||
declare module "core-js/library/fn/reflect" {
|
||||
var Reflect: typeof core.Reflect;
|
||||
export = Reflect;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/apply" {
|
||||
declare module "core-js/library/fn/reflect/apply" {
|
||||
var apply: typeof core.Reflect.apply;
|
||||
export = apply;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/construct" {
|
||||
declare module "core-js/library/fn/reflect/construct" {
|
||||
var construct: typeof core.Reflect.construct;
|
||||
export = construct;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/define-property" {
|
||||
declare module "core-js/library/fn/reflect/define-property" {
|
||||
var defineProperty: typeof core.Reflect.defineProperty;
|
||||
export = defineProperty;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/delete-property" {
|
||||
declare module "core-js/library/fn/reflect/delete-property" {
|
||||
var deleteProperty: typeof core.Reflect.deleteProperty;
|
||||
export = deleteProperty;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/enumerate" {
|
||||
declare module "core-js/library/fn/reflect/enumerate" {
|
||||
var enumerate: typeof core.Reflect.enumerate;
|
||||
export = enumerate;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/get" {
|
||||
declare module "core-js/library/fn/reflect/get" {
|
||||
var get: typeof core.Reflect.get;
|
||||
export = get;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/get-own-property-descriptor" {
|
||||
declare module "core-js/library/fn/reflect/get-own-property-descriptor" {
|
||||
var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor;
|
||||
export = getOwnPropertyDescriptor;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/get-prototype-of" {
|
||||
declare module "core-js/library/fn/reflect/get-prototype-of" {
|
||||
var getPrototypeOf: typeof core.Reflect.getPrototypeOf;
|
||||
export = getPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/has" {
|
||||
declare module "core-js/library/fn/reflect/has" {
|
||||
var has: typeof core.Reflect.has;
|
||||
export = has;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/is-extensible" {
|
||||
declare module "core-js/library/fn/reflect/is-extensible" {
|
||||
var isExtensible: typeof core.Reflect.isExtensible;
|
||||
export = isExtensible;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/own-keys" {
|
||||
declare module "core-js/library/fn/reflect/own-keys" {
|
||||
var ownKeys: typeof core.Reflect.ownKeys;
|
||||
export = ownKeys;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/prevent-extensions" {
|
||||
declare module "core-js/library/fn/reflect/prevent-extensions" {
|
||||
var preventExtensions: typeof core.Reflect.preventExtensions;
|
||||
export = preventExtensions;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/set" {
|
||||
declare module "core-js/library/fn/reflect/set" {
|
||||
var set: typeof core.Reflect.set;
|
||||
export = set;
|
||||
}
|
||||
declare module "core-js/libary/fn/reflect/set-prototype-of" {
|
||||
declare module "core-js/library/fn/reflect/set-prototype-of" {
|
||||
var setPrototypeOf: typeof core.Reflect.setPrototypeOf;
|
||||
export = setPrototypeOf;
|
||||
}
|
||||
declare module "core-js/libary/fn/regexp" {
|
||||
declare module "core-js/library/fn/regexp" {
|
||||
var RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
}
|
||||
declare module "core-js/libary/fn/regexp/escape" {
|
||||
declare module "core-js/library/fn/regexp/escape" {
|
||||
var escape: typeof core.RegExp.escape;
|
||||
export = escape;
|
||||
}
|
||||
declare module "core-js/libary/fn/string" {
|
||||
declare module "core-js/library/fn/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/at" {
|
||||
declare module "core-js/library/fn/string/at" {
|
||||
var at: typeof core.String.at;
|
||||
export = at;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/code-point-at" {
|
||||
declare module "core-js/library/fn/string/code-point-at" {
|
||||
var codePointAt: typeof core.String.codePointAt;
|
||||
export = codePointAt;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/ends-with" {
|
||||
declare module "core-js/library/fn/string/ends-with" {
|
||||
var endsWith: typeof core.String.endsWith;
|
||||
export = endsWith;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/escape-html" {
|
||||
declare module "core-js/library/fn/string/escape-html" {
|
||||
var escapeHTML: typeof core.String.escapeHTML;
|
||||
export = escapeHTML;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/from-code-point" {
|
||||
declare module "core-js/library/fn/string/from-code-point" {
|
||||
var fromCodePoint: typeof core.String.fromCodePoint;
|
||||
export = fromCodePoint;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/includes" {
|
||||
declare module "core-js/library/fn/string/includes" {
|
||||
var includes: typeof core.String.includes;
|
||||
export = includes;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/lpad" {
|
||||
declare module "core-js/library/fn/string/lpad" {
|
||||
var lpad: typeof core.String.lpad;
|
||||
export = lpad;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/raw" {
|
||||
declare module "core-js/library/fn/string/raw" {
|
||||
var raw: typeof core.String.raw;
|
||||
export = raw;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/repeat" {
|
||||
declare module "core-js/library/fn/string/repeat" {
|
||||
var repeat: typeof core.String.repeat;
|
||||
export = repeat;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/rpad" {
|
||||
declare module "core-js/library/fn/string/rpad" {
|
||||
var rpad: typeof core.String.rpad;
|
||||
export = rpad;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/starts-with" {
|
||||
declare module "core-js/library/fn/string/starts-with" {
|
||||
var startsWith: typeof core.String.startsWith;
|
||||
export = startsWith;
|
||||
}
|
||||
declare module "core-js/libary/fn/string/unescape-html" {
|
||||
declare module "core-js/library/fn/string/unescape-html" {
|
||||
var unescapeHTML: typeof core.String.unescapeHTML;
|
||||
export = unescapeHTML;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol" {
|
||||
declare module "core-js/library/fn/symbol" {
|
||||
var Symbol: typeof core.Symbol;
|
||||
export = Symbol;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/for" {
|
||||
declare module "core-js/library/fn/symbol/for" {
|
||||
var _for: typeof core.Symbol.for;
|
||||
export = _for;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/has-instance" {
|
||||
declare module "core-js/library/fn/symbol/has-instance" {
|
||||
var hasInstance: typeof core.Symbol.hasInstance;
|
||||
export = hasInstance;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/is-concat-spreadable" {
|
||||
declare module "core-js/library/fn/symbol/is-concat-spreadable" {
|
||||
var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable;
|
||||
export = isConcatSpreadable;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/iterator" {
|
||||
declare module "core-js/library/fn/symbol/iterator" {
|
||||
var iterator: typeof core.Symbol.iterator;
|
||||
export = iterator;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/key-for" {
|
||||
declare module "core-js/library/fn/symbol/key-for" {
|
||||
var keyFor: typeof core.Symbol.keyFor;
|
||||
export = keyFor;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/match" {
|
||||
declare module "core-js/library/fn/symbol/match" {
|
||||
var match: typeof core.Symbol.match;
|
||||
export = match;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/replace" {
|
||||
declare module "core-js/library/fn/symbol/replace" {
|
||||
var replace: typeof core.Symbol.replace;
|
||||
export = replace;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/search" {
|
||||
declare module "core-js/library/fn/symbol/search" {
|
||||
var search: typeof core.Symbol.search;
|
||||
export = search;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/species" {
|
||||
declare module "core-js/library/fn/symbol/species" {
|
||||
var species: typeof core.Symbol.species;
|
||||
export = species;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/split" {
|
||||
declare module "core-js/library/fn/symbol/split" {
|
||||
var split: typeof core.Symbol.split;
|
||||
export = split;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/to-primitive" {
|
||||
declare module "core-js/library/fn/symbol/to-primitive" {
|
||||
var toPrimitive: typeof core.Symbol.toPrimitive;
|
||||
export = toPrimitive;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/to-string-tag" {
|
||||
declare module "core-js/library/fn/symbol/to-string-tag" {
|
||||
var toStringTag: typeof core.Symbol.toStringTag;
|
||||
export = toStringTag;
|
||||
}
|
||||
declare module "core-js/libary/fn/symbol/unscopables" {
|
||||
declare module "core-js/library/fn/symbol/unscopables" {
|
||||
var unscopables: typeof core.Symbol.unscopables;
|
||||
export = unscopables;
|
||||
}
|
||||
declare module "core-js/libary/es5" {
|
||||
declare module "core-js/library/es5" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6" {
|
||||
declare module "core-js/library/es6" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es6/array" {
|
||||
declare module "core-js/library/es6/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/es6/function" {
|
||||
declare module "core-js/library/es6/function" {
|
||||
var Function: typeof core.Function;
|
||||
export = Function;
|
||||
}
|
||||
declare module "core-js/libary/es6/map" {
|
||||
declare module "core-js/library/es6/map" {
|
||||
var Map: typeof core.Map;
|
||||
export = Map;
|
||||
}
|
||||
declare module "core-js/libary/es6/math" {
|
||||
declare module "core-js/library/es6/math" {
|
||||
var Math: typeof core.Math;
|
||||
export = Math;
|
||||
}
|
||||
declare module "core-js/libary/es6/number" {
|
||||
declare module "core-js/library/es6/number" {
|
||||
var Number: typeof core.Number;
|
||||
export = Number;
|
||||
}
|
||||
declare module "core-js/libary/es6/object" {
|
||||
declare module "core-js/library/es6/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/es6/promise" {
|
||||
declare module "core-js/library/es6/promise" {
|
||||
var Promise: typeof core.Promise;
|
||||
export = Promise;
|
||||
}
|
||||
declare module "core-js/libary/es6/reflect" {
|
||||
declare module "core-js/library/es6/reflect" {
|
||||
var Reflect: typeof core.Reflect;
|
||||
export = Reflect;
|
||||
}
|
||||
declare module "core-js/libary/es6/regexp" {
|
||||
declare module "core-js/library/es6/regexp" {
|
||||
var RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
}
|
||||
declare module "core-js/libary/es6/set" {
|
||||
declare module "core-js/library/es6/set" {
|
||||
var Set: typeof core.Set;
|
||||
export = Set;
|
||||
}
|
||||
declare module "core-js/libary/es6/string" {
|
||||
declare module "core-js/library/es6/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/es6/symbol" {
|
||||
declare module "core-js/library/es6/symbol" {
|
||||
var Symbol: typeof core.Symbol;
|
||||
export = Symbol;
|
||||
}
|
||||
declare module "core-js/libary/es6/weak-map" {
|
||||
declare module "core-js/library/es6/weak-map" {
|
||||
var WeakMap: typeof core.WeakMap;
|
||||
export = WeakMap;
|
||||
}
|
||||
declare module "core-js/libary/es6/weak-set" {
|
||||
declare module "core-js/library/es6/weak-set" {
|
||||
var WeakSet: typeof core.WeakSet;
|
||||
export = WeakSet;
|
||||
}
|
||||
declare module "core-js/libary/es7" {
|
||||
declare module "core-js/library/es7" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/es7/array" {
|
||||
declare module "core-js/library/es7/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/es7/map" {
|
||||
declare module "core-js/library/es7/map" {
|
||||
var Map: typeof core.Map;
|
||||
export = Map;
|
||||
}
|
||||
declare module "core-js/libary/es7/object" {
|
||||
declare module "core-js/library/es7/object" {
|
||||
var Object: typeof core.Object;
|
||||
export = Object;
|
||||
}
|
||||
declare module "core-js/libary/es7/regexp" {
|
||||
declare module "core-js/library/es7/regexp" {
|
||||
var RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
}
|
||||
declare module "core-js/libary/es7/set" {
|
||||
declare module "core-js/library/es7/set" {
|
||||
var Set: typeof core.Set;
|
||||
export = Set;
|
||||
}
|
||||
declare module "core-js/libary/es7/string" {
|
||||
declare module "core-js/library/es7/string" {
|
||||
var String: typeof core.String;
|
||||
export = String;
|
||||
}
|
||||
declare module "core-js/libary/js" {
|
||||
declare module "core-js/library/js" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/js/array" {
|
||||
declare module "core-js/library/js/array" {
|
||||
var Array: typeof core.Array;
|
||||
export = Array;
|
||||
}
|
||||
declare module "core-js/libary/web" {
|
||||
declare module "core-js/library/web" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/dom" {
|
||||
declare module "core-js/library/web/dom" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/immediate" {
|
||||
declare module "core-js/library/web/immediate" {
|
||||
export = core;
|
||||
}
|
||||
declare module "core-js/libary/web/timers" {
|
||||
declare module "core-js/library/web/timers" {
|
||||
export = core;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/// <reference path="credential.d.ts" />
|
||||
|
||||
import * as credential from 'credential';
|
||||
|
||||
credential.hash('password', function(err: Error, hash: string) {
|
||||
if (err) console.error(err);
|
||||
else console.log(hash);
|
||||
});
|
||||
|
||||
const hash = '{}';
|
||||
const password = 'test';
|
||||
|
||||
credential.verify(hash, password, function(err: Error, isValid: boolean) {
|
||||
if (err) console.error(err);
|
||||
else console.log(isValid ? 'Password match' : 'Incorrect password');
|
||||
});
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for credential
|
||||
// Project: https://github.com/ericelliott/credential
|
||||
// Definitions by: Phú <https://github.com/phuvo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'credential' {
|
||||
|
||||
type HashCallback = (err: Error, hash: string) => void;
|
||||
type VerifyCallback = (err: Error, isValid: boolean) => void;
|
||||
|
||||
module credential {
|
||||
function hash(password: string, callback: HashCallback): void;
|
||||
function verify(hash: string, password: string, callback: VerifyCallback): void;
|
||||
}
|
||||
|
||||
export = credential;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/// <reference path="./decorum.d.ts" />
|
||||
|
||||
import {Required} from 'decorum';
|
||||
import {Email} from 'decorum';
|
||||
import {MinLength} from 'decorum';
|
||||
import {MaxLength} from 'decorum';
|
||||
import {Length} from 'decorum';
|
||||
import {FieldName} from 'decorum';
|
||||
import {Validation} from 'decorum';
|
||||
import {Pattern} from 'decorum';
|
||||
import {Alpha} from 'decorum';
|
||||
import {AlphaNumeric} from 'decorum';
|
||||
import {Validator} from 'decorum';
|
||||
import {BaseValidator} from 'decorum';
|
||||
import {IMessageOpts} from 'decorum';
|
||||
import {MessageHandlers} from 'decorum';
|
||||
|
||||
class MyModel {
|
||||
@FieldName('User name')
|
||||
@Required()
|
||||
@MaxLength(50)
|
||||
username = '';
|
||||
|
||||
@FieldName('Email address')
|
||||
@Email()
|
||||
@Required('Your email address will be used to send you a confirmation email. You must fill it out')
|
||||
emailAddress = '';
|
||||
|
||||
@Required()
|
||||
@MinLength(10)
|
||||
@MaxLength(30)
|
||||
password = '';
|
||||
|
||||
@FieldName('Confirm password')
|
||||
@Validation<MyModel>(
|
||||
'The passwords do not match.',
|
||||
(pwd, model) => model.password === pwd
|
||||
)
|
||||
confirmPassword = '';
|
||||
|
||||
@Pattern(/^[a-z0-9-]+$/i, 'Must be a valid slug tag')
|
||||
slug = 'foo';
|
||||
|
||||
@Length(6, 'Alias must be 6 characters long')
|
||||
alias: string;
|
||||
|
||||
@Alpha((opts: IMessageOpts) => 'Message overridden for field ' + opts.property + ' with friendly name ' + opts.friendlyName)
|
||||
alpha: string;
|
||||
|
||||
@AlphaNumeric((opts: IMessageOpts) => 'Message overridden for field ' + opts.property + ' with friendly name ' + opts.friendlyName)
|
||||
alphaNumeric: string;
|
||||
}
|
||||
|
||||
// ES6-style
|
||||
class MyController {
|
||||
model = new MyModel();
|
||||
validator = Validator.new(this.model);
|
||||
|
||||
doStuff(): void {
|
||||
var opts = this.validator.getValidationOptions('alias');
|
||||
var fieldName = opts.getFriendlyName();
|
||||
var errs = opts.validateValue('foo', this.model);
|
||||
opts.setFriendlyName('Foo');
|
||||
opts.addValidator(null);
|
||||
var validators = opts.getValidators();
|
||||
}
|
||||
|
||||
validate(): void {
|
||||
var result = this.validator.validate();
|
||||
if (!result.isValid) {
|
||||
for(var i = 0; i < result.errors.length; i++) {
|
||||
var current = result.errors[i];
|
||||
console.error(current.fieldName, current.errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ES5-style
|
||||
function MyOtherModel() {
|
||||
this.foo = '';
|
||||
this.bar = '';
|
||||
}
|
||||
|
||||
Validator.decorate(MyOtherModel, {
|
||||
foo: [
|
||||
decorum.Required()
|
||||
],
|
||||
bar: [
|
||||
decorum.Pattern(/^[a-z][0-9]$/i),
|
||||
decorum.FieldName('My bar')
|
||||
]
|
||||
});
|
||||
|
||||
var otherValidator = Validator.new(new MyOtherModel());
|
||||
otherValidator.validateField('foo', '');
|
||||
|
||||
// Custom validator
|
||||
class MyValidator extends BaseValidator {
|
||||
|
||||
validatesEmptyValue(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
getMessage(opts: IMessageOpts): string {
|
||||
return opts.friendlyName + ' is not a valid thing because of value ' + opts.value + '! Fyi... its property name is ' + opts.property;
|
||||
}
|
||||
|
||||
isValid(value: any, model: any): boolean {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Message overrides
|
||||
MessageHandlers['alpha'] = (opts: IMessageOpts) => 'The value ' + opts.value + ' for property ' + opts.property + ' is invalid!';
|
||||
@@ -0,0 +1,2 @@
|
||||
--experimentalDecorators
|
||||
--target ES5
|
||||
Vendored
+436
@@ -0,0 +1,436 @@
|
||||
// Type definitions for Decorum JS v0.2.0
|
||||
// Project: https://github.com/dflor003/decorum
|
||||
// Definitions by: Danil Flores <https://github.com/dflor003>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'decorum' {
|
||||
export = decorum;
|
||||
}
|
||||
|
||||
declare namespace decorum {
|
||||
/**
|
||||
* A generic custom validation. Takes a predicate that will receive the proposed value as the first parameter and
|
||||
* the current model state as the second.
|
||||
* @param message The message to display when the predicate fails.
|
||||
* @param predicate A lambda expression/function that determines if the value is valid. If it returns a falsy
|
||||
* value, the field will be considered invalid and will return the passed error message upon validation.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function Validation<TModel>(message: string | MessageHandler<CustomValidator<TModel>>, predicate: (value: any, model: TModel) => boolean): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validate's that the field is a valid email address. The format used is the same as the webkit browser's internal
|
||||
* email validation format. For looser or stricter formats, use your own validation based on the @Pattern decorator.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function Email(message?: string | MessageHandler<EmailValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Sets the field's "friendly" name in validation error messages.
|
||||
* @param name The field's friendly name
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function FieldName(name: string): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validate's a field's EXACT length. Validation fails if the field is not EXACTLY the length passed.
|
||||
* @param length The exact length the field must be.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function Length(length: number, message?: string | MessageHandler<LengthValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validates a field's maximum length.
|
||||
* @param maxLength The field's maximum length. Must be a positive integer greater than 1.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function MaxLength(maxLength: number, message?: string | MessageHandler<MaxLengthValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validates the field's minimum length.
|
||||
* @param minLength The field's minimum length. Must be a positive integer greater than 0
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function MinLength(minLength: number, message?: string | MessageHandler<MinLengthValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validates the field against a regular expression pattern.
|
||||
* @param regex The regex to validate against. Should be a valid JavaScript {RegExp} instance.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function Pattern(regex: RegExp, message?: string | MessageHandler<PatternValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Marks the field as required.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function Required(message?: string | MessageHandler<RequiredFieldValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validates that a given field only contains alpha values.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function Alpha(message?: string | MessageHandler<PatternValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* Validates that a given field only contains alphanumeric values.
|
||||
* @param message [Optional] Overrides the default validation error message.
|
||||
* @returns {function(Object, string): void} A field validation decorator.
|
||||
*/
|
||||
export function AlphaNumeric(message?: string | MessageHandler<PatternValidator>): PropertyDecorator;
|
||||
|
||||
/**
|
||||
* A map from field name to array of field validation decorators.
|
||||
*/
|
||||
export type ValidationDefinitions = {
|
||||
[field: string]: PropertyDecorator[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Static container for convenience methods related to field validation.
|
||||
*/
|
||||
export class Validator {
|
||||
/**
|
||||
* Creates a new model validator for the given model. Model should be a valid class that has a valid constructor
|
||||
* and a prototype.
|
||||
* @param model The model to create the validator for.
|
||||
* @returns {ModelValidator} An instance of {ModelValidator}
|
||||
*/
|
||||
static new(model: any): ModelValidator;
|
||||
|
||||
/**
|
||||
* Decorates the passed class with model validations. Use this when you do not have access to ES7 decorators.
|
||||
* The object passed should be a valid class (ES6 class or ES5 function constructor).
|
||||
* @param objectType The class to decorate.
|
||||
* @param definitions One or more field validation definitions of the form { "fieldName": [ decorators ] }.
|
||||
*/
|
||||
static decorate(objectType: any, definitions: ValidationDefinitions): void;
|
||||
|
||||
/**
|
||||
* Creates an anonymous validator, immediately validates the model, and returns any validation errors on the
|
||||
* model as a result.
|
||||
* @param model The model to validate.
|
||||
*/
|
||||
static validate(model: any): IValidationResult;
|
||||
|
||||
/**
|
||||
* Adds a validator to the given object prototype for the given property. Meant to be used inside of validation
|
||||
* decorators to inject the validation onto the object property.
|
||||
* @param targetPrototype A valid object prototype to add to.
|
||||
* @param property The property to add the validator for.
|
||||
* @param validator The validator to add.
|
||||
*/
|
||||
static addValidator(targetPrototype: Object, property: string, validator: BaseValidator): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Details about validation errors on a field.
|
||||
*/
|
||||
export interface IFieldValidationError {
|
||||
/**
|
||||
* The property name of the field on the model.
|
||||
*/
|
||||
field: string;
|
||||
|
||||
/**
|
||||
* The "friendly" name of the field. If not set on the model via @FieldName(...), it will default to "Field".
|
||||
*/
|
||||
fieldName: string;
|
||||
|
||||
/**
|
||||
* One or more field validation errors. Empty if no errors.
|
||||
*/
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Result returned when a model is validated.
|
||||
*/
|
||||
export interface IValidationResult {
|
||||
/**
|
||||
* Whether or not the model is valid.
|
||||
*/
|
||||
isValid: boolean;
|
||||
|
||||
/**
|
||||
* A map of field name to validation errors.
|
||||
*/
|
||||
errors: IFieldValidationError[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a model to allow the consuming class to call validation methods.
|
||||
*/
|
||||
export class ModelValidator {
|
||||
/**
|
||||
* Creates a new model validator.
|
||||
* @param model The model to validate. Should be a class that has a valid constructor function and prototype.
|
||||
*/
|
||||
constructor(model: any);
|
||||
|
||||
/**
|
||||
* Gets the validation options for the given field name.
|
||||
* @param fieldKey The name of the field to get options for.
|
||||
* @returns {FieldOptions} The field options associated with that field or null if no validations defined
|
||||
* for the field.
|
||||
*/
|
||||
getValidationOptions(fieldKey: string): FieldOptions;
|
||||
|
||||
/**
|
||||
* Validates the given field on this {ModelValidator}'s model. If a proposed value is passed, validate
|
||||
* against that passed value; otherwise, use the field's current value on the model.
|
||||
* @param fieldKey The name of the field to validate.
|
||||
* @param proposedValue [Optional] The proposed value to set on the field.
|
||||
* @returns {string[]} An array of field validation error messages if the field is invalid; otherwise,
|
||||
* an empty array.
|
||||
*/
|
||||
validateField(fieldKey: string, proposedValue?: any): string[];
|
||||
|
||||
/**
|
||||
* Validate the entire model and return a result that indicates whether the model is valid or not and any
|
||||
* errors
|
||||
* that have occurred in an object indexed by field name on the model.
|
||||
* @returns {IValidationResult} An object that contains whether the model is valid or not and errors by field
|
||||
* name.
|
||||
*/
|
||||
validate(): IValidationResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback invoked when a validation needs to return an error. The first parameter is an object
|
||||
* wrapping metadata about the field such as the field name, friendly name, value, etc.
|
||||
* The second parameter is the validator instance that triggered the error.
|
||||
*/
|
||||
export interface MessageHandler<TValidator extends BaseValidator> {
|
||||
(opts: IMessageOpts, validator: TValidator): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options passed to a field to aid in generating a message. Contains data about
|
||||
* the field such as name, friendly name, and value.
|
||||
*/
|
||||
export interface IMessageOpts {
|
||||
/**
|
||||
* The property name from the model. I.e. 'emailAddress', 'username', etc.
|
||||
*/
|
||||
property: string;
|
||||
|
||||
/**
|
||||
* The friendly name for the field. I.e. 'Email address', 'Password Confirmation', etc.
|
||||
*/
|
||||
friendlyName: string;
|
||||
|
||||
/**
|
||||
* The current value of the field at the time the validation error was generated.
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A map of validation "key" (unique name for a given type of validation) to message handler callback.
|
||||
*/
|
||||
export interface IMessageHandlerMap {
|
||||
[key: string]: MessageHandler<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mechanism for overriding validation errors to provide for custom or localized error messages.
|
||||
* @type {{IMessageHandlerMap}}
|
||||
*/
|
||||
export let MessageHandlers: IMessageHandlerMap;
|
||||
|
||||
/**
|
||||
* Custom validation class.
|
||||
*/
|
||||
export class CustomValidator<TModel> extends BaseValidator {
|
||||
constructor(predicate: (value: any, model: TModel) => boolean, message: string | MessageHandler<CustomValidator<TModel>>);
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
isValid(value: any, model: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* An email validator.
|
||||
*/
|
||||
export class EmailValidator extends PatternValidator {
|
||||
static EmailRegex: RegExp;
|
||||
|
||||
constructor(message?: string | MessageHandler<EmailValidator>);
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
getKey(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An exact length validator.
|
||||
*/
|
||||
export class LengthValidator extends BaseValidator {
|
||||
length: number;
|
||||
|
||||
constructor(length: number, message?: string | MessageHandler<LengthValidator>);
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
isValid(value: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A maximum length validator.
|
||||
*/
|
||||
export class MaxLengthValidator extends BaseValidator {
|
||||
maxLength: number;
|
||||
|
||||
constructor(maxLength: number, message?: string | MessageHandler<MaxLengthValidator>);
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
isValid(value: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A minimum length validator.
|
||||
*/
|
||||
export class MinLengthValidator extends BaseValidator {
|
||||
minLength: number;
|
||||
|
||||
constructor(minLength: number, message?: string | MessageHandler<MinLengthValidator>);
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
isValid(value: string): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A regular expression validator.
|
||||
*/
|
||||
export class PatternValidator extends BaseValidator {
|
||||
pattern: RegExp;
|
||||
|
||||
constructor(pattern: RegExp, message?: string | MessageHandler<PatternValidator>);
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
isValid(value: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A field requiredness validator.
|
||||
*/
|
||||
export class RequiredFieldValidator extends BaseValidator {
|
||||
constructor(message?: string | MessageHandler<RequiredFieldValidator>);
|
||||
|
||||
validatesEmptyValue(): boolean;
|
||||
|
||||
getMessage(opts: IMessageOpts): string;
|
||||
|
||||
isValid(value: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base abstract class for all validators. Methods that must be overridden:
|
||||
* getMessage(...) - Get error message to return when field is invalid.
|
||||
* isValid(...) - Check validity of field given proposed value and the rest of the model.
|
||||
*/
|
||||
export abstract class BaseValidator {
|
||||
/**
|
||||
* Initializes the {BaseValidator}
|
||||
* @param validatorKey A unique "key" by which to identify this field validator i.e. length, maxlength,
|
||||
* required. Should be a valid JS property name.
|
||||
* @param message A custom error message to return. Should be passed down from concrete class' constructors to
|
||||
* enable customizing error messages.
|
||||
*/
|
||||
constructor(validatorKey: string, message: string | MessageHandler<any>);
|
||||
|
||||
/**
|
||||
* Returns true if the validator instance was passed a custom error message.
|
||||
*/
|
||||
hasCustomMessage: boolean;
|
||||
|
||||
/**
|
||||
* Check whether this validator should process an "empty" value (i.e. null, undefined, empty string). Override
|
||||
* this in derived classes to skip validators if the field value hasn't been set. Things like email, min/max
|
||||
* length, and pattern should return false for this to ensure they don't get fired when the model is initially
|
||||
* empty before a user has had a chance to input a value. Things like required should override this to true so
|
||||
* that they are fired for empty values. Base implementation defaults to false
|
||||
* @returns {boolean}
|
||||
*/
|
||||
validatesEmptyValue(): boolean;
|
||||
|
||||
/**
|
||||
* Gets the custom error message set on this validator.
|
||||
* @param opts Metadata about the field such as name and friendly name.
|
||||
* @returns {string} The custom error message or null if none has been set.
|
||||
*/
|
||||
getCustomMessage(opts: IMessageOpts): string;
|
||||
|
||||
/**
|
||||
* Gets the unique name for this validator.
|
||||
* @returns {string} The unique name for this validator.
|
||||
*/
|
||||
getKey(): string;
|
||||
|
||||
/**
|
||||
* [Abstract] Gets the error message to display when a field fails validation by this validator.
|
||||
* @param opts Metadata about the field such as name and friendly name.
|
||||
*/
|
||||
abstract getMessage(opts: IMessageOpts): string;
|
||||
|
||||
/**
|
||||
* [Abstract] Checks the passed value for validity.
|
||||
* @param value The field's proposed value.
|
||||
* @param model The rest of the model if cross-field validity checks are necessary.
|
||||
*/
|
||||
abstract isValid(value: any, model: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation options for a given field including actual validators and meta data such as the field name.
|
||||
*/
|
||||
export class FieldOptions {
|
||||
constructor(property: string);
|
||||
|
||||
/**
|
||||
* Gets the "friendly" name of the field for use in validation error messages. Defaults to just "Field".
|
||||
* @returns {string}
|
||||
*/
|
||||
getFriendlyName(): string;
|
||||
|
||||
/**
|
||||
* Sets the "friendly" name of the field for use in validation error messages. This name will be used in the
|
||||
* text of validation errors.
|
||||
* @param name The new name to set.
|
||||
*/
|
||||
setFriendlyName(name: string): void;
|
||||
|
||||
/**
|
||||
* Add a validator to the list of validators for this field.
|
||||
* @param validator The validator to add. Should be a class that extends from {BaseValidator}.
|
||||
*/
|
||||
addValidator(validator: BaseValidator): void;
|
||||
|
||||
/**
|
||||
* Gets the validators assigned to this field.
|
||||
* @returns {BaseValidator[]} The validators for this field.
|
||||
*/
|
||||
getValidators(): BaseValidator[];
|
||||
|
||||
/**
|
||||
* Runs through all of the validators for the field given a particular value and returns any validation errors
|
||||
* that may have occurred.
|
||||
* @param value The value to validate.
|
||||
* @param model The rest of the model. Used in custom cross-field validations.
|
||||
* @returns {string[]} Any validation errors that may have occurred or an empty array if the value passed is
|
||||
* valid for the field.
|
||||
*/
|
||||
validateValue(value: any, model: any): string[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/// <reference path="./depd.d.ts"/>
|
||||
|
||||
import depd = require('depd');
|
||||
|
||||
var deprecate = depd("depd-tests");
|
||||
|
||||
function assert(condition: boolean, message: string): void {
|
||||
if (!condition) {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
function testDepdMessage(...args: string[]): boolean {
|
||||
if (arguments.length < 1) {
|
||||
deprecate('testDepdMessage argument.lenth<1');
|
||||
return true;
|
||||
} else {
|
||||
console.log('normal logic');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
assert(testDepdMessage() === true, "Deprecated code must be triggered!");
|
||||
assert(testDepdMessage('a') === false, "Deprecated code must be triggered!");
|
||||
|
||||
interface ITestObject {
|
||||
p1: string;
|
||||
p2: string;
|
||||
}
|
||||
|
||||
var obj = <ITestObject>{ p1: 'deprecated property', p2: 'normal property' };
|
||||
deprecate.property(obj, 'p1', 'property [p1] is deprecated!');
|
||||
|
||||
console.log(obj.p1);
|
||||
|
||||
interface ITestDeprecatedFunction {
|
||||
func1?: Function;
|
||||
func2?: Function;
|
||||
}
|
||||
|
||||
var obj2 = <ITestDeprecatedFunction>{};
|
||||
|
||||
// message automatically derived from function name
|
||||
obj2.func1 = deprecate.function(function func1() {
|
||||
console.log('all calls to [func1] are deprecated ');
|
||||
});
|
||||
|
||||
// specific message
|
||||
obj2.func2 = deprecate.function(function () {
|
||||
console.log('all calls to [func2] are deprecated ');
|
||||
}, 'func2');
|
||||
|
||||
obj2.func1();
|
||||
obj2.func2();
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for depd 1.1.0
|
||||
// Project: https://github.com/dougwilson/nodejs-depd
|
||||
// Definitions by: Zhiyuan Wang <https://github.com/danny8002/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module 'depd' {
|
||||
function depd(namespace: string): Deprecate;
|
||||
|
||||
interface Deprecate {
|
||||
(message: string): void;
|
||||
function(fn: Function, message?: string): Function;
|
||||
property(obj: Object, prop: string, message: string): void;
|
||||
}
|
||||
|
||||
export = depd;
|
||||
}
|
||||
Vendored
+6572
File diff suppressed because it is too large
Load Diff
Vendored
+47
-39
@@ -1,4 +1,4 @@
|
||||
// Type definitions for DevExtreme 15.1.7
|
||||
// Type definitions for DevExtreme 15.1.8
|
||||
// Project: http://js.devexpress.com/
|
||||
// Definitions by: DevExpress Inc. <http://devexpress.com/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -35,7 +35,7 @@ declare module DevExpress {
|
||||
brokenRules: any[];
|
||||
validators: IValidator[];
|
||||
}
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
export interface GroupConfig extends EventsMixin<GroupConfig> {
|
||||
group: any;
|
||||
validators: IValidator[];
|
||||
validate(): ValidationGroupValidationResult;
|
||||
@@ -56,7 +56,7 @@ declare module DevExpress {
|
||||
/** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */
|
||||
export function validateModel(model: Object): ValidationGroupValidationResult;
|
||||
/** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */
|
||||
export function registerModelForValidation(model: Object): void;
|
||||
export function registerModelForValidation(model: Object) : void;
|
||||
}
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
/** Processes the hardware back button click. */
|
||||
@@ -223,10 +223,14 @@ declare module DevExpress {
|
||||
endUpdate(): void;
|
||||
/** Returns an instance of this component class. */
|
||||
instance(): Component;
|
||||
/** Sets one or more options of this component. */
|
||||
option(options: Object): void;
|
||||
/** Returns the configuration options of this component. */
|
||||
option(): Object;
|
||||
option(): {
|
||||
[optionKey: string]: any;
|
||||
};
|
||||
/** Sets one or more options of this component. */
|
||||
option(options: {
|
||||
[optionKey: string]: any;
|
||||
}): void;
|
||||
/** Gets the value of the specified configuration option of this component. */
|
||||
option(optionName: string): any;
|
||||
/** Sets a value to the specified configuration option of this component. */
|
||||
@@ -1384,11 +1388,11 @@ declare module DevExpress.ui {
|
||||
};
|
||||
/** A handler for the click event. */
|
||||
onClick?: any;
|
||||
clickAction?: any;
|
||||
clickAction?: any;
|
||||
/** Specifies whether or not map widget controls are available. */
|
||||
controls?: boolean;
|
||||
/** Specifies the height of the widget. */
|
||||
height?: number;
|
||||
height?: any;
|
||||
/** A key used to authenticate the application within the required map provider. */
|
||||
key?: {
|
||||
/** A key used to authenticate the application within the "Bing" map provider. */
|
||||
@@ -1400,31 +1404,31 @@ declare module DevExpress.ui {
|
||||
}
|
||||
/** A handler for the markerAdded event. */
|
||||
onMarkerAdded?: Function;
|
||||
markerAddedAction?: Function;
|
||||
markerAddedAction?: Function;
|
||||
/** A URL pointing to the custom icon to be used for map markers. */
|
||||
markerIconSrc?: string;
|
||||
/** A handler for the markerRemoved event. */
|
||||
onMarkerRemoved?: Function;
|
||||
markerRemovedAction?: Function;
|
||||
markerRemovedAction?: Function;
|
||||
/** An array of markers displayed on a map. */
|
||||
markers?: Array<any>;
|
||||
/** The name of the current map data provider. */
|
||||
provider?: string;
|
||||
/** A handler for the ready event. */
|
||||
onReady?: Function;
|
||||
readyAction?: Function;
|
||||
readyAction?: Function;
|
||||
/** A handler for the routeAdded event. */
|
||||
onRouteAdded?: Function;
|
||||
routeAddedAction?: Function;
|
||||
routeAddedAction?: Function;
|
||||
/** A handler for the routeRemoved event. */
|
||||
onRouteRemoved?: Function;
|
||||
routeRemovedAction?: Function;
|
||||
routeRemovedAction?: Function;
|
||||
/** An array of routes shown on the map. */
|
||||
routes?: Array<any>;
|
||||
/** The type of a map to display. */
|
||||
type?: string;
|
||||
/** Specifies the width of the widget. */
|
||||
width?: number;
|
||||
width?: any;
|
||||
/** The zoom level of the map. */
|
||||
zoom?: number;
|
||||
}
|
||||
@@ -1435,7 +1439,7 @@ declare module DevExpress.ui {
|
||||
/** Adds a marker to the map. */
|
||||
addMarker(markerOptions: Object): JQueryPromise<Object>;
|
||||
/** Adds a route to the map. */
|
||||
addRoute(options: Object): JQueryPromise<Object>;
|
||||
addRoute(routeOptions: Object): JQueryPromise<Object>;
|
||||
/** Removes a marker from the map. */
|
||||
removeMarker(marker: Object): JQueryPromise<void>;
|
||||
/** Removes a route from the map. */
|
||||
@@ -1787,7 +1791,7 @@ declare module DevExpress.ui {
|
||||
interval?: number;
|
||||
/** Specifies the maximum zoom level of a calendar, which is used to pick the date. */
|
||||
maxZoomLevel?: string;
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
/** Specifies the minimal zoom level of a calendar, which is used to pick the date. */
|
||||
minZoomLevel?: string;
|
||||
/** Specifies the type of date/time picker. */
|
||||
pickerType?: string;
|
||||
@@ -1825,8 +1829,8 @@ declare module DevExpress.ui {
|
||||
maxZoomLevel?: string;
|
||||
/** Specifies the minimum zoom level of the calendar. */
|
||||
minZoomLevel?: string;
|
||||
/** The template to be used for rendering calendar cells. */
|
||||
cellTemplate?: any;
|
||||
/** The template to be used for rendering calendar cells. */
|
||||
cellTemplate?: any;
|
||||
}
|
||||
/** A calendar widget. */
|
||||
export class dxCalendar extends Editor {
|
||||
@@ -1976,6 +1980,8 @@ declare module DevExpress.ui {
|
||||
onProgress?: Function;
|
||||
/** A handler for the uploadError event. */
|
||||
onUploadError?: Function;
|
||||
/** A handler for the valueChanged event. */
|
||||
onValueChanged?: Function;
|
||||
}
|
||||
/** A widget used to select and upload a file or multiple files. */
|
||||
export class dxFileUploader extends Editor {
|
||||
@@ -2145,6 +2151,11 @@ interface JQuery {
|
||||
dxSelectBox(options: string): any;
|
||||
dxSelectBox(options: string, ...params: any[]): any;
|
||||
dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery;
|
||||
dxTagBox(): JQuery;
|
||||
dxTagBox(options: "instance"): DevExpress.ui.dxTagBox;
|
||||
dxTagBox(options: string): any;
|
||||
dxTagBox(options: string, ...params: any[]): any;
|
||||
dxTagBox(options: DevExpress.ui.dxTagBoxOptions): JQuery;
|
||||
dxScrollView(): JQuery;
|
||||
dxScrollView(options: "instance"): DevExpress.ui.dxScrollView;
|
||||
dxScrollView(options: string): any;
|
||||
@@ -3036,9 +3047,6 @@ declare module DevExpress.ui {
|
||||
showInColumnChooser?: boolean;
|
||||
/** Specifies the identifier of the column. */
|
||||
name?: string;
|
||||
// NOTE https://github.com/borisyankov/DefinitelyTyped/pull/5590
|
||||
text?: string;
|
||||
value?: any;
|
||||
}
|
||||
export interface dxDataGridOptions extends WidgetOptions {
|
||||
/** Specifies whether the outer borders of the grid are visible or not. */
|
||||
@@ -4291,16 +4299,16 @@ declare module DevExpress.viz.core {
|
||||
}) => void;
|
||||
/** A handler for the incidentOccurred event. */
|
||||
onIncidentOccurred?: (
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
component: BaseWidget,
|
||||
element: Element,
|
||||
target: {
|
||||
id: string;
|
||||
type: string;
|
||||
args: any;
|
||||
text: string;
|
||||
widget: string;
|
||||
version: string;
|
||||
}
|
||||
) => void;
|
||||
/** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */
|
||||
pathModified?: boolean;
|
||||
@@ -5194,9 +5202,9 @@ declare module DevExpress.viz.charts {
|
||||
export interface BaseChartOptions<TPoint> extends viz.core.BaseWidgetOptions {
|
||||
/** Specifies adaptive layout options. */
|
||||
adaptiveLayout?: {
|
||||
/** Specifies the width of the widget container that is small enough for the layout to begin adapting. */
|
||||
/** Specifies the width of the widget that is small enough for the layout to begin adapting. */
|
||||
width?: number;
|
||||
/** Specifies the height of the widget container that is small enough for the layout to begin adapting. */
|
||||
/** Specifies the height of the widget that is small enough for the layout to begin adapting. */
|
||||
height?: number;
|
||||
/** Specifies whether or not point labels can be hidden when the layout is adapting. */
|
||||
keepLabels?: boolean;
|
||||
@@ -6049,8 +6057,8 @@ declare module DevExpress.viz.rangeSelector {
|
||||
useTicksAutoArrangement?: boolean;
|
||||
/** Specifies the type of values on the scale. */
|
||||
valueType?: string;
|
||||
/** Specifies the order of arguments on a discrete scale. */
|
||||
categories?: Array<any>;
|
||||
/** Specifies the order of arguments on a discrete scale. */
|
||||
categories?: Array<any>;
|
||||
};
|
||||
/** Specifies the range to be selected when displaying the dxRangeSelector. */
|
||||
selectedRange?: {
|
||||
@@ -6351,9 +6359,9 @@ declare module DevExpress.viz.map {
|
||||
centerChanged?: (center: Array<number>) => void;
|
||||
/** A handler for the centerChanged event. */
|
||||
onCenterChanged?: (e: {
|
||||
center: Array<number>;
|
||||
component: dxVectorMap;
|
||||
element: Element;
|
||||
center: Array<number>;
|
||||
component: dxVectorMap;
|
||||
element: Element;
|
||||
}) => void;
|
||||
/** A handler for the tooltipShown event. */
|
||||
onTooltipShown?: (e: {
|
||||
@@ -6569,4 +6577,4 @@ interface JQuery {
|
||||
dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery;
|
||||
dxSparkline(methodName: string, ...params: any[]): any;
|
||||
dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -38,7 +38,7 @@ declare class Dexie {
|
||||
|
||||
static deepClone(obj: Object): Object;
|
||||
|
||||
version(versionNumber: Number): Dexie.Version
|
||||
version(versionNumber: number): Dexie.Version
|
||||
|
||||
on: {
|
||||
(eventName: string, subscriber: () => any): void;
|
||||
|
||||
Vendored
+2
-2
@@ -1229,7 +1229,7 @@ interface SchedulerStatic{
|
||||
* return the event object by its id
|
||||
* @param event_id event_id
|
||||
*/
|
||||
getEvent(event_id: any);
|
||||
getEvent<T>(event_id: any): T;
|
||||
|
||||
/**
|
||||
* gets the event's end date
|
||||
@@ -1601,4 +1601,4 @@ interface SchedulerStatic{
|
||||
|
||||
|
||||
|
||||
declare var scheduler: SchedulerStatic;
|
||||
declare var scheduler: SchedulerStatic;
|
||||
|
||||
Vendored
+995
-995
File diff suppressed because it is too large
Load Diff
Vendored
+642
-642
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+73
-60
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Durandal 2.1.0
|
||||
// Type definitions for Durandal 2.1.0
|
||||
// Project: http://durandaljs.com
|
||||
// Definitions by: Blue Spire <https://github.com/BlueSpire>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -12,6 +12,18 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
// By default, Durandal uses JQuery's Defer/Promise implementation, but durandal supports injecting/configuring
|
||||
// usage of different JavaScript Defer/Promise libraries (f.ex. Q or ES6 Promise polyfills).
|
||||
// You might therefore want to use a different interface from a community typings file or your custom unified interface.
|
||||
// When using f.ex. Q as Defer/Promise library replace the lines below with:
|
||||
|
||||
// <reference path="../q/Q.d.ts" />
|
||||
// interface DurandalPromise<T> extends Q.Promise<T>
|
||||
// interface DurandalDeferred<T> extends Q.Deferred<T>
|
||||
|
||||
interface DurandalPromise<T> extends JQueryPromise<T> { }
|
||||
interface DurandalDeferred<T> extends JQueryDeferred<T> { }
|
||||
|
||||
/**
|
||||
* The system module encapsulates the most basic features used by other modules.
|
||||
* @requires require
|
||||
@@ -45,7 +57,7 @@ interface DurandalSystemModule {
|
||||
* @param {object} obj The object whose module id you wish to set.
|
||||
* @param {string} id The id to set for the specified object.
|
||||
*/
|
||||
setModuleId(obj, id: string): void;
|
||||
setModuleId(obj: any, id: string): void;
|
||||
|
||||
/**
|
||||
* Resolves the default object instance for a module. If the module is an object, the module is returned. If the module is a function, that function is called with `new` and it's result is returned.
|
||||
@@ -89,9 +101,9 @@ interface DurandalSystemModule {
|
||||
/**
|
||||
* Creates a deferred object which can be used to create a promise. Optionally pass a function action to perform which will be passed an object used in resolving the promise.
|
||||
* @param {function} [action] The action to defer. You will be passed the deferred object as a paramter.
|
||||
* @returns {JQueryDeferred} The deferred object.
|
||||
* @returns {Deferred} The deferred object.
|
||||
*/
|
||||
defer<T>(action?: (dfd: JQueryDeferred<T>) => void): JQueryDeferred<T>;
|
||||
defer<T>(action?: (dfd: DurandalDeferred<T>) => void): DurandalDeferred<T>;
|
||||
|
||||
/**
|
||||
* Creates a simple V4 UUID. This should not be used as a PK in your database. It can be used to generate internal, unique ids. For a more robust solution see [node-uuid](https://github.com/broofa/node-uuid).
|
||||
@@ -102,23 +114,23 @@ interface DurandalSystemModule {
|
||||
/**
|
||||
* Uses require.js to obtain a module. This function returns a promise which resolves with the module instance.
|
||||
* @param {string} moduleId The id of the module to load.
|
||||
* @returns {JQueryPromise} A promise for the loaded module.
|
||||
* @returns {Promise} A promise for the loaded module.
|
||||
*/
|
||||
acquire(moduleId: string): JQueryPromise<any>;
|
||||
acquire(moduleId: string): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Uses require.js to obtain an array of modules. This function returns a promise which resolves with the modules instances in an array.
|
||||
* @param {string[]} moduleIds The ids of the modules to load.
|
||||
* @returns {JQueryPromise} A promise for the loaded module.
|
||||
* @returns {Promise} A promise for the loaded module.
|
||||
*/
|
||||
acquire(modules: string[]): JQueryPromise<any[]>;
|
||||
acquire(modules: string[]): DurandalPromise<any[]>;
|
||||
|
||||
/**
|
||||
* Uses require.js to obtain multiple modules. This function returns a promise which resolves with the module instances in an array.
|
||||
* @param {string} moduleIds* The ids of the modules to load.
|
||||
* @returns {JQueryPromise} A promise for the loaded module.
|
||||
* @returns {Promise} A promise for the loaded module.
|
||||
*/
|
||||
acquire(...moduleIds: string[]): JQueryPromise<any[]>;
|
||||
acquire(...moduleIds: string[]): DurandalPromise<any[]>;
|
||||
|
||||
/**
|
||||
* Extends the first object with the properties of the following objects.
|
||||
@@ -130,9 +142,9 @@ interface DurandalSystemModule {
|
||||
/**
|
||||
* Uses a setTimeout to wait the specified milliseconds.
|
||||
* @param {number} milliseconds The number of milliseconds to wait.
|
||||
* @returns {JQueryPromise}
|
||||
* @returns {Promise}
|
||||
*/
|
||||
wait(milliseconds: number): JQueryPromise<any>;
|
||||
wait(milliseconds: number): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Gets all the owned keys of the specified object.
|
||||
@@ -295,14 +307,14 @@ interface DurandalViewEngineModule {
|
||||
* @param {string} id The view id whose view should be cached.
|
||||
* @param {DOMElement} view The view to cache.
|
||||
*/
|
||||
putViewInCache(id: string, view: HTMLElement);
|
||||
putViewInCache(id: string, view: HTMLElement): void;
|
||||
|
||||
/**
|
||||
* Creates the view associated with the view id.
|
||||
* @param {string} viewId The view id whose view should be created.
|
||||
* @returns {JQueryPromise<HTMLElement>} A promise of the view.
|
||||
* @returns {DurandalPromise<HTMLElement>} A promise of the view.
|
||||
*/
|
||||
createView(viewId: string): JQueryPromise<HTMLElement>;
|
||||
createView(viewId: string): DurandalPromise<HTMLElement>;
|
||||
|
||||
/**
|
||||
* Called when a view cannot be found to provide the opportunity to locate or generate a fallback view. Mainly used to ease development.
|
||||
@@ -311,7 +323,7 @@ interface DurandalViewEngineModule {
|
||||
* @param {Error} requirePath The error that was returned from the attempt to locate the default view.
|
||||
* @returns {Promise} A promise for the fallback view.
|
||||
*/
|
||||
createFallbackView(viewId: string, requirePath: string, err: Error): JQueryPromise<HTMLElement>;
|
||||
createFallbackView(viewId: string, requirePath: string, err: Error): DurandalPromise<HTMLElement>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,7 +451,7 @@ interface DurandalViewLocatorModule {
|
||||
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
|
||||
* @returns {Promise} A promise of the view.
|
||||
*/
|
||||
locateViewForObject(obj: any, area: string, elementsToSearch?: HTMLElement[]): JQueryPromise<HTMLElement>;
|
||||
locateViewForObject(obj: any, area: string, elementsToSearch?: HTMLElement[]): DurandalPromise<HTMLElement>;
|
||||
|
||||
/**
|
||||
* Converts a module id into a view id. By default the ids are the same.
|
||||
@@ -470,7 +482,7 @@ interface DurandalViewLocatorModule {
|
||||
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
|
||||
* @returns {Promise} A promise of the view.
|
||||
*/
|
||||
locateView(view: HTMLElement, area?: string, elementsToSearch?: HTMLElement[]): JQueryPromise<HTMLElement>;
|
||||
locateView(view: HTMLElement, area?: string, elementsToSearch?: HTMLElement[]): DurandalPromise<HTMLElement>;
|
||||
|
||||
/**
|
||||
* Locates the specified view.
|
||||
@@ -479,7 +491,7 @@ interface DurandalViewLocatorModule {
|
||||
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
|
||||
* @returns {Promise} A promise of the view.
|
||||
*/
|
||||
locateView(viewUrlOrId: string, area?: string, elementsToSearch?: HTMLElement[]): JQueryPromise<HTMLElement>;
|
||||
locateView(viewUrlOrId: string, area?: string, elementsToSearch?: HTMLElement[]): DurandalPromise<HTMLElement>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -514,7 +526,7 @@ declare module 'durandal/composition' {
|
||||
area?: string;
|
||||
preserveContext?: boolean;
|
||||
activate?: boolean;
|
||||
strategy?: (context: CompositionContext) => JQueryPromise<HTMLElement>;
|
||||
strategy?: (context: CompositionContext) => DurandalPromise<HTMLElement>;
|
||||
composingNewView: boolean;
|
||||
child: HTMLElement;
|
||||
binding?: (child: HTMLElement, parent: HTMLElement, context: CompositionContext) => void;
|
||||
@@ -547,7 +559,7 @@ declare module 'durandal/composition' {
|
||||
* @param {object} [config] The binding handler instance. If none is provided, the name will be used to look up an existing handler which will then be converted to a composition handler.
|
||||
* @param {function} [initOptionsFactory] If the registered binding needs to return options from its init call back to knockout, this function will server as a factory for those options. It will receive the same parameters that the init function does.
|
||||
*/
|
||||
export function addBindingHandler(name, config?: KnockoutBindingHandler, initOptionsFactory?: (element?: HTMLElement, valueAccessor?: any, allBindingsAccessor?: any, viewModel?: any, bindingContext?: KnockoutBindingContext) => any);
|
||||
export function addBindingHandler(name: string, config?: KnockoutBindingHandler, initOptionsFactory?: (element?: HTMLElement, valueAccessor?: any, allBindingsAccessor?: any, viewModel?: any, bindingContext?: KnockoutBindingContext) => any): void;
|
||||
|
||||
/**
|
||||
* Gets an object keyed with all the elements that are replacable parts, found within the supplied elements. The key will be the part name and the value will be the element itself.
|
||||
@@ -568,7 +580,7 @@ declare module 'durandal/composition' {
|
||||
* @param {object} context The composition context containing the model and possibly existing viewElements.
|
||||
* @returns {promise} A promise for the view.
|
||||
*/
|
||||
export var defaultStrategy: (context: CompositionContext) => JQueryPromise<HTMLElement>;
|
||||
export var defaultStrategy: (context: CompositionContext) => DurandalPromise<HTMLElement>;
|
||||
|
||||
/**
|
||||
* Initiates a composition.
|
||||
@@ -663,13 +675,13 @@ declare module 'plugins/dialog' {
|
||||
* In this function, you are expected to add a DOM element to the tree which will serve as the "host" for the modal's composed view. You must add a property called host to the modalWindow object which references the dom element. It is this host which is passed to the composition module.
|
||||
* @param {Dialog} theDialog The dialog model.
|
||||
*/
|
||||
addHost(theDialog: Dialog);
|
||||
addHost(theDialog: Dialog): void;
|
||||
|
||||
/**
|
||||
* This function is expected to remove any DOM machinery associated with the specified dialog and do any other necessary cleanup.
|
||||
* @param {Dialog} theDialog The dialog model.
|
||||
*/
|
||||
removeHost(theDialog: Dialog);
|
||||
removeHost(theDialog: Dialog): void;
|
||||
|
||||
/**
|
||||
* This function is called after the modal is fully composed into the DOM, allowing your implementation to do any final modifications, such as positioning or animation. You can obtain the original dialog object by using `getDialog` on context.model.
|
||||
@@ -677,14 +689,14 @@ declare module 'plugins/dialog' {
|
||||
* @param {DOMElement} parent The parent view.
|
||||
* @param {object} context The composition context.
|
||||
*/
|
||||
compositionComplete(child: HTMLElement, parent: HTMLElement, context: composition.CompositionContext);
|
||||
compositionComplete(child: HTMLElement, parent: HTMLElement, context: composition.CompositionContext): void;
|
||||
}
|
||||
|
||||
interface Dialog {
|
||||
owner: any;
|
||||
context: DialogContext;
|
||||
activator: DurandalActivator<any>;
|
||||
close(): JQueryPromise<any>;
|
||||
close(): DurandalPromise<any>;
|
||||
settings: composition.CompositionContext;
|
||||
}
|
||||
|
||||
@@ -745,7 +757,7 @@ declare module 'plugins/dialog' {
|
||||
* @param {string} [context] The name of the dialog context to use. Uses the default context if none is specified.
|
||||
* @returns {Promise} A promise that resolves when the dialog is closed and returns any data passed at the time of closing.
|
||||
*/
|
||||
export function show(obj: any, activationData?: any, context?: string): JQueryPromise<any>;
|
||||
export function show(obj: any, activationData?: any, context?: string): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Shows a message box.
|
||||
@@ -756,7 +768,7 @@ declare module 'plugins/dialog' {
|
||||
* @param {Object} [settings] Custom settings for this instance of the messsage box, used to change classes and styles.
|
||||
* @returns {Promise} A promise that resolves when the message box is closed and returns the selected option.
|
||||
*/
|
||||
export function showMessage(message: string, title?: string, options?: string[], autoclose?: boolean, settings?: Object): JQueryPromise<string>;
|
||||
export function showMessage(message: string, title?: string, options?: string[], autoclose?: boolean, settings?: Object): DurandalPromise<string>;
|
||||
|
||||
/**
|
||||
* Shows a message box.
|
||||
@@ -767,7 +779,7 @@ declare module 'plugins/dialog' {
|
||||
* @param {Object} [settings] Custom settings for this instance of the messsage box, used to change classes and styles.
|
||||
* @returns {Promise} A promise that resolves when the message box is closed and returns the selected option.
|
||||
*/
|
||||
export function showMessage(message: string, title?: string, options?: DialogButton[], autoclose?: boolean, settings?: Object): JQueryPromise<any>;
|
||||
export function showMessage(message: string, title?: string, options?: DialogButton[], autoclose?: boolean, settings?: Object): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Installs this module into Durandal; called by the framework. Adds `app.showDialog` and `app.showMessage` convenience methods.
|
||||
@@ -890,7 +902,7 @@ declare module 'plugins/http' {
|
||||
* @param {object} [headers] The data to add to the request header. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
|
||||
* @returns {Promise} A promise of the get response data.
|
||||
*/
|
||||
export function get(url: string, query?: Object, headers?: Object): JQueryPromise<any>;
|
||||
export function get(url: string, query?: Object, headers?: Object): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Makes an JSONP request.
|
||||
@@ -900,7 +912,7 @@ declare module 'plugins/http' {
|
||||
* @param {object} [headers] The data to add to the request header. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
|
||||
* @returns {Promise} A promise of the response data.
|
||||
*/
|
||||
export function jsonp(url: string, query?: Object, callbackParam?: string, headers?: Object): JQueryPromise<any>;
|
||||
export function jsonp(url: string, query?: Object, callbackParam?: string, headers?: Object): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Makes an HTTP POST request.
|
||||
@@ -909,7 +921,7 @@ declare module 'plugins/http' {
|
||||
* @param {object} [headers] The data to add to the request header. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
|
||||
* @returns {Promise} A promise of the response data.
|
||||
*/
|
||||
export function post(url: string, data: Object, headers?: Object): JQueryPromise<any>;
|
||||
export function post(url: string, data: Object, headers?: Object): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Makes an HTTP PUT request.
|
||||
@@ -919,7 +931,7 @@ declare module 'plugins/http' {
|
||||
* @param {object} [headers] The data to add to the request header. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
|
||||
* @return {Promise} A promise of the response data.
|
||||
*/
|
||||
export function put(url: string, data: Object, headers?: Object): JQueryPromise<any>;
|
||||
export function put(url: string, data: Object, headers?: Object): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Makes an HTTP DELETE request.
|
||||
@@ -929,7 +941,7 @@ declare module 'plugins/http' {
|
||||
* @param {object} [headers] The data to add to the request header. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
|
||||
* @return {Promise} A promise of the get response data.
|
||||
*/
|
||||
export function remove(url: string, query?: Object, headers?: Object): JQueryPromise<any>;
|
||||
export function remove(url: string, query?: Object, headers?: Object): DurandalPromise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -964,7 +976,7 @@ declare module 'plugins/observable' {
|
||||
* @param {function|object} evaluatorOrOptions The Knockout computed function or computed options object.
|
||||
* @returns {KnockoutComputed} The underlying computed observable.
|
||||
*/
|
||||
export function defineProperty<T>(obj: any, propertyName: string, evaluatorOrOptions?: KnockoutComputedDefine<T>);
|
||||
export function defineProperty<T>(obj: any, propertyName: string, evaluatorOrOptions?: KnockoutComputedDefine<T>): KnockoutComputed<T>;
|
||||
|
||||
/**
|
||||
* Installs the plugin into the view model binder's `beforeBind` hook so that objects are automatically converted before being bound.
|
||||
@@ -1046,7 +1058,7 @@ declare module 'plugins/serializer' {
|
||||
* @param {object} [settings] Settings can specify a replacer or space to override the serializer defaults.
|
||||
* @returns {string} The JSON string.
|
||||
*/
|
||||
export function serialize(object: any, settings?: string);
|
||||
export function serialize(object: any, settings?: string): string;
|
||||
|
||||
/**
|
||||
* Serializes the object.
|
||||
@@ -1054,7 +1066,7 @@ declare module 'plugins/serializer' {
|
||||
* @param {object} [settings] Settings can specify a replacer or space to override the serializer defaults.
|
||||
* @returns {string} The JSON string.
|
||||
*/
|
||||
export function serialize(object: any, settings?: number);
|
||||
export function serialize(object: any, settings?: number): string;
|
||||
|
||||
/**
|
||||
* Serializes the object.
|
||||
@@ -1062,7 +1074,7 @@ declare module 'plugins/serializer' {
|
||||
* @param {object} [settings] Settings can specify a replacer or space to override the serializer defaults.
|
||||
* @returns {string} The JSON string.
|
||||
*/
|
||||
export function serialize(object: any, settings?: SerializerOptions);
|
||||
export function serialize(object: any, settings?: SerializerOptions): string;
|
||||
|
||||
/**
|
||||
* Gets the type id for an object instance, using the configured `typeAttribute`.
|
||||
@@ -1081,7 +1093,7 @@ declare module 'plugins/serializer' {
|
||||
* @param {string} typeId The type id.
|
||||
* @param {function} constructor The constructor.
|
||||
*/
|
||||
export function registerType(typeId: string, constructor: () => any);
|
||||
export function registerType(typeId: string, constructor: () => any): void;
|
||||
|
||||
/**
|
||||
* The default reviver function used during deserialization. By default is detects type properties on objects and uses them to re-construct the correct object using the provided constructor mapping.
|
||||
@@ -1091,7 +1103,7 @@ declare module 'plugins/serializer' {
|
||||
* @param {object} getConstructor A custom function used to get the constructor function associated with a type id.
|
||||
* @returns {object} The value.
|
||||
*/
|
||||
export function reviver(key: string, value: any, getTypeId: (value: any) => string, getConstructor: (string) => () => any): any;
|
||||
export function reviver(key: string, value: any, getTypeId: (value: any) => string, getConstructor: (id: string) => () => any): any;
|
||||
|
||||
/**
|
||||
* Deserialize the JSON.
|
||||
@@ -1128,7 +1140,7 @@ declare module 'plugins/widget' {
|
||||
* Creates a ko binding handler for the specified kind.
|
||||
* @param {string} kind The kind to create a custom binding handler for.
|
||||
*/
|
||||
export function registerKind(kind: string);
|
||||
export function registerKind(kind: string): void;
|
||||
|
||||
/**
|
||||
* Maps views and module to the kind identifier if a non-standard pattern is desired.
|
||||
@@ -1136,7 +1148,7 @@ declare module 'plugins/widget' {
|
||||
* @param {string} [viewId] The unconventional view id to map the kind to.
|
||||
* @param {string} [moduleId] The unconventional module id to map the kind to.
|
||||
*/
|
||||
export function mapKind(kind: string, viewId?: string, moduleId?: string);
|
||||
export function mapKind(kind: string, viewId?: string, moduleId?: string): void;
|
||||
|
||||
/**
|
||||
* Maps a kind name to it's module id. First it looks up a custom mapped kind, then falls back to `convertKindToModulePath`.
|
||||
@@ -1172,7 +1184,7 @@ declare module 'plugins/widget' {
|
||||
* @param {object} settings The widget settings.
|
||||
* @param {object} [bindingContext] The current binding context.
|
||||
*/
|
||||
export function create(element: HTMLElement, settings: WidgetSettings, bindingContext?: KnockoutBindingContext);
|
||||
export function create(element: HTMLElement, settings: WidgetSettings, bindingContext?: KnockoutBindingContext): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1279,14 +1291,14 @@ interface DurandalAppModule extends DurandalEventSupport<DurandalAppModule> {
|
||||
* @param {string} [context] The name of the dialog context to use. Uses the default context if none is specified.
|
||||
* @returns {Promise} A promise that resolves when the dialog is closed and returns any data passed at the time of closing.
|
||||
*/
|
||||
showDialog(obj: any, activationData?: any, context?: string): JQueryPromise<any>;
|
||||
showDialog(obj: any, activationData?: any, context?: string): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Closes the dialog associated with the specified object. via the dialog plugin.
|
||||
* @param {object} obj The object whose dialog should be closed.
|
||||
* @param {object} results* The results to return back to the dialog caller after closing.
|
||||
*/
|
||||
closeDialog(obj: any, ...results);
|
||||
closeDialog(obj: any, ...results: any[]): void;
|
||||
|
||||
/**
|
||||
* Shows a message box via the dialog plugin.
|
||||
@@ -1297,7 +1309,7 @@ interface DurandalAppModule extends DurandalEventSupport<DurandalAppModule> {
|
||||
* @param {Object} [settings] Custom settings for this instance of the messsage box, used to change classes and styles.
|
||||
* @returns {Promise} A promise that resolves when the message box is closed and returns the selected option.
|
||||
*/
|
||||
showMessage(message: string, title?: string, options?: string[], autoclose?: boolean, settings?: Object): JQueryPromise<string>;
|
||||
showMessage(message: string, title?: string, options?: string[], autoclose?: boolean, settings?: Object): DurandalPromise<string>;
|
||||
|
||||
/**
|
||||
* Shows a message box.
|
||||
@@ -1308,7 +1320,7 @@ interface DurandalAppModule extends DurandalEventSupport<DurandalAppModule> {
|
||||
* @param {Object} [settings] Custom settings for this instance of the messsage box, used to change classes and styles.
|
||||
* @returns {Promise} A promise that resolves when the message box is closed and returns the selected option.
|
||||
*/
|
||||
showMessage(message: string, title?: string, options?: DialogButton[], autoclose?: boolean, settings?: Object): JQueryPromise<any>;
|
||||
showMessage(message: string, title?: string, options?: DialogButton[], autoclose?: boolean, settings?: Object): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Configures one or more plugins to be loaded and installed into the application.
|
||||
@@ -1322,7 +1334,7 @@ interface DurandalAppModule extends DurandalEventSupport<DurandalAppModule> {
|
||||
* Starts the application.
|
||||
* @returns {promise}
|
||||
*/
|
||||
start(): JQueryPromise<any>;
|
||||
start(): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Sets the root module/view for the application.
|
||||
@@ -1404,7 +1416,7 @@ interface DurandalActivator<T> extends KnockoutComputed<T> {
|
||||
* @param {boolean} close Whether or not to check if close is possible.
|
||||
* @returns {promise}
|
||||
*/
|
||||
canDeactivateItem(item: T, close: boolean): JQueryPromise<boolean>;
|
||||
canDeactivateItem(item: T, close: boolean): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Deactivates the specified item.
|
||||
@@ -1412,7 +1424,7 @@ interface DurandalActivator<T> extends KnockoutComputed<T> {
|
||||
* @param {boolean} close Whether or not to close the item.
|
||||
* @returns {promise}
|
||||
*/
|
||||
deactivateItem(item: T, close: boolean): JQueryPromise<boolean>;
|
||||
deactivateItem(item: T, close: boolean): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Determines whether or not the specified item can be activated.
|
||||
@@ -1420,7 +1432,7 @@ interface DurandalActivator<T> extends KnockoutComputed<T> {
|
||||
* @param {object} activationData Data associated with the activation.
|
||||
* @returns {promise}
|
||||
*/
|
||||
canActivateItem(newItem: T, activationData?: any): JQueryPromise<boolean>;
|
||||
canActivateItem(newItem: T, activationData?: any): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Activates the specified item.
|
||||
@@ -1428,31 +1440,31 @@ interface DurandalActivator<T> extends KnockoutComputed<T> {
|
||||
* @param {object} newActivationData Data associated with the activation.
|
||||
* @returns {promise}
|
||||
*/
|
||||
activateItem(newItem: T, activationData?: any): JQueryPromise<boolean>;
|
||||
activateItem(newItem: T, activationData?: any): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Determines whether or not the activator, in its current state, can be activated.
|
||||
* @returns {promise}
|
||||
*/
|
||||
canActivate(): JQueryPromise<boolean>;
|
||||
canActivate(): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Activates the activator, in its current state.
|
||||
* @returns {promise}
|
||||
*/
|
||||
activate(): JQueryPromise<boolean>;
|
||||
activate(): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Determines whether or not the activator, in its current state, can be deactivated.
|
||||
* @returns {promise}
|
||||
*/
|
||||
canDeactivate(close: boolean): JQueryPromise<boolean>;
|
||||
canDeactivate(close: boolean): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Deactivates the activator, in its current state.
|
||||
* @returns {promise}
|
||||
*/
|
||||
deactivate(close: boolean): JQueryPromise<boolean>;
|
||||
deactivate(close: boolean): DurandalPromise<boolean>;
|
||||
|
||||
/**
|
||||
* Adds canActivate, activate, canDeactivate and deactivate functions to the provided model which pass through to the corresponding functions on the activator.
|
||||
@@ -1462,7 +1474,7 @@ interface DurandalActivator<T> extends KnockoutComputed<T> {
|
||||
/**
|
||||
* Sets up a collection representing a pool of objects which the activator will activate. See below for details. Activators without an item bool always close their values on deactivate. Activators with an items pool only deactivate, but do not close them.
|
||||
*/
|
||||
forItems(items): DurandalActivator<T>;
|
||||
forItems(items: any[]): DurandalActivator<T>;
|
||||
}
|
||||
|
||||
interface DurandalHistoryOptions {
|
||||
@@ -1509,7 +1521,7 @@ interface DurandalRouteConfiguration {
|
||||
title?: any;
|
||||
moduleId?: string;
|
||||
hash?: string;
|
||||
route?: string|string[];
|
||||
route?: string | string[];
|
||||
routePattern?: RegExp;
|
||||
isActive?: KnockoutComputed<boolean>;
|
||||
nav?: any;
|
||||
@@ -1529,6 +1541,7 @@ interface DurandalRelativeRouteSettings {
|
||||
moduleId?: string;
|
||||
route?: string;
|
||||
fromParent?: boolean;
|
||||
dynamicHash?: string;
|
||||
}
|
||||
|
||||
interface DurandalRouterBase<T> extends DurandalEventSupport<T> {
|
||||
@@ -1765,7 +1778,7 @@ interface DurandalRouterBase<T> extends DurandalEventSupport<T> {
|
||||
* @param {object} instruction The route instruction. The instruction object has config, fragment, queryString, params and queryParams properties.
|
||||
* @returns {Promise|Boolean|String} If a boolean, determines whether or not the route should activate or be cancelled. If a string, causes a redirect to the specified route. Can also be a promise for either of these value types.
|
||||
*/
|
||||
guardRoute?: (instance: Object, instruction: DurandalRouteInstruction) => JQueryPromise<boolean|string>|boolean|string;
|
||||
guardRoute?: (instance: Object, instruction: DurandalRouteInstruction) => DurandalPromise<boolean | string> | boolean | string;
|
||||
|
||||
/**
|
||||
* Parent router of the current child router.
|
||||
@@ -1785,7 +1798,7 @@ interface DurandalRootRouter extends DurandalRouterBase<DurandalRootRouter> {
|
||||
* Activates the router and the underlying history tracking mechanism.
|
||||
* @returns {Promise} A promise that resolves when the router is ready.
|
||||
*/
|
||||
activate(options?: DurandalHistoryOptions): JQueryPromise<any>;
|
||||
activate(options?: DurandalHistoryOptions): DurandalPromise<any>;
|
||||
|
||||
/**
|
||||
* Disable history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/// <reference path="./electron-builder.d.ts" />
|
||||
|
||||
import * as factory from "electron-builder";
|
||||
const builder = factory.init();
|
||||
|
||||
function callback(err: Error) {
|
||||
const msg = err.message;
|
||||
}
|
||||
|
||||
builder.build({
|
||||
appPath: ".",
|
||||
out: "out",
|
||||
platform: "win",
|
||||
config: {
|
||||
osx: {
|
||||
title: "myapplication",
|
||||
icon: "icon.icns",
|
||||
"icon-size": 80,
|
||||
background: "installer.png",
|
||||
contents: [
|
||||
{ x: 438, y: 344, type: "link", path: "/Applications" },
|
||||
{ x: 192, y: 344, type: "file" },
|
||||
]
|
||||
},
|
||||
win: {
|
||||
title: "myapplication",
|
||||
icon: "icon.ico"
|
||||
}
|
||||
}
|
||||
}, callback);
|
||||
|
||||
const bldr = require("electron-builder").init();
|
||||
|
||||
bldr.build({
|
||||
appPath: ".",
|
||||
out: "out",
|
||||
platform: "osx",
|
||||
config: {
|
||||
osx: {
|
||||
title: "myapplication",
|
||||
icon: "icon.icns",
|
||||
"icon-size": 80,
|
||||
background: "installer.png",
|
||||
contents: [
|
||||
{ x: 438, y: 344, type: "link", path: "/Applications" },
|
||||
{ x: 192, y: 344, type: "file" },
|
||||
]
|
||||
},
|
||||
win: {
|
||||
title: "myapplication",
|
||||
icon: "icon.ico"
|
||||
}
|
||||
}
|
||||
}, callback);
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
// Type definitions for electron-builder v2.0.2
|
||||
// Project: https://github.com/loopline-systems/electron-builder
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare namespace ElectronBuilder {
|
||||
|
||||
/** Electron-builder Options. */
|
||||
export interface Options {
|
||||
/** Source application path. */
|
||||
appPath: string;
|
||||
|
||||
/** Platforms to build. Allowed values: win, osx, all. */
|
||||
platform: string;
|
||||
|
||||
/** Path or Object. Configuration for build. */
|
||||
config: string | Config;
|
||||
|
||||
/** The output directory. */
|
||||
out?: string;
|
||||
|
||||
}
|
||||
|
||||
/** Build configuration by platforms. */
|
||||
export interface Config {
|
||||
/** Configurations for Mac OS X. */
|
||||
osx: {
|
||||
/** Installer title. */
|
||||
title: string;
|
||||
/** Installer background. */
|
||||
background: string;
|
||||
/** Installer icon. */
|
||||
icon: string;
|
||||
/** Installer icon size. */
|
||||
"icon-size": number;
|
||||
/** Installer custom contents. */
|
||||
contents: [OsxContents, OsxContents]
|
||||
};
|
||||
|
||||
/** Configurations for Windows. */
|
||||
win: {
|
||||
/** Installer title. */
|
||||
title: string;
|
||||
/** Installer icon. */
|
||||
icon: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** OSX Installer custom contents. */
|
||||
export interface OsxContents {
|
||||
/** Horizontal position on installer screen (in pixels). */
|
||||
x: number;
|
||||
/** Vertical position on installer screen (in pixels). */
|
||||
y: number;
|
||||
/** Content type. Allowed values are "file", "link". */
|
||||
type: string;
|
||||
/** Link only. Customize link destination path. */
|
||||
path?: string;
|
||||
}
|
||||
|
||||
/** Electron-builder done callback. */
|
||||
export interface Callback {
|
||||
/**
|
||||
* Callback wich is called when electron-builder is done.
|
||||
* @param err - Contains errors if any.
|
||||
*/
|
||||
(err: Error): void
|
||||
}
|
||||
|
||||
/** Prototype for electron-builder. */
|
||||
export interface Builder {
|
||||
/**
|
||||
* Build the installer for given platform.
|
||||
*
|
||||
* @param opts - Options to configure installer.
|
||||
* @param callback - Callback which is called when building is done or an error occured.
|
||||
*/
|
||||
build(opts: Options, callback: Callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "electron-builder" {
|
||||
export function init(): ElectronBuilder.Builder;
|
||||
}
|
||||
|
||||
interface NodeRequireFunction {
|
||||
(id: "electron-builder"): { init(): ElectronBuilder.Builder };
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="./electron-packager.d.ts" />
|
||||
|
||||
import * as packager from "electron-packager";
|
||||
|
||||
function callback(err: Error, appPath: string) {
|
||||
const
|
||||
msg = err.message,
|
||||
index = appPath.indexOf("test");
|
||||
}
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
platform: "win32",
|
||||
arch: "all",
|
||||
version: "0.34.0"
|
||||
}, callback);
|
||||
|
||||
packager({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
version: "0.34.0",
|
||||
all: true
|
||||
}, callback);
|
||||
|
||||
const pkger = require("electron-packager");
|
||||
|
||||
pkger({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
platform: "win32",
|
||||
arch: "all",
|
||||
version: "0.34.0"
|
||||
}, callback);
|
||||
|
||||
pkger({
|
||||
dir: ".",
|
||||
name: "myapplication",
|
||||
version: "0.34.0",
|
||||
all: true
|
||||
}, callback);
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
// Type definitions for electron-packager v5.1.0
|
||||
// Project: https://github.com/maxogden/electron-packager
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare namespace ElectronPackager {
|
||||
/** Electron-packager Options. */
|
||||
export interface Options {
|
||||
/** The source directory. */
|
||||
dir: string;
|
||||
/** The application name. */
|
||||
name: string;
|
||||
/**
|
||||
* Allowed values: linux, win32, darwin, all. Not required if `all` is used.
|
||||
* Arbitrary combinations of individual platforms are also supported via a comma-delimited string or array of strings.
|
||||
*/
|
||||
platform?: string | string[];
|
||||
/** Allowed values: ia32, x64, all Not required if `all` is used. */
|
||||
arch?: string;
|
||||
/** Electron version (without the "v"). See https://github.com/atom/electron/releases. */
|
||||
version: string;
|
||||
|
||||
/** Shortcut for `--arch=all --platform=all`. */
|
||||
all?: boolean;
|
||||
/** The output directory. */
|
||||
out?: string;
|
||||
/**
|
||||
* Currently you must look for conversion tools in order to supply an icon in the format required by the platform:
|
||||
* - OS X: `.icns`
|
||||
* - Windows: `.ico`
|
||||
*
|
||||
* For Linux builds, this option is not required, as the dock/window list icon is set via the icon option in the BrowserWindow contructor.
|
||||
* Setting the icon in the file manager is not currently supported.
|
||||
*
|
||||
* If the file extension is omitted, it is auto-completed to the correct extension based on the platform,
|
||||
* including when `--platform=all` is in effect.
|
||||
*/
|
||||
icon?: string;
|
||||
|
||||
/** The bundle identifier to use in the app plist. */
|
||||
"app-bundle-id"?: string;
|
||||
/** The release version to set for the app. */
|
||||
"app-version"?: string;
|
||||
/** The build version to set for the app (OS X only). */
|
||||
"build-version"?: string;
|
||||
/** The bundle identifier to use in the app helper plist. */
|
||||
"helper-bundle-id"?: string;
|
||||
/** Object hash of application metadata to embed into the executable (Windows only). */
|
||||
"version-string"?: VersionString;
|
||||
|
||||
/** The directory of cached electron downloads. Defaults to "$HOME/.electron". */
|
||||
cache?: string;
|
||||
/** Do not copy files into App whose filenames regex .match this string. */
|
||||
ignore?: RegExp;
|
||||
/** Runs `npm prune --production` on the app. */
|
||||
prune?: boolean;
|
||||
/** If output directory for a platform already exists, replaces it rather than skipping it. */
|
||||
overwrite?: boolean;
|
||||
/** Packages the source code within your app into an archive. */
|
||||
asar?: boolean;
|
||||
/** Unpacks the files to app.asar.unpacked directory whose filenames regex .match this string. */
|
||||
"asar-unpack"?: string;
|
||||
/** Should contain the identity to be used when running `codesign` (OS X only). */
|
||||
sign?: string;
|
||||
}
|
||||
|
||||
/** Object hash of application metadata to embed into the executable (Windows only). */
|
||||
export interface VersionString {
|
||||
CompanyName?: string;
|
||||
LegalCopyright?: string;
|
||||
FileDescription?: string;
|
||||
OriginalFilename?: string;
|
||||
FileVersion?: string;
|
||||
ProductVersion?: string;
|
||||
ProductName?: string;
|
||||
InternalName?: string;
|
||||
}
|
||||
|
||||
/** Electron-packager done callback. */
|
||||
export interface Callback {
|
||||
/**
|
||||
* Callback wich is called when electron-packager is done.
|
||||
*
|
||||
* @param err - Contains errors if any.
|
||||
* @param appPath - Path to the newly created application.
|
||||
*/
|
||||
(err: Error, appPath: string): void
|
||||
}
|
||||
|
||||
/** Electron-packager function */
|
||||
export interface Packager {
|
||||
/**
|
||||
* This will:
|
||||
* - Find or download the correct release of Electron
|
||||
* - Use that version of electron to create a app in <out>/<appname>-<platform>-<arch>
|
||||
*
|
||||
* You should be able to launch the app on the platform you built for. If not, check your settings and try again.
|
||||
*
|
||||
* @param opts - Options to configure packaging.
|
||||
* @param callback - Callback which is called when packaging is done or an error occured.
|
||||
*/
|
||||
(opts: Options, callback: Callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "electron-packager" {
|
||||
const packager: ElectronPackager.Packager;
|
||||
export = packager;
|
||||
}
|
||||
|
||||
interface NodeRequireFunction {
|
||||
(id: "electron-packager"): ElectronPackager.Packager;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user