diff --git a/OpenJsCad/openjscad-tests.ts b/OpenJsCad/openjscad-tests.ts
new file mode 100644
index 0000000000..fd13f0dbb4
--- /dev/null
+++ b/OpenJsCad/openjscad-tests.ts
@@ -0,0 +1,266 @@
+///
+
+function test() {
+
+ var gProcessor: OpenJsCad.Processor = null;
+
+ // Show all exceptions to the user:
+ OpenJsCad.AlertUserOfUncaughtExceptions();
+
+ function onload()
+ {
+ gProcessor = new OpenJsCad.Processor(document.getElementById("viewer"));
+ updateSolid();
+ }
+
+ function updateSolid()
+ {
+ gProcessor.setJsCad((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 = 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 = 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=part1.rotateX(180).translate([0,0,params.outerlength1+params.spiderlength]);
+ part2=part2.rotateX(180).translate([0,0,params.outerlength2+params.spiderlength]);
+
+ var result=part1.translate([-outerdiameter-5,0,0]);
+ result=result.union(part2.translate([0,0,0]));
+ result=result.union(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=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 = 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 = nutcutout.rotateY(90);
+ nutcutout = 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=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;
+}
\ No newline at end of file
diff --git a/OpenJsCad/openjscad.d.ts b/OpenJsCad/openjscad.d.ts
new file mode 100644
index 0000000000..072fa10b5a
--- /dev/null
+++ b/OpenJsCad/openjscad.d.ts
@@ -0,0 +1,912 @@
+// Type definitions for OpenJsCad.js
+// Project: https://github.com/joostn/OpenJsCad
+// Definitions by: Dan Marshall
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+///
+
+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[]);
+ }
+}
diff --git a/PayPal-Cordova-Plugin/PayPal-Cordova-Plugin-test.ts b/PayPal-Cordova-Plugin/PayPal-Cordova-Plugin-tests.ts
similarity index 100%
rename from PayPal-Cordova-Plugin/PayPal-Cordova-Plugin-test.ts
rename to PayPal-Cordova-Plugin/PayPal-Cordova-Plugin-tests.ts
diff --git a/acl/acl-redisBackend-test.ts b/acl/acl-redisBackend-tests.ts
similarity index 100%
rename from acl/acl-redisBackend-test.ts
rename to acl/acl-redisBackend-tests.ts
diff --git a/amqplib/amqplib-tests.ts b/amqplib/amqplib-tests.ts
index f99a3bde1a..85763c9ee1 100644
--- a/amqplib/amqplib-tests.ts
+++ b/amqplib/amqplib-tests.ts
@@ -5,6 +5,7 @@ import amqp = require("amqplib");
var msg = "Hello World";
+// test promise api
amqp.connect("amqp://localhost")
.then(connection => {
return connection.createChannel()
@@ -21,6 +22,13 @@ amqp.connect("amqp://localhost")
.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");
@@ -51,3 +59,9 @@ amqpcb.connect("amqp://localhost", (err, connection) => {
});
}
});
+
+// test callback api properties
+var amqpcbMessage: amqpcb.Message;
+amqpcbMessage.properties.contentType = "application/json";
+var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
+var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
\ No newline at end of file
diff --git a/amqplib/amqplib.d.ts b/amqplib/amqplib.d.ts
index f125aaa070..d03c46ed79 100644
--- a/amqplib/amqplib.d.ts
+++ b/amqplib/amqplib.d.ts
@@ -66,7 +66,7 @@ declare module "amqplib/properties" {
contentType?: string;
contentEncoding?: string;
- headers?: Object;
+ headers?: any;
priority?: number;
correlationId?: string;
replyTo?: string;
@@ -81,7 +81,7 @@ declare module "amqplib/properties" {
noAck?: boolean;
exclusive?: boolean;
priority?: number;
- arguments?: Object;
+ arguments?: any;
}
interface Get {
noAck?: boolean;
@@ -90,8 +90,8 @@ declare module "amqplib/properties" {
interface Message {
content: Buffer;
- fields: Object;
- properties: Object;
+ fields: any;
+ properties: any;
}
}
@@ -100,9 +100,9 @@ declare module "amqplib" {
import events = require("events");
import when = require("when");
import shared = require("amqplib/properties")
- import Replies = shared.Replies;
- import Options = shared.Options;
- import Message = shared.Message;
+ export import Replies = shared.Replies;
+ export import Options = shared.Options;
+ export import Message = shared.Message;
interface Connection extends events.EventEmitter {
close(): when.Promise;
@@ -156,9 +156,9 @@ declare module "amqplib/callback_api" {
import events = require("events");
import shared = require("amqplib/properties")
- import Replies = shared.Replies;
- import Options = shared.Options;
- import Message = shared.Message;
+ 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;
diff --git a/angular-dialog-service/angular-dialog-service-tests.ts b/angular-dialog-service/angular-dialog-service-tests.ts
new file mode 100644
index 0000000000..8142a3a713
--- /dev/null
+++ b/angular-dialog-service/angular-dialog-service-tests.ts
@@ -0,0 +1,16 @@
+///
+
+
+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."
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',{},{});
diff --git a/angular-dialog-service/angular-dialog-service.d.ts b/angular-dialog-service/angular-dialog-service.d.ts
new file mode 100644
index 0000000000..38ce8589e4
--- /dev/null
+++ b/angular-dialog-service/angular-dialog-service.d.ts
@@ -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
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+///
+
+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
+ }
+
+}
diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts
index 8f76b3ccf9..9917d217f4 100644
--- a/angular-formly/angular-formly.d.ts
+++ b/angular-formly/angular-formly.d.ts
@@ -297,6 +297,7 @@ declare module AngularFormly {
bound?: any;
expression?: any;
value?: any;
+ [key: string]: any;
};
diff --git a/angular-growl-v2/angular-growl-v2-test.ts b/angular-growl-v2/angular-growl-v2-tests.ts
similarity index 100%
rename from angular-growl-v2/angular-growl-v2-test.ts
rename to angular-growl-v2/angular-growl-v2-tests.ts
diff --git a/angular-httpi/angular-httpi-tests.ts b/angular-httpi/angular-httpi-tests.ts
new file mode 100644
index 0000000000..47ac25228c
--- /dev/null
+++ b/angular-httpi/angular-httpi-tests.ts
@@ -0,0 +1,64 @@
+///
+
+(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
+ }
+ });
+ }
+ );
+
+})();
\ No newline at end of file
diff --git a/angular-httpi/angular-httpi.d.ts b/angular-httpi/angular-httpi.d.ts
new file mode 100644
index 0000000000..eb4a16106b
--- /dev/null
+++ b/angular-httpi/angular-httpi.d.ts
@@ -0,0 +1,42 @@
+// Type definitions for angular-httpi
+// Project: https://github.com/bennadel/httpi
+// Definitions by: Andrew Camilleri
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+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(config: HttpiPayload): ng.IHttpPromise;
+
+ get(config: HttpiPayload): ng.IHttpPromise;
+
+ head(config: HttpiPayload): ng.IHttpPromise;
+
+ jsonp(config: HttpiPayload): ng.IHttpPromise;
+
+ post(config: HttpiPayload): ng.IHttpPromise;
+
+ put(config: HttpiPayload): ng.IHttpPromise;
+
+ setKeepTrailingSlash(newKeepTrailingSlash: boolean): HttpiResource;
+ }
+}
\ No newline at end of file
diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts
index ee932f0218..3b9a896c90 100644
--- a/angular-material/angular-material.d.ts
+++ b/angular-material/angular-material.d.ts
@@ -221,4 +221,19 @@ declare module angular.material {
setDefaultTheme(theme: string): void;
alwaysWatchTheme(alwaysWatch: boolean): void;
}
+
+ interface IDateLocaleProvider {
+ months: string[];
+ shortMonths: string[];
+ days: string[];
+ shortDays: string[];
+ dates: string[];
+ firstDayOfWeek: number;
+ parseDate(dateString: string): Date;
+ formatDate(date: Date): string;
+ monthHeaderFormatter(date: Date): string;
+ weekNumberFormatter(weekNumber: number): string;
+ msgCalendar: string;
+ msgOpenCalendar: string;
+ }
}
diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts
index b61909beb7..014baf5ac4 100644
--- a/angular-ui-router/angular-ui-router.d.ts
+++ b/angular-ui-router/angular-ui-router.d.ts
@@ -235,10 +235,10 @@ declare module angular.ui {
*/
go(to: string, params?: {}, options?: IStateOptions): angular.IPromise;
go(to: IState, params?: {}, options?: IStateOptions): angular.IPromise;
- transitionTo(state: string, params?: {}, updateLocation?: boolean): ng.IPromise;
- transitionTo(state: IState, params?: {}, updateLocation?: boolean): ng.IPromise;
- transitionTo(state: string, params?: {}, options?: IStateOptions): ng.IPromise;
- transitionTo(state: IState, params?: {}, options?: IStateOptions): ng.IPromise;
+ transitionTo(state: string, params?: {}, updateLocation?: boolean): angular.IPromise;
+ transitionTo(state: IState, params?: {}, updateLocation?: boolean): angular.IPromise;
+ transitionTo(state: string, params?: {}, options?: IStateOptions): angular.IPromise;
+ transitionTo(state: IState, params?: {}, options?: IStateOptions): angular.IPromise;
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;
+ reload(): angular.IPromise;
/** Currently pending transition. A promise that'll resolve or reject. */
- transition: ng.IPromise<{}>;
+ transition: angular.IPromise<{}>;
$current: IResolvedState;
}
diff --git a/angularjs/README.md b/angularjs/README.md
index 510f304f55..e1256e905b 100644
--- a/angularjs/README.md
+++ b/angularjs/README.md
@@ -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
diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts
index babc752b2d..be83611e07 100644
--- a/angularjs/angular-animate.d.ts
+++ b/angularjs/angular-animate.d.ts
@@ -121,7 +121,7 @@ declare module angular.animate {
}
/**
- * AngularProvider
+ * AnimateProvider
* see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider
*/
interface IAnimateProvider {
diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts
index f7f248ea8a..cfa7712cc2 100644
--- a/angularjs/angular-resource-tests.ts
+++ b/angularjs/angular-resource-tests.ts
@@ -8,11 +8,24 @@ interface IMyResourceClass extends angular.resource.IResourceClass
///////////////////////////////////////
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' };
+});
///////////////////////////////////////
diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts
index 4688a9c6f5..76930196ba 100644
--- a/angularjs/angular-resource.d.ts
+++ b/angularjs/angular-resource.d.ts
@@ -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;
+ withCredentials?: boolean;
+ responseType?: string;
+ interceptor?: any;
}
// Baseclass for everyresource with default actions.
diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts
index 75f0b0e6aa..040622b51d 100644
--- a/angularjs/angular.d.ts
+++ b/angularjs/angular.d.ts
@@ -620,7 +620,7 @@ declare module angular {
}
///////////////////////////////////////////////////////////////////////////
- // AngularProvider
+ // AnimateProvider
// see http://docs.angularjs.org/api/ng/provider/$animateProvider
///////////////////////////////////////////////////////////////////////////
interface IAnimateProvider {
@@ -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
diff --git a/angularjs/legacy/angular-cookies-1.0.d.ts b/angularjs/legacy/angular-cookies-1.0.d.ts
index b451dc431d..546affdea1 100644
--- a/angularjs/legacy/angular-cookies-1.0.d.ts
+++ b/angularjs/legacy/angular-cookies-1.0.d.ts
@@ -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
// Definitions: https://github.com/borisyankov/DefinitelyTyped
diff --git a/angularjs/legacy/angular-scenario-1.0.d.ts b/angularjs/legacy/angular-scenario-1.0.d.ts
index a44b79096c..af8a1e204f 100644
--- a/angularjs/legacy/angular-scenario-1.0.d.ts
+++ b/angularjs/legacy/angular-scenario-1.0.d.ts
@@ -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
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module angularScenario {
diff --git a/anydb-sql-migrations/anydb-sql-migrations-tests.ts b/anydb-sql-migrations/anydb-sql-migrations-tests.ts
new file mode 100644
index 0000000000..f9c3da03a2
--- /dev/null
+++ b/anydb-sql-migrations/anydb-sql-migrations-tests.ts
@@ -0,0 +1,17 @@
+///
+///
+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();
+}
diff --git a/anydb-sql-migrations/anydb-sql-migrations.d.ts b/anydb-sql-migrations/anydb-sql-migrations.d.ts
new file mode 100644
index 0000000000..9ab421c3ac
--- /dev/null
+++ b/anydb-sql-migrations/anydb-sql-migrations.d.ts
@@ -0,0 +1,34 @@
+// Type definitions for anydb-sql-migrations
+// Project: https://github.com/spion/anydb-sql-migrations
+// Definitions by: Gorgi Kosev
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+///
+
+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 {
+ version: Column;
+ }
+ export interface MigFn {
+ (tx: Transaction): Promise;
+ }
+ export interface MigrationTask {
+ up: MigFn;
+ down: MigFn;
+ name: string;
+ }
+ export function create(db: AnydbSql, tasks: any): {
+ run: () => Promise;
+ migrateTo: (target?: string) => Promise;
+ check: (f: (m: {
+ type: string;
+ items: MigrationTask[];
+ }) => any) => Promise;
+ };
+}
\ No newline at end of file
diff --git a/anydb-sql/anydb-sql-tests.ts b/anydb-sql/anydb-sql-tests.ts
new file mode 100644
index 0000000000..9e0264f7bb
--- /dev/null
+++ b/anydb-sql/anydb-sql-tests.ts
@@ -0,0 +1,70 @@
+///
+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 {
+ content: Column;
+ userId: Column;
+ date: Column;
+ }
+
+ var post = db.define({
+ name: 'posts',
+ columns: {
+ content: {},
+ userId: {},
+ date: {}
+ }
+ });
+
+ // Table User
+
+ interface User {
+ id: string;
+ email: string;
+ password: string;
+ name: string;
+ }
+
+ interface UserTable extends Table {
+ id: Column;
+ email: Column;
+ password: Column;
+ name: Column;
+ }
+
+ var user = db.define({
+ 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()
+}
\ No newline at end of file
diff --git a/anydb-sql/anydb-sql.d.ts b/anydb-sql/anydb-sql.d.ts
new file mode 100644
index 0000000000..d8bce402b7
--- /dev/null
+++ b/anydb-sql/anydb-sql.d.ts
@@ -0,0 +1,194 @@
+// Type definitions for anydb-sql
+// Project: https://github.com/doxout/anydb-sql
+// Definitions by: Gorgi Kosev
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+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 { [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
+ has?:Dictionary<{from:string; many?:boolean}>
+ }
+
+
+ export interface QueryLike {
+ query:string;
+ values: any[]
+ text:string
+ }
+ export interface DatabaseConnection {
+ queryAsync(query:string, ...params:any[]):Promise<{rowCount:number;rows:T[]}>
+ queryAsync(query:QueryLike):Promise<{rowCount:number;rows:T[]}>
+ }
+
+ export interface Transaction extends DatabaseConnection {
+ rollback():void
+ commitAsync():Promise
+ }
+
+ export interface SubQuery {
+ select(node:Column):SubQuery
+ where(...nodes:any[]):SubQuery
+ from(table:TableNode):SubQuery
+ group(...nodes:any[]):SubQuery
+ order(criteria:OrderByValueNode):SubQuery
+ notExists(subQuery:SubQuery):SubQuery
+ }
+
+ interface Executable {
+ get():Promise
+ getWithin(tx:DatabaseConnection):Promise
+ exec():Promise
+ all():Promise
+ execWithin(tx:DatabaseConnection):Promise
+ allWithin(tx:DatabaseConnection):Promise
+ toQuery():QueryLike;
+ }
+
+ interface Queryable {
+ where(...nodes:any[]):Query
+ delete():ModifyingQuery
+ select(...nodes:any[]):Query
+ selectDeep(table: Table): Query
+ selectDeep(...nodesOrTables:any[]):Query
+ }
+
+ export interface Query extends Executable, Queryable {
+ from(table:TableNode):Query
+ update(o:Dictionary):ModifyingQuery
+ update(o:{}):ModifyingQuery
+ group(...nodes:any[]):Query
+ order(...criteria:OrderByValueNode[]):Query
+ limit(l:number):Query
+ offset(o:number):Query
+ }
+
+ export interface ModifyingQuery extends Executable {
+ returning(...nodes:any[]):Query
+ 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 {
+ ifNotExists():Executable
+ }
+ interface DropQuery extends Executable {
+ ifExists():Executable
+ }
+ export interface Table extends TableNode, Queryable {
+ create():CreateQuery
+ drop():DropQuery
+ as(name:string):Table
+ update(o:any):ModifyingQuery
+ insert(row:T):ModifyingQuery
+ insert(rows:T[]):ModifyingQuery
+ select():Query
+ select(...nodes:any[]):Query
+ from(table:TableNode):Query
+ star():Column
+ subQuery():SubQuery
+ eventEmitter:{emit:(type:string, ...args:any[])=>void
+ on:(eventName:string, handler:Function)=>void}
+ columns:Column[]
+ sql: SQL;
+ alter():AlterQuery
+ }
+ export interface AlterQuery extends Executable {
+ addColumn(column:Column): AlterQuery;
+ addColumn(name: string, options:string): AlterQuery;
+ dropColumn(column: Column): AlterQuery;
+ renameColumn(column: Column, newColumn: Column):AlterQuery;
+ renameColumn(column: Column, newName: string):AlterQuery;
+ renameColumn(name: string, newName: string):AlterQuery;
+ rename(newName: string): AlterQuery
+ }
+
+ export interface SQL {
+ functions: {
+ LOWER(c:Column):Column
+ }
+ }
+
+ export interface BinaryNode {
+ and(node:BinaryNode):BinaryNode
+ or(node:BinaryNode):BinaryNode
+ }
+
+ export interface Column {
+ in(arr:T[]):BinaryNode
+ in(subQuery:SubQuery):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):Column
+ (n:number):Column
+ }
+ isNull():BinaryNode
+ isNotNull():BinaryNode
+ sum():Column
+ count():Column
+ count(name:string):Column
+ distinct():Column
+ as(name:string):Column
+ ascending:OrderByValueNode
+ descending:OrderByValueNode
+ asc:OrderByValueNode
+ desc:OrderByValueNode
+ }
+
+ export interface AnydbSql extends DatabaseConnection {
+ define(map:TableDefinition):Table;
+ transaction(fn:(tx:Transaction)=>Promise):Promise
+ allOf(...tables:Table[]):any
+ models:Dictionary>
+ functions:{LOWER:(name:Column)=>Column
+ RTRIM:(name:Column)=>Column}
+ makeFunction(name:string):Function
+ begin():Transaction
+ open():void;
+ close():void;
+ getPool():AnyDBPool;
+ dialect():string;
+ }
+ }
+
+ function anydbSQL(config:Object):anydbSQL.AnydbSql;
+
+ export = anydbSQL;
+}
\ No newline at end of file
diff --git a/applicationinsights/applicationinsights-tests.ts b/applicationinsights/applicationinsights-tests.ts
index 871a029e85..8d4d83e9dc 100644
--- a/applicationinsights/applicationinsights-tests.ts
+++ b/applicationinsights/applicationinsights-tests.ts
@@ -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 = {
diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts
index 12dffdd81c..9fc6f494d5 100644
--- a/applicationinsights/applicationinsights.d.ts
+++ b/applicationinsights/applicationinsights.d.ts
@@ -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
// 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.
*/
diff --git a/archiver/archiver-test.ts b/archiver/archiver-tests.ts
similarity index 100%
rename from archiver/archiver-test.ts
rename to archiver/archiver-tests.ts
diff --git a/assertsharp/assertsharp-tests.ts b/assertsharp/assertsharp-tests.ts
new file mode 100644
index 0000000000..484e3ac774
--- /dev/null
+++ b/assertsharp/assertsharp-tests.ts
@@ -0,0 +1,16 @@
+///
+
+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");
diff --git a/assertsharp/assertsharp.d.ts b/assertsharp/assertsharp.d.ts
new file mode 100644
index 0000000000..e66442cf78
--- /dev/null
+++ b/assertsharp/assertsharp.d.ts
@@ -0,0 +1,21 @@
+// Type definitions for assertsharp
+// Project: https://www.npmjs.com/package/assertsharp
+// Definitions by: Bruno Leonardo Michels
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+declare module "assertsharp" {
+ export default class Assert {
+ static AreEqual(expected: T, actual: T, message?: string): void;
+ static AreNotEqual(notExpected: T, actual: T, message?: string): void;
+ static AreNotSame(notExpected: T, actual: T, message?: string): void;
+ static AreSequenceEqual(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;
+ }
+}
diff --git a/aws-sdk/aws-sdk-tests.ts b/aws-sdk/aws-sdk-tests.ts
index 8a3464a6df..7411beb930 100644
--- a/aws-sdk/aws-sdk-tests.ts
+++ b/aws-sdk/aws-sdk-tests.ts
@@ -1,13 +1,256 @@
///
-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
+ });
+
+
\ No newline at end of file
diff --git a/aws-sdk/aws-sdk-tests.ts.tscparams b/aws-sdk/aws-sdk-tests.ts.tscparams
new file mode 100644
index 0000000000..70401a77ee
--- /dev/null
+++ b/aws-sdk/aws-sdk-tests.ts.tscparams
@@ -0,0 +1 @@
+--noImplicitAny --module commonjs --target es5
\ No newline at end of file
diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts
index 3a500bbbb4..128341729d 100644
--- a/aws-sdk/aws-sdk.d.ts
+++ b/aws-sdk/aws-sdk.d.ts
@@ -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;
+ }
}
diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts
index 4e40687a8c..764aa83d75 100644
--- a/backbone/backbone-global.d.ts
+++ b/backbone/backbone-global.d.ts
@@ -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 = { 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 = { "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 {
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;
+ collection?: Backbone.Collection; //was: Collection;
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 = { "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;
remove(): View;
make(tagName: any, attributes?: any, content?: any): any;
- delegateEvents(events?: any): any;
+ delegateEvents(events?: EventsHash): any;
+ delegate(eventName: string, selector: string, listener: Function): View;
undelegateEvents(): any;
+ undelegate(eventName: string, selector?: string, listener?: Function): View;
_ensureElement(): void;
}
diff --git a/barcode/barcode-tests.ts b/barcode/barcode-tests.ts
new file mode 100644
index 0000000000..bb7b67187e
--- /dev/null
+++ b/barcode/barcode-tests.ts
@@ -0,0 +1,22 @@
+///
+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!');
+});
\ No newline at end of file
diff --git a/barcode/barcode.d.ts b/barcode/barcode.d.ts
new file mode 100644
index 0000000000..5f4c6cfd8c
--- /dev/null
+++ b/barcode/barcode.d.ts
@@ -0,0 +1,25 @@
+// Type definitions for barcode
+// Project: https://github.com/samt/barcode
+// Definitions by: Pascal Vomhoff
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+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;
+}
diff --git a/big-integer/big-integer-tests.ts b/big-integer/big-integer-tests.ts
index 3b9fb8745f..92633d2871 100644
--- a/big-integer/big-integer-tests.ts
+++ b/big-integer/big-integer-tests.ts
@@ -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();
\ No newline at end of file
+isNumber = x.valueOf();
diff --git a/big-integer/big-integer.d.ts b/big-integer/big-integer.d.ts
index 633432e199..9e9127e830 100644
--- a/big-integer/big-integer.d.ts
+++ b/big-integer/big-integer.d.ts
@@ -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;
-}
\ No newline at end of file
+}
diff --git a/bingmaps/bingmaps-test.ts b/bingmaps/bingmaps-tests.ts
similarity index 98%
rename from bingmaps/bingmaps-test.ts
rename to bingmaps/bingmaps-tests.ts
index bccc5c8f28..5842ee82df 100644
--- a/bingmaps/bingmaps-test.ts
+++ b/bingmaps/bingmaps-tests.ts
@@ -1,4 +1,4 @@
-///
+///
///
///
///
@@ -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) });
}
diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts
index b8eecf2cad..ade4610743 100644
--- a/bluebird/bluebird-tests.ts
+++ b/bluebird/bluebird-tests.ts
@@ -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,7 @@ var voidProm: Promise;
var fooProm: Promise;
var barProm: Promise;
+var bazProm: Promise;
// - - - - - - - - - - - - - - - - -
@@ -499,6 +504,30 @@ barProm = fooProm.race();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+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((item: Foo, index: number, arrayLength: number) => {
diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts
index 350761fddc..878e1051e8 100644
--- a/bluebird/bluebird.d.ts
+++ b/bluebird/bluebird.d.ts
@@ -464,6 +464,11 @@ declare class Promise implements Promise.Thenable, Promise.Inspection {
static all(values: Promise.Thenable): Promise;
// array with promises of value
static all(values: Promise.Thenable[]): Promise;
+ // array with promises of different types
+ static all(values: [Promise.Thenable, Promise.Thenable]): Promise<[T1, T2]>;
+ static all(values: [Promise.Thenable, Promise.Thenable, Promise.Thenable]): Promise<[T1, T2, T3]>;
+ static all(values: [Promise.Thenable, Promise.Thenable, Promise.Thenable, Promise.Thenable]): Promise<[T1, T2, T3, T4]>;
+ static all(values: [Promise.Thenable, Promise.Thenable, Promise.Thenable, Promise.Thenable, Promise.Thenable]): Promise<[T1, T2, T3, T4, T5]>;
// array with values
static all(values: R[]): Promise;
diff --git a/bootstrap-maxlength/bootstrap-maxlength-tests.ts b/bootstrap-maxlength/bootstrap-maxlength-tests.ts
new file mode 100644
index 0000000000..8a17cc7ff9
--- /dev/null
+++ b/bootstrap-maxlength/bootstrap-maxlength-tests.ts
@@ -0,0 +1,70 @@
+///
+///
+
+// 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) {
+ }
+});
diff --git a/bootstrap-maxlength/bootstrap-maxlength.d.ts b/bootstrap-maxlength/bootstrap-maxlength.d.ts
new file mode 100644
index 0000000000..4d36c70386
--- /dev/null
+++ b/bootstrap-maxlength/bootstrap-maxlength.d.ts
@@ -0,0 +1,158 @@
+// Type definitions for bootstrap-maxlength v1.7.0
+// Project: https://github.com/mimo84/bootstrap-maxlength
+// Definitions by: Dan Manastireanu
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+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;
+
+}
diff --git a/bootstrap-notify/bootstrap-notify-test.ts b/bootstrap-notify/bootstrap-notify-tests.ts
similarity index 98%
rename from bootstrap-notify/bootstrap-notify-test.ts
rename to bootstrap-notify/bootstrap-notify-tests.ts
index a71a835579..8461da8e48 100644
--- a/bootstrap-notify/bootstrap-notify-test.ts
+++ b/bootstrap-notify/bootstrap-notify-tests.ts
@@ -1,9 +1,9 @@
///
///
-
+
//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({
'' +
'' +
'' +
- ''
+ ''
});
\ No newline at end of file
diff --git a/bootstrap-notify/bootstrap-notify.d.ts.tscparams b/bootstrap-notify/bootstrap-notify.d.ts.tscparams
deleted file mode 100644
index d3f5a12faa..0000000000
--- a/bootstrap-notify/bootstrap-notify.d.ts.tscparams
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/bootstrap-switch/bootstrap-switch-tests.ts b/bootstrap-switch/bootstrap-switch-tests.ts
new file mode 100644
index 0000000000..542f71ebd4
--- /dev/null
+++ b/bootstrap-switch/bootstrap-switch-tests.ts
@@ -0,0 +1,25 @@
+///
+///
+
+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());
+ });
+}
\ No newline at end of file
diff --git a/bootstrap-switch/bootstrap-switch.d.ts b/bootstrap-switch/bootstrap-switch.d.ts
new file mode 100644
index 0000000000..f562f9ef07
--- /dev/null
+++ b/bootstrap-switch/bootstrap-switch.d.ts
@@ -0,0 +1,102 @@
+// Type definitions for Bootstrap Switch
+// Project: http://www.bootstrap-switch.org/
+// Definitions by: John M. Baughman
+// 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.
+ */
+
+///
+
+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;
+}
\ No newline at end of file
diff --git a/bootstrap.datepicker/bootstrap.datepicker.d.ts b/bootstrap.datepicker/bootstrap.datepicker.d.ts
index da0ec1ab3d..23f51cb431 100644
--- a/bootstrap.datepicker/bootstrap.datepicker.d.ts
+++ b/bootstrap.datepicker/bootstrap.datepicker.d.ts
@@ -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;
diff --git a/browser-sync/browser-sync-tests.ts b/browser-sync/browser-sync-tests.ts
index 50042410f0..210a8cf1bb 100644
--- a/browser-sync/browser-sync-tests.ts
+++ b/browser-sync/browser-sync-tests.ts
@@ -1,6 +1,13 @@
///
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);
diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts
index 03b751fabd..00c2429425 100644
--- a/browser-sync/browser-sync.d.ts
+++ b/browser-sync/browser-sync.d.ts
@@ -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 {
- [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 {
+ [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;
+ /** configure custom middleware */
+ middleware?: MiddlewareHandler[];
+ }
+
+ interface ProxyOptions {
+ target?: string;
+ middleware?: MiddlewareHandler;
+ ws: boolean;
+ reqHeaders: (config: any) => Hash;
+ 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;
- /** configure custom middleware */
- middleware?: MiddlewareHandler[];
- }
-
- interface ProxyOptions {
- target?: string;
- middleware?: MiddlewareHandler;
- ws: boolean;
- reqHeaders: (config: any) => Hash;
- 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;
}
diff --git a/bunyan-logentries/bunyan-logentries-test.ts b/bunyan-logentries/bunyan-logentries-tests.ts
similarity index 100%
rename from bunyan-logentries/bunyan-logentries-test.ts
rename to bunyan-logentries/bunyan-logentries-tests.ts
diff --git a/bunyan/bunyan-test.ts b/bunyan/bunyan-tests.ts
similarity index 100%
rename from bunyan/bunyan-test.ts
rename to bunyan/bunyan-tests.ts
diff --git a/bytes/bytes-tests.ts b/bytes/bytes-tests.ts
new file mode 100644
index 0000000000..4a981aee47
--- /dev/null
+++ b/bytes/bytes-tests.ts
@@ -0,0 +1,16 @@
+///
+
+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));
\ No newline at end of file
diff --git a/bytes/bytes.d.ts b/bytes/bytes.d.ts
new file mode 100644
index 0000000000..0d8a63cf7c
--- /dev/null
+++ b/bytes/bytes.d.ts
@@ -0,0 +1,62 @@
+// Type definitions for bytes v2.1.0
+// Project: https://github.com/visionmedia/bytes.js
+// Definitions by: Zhiyuan Wang
+// 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;
+}
\ No newline at end of file
diff --git a/c3/c3.d.ts b/c3/c3.d.ts
index 3c7469b0aa..160e0b1696 100644
--- a/c3/c3.d.ts
+++ b/c3/c3.d.ts
@@ -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;
diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts
index 51255b4902..d7f1472c7a 100644
--- a/chai-as-promised/chai-as-promised.d.ts
+++ b/chai-as-promised/chai-as-promised.d.ts
@@ -8,6 +8,7 @@
declare module 'chai-as-promised' {
function chaiAsPromised(chai: any, utils: any): void;
+ namespace chaiAsPromised {}
export = chaiAsPromised;
}
diff --git a/chance/chance-tests.ts b/chance/chance-tests.ts
index 5a2aa9a9cb..29d258cf70 100644
--- a/chance/chance-tests.ts
+++ b/chance/chance-tests.ts
@@ -34,3 +34,6 @@ chance.mixin({
});
var timeString: string = chance.time();
+
+var chanceConstructedWithSeed100 = new Chance(100);
+var chanceCalledWithSeed100 = Chance()
\ No newline at end of file
diff --git a/chance/chance.d.ts b/chance/chance.d.ts
index e79304c8d5..c77be4d282 100644
--- a/chance/chance.d.ts
+++ b/chance/chance.d.ts
@@ -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;
}
diff --git a/connect-livereload/connect-livereload-tests.ts b/connect-livereload/connect-livereload-tests.ts
new file mode 100644
index 0000000000..2609871e98
--- /dev/null
+++ b/connect-livereload/connect-livereload-tests.ts
@@ -0,0 +1,69 @@
+///
+
+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;
+}
\ No newline at end of file
diff --git a/connect-livereload/connect-livereload.d.ts b/connect-livereload/connect-livereload.d.ts
new file mode 100644
index 0000000000..98e851fec6
--- /dev/null
+++ b/connect-livereload/connect-livereload.d.ts
@@ -0,0 +1,38 @@
+// Type definitions for connect-livereload v0.5.3
+// Project: https://github.com/intesso/connect-livereload
+// Definitions by: Maxime LUCE
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+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;
+}
\ No newline at end of file
diff --git a/content-type/content-type-test.ts b/content-type/content-type-tests.ts
similarity index 100%
rename from content-type/content-type-test.ts
rename to content-type/content-type-tests.ts
diff --git a/cookie/cookie-test.ts b/cookie/cookie-tests.ts
similarity index 100%
rename from cookie/cookie-test.ts
rename to cookie/cookie-tests.ts
diff --git a/cordova/cordova-tests.ts b/cordova/cordova-tests.ts
index 491b49773a..d0e6e68897 100644
--- a/cordova/cordova-tests.ts
+++ b/cordova/cordova-tests.ts
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Open Technologies, Inc.
-// Licensed under the MIT license.
+// Licensed under the MIT license.
///
@@ -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 = 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');
+};
diff --git a/cordova/cordova.d.ts b/cordova/cordova.d.ts
index 32ef0a76b6..fcef3b9fe7 100644
--- a/cordova/cordova.d.ts
+++ b/cordova/cordova.d.ts
@@ -25,6 +25,7 @@
///
///
///
+///
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;
+}
diff --git a/cordova/plugins/Keyboard.d.ts b/cordova/plugins/Keyboard.d.ts
new file mode 100644
index 0000000000..414cd87fac
--- /dev/null
+++ b/cordova/plugins/Keyboard.d.ts
@@ -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
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+/**
+ * The Keyboard object provides some functions to customize the iOS keyboard.
+ *
+ * Supported Platforms: iOS
+ *
+ * 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
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+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:
+ *
+ * Keyboard.shrinkView(true);
+ * Keyboard.shrinkView(false);
+ *
+ *
+ * @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:
+ *
+ * Keyboard.hideFormAccessoryBar(true);
+ * Keyboard.hideFormAccessoryBar(false);
+ *
+ *
+ * @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:
+ *
+ * Keyboard.disableScrollingInShrinkView(true);
+ * Keyboard.disableScrollingInShrinkView(false);
+ *
+ *
+ * @param disable
+ */
+ disableScrollingInShrinkView(disable:boolean): void,
+
+ // Properties
+
+ /**
+ * Determine if the keyboard is visible.
+ *
+ * Read this property to determine if the keyboard is visible.
+ *
+ * Example:
+ *
+ * if (Keyboard.isVisible) {
+ * // do something
+ * }
+ *
+ *
+ */
+ 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:
+ *
+ * Keyboard.automaticScrollToTopOnHiding = true;
+ *
+ *
+ */
+ 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:
+ *
+ * Keyboard.onshow = function () {
+ * // Describe your logic which will be run each time keyboard is shown.
+ * }
+ *
+ *
+ */
+ 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:
+ *
+ * Keyboard.onhide = function () {
+ * // Describe your logic which will be run each time keyboard is closed.
+ * }
+ *
+ *
+ */
+ 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:
+ *
+ * Keyboard.onshowing = function () {
+ * // Describe your logic which will be run each time when keyboard is about to be shown.
+ * }
+ *
+ *
+ */
+ 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:
+ *
+ * Keyboard.onhiding = function () {
+ * // Describe your logic which will be run each time when keyboard is about to be closed.
+ * }
+ *
+ *
+ */
+ onhiding():void,
+
+}
+
+declare var Keyboard:Keyboard;
diff --git a/credential/credential-tests.ts b/credential/credential-tests.ts
new file mode 100644
index 0000000000..6013436b05
--- /dev/null
+++ b/credential/credential-tests.ts
@@ -0,0 +1,16 @@
+///
+
+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');
+});
diff --git a/credential/credential.d.ts b/credential/credential.d.ts
new file mode 100644
index 0000000000..d8497ec142
--- /dev/null
+++ b/credential/credential.d.ts
@@ -0,0 +1,18 @@
+// Type definitions for credential
+// Project: https://github.com/ericelliott/credential
+// Definitions by: Phú
+// 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;
+
+}
diff --git a/decorum/decorum-tests.ts b/decorum/decorum-tests.ts
new file mode 100644
index 0000000000..4a51b09555
--- /dev/null
+++ b/decorum/decorum-tests.ts
@@ -0,0 +1,115 @@
+///
+
+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(
+ '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!';
diff --git a/decorum/decorum-tests.ts.tscparams b/decorum/decorum-tests.ts.tscparams
new file mode 100644
index 0000000000..5300ee7222
--- /dev/null
+++ b/decorum/decorum-tests.ts.tscparams
@@ -0,0 +1,2 @@
+--experimentalDecorators
+--target ES5
diff --git a/decorum/decorum.d.ts b/decorum/decorum.d.ts
new file mode 100644
index 0000000000..4a966e9d2b
--- /dev/null
+++ b/decorum/decorum.d.ts
@@ -0,0 +1,436 @@
+// Type definitions for Decorum JS v0.2.0
+// Project: https://github.com/dflor003/decorum
+// Definitions by: Danil Flores
+// 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(message: string | MessageHandler>, 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): 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): 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): 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): 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): 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): 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): 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): 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 {
+ (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;
+ }
+
+ /**
+ * 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 extends BaseValidator {
+ constructor(predicate: (value: any, model: TModel) => boolean, message: string | MessageHandler>);
+
+ 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);
+
+ getMessage(opts: IMessageOpts): string;
+
+ getKey(): string;
+ }
+
+ /**
+ * An exact length validator.
+ */
+ export class LengthValidator extends BaseValidator {
+ length: number;
+
+ constructor(length: number, message?: string | MessageHandler);
+
+ 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);
+
+ 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);
+
+ 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);
+
+ getMessage(opts: IMessageOpts): string;
+
+ isValid(value: any): boolean;
+ }
+
+ /**
+ * A field requiredness validator.
+ */
+ export class RequiredFieldValidator extends BaseValidator {
+ constructor(message?: string | MessageHandler);
+
+ 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);
+
+ /**
+ * 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[];
+ }
+}
diff --git a/depd/depd-tests.ts b/depd/depd-tests.ts
new file mode 100644
index 0000000000..14dfbe72c4
--- /dev/null
+++ b/depd/depd-tests.ts
@@ -0,0 +1,54 @@
+///
+
+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 = { 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 = {};
+
+// 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();
\ No newline at end of file
diff --git a/depd/depd.d.ts b/depd/depd.d.ts
new file mode 100644
index 0000000000..1af4eaa8da
--- /dev/null
+++ b/depd/depd.d.ts
@@ -0,0 +1,17 @@
+// Type definitions for depd 1.1.0
+// Project: https://github.com/dougwilson/nodejs-depd
+// Definitions by: Zhiyuan Wang
+// 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;
+}
\ No newline at end of file
diff --git a/dexie/dexie.d.ts b/dexie/dexie.d.ts
index 36bec7b327..d6c26283c2 100644
--- a/dexie/dexie.d.ts
+++ b/dexie/dexie.d.ts
@@ -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;
diff --git a/dhtmlxscheduler/dhtmlxscheduler.d.ts b/dhtmlxscheduler/dhtmlxscheduler.d.ts
index 011532573b..c79ce78c9a 100644
--- a/dhtmlxscheduler/dhtmlxscheduler.d.ts
+++ b/dhtmlxscheduler/dhtmlxscheduler.d.ts
@@ -1229,7 +1229,7 @@ interface SchedulerStatic{
* return the event object by its id
* @param event_id event_id
*/
- getEvent(event_id: any);
+ getEvent(event_id: any): T;
/**
* gets the event's end date
@@ -1601,4 +1601,4 @@ interface SchedulerStatic{
-declare var scheduler: SchedulerStatic;
\ No newline at end of file
+declare var scheduler: SchedulerStatic;
diff --git a/di-lite/di-lite-test.ts b/di-lite/di-lite-tests.ts
similarity index 100%
rename from di-lite/di-lite-test.ts
rename to di-lite/di-lite-tests.ts
diff --git a/dropzone/dropzone.d.ts.tscparams b/dropzone/dropzone.d.ts.tscparams
deleted file mode 100644
index d3f5a12faa..0000000000
--- a/dropzone/dropzone.d.ts.tscparams
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/durandal/durandal.d.ts b/durandal/durandal.d.ts
index 86f988cbe7..f5b7c32601 100644
--- a/durandal/durandal.d.ts
+++ b/durandal/durandal.d.ts
@@ -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
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -12,6 +12,18 @@
///
///
+// 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:
+
+//
+// interface DurandalPromise extends Q.Promise