diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..5ebf4a129c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +trim_trailing_whitespace = true +insert_final_newline = true + +[{*.json,*.yml}] +indent_style = space +indent_size = 2 diff --git a/.gitignore b/.gitignore index 71251cf8ad..7bfdb8b535 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,9 @@ _infrastructure/tests/build *.iml *.js.map +#decimal.js +!decimal.js + #rx.js !rx.js diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b54b7d1df4..6abf7201be 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -22,15 +22,16 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angularjs/angular-route.d.ts) [Angular JS (ngRoute module)](http://angularjs.org) by [Jonathan Park](https://github.com/park9140) * [:link:](angularjs/angular-sanitize.d.ts) [Angular JS (ngSanitize module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angular-ui-router/angular-ui-router.d.ts) [Angular JS (ui.router module)](https://github.com/angular-ui/ui-router) by [Michel Salib](https://github.com/michelsalib) -* [:link:](angular-material/angular-material.d.ts) [Angular Material (ng.material module)](https://github.com/angular/material) by [Matt Traynham](https://github.com/mtraynham) +* [:link:](angular-material/angular-material.d.ts) [Angular Material (angular.material module)](https://github.com/angular/material) by [Matt Traynham](https://github.com/mtraynham) * [:link:](angular-protractor/angular-protractor.d.ts) [Angular Protractor](https://github.com/angular/protractor) by [Bill Armstrong](https://github.com/BillArmstrong) * [:link:](angular-scenario/angular-scenario.d.ts) [Angular Scenario Testing (ngScenario module)](http://angularjs.org) by [RomanoLindano](https://github.com/RomanoLindano) * [:link:](angular-translate/angular-translate.d.ts) [Angular Translate (pascalprecht.translate module)](https://github.com/PascalPrecht/angular-translate) by [Michel Salib](https://github.com/michelsalib) * [:link:](angular-ui-bootstrap/angular-ui-bootstrap.d.ts) [Angular UI Bootstrap](https://github.com/angular-ui/bootstrap) by [Brian Surowiec](https://github.com/xt0rted) +* [:link:](angular-wizard/angular-wizard.d.ts) [Angular Wizard](https://github.com/mgonto/angular-wizard) by [Marko Jurisic](https://github.com/mjurisic) * [:link:](angular-bootstrap-lightbox/angular-bootstrap-lightbox.d.ts) [angular-bootstrap-lightbox](https://github.com/compact/angular-bootstrap-lightbox) by [Roland Zwaga](https://github.com/rolandzwaga) * [:link:](angular-hotkeys/angular-hotkeys.d.ts) [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys) by [Jason Zhao](https://github.com/jlz27), [Stefan Steinhart](https://github.com/reppners) * [:link:](angular-http-auth/angular-http-auth.d.ts) [angular-http-auth](https://github.com/witoldsz/angular-http-auth) by [vvakame](https://github.com/vvakame) -* [:link:](angular-local-storage/angular-local-storage.d.ts) [angular-local-storage](https://github.com/grevory/angular-local-storage) by [Ken Fukuyama](https://github.com/kenfdev),[Chris Woolum](https://github.com/cwoolum) +* [:link:](angular-local-storage/angular-local-storage.d.ts) [angular-local-storage](https://github.com/grevory/angular-local-storage) by [Ken Fukuyama](https://github.com/kenfdev) * [:link:](angular-notify/angular-notify.d.ts) [angular-notify](https://github.com/cgross/angular-notify) by [Suwato](https://github.com/Suwato/DefinitelyTyped) * [:link:](angular-scroll/angular-scroll.d.ts) [angular-scroll](https://github.com/oblador/angular-scroll) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](angular-spinner/angular-spinner.d.ts) [angular-spinner.js](https://github.com/urish/angular-spinner) by [Marcin Biegała](https://github.com/Biegal) @@ -57,10 +58,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](asyncblock/asyncblock.d.ts) [asyncblock](https://github.com/scriby/asyncblock) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](atmosphere/atmosphere.d.ts) [Atmosphere](https://github.com/Atmosphere/atmosphere-javascript) by [Kai Toedter](https://github.com/toedter) * [:link:](atom/atom.d.ts) [Atom](https://atom.io) by [vvakame](https://github.com/vvakame) +* [:link:](atom/api-docs.d.ts) [Atom API docs](https://github.com/atom/atom/blob/master/build/tasks/docs-task.coffee) by [vvakame](https://github.com/vvakame) * [:link:](atpl/atpl.d.ts) [atpl](https://github.com/soywiz/atpl.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](auth0/auth0.d.ts) [Auth0.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) -* [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](auth0.lock/auth0.lock.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) +* [:link:](auth0.widget/auth0.widget.d.ts) [Auth0Widget.js](http://auth0.com) by [Robert McLaws](https://github.com/advancedrei) * [:link:](autobahn/autobahn.d.ts) [AutobahnJS](http://autobahn.ws/js) by [Elad Zelingher](https://github.com/darkl) * [:link:](aws-sdk/aws-sdk.d.ts) [aws-sdk](https://github.com/aws/aws-sdk-js) by [midknight41](https://github.com/midknight41) * [:link:](axios/axios.d.ts) [axios](https://github.com/mzabriskie/axios) by [Marcel Buesing](https://github.com/marcelbuesing) @@ -85,11 +87,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bootbox/bootbox.d.ts) [Bootbox](https://github.com/makeusabrew/bootbox) by [Vincent Bortone](https://github.com/vbortone), [Kon Pik](https://github.com/konpikwastaken) * [:link:](bootstrap/bootstrap.d.ts) [Bootstrap](http://twitter.github.com/bootstrap) by [Boris Yankov](https://github.com/borisyankov) * [:link:](bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts) [Bootstrap datetimepicker v3](http://eonasdan.github.io/bootstrap-datetimepicker) by [Jesica N. Fera](https://github.com/bayitajesi) +* [:link:](bootstrap-touchspin/bootstrap-touchspin.d.ts) [Bootstrap TouchSpin](http://www.virtuosoft.eu/code/bootstrap-touchspin) by [Albin Sunnanbo](https://github.com/albinsunnanbo) * [:link:](bootstrap-notify/bootstrap-notify.d.ts) [bootstrap-notify](https://github.com/Nijikokun/bootstrap-notify) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](bootstrap.datepicker/bootstrap.datepicker.d.ts) [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) by [Boris Yankov](https://github.com/borisyankov) * [:link:](bootstrap.paginator/bootstrap.paginator.d.ts) [bootstrap.paginator](https://github.com/lyonlai/bootstrap-paginator) by [derikwhittaker](https://github.com/derikwhittaker) -* [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) * [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker) +* [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) * [:link:](breeze/breeze.d.ts) [Breeze 1.5.x](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze) * [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby) * [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com) @@ -97,10 +100,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bucks/bucks.d.ts) [bucks.js](https://github.com/CyberAgent/bucks.js) by [Shunsuke Ohtani](https://github.com/zaneli) * [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](buffers/buffers.d.ts) [buffers](https://github.com/substack/node-buffers) by [Robert Hencke](https://github.com/rhencke) * [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen) * [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec) * [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners) +* [:link:](calq/calq.d.ts) [calq](https://calq.io/docs/client/javascript/reference) by [Eirik Hoem](https://github.com/eirikhm) * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) * [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5) * [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao) @@ -121,6 +126,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD) * [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10) * [:link:](chrome/chrome-app.d.ts) [Chrome packaged application development](http://developer.chrome.com/apps) by [Adam Lay](https://github.com/AdamLay), [MIZUNE Pine](https://github.com/pine613), [MIZUSHIMA Junki](https://github.com/mzsm) +* [:link:](circular-json/circular-json.d.ts) [circular-json](https://github.com/WebReflection/circular-json) by [Jonathan Pevarnek](https://github.com/jpevarnek) * [:link:](ckeditor/ckeditor.d.ts) [CKEditor](http://ckeditor.com) by [Ondrej Sevcik](https://github.com/ondrejsevcik) * [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan) * [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped) @@ -130,6 +136,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](commander/commander.d.ts) [commanderjs](https://github.com/visionmedia/commander.js) by [Marcelo Dezem](http://github.com/mdezem), [vvakame](http://github.com/vvakame) * [:link:](compression/compression.d.ts) [compression](https://github.com/expressjs/compression) by [Santi Albo](https://github.com/santialbo) * [:link:](configstore/configstore.d.ts) [configstore](https://github.com/yeoman/configstore) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](connect-flash/connect-flash.d.ts) [connect-flash](https://github.com/jaredhanson/connect-flash) by [Andreas Gassmann](https://github.com/AndreasGassmann) +* [:link:](connect-slashes/connect-slashes.d.ts) [connect-slashes](https://github.com/avinoamr/connect-slashes) by [Sam Herrmann](https://github.com/samherrmann) * [:link:](consolidate/consolidate.d.ts) [consolidate](https://github.com/visionmedia/consolidate.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](content-type/content-type.d.ts) [content-type](https://github.com/deoxxa/content-type) by [Pine Mizune](https://github.com/pine613) * [:link:](convert-source-map/convert-source-map.d.ts) [convert-source-map](https://github.com/thlorenz/convert-source-map) by [Andrew Gaspar](https://github.com/AndrewGaspar) @@ -140,6 +148,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](cordovarduino/cordovarduino.d.ts) [Cordovarduino plugin](https://github.com/stereolux/cordovarduino) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](couchbase/couchbase.d.ts) [Couchbase Couchnode](https://github.com/couchbase/couchnode) by [Basarat Ali Syed](https://github.com/basarat) * [:link:](createjs/createjs.d.ts) [CreateJS](http://www.createjs.com) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist), [Satoru Kimura](https://github.com/gyohk) +* [:link:](cron/cron.d.ts) [cron](https://www.npmjs.com/package/cron) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](crossfilter/crossfilter.d.ts) [CrossFilter](https://github.com/square/crossfilter) by [Schmulik Raskin](https://github.com/schmuli) * [:link:](crossroads/crossroads.d.ts) [Crossroads.js](http://millermedeiros.github.io/crossroads.js) by [Diullei Gomes](https://github.com/diullei) * [:link:](crypto-js/crypto-js.d.ts) [crypto-js](https://github.com/evanvosberg/crypto-js) by [Michael Zabka](https://github.com/misak113) @@ -147,6 +156,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](googlemaps.infobubble/google.maps.infobubble.d.ts) [CSS3 InfoBubble with tabs for Google Maps API V3](http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src) by [Johan Nilsson](https://github.com/Dashue) * [:link:](csurf/csurf.d.ts) [csurf](https://www.npmjs.org/package/csurf) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](csv-stringify/csv-stringify.d.ts) [csv-stringify](https://github.com/wdavidw/node-csv-stringify) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](custom-error-generator/custom-error-generator.d.ts) [custom-error-generator](https://github.com/jproulx/node-custom-error) by [Thierry Miceli](https://github.com/thmiceli) * [:link:](md5/md5.d.ts) [CybozuLabs.MD5](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) by [MIZUNE Pine](https://github.com/pine613) * [:link:](d3/d3.d.ts) [d3JS](http://d3js.org) by [Boris Yankov](https://github.com/borisyankov) * [:link:](d3.cloud.layout/d3.cloud.layout.d.ts) [d3JS cloud layout plugin by Jason Davies](https://github.com/jasondavies/d3-cloud) by [hans windhoff](https://github.com/hansrwindhoff) @@ -157,6 +167,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](datejs/datejs.d.ts) [DateJS](http://www.datejs.com) by [David Khristepher Santos](http://github.com/rupertavery) * [:link:](dcjs/dc.d.ts) [DCJS](https://github.com/dc-js/dc.js) by [hans windhoff](https://github.com/hansrwindhoff), [matt traynham](https://github.com/mtraynham) * [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook) +* [:link:](decimal.js/decimal.js.d.ts) [decimal.js](http://mikemcl.github.io/decimal.js) by [Joseph Rossi](http://github.com/musicist288) * [:link:](deep-diff/deep-diff.d.ts) [deep-diff](https://github.com/flitbit/diff) by [ZauberNerd](https://github.com/ZauberNerd) * [:link:](deep-freeze/deep-freeze.d.ts) [deep-freeze](https://github.com/substack/deep-freeze) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](del/del.d.ts) [del](https://github.com/sindresorhus/del) by [Asana](https://asana.com) @@ -171,17 +182,21 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](dock-spawn/dock-spawn.d.ts) [Dock Spawn](http://dockspawn.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](documentdb/documentdb.d.ts) [DocumentDB](https://github.com/Azure/azure-documentdb-node) by [Noel Abrahams](https://github.com/NoelAbrahams) * [:link:](dojo/dojo.d.ts) [Dojo](http://dojotoolkit.org) by [Michael Van Sickle](https://github.com/vansimke) +* [:link:](dompurify/dompurify.d.ts) [DOM Purify](https://github.com/cure53/DOMPurify) by [Dave Taylor](http://davetayls.me) * [:link:](domo/domo.d.ts) [Domo](http://domo-js.com) by [Steve Fenton](https://github.com/Steve-Fenton) * [:link:](domready/domready.d.ts) [domready](https://github.com/ded/domready) by [Christian Holm Nielsen](https://github.com/dotnetnerd) +* [:link:](donna/donna.d.ts) [donna](https://github.com/atom/donna) by [vvakame](https://github.com/vvakame) * [:link:](dot/dot.d.ts) [doT](https://github.com/olado/doT) by [ZombieHunter](https://github.com/ZombieHunter) * [:link:](dotdotdot/dotdotdot.d.ts) [dotdotdot](http://dotdotdot.frebsite.nl) by [Milan Jaros](https://github.com/milanjaros) * [:link:](doublearray/doublearray.d.ts) [doublearray](https://github.com/takuyaa/doublearray) by [MIZUSHIMA Junki](https://github.com/mzsm) * [:link:](drop/drop.d.ts) [Drop](http://github.hubspot.com/drop) by [Adi Dahiya](https://github.com/adidahiya) * [:link:](dropboxjs/dropboxjs.d.ts) [dropbox-js](https://github.com/dropbox/dropbox-js) by [Steve Fenton](https://github.com/Steve-Fenton), [Pedro Casaubon](https://github.com/xperiments) * [:link:](dropzone/dropzone.d.ts) [Dropzone](http://www.dropzonejs.com) by [Natan Vivo](https://github.com/nvivo) +* [:link:](dsv/dsv.d.ts) [dsv](https://www.npmjs.com/package/dsv) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com) * [:link:](durandal/durandal.d.ts) [Durandal](http://durandaljs.com) by [Blue Spire](https://github.com/BlueSpire) * [:link:](easeljs/easeljs.d.ts) [EaselJS](http://www.createjs.com/#!/EaselJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) +* [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) @@ -205,6 +220,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](expect.js/expect.js.d.ts) [expect.js](https://github.com/LearnBoost/expect.js) by [Teppei Sato](https://github.com/teppeis) * [:link:](expectations/expectations.d.ts) [expectations.js](https://github.com/spmason/expectations) by [vvakame](https://github.com/vvakame) * [:link:](express/express.d.ts) [Express 4.x](http://expressjs.com) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](express-debug/express-debug.d.ts) [express-debug](https://github.com/devoidfury/express-debug) by [Federico Bond](https://github.com/federicobond) * [:link:](express-jwt/express-jwt.d.ts) [express-jwt](https://www.npmjs.org/package/express-jwt) by [Wonshik Kim](https://github.com/wokim) * [:link:](express-myconnection/express-myconnection.d.ts) [express-myconnection](https://www.npmjs.org/package/express-myconnection) by [Michael Ferris](https://github.com/Cellule) * [:link:](express-partials/express-partials.d.ts) [express-partials](https://github.com/publicclass/express-partials) by [jt000](https://github.com/jt000) @@ -265,11 +281,12 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com) * [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT) -* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](googlemaps/google.maps.d.ts) [Google Geolocation](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk) +* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](gapi.pagespeedonline/gapi.pagespeedonline.d.ts) [Google Page Speed Online Api](https://developers.google.com/speed/pagespeed) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.picker/google.picker.d.ts) [Google Picker API](https://developers.google.com/picker) by [grapswiz](https://github.com/grapswiz) * [:link:](recaptcha/recaptcha.d.ts) [Google Recaptcha](https://www.google.com/recaptcha) by [Brent Jenkins](https://github.com/brentj73) +* [:link:](grecaptcha/grecaptcha.d.ts) [Google Recaptcha v2](https://www.google.com/recaptcha) by [Kristof Mattei](http://kristofmattei.be) * [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](gapi.urlshortener/gapi.urlshortener.d.ts) [Google Url Shortener API](https://developers.google.com/url-shortener) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.visualization/google.visualization.d.ts) [Google Visualisation Apis](https://developers.google.com/chart) by [Dan Ludwig](https://github.com/danludwig) @@ -279,9 +296,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](greensock/greensock.d.ts) [GreenSock Animation Platform](http://www.greensock.com/get-started-js) by [Robert S](https://github.com/codebelt) * [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm) * [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat) -* [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) +* [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) * [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) * [:link:](gulp-concat/gulp-concat.d.ts) [gulp-concat](http://github.com/wearefractal/gulp-concat) by [Keita Kagurazaka](https://github.com/k-kagurazaka) @@ -314,6 +331,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](highcharts/highcharts.d.ts) [Highcharts](http://www.highcharts.com) by [Damiano Gambarotto](http://github.com/damianog) * [:link:](highland/highland.d.ts) [Highland](http://highlandjs.org) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](highlightjs/highlightjs.d.ts) [highlight.js](https://github.com/isagalaev/highlight.js) by [Niklas Mollenhauer](https://github.com/nikeee), [Jeremy Hull](https://github.com/sourrust) +* [:link:](highcharts/highstock.d.ts) [Highstock](http://www.highcharts.com) by [David Deutsch](http://github.com/DavidKDeutsch) * [:link:](history/history.d.ts) [History.js](https://github.com/browserstate/history.js) by [Boris Yankov](https://github.com/borisyankov), [Gidon Junge](https://github.com/gjunge) * [:link:](howlerjs/howler.d.ts) [howler.js](https://github.com/goldfire/howler.js) by [Pedro Casaubon](https://github.com/xperiments) * [:link:](touch-events/touch-events.d.ts) [HTML Touch Events](http://www.w3.org/TR/touch-events) by [Kevin Barabash](https://github.com/kevinb7) @@ -322,6 +340,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](http-status/http-status.d.ts) [http-status](https://github.com/wdavidw/node-http-status) by [Michael Zabka](https://github.com/misak113) * [:link:](http-string-parser/http-string-parser.d.ts) [http-string-parser](https://github.com/apiaryio/http-string-parser) by [MIZUNE Pine](https://github.com/pine613) * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) +* [:link:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) * [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) @@ -335,6 +354,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](insight/insight.d.ts) [insight](https://github.com/yeoman/insight) by [vvakame](http://github.com/vvakame) * [:link:](interactjs/interact.d.ts) [Interacting for interact.js](https://github.com/taye/interact.js) by [Douglas Eichelberger](https://github.com/dduugg), [Adi Dahiya](https://github.com/adidahiya) * [:link:](intercomjs/intercom.d.ts) [intercom.js](https://github.com/diy/intercom.js) by [spencerwi](http://github.com/spencerwi) +* [:link:](inversify/inversify.d.ts) [inversify](https://github.com/inversify/InversifyJS) by [inversify](https://github.com/inversify) * [:link:](cordova-ionic/cordova-ionic.d.ts) [Ionic Cordova plugins](https://github.com/driftyco) by [Hendrik Maus](https://github.com/hendrikmaus) * [:link:](is_js/is_js.d.ts) [is.js](http://arasatasaygin.github.io/is.js) by [Rodrigo Cabral](https://github.com/cabralRodrigo) * [:link:](iscroll/iscroll.d.ts) [iScroll](http://cubiq.org/iscroll-4) by [Boris Yankov](https://github.com/borisyankov), [Christiaan Rakowski](https://github.com/csrakowski) @@ -351,6 +371,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jasmine-matchers/jasmine-matchers.d.ts) [jasmine-matchers](https://github.com/uxebu/jasmine-matchers) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](java-applet/java-applet.d.ts) [Java Applet](https://www.java.com) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](hooker/hooker.d.ts) [JavaScript Hooker](https://github.com/cowboy/javascript-hooker) by [Michael Zabka](https://github.com/misak113) +* [:link:](oauth.js/oauth.js.d.ts) [JavaScript software for implementing an OAuth consumer](https://code.google.com/p/oauth) by [NOBUOKA Yu](https://github.com/nobuoka) * [:link:](jbinary/jbinary.d.ts) [jBinary](https://github.com/jDataView/jBinary) by [Tim Bureck](https://github.com/tbureck) * [:link:](jdataview/jdataview.d.ts) [jDataView](https://github.com/jDataView/jDataView) by [Ingvar Stepanyan](https://github.com/RReverser) * [:link:](jest/jest.d.ts) [Jest](http://facebook.github.io/jest) by [Asana](https://asana.com) @@ -407,6 +428,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.gridster/gridster.d.ts) [jQuery.gridster](https://github.com/jbaldwin/gridster) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](jquery.jnotify/jquery.jnotify.d.ts) [jQuery.jNotify](http://jnotify.codeplex.com) by [James Curran](https://github.com/jamescurran) * [:link:](jquery.jsignature/jquery.jsignature.d.ts) [jQuery.jsignature v2](https://github.com/willowsystems/jSignature) by [Patrick Magee](https://github.com/pjmagee) +* [:link:](jquery-jsonrpcclient/jquery-jsonrpcclient.d.ts) [jquery.jsonrpc](https://github.com/Textalk/jquery.jsonrpcclient.js) by [Maksim Karelov](https://github.com/Ty3uK) * [:link:](jquery.noty/jquery.noty.d.ts) [jQuery.noty](http://needim.github.io/noty) by [Aaron King](https://github.com/kingdango) * [:link:](jquery.payment/jquery.payment.d.ts) [jQuery.payment](https://github.com/stripe/jquery.payment) by [Eric J. Smith](https://github.com/ejsmith) * [:link:](jquery.pjax.falsandtru/jquery.pjax.d.ts) [jquery.pjax.ts by falsandtru](https://github.com/falsandtru/jquery.pjax.js) by [新ゝ月 NewNotMoon](http://new.not-moon.net) @@ -442,8 +464,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](hashset/hashset.d.ts) [jshashset](http://www.timdown.co.uk/jshashtable/jshashset.html) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](hashtable/hashtable.d.ts) [jshashtable](http://www.timdown.co.uk/jshashtable) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](jsnox/jsnox.d.ts) [JSnoX](https://github.com/af/jsnox) by [Steve Baker](https://github.com/stkb) +* [:link:](json-patch/json-patch.d.ts) [json-patch](https://github.com/bruth/jsonpatch-js) by [vvakame](https://github.com/vvakame) * [:link:](json-pointer/json-pointer.d.ts) [json-pointer 1.0 l](https://www.npmjs.org/package/json-pointer) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](json5/json5.d.ts) [JSON5](http://json5.org) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](jsoneditoronline/jsoneditoronline.d.ts) [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) by [Vincent Bortone](https://github.com/vbortone) +* [:link:](jsonpath/jsonpath.d.ts) [jsonpath](https://www.npmjs.org/package/jsonpath) by [Hiroki Horiuchi](https://github.com/horiuchi) * [:link:](JSONStream/JSONStream.d.ts) [JSONStream](http://github.com/dominictarr/JSONStream) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](jsonwebtoken/jsonwebtoken.d.ts) [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](jsplumb/jquery.jsPlumb.d.ts) [jsPlumb 1.3.16 jQuery adapter](http://jsplumb.org) by [Steve Shearn](https://github.com/shearnie) @@ -488,7 +513,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](leaflet-label/leaflet-label.d.ts) [Leaflet.label](https://github.com/Leaflet/Leaflet.label) by [Wim Looman](https://github.com/Nemo157) * [:link:](jquery.leanModal/jquery.leanModal.d.ts) [leanModal.js](http://leanmodal.finelysliced.com.au) by [FinelySliced](https://github.com/FinelySliced) * [:link:](leapmotionTS/LeapMotionTS.d.ts) [Leap Motion TS](https://github.com/logotype/LeapMotionTS) by [Victor Norgren](https://github.com/logotype) -* [:link:](less/less.d.ts) [LESS](http://lesscss.org) by [AndrewGaspar](https://github.com/AndrewGaspar) +* [:link:](less/less.d.ts) [LESS](http://lesscss.org) by [Tom Hasner](https://github.com/thasner) +* [:link:](less-middleware/less-middleware.d.ts) [less-middleware](https://github.com/emberfeather/less.js-middleware) by [Federico Bond](https://github.com/federicobond) * [:link:](levelup/levelup.d.ts) [LevelUp](https://github.com/rvagg/node-levelup) by [Bret Little](https://github.com/blittle) * [:link:](libxmljs/libxmljs.d.ts) [Libxmljs](https://github.com/polotek/libxmljs) by [François de Campredon](https://github.com/fdecampredon) * [:link:](dustjs-linkedin/dustjs-linkedin.d.ts) [linkedin dustjs](https://github.com/linkedin/dustjs) by [Marcelo Dezem](http://github.com/mdezem) @@ -504,11 +530,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](logrotate-stream/logrotate-stream.d.ts) [logrotate-stream](https://github.com/dstokes/logrotate-stream) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](lolex/lolex.d.ts) [lolex](https://github.com/sinonjs/lolex) by [Wim Looman](https://github.com/Nemo157) * [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Toshihide Hara](https://github.com/kerug) +* [:link:](lory.js/lory.js.d.ts) [lory](https://github.com/meandmax/lory) by [kubosho](https://github.com/kubosho) * [:link:](lru-cache/lru-cache.d.ts) [lru-cache](https://github.com/isaacs/node-lru-cache) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz) * [:link:](lunr/lunr.d.ts) [lunr.js](https://github.com/olivernn/lunr.js) by [Sebastian Lenz](https://github.com/sebastian-lenz) * [:link:](lz-string/lz-string.d.ts) [lz-string](https://github.com/pieroxy/lz-string) by [Roman Nikitin](https://github.com/M0ns1gn0r) +* [:link:](mailcheck/mailcheck.d.ts) [Mailcheck](https://github.com/mailcheck/mailcheck) by [Paulo Cesar](http://github.com/pocesar) * [:link:](main-bower-files/main-bower-files.d.ts) [main-bower-files](https://github.com/ck86/main-bower-files) by [Keita Kagurazaka](https://github.com/k-kagurazaka) +* [:link:](mandrill-api/mandrill-api.d.ts) [Mandrill API 1.x](http://mandrill.com) by [Paulo Cesar](https://github.com/pocesar) * [:link:](mapbox/mapbox.d.ts) [Mapbox](https://www.mapbox.com/mapbox.js) by [Maxime Fabre](https://github.com/anahkiasen) * [:link:](mapsjs/mapsjs.d.ts) [Mapsjs](https://github.com/mapsjs) by [Matthew James Davis](https://github.com/davismj) * [:link:](mariasql/mariasql.d.ts) [mariasql](https://github.com/mscdex/node-mariasql) by [MichaelBennett](https://github.com/bennett000) @@ -524,7 +553,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](meteor/meteor.d.ts) [Meteor](http://www.meteor.com) by [Dave Allen](https://github.com/fullflavedave) * [:link:](method-override/method-override.d.ts) [method-override](https://github.com/expressjs/method-override) by [Santi Albo](https://github.com/santialbo) * [:link:](microsoft-ajax/microsoft.ajax.d.ts) [Microsoft ASP.NET Ajax client side library](http://msdn.microsoft.com/en-us/library/ee341002(v=vs.100).aspx) by [Patrick Magee](https://github.com/pjmagee) +* [:link:](xrm/xrm.d.ts) [Microsoft Dynamics xRM API](http://www.microsoft.com/en-us/download/details.aspx?id=44567) by [David Berry](https://github.com/6ix4our), [Matt Ngan](https://github.com/mattngan) +* [:link:](xrm/xrm-6.d.ts) [Microsoft Dynamics xRM API v6](http://msdn.microsoft.com/en-us/library/gg328255.aspx) by [David Berry](https://github.com/6ix4our) +* [:link:](xrm/clientglobalcontext.d.ts) [Microsoft Dynamics xRM ClientGlobalContext.js.aspx](http://msdn.microsoft.com/en-us/library/gg328255.aspx) by [David Berry](https://github.com/6ix4our) * [:link:](microsoft-live-connect/microsoft-live-connect.d.ts) [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) by [John Vilk](https://github.com/jvilk) +* [:link:](xrm/parature.d.ts) [Microsoft Parature extentions to Xrm.Page - available for CRM Online Only](http://msdn.microsoft.com/en-us/library/gg328255.aspx) by [David Berry](https://github.com/6ix4our) * [:link:](azure-mobile-services-client/AzureMobileServicesClient.d.ts) [Microsoft Windows AzureMobile Service](http://www.windowsazure.com/en-us/develop/mobile) by [Morosinotto Daniele](https://github.com/dmorosinotto) * [:link:](bingmaps/Microsoft.Maps.d.ts) [Microsoft.Maps](http://msdn.microsoft.com/en-us/library/gg427611.aspx) by [Eric Todd](https://github.com/ericrtodd) * [:link:](bingmaps/Microsoft.Maps.AdvancedShapes.d.ts) [Microsoft.Maps.AdvancedShapes](http://msdn.microsoft.com/en-us/library/hh921952.aspx) by [Eric Todd](https://github.com/ericrtodd) @@ -557,7 +590,6 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mousetrap/mousetrap.d.ts) [Mousetrap](http://craig.is/killing/mice) by [Dániel Tar](https://github.com/qcz) * [:link:](mousetrap/mousetrap-global-bind.d.ts) [Mousetrap 1.4.6's global-bind extension](http://craig.is/killing/mice#extensions.global) by [Andrew Bradley](https://github.com/cspotcode) * [:link:](moviedb/moviedb.d.ts) [MovieDB](https://github.com/danzajdband/moviedb) by [Basarat Ali Syed](https://github.com/basarat) -* [:link:](mozilla-spidermonkey-parser-api/mozilla-spidermonkey-parser-api.d.ts) [Mozilla SpiderMonkey Parser API](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API) by [vvakame](https://github.com/vvakame) * [:link:](firefox/firefox.d.ts) [Mozilla Web API](https://developer.mozilla.org/en-US/docs/Web/API) by [vvakame](https://github.com/vvakame) * [:link:](localForage/localForage.d.ts) [Mozilla's localForage](https://github.com/mozilla/localforage) by [david pichsenmeister](https://github.com/3x14159265) * [:link:](msgpack/msgpack.d.ts) [msgpack.js - MessagePack JavaScript Implementation](https://github.com/uupaa/msgpack.js) by [Shinya Mochizuki](https://github.com/enrapt-mochizuki) @@ -598,23 +630,24 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm) * [:link:](node/node.d.ts) [Node.js](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) * [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle) -* [:link:](acl/acl.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) +* [:link:](acl/acl.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo) * [:link:](mdns/mdns.d.ts) [node_mdns](https://github.com/agnat/node_mdns) by [Stefan Steinhart](https://github.com/reppners) * [:link:](node_redis/node_redis.d.ts) [node_redis](https://github.com/mranney/node_redis) by [Boris Yankov](https://github.com/borisyankov) * [:link:](each/each.d.ts) [NodeEach](http://www.adaltas.com/projects/node-each) by [Michael Zabka](https://github.com/misak113) +* [:link:](nodemailer/nodemailer-types.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Rogier Schouten](https://github.com/rogierschouten) -* [:link:](nodemailer-direct-transport/nodemailer-direct-transport.d.ts) [Nodemailer](https://github.com/andris9/nodemailer-direct-transport) by [Rogier Schouten](https://github.com/rogierschouten) -* [:link:](nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts) [Nodemailer](https://github.com/andris9/nodemailer-smptp-transport) by [Rogier Schouten](https://github.com/rogierschouten) -* [:link:](nodemailer-smtp-pool/nodemailer-smtp-pool.d.ts) [Nodemailer](https://github.com/andris9/nodemailer-smtp-pool) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer-direct-transport/nodemailer-direct-transport.d.ts) [nodemailer-direct-transport](https://github.com/andris9/nodemailer-direct-transport) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer-smtp-pool/nodemailer-smtp-pool.d.ts) [nodemailer-smtp-pool](https://github.com/andris9/nodemailer-smtp-pool) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](nodemailer-smtp-transport/nodemailer-smtp-transport.d.ts) [nodemailer-smtp-transport](https://github.com/andris9/nodemailer-smtp-transport) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](nodeunit/nodeunit.d.ts) [nodeunit](https://github.com/caolan/nodeunit) by [Jeff Goddard](https://github.com/jedigo) * [:link:](nomnom/nomnom.d.ts) [nomnom](https://github.com/harthur/nomnom) by [Paul Vick](https://github.com/panopticoncentral) * [:link:](nopt/nopt.d.ts) [nopt](https://github.com/npm/nopt) by [jbondc](https://github.com/jbondc) -* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) -* [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) +* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Corey Jepperson](https://github.com/acoreyj) +* [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) * [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) @@ -661,10 +694,10 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr) * [:link:](polymer/polymer.d.ts) [polymer](https://github.com/polymer) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.paper-dialog.d.ts) [polymer's paper-dialog](https://github.com/Polymer/paper-dialog) by [Louis Grignon](https://github.com/lgrignon) -* [:link:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) -* [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.core-drawer-panel.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-drawer-panel) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) * [:link:](polymer/polymer.core-selector.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon) +* [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon) * [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz) * [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U) * [:link:](power-assert/power-assert.d.ts) [power-assert](https://github.com/twada/power-assert) by [vvakame](https://github.com/vvakame) @@ -731,6 +764,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](sammyjs/sammyjs.d.ts) [Sammy.js](http://sammyjs.org) by [Boris Yankov](https://github.com/borisyankov), [Oisin Grehan](https://github.com/oising) * [:link:](sanitize-filename/sanitize-filename.d.ts) [sanitize-filename](https://github.com/parshap/node-sanitize-filename) by [Wim Looman](https://github.com/Nemo157) * [:link:](sanitize-html/sanitize-html.d.ts) [sanitize-html](https://github.com/punkave/sanitize-html) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](sanitizer/sanitizer.d.ts) [Sanitizer](https://github.com/theSmaw/Caja-HTML-Sanitizer) by [Dave Taylor](http://davetayls.me) * [:link:](sax/sax.d.ts) [sax js](https://github.com/isaacs/sax-js) by [Asana](https://asana.com) * [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy) * [:link:](select2/select2.d.ts) [Select2](http://ivaynberg.github.com/select2) by [Boris Yankov](https://github.com/borisyankov) @@ -774,6 +808,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](spectrum/spectrum.d.ts) [spectrum](https://github.com/bgrins/spectrum) by [Mordechai Zuber](https://github.com/M-Zuber) * [:link:](spin/spin.d.ts) [Spin.js](http://fgnass.github.com/spin.js) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) * [:link:](split/split.d.ts) [split](https://github.com/dominictarr/split) by [Marcin Porębski](https://github.com/marcinporebski) +* [:link:](sprintf-js/sprintf-js.d.ts) [sprintf-js](https://www.npmjs.com/package/sprintf-js) by [Jason Swearingen](https://jasonswearingen.github.io) * [:link:](sprintf/sprintf.d.ts) [sprintff](https://github.com/maritz/node-sprintff) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](sharepoint/SharePoint.d.ts) [sptypescript](http://sptypescript.codeplex.com) by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru), [Andrey Markeev](http://markeev.com) * [:link:](sqlite3/sqlite3.d.ts) [sqlite3](https://github.com/mapbox/node-sqlite3) by [Nick Malaguti](https://github.com/nmalaguti) @@ -786,6 +821,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka) * [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Eric J. Smith](https://github.com/ejsmith) +* [:link:](stripe/stripe-node.d.ts) [stripe-node](https://github.com/stripe/stripe-node) by [William Johnston](https://github.com/wjohnsto) +* [:link:](strophe/strophe.d.ts) [Strophe.js](http://strophe.im/strophejs) by [David Deutsch](https://github.com/DavidKDeutsch) * [:link:](stylus/stylus.d.ts) [stylus](https://github.com/LearnBoost/stylus) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](sugar/sugar.d.ts) [Sugar](http://sugarjs.com) by [Josh Baldwin](https://github.com/jbaldwin) * [:link:](superagent/superagent.d.ts) [SuperAgent](https://github.com/visionmedia/superagent) by [Alex Varju](https://github.com/varju) @@ -795,6 +832,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](svg2png/svg2png.d.ts) [svg2png node package](https://github.com/domenic/svg2png) by [hans windhoff](https://github.com/hansrwindhoff) * [:link:](svgjs.draggable/svgjs.draggable.d.ts) [svgjs.draggable](http://www.svgjs.com) by [Luigi Trabacchin](https://github.com/LiFeleSs) * [:link:](swag/swag.d.ts) [swag](https://github.com/elving/swag) by [Shogo Iwano](https://github.com/shiwano) +* [:link:](sweetalert/sweetalert.d.ts) [SweetAlert](https://github.com/t4t5/sweetalert) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](swfobject/swfobject.d.ts) [swfobject](https://code.google.com/p/swfobject) by [rou](https://github.com/rou) * [:link:](swig/swig.d.ts) [swig](http://github.com/paularmstrong/swig) by [Peter Harris](https://github.com/CodeAnimal), [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](swiper/swiper.d.ts) [Swiper](https://github.com/nolimits4web/Swiper) by [Sebastián Galiano](https://github.com/sgaliano) @@ -842,6 +880,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](twitter/twitter.d.ts) [Twitter for Websites](https://dev.twitter.com/web) by [Chitoku](https://github.com/chitoku-k) * [:link:](jquery.bootstrap.wizard/jquery.bootstrap.wizard.d.ts) [twitter-bootstrap-wizard](https://github.com/VinceG/twitter-bootstrap-wizard) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](type-detect/type-detect.d.ts) [type-detect](https://github.com/chaijs/type-detect) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](type-name/type-name.d.ts) [type-name](https://github.com/twada/type-name) by [OKUNOKENTARO](https://github.com/armorik83) * [:link:](typeahead/typeahead.d.ts) [typeahead.js](http://twitter.github.io/typeahead.js) by [Ivaylo Gochkov](https://github.com/igochkov), [Gidon Junge](https://github.com/gjunge) * [:link:](typescript/typescript.d.ts) [TypeScript API](http://www.typescriptlang.org) by [Microsoft TypeScript](http://typescriptlang.org) * [:link:](typescript-deferred/typescript-deferred.d.ts) [typescript-deferred](https://github.com/DirtyHairy/typescript-deferred) by [Christian Speckner](https://github.com/DirtyHairy) @@ -850,6 +889,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](underscore/underscore.d.ts) [Underscore](http://underscorejs.org) by [Boris Yankov](https://github.com/borisyankov), [Josh Baldwin](https://github.com/jbaldwin) * [:link:](underscore-ko/underscore-ko.d.ts) [Underscore-ko 1.2.2 with underscore](https://github.com/kamranayub/UnderscoreKO) by [Maurits Elbers](https://github.com/MagicMau) * [:link:](underscore.string/underscore.string.d.ts) [underscore.string](https://github.com/epeli/underscore.string) by [Ry Racherbaumer](http://github.com/rygine) +* [:link:](uniq/uniq.d.ts) [uniq](https://www.npmjs.com/package/uniq) by [Hans Windhoff](https://github.com/hansrwindhoff) * [:link:](universal-analytics/universal-analytics.d.ts) [universal-analytics](https://github.com/peaksandpies/universal-analytics) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](update-notifier/update-notifier.d.ts) [update-notifier](https://github.com/yeoman/update-notifier) by [vvakame](https://github.com/vvakame) * [:link:](uri-templates/uri-templates.d.ts) [uri-templates](https://github.com/geraintluff/uri-templates) by [Bart van der Schoor](https://github.com/Bartvds) @@ -880,6 +920,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webix/webix.d.ts) [Webix UI](http://webix.com) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42) * [:link:](websocket/websocket.d.ts) [websocket](https://github.com/Worlize/WebSocket-Node) by [Paul Loyd](https://github.com/loyd) +* [:link:](websql/websql.d.ts) [websql](http://www.w3.org/TR/webdatabase) by [TeamworkGuy2](https://github.com/TeamworkGuy2) * [:link:](when/when.d.ts) [When](https://github.com/cujojs/when) by [Derek Cicerone](https://github.com/derekcicerone), [Wim Looman](https://github.com/Nemo157) * [:link:](which/which.d.ts) [which](https://github.com/isaacs/node-which) by [vvakame](https://github.com/vvakame) * [:link:](jquery.window/jquery.window.d.ts) [Window plugin for jQuery](http://fstoke.me/jquery/window) by [Ryan Graham](https://github.com/ryan-codingintrigue) @@ -896,6 +937,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](xpath/xpath.d.ts) [xpath](https://github.com/goto100/xpath) by [Andrew Bradley](https://github.com/cspotcode) * [:link:](xregexp/xregexp.d.ts) [XRegExp](http://xregexp.com) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](xsockets/XSockets.d.ts) [XSockets.NET](http://xsockets.net) by [Jeffery Grajkowski](https://github.com/pushplay) +* [:link:](xss-filters/xss-filters.d.ts) [Yahoo XSS Filters](https://github.com/yahoo/xss-filters) by [Dave Taylor](http://davetayls.me) * [:link:](yamljs/yamljs.d.ts) [yamljs](https://github.com/jeremyfa/yaml.js) by [Tim Jonischkat](http://www.tim-jonischkat.de) * [:link:](yargs/yargs.d.ts) [yargs](https://github.com/chevex/yargs) by [Martin Poelstra](https://github.com/poelstra) * [:link:](yeoman-generator/yeoman-generator.d.ts) [yeoman-generator](https://github.com/yeoman/generator) by [Kentaro Okuno](http://github.com/armorik83) diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 608591b581..c9883f86e0 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -131,6 +131,7 @@ testApp.controller('TestCtrl', ( var modalInstance = $modal.open({ backdrop: 'static', controller: 'ModalTestCtrl', + controllerAs: 'vm', keyboard: true, resolve: { items: ()=> { diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index d7e65c77ca..c3675e7a98 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -229,7 +229,7 @@ declare module angular.ui.bootstrap { * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). * Defaults to `$rootScope`. */ - scope?: IModalScope; + scope?: angular.IScope|IModalScope; /** * a controller for a modal instance - it can initialize scope used by modal. @@ -237,6 +237,12 @@ declare module angular.ui.bootstrap { */ controller?: any; + /** + * an alternative to the controller-as syntax, matching the API of directive definitions. + * Requires the controller option to be provided as well + */ + controllerAs?: string; + /** * members that will be resolved and passed to the controller as locals; it is equivalent of the `resolve` property for AngularJS routes */ diff --git a/angular-wizard/angular-wizard-tests.ts b/angular-wizard/angular-wizard-tests.ts new file mode 100644 index 0000000000..61ad7a4843 --- /dev/null +++ b/angular-wizard/angular-wizard-tests.ts @@ -0,0 +1,218 @@ +/// +/// + +/// + +// test file taken from https://github.com/mgonto/angular-wizard + + +interface WizardScope extends ng.IScope { + referenceCurrentStep:string; + stepValidation:()=>void; + finishedWizard:()=>void; + enterValidation:()=>void; +} + +describe('AngularWizard', function () { + var $compile:ng.ICompileService, + $rootScope:ng.IRootScopeService, WizardHandler:angular.mgoAngularWizard.WizardHandler, scope:WizardScope; + + /** + * Create the view with wizard to test + * @param {Scope} scope A scope to bind to + * @return {[DOM element]} A DOM element compiled + */ + function createView(scope:WizardScope) { + scope.referenceCurrentStep = null; + var element = angular.element('' + + ' ' + + '

This is the first step

' + + '

Here you can use whatever you want. You can use other directives, binding, etc.

' + + ' ' + + '
' + + ' ' + + '

Continuing

' + + '

You have continued here!

' + + ' ' + + '
' + + ' ' + + '

Even more steps!!

' + + ' ' + + '
' + + '
'); + var elementCompiled = $compile(element)(scope); + $rootScope.$digest(); + return elementCompiled; + } + + it("should correctly create the wizard", function () { + var view = createView(scope); + expect(WizardHandler).toBeTruthy(); + expect(view.find('section').length).toEqual(3); + // expect the correct step to be desirable one + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + + it("should go to the next step", function () { + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should return to a previous step", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().previous(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + it("should go to a step specified by name", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().goTo('More steps'); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should go to a step specified by index", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().goTo(2); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should go to next step becasue callback is truthy", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(function () { + return true + }); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should NOT go to next step because callback is falsey", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(function () { + return false + }); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + it("should go to next step because CANEXIT is UNDEFINED", function () { + + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should go to next step because CANEXIT is TRUE", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return true; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should NOT go to next step because CANEXIT is FALSE", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should go to next step because CANENTER is TRUE", function () { + + var view = createView(scope); + scope.enterValidation = function () { + return true; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('More steps'); + }); + it("should NOT go to next step because CANENTER is FALSE", function () { + + var view = createView(scope); + scope.enterValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should NOT return to a previous step. Although CANEXIT is false and we are heading to a previous state, the can enter validation is false", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return false; + }; + scope.enterValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().previous(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + }); + it("should return to a previous step even though CANEXIT is false", function () { + + var view = createView(scope); + scope.stepValidation = function () { + return false; + }; + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().next(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Continuing'); + WizardHandler.wizard().previous(); + $rootScope.$digest(); + expect(scope.referenceCurrentStep).toEqual('Starting'); + }); + it("should finish", function () { + + var flag = false; + scope.finishedWizard = function () { + flag = true; + }; + var view = createView(scope); + expect(scope.referenceCurrentStep).toEqual('Starting'); + WizardHandler.wizard().finish(); + expect(flag).toBeTruthy(); + $rootScope.$digest(); + }); +}); + diff --git a/angular-wizard/angular-wizard.d.ts b/angular-wizard/angular-wizard.d.ts new file mode 100644 index 0000000000..f079a46c24 --- /dev/null +++ b/angular-wizard/angular-wizard.d.ts @@ -0,0 +1,21 @@ +// Type definitions for Angular Wizard 0.4.2 +// Project: https://github.com/mgonto/angular-wizard +// Definitions by: Marko Jurisic +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module angular.mgoAngularWizard { + interface WizardHandler { + wizard(name?:string): Wizard; + addWizard(name:string, wizard:Wizard):void; + removeWizard(name:string):void; + } + + interface Wizard { + next(nextHandler?:Function):void; + previous():void; + goTo(step:number):void; + goTo(step:string):void; + finish():void; + currentStepNumber():number; + } +} diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 89a747f828..cdea69d369 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Angular JS 1.3 (ngCookies module) +// Type definitions for Angular JS 1.4 (ngCookies module) // Project: http://angularjs.org -// Definitions by: Diego Vilar +// Definitions by: Diego Vilar , Anthony Ciccarello // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -28,10 +28,13 @@ declare module angular.cookies { // CookieStoreService // see http://docs.angularjs.org/api/ngCookies.$cookieStore /////////////////////////////////////////////////////////////////////////// - interface ICookieStoreService { - get(key: string): any; - put(key: string, value: any): void; - remove(key: string): void; + interface ICookiesService { + get(key: string): string; + getObject(key: string): any; + getAll(): any; + put(key: string, value: string, options?: any): void; + putObject(key: string, value: any, options?: any): void; + remove(key: string, options?: any): void; } } diff --git a/ansi-styles/ansi-styles-tests.ts b/ansi-styles/ansi-styles-tests.ts new file mode 100644 index 0000000000..dc3187ef5b --- /dev/null +++ b/ansi-styles/ansi-styles-tests.ts @@ -0,0 +1,54 @@ +/// + +import ansi = require('ansi-styles'); + + +var styles = [ + ansi.reset, + + ansi.bold, + ansi.dim, + ansi.italic, + ansi.underline, + ansi.inverse, + ansi.hidden, + ansi.strikethrough, + + ansi.black, + ansi.red, + ansi.green, + ansi.yellow, + ansi.blue, + ansi.magenta, + ansi.cyan, + ansi.white, + ansi.gray, + + ansi.bgBlack, + ansi.bgRed, + ansi.bgGreen, + ansi.bgYellow, + ansi.bgBlue, + ansi.bgMagenta, + ansi.bgCyan, + ansi.bgWhite +] + +for (var key in styles) { + check(key, styles[key]) +} + +function check(key:string, escapeCodes:ansi.EscapeCodePair): void { + if (uninitialized(escapeCodes.open)) { + throw new Error('key not found ~> ' + key + '.open') + } + if (uninitialized(escapeCodes.close)) { + throw new Error('key not found ~> ' + key + '.close') + } +} + +function uninitialized(val:any): boolean { + return val === null || val === undefined +} + + diff --git a/ansi-styles/ansi-styles.d.ts b/ansi-styles/ansi-styles.d.ts new file mode 100644 index 0000000000..4c79b118f3 --- /dev/null +++ b/ansi-styles/ansi-styles.d.ts @@ -0,0 +1,42 @@ +// Type definitions for ansi-styles 2.0.1 +// Project: https://github.com/sindresorhus/ansi-styles +// Definitions by: bryn austin bellomy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module "ansi-styles" +{ + export interface EscapeCodePair { + open: string; + close: string; + } + + export var reset: EscapeCodePair; + + export var bold: EscapeCodePair; + export var dim: EscapeCodePair; + export var italic: EscapeCodePair; + export var underline: EscapeCodePair; + export var inverse: EscapeCodePair; + export var hidden: EscapeCodePair; + export var strikethrough: EscapeCodePair; + + export var black: EscapeCodePair; + export var red: EscapeCodePair; + export var green: EscapeCodePair; + export var yellow: EscapeCodePair; + export var blue: EscapeCodePair; + export var magenta: EscapeCodePair; + export var cyan: EscapeCodePair; + export var white: EscapeCodePair; + export var gray: EscapeCodePair; + + export var bgBlack: EscapeCodePair; + export var bgRed: EscapeCodePair; + export var bgGreen: EscapeCodePair; + export var bgYellow: EscapeCodePair; + export var bgBlue: EscapeCodePair; + export var bgMagenta: EscapeCodePair; + export var bgCyan: EscapeCodePair; + export var bgWhite: EscapeCodePair; +} \ No newline at end of file diff --git a/buffers/buffers-tests.ts b/buffers/buffers-tests.ts new file mode 100644 index 0000000000..0a51f97ae4 --- /dev/null +++ b/buffers/buffers-tests.ts @@ -0,0 +1,49 @@ +/// +import Buffers = require('buffers'); + +var any: any; +var num: number; +var str: string; +var buf = new Buffer([1, 2, 3]); +var bufs: Buffers = new Buffers(); // with new, as type + +bufs = Buffers(); // no new + +// with self +bufs = Buffers(bufs); +bufs = new Buffers(bufs); + +// with array of buffers. +bufs = Buffers([buf, buf]); +bufs = new Buffers([buf, buf]); + +num = bufs.push(buf); +num = bufs.push(buf, buf); + +num = bufs.unshift(buf); +num = bufs.unshift(buf, buf); + +buf = bufs.slice(); +buf = bufs.slice(num); +buf = bufs.slice(num, num); + +bufs = bufs.splice(num); +bufs = bufs.splice(num, num); +bufs = bufs.splice(num, num, buf); +bufs = bufs.splice(num, num, buf, buf); + +num = bufs.copy(buf); +num = bufs.copy(buf, num, num, num); + +any = bufs.get(num); +bufs.set(num, any); + +num = bufs.indexOf(str); +num = bufs.indexOf(str, num); +num = bufs.indexOf(buf); +num = bufs.indexOf(buf, num); + +buf = bufs.toBuffer(); + +str = buf.toString(); +str = buf.toString(any, num, num); diff --git a/buffers/buffers.d.ts b/buffers/buffers.d.ts new file mode 100644 index 0000000000..fad36d3c49 --- /dev/null +++ b/buffers/buffers.d.ts @@ -0,0 +1,36 @@ +// Type definitions for buffers 0.1.1 +// Project: https://github.com/substack/node-buffers +// Definitions by: Robert Hencke +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "buffers" { + + interface BuffersStatics { + new (bufs?: Buffer[]|Buffers): Buffers; + (bufs?: Buffer[]| Buffers): Buffers; + prototype: Buffers; + } + + interface Buffers { + buffers: Buffer[]; + length: number; + + push(...items: Buffer[]): number; + unshift(...items: Buffer[]): number; + slice(i?: number, j?: number): Buffer; + splice(i: number, howMany?: number, ...items: Buffer[]): Buffers; + copy(dst: Buffer, dstStart?: number, start?: number, end?: number): number; + get(i: number): any; + set(i: number, b: any): void; + indexOf(needle: string|Buffer, offset?: number): number; + toBuffer(): Buffer; + toString(encoding?: any, start?: number, end?: number): string; + } + + var Buffers: BuffersStatics; + + export = Buffers; + +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index 98d75e8aef..ddaa84ee28 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -337,6 +337,11 @@ function deepEqual3(Date) { expect(a).not.to.deep.equal({}); } +function deepInclude(val) { + expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); + expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]); +} + function empty() { function FakeArgs() { }; FakeArgs.prototype.length = 0; diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 4b9d313dd2..dd0adf9740 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -132,6 +132,7 @@ declare module chai { interface Deep { equal: Equal; + include: Include; property: Property; } diff --git a/chrome/chrome-app-tests.ts b/chrome/chrome-app-tests.ts index 01657dc858..de56bbac89 100644 --- a/chrome/chrome-app-tests.ts +++ b/chrome/chrome-app-tests.ts @@ -23,8 +23,13 @@ chrome.app.runtime.onLaunched.addListener(function (launchData: runtime.LaunchDa chrome.app.runtime.onRestarted.addListener(function () { return; }); -// Get Current Window +// retrieving windows var currentWindow: cwindow.AppWindow = chrome.app.window.current(); +var otherWindow: cwindow.AppWindow = chrome.app.window.get('some-string'); +var allWindows: cwindow.AppWindow[] = chrome.app.window.getAll(); + +// check platform capabilities +var visibleEverywhere: boolean = chrome.app.window.canSetVisibleOnAllWorkspaces(); // FileSystem // https://developer.chrome.com/apps/fileSystem diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index a2b0d5997e..2f498ed28c 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -126,6 +126,9 @@ declare module chrome.app.window { export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void; export function current(): AppWindow; + export function get(id: string): AppWindow; + export function getAll(): AppWindow[]; + export function canSetVisibleOnAllWorkspaces(): boolean; interface WindowEvent { addListener(callback: () => void): void; diff --git a/colorbrewer/colorbrewer-tests.ts b/colorbrewer/colorbrewer-tests.ts new file mode 100644 index 0000000000..7e17551b5a --- /dev/null +++ b/colorbrewer/colorbrewer-tests.ts @@ -0,0 +1,8 @@ +/// + +var accent3: string[] = colorbrewer.Accent[3]; +var accent4: string[] = colorbrewer.Accent[4]; +var accent5: string[] = colorbrewer.Accent[5]; +var accent6: string[] = colorbrewer.Accent[6]; +var accent7: string[] = colorbrewer.Accent[7]; +var accent8: string[] = colorbrewer.Accent[8]; diff --git a/colorbrewer/colorbrewer.d.ts b/colorbrewer/colorbrewer.d.ts new file mode 100644 index 0000000000..ecd4bffc7b --- /dev/null +++ b/colorbrewer/colorbrewer.d.ts @@ -0,0 +1,76 @@ +// Type definitions for colorbrewer v1.0.0 +// Project: https://github.com/jeanlauliac/colorbrewer +// Definitions by: Matt Traynham +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var colorbrewer: ColorBrewer.Base; + +declare module ColorBrewer { + interface ColorScheme { + [n: number]: string[]; + } + + interface EightColorScheme extends ColorScheme { + 3: [string, string, string]; + 4: [string, string, string, string]; + 5: [string, string, string, string, string]; + 6: [string, string, string, string, string, string]; + 7: [string, string, string, string, string, string, string]; + 8: [string, string, string, string, string, string, string, string]; + } + + interface NineColorScheme extends EightColorScheme { + 9: [string, string, string, string, string, string, string, string, string]; + } + + interface ElevenColorScheme extends NineColorScheme { + 10: [string, string, string, string, string, string, string, string, string, string]; + 11: [string, string, string, string, string, string, string, string, string, string, string]; + } + + interface TwelveColorScheme extends ElevenColorScheme { + 12: [string, string, string, string, string, string, string, string, string, string, string, string]; + } + + interface Base { + YlGn: NineColorScheme; + YlGnBu: NineColorScheme; + GnBu: NineColorScheme; + BuGn: NineColorScheme; + PuBuGn: NineColorScheme; + PuBu: NineColorScheme; + BuPu: NineColorScheme; + RdPu: NineColorScheme; + PuRd: NineColorScheme; + OrRd: NineColorScheme; + YlOrRd: NineColorScheme; + YlOrBr: NineColorScheme; + Purples: NineColorScheme; + Blues: NineColorScheme; + Greens: NineColorScheme; + Oranges: NineColorScheme; + Reds: NineColorScheme; + Greys: NineColorScheme; + PuOr: ElevenColorScheme; + BrBG: ElevenColorScheme; + PRGn: ElevenColorScheme; + PiYG: ElevenColorScheme; + RdBu: ElevenColorScheme; + RdGy: ElevenColorScheme; + RdYlBu: ElevenColorScheme; + Spectral: ElevenColorScheme; + RdYlGn: ElevenColorScheme; + Accent: EightColorScheme; + Dark2: EightColorScheme; + Paired: TwelveColorScheme; + Pastel1: NineColorScheme; + Pastel2: EightColorScheme; + Set1: NineColorScheme; + Set2: EightColorScheme; + Set3: TwelveColorScheme; + } +} + +declare module 'colorbrewer' { + export = colorbrewer; +} diff --git a/convert-source-map/convert-source-map.d.ts b/convert-source-map/convert-source-map.d.ts index 6034d13f7e..34a0b2c8ea 100644 --- a/convert-source-map/convert-source-map.d.ts +++ b/convert-source-map/convert-source-map.d.ts @@ -6,22 +6,22 @@ declare module "convert-source-map" { export interface SourceMapConverter { toObject(): any; - toJSON(space?): string; + toJSON(space?: any): string; toBase64(): string; toComment(): string; - addProperty(key, value): SourceMapConverter; - setProperty(key, value): SourceMapConverter; + addProperty(key: string, value: any): SourceMapConverter; + setProperty(key: string, value: any): SourceMapConverter; - getProperty(key): any; + getProperty(key: string): any; } - export function removeComments(src): string; + export function removeComments(src: string): string; export var commentRegex: RegExp; - export function fromObject(obj): SourceMapConverter; + export function fromObject(obj: any): SourceMapConverter; export function fromJSON(json: string): SourceMapConverter; export function fromBase64(base64: string): SourceMapConverter; export function fromComment(comment: string): SourceMapConverter; export function fromSource(source: string): SourceMapConverter; -} \ No newline at end of file +} diff --git a/custom-error-generator/custom-error-generator-tests.ts b/custom-error-generator/custom-error-generator-tests.ts new file mode 100644 index 0000000000..09ae86373e --- /dev/null +++ b/custom-error-generator/custom-error-generator-tests.ts @@ -0,0 +1,6 @@ +/// + +import createCustomError = require('custom-error-generator'); +var HTTPError = createCustomError('HTTPError', { 'code' : 500, 'status' : 'Server Error' }); +var error = new HTTPError('Uh oh'); +console.log(error.code, error.status); diff --git a/custom-error-generator/custom-error-generator.d.ts b/custom-error-generator/custom-error-generator.d.ts new file mode 100644 index 0000000000..8ce65f673d --- /dev/null +++ b/custom-error-generator/custom-error-generator.d.ts @@ -0,0 +1,11 @@ +// Type definitions for custom-error-generator 7.0.0 +// Project: https://github.com/jproulx/node-custom-error +// Definitions by: Thierry Miceli +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "custom-error-generator" { + function createError(name: string, parameters?: Object, Constructor?: any): any; + module createError { + } + export = createError; +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index b71610f944..f3dbee63d9 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -371,6 +371,12 @@ declare module D3 { * Request a comma-separated values (CSV) file. */ csv: Dsv; + + /** + * Request an arbitrary char-separated values file parser, like semicolon or what ever + */ + dsv: Dsv; + /** * Request a tab-separated values (TSV) file */ @@ -708,6 +714,17 @@ declare module D3 { */ (url: string, callback?: (error: any, response: any[]) => void ): Xhr; /** + * Arbitrary Delimiters: + * Constructs a new parser for the given delimiter and mime type. For example, to parse values separated by "|", the vertical bar character, use: + * var dsv = d3.dsv("|", "text/plain"); + * + * returns the new parser + * + * @param separator seperator character + * @param contentType + */ + (separator: string, contentType:string): (url: string, callback?: (error: any, response: any[]) => void )=> Xhr; + /** * Parse a delimited string into objects using the header row. * * @param string delimited formatted string to parse diff --git a/decimal.js/decimal.js-tests.ts b/decimal.js/decimal.js-tests.ts new file mode 100644 index 0000000000..b151380d51 --- /dev/null +++ b/decimal.js/decimal.js-tests.ts @@ -0,0 +1,401 @@ +/// +var x = new Decimal(9) +var y = new Decimal(x) + +Decimal(435.345) + +new Decimal('5032485723458348569331745.33434346346912144534543') +new Decimal('4.321e+4') +new Decimal('-735.0918e-430') +new Decimal('5.6700000') +new Decimal(Infinity) +new Decimal(NaN) +new Decimal('.5') +new Decimal('+2') +new Decimal(-10110100.1, 2) +new Decimal('123412421.234324', 5) +new Decimal('ff.8', 16) + +Decimal.config({ precision: 5 }) +new Decimal(1.23456789) +new Decimal(1.23456789, 10) + + +Decimal.config({ + precision: 20, + rounding: 4, + toExpNeg: -7, + toExpPos: 21, + minE: -9e15, + maxE: 9e15, + errors: true, + crypto: false, + modulo: 1, + format: { + decimalSeparator: '.', + groupSeparator: ',', + groupSize: 3, + secondaryGroupSize: 0, + fractionGroupSeparator: '\xA0', + fractionGroupSize: 0 + } +}); + +Decimal.config({ + format: { + + decimalSeparator: '.', + + groupSeparator: ',', + + groupSize: 3, + + secondaryGroupSize: 0, + + fractionGroupSeparator: ' ', + + fractionGroupSize: 0 + } +}); +Decimal.config({ rounding: Decimal.ROUND_CEIL }) +Decimal.config({ rounding: 2 }) +Decimal.rounding + +x = new Decimal(1.3) +x.ceil() +y = new Decimal(-1.8) +y.ceil() + +x.comparedTo(y) +x.comparedTo(x.minus(1)) +y.cmp(NaN) +y.cmp('110', 2) + +x.decimalPlaces() +y.dp() + +x.dividedBy(y) +x.div(5) +x.div(47, 16) + +x.dividedToIntegerBy(y) +x.divToInt(0.7) +x.divToInt('0.f', 16) + +x.equals('1e-324') +new Decimal(-0).eq(x) +new Decimal(255).eq('ff', 16) + +y = new Decimal(NaN) +y.equals(NaN) + +x = new Decimal(1) +x.exponential() +y = new Decimal(2) +y.exp() + +x = new Decimal(1.8) +x.floor() +y = new Decimal(-1.3) +y.floor() + +x.greaterThan(Decimal(0.3).minus(0.2)) +new Decimal(0).gt(x) +new Decimal(11, 3).gt(11.1, 2) + + +x = new Decimal(0.3).minus(0.2) +x.greaterThanOrEqualTo(0.1) +new Decimal(1).gte(x) +new Decimal(10, 18).gte('i', 36) + +x = new Decimal(1) +x.isFinite() +y = new Decimal(Infinity) +y.isFinite() + +x = new Decimal(1) +x.isInteger() +y = new Decimal(123.456) +y.isInt() + +x = new Decimal(NaN) +x.isNaN() +y = new Decimal('Infinity') +y.isNaN() + +x = new Decimal(-0) +x.isNegative() +y = new Decimal(2) +y.isNeg + +x = new Decimal(-0) +x.isZero() && x.isNeg() +y = new Decimal(Infinity) +y.isZero() + +x.lessThan(0.1) +new Decimal(0).lt(x) +new Decimal(11.1, 2).lt(11, 3) + +x.lessThan(0.1) +new Decimal(0).lt(x) +new Decimal(11.1, 2).lt(11, 3) + +x = new Decimal(0.1) +x.lessThanOrEqualTo(Decimal(0.3).minus(0.2)) +new Decimal(-1).lte(x) +new Decimal(10, 18).lte('i', 36) + +x = new Decimal(1000) +x.logarithm() +y = new Decimal(256) +y.log(2) + +x = new Decimal(0.3) +x.minus(0.1) +x.minus(0.6, 20) + +x = new Decimal(1) +x.modulo(0.9) + +y = new Decimal(33) +y.mod('a', 33) + +x = new Decimal(8) +y = new Decimal(-3) +Decimal.modulo = 1 +x.mod(y) +Decimal.modulo = 3 +x.mod(y) + +x = new Decimal(10) +x.naturalLogarithm() +y = new Decimal('1.23e+30') +y.ln() + +x = new Decimal(1.8) +x.negated() +y = new Decimal(-1.3) +y.neg() + +x = new Decimal(0.1) +y = x.plus(0.2) +new Decimal(0.7).plus(x).plus(y) +x.plus('0.1', 8) + +x = new Decimal(1.234) +x.precision() +y = new Decimal(987000) +y.sd() +y.sd(true) + +Decimal.config({ rounding: 4 }) +x.round() + +Decimal.rounding = Decimal.ROUND_DOWN +x.round() +x + +x = new Decimal(16) +x.squareRoot() +y = new Decimal(3) +y.sqrt() +y.sqrt().eq(y.pow(0.5)) + +x = new Decimal(0.6) +y = x.times(3) +new Decimal('7e+500').times(y) +x.times('-a', 16) + +x = new Decimal(12.24567) +x.toDecimalPlaces(0) +x.toDecimalPlaces(1, 0) + +y = new Decimal(9876.54321) +y.toDP(3) +y.toDP(1, 0) +y.toDP(1, Decimal.ROUND_DOWN) + +y = new Decimal(x) +x.toExponential() +y.toExponential() +x.toExponential(0) +y.toExponential(0) +x.toExponential(1) +y.toExponential(1) +y.toExponential(1, 1) +x.toExponential(3) +y.toExponential(3) + +y = new Decimal(x) +x.toFixed() +y.toFixed() +y.toFixed(0) +x.toFixed(2) +y.toFixed(2) +y.toFixed(2, 1) +x.toFixed(5) +y.toFixed(5) + +Decimal.config({ + format: { + decimalSeparator: '.', + groupSeparator: ',', + groupSize: 3, + secondaryGroupSize: 0, + fractionGroupSeparator: ' ', + fractionGroupSize: 0 + } +}); + +x = new Decimal('123456789.123456789') +x.toFormat() +x.toFormat(1) + + +Decimal.format.groupSeparator = ' '; +Decimal.format.fractionGroupSize = 5; +x.toFormat() + + +Decimal.format = { + decimalSeparator: ',', + groupSeparator: '.', + groupSize: 3, + secondaryGroupSize: 2 +} + +x.toFormat() + +x.toFraction() + +var pi = new Decimal('3.14159265358') +pi.toFraction() +pi.toFraction(100000) +pi.toFraction(10000) +pi.toFraction(100) +pi.toFraction(10) +pi.toFraction(1) + + + +x = new Decimal('177.7e+457') +y = new Decimal(235.4325) +var z = new Decimal('0.0098074') + +// Serialize an array of three Decimals +var str = JSON.stringify([x, y, z]) +// "["1.777e+459","235.4325","0.0098074"]" + +// Return an array of three Decimals +JSON.parse(str, function(key, val) { + return key === '' ? val : new Decimal(val) +}) + +x = new Decimal(1.39) +x.toNearest(0.25) + +y = new Decimal(0.75) +y.toNearest(0.5, 0) +y.toNearest(0.5, 1) + +x = new Decimal(456.789) +x.toNumber() + +y = new Decimal('45987349857634085409857349856430985') +y.toNumber() + +z = new Decimal(-0) +1 / +z +1 / z.toNumber() + +Math.pow(0.7, 2) +x = new Decimal(0.7) +x.toPower(2) +new Decimal(3).pow(-2) + +new Decimal(1217652.23).pow('98765.489305603941') +y = new Decimal(x) +x.toPrecision() +y.toPrecision() +x.toPrecision(1) +y.toPrecision(1) +y.toPrecision(2, 0) +y.toPrecision(2, 1) +x.toPrecision(5) +y.toPrecision(5) + +Decimal.config({ precision: 5, rounding: 4 }) +x = new Decimal(9876.54321) + +x.toSignificantDigits() +x.toSignificantDigits(6) +x.toSignificantDigits(6, Decimal.ROUND_UP) +x.toSD(2) +x.toSD(2, 1) + +x = new Decimal(750000) +x.toString() +Decimal.config({ toExpPos: 5 }) +x.toString() + +y = new Decimal(362.875) +y.toString(2) +y.toString(9) +y.toString(32) + +Decimal.config({ precision: 4 }); +z = new Decimal('1.23456789') +z.toString() +z.toString(10) + +x = new Decimal(123.456) +x.truncated() +y = new Decimal(-12.3) +y.trunc() + +x = new Decimal('1.777e+457') +x.valueOf() + +x = Decimal.exp(3) +y = new Decimal(3).exp() +x.equals(y) + +x = Decimal.ln(4.321) +y = new Decimal(4.321).ln() +x.equals(y) + +x = Decimal.log(100, 2.5) +y = new Decimal(100).log(2.5) +x.equals(y) + +x = new Decimal('3257869345.0378653') +Decimal.max(4e9, x, '123456789.9') + +var arr = [12, '13', new Decimal(14)] +Decimal.max(arr) + +x = new Decimal('3257869345.0378653') +Decimal.min(4e9, x, '123456789.9') + +arr = [2, new Decimal(-14), '-15.9999', -12] +Decimal.min(arr) + +x = new Decimal(2) +var D = Decimal.noConflict() +Decimal +y = new D(3) + +x = Decimal.pow(3257.4, 17.01) +y = new Decimal(3257.4).pow(17.01) +x.equals(y) + +Decimal.config({ precision: 10 }) +Decimal.random() + +Decimal.random(20) + +x = Decimal.sqrt('987654321.123456789') +y = new Decimal('987654321.123456789').sqrt() +x.equals(y) diff --git a/decimal.js/decimal.js.d.ts b/decimal.js/decimal.js.d.ts new file mode 100644 index 0000000000..da2489a5f7 --- /dev/null +++ b/decimal.js/decimal.js.d.ts @@ -0,0 +1,765 @@ +// Type definitions for decimal.js +// Project: http://mikemcl.github.io/decimal.js +// Definitions by: Joseph Rossi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var Decimal: decimal.IDecimalStatic; + +// Support AMD require +declare module 'decimal' { + export = Decimal; +} + +declare module decimal { + + enum RoundingMode { + /** + * Rounds away from zero + */ + ROUND_UP = 0, + + /** + * Rounds towards zero + */ + ROUND_DOWN = 1, + + /** + * Rounds towards Infinity + */ + ROUND_CEIL = 2, + + /** + * Rounds towards -Infinity + */ + ROUND_FLOOR = 3, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds away from zero + */ + ROUND_HALF_UP = 4, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards zero + */ + ROUND_HALF_DOWN = 5, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards even neighbour + */ + ROUND_HALF_EVEN = 6, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards Infinity + */ + ROUND_HALF_CEIL = 7, + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards -Infinity + */ + ROUND_HALF_FLOOR = 8, + + /** + * Not a rounding mode, see modulo + */ + EUCLID = 9, + } + + interface IFormatConfig { + decimalSeparator?: string; + groupSeparator?: string; + groupSize?: number; + secondaryGroupSize?: number; + fractionGroupSeparator?: string; + fractionGroupSize?: number; + } + + interface IDecimalConfig { + /** + * number: integer, 1 to 1e+9 inclusive + * Default value: 20 + * + * The maximum number of significant digits of the result of a calculation or base conversion. + * + * All methods which return a Decimal will round the return value to precision significant digits except absoluteValue, ceil, floor, negated, round, toDecimalPlaces, toNearest and truncated. + * + * A Decimal constructor will also not round to precision unless a base is specified. + */ + precision?: number; + + /** + * number: integer, 0 to 8 inclusive + * Default value: 4 (ROUND_HALF_UP) + * + * The default rounding mode used when rounding the result of a calculation or base conversion to precision significant digits, and when rounding the return value of the round, toDecimalPlaces, toExponential, toFixed, toFormat, toNearest, toPrecision and toSignificantDigits methods. + * + * The rounding modes are available as enumerated properties of the constructor. + */ + rounding?: RoundingMode; + + /** + * number: integer, -9e15 to 0 inclusive + * Default value: -7 + * + * The negative exponent value at and below which toString returns exponential notation. + * @type {[type]} + */ + toExpNeg?: number; + + /** + * number: integer, 0 to 9e15 inclusive + * Default value: 20 + * + * The positive exponent value at and above which toString returns exponential notation. + */ + toExpPos?: number; + + /** + * number: integer, -9e15 to 0 inclusive + * Default value: -9e15 + * + * The negative exponent limit, i.e. the exponent value below which underflow to zero occurs. + * + * If the Decimal to be returned by a calculation would have an exponent lower than minE then its value becomes zero. + * + * JavaScript numbers underflow to zero for exponents below -324. + */ + minE?: number; + + /** + * number: integer, 0 to 9e15 inclusive + * Default value: 9e15 + * + * The positive exponent limit, i.e. the exponent value above which overflow to Infinity occurs. + * + * If the Decimal to be returned by a calculation would have an exponent higher than maxE then its value becomes Infinity. + * + * JavaScript numbers overflow to Infinity for exponents above 308. + */ + maxE?: number; + + /** + * boolean/number: true, false, 1 or 0 + * Default value: true + * + * The value that determines whether Decimal Errors are thrown. If errors is false, this library will not throw errors. + */ + errors?: boolean | number; + + /** + * boolean/number: true, false, 1 or 0 + * Default value: false + * + * The value that determines whether cryptographically-secure pseudo-random number generation is used. + * + * If crypto is truthy then the random method will generate random digits using crypto.getRandomValues in browsers that support it, or crypto.randomBytes if using a version of Node.js that supports it. + * + * If neither function is supported by the host environment or if crypto is falsey then the source of randomness will be Math.random. If the crypto property is set directly (i.e. without using config) to true, then at the time the random method is called, if errors is true, an error will be thrown if the crypto methods are unavailable. + */ + crypto?: boolean | number; + + /** + * number: integer, 0 to 9 inclusive + * Default value: 1 (ROUND_DOWN) + * + * The modulo mode used when calculating the modulus: a mod n. + * + * The quotient, q = a / n, is calculated according to the rounding mode that corresponds to the chosen modulo mode. + * + * The remainder, r, is calculated as: r = a - n * q. + * + * The modes that are most commonly used for the modulus/remainder operation are ROUND_UP, ROUND_DOWN, ROUND_FLOOR, ROUND_HALF_EVEN, and EUCLID. Although the other rounding modes can be used, they may not give useful results. + */ + modulo?: RoundingMode; + + /** + * The format object configures the format of the string returned by the toFormat method. + * + * The example below shows the properties of the format object that are recognised, and their default values. + * + * Unlike setting other properties using config, the values of the properties of the format object will not be checked for validity. The existing format object will simply be replaced by the object that is passed in. Only the toFormat method ever references a Decimal constructor's format object property. + * + * See toFormat for examples of usage, and of setting format properties individually and directly without using config. + */ + format?: IFormatConfig; + } + + interface IDecimalStatic extends IDecimalConfig { + (value: number | string | Decimal, base?: number): Decimal; + + new(value: number | string | Decimal, base?: number): Decimal; + + /** + * Configures the 'global' settings for this particular Decimal constructor. + * + * Returns this Decimal constructor. + */ + config(object: IDecimalConfig): IDecimalStatic; + + /** + * Returns a new independent Decimal constructor with configuration settings as described by object + */ + constructor(object: IDecimalConfig): IDecimalStatic; + + /** + * Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + */ + exp(n: number | string | Decimal): Decimal; + + /** + * Returns a new Decimal whose value is the natural logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * The natual logarithm is the inverse of the exponential function. + */ + ln(n: number | string | Decimal): Decimal; + + /** + * Returns a new Decimal whose value is the base n logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * If n is null or undefined, then the base 10 logarithm of the value of this Decimal will be returned. + */ + log(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the maximum of arg1, arg2,... . + */ + max(...args: any[]): Decimal; + + /** + * Returns a new Decimal whose value is the minimum of arg1, arg2,... . + */ + min(...args: any[]): Decimal; + + /** + * Reverts the Decimal variable to the value it had before this library was loaded and returns a reference to the original Decimal constructor so it can be assigned to a variable with a different name. + */ + noConflict(): IDecimalStatic; + + /** + * Returns a new Decimal whose value is the value of this Decimal raised to the power n, rounded to precision significant digits using rounding mode rounding. + * + * The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate. + */ + pow(base: number | string | Decimal, exponent: number | string | Decimal): Decimal; + + /** + * Returns a new Decimal with a pseudo-random value equal to or greater than 0 and less than 1. The return value will have dp decimal places (or less if trailing zeros are produced). If dp is omitted then the number of decimal places will default to the current precision setting. + * + * Depending on the value of a Decimal constructor's crypto property and the support for the crypto object in the host environment, the random digits of the return value are generated by either Math.random (fastest), crypto.getRandomValues (Web Cryptography API in recent browsers) or crypto.randomBytes (Node.js). + * + * If crypto is true, i.e. one of the crypto methods is to be used, the value of a returned Decimal should be cryptographically-secure and statistically indistinguishable from a random value. + */ + random(dp?: number): Decimal; + + /** + * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. + * + * This method is much faster than using the toPower method with an exponent of 0.5. + */ + sqrt(arg: number | string | Decimal): Decimal; + + /** + * A Decimal instance with value one. + */ + ONE: number; + + /** + * Rounds away from zero + */ + ROUND_UP: number; + + /** + * Rounds towards zero + */ + ROUND_DOWN: number; + + /** + * Rounds towards Infinity + */ + ROUND_CEIL: number; + + /** + * Rounds towards -Infinity + */ + ROUND_FLOOR: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds away from zero + */ + ROUND_HALF_UP: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards zero + */ + ROUND_HALF_DOWN: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards even neighbour + */ + ROUND_HALF_EVEN: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards Infinity + */ + ROUND_HALF_CEIL: number; + + /** + * Rounds towards nearest neighbour. + * If equidistant, rounds towards -Infinity + */ + ROUND_HALF_FLOOR: number; + + /** + * Not a rounding mode, see modulo + */ + EUCLID: number; + } + + interface Decimal { + + /** + * Returns a new Decimal whose value is the absolute value, i.e. the magnitude, of the value of this Decimal. + * + * The return value is not rounded. + */ + absoluteValue(): Decimal; + + /** + * Returns a new Decimal whose value is the absolute value, i.e. the magnitude, of the value of this Decimal. + * + * The return value is not rounded. + */ + abs(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to a whole number in the direction of positive Infinity. + * + * The return value is not rounded to precision. + */ + ceil(): Decimal; + + /** + * @return 1, -1, 0, or null + * 1 If the value of this Decimal is greater than the + * value of n + * -1 If the value of this Decimal is less than the value + * of n + * 0 If this Decimal and n have the same value + * null If the value of either this Decimal or n is NaN + */ + comparedTo(n: number | string | Decimal, base?: number): number; + + /** + * Returns 1, -1, 0, or null + * 1 If the value of this Decimal is greater than the value + * of n + * -1 If the value of this Decimal is less than the value + * of n + * 0 If this Decimal and n have the same value + * null If the value of either this Decimal or n is NaN + */ + cmp(n: number | string | Decimal, base?: number): number; + + /** + * Returns the number of decimal places, i.e. the number of digits after the decimal point, of the value of this Decimal. + */ + decimalPlaces(): number; + + /** + * Returns the number of decimal places, i.e. the number of digits after the decimal point, of the value of this Decimal. + */ + dp(): number; + + /** + * Returns a new Decimal whose value is the value of this Decimal divided by n, rounded to precision significant digits using rounding mode rounding. + */ + dividedBy(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal divided by n, rounded to precision significant digits using rounding mode rounding. + */ + div(n: number | string | Decimal, base?: number): Decimal; + + /** + * Return a new Decimal whose value is the integer part of dividing this Decimal by n, rounded to precision significant digits using rounding mode rounding. + */ + dividedToIntegerBy(n: number | string| Decimal, base?: number): Decimal; + + /** + * Return a new Decimal whose value is the integer part of dividing this Decimal by n, rounded to precision significant digits using rounding mode rounding. + */ + divToInt(n: number | string| Decimal, base?: number): Decimal; + + /** + * Returns true if the value of this Decimal equals the value of n, otherwise returns false. + * + * As with JavaScript, NaN does not equal NaN. + * + * Note: This method uses the cmp method internally. + */ + equals(n: number | string | Decimal, base?: number): boolean; + + /** + * Returns true if the value of this Decimal equals the value of n, otherwise returns false. + * + * As with JavaScript, NaN does not equal NaN. + * + * Note: This method uses the cmp method internally. + */ + eq(n: number | string | Decimal, base?: number): boolean; + + /** + * Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + */ + exponential(): Decimal; + + /** + * Returns a new Decimal whose value is the base e (Euler's number, the base of the natural logarithm) exponential of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + */ + exp(): Decimal; + + /** + * The return value is not rounded to precision. + */ + floor(): Decimal; + + + /** + * Note: This method uses cmp method internally. + */ + greaterThan(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + gt(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + greaterThanOrEqualTo(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + gte(n: number | string | Decimal, base?: number): boolean; + + /** + * The only possible non-finite values of a Decimal are NaN, Infinity and -Infinity. + */ + isFinite(): boolean; + + isInteger(): boolean; + + isInt(): boolean; + + isNaN(): boolean; + + isNegative(): boolean; + + isNeg(): boolean; + + isZero(): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lessThan(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lt(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lessThanOrEqualTo(n: number | string | Decimal, base?: number): boolean; + + /** + * Note: This method uses cmp method internally. + */ + lte(n: number | string | Decimal, base?: number): boolean; + + /** + * Returns a new Decimal whose value is the base n logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * If n is null or undefined, then the base 10 logarithm of the value of this Decimal will be returned. + */ + logarithm(n?: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the base n logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * If n is null or undefined, then the base 10 logarithm of the value of this Decimal will be returned. + */ + log(n?: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal minus n, rounded to precision significant digits using rounding mode rounding. + */ + minus(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal modulo n, rounded to precision significant digits using rounding mode rounding. + * + * The value returned, and in particular its sign, is dependent on the value of the modulo property of this Decimal's constructor. If it is 1 (default value), the result will have the same sign as this Decimal, and it will match that of Javascript's % operator (within the limits of double precision) and BigDecimal's remainder method. + */ + modulo(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal modulo n, rounded to precision significant digits using rounding mode rounding. + * + * The value returned, and in particular its sign, is dependent on the value of the modulo property of this Decimal's constructor. If it is 1 (default value), the result will have the same sign as this Decimal, and it will match that of Javascript's % operator (within the limits of double precision) and BigDecimal's remainder method. + */ + mod(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the natural logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * The natual logarithm is the inverse of the exponential function. + */ + naturalLogarithm(): Decimal; + + /** + * Returns a new Decimal whose value is the natural logarithm of the value of this Decimal, rounded to precision significant digits using rounding mode rounding. + * + * The natual logarithm is the inverse of the exponential function. + */ + ln(): Decimal; + + /** + * The return value is not rounded. + */ + negated(): Decimal; + + /** + * The return value is not rounded. + */ + neg(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal plus n, rounded to precision significant digits using rounding mode rounding. + */ + plus(n: number | string | Decimal, base?: number): Decimal; + + /** + * If include_zeros is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not. + */ + precision(include_leading_zeros?: boolean | number): number; + + /** + * If include_zeros is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not. + */ + sd(include_leading_zeros?: boolean | number): number; + + round(): Decimal; + + /** + * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. + * + * This method is much faster than using the toPower method with an exponent of 0.5. + */ + squareRoot(): Decimal; + + /** + * The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding. + * + * This method is much faster than using the toPower method with an exponent of 0.5. + */ + sqrt(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal times n, rounded to precision significant digits using rounding mode rounding. + */ + times(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to dp decimal places using rounding mode rm. + * + * If dp is omitted or is null or undefined, the return value will have the same value as this Decimal. + * + * If rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toDecimalPlaces(dp?: number, rm?: RoundingMode): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to dp decimal places using rounding mode rm. + * + * If dp is omitted or is null or undefined, the return value will have the same value as this Decimal. + * + * If rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toDP(dp?: number, rm?: RoundingMode): Decimal; + + /** + * Returns a string representing the value of this Decimal in exponential notation rounded using rounding mode rm to dp decimal places, i.e with one digit before the decimal point and dp digits after it. + * + * If the value of this Decimal in exponential notation has fewer than dp fraction digits, the return value will be appended with zeros accordingly. + * + * If dp is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly. + * + * If rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toExponential(dp?: number, rm?: RoundingMode): string; + + /** + * Returns a string representing the value of this Decimal in normal (fixed-point) notation rounded to dp decimal places using rounding mode rm. + * + * If the value of this Decimal in normal notation has fewer than dp fraction digits , the return value will be appended with zeros accordingly. + * + * Unlike Number.prototype.toFixed, which returns exponential notation if a number is greater or equal to 1021, this method will always return normal notation. + * + * If dp is omitted or is null or undefined, then the return value will be unrounded and in normal notation. This is unlike Number.prototype.toFixed, which returns the value to zero decimal places, but is useful when because of the current toExpNeg or toExpNeg values, toString returns exponential notation + * + * if rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toFixed(dp?: number, rm?: RoundingMode): string; + + /** + * Returns a string representing the value of this Decimal in fixed-point notation rounded to dp decimal places using rounding mode rm (as toFixed), and formatted according to the properties of this Decimal's constructor's format object property. + * + * See the examples below for the properties of the format object, their types and their usage. + * + * If dp is omitted or is null or undefined, then the return value is not rounded to a fixed number of decimal places. + * + * if rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toFormat(dp?: number, rm?: RoundingMode): string; + + /** + * Returns a string array representing the value of this Decimal as a simple fraction with an integer numerator and an integer denominator. The denominator will be a positive non-zero value less than or equal to max_denominator. + * + * If a maximum denominator is not specified, or is null or undefined, the denominator will be the lowest value necessary to represent the number exactly. + */ + toFraction(max_denominator?: number | string | Decimal): string[]; + + toJSON(): string; + + /** + * Returns a new Decimal whose value is the nearest multiple of n to the value of this Decimal. + * + * If the value of this Decimal is equidistant from two multiples of n, the rounding mode rm, or rounding if rm is omitted or is null or undefined, determines the direction of the nearest. + * + * In this context, rounding mode ROUND_HALF_UP is interpreted the same as rounding mode ROUND_UP, and so on. I.e. the rounding is either up, own, to ceil, to floor or to even. + * + * The return value will always have the same sign as this Decimal, unless either this Decimal or n is NaN, in which case the return value will be also be NaN. + * + * The return value is not rounded to precision. + */ + toNearest(n: number | string | Decimal, rm?: RoundingMode): Decimal; + + /** + * Returns the value of this Decimal converted to a number primitive. + * + * Type coercion with, for example, JavaScript's unary plus operator will also work, except that a Decimal with the value minus zero will convert to positive zero. + */ + toNumber(): number; + + /** + * Returns a new Decimal whose value is the value of this Decimal raised to the power n, rounded to precision significant digits using rounding mode rounding. + * + * The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate. + */ + toPower(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal raised to the power n, rounded to precision significant digits using rounding mode rounding. + * + * The performance of this method degrades exponentially with increasing digits. For non-integer exponents in particular, the performance of this method may not be adequate. + */ + pow(n: number | string | Decimal, base?: number): Decimal; + + /** + * Returns a string representing the value of this Decimal rounded to sd significant digits using rounding mode rm. + * + * If sd is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used. + * + * If sd is omitted or is null or undefined, then the return value is the same as toString. + * + * if rm is omitted or is null or undefined, rounding mode rounding is used. + */ + toPrecision(sd?: number, rm?: RoundingMode): string; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to sd significant digits using rounding mode rm. + * + * If sd is omitted or is null or undefined, the return value will be rounded to precision significant digits. + * + * if rm is omitted or is null or undefined, rounding mode rounding will be used. + */ + toSignificantDigits(sd?: number, rm?: RoundingMode): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal rounded to sd significant digits using rounding mode rm. + * + * If sd is omitted or is null or undefined, the return value will be rounded to precision significant digits. + * + * if rm is omitted or is null or undefined, rounding mode rounding will be used. + */ + toSD(sd?: number, rm?: RoundingMode): Decimal; + + /** + * base: number: integer, 2 to 64 inclusive + * + * Returns a string representing the value of this Decimal in the specified base, or base 10 if base is omitted or is null or undefined. + * + * For bases above 10, values from 10 to 35 are represented by a-z (as with Number.prototype.toString), 36 to 61 by A-Z, and 62 and 63 by $ and _ respectively. + * + * If a base is specified the value is rounded to precision significant digits using rounding mode rounding. + * + * If a base is not specified and this Decimal has a positive exponent that is equal to or greater than toExpPos, or a negative exponent equal to or less than toExpNeg, then exponential notation is returned. + * + * If base is null or undefined it is ignored. + */ + toString(base?: number): string; + + /** + * Returns a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + * The return value is not rounded to precision. + */ + truncated(): Decimal; + + /** + * Returns a new Decimal whose value is the value of this Decimal truncated to a whole number. + * + * The return value is not rounded to precision. + */ + trunc(): Decimal; + + /** + * As toString, but does not accept a base argument. + */ + valueOf(): string; + + /** + * coefficient + * + * Array of integers, each 0 - 1e7 + */ + c: number[]; + + /** + * exponent + * + * Integer, -9e15 to 9e15 inclusive + */ + e: number; + + /** + * sign + * + * -1 or 1 + */ + s: number; + } +} diff --git a/dexie/dexie-tests.ts b/dexie/dexie-tests.ts new file mode 100644 index 0000000000..25deb115d4 --- /dev/null +++ b/dexie/dexie-tests.ts @@ -0,0 +1,256 @@ +/// + +import Dexie = require("Dexie"); + +module Utils { + + export class Console { + textarea: HTMLTextAreaElement; + + constructor() { + this.textarea = document.createElement('textarea'); + } + + log(txt: string, type?: string) { + if (type) this.textarea.value += type + " "; + this.textarea.value += txt + "\n"; + } + error = function (txt: string) { + this.log(txt, "ERROR!"); + } + } + +} + +module AppDb { + + export class AppDatabase extends Dexie { + + contacts: Dexie.Table; + emails: Dexie.Table; + phones: Dexie.Table; + + constructor() { + + super("MyTypeScriptAppDb"); + + var db = this; + + // + // Define tables and indexes + // + db.version(1).stores({ + contacts: '++id, first, last', + emails: '++id, contactId, type, email', + phones: '++id, contactId, type, phone', + }); + + // Let's physically map Contact class to contacts table. + // This will make it possible to call loadEmailsAndPhones() + // directly on retrieved database objects. + db.contacts.mapToClass(Contact); + } + } + + /* Just for code completion and compilation - defines + * the interface of objects stored in the emails table. + */ + export interface IEmailAddress { + id?: number; + contactId: number; + type: string; + email: string; + } + + /* Just for code completion and compilation - defines + * the interface of objects stored in the phones table. + */ + export interface IPhoneNumber { + id?: number; + contactId: number; + type: string; + phone: string; + } + + /* This is a 'physical' class that is mapped to + * the contacts table. We can have methods on it that + * we could call on retrieved database objects. + */ + export class Contact { + id: number; + first: string; + last: string; + emails: IEmailAddress[]; + phones: IPhoneNumber[]; + + constructor(first: string, last: string, id?: number) { + this.first = first; + this.last = last; + if (id) this.id = id; + } + + loadEmailsAndPhones() : Dexie.Promise { + return Dexie.Promise.all( + db.emails + .where('contactId').equals(this.id) + .toArray(emails => this.emails = emails) + , + db.phones + .where('contactId').equals(this.id) + .toArray(phones => this.phones = phones) + + ).then(() => this); + } + + save() { + return db.transaction('rw', db.contacts, db.emails, db.phones, () => { + Dexie.Promise.all( + // Save existing arrays + Dexie.Promise.all(this.emails.map(email => db.emails.put(email))), + Dexie.Promise.all(this.phones.map(phone => db.phones.put(phone)))) + .then(results => { + // Remove items from DB that is was not saved here: + var emailIds = results[0], // array of resulting primary keys + phoneIds = results[1]; // array of resulting primary keys + + db.emails.where('contactId').equals(this.id) + .and(email => emailIds.indexOf(email.id) === -1) + .delete(); + + db.phones.where('contactId').equals(this.id) + .and(phone => phoneIds.indexOf(phone.id) === -1) + .delete(); + + // At last, save our own properties. + // (Must not do put(this) because we would get + // reduntant emails/phones arrays saved into db) + db.contacts.put( + new Contact(this.first, this.last, this.id)) + .then(id => this.id = id); + }); + }); + } + } + + export var db = new AppDatabase(); + db.open(); +} + + +import Console = Utils.Console; +import db = AppDb.db; + +document.addEventListener('DOMContentLoaded', () => { + + // Initialize our Console widget - it will log browser window. + var console = new Console(); + document.getElementById('consoleArea').appendChild(console.textarea); + + // Test it: + console.log("Hello world!"); + + // Make sure to never miss any unexpected error: + Dexie.Promise.on.error.subscribe(e => { + // Log any uncatched error: + console.error(e); + }); + + // + // Let's clear and re-seed the database: + // + clearDatabase() + .then(seedDatabase) + .then(playALittle_add_phone_to_adam) + .then(printContacts); + + function clearDatabase() { + console.log("Clearing database..."); + return Dexie.Promise.all( + db.contacts.clear(), + db.emails.clear(), + db.phones.clear()); + } + + function seedDatabase() { + console.log("Seeding database with some contacts..."); + return db.transaction('rw', db.contacts, db.emails, db.phones, () => { + // Populate a contact + db.contacts.add(new AppDb.Contact('Arnold', 'Fitzgerald')).then(id => { + // Populate some emails and phone numbers for the contact + db.emails.add({ contactId: id, type: 'home', email: 'arnold@email.com' }); + db.emails.add({ contactId: id, type: 'work', email: 'arnold@abc.com' }); + db.phones.add({ contactId: id, type: 'home', phone: '12345678' }); + db.phones.add({ contactId: id, type: 'work', phone: '987654321' }); + }); + + // ... and another one... + db.contacts.add(new AppDb.Contact('Adam', 'Tensta')).then(id => { + // Populate some emails and phone numbers for the contact + db.emails.add({ contactId: id, type: 'home', email: 'adam@tensta.se' }); + db.phones.add({ contactId: id, type: 'work', phone: '88888888' }); + }); + }); + } + + function playALittle_add_phone_to_adam() { + // Now, just to examplify how to use the save() method as an alternative + // to db.phones.add(), we will add yet another phone number + // to an existing contact and then re-save it: + console.log("Playing a little: adding another phone entry for Adam Tensta..."); + return db.contacts + .where('last').equals('Tensta').first(c => c.loadEmailsAndPhones()) + .then(contact => { + // Also add another phone number to Adam Tensta: + contact.phones.push({ + contactId: contact.id, + type: 'custom', + phone: '112' + }); + contact.save(); + }); + } + + function printContacts() { + + // Now we're gonna list all contacts starting with letter 'A' + // and print them out. + // For each contact, also resolve its collection of + // phone number entries and email addresses by reverse-quering + // the foreign tables. + + // For atomicity and speed, use a single transaction for the + // queries to make: + db.transaction('r', [db.contacts, db.phones, db.emails], () => { + + // Query some contacts + return db.contacts + .where('first').startsWithIgnoreCase('a') + .sortBy('id') + .then(contacts => + + // Resolve array properties 'emails' and 'phones' + // on each and every contact: + Dexie.Promise.all( + contacts.map(contact => + contact.loadEmailsAndPhones())) + ); + + }).then(contacts => { + + // Print result + console.log("Database contains the following contacts:"); + contacts.forEach(contact => { + console.log(contact.id + ". " + contact.first + " " + contact.last); + console.log(" Phone numbers: "); + contact.phones.forEach(phone => { + console.log(" " + phone.phone + "(" + phone.type + ")"); + }); + console.log(" Emails: "); + contact.emails.forEach(email => { + console.log(" " + email.email + "(" + email.type + ")"); + }); + }); + }); + } +}); + diff --git a/dexie/dexie.d.ts b/dexie/dexie.d.ts new file mode 100644 index 0000000000..eb6854ce2e --- /dev/null +++ b/dexie/dexie.d.ts @@ -0,0 +1,320 @@ +// Type definitions for Dexie v1.1 +// Project: https://github.com/dfahlander/Dexie.js +// Definitions by: David Fahlander +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Thenable { + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Thenable; + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Thenable; + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable; +} + +declare class Dexie { + constructor(databaseName: string); + + constructor(databaseName: string, options: { addons: Array<(db: Dexie) => void> }); + + name: string; + tables: Dexie.Table[]; + verno: number; + + static addons: Array<(db: Dexie) => void>; + static version: number; + + static getDatabaseNames(): Dexie.Promise>; + + static getDatabaseNames(onFulfilled: (value: Array) => Thenable): Dexie.Promise; + + static getDatabaseNames(onFulfilled: (value: Array) => U): Dexie.Promise; + + static getByKeyPath(obj: Object, keyPath: string): any; + + static setByKeyPath(obj: Object, keyPath: string, value: any): void; + + static delByKeyPath(obj: Object, keyPath: string): void; + + static shallowClone(obj: Object): Object; + + static deepClone(obj: Object): Object; + + version(versionNumber: Number): Dexie.Version + + on: { + (eventName: string, subscriber: () => any): void; + (eventName: string, subscriber: () => any, bSticky: boolean): void; + ready: Dexie.DexieOnReadyEvent; + error: Dexie.DexieErrorEvent; + populate: Dexie.DexieEvent; + blocked: Dexie.DexieEvent; + versionchange: Dexie.DexieVersionChangeEvent; + } + + open(): Dexie.Promise; + + table(tableName: string): Dexie.Table; + + table(tableName: string): Dexie.Table; + + table(tableName: string): Dexie.Table; + + transaction(mode: string, table: Dexie.Table, scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, table3: Dexie.Table, scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, tables: Dexie.Table[], scope: () => Thenable): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, scope: () => U): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, scope: () => U): Dexie.Promise; + + transaction(mode: string, table: Dexie.Table, table2: Dexie.Table, table3: Dexie.Table, scope: () => U): Dexie.Promise; + + transaction(mode: string, tables: Dexie.Table[], scope: () => U): Dexie.Promise; + + close(): void; + + delete(): Dexie.Promise; + + isOpen(): boolean; + + hasFailed(): boolean; + + backendDB(): IDBDatabase; + + vip(scopeFunction: () => U): U; +} + +declare module Dexie { + + class Promise implements Thenable { + constructor(callback: (resolve: (value?: Thenable) => void, reject: (error?: any) => void) => void); + + constructor(callback: (resolve: (value?: R) => void, reject: (error?: any) => void) => void); + + then(onFulfilled: (value: R) => Thenable, onRejected: (error: any) => Thenable): Promise; + + then(onFulfilled: (value: R) => Thenable, onRejected?: (error: any) => U): Promise; + + then(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable): Promise; + + then(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Promise; + + catch(onRejected: (error: any) => Promise): Promise; + + catch(ExceptionType: Function, onRejected: (error : any) => Promise): Promise; + + catch(errorName: string, onRejected: (error : any) => Promise): Promise; + + finally(onFinally: () => any): Promise; + + onuncatched: () => any; + } + + module Promise { + function resolve(value?: Thenable): Promise; + + function resolve(value?: R): Promise; + + function reject(error: any): Promise; + + function all(promises: Thenable[]): Promise; + + function all(...promises: Thenable[]): Promise; + + function race(promises: Thenable[]): Promise; + + function newPSD(scope: () => R): R; + + var PSD: any; + + var on: { + (eventName: string, subscriber: (...args : any[]) => any): void; + error: DexieErrorEvent; + } + } + + + interface Version { + stores(schema: { [key: string]: string }): Version; + upgrade(fn: (trans: Transaction) => void): Version; + } + + interface Transaction { + active: boolean; + db: Dexie; + mode: string; + idbtrans: IDBTransaction; + tables: { [type: string]: Table }; + storeNames: Array; + on: { + (eventName: string, subscriber: () => any): void; + complete: DexieEvent; + abort: DexieEvent; + error: DexieEvent; + } + abort(): void; + table(tableName: string): Table; + table(tableName: string): Table; + table(tableName: string): Table; + } + + interface DexieEvent { + subscribe(fn: () => any) : void; + unsubscribe(fn: () => any) : void; + fire() : any; + } + + interface DexieErrorEvent { + subscribe(fn: (error: any) => any) : void; + unsubscribe(fn: (error: any) => any) : void; + fire(error: any) : any; + } + + interface DexieVersionChangeEvent { + subscribe(fn: (event: IDBVersionChangeEvent) => any) : void; + unsubscribe(fn: (event: IDBVersionChangeEvent) => any) : void; + fire(event: IDBVersionChangeEvent) : any; + } + + interface DexieOnReadyEvent + { + subscribe(fn: () => any, bSticky: boolean) : void; + unsubscribe(fn: () => any) : void; + fire() : any; + } + + interface Table { + name: string; + schema: TableSchema; + hook: { + (eventName: string, subscriber: () => any): void; + creating: DexieEvent; + reading: DexieEvent; + updating: DexieEvent; + deleting: DexieEvent; + } + + get(key: Key): Promise; + where(index: string): WhereClause; + + filter(fn: (obj: T) => boolean): Collection; + + count(): Promise; + count(onFulfilled: (value: number) => Thenable): Promise; + count(onFulfilled: (value: number) => U): Promise; + + offset(n: number): Collection; + + limit(n: number): Collection; + + each(callback: (obj: T, cursor: IDBCursor) => any): Promise; + + toArray(): Promise>; + toArray(onFulfilled: (value: Array) => Thenable): Promise; + toArray(onFulfilled: (value: Array) => U): Promise; + + toCollection(): Collection; + orderBy(index: string): Collection; + reverse(): Collection; + mapToClass(constructor: Function): Function; + add(item: T, key?: Key): Promise; + update(key: Key, changes: { [keyPath: string]: any }) : Promise; + put(item: T, key?: Key): Promise; + delete(key: Key): Promise; + clear(): Promise; + } + + interface WhereClause { + above(key: number): Collection; + above(key: string): Collection; + above(key: Date): Collection; + above(key: Array): Collection; + aboveOrEqual(key: number): Collection; + aboveOrEqual(key: string): Collection; + aboveOrEqual(key: Date): Collection; + aboveOrEqual(key: Array): Collection; + anyOf(keys: Array): Collection; + anyOf(...keys: any[]): Collection; + below(key: number): Collection; + below(key: string): Collection; + below(key: Date): Collection; + below(key: Array): Collection; + belowOrEqual(key: number): Collection; + belowOrEqual(key: string): Collection; + belowOrEqual(key: Date): Collection; + belowOrEqual(key: Array): Collection; + between(lower: number, upper: number, includeLower?: boolean, includeUpper?: boolean): Collection; + between(lower: string, upper: string, includeLower?: boolean, includeUpper?: boolean): Collection; + between(lower: Date, upper: Date, includeLower?: boolean, includeUpper?: boolean): Collection; + between(lower: Array, upper: Array, includeLower?: boolean, includeUpper?: boolean): Collection; + equals(key: number): Collection; + equals(key: string): Collection; + equals(key: Date): Collection; + equals(key: Array): Collection; + equalsIgnoreCase(key: string): Collection; + startsWith(key: string): Collection; + startsWithIgnoreCase(key: string): Collection; + } + + interface Collection { + and(filter: (x: T) => boolean): Collection; + count(): Promise; + count(onFulfilled: (value: number) => Thenable): Promise; + count(onFulfilled: (value: number) => U): Promise; + distinct(): Collection; + each(callback: (obj: T, cursor: IDBCursor) => any): Promise; + eachKey(callback: (key: Key, cursor: IDBCursor) => any): Promise; + eachUniqueKey(callback: (key: Key, cursor: IDBCursor) => any): Promise; + first(): Promise; + first(onFulfilled: (value: T) => Thenable): Promise; + first(onFulfilled: (value: T) => U): Promise; + keys(): Promise; + keys(onFulfilled: (value: Key[]) => Thenable): Promise; + keys(onFulfilled: (value: Key[]) => U): Promise; + last(): Promise; + last(onFulfilled: (value: T) => Thenable): Promise; + last(onFulfilled: (value: T) => U): Promise; + limit(n: number): Collection; + offset(n: number): Collection; + or(indexOrPrimayKey: string): WhereClause; + reverse(): Collection; + sortBy(keyPath: string): Promise; + sortBy(keyPath: string, onFulfilled: (value: T[]) => Thenable): Promise; + sortBy(keyPath: string, onFulfilled: (value: T[]) => U): Promise; + toArray(): Promise>; + toArray(onFulfilled: (value: Array) => Thenable): Promise; + toArray(onFulfilled: (value: Array) => U): Promise; + uniqueKeys(): Promise; + uniqueKeys(onFulfilled: (value: Key[]) => Thenable): Promise; + uniqueKeys(onFulfilled: (value: Key[]) => U): Promise; + until(filter: (value: T) => boolean, includeStopEntry?: boolean): Collection; + // WriteableCollection: + delete(): Promise; + modify(changes: { [keyPath: string]: any }): Promise; + modify(changeCallback: (obj: T) => void): Promise; + } + + interface TableSchema { + name: string; + primKey: IndexSpec; + indexes: IndexSpec[]; + mappedClass: Function; + } + + interface IndexSpec { + name: string; + keyPath: any; + unique: boolean; + multi: boolean; + auto: boolean; + compound: boolean; + src: string; + } +} + +declare module 'Dexie' { + export = Dexie; +} diff --git a/drop/drop-tests.ts b/drop/drop-tests.ts index b5ae47456c..22f83dc2ef 100644 --- a/drop/drop-tests.ts +++ b/drop/drop-tests.ts @@ -10,7 +10,10 @@ var d = new Drop({ constrainToWindow: true, constrainToScrollParent: true, classes: "", - tetherOptions: {} + tetherOptions: {}, + remove: true, + target: yellowBox, + content: greenBox }); d.open(); @@ -19,6 +22,8 @@ d.remove(); d.toggle(); d.position(); d.destroy(); +d.element.appendChild(document.createElement("div")); +d.tether.position(); d.on("open", () => null); d.on("close", () => null); @@ -26,3 +31,8 @@ d.once("close", () => null); d.off("close", () => null); d.off("open"); +var e = new Drop({ + target: yellowBox, + content: () => greenBox +}); + diff --git a/drop/drop.d.ts b/drop/drop.d.ts index e3615d5105..85cfd0766f 100644 --- a/drop/drop.d.ts +++ b/drop/drop.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Drop v0.5 +// Type definitions for Drop v0.5.7 // Project: http://github.hubspot.com/drop/ // Definitions by: Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -19,7 +19,7 @@ declare module drop { interface IDropOptions { target?: Element; - content?: Element | string | (() => string); + content?: Element | string | ((drop?: Drop) => string) | ((drop?: Drop) => Element); position?: string; openOn?: string; constrainToWindow?: boolean; @@ -30,6 +30,8 @@ declare module drop { interface Drop { content: HTMLElement; + element: HTMLElement; + tether: tether.Tether; open(): void; close(): void; remove(): void; diff --git a/dsv/dsv-tests.ts b/dsv/dsv-tests.ts new file mode 100644 index 0000000000..93ff59f04c --- /dev/null +++ b/dsv/dsv-tests.ts @@ -0,0 +1,8 @@ +/// + +import dsv = require("dsv"); + +var csv = dsv(","); + +var rows = csv.parse("a,b,c\n1,2,3\n4,5,6"); + diff --git a/dsv/dsv.d.ts b/dsv/dsv.d.ts new file mode 100644 index 0000000000..797befb370 --- /dev/null +++ b/dsv/dsv.d.ts @@ -0,0 +1,68 @@ +// Type definitions for dsv +// Project: https://www.npmjs.com/package/dsv +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +//commonjs loader +declare module "dsv" { + + /** A parser and formatter for DSV (CSV and TSV) files. +Extracted from D3. */ + var loader: ( + /** the symbol used to seperate cells in the row.*/ + delimiter: string, + /** example: "text/plain" */ + encoding?: string) => _dsv.Dsv; + export = loader; +} + +declare module _dsv { + /** A parser and formatter for DSV (CSV and TSV) files. +Extracted from D3. */ + export class Dsv { + /** Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows. + The string is assumed to be RFC4180-compliant. + Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names; + these column names become the attributes on the returned objects. + For example, consider the following CSV file: + +Year,Make,Model,Length +1997,Ford,E350,2.34 +2000,Mercury,Cougar,2.38 + +The resulting JavaScript array is: + +[ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"}, + {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ] + */ + public parse( + table: string, + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */ + accessor?: (row: any) => TRow + ): TRow[]; + /** Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows. The string is assumed to be RFC4180-compliant. Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header. Each row is represented as an array rather than an object. Rows may have variable length. For example, consider the following CSV file: + +1997,Ford,E350,2.34 +2000,Mercury,Cougar,2.38 +The resulting JavaScript array is: + +[ ["1997", "Ford", "E350", "2.34"], + ["2000", "Mercury", "Cougar", "2.38"] ] +Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.*/ + public parseRows( + table: string, + /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/ + accessor?: (row: string[]) => TRow + ): TRow[]; + /** Converts the specified array of rows into comma-separated values format, returning a string. This operation is the reverse of parse. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. + +Each row should be an object, and all object properties will be converted into fields. For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows. */ + public format(rows: any[]): string; + /** Converts the specified array of rows into comma-separated values format, returning a string. This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,). Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes. */ + public formatRows(rows: any[]): string; + + + } + +} \ No newline at end of file diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 636a7af685..9fe420766c 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -48,11 +48,11 @@ declare module EmberStates { /** A standard promise hook that resolves if the transition succeeds and rejects if it fails/redirects/aborts. - + Forwards to the internal `promise` property which you can use in situations where you want to pass around a thennable, but not the Transition itself. - + @arg {Function} onFulfilled @arg {Function} onRejected @arg {String} label optional string for labeling the promise. Useful for tooling. @@ -64,7 +64,7 @@ declare module EmberStates { Forwards to the internal `promise` property which you can use in situations where you want to pass around a thennable, but not the Transition itself. - + @method catch @arg {Function} onRejection @arg {String} label optional string for labeling the promise. @@ -77,7 +77,7 @@ declare module EmberStates { Forwards to the internal `promise` property which you can use in situations where you want to pass around a thennable, but not the Transition itself. - + @method finally @arg {Function} callback @arg {String} label optional string for labeling the promise. @@ -85,7 +85,7 @@ declare module EmberStates { @return {Promise} */ finally(callback: Function, label?: string): Ember.RSVP.Promise; - + /** Aborts the Transition. Note you can also implicitly abort a transition by initiating another transition while a previous one is underway. @@ -123,9 +123,9 @@ declare module EmberStates { Fires an event on the current list of resolved/resolving handlers within this transition. Useful for firing events on route hierarchies that haven't fully been entered yet. - + Note: This method is also aliased as `send` - + @arg {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error @arg {String} name the name of the event to fire */ @@ -134,9 +134,9 @@ declare module EmberStates { Fires an event on the current list of resolved/resolving handlers within this transition. Useful for firing events on route hierarchies that haven't fully been entered yet. - + Note: This method is also aliased as `send` - + @arg {String} name the name of the event to fire */ trigger(eventName: string): void; @@ -147,7 +147,7 @@ declare module EmberStates { that will follow any redirects that occur and fulfill with the value fulfilled by any redirecting transitions that occur. - + @return {Promise} a promise that fulfills with the same value that the final redirecting transition fulfills with */ @@ -412,7 +412,7 @@ declare module Ember { **/ function A(arr?: any[]): NativeArray; /** - The Ember.ActionHandler mixin implements support for moving an actions property to an _actions + The Ember.ActionHandler mixin implements support for moving an actions property to an _actions property at extend time, and adding _actions to the object's mergedProperties list. **/ class ActionHandlerMixin { @@ -420,7 +420,7 @@ declare module Ember { Triggers a named action on the ActionHandler **/ send(name: string, ...args: any[]): void; - /** + /** The collection of functions, keyed by name, available on this ActionHandler as action targets. **/ actions: ActionsHash; @@ -931,49 +931,149 @@ declare module Ember { frozenCopy(): Copyable; } class CoreObject { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. + An overridable method called when objects are instantiated. By default, + does nothing unless it is overridden during class definition. + @method init **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - static isClass: boolean; - static isMethod: boolean; - /** - Destroys an object by setting the isDestroyed flag and removing its metadata, which effectively - destroys observers and bindings. If you try to set a property on a destroyed object, an exception - will be raised. Note that destruction is scheduled for the end of the run loop and does not - happen immediately. It will set an isDestroying flag immediately. - **/ - destroy(): CoreObject; init(): void; - /** - Returns a string representation which attempts to provide more information than Javascript's toString - typically does, in a generic way for all Ember objects (e.g., ""). - **/ - toString(): string; - willDestroy(): void; /** Defines the properties that will be concatenated from the superclass (instead of overridden). + @property concatenatedProperties + @type Array + @default null **/ concatenatedProperties: any[]; + /** Destroyed object property flag. If this property is true the observers and bindings were already removed by the effect of calling the destroy() method. + @property isDestroyed + @default false **/ isDestroyed: boolean; /** Destruction scheduled flag. The destroy() method has been called. The object stays intact until the end of the run loop at which point the isDestroyed flag is set. + @property isDestroying + @default false **/ isDestroying: boolean; + + /** + Destroys an object by setting the `isDestroyed` flag and removing its + metadata, which effectively destroys observers and bindings. + If you try to set a property on a destroyed object, an exception will be + raised. + Note that destruction is scheduled for the end of the run loop and does not + happen immediately. It will set an isDestroying flag immediately. + @method destroy + @return {Ember.Object} receiver + */ + destroy(): CoreObject; + + /** + Override to implement teardown. + @method willDestroy + */ + willDestroy(): void; + + /** + Returns a string representation which attempts to provide more information than Javascript's toString + typically does, in a generic way for all Ember objects (e.g., ""). + @method toString + @return {String} string representation + **/ + toString(): string; + + static isClass: boolean; + static isMethod: boolean; + + /** + Creates a new subclass. + @method extend + @static + @param {Object} [args] - Object containing values to use within the new class + **/ + static extend(args ?: CoreObjectArguments): T; + /** + Creates a new subclass. + @method extend + @static + @param {Mixin} [mixins] - One or more Mixin classes + @param {Object} [args] - Object containing values to use within the new class + **/ + static extend(mixins?: Mixin, args?: CoreObjectArguments): T; + + /** + Creates a new subclass. + @method extend + @param {Object} [args] - Object containing values to use within the new class + Non-static method because Ember classes aren't currently 'real' TypeScript classes. + **/ + extend(args ?: CoreObjectArguments): T; + /** + Creates a new subclass. + @method extend + @param {Mixin} [mixins] - One or more Mixin classes + @param {Object} [args] - Object containing values to use within the new class + Non-static method because Ember classes aren't currently 'real' TypeScript classes. + **/ + extend(mixins ? : Mixin, args ?: CoreObjectArguments): T; + + /** + Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. + @method createWithMixins + @static + @param [args] + **/ + static createWithMixins(args?: {}): T; + + /** + Creates an instance of the class. + @method create + @static + @param [args] - A hash containing values with which to initialize the newly instantiated object. + **/ + static create(args?: {}): T; + + /** + Augments a constructor's prototype with additional properties and functions. + To add functions and properties to the constructor itself, see reopenClass. + @method reopen + **/ + static reopen(args?: {}): T; + + /** + Augments a constructor's own properties and functions. + To add functions and properties to instances of a constructor by extending the + constructor's prototype see reopen. + @method reopenClass + **/ + static reopenClass(args?: {}): T; + + static detect(obj: any): boolean; + static detectInstance(obj: any): boolean; + + /** + Returns the original hash that was passed to meta(). + @method metaForProperty + @static + @param key {String} property name + **/ + static metaForProperty(key: string): {}; + + /** + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + + @method eachComputedProperty + @static + @param {Function} callback + @param {Object} binding + **/ + static eachComputedProperty(callback: Function, binding: {}): void; } /** An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View @@ -1578,45 +1678,6 @@ declare module Ember { } var ORDER_DEFINITION: string[]; class Object extends CoreObject implements Observable { - /** - Creates a subclass of the Object class. - **/ - static extend(args?: CoreObjectArguments): T; - static extend(mixins? : Mixin, args?: CoreObjectArguments): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(args?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(args?: {}): T; - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(args?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(args?: {}): T; - static isClass: boolean; - static isMethod: boolean; addObserver: ModifyObserver; beginPropertyChanges(): Observable; cacheFor(keyName: string): any; diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts new file mode 100644 index 0000000000..9698dffcf6 --- /dev/null +++ b/express-validator/express-validator-tests.ts @@ -0,0 +1,40 @@ +/// + +/* Usage Example from https://github.com/ctavan/express-validator */ + +import util = require('util') +import express = require('express') +import expressValidator = require('express-validator') +var app = express() + +app.use(expressValidator()); + +app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: express.Response) { + + // checkBody only checks req.body; none of the other req parameters + // Similarly checkParams only checks in req.params (URL params) and + // checkQuery only checks req.query (GET params). + req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt(); + req.checkParams('urlparam', 'Invalid urlparam').isAlpha(); + req.checkQuery('getparam', 'Invalid getparam').isInt(); + + // OR assert can be used to check on all 3 types of params. + // req.assert('postparam', 'Invalid postparam').notEmpty().isInt(); + // req.assert('urlparam', 'Invalid urlparam').isAlpha(); + // req.assert('getparam', 'Invalid getparam').isInt(); + + req.sanitize('postparam').toBoolean(); + + var errors = req.validationErrors(); + if (errors) { + res.status(400).send('There have been validation errors: ' + util.inspect(errors)); + return; + } + res.json({ + urlparam: req.param('urlparam'), + getparam: req.param('getparam'), + postparam: req.param('postparam') + }); +}); + +app.listen(8888); diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 5a5df2fa0d..81f77323dd 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -1,11 +1,10 @@ -// Type definitions for express-validator +// Type definitions for express-validator 2.9.0 // Project: https://github.com/ctavan/express-validator // Definitions by: Nathan Ridley , Jonathan Häberle // Definitions: https://github.com/borisyankov/DefinitelyTyped /// - declare module "express-validator" { import express = require('express'); @@ -16,14 +15,32 @@ declare module "express-validator" { param: string; } + interface ValidatorFunction { (item: string, message: string): Validator; } + interface SanitizerFunction { (item: string): Sanitizer; } + interface Dictionary { [key: string]: T; } + export interface RequestValidation { - check(field:string, message:string): Validator; - assert(field:string, message:string): Validator; - sanitize(field:string): Sanitizer; - onValidationError(func:(msg:string) => void): void; - validationErrors() : any; + assert: ValidatorFunction; + check: ValidatorFunction; + checkBody: ValidatorFunction; + checkFiles: ValidatorFunction; + checkHeader: ValidatorFunction; + checkParams: ValidatorFunction; + checkQuery: ValidatorFunction; + validate: ValidatorFunction; + + filter: SanitizerFunction; + sanitize: SanitizerFunction; + + onValidationError(errback: (msg: string) => void): void; + validationErrors(mapped?: boolean): Dictionary | any[]; } + /** + * Interface for use when using express-validator as middleware for requests + */ + export interface ValidatedRequest extends express.Request, RequestValidation {} + export interface Validator { /** * Alias for regex() @@ -168,6 +185,5 @@ declare module "express-validator" { */ function ExpressValidator(middlewareOptions?:any):express.RequestHandler; - export = ExpressValidator; } diff --git a/eyes/eyes-tests.ts b/eyes/eyes-tests.ts new file mode 100644 index 0000000000..3182195dda --- /dev/null +++ b/eyes/eyes-tests.ts @@ -0,0 +1,29 @@ +/// + +import eyes = require('eyes'); + +var testObj = { + color: 'red', + num: 227 +} + +eyes.inspect(testObj) + +var options = { + styles: { + all: 'green', + label: 'red', + other: 'red', + key: 'red', + special: 'red', + 'string': 'red', + 'number': 'red', + bool: 'red', + regexp: 'red' + }, + + pretty: false, + hideFunctions: true, + stream: process.stdout, + maxLength: 120 +} \ No newline at end of file diff --git a/eyes/eyes.d.ts b/eyes/eyes.d.ts new file mode 100644 index 0000000000..0919168210 --- /dev/null +++ b/eyes/eyes.d.ts @@ -0,0 +1,54 @@ +// Type definitions for eyes 0.1.8 +// Project: https://github.com/cloudhead/eyes.js +// Definitions by: bryn austin bellomy +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "eyes" +{ + import stream = require('stream'); + + export function inspector(options?:EyesOptions): InspectorFunction; + export function inspect(thing:any, label?:string): void; + + export interface InspectorFunction { + (thing:any, label?:string): void; + } + + export interface EyesOptions + { + /** Styles applied to stdout */ + styles?: { + /** Overall base style applied to everything */ + all?: string; + /** Style when printing inspection labels, like 'array' in `array: [1, 2, 3]` */ + label?: string; + /** Style when printing objects which don't have a literal representation, such as functions */ + other?: string; + /** Style when printing the keys in object literals, like 'a' in `{a: 1}` */ + key?: string; + /** Style when printing `null`, `undefined`, etc. */ + special?: string; + /** Style when printing strings */ + string?: string; + /** Style when printing numbers */ + number?: string; + /** Style when printing booleans */ + bool?: string; + /** Style when printing RegExps */ + regexp?: string; + }; + + /** Indent object literals */ + pretty?: boolean; + /** Don't output functions at all */ + hideFunctions?: boolean; + /** Stream to write to, or null */ + stream?: stream.Writable; + /** Truncate output if longer */ + maxLength?: number; + } +} + + diff --git a/highcharts/highcharts-tests.ts b/highcharts/highcharts-tests.ts index 7e131b60b7..464f536d99 100644 --- a/highcharts/highcharts-tests.ts +++ b/highcharts/highcharts-tests.ts @@ -1,15 +1,33 @@ /// /// +Highcharts.setOptions({ + global: { + useUTC: false + } +}); -var animate: HighchartsBoolOrAnimation; -animate = true; -animate = { duration: 200, easing: "linear" }; +Highcharts.setOptions({ + lang: { + months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], + weekdays: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'] + } +}); -var gradient: HighchartsColorOrGradient; -gradient = { - linearGradient: { x0: 0, y0: 0, x1: 500, y1: 500 }, +var animate: HighchartsAnimation = { + duration: 200, + easing: "linear" +}; + + +var gradient: HighchartsGradient = { + linearGradient: { + x0: 0, + y0: 0, + x1: 500, + y1: 500 + }, stops: [ [0, 'rgb(255, 255, 255)'], [1, 'rgb(200, 200, 255)'] @@ -18,11 +36,6 @@ gradient = { var color = "#fcfcff"; -var backgound: HighchartsColorOrGradient; - -backgound = gradient; -backgound = color; - var chart1 = new Highcharts.Chart({ chart: { renderTo: "container" @@ -121,6 +134,6 @@ var highChartSettings: HighchartsOptions = { }] }; -var container = $("#container").highcharts(highChartSettings, function (chart) { +var container = $("#container").highcharts(highChartSettings, (chart) => { chart.series[0].setVisible(true, true); }); \ No newline at end of file diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 0049c522a7..584d61c9ba 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Highcharts 2.3.3 +// Type definitions for Highcharts 4.0.4 // Project: http://www.highcharts.com/ // Definitions by: Damiano Gambarotto // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -151,9 +151,6 @@ interface HighchartsAnimation { easing?: string; // "linear" | "swing" } -interface HighchartsBoolOrAnimation extends HighchartsAnimation { -} - interface HighchartsSelectionEvent extends Event { xAxis: HighchartsAxisOptions[]; yAxis: HighchartsAxisOptions[]; @@ -167,7 +164,7 @@ interface HighchartsChartEvents { selection?: (event: HighchartsSelectionEvent) => void; } -interface HighchartsColorOrGradient { +interface HighchartsGradient { linearGradient?: { x0: number; y0: number; x1: number; y1: number; }; @@ -175,12 +172,11 @@ interface HighchartsColorOrGradient { cx: number; cy: number; r: number; }; stops?: any[][]; - - brighten?(amount: number): HighchartsColorOrGradient; - get?(type: string): string; + brighten? (amount: number): string | HighchartsGradient; + get? (type: string): string; } -interface HighchartsBoolOrShadow { +interface HighchartsShadow { color?: string; offsetX?: number; offsetY?: number; @@ -191,21 +187,21 @@ interface HighchartsBoolOrShadow { interface HighchartsChartResetZoomButton { position: HighchartsPosition; relativeTo?: string; - theme?: HighchartsChartResetZoomButtonTheme; //TO DO + theme?: HighchartsChartResetZoomButtonTheme; } interface HighchartsChartResetZoomButtonTheme { - fill?:string; //css HEX colours. + fill?: string; //css HEX colours. stroke?: string;//css HEX colours. r?: number; // Radius % states?: any; // HTML element states eg: hover, with css attributes in object. - display?:string; // css attr eg: 'none' + display?: string; // css attr eg: 'none' } interface HighchartsChartOptions { alignTicks?: boolean; - animation?: HighchartsBoolOrAnimation; - backgroundColor?: HighchartsColorOrGradient; + animation?: boolean | HighchartsAnimation; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -220,17 +216,17 @@ interface HighchartsChartOptions { marginLeft?: number; marginRight?: number; marginTop?: number; - plotBackGroundColor?: HighchartsColorOrGradient; + plotBackGroundColor?: string | HighchartsGradient; plotBackGroundImage?: string; plotBorderColor?: string; plotBorderWidth?: number; - plotShadow?: HighchartsBoolOrShadow; + plotShadow?: boolean | HighchartsShadow; polar?: boolean; reflow?: boolean; renderTo?: any; resetZoomButton?: HighchartsChartResetZoomButton; selectionMarkerFill?: string; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showAxes?: boolean; spacingBottom?: number; spacingLeft?: number; @@ -272,7 +268,7 @@ interface HighchartsMenuItem { interface HighchartsButton { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -309,9 +305,11 @@ interface HighchartsExportingOptions { width?: number; } -interface HighchartsGlobalOptions { +interface HighchartsGlobalObject { + Date?: any; VMLRadialGradientURL?: string; canvasToolsURL?: string; + timezoneOffset?: number; useUTC?: boolean; } @@ -325,17 +323,19 @@ interface HighchartsLabelsOptions { style?: HighchartsCSSObject; } -interface HighchartsLangOptions { +interface HighchartsLangObject { + contextButtonTitle?: string; decimalPoint?: string; downloadJPEG?: string; downloadPDF?: string; downloadPNG?: string; downloadSVG?: string; - exportButtonTitle?: string; + drillUpText?: string; loading?: string; months?: string[]; + noData?: string; numericSymbols?: string[]; - printButtonTitle?: string; + printChart?: string; resetZoom?: string; resetZoomTitle?: string; shortMonths?: string[]; @@ -345,7 +345,7 @@ interface HighchartsLangOptions { interface HighchartsLegendNavigationOptions { activeColor?: string; - animation?: HighchartsBoolOrAnimation; + animation?: boolean | HighchartsAnimation; arrowSize?: number; inactiveColor?: string; style?: HighchartsCSSObject; @@ -353,7 +353,7 @@ interface HighchartsLegendNavigationOptions { interface HighchartsLegendOptions { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -375,7 +375,7 @@ interface HighchartsLegendOptions { reversed?: boolean; rtl?: boolean; verticalAlign?: string; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; style?: HighchartsCSSObject; symbolPadding?: number; symbolWidth?: number; @@ -401,7 +401,7 @@ interface HighchartsNavigationOptions { // Not sure of this interface interface HighchartsPaneBackground { - backgroundColor: HighchartsColorOrGradient; + backgroundColor: string | HighchartsGradient; borderColor?: string; borderWidth?: number; innerRadius?: string; @@ -412,12 +412,13 @@ interface HighchartsPaneOptions { background?: HighchartsPaneBackground[]; center?: [number|string, number|string]; // [x,y] | ["50%","50%" ] endAngle?: number; + size?: number | string; startAngle?: number; } interface HighchartsDataLabels { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -428,7 +429,7 @@ interface HighchartsDataLabels { overflow?: string; padding?: number; rotation?: number; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; staggerLines?: any; // ?? need to check API step?: any; // ?? need to check API style?: HighchartsCSSObject; @@ -492,63 +493,23 @@ interface HighchartsBarStates extends HighchartsAreaStates { brightness?: number; } -interface HighchartsAreaChart { - allowPointSelect?: boolean; - animation?: boolean; - color?: string; - connectEnds?: boolean; - connectNulls?: boolean; - cropThreshold?: number; - cursor?: string; - dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot - dataLabels?: HighchartsDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - fillColor?: HighchartsColorOrGradient; - fillOpacity?: boolean; - id?: string; - lineColor?: string; - lineWidth?: number; - marker?: HighchartsMarker; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPlacement?: string; // null, "on", "between" - pointStart?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsAreaStates; - }; - stickyTracking?: boolean; - threshold?: number; - tooltip?: HighchartsTooltipOptions; - trackByArea?: boolean; - turboThreshold?: number; - visible?: number; - zIndex?: number; -} - interface HighchartsRangeDataLabels { align?: string; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; color?: string; crop?: boolean; + defer?: boolean; enabled?: boolean; + format?: string; formatter?: () => any; + inside?: boolean; overflow?: string; padding?: number; rotation?: number; - shadow?: HighchartsBoolOrShadow; - staggerLines?: any; // ?? need to check API - step?: any; // ?? need to check API + shadow?: boolean | HighchartsShadow; style?: HighchartsCSSObject; useHTML?: boolean; verticalAlign?: string; @@ -556,125 +517,6 @@ interface HighchartsRangeDataLabels { xLow?: number; yHigh?: number; yLow?: number; -} - -interface HighchartsAreaRangeChart { - allowPointSelect?: boolean; - animation?: boolean; - color?: string; - connectNulls?: boolean; - cropThreshold?: number; - cursor?: string; - dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot - dataLabels?: HighchartsRangeDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - fillColor?: HighchartsColorOrGradient; - fillOpacity?: boolean; - id?: string; - lineColor?: string; - lineWidth?: number; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPlacement?: string; // null, "on", "between" - pointStart?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsAreaStates; - }; - stickyTracking?: boolean; - threshold?: number; - trackByArea?: boolean; - turboThreshold?: number; - visible?: number; - zIndex?: number; -} - -interface HighchartsBarChart { - allowPointSelect?: boolean; - animation?: boolean; - borderColor?: string; - borderRadius?: number; - borderWidth?: number; - color?: string; - colorByPoint?: boolean; - cropThreshold?: number; - cursor?: string; - dataLabels?: HighchartsDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - groupPadding?: number; - grouping?: boolean; - id?: string; - minPointLength?: number; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPadding?: number; - pointPlacement?: string; // null, "on", "between" - pointRange?: number; - pointStart?: number; - pointWidth?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsBarStates; - }; - stickyTracking?: boolean; - tooltip?: HighchartsTooltipOptions; - turboThreshold?: number; - visible?: number; - zIndex?: number; -} - -interface HighchartsColumnRangeChart { - allowPointSelect?: boolean; - animation?: boolean; - borderColor?: string; - borderRadius?: number; - borderWidth?: number; - color?: string; - colorByPoint?: boolean; - cropThreshold?: number; - cursor?: string; - dataLabels?: HighchartsRangeDataLabels; - enableMouseTracking?: boolean; - events?: HighchartsPlotEvents; - groupPadding?: number; - grouping?: boolean; - id?: string; - minPointLength?: number; - point?: { - events: HighchartsPointEvents; - }; - pointInterval?: number; - pointPadding?: number; - pointPlacement?: string; // null, "on", "between" - pointRange?: number; - pointStart?: number; - pointWidth?: number; - selected?: boolean; - shadow?: HighchartsBoolOrShadow; - showCheckbox?: boolean; - showInLegend?: boolean; - stacking?: string; - states?: { - hover: HighchartsBarStates; - }; - stickyTracking?: boolean; - tooltip?: HighchartsTooltipOptions; - turboThreshold?: number; - visible?: number; zIndex?: number; } @@ -696,6 +538,283 @@ interface HighchartsPivot { radius?: number; } +interface HighchartsAreaChart { + allowPointSelect?: boolean; + animation?: boolean; + color?: string; + connectEnds?: boolean; + connectNulls?: boolean; + cropThreshold?: number; + cursor?: string; + dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dataLabels?: HighchartsDataLabels; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + fillColor?: string | HighchartsGradient; + fillOpacity?: number; + linkedTo?: string; + lineColor?: string; + lineWidth?: number; + marker?: HighchartsMarker; + negativeColor?: string; + negativeFillColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPlacement?: string | number; // null, "on", "between" + pointStart?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsAreaStates; + }; + step?: string; + stickyTracking?: boolean; + threshold?: number; + tooltip?: HighchartsTooltipOptions; + trackByArea?: boolean; + turboThreshold?: number; + visible?: boolean; + zIndex?: number; +} + +interface HighchartsAreaRangeChart { + allowPointSelect?: boolean; + animation?: boolean; + color?: string; + connectNulls?: boolean; + cropThreshold?: number; + cursor?: string; + dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dataLabels?: HighchartsRangeDataLabels; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + fillColor?: string | HighchartsGradient; + fillOpacity?: number; + lineColor?: string; + lineWidth?: number; + linkedTo?: string; + negativeColor?: string; + negativeFillColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPlacement?: string | number; // null, "on", "between" + pointStart?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsAreaStates; + }; + step?: string; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + threshold?: number; + trackByArea?: boolean; + turboThreshold?: number; + visible?: boolean; +} + +interface HighchartsAreaSplineChart extends HighchartsAreaChart { + connectEnds?: boolean; +} + +interface HighchartsAreaSplineRangeChart extends HighchartsAreaRangeChart { +} + +interface HighchartsBarChart { + allowPointSelect?: boolean; + animation?: boolean; + borderColor?: string; + borderRadius?: number; + borderWidth?: number; + color?: string; + colorByPoint?: boolean; + cropThreshold?: number; + colors?: string[]; + cursor?: string; + dataLabels?: HighchartsDataLabels; + depth?: number; + edgeColor?: string; + edgeWidth?: number; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + groupPadding?: number; + groupZPadding?: number; + grouping?: boolean; + linkedTo?: string; + minPointLength?: number; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPadding?: number; + pointPlacement?: string; // null, "on", "between" + pointRange?: number; + pointStart?: number; + pointWidth?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsBarStates; + }; + stickyTracking?: boolean; + threshold?: number; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; +} + +interface HighchartsBoxPlotChart { + allowPointSelect?: boolean; + color?: string; + colorByPoint?: boolean; + colors?: string[]; + cursor?: string; + depth?: number; + edgecolor?: string; + edgewidth?: number; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + fillColor?: string; + groupPadding?: number; + groupZPadding?: number; + grouping?: boolean; + lineWidth?: number; + linkedTo?: string; + medianColor?: string; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPadding?: number; + pointPlacement?: string | number; + pointRange?: number; + pointStart?: number; + pointWidth?: number; + selected?: boolean; + showCheckbox?: boolean; + showInLegend?: boolean; + states?: { + hover: HighchartsBarStates; + }; + stemColor?: string; + stemDashStyle?: string; + stemWidth?: number; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; + whiskerColor?: string; + whiskerLength?: number | string; // 100 | "50%" + whiskerWidth?: number; +} + +interface HighchartsBubbleChart { + allowPointSelect?: boolean; + animation?: boolean; + color?: string; + cropThreshold?: number; + cursor?: string; + dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dataLabels?: HighchartsRangeDataLabels; + displayNegative?: boolean; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + lineWidth?: number; + linkedTo?: string; + marker?: HighchartsMarker; + maxSize?: string; + minSize?: string; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointStart?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + sizeBy?: string; + states?: { + hover: HighchartsBarStates; + }; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; + zMax?: number; + zMin?: number; + zThreshold?: number; +} + +interface HighchartsColumnChart extends HighchartsBarChart { +} + +interface HighchartsColumnRangeChart { + allowPointSelect?: boolean; + animation?: boolean; + borderColor?: string; + borderRadius?: number; + borderWidth?: number; + color?: string; + colorByPoint?: boolean; + colors?: string[]; + cropThreshold?: number; + cursor?: string; + dataLabels?: HighchartsRangeDataLabels; + enableMouseTracking?: boolean; + events?: HighchartsPlotEvents; + groupPadding?: number; + grouping?: boolean; + linkedTo?: string; + minPointLength?: number; + negativeColor?: string; + point?: { + events: HighchartsPointEvents; + }; + pointInterval?: number; + pointPadding?: number; + pointPlacement?: string | number; // null, "on", "between" + pointRange?: number; + pointStart?: number; + pointWidth?: number; + selected?: boolean; + shadow?: boolean | HighchartsShadow; + showCheckbox?: boolean; + showInLegend?: boolean; + stacking?: string; + states?: { + hover: HighchartsBarStates; + }; + stickyTracking?: boolean; + tooltip?: HighchartsTooltipOptions; + turboThreshold?: number; + visible?: boolean; +} + +interface HighchartsErrorBarChart { + // TODO +} + +interface HighchartsFunnelChart { + // TODO +} + interface HighchartsGaugeChart { animation?: boolean; color?: string; @@ -721,6 +840,10 @@ interface HighchartsGaugeChart { zIndex?: number; } +interface HighchartsHeatMapChart { + // TODO +} + interface HighchartsLineChart { allowPointSelect?: boolean; animation?: boolean; @@ -743,7 +866,7 @@ interface HighchartsLineChart { pointPlacement?: string; // null, "on", "between" pointStart?: number; selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showCheckbox?: boolean; showInLegend?: boolean; stacking?: string; @@ -771,7 +894,7 @@ interface HighchartsPieChart { events?: HighchartsPlotEvents; id?: string; ignoreHiddenPoint?: boolean; - innerSize?: any; // string or number; + innerSize?: number | string; lineWidth?: number; marker?: HighchartsMarker; point?: { @@ -779,9 +902,9 @@ interface HighchartsPieChart { }; pointPlacement?: string; // null, "on", "between" selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showInLegend?: boolean; - size?: any; // string or number; + size?: number | string; slicedOffset?: number; states?: { hover: HighchartsAreaStates; @@ -792,6 +915,14 @@ interface HighchartsPieChart { zIndex?: number; } +interface HighchartsPolygonChart { + // TODO +} + +interface HighchartsPyramidChart { + // TODO +} + interface HighchartsScatterChart { allowPointSelect?: boolean; animation?: boolean; @@ -813,7 +944,7 @@ interface HighchartsScatterChart { pointPlacement?: string; // null, "on", "between" pointStart?: number; selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showCheckbox?: boolean; showInLegend?: boolean; states?: { @@ -826,6 +957,22 @@ interface HighchartsScatterChart { zIndex?: number; } +interface HighchartsSolidGaugeChart { + // TODO +} + +interface HighchartsSplineChart extends HighchartsSeriesChart { +} + +interface HighchartsTreeMapChart { + // TODO +} + +interface HighchartsWaterFallChart { + // TODO +} + + // General options for all series types interface HighchartsSeriesChart { allowPointSelect?: boolean; @@ -849,7 +996,7 @@ interface HighchartsSeriesChart { pointPlacement?: string; // null, "on", "between" pointStart?: number; selected?: boolean; - shadow?: HighchartsBoolOrShadow; + shadow?: boolean | HighchartsShadow; showCheckbox?: boolean; showInLegend?: boolean; stacking?: string; @@ -863,23 +1010,30 @@ interface HighchartsSeriesChart { zIndex?: number; } -interface HighchartsSplineChart extends HighchartsSeriesChart { -} - interface HighchartsPlotOptions { area?: HighchartsAreaChart; arearange?: HighchartsAreaRangeChart; - areaspline?: HighchartsAreaChart; - areasplinerange?: HighchartsAreaRangeChart; + areaspline?: HighchartsAreaSplineChart; + areasplinerange?: HighchartsAreaSplineRangeChart; bar?: HighchartsBarChart; - column?: HighchartsBarChart; + boxplot?: HighchartsBoxPlotChart; + bubble?: HighchartsBubbleChart; + column?: HighchartsColumnChart; columnrange?: HighchartsColumnRangeChart; + errorbar?: HighchartsErrorBarChart; + funnel?: HighchartsFunnelChart; gauge?: HighchartsGaugeChart; + heatmap?: HighchartsHeatMapChart; line?: HighchartsLineChart; pie?: HighchartsPieChart; + polygon?: HighchartsPolygonChart; + pyramid?: HighchartsPyramidChart; scatter?: HighchartsScatterChart; series?: HighchartsSeriesChart; + solidgauge?: HighchartsSolidGaugeChart; spline?: HighchartsSplineChart; + treemap?: HighchartsTreeMapChart; + waterfall?: HighchartsWaterFallChart; } /* You will rarely, if ever, want to use this interface directly. Instead it is much more useful to use one of the derived @@ -897,18 +1051,29 @@ interface HighchartsIndividualSeriesOptions { } interface HighchartsSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSeriesChart { } + interface HighchartsAreaChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaChart { } interface HighchartsAreaRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaRangeChart { } -interface HighchartsAreaSplineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaChart { } -interface HighchartsAreaSplineRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaRangeChart { } +interface HighchartsAreaSplineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaSplineChart { } +interface HighchartsAreaSplineRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsAreaSplineRangeChart { } interface HighchartsBarChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBarChart { } -interface HighchartsColumnChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBarChart { } +interface HighchartsBoxPlotChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBoxPlotChart { } +interface HighchartsBubbleChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsBubbleChart { } +interface HighchartsColumnChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsColumnChart { } interface HighchartsColumnRangeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsColumnRangeChart { } +interface HighchartsErrorBarChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsErrorBarChart { } +interface HighchartsFunnelChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsFunnelChart { } interface HighchartsGaugeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsGaugeChart { } +interface HighchartsHeatMapSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsHeatMapChart { } interface HighchartsLineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsLineChart { } interface HighchartsPieChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsPieChart { } +interface HighchartsPolygonChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsPolygonChart { } +interface HighchartsPyramidChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsPyramidChart { } interface HighchartsScatterChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsScatterChart { } +interface HighchartsSolidGaugeChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSolidGaugeChart { } interface HighchartsSplineChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSplineChart { } +interface HighchartsTreeMapChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsTreeMapChart { } +interface HighchartsWaterFallChartSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsWaterFallChart { } interface HighchartsDataPoint { color?: string; @@ -923,6 +1088,17 @@ interface HighchartsDataPoint { y?: number; } +interface HighchartsSeriesOptions extends HighchartsSeriesChart { + type?: string; + data?: number[]| number[][]| HighchartsDataPoint[]; + index?: number; + legendIndex?: number; + name?: string; + stack?: string | number; + xAxis?: number; + yAxis?: number; +} + interface HighchartsSubtitleOptions { align?: string; verticalAlign?: string; @@ -952,7 +1128,7 @@ interface HighchartsPlotPoint { interface HighchartsTooltipOptions { animation?: boolean; - backgroundColor?: HighchartsColorOrGradient; + backgroundColor?: string | HighchartsGradient; borderColor?: string; borderRadius?: number; borderWidth?: number; @@ -977,13 +1153,14 @@ interface HighchartsOptions { chart?: HighchartsChartOptions; colors?: string[]; credits?: HighchartsCreditsOptions; + data?: any; // TODO + drilldown?: any; // TODO exporting?: HighchartsExportingOptions; - global?: HighchartsGlobalOptions; labels?: HighchartsLabelsOptions; - lang?: HighchartsLangOptions; legend?: HighchartsLegendOptions; loading?: HighchartsLoadingOptions; navigation?: HighchartsNavigationOptions; + noData?: any; // TODO pane?: HighchartsPaneOptions; plotOptions?: HighchartsPlotOptions; series?: HighchartsIndividualSeriesOptions[]; @@ -994,6 +1171,10 @@ interface HighchartsOptions { yAxis?: HighchartsAxisOptions; } +interface HighchartsGlobalOptions extends HighchartsOptions { + global?: HighchartsGlobalObject; + lang?: HighchartsLangObject; +} interface HighchartsAxisObject { addPlotBand(options: HighchartsPlotBands): void; @@ -1005,18 +1186,18 @@ interface HighchartsAxisObject { setCategories(categories: string[], redraw: boolean): void; setExtremes(min: number, max: number): void; setExtremes(min: number, max: number, redraw: boolean): void; - setExtremes(min: number, max: number, redraw: boolean, animation: HighchartsBoolOrAnimation): void; + setExtremes(min: number, max: number, redraw: boolean, animation: boolean | HighchartsAnimation): void; setTitle(title: HighchartsAxisTitle): void; setTitle(title: HighchartsAxisTitle, redraw: boolean): void; } interface HighchartsChartObject { - addSeries(options: T, redraw?: boolean, animation?: boolean): T; - addSeries(options: T, redraw?: boolean, animation?: HighchartsAnimation): T; - addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: boolean): HighchartsAxisObject; - addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: HighchartsAnimation): HighchartsAxisObject; + addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: boolean | HighchartsAnimation): HighchartsAxisObject; + addSeries(options: T, redraw?: boolean, animation?: boolean | HighchartsAnimation): T; + addSeriesAsDrilldown(point: HighchartsPointObject, seriesOptions: HighchartsSeriesOptions): void; container: HTMLElement; destroy(): void; + drillUp(): void; exportChart(): void; exportChart(options: HighchartsExportingOptions): void; exportChart(options: HighchartsExportingOptions, chartOptions: HighchartsChartOptions): void; @@ -1029,12 +1210,14 @@ interface HighchartsChartObject { options: HighchartsChartOptions; print(): void; redraw(): void; + reflow(): void; series: HighchartsSeriesObject[]; setSize(width: number, height: number): void; - setSize(width: number, height: number, anumation: boolean): void; - setSize(width: number, height: number, anumation: HighchartsAnimation): void; + setSize(width: number, height: number, animation: boolean): void; + setSize(width: number, height: number, animation: HighchartsAnimation): void; setTitle(title: HighchartsTitleOptions): void; setTitle(title: HighchartsTitleOptions, subtitle: HighchartsSubtitleOptions): void; + setTitle(title: HighchartsTitleOptions, subtitle: HighchartsSubtitleOptions, redraw: boolean): void; showLoading(): void; showLoading(str: string): void; xAxis: HighchartsAxisObject[]; @@ -1045,18 +1228,18 @@ interface HighchartsChartObject { interface HighchartsChart { new (options: HighchartsOptions): HighchartsChartObject; - new (options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void ): HighchartsChartObject; + new (options: HighchartsOptions, callback: (chart: HighchartsChartObject) => void): HighchartsChartObject; } interface HighchartsElementObject { add(): HighchartsElementObject; add(parent: HighchartsElementObject): HighchartsElementObject; - animate(attributes: any, animation?: any): HighchartsElementObject; + animate(attributes: any, animation?: any): HighchartsElementObject; attr(hash: any): HighchartsElementObject; css(hash: HighchartsCSSObject): HighchartsElementObject; destroy(): void; getBBox(): { x: number; y: number; height: number; width: number; }; - on(eventType: string, handler: () => void ): HighchartsElementObject; + on(eventType: string, handler: () => void): HighchartsElementObject; toFront(): HighchartsElementObject; } @@ -1077,15 +1260,16 @@ interface HighchartsRenderer { interface HighchartsStatic { Chart: HighchartsChart; Renderer: HighchartsRenderer; - Color(color: HighchartsColorOrGradient): HighchartsColorOrGradient; + Color(color: string | HighchartsGradient): string | HighchartsGradient; dateFormat(format: string, time?: number, capitalize?: boolean): string; numberFormat(value: number, decimals?: number, decimalPoint?: string, thousandsSep?: string): string; - setOptions(options: HighchartsOptions): HighchartsOptions; + setOptions(options: HighchartsGlobalOptions): HighchartsOptions; getOptions(): HighchartsOptions; map(array: any[], fn: Function): any[]; } + declare var Highcharts: HighchartsStatic; interface HighchartsPointObject { @@ -1105,6 +1289,7 @@ interface HighchartsPointObject { slice(sliced: boolean, redraw: boolean): void; slice(sliced: boolean, redraw: boolean, animation: boolean): void; slice(sliced: boolean, redraw: boolean, animation: HighchartsAnimation): void; + total: number; update(options: any): void; update(options: any, redraw: boolean): void; update(options: any, redraw: boolean, animation: boolean): void; @@ -1114,20 +1299,19 @@ interface HighchartsPointObject { } interface HighchartsSeriesObject { - addPoint(options: any): void; - addPoint(options: any, redraw: boolean, shift: boolean): void; - addPoint(options: any, redraw: boolean, shift: boolean, animation: boolean): void; - addPoint(options: any, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void; + addPoint(options: number |[number, number]| HighchartsDataPoint): void; + addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean): void; + addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean, animation: boolean): void; + addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void; chart: HighchartsChartObject; data: HighchartsDataPoint[]; hide(): void; - options: HighchartsIndividualSeriesOptions; + name: string; + options: HighchartsSeriesOptions; remove(): void; remove(redraw: boolean): void; - name: string; - points: HighchartsPointObject[]; select(): void; - select(selected?: boolean): void; + select(selected: boolean): void; selected: boolean; setData(data: number[]): void; // [value1,value2, ... ] setData(data: number[], redraw: boolean): void; @@ -1139,6 +1323,7 @@ interface HighchartsSeriesObject { setVisible(visible: boolean, redraw: boolean): void; show(): void; type: string; + update(options: HighchartsSeriesOptions, redraw?: boolean): void; visible: boolean; xAxis: HighchartsAxisObject; yAxis: HighchartsAxisObject; diff --git a/hypertext-application-language/hypertext-application-language-tests.ts b/hypertext-application-language/hypertext-application-language-tests.ts new file mode 100644 index 0000000000..13a88fe870 --- /dev/null +++ b/hypertext-application-language/hypertext-application-language-tests.ts @@ -0,0 +1,20 @@ +/// + +// Link object + +// Fields format: +var link:Hal.Link = { + "deprecation": "", + "href": "", + "hreflang": "", + "name": "", + "profile": "", + "templated": true, + "title": "", + "type": "", +}; + +// Required fields: +var link:Hal.Link = { + "href": "", +}; diff --git a/hypertext-application-language/hypertext-application-language.d.ts b/hypertext-application-language/hypertext-application-language.d.ts new file mode 100644 index 0000000000..648a89634d --- /dev/null +++ b/hypertext-application-language/hypertext-application-language.d.ts @@ -0,0 +1,22 @@ +// Type definitions for Hypertext Application Language Draft 6 +// Project: https://tools.ietf.org/html/draft-kelly-json-hal-06 +// Definitions by: Maks3w +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Hal { + /** + * Describe a HAL Link object + * + * https://tools.ietf.org/html/draft-kelly-json-hal-06#section-5 + */ + interface Link { + deprecation?: string; + href: string; + hreflang?: string; + name?: string; + profile?: string; + templated?: boolean; + title?: string; + type?: string; + } +} diff --git a/json-patch/json-patch-tests.ts b/json-patch/json-patch-tests.ts new file mode 100644 index 0000000000..c2736c403f --- /dev/null +++ b/json-patch/json-patch-tests.ts @@ -0,0 +1,35 @@ +/// + +import jp = require("json-patch"); + +// Add property, result: {foo: 'bar'} +jsonpatch.apply({}, [{ op: 'add', path: '/foo', value: 'bar' }]); +// Add array element, result: {foo: [1, 2, 3]} +jsonpatch.apply({ foo: [1, 3] }, [{ op: 'add', path: '/foo/1', value: 2 }]); +// Complex, result: {foo: [{bar: 'baz'}]} +jsonpatch.apply({ foo: [{}] }, [{ op: 'add', path: '/foo/0/bar', value: 'baz' }]); + +// Remove property, result: {} +jsonpatch.apply({ foo: 'bar' }, [{ op: 'remove', path: '/foo' }]); +// Remove array element, result: {foo: [1, 3]} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'remove', path: '/foo/1' }]); +// Complex, result: {foo: [{}]} +jsonpatch.apply({ foo: [{ bar: 'baz' }] }, [{ op: 'remove', path: '/foo/0/bar' }]); + +// Replace property, result: {foo: 1} +jsonpatch.apply({ foo: 'bar' }, [{ op: 'replace', path: '/foo', value: 1 }]); +// Repalce array element, result: {foo: [1, 4, 3]} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'replace', path: '/foo/1', value: 4 }]); +// Complex, result: {foo: [{bar: 1}]} +jsonpatch.apply({ foo: [{ bar: 'baz' }] }, [{ op: 'replace', path: '/foo/0/bar', value: 1 }]); + +// Move property, result {bar: [1, 2, 3]} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'move', from: '/foo', path: '/bar' }]); +// Copy property, result {foo: [1, 2, 3], bar: 2} +jsonpatch.apply({ foo: [1, 2, 3] }, [{ op: 'copy', from: '/foo/1', path: '/bar' }]); +// Test equality of property to value, result: true +jsonpatch.apply({ foo: 'bar' }, [{ op: 'test', path: '/foo', value: 'bar' }]); + +jsonpatch.compile([{ op: 'test', path: '/foo', value: 'bar' }])({ foo: 'bar' }); + +jp.apply({}, [{ op: 'add', path: '/foo', value: 'bar' }]); diff --git a/json-patch/json-patch.d.ts b/json-patch/json-patch.d.ts new file mode 100644 index 0000000000..308fe35c69 --- /dev/null +++ b/json-patch/json-patch.d.ts @@ -0,0 +1,41 @@ +// Type definitions for json-patch +// Project: https://github.com/bruth/jsonpatch-js +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module jsonpatch { + type OpPatch = AddPath | RemovePath | ReplacePath | MovePath | CopyPath | TestPath; + interface Patch { + op: string; + } + interface AddPath extends Patch { + path: string; + value: any; + } + interface RemovePath extends Patch { + path: string; + } + interface ReplacePath extends Patch { + path: string; + value: any; + } + interface MovePath extends Patch { + from: string; + path: string; + } + interface CopyPath extends Patch { + from: string; + path: string; + } + interface TestPath extends Patch { + path: string; + value: any; + } + + function apply(document: any, patches: OpPatch[]): any; + function compile(patches: OpPatch[]): (document: any) => any; +} + +declare module "json-patch" { + export = jsonpatch; +} diff --git a/json5/json5-tests.ts b/json5/json5-tests.ts new file mode 100644 index 0000000000..da945c3413 --- /dev/null +++ b/json5/json5-tests.ts @@ -0,0 +1,7 @@ +/// +import JSON5 = require('json5'); + +var obj = JSON5.parse("{ key:'val', 'key2':[0,1,2,] } //comment "); +var str = JSON5.stringify(obj, null, "\t"); +console.log(str); + diff --git a/json5/json5.d.ts b/json5/json5.d.ts new file mode 100644 index 0000000000..2ea49bf969 --- /dev/null +++ b/json5/json5.d.ts @@ -0,0 +1,45 @@ +// Type definitions for JSON5 +// Project: http://json5.org/ +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +//commonjs loader +declare module "json5" { + /** + * The following is the exact list of additions to JSON's syntax introduced by JSON5. All of these are optional, and all of these come from ES5. + +Objects + +Object keys can be unquoted if they're valid identifiers. Yes, even reserved keywords (like default) are valid unquoted keys in ES5 [§11.1.5, §7.6]. (More info) + +(TODO: Unicode characters and escape sequences aren’t yet supported in this implementation.) + +Objects can have trailing commas. + +Arrays + +Arrays can have trailing commas. +Strings + +Strings can be single-quoted. + +Strings can be split across multiple lines; just prefix each newline with a backslash. [ES5 §7.8.4] + +Numbers + +Numbers can be hexadecimal (base 16). + +Numbers can begin or end with a (leading or trailing) decimal point. + +Numbers can include Infinity, -Infinity, NaN, and -NaN. + +Numbers can begin with an explicit plus sign. + +Comments + +Both inline (single-line) and block (multi-line) comments are allowed. + */ + var json5: JSON; + export = json5; +} \ No newline at end of file diff --git a/knockout.punches/knockout.punches-tests.ts b/knockout.punches/knockout.punches-tests.ts new file mode 100644 index 0000000000..bd5d53a5c5 --- /dev/null +++ b/knockout.punches/knockout.punches-tests.ts @@ -0,0 +1,8 @@ +/// + + +function test_enable() { + + ko.punches.enableAll(); + +} \ No newline at end of file diff --git a/knockout.punches/knockout.punches.d.ts b/knockout.punches/knockout.punches.d.ts new file mode 100644 index 0000000000..d219d61f15 --- /dev/null +++ b/knockout.punches/knockout.punches.d.ts @@ -0,0 +1,20 @@ +// Type definitions for knockout.punches 0.5.1 +// Project: https://github.com/mbest/knockout.punches +// Definitions by: Stephen Lautier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutPunchesStatic { + enableAll(): void; +} + +interface KnockoutStatic { + punches: KnockoutPunchesStatic; +} + +declare module "knockout.punches" { + export = punches; +} + +declare var punches: KnockoutPunchesStatic; \ No newline at end of file diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts old mode 100644 new mode 100755 index 184724f4cb..4c8fd4d73f --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -325,3 +325,92 @@ CustomControl = L.Control.extend({ this.title = title; }, }); + +// Different latLng and latLngBounds expressions +var latLngLiteral = [10, 20]; +var latLngObjectLiteral = { lat: 10, lng: 10 }; +var boundsLiteral = [[10, 20], [20, 20]]; +var boundLiteralOfLatLngObjects = [latLngObjectLiteral, latLngObjectLiteral]; + +var circle: L.Circle = L.circle(latLngLiteral, 4); +circle = new L.Circle(latLngLiteral, 4); +circle.setLatLng(latLngLiteral); + +circle = L.circle(latLngObjectLiteral, 4); +circle = new L.Circle(latLngObjectLiteral, 4); +circle.setLatLng(latLngObjectLiteral); + +var circleMarker: L.CircleMarker = L.circleMarker(latLngLiteral); +circleMarker = new L.CircleMarker(latLngLiteral); +circleMarker.setLatLng(latLngLiteral); + +circleMarker = L.circleMarker(latLngObjectLiteral); +circleMarker = new L.CircleMarker(latLngObjectLiteral); +circleMarker.setLatLng(latLngObjectLiteral); + +var latLng: L.LatLng = L.latLng(latLngLiteral); +latLng = new L.LatLng(latLngLiteral); +latLng.distanceTo(latLngLiteral); +latLng.equals(latLngLiteral); + +latLng = L.latLng(latLngObjectLiteral); +latLng = new L.LatLng(latLngObjectLiteral); +latLng.distanceTo(latLngObjectLiteral); +latLng.equals(latLngObjectLiteral); + +var bounds: L.LatLngBounds = L.latLngBounds(boundsLiteral); +bounds = L.latLngBounds(boundLiteralOfLatLngObjects); +bounds = new L.LatLngBounds(boundsLiteral); +bounds = new L.LatLngBounds(boundLiteralOfLatLngObjects); +bounds = new L.LatLngBounds(latLngLiteral, latLngLiteral); + +bounds.extend(latLngLiteral); +bounds.extend(latLngObjectLiteral); +bounds.extend(boundsLiteral); +bounds.extend(boundLiteralOfLatLngObjects); + +bounds.contains(latLngLiteral); +bounds.contains(boundLiteralOfLatLngObjects); +bounds.contains(boundsLiteral); + +bounds.intersects(boundsLiteral); +bounds.intersects(boundLiteralOfLatLngObjects); + +bounds.equals(boundsLiteral); +bounds.equals(boundLiteralOfLatLngObjects); + +map.setView(latLngLiteral); +map.setView(latLngObjectLiteral); +map.setZoomAround(latLngLiteral, 15); +map.setZoomAround(latLngObjectLiteral, 15); +map.panTo(latLngLiteral); +map.panTo(latLngObjectLiteral); +map.openPopup('test', latLngLiteral); +map.openPopup('test', latLngObjectLiteral); +map.latLngToLayerPoint(latLngLiteral); +map.latLngToLayerPoint(latLngObjectLiteral); +map.latLngToContainerPoint(latLngLiteral); +map.latLngToContainerPoint(latLngObjectLiteral); +map.project(latLngLiteral); +map.project(latLngObjectLiteral); + +marker.setLatLng(latLngLiteral); +marker.setLatLng(latLngObjectLiteral); + +var polygon: L.Polygon = L.polygon(boundsLiteral); +polygon = L.polygon(boundLiteralOfLatLngObjects); +polygon = new L.Polygon(boundsLiteral); +polygon = new L.Polygon(boundLiteralOfLatLngObjects); + +var polyline: L.Polyline = L.polyline(boundsLiteral); +polyline = L.polyline(boundLiteralOfLatLngObjects); +polyline = new L.Polyline(boundsLiteral); +polyline = new L.Polyline(boundLiteralOfLatLngObjects); +polyline.setLatLngs(boundsLiteral); +polyline.setLatLngs(boundLiteralOfLatLngObjects); +polyline.addLatLng(latLngLiteral); +polyline.addLatLng(latLngObjectLiteral); + +var popup: L.Popup = L.popup(); +popup.setLatLng(latLngLiteral); +popup.setLatLng(latLngObjectLiteral); diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts old mode 100644 new mode 100755 index a1e92ef713..2bd6a51189 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -3,6 +3,10 @@ // Definitions by: Vladimir Zotov // Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module L { + type LatLngExpression = LatLng | number[] | ({ lat: number; lng: number }) + type LatLngBoundsExpression = LatLngBounds | LatLngExpression[]; +} declare module L { @@ -180,14 +184,14 @@ declare module L { * Instantiates a circle object given a geographical point, a radius in meters * and optionally an options object. */ - function circle(latlng: LatLng, radius: number, options?: PathOptions): Circle; + function circle(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle; export interface CircleStatic extends ClassStatic { /** * Instantiates a circle object given a geographical point, a radius in meters * and optionally an options object. */ - new(latlng: LatLng, radius: number, options?: PathOptions): Circle; + new(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle; } export var Circle: CircleStatic; @@ -205,7 +209,7 @@ declare module L { /** * Sets the position of a circle to a new location. */ - setLatLng(latlng: LatLng): Circle; + setLatLng(latlng: LatLngExpression): Circle; /** * Sets the radius of a circle. Units are in meters. @@ -227,7 +231,7 @@ declare module L { * an options object. The default radius is 10 and can be altered by passing a * "radius" member in the path options object. */ - function circleMarker(latlng: LatLng, options?: PathOptions): CircleMarker; + function circleMarker(latlng: LatLngExpression, options?: PathOptions): CircleMarker; export interface CircleMarkerStatic extends ClassStatic { @@ -236,7 +240,7 @@ declare module L { * an options object. The default radius is 10 and can be altered by passing a * "radius" member in the path options object. */ - new(latlng: LatLng, options?: PathOptions): CircleMarker; + new(latlng: LatLngExpression, options?: PathOptions): CircleMarker; } export var CircleMarker: CircleMarkerStatic; @@ -244,7 +248,7 @@ declare module L { /** * Sets the position of a circle marker to a new location. */ - setLatLng(latlng: LatLng): CircleMarker; + setLatLng(latlng: LatLngExpression): CircleMarker; /** * Sets the radius of a circle marker. Units are in pixels. @@ -1439,7 +1443,7 @@ declare module L { * Creates an object representing a geographical point with the given latitude * and longitude. */ - function latLng(coords: number[]): LatLng; + function latLng(coords: LatLngExpression): LatLng; export interface LatLngStatic extends ClassStatic { /** @@ -1452,7 +1456,7 @@ declare module L { * Creates an object representing a geographical point with the given latitude * and longitude. */ - new(coords: number[]): LatLng; + new(coords: LatLngExpression): LatLng; /** * A multiplier for converting degrees into radians. @@ -1482,13 +1486,13 @@ declare module L { * Returns the distance (in meters) to the given LatLng calculated using the * Haversine formula. See description on wikipedia */ - distanceTo(otherLatlng: LatLng): number; + distanceTo(otherLatlng: LatLngExpression): number; /** * Returns true if the given LatLng point is at the same position (within a small * margin of error). */ - equals(otherLatlng: LatLng): boolean; + equals(otherLatlng: LatLngExpression): boolean; /** * Returns a string representation of the point (for debugging purposes). @@ -1519,26 +1523,26 @@ declare module L { * Creates a LatLngBounds object by defining south-west and north-east corners * of the rectangle. */ - function latLngBounds(southWest: LatLng, northEast: LatLng): LatLngBounds; + function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds; /** * Creates a LatLngBounds object defined by the geographical points it contains. * Very useful for zooming the map to fit a particular set of locations with fitBounds. */ - function latLngBounds(latlngs: LatLng[]): LatLngBounds; + function latLngBounds(latlngs: LatLngBoundsExpression): LatLngBounds; export interface LatLngBoundsStatic extends ClassStatic { /** * Creates a LatLngBounds object by defining south-west and north-east corners * of the rectangle. */ - new(southWest: LatLng, northEast: LatLng): LatLngBounds; + new(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds; /** * Creates a LatLngBounds object defined by the geographical points it contains. * Very useful for zooming the map to fit a particular set of locations with fitBounds. */ - new(latlngs: LatLng[]): LatLngBounds; + new(latlngs: LatLngBoundsExpression): LatLngBounds; } export var LatLngBounds: LatLngBoundsStatic; @@ -1546,12 +1550,12 @@ declare module L { /** * Extends the bounds to contain the given point. */ - extend(latlng: LatLng): LatLngBounds; + extend(latlng: LatLngExpression): LatLngBounds; /** * Extends the bounds to contain the given bounds. */ - extend(latlng: LatLngBounds): LatLngBounds; + extend(latlng: LatLngBoundsExpression): LatLngBounds; /** * Returns the south-west point of the bounds. @@ -1601,23 +1605,23 @@ declare module L { /** * Returns true if the rectangle contains the given one. */ - contains(otherBounds: LatLngBounds): boolean; + contains(otherBounds: LatLngBoundsExpression): boolean; /** * Returns true if the rectangle contains the given point. */ - contains(latlng: LatLng): boolean; + contains(latlng: LatLngExpression): boolean; /** * Returns true if the rectangle intersects the given bounds. */ - intersects(otherBounds: LatLngBounds): boolean; + intersects(otherBounds: LatLngBoundsExpression): boolean; /** * Returns true if the rectangle is equivalent (within a small margin of error) * to the given bounds. */ - equals(otherBounds: LatLngBounds): boolean; + equals(otherBounds: LatLngBoundsExpression): boolean; /** * Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' @@ -2082,7 +2086,7 @@ declare module L { * Sets the view of the map (geographical center and zoom) with the given * animation options. */ - setView(center: LatLng, zoom?: number, options?: ZoomPanOptions): Map; + setView(center: LatLngExpression, zoom?: number, options?: ZoomPanOptions): Map; /** * Sets the zoom of the map. @@ -2103,7 +2107,7 @@ declare module L { * Zooms the map while keeping a specified point on the map stationary * (e.g. used internally for scroll zoom and double-click zoom). */ - setZoomAround(latlng: LatLng, zoom: number, options?: ZoomOptions): Map; + setZoomAround(latlng: LatLngExpression, zoom: number, options?: ZoomOptions): Map; /** * Sets a map view that contains the given geographical bounds with the maximum @@ -2121,7 +2125,7 @@ declare module L { * Pans the map to a given center. Makes an animated pan if new center is not more * than one screen away from the current one. */ - panTo(latlng: LatLng, options?: PanOptions): Map; + panTo(latlng: LatLngExpression, options?: PanOptions): Map; /** * Pans the map to the closest view that would lie inside the given bounds (if @@ -2253,13 +2257,13 @@ declare module L { * Creates a popup with the specified options and opens it in the given point * on a map. */ - openPopup(html: string, latlng: LatLng, options?: PopupOptions): Map; + openPopup(html: string, latlng: LatLngExpression, options?: PopupOptions): Map; /** * Creates a popup with the specified options and opens it in the given point * on a map. */ - openPopup(el: HTMLElement, latlng: LatLng, options?: PopupOptions): Map; + openPopup(el: HTMLElement, latlng: LatLngExpression, options?: PopupOptions): Map; /** * Closes the popup previously opened with openPopup (or the given one). @@ -2282,7 +2286,7 @@ declare module L { * Returns the map layer point that corresponds to the given geographical coordinates * (useful for placing overlays on the map). */ - latLngToLayerPoint(latlng: LatLng): Point; + latLngToLayerPoint(latlng: LatLngExpression): Point; /** * Returns the geographical coordinates of a given map layer point. @@ -2305,7 +2309,7 @@ declare module L { * Returns the map container point that corresponds to the given geographical * coordinates. */ - latLngToContainerPoint(latlng: LatLng): Point; + latLngToContainerPoint(latlng: LatLngExpression): Point; /** * Returns the geographical coordinates of a given map container point. @@ -2316,7 +2320,7 @@ declare module L { * Projects the given geographical coordinates to absolute pixel coordinates * for the given zoom level (current zoom level by default). */ - project(latlng: LatLng, zoom?: number): Point; + project(latlng: LatLngExpression, zoom?: number): Point; /** * Projects the given absolute pixel coordinates to geographical coordinates @@ -2718,14 +2722,14 @@ declare module L { * Instantiates a Marker object given a geographical point and optionally * an options object. */ - function marker(latlng: LatLng, options?: MarkerOptions): Marker; + function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; var Marker: { /** * Instantiates a Marker object given a geographical point and optionally * an options object. */ - new(latlng: LatLng, options?: MarkerOptions): Marker; + new(latlng: LatLngExpression, options?: MarkerOptions): Marker; }; export interface Marker extends ILayer, IEventPowered { @@ -2742,7 +2746,7 @@ declare module L { /** * Changes the marker position to the given point. */ - setLatLng(latlng: LatLng): Marker; + setLatLng(latlng: LatLngExpression): Marker; /** * Changes the marker icon. @@ -3095,7 +3099,7 @@ declare module L { * Opens the popup previously bound by the bindPopup method in the given point, * or in one of the path's points if not specified. */ - openPopup(latlng?: LatLng): Path; + openPopup(latlng?: LatLngExpression): Path; /** * Closes the path's bound popup if it is opened. @@ -3371,7 +3375,7 @@ declare module L { * latlngs array representing the exterior ring while the remaining represent * the holes inside. */ - function polygon(latlngs: LatLng[], options?: PolylineOptions): Polygon; + function polygon(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polygon; export interface PolygonStatic extends ClassStatic { @@ -3382,7 +3386,7 @@ declare module L { * latlngs array representing the exterior ring while the remaining represent * the holes inside. */ - new(latlngs: LatLng[], options?: PolylineOptions): Polygon; + new(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polygon; } export var Polygon: PolygonStatic; @@ -3396,14 +3400,14 @@ declare module L { * Instantiates a polyline object given an array of geographical points and * optionally an options object. */ - function polyline(latlngs: LatLng[], options?: PolylineOptions): Polyline; + function polyline(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polyline; export interface PolylineStatic extends ClassStatic { /** * Instantiates a polyline object given an array of geographical points and * optionally an options object. */ - new(latlngs: LatLng[], options?: PolylineOptions): Polyline; + new(latlngs: LatLngBoundsExpression, options?: PolylineOptions): Polyline; } export var Polyline: PolylineStatic; @@ -3411,13 +3415,13 @@ declare module L { /** * Adds a given point to the polyline. */ - addLatLng(latlng: LatLng): Polyline; + addLatLng(latlng: LatLngExpression): Polyline; /** * Replaces all the points in the polyline with the given array of geographical * points. */ - setLatLngs(latlngs: LatLng[]): Polyline; + setLatLngs(latlngs: LatLngBoundsExpression): Polyline; /** * Returns an array of the points in the path. @@ -3510,7 +3514,7 @@ declare module L { /** * Sets the geographical point where the popup will open. */ - setLatLng(latlng: LatLng): Popup; + setLatLng(latlng: LatLngExpression): Popup; /** * Returns the geographical point of popup. diff --git a/mandrill-api/mandrill-api.d.ts b/mandrill-api/mandrill-api.d.ts new file mode 100644 index 0000000000..54a9a73a43 --- /dev/null +++ b/mandrill-api/mandrill-api.d.ts @@ -0,0 +1,1182 @@ +// Type definitions for Mandrill API 1.x +// Project: http://mandrill.com/ +// Definitions by: Paulo Cesar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* =================== USAGE =================== + + import mandrill from 'mandrill-api'; + + =============================================== */ + +/// + +declare module 'mandrill-api' { + + export interface ICallback { + (json: Object): void; + } + + export interface IErrorCallback { + (err: Error): void; + } + + export class Mandrill { + apikey: string; + debug: boolean; + templates: Templates; + exports: Exports; + users: Users; + rejects: Rejects; + inbound: Inbound; + tags: Tags; + messages: Messages; + whitelists: Whitelists; + ips: Ips; + internal: Internal; + subaccounts: Subaccounts; + urls: Urls; + webhooks: Webhooks; + senders: Senders; + metadata: Metadata; + onerror: IErrorCallback; + constructor(apikey: string, debug?: boolean); + call(uri: string, params: any, onresult?: ICallback, onerror?: ICallback): void; + } + + export class Templates { + constructor(master: Mandrill); + + /** + * Add a new template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the name for the new template - must be unique + * @option params {String} from_email a default sending address for emails sent using this template + * @option params {String} from_name a default from name to be used + * @option params {String} subject a default subject line to be used + * @option params {String} code the HTML code for the template with mc:edit attributes for the editable elements + * @option params {String} text a default text part to be used when sending with this template + * @option params {Boolean} publish set to false to add a draft template without publishing + * @option params {Array} labels an optional array of up to 10 labels to use for filtering templates + * - labels[] {String} a single label + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Get the information for an existing template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Update the code for an existing template. If null is provided for any fields, the values will remain unchanged. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @option params {String} from_email the new default sending address + * @option params {String} from_name the new default from name + * @option params {String} subject the new default subject line + * @option params {String} code the new code for the template + * @option params {String} text the new default text part to be used + * @option params {Boolean} publish set to false to update the draft version of the template without publishing + * @option params {Array} labels an optional array of up to 10 labels to use for filtering templates + * - labels[] {String} a single label + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + publish(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Delete a template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the immutable name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return a list of all the templates available to this user + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} label an optional label to filter the templates + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the name of an existing template + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Inject content and optionally merge fields into a template, returning the HTML that results + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} template_name the immutable name of a template that exists in the user's account + * @option params {Array} template_content an array of template content to render. Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block + * - template_content[] {Object} the injection of a single piece of content into a single editable region + * - name {String} the name of the mc:edit editable region to inject into + * - content {String} the content to inject + * @option params {Array} merge_vars optional merge variables to use for injecting merge field content. If this is not provided, no merge fields will be replaced. + * - merge_vars[] {Object} a single merge variable + * - name {String} the merge variable's name. Merge variable names are case-insensitive and may not start with _ + * - content {String} the merge variable's content + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + render(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Exports { + constructor(master: Mandrill); + + /** + * Returns information about an export job. If the export job's state is 'complete', + * the returned data will include a URL you can use to fetch the results. Every export + * job produces a zip archive, but the format of the archive is distinct for each job + * type. The api calls that initiate exports include more details about the output format + * for that job type. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id an export job identifier + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Returns a list of your exports. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Begins an export of your rejection blacklist. The blacklist will be exported to a zip archive + * containing a single file named rejects.csv that includes the following fields: email, + * reason, detail, created_at, expires_at, last_event_at, expires_at. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} notify_email an optional email address to notify when the export job has finished. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + rejects(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Begins an export of your rejection whitelist. The whitelist will be exported to a zip archive + * containing a single file named whitelist.csv that includes the following fields: + * email, detail, created_at. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} notify_email an optional email address to notify when the export job has finished. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + whitelist(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Begins an export of your activity history. The activity will be exported to a zip archive + * containing a single file named activity.csv in the same format as you would be able to export + * from your account's activity view. It includes the following fields: Date, Email Address, + * Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom + * metadata fields, they will be included in the exported data. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} notify_email an optional email address to notify when the export job has finished + * @option params {String} date_from start date as a UTC string in YYYY-MM-DD HH:MM:SS format + * @option params {String} date_to end date as a UTC string in YYYY-MM-DD HH:MM:SS format + * @option params {Array} tags an array of tag names to narrow the export to; will match messages that contain ANY of the tags + * - tags[] {String} a tag name + * @option params {Array} senders an array of senders to narrow the export to + * - senders[] {String} a sender address + * @option params {Array} states an array of states to narrow the export to; messages with ANY of the states will be included + * - states[] {String} a message state + * @option params {Array} api_keys an array of api keys to narrow the export to; messsagse sent with ANY of the keys will be included + * - api_keys[] {String} an API key associated with your account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + activity(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Users { + constructor(master: Mandrill); + + /** + * Return the information about the API-connected user + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Validate an API key and respond to a ping + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + ping(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Validate an API key and respond to a ping (anal JSON parser version) + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + ping2(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the senders that have tried to use this account, both verified and unverified + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + senders(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Rejects { + constructor(master: Mandrill); + + /** + * Adds an email to your email rejection blacklist. Addresses that you + * add manually will never expire and there is no reputation penalty + * for removing them from your blacklist. Attempting to blacklist an + * address that has been whitelisted will have no effect. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an email address to block + * @option params {String} comment an optional comment describing the rejection + * @option params {String} subaccount an optional unique identifier for the subaccount to limit the blacklist entry + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Retrieves your email rejection blacklist. You can provide an email + * address to limit the results. Returns up to 1000 results. By default, + * entries that have expired are excluded from the results; set + * include_expired to true to include them. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an optional email address to search by + * @option params {Boolean} include_expired whether to include rejections that have already expired. + * @option params {String} subaccount an optional unique identifier for the subaccount to limit the blacklist + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes an email rejection. There is no limit to how many rejections + * you can remove from your blacklist, but keep in mind that each deletion + * has an affect on your reputation. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an email address + * @option params {String} subaccount an optional unique identifier for the subaccount to limit the blacklist deletion + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Inbound { + constructor(master: Mandrill); + + /** + * List the domains that have been configured for inbound delivery + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + domains(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Add an inbound domain to your account + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing inbound domain + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Delete an inbound domain from the account. All mail will stop routing for this domain immediately. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing inbound domain + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + deleteDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * List the mailbox routes defined for an inbound domain + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain the domain to check + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + routes(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Add a new mailbox route to an inbound domain + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing inbound domain + * @option params {String} pattern the search pattern that the mailbox name should match + * @option params {String} url the webhook URL where the inbound messages will be published + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addRoute(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of an existing mailbox route + * @option params {String} pattern the search pattern that the mailbox name should match + * @option params {String} url the webhook URL where the inbound messages will be published + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + updateRoute(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Delete an existing inbound mailbox route + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of an existing route + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + deleteRoute(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} raw_message the full MIME document of an email message + * @option params {Array|null} to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document + * - to[] {String} the email address of the recipient + * @option params {String} mail_from the address specified in the MAIL FROM stage of the SMTP conversation. Required for the SPF check. + * @option params {String} helo the identification provided by the client mta in the MTA state of the SMTP conversation. Required for the SPF check. + * @option params {String} client_address the remote MTA's ip address. Optional; required for the SPF check. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + sendRaw(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Tags { + constructor(master: Mandrill); + + /** + * Return all of the user-defined tag information + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes a tag permanently. Deleting a tag removes the tag from any messages + * that have been sent, and also deletes the tag's stats. There is no way to + * undo this operation, so use it carefully. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} tag a tag name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Return more detailed information about a single tag, including aggregates of recent stats + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} tag an existing tag name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a tag + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} tag an existing tag name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for all tags + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + allTimeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Messages { + constructor(master: Mandrill); + + /** + * Send a new transactional message through Mandrill + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Struct} message the information on the message to send + * -html {String} the full HTML content to be sent + * -text {String} optional full text content to be sent + * -subject {String} the message subject + * -from_email {String} the sender email address. + * -from_name {String} optional from name to be used + * -to {Array} an array of recipient information. + * -to[] {Object} a single recipient's information. + * -email {String} the email address of the recipient + * -name {String} the optional display name to use for the recipient + * -type {String} the header type to use for the recipient, defaults to "to" if not provided + * -headers {Object} optional extra headers to add to the message (most headers are allowed) + * -important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages + * -track_opens {Boolean} whether or not to turn on open tracking for the message + * -track_clicks {Boolean} whether or not to turn on click tracking for the message + * -auto_text {Boolean} whether or not to automatically generate a text part for messages that are not given text + * -auto_html {Boolean} whether or not to automatically generate an HTML part for messages that are not given HTML + * -inline_css {Boolean} whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size + * -url_strip_qs {Boolean} whether or not to strip the query string from URLs when aggregating tracked URL data + * -preserve_recipients {Boolean} whether or not to expose all recipients in to "To" header for each email + * -view_content_link {Boolean} set to false to remove content logging for sensitive emails + * -bcc_address {String} an optional address to receive an exact copy of each recipient's email + * -tracking_domain {String} a custom domain to use for tracking opens and clicks instead of mandrillapp.com + * -signing_domain {String} a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients) + * -return_path_domain {String} a custom domain to use for the messages's return-path + * -merge {Boolean} whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided. + * -merge_language {String} the merge tag language to use when evaluating merge tags, either mailchimp or handlebars + * -global_merge_vars {Array} global merge variables to use for all recipients. You can override these per recipient. + * -global_merge_vars[] {Object} a single global merge variable + * -name {String} the global merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the global merge variable's content + * -merge_vars {Array} per-recipient merge variables, which override global merge variables with the same name. + * -merge_vars[] {Object} per-recipient merge variables + * -rcpt {String} the email address of the recipient that the merge variables should apply to + * -vars {Array} the recipient's merge variables + * -vars[] {Object} a single merge variable + * -name {String} the merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the merge variable's content + * -tags {Array} an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors. + * -tags[] {String} a single tag - must not start with an underscore + * -subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error + * -google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically. + * -google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead. + * -metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api. + * -recipient_metadata {Array} Per-recipient metadata that will override the global values specified in the metadata parameter. + * -recipient_metadata[] {Object} metadata for a single recipient + * -rcpt {String} the email address of the recipient that the metadata is associated with + * -values {Array} an associated array containing the recipient's unique metadata. If a key exists in both the per-recipient metadata and the global metadata, the per-recipient metadata will be used. + * -attachments {Array} an array of supported attachments to add to the message + * -attachments[] {Object} a single supported attachment + * -type {String} the MIME type of the attachment + * -name {String} the file name of the attachment + * -content {String} the content of the attachment as a base64-encoded string + * -images {Array} an array of embedded images to add to the message + * -images[] {Object} a single embedded image + * -type {String} the MIME type of the image - must start with "image/" + * -name {String} the Content ID of the image - use to reference the image in your HTML content + * -content {String} the content of the image as a base64-encoded string + * @option params {Boolean} async enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. + * @option params {String} ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead. + * @option params {String} send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + send(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Send a new transactional message through Mandrill using a template + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} template_name the immutable name or slug of a template that exists in the user's account. For backwards-compatibility, the template name may also be used but the immutable slug is preferred. + * @option params {Array} template_content an array of template content to send. Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block + * -template_content[] {Object} the injection of a single piece of content into a single editable region + * -name {String} the name of the mc:edit editable region to inject into + * -content {String} the content to inject + * @option params {Struct} message the other information on the message to send - same as /messages/send, but without the html content + * -html {String} optional full HTML content to be sent if not in template + * -text {String} optional full text content to be sent + * -subject {String} the message subject + * -from_email {String} the sender email address. + * -from_name {String} optional from name to be used + * -to {Array} an array of recipient information. + * -to[] {Object} a single recipient's information. + * -email {String} the email address of the recipient + * -name {String} the optional display name to use for the recipient + * -type {String} the header type to use for the recipient, defaults to "to" if not provided + * -headers {Object} optional extra headers to add to the message (most headers are allowed) + * -important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages + * -track_opens {Boolean} whether or not to turn on open tracking for the message + * -track_clicks {Boolean} whether or not to turn on click tracking for the message + * -auto_text {Boolean} whether or not to automatically generate a text part for messages that are not given text + * -auto_html {Boolean} whether or not to automatically generate an HTML part for messages that are not given HTML + * -inline_css {Boolean} whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size + * -url_strip_qs {Boolean} whether or not to strip the query string from URLs when aggregating tracked URL data + * -preserve_recipients {Boolean} whether or not to expose all recipients in to "To" header for each email + * -view_content_link {Boolean} set to false to remove content logging for sensitive emails + * -bcc_address {String} an optional address to receive an exact copy of each recipient's email + * -tracking_domain {String} a custom domain to use for tracking opens and clicks instead of mandrillapp.com + * -signing_domain {String} a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients) + * -return_path_domain {String} a custom domain to use for the messages's return-path + * -merge {Boolean} whether to evaluate merge tags in the message. Will automatically be set to true if either merge_vars or global_merge_vars are provided. + * -merge_language {String} the merge tag language to use when evaluating merge tags, either mailchimp or handlebars + * -global_merge_vars {Array} global merge variables to use for all recipients. You can override these per recipient. + * -global_merge_vars[] {Object} a single global merge variable + * -name {String} the global merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the global merge variable's content + * -merge_vars {Array} per-recipient merge variables, which override global merge variables with the same name. + * -merge_vars[] {Object} per-recipient merge variables + * -rcpt {String} the email address of the recipient that the merge variables should apply to + * -vars {Array} the recipient's merge variables + * -vars[] {Object} a single merge variable + * -name {String} the merge variable's name. Merge variable names are case-insensitive and may not start with _ + * -content {Mixed} the merge variable's content + * -tags {Array} an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors. + * -tags[] {String} a single tag - must not start with an underscore + * -subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error + * -google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically. + * -google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead. + * -metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api. + * -recipient_metadata {Array} Per-recipient metadata that will override the global values specified in the metadata parameter. + * -recipient_metadata[] {Object} metadata for a single recipient + * -rcpt {String} the email address of the recipient that the metadata is associated with + * -values {Array} an associated array containing the recipient's unique metadata. If a key exists in both the per-recipient metadata and the global metadata, the per-recipient metadata will be used. + * -attachments {Array} an array of supported attachments to add to the message + * -attachments[] {Object} a single supported attachment + * -type {String} the MIME type of the attachment + * -name {String} the file name of the attachment + * -content {String} the content of the attachment as a base64-encoded string + * -images {Array} an array of embedded images to add to the message + * -images[] {Object} a single embedded image + * -type {String} the MIME type of the image - must start with "image/" + * -name {String} the Content ID of the image - use to reference the image in your HTML content + * -content {String} the content of the image as a base64-encoded string + * @option params {Boolean} async enable a background sending mode that is optimized for bulk sending. In async mode, messages/send will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. + * @option params {String} ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead. + * @option params {String} send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. An additional fee applies for scheduled email, and this feature is only available to accounts with a positive balance. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + sendTemplate(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Search recently sent messages and optionally narrow by date range, tags, senders, and API keys. If no date range is specified, results within the last 7 days are returned. This method may be called up to 20 times per minute. If you need the data more often, you can use /messages/info.json to get the information for a single message, or webhooks to push activity to your own application for querying. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} query search terms to find matching messages + * @option params {String} date_from start date + * @option params {String} date_to end date + * @option params {Array} tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags + * @option params {Array} senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders + * @option params {Array} api_keys an array of API keys to narrow the search to, will return messages sent by ANY of the keys + * @option params {Integer} limit the maximum number of results to return, defaults to 100, 1000 is the maximum + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + search(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Search the content of recently sent messages and return the aggregated hourly stats for matching messages + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} query the search terms to find matching messages for + * @option params {String} date_from start date + * @option params {String} date_to end date + * @option params {Array} tags an array of tag names to narrow the search to, will return messages that contain ANY of the tags + * @option params {Array} senders an array of sender addresses to narrow the search to, will return messages sent by ANY of the senders + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + searchTimeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Get the information for a single recently sent message + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Get the full content of a recently sent message + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + content(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} raw_message the full MIME document of an email message + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + parse(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Take a raw MIME document for a message, and send it exactly as if it were sent through Mandrill's SMTP servers + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} raw_message the full MIME document of an email message + * @option params {String|null} from_email optionally define the sender address - otherwise we'll use the address found in the provided headers + * @option params {String|null} from_name optionally define the sender alias + * @option params {Array|null} to optionally define the recipients to receive the message - otherwise we'll use the To, Cc, and Bcc headers provided in the document + * -to[] {String} the email address of the recipient + * @option params {Boolean} async enable a background sending mode that is optimized for bulk sending. In async mode, messages/sendRaw will immediately return a status of "queued" for every recipient. To handle rejections when sending in async mode, set up a webhook for the 'reject' event. Defaults to false for messages with no more than 10 recipients; messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. + * @option params {String} ip_pool the name of the dedicated ip pool that should be used to send the message. If you do not have any dedicated IPs, this parameter has no effect. If you specify a pool that does not exist, your default pool will be used instead. + * @option params {String} send_at when this message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. + * @option params {String} return_path_domain a custom domain to use for the messages's return-path + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + sendRaw(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Queries your scheduled emails by sender or recipient, or both. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} to an optional recipient address to restrict results to + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + listScheduled(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Cancels a scheduled email. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + cancelScheduled(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Reschedules a scheduled email. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id a scheduled email id, as returned by any of the messages/send calls or messages/list-scheduled + * @option params {String} send_at the new UTC timestamp when the message should sent. Mandrill can't time travel, so if you specify a time in past the message will be sent immediately + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + reschedule(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Whitelists { + constructor(master: Mandrill); + + /** + * Adds an email to your email rejection whitelist. If the address is + * currently on your blacklist, that blacklist entry will be removed + * automatically. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an email address to add to the whitelist + * @option params {String} comment an optional description of why the email was whitelisted + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Retrieves your email rejection whitelist. You can provide an email + * address or search prefix to limit the results. Returns up to 1000 results. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email an optional email address or prefix to search by + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Removes an email address from the whitelist. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} email the email address to remove from the whitelist + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Ips { + constructor(master: Mandrill); + + /** + * Lists your dedicated IPs. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Retrieves information about a single dedicated ip. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated IP address + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Requests an additional dedicated IP for your account. Accounts may + * have one outstanding request at any time, and provisioning requests + * are processed within 24 hours. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Boolean} warmup whether to enable warmup mode for the ip + * @option params {String} pool the id of the pool to add the dedicated ip to, or null to use your account's default pool + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + provision(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Begins the warmup process for a dedicated IP. During the warmup process, + * Mandrill will gradually increase the percentage of your mail that is sent over + * the warming-up IP, over a period of roughly 30 days. The rest of your mail + * will be sent over shared IPs or other dedicated IPs in the same pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + startWarmup(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Cancels the warmup process for a dedicated IP. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + cancelWarmup(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Moves a dedicated IP to a different pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @option params {String} pool the name of the new pool to add the dedicated ip to + * @option params {Boolean} create_pool whether to create the pool if it does not exist; if false and the pool does not exist, an Unknown_Pool will be thrown. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + setPool(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes a dedicated IP. This is permanent and cannot be undone. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip the dedicated ip to remove from your account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Lists your dedicated IP pools. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + listPools(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Describes a single dedicated IP pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} pool a pool name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + poolInfo(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Creates a pool and returns it. If a pool already exists with this + * name, no action will be performed. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} pool the name of a pool to create + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + createPool(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Deletes a pool. A pool must be empty before you can delete it, and you cannot delete your default pool. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} pool the name of the pool to delete + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + deletePool(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Tests whether a domain name is valid for use as the custom reverse + * DNS for a dedicated IP. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @option params {String} domain the domain name to test + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkCustomDns(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Configures the custom DNS name for a dedicated IP. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} ip a dedicated ip address + * @option params {String} domain a domain name to set as the dedicated IP's custom dns name. + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + setCustomDns(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Internal { + constructor(master: Mandrill); + } + + export class Subaccounts { + constructor(master: Mandrill); + + /** + * Get the list of subaccounts defined for the account, optionally filtered by a prefix + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} q an optional prefix to filter the subaccounts' ids and names + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Add a new subaccount + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id a unique identifier for the subaccount to be used in sending calls + * @option params {String} name an optional display name to further identify the subaccount + * @option params {String} notes optional extra text to associate with the subaccount + * @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Given the ID of an existing subaccount, return the data about it + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to query + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Update an existing subaccount + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to update + * @option params {String} name an optional display name to further identify the subaccount + * @option params {String} notes optional extra text to associate with the subaccount + * @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to delete + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + + /** + * Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to pause + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + pause(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Resume a paused subaccount's sending + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} id the unique identifier of the subaccount to resume + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + resume(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Urls { + constructor(master: Mandrill); + + /** + * Get the 100 most clicked URLs + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the 100 most clicked URLs that match the search query given + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} q a search query + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + search(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a url + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} url an existing URL + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Get the list of tracking domains set up for this account + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + trackingDomains(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Add a tracking domain to your account + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addTrackingDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain an existing tracking domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkTrackingDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Webhooks { + constructor(master: Mandrill); + + /** + * Get the list of all webhooks defined on the account + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Add a new webhook + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} url the URL to POST batches of events + * @option params {String} description an optional description of the webhook + * @option params {Array} events an optional list of events that will be posted to the webhook + * - events[] {String} the individual event to listen for + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Given the ID of an existing webhook, return the data about it + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Integer} id the unique identifier of a webhook belonging to this account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Update an existing webhook + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Integer} id the unique identifier of a webhook belonging to this account + * @option params {String} url the URL to POST batches of events + * @option params {String} description an optional description of the webhook + * @option params {Array} events an optional list of events that will be posted to the webhook + * - events[] {String} the individual event to listen for + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Delete an existing webhook + * @param {Object} params the hash of the parameters to pass to the request + * @option params {Integer} id the unique identifier of a webhook belonging to this account + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: {id: number}, onsuccess?: ICallback, onerror?: ICallback): void; + + } + + export class Senders { + constructor(master: Mandrill); + + /** + * Return the senders that have tried to use this account. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Returns the sender domains that have been added to this account. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + domains(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Adds a sender domain to your account. Sender domains are added automatically as you + * send, but you can use this call to add them ahead of time. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + addDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Checks the SPF and DKIM settings for a domain. If you haven't already added this domain to your + * account, it will be added automatically. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + checkDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Sends a verification email in order to verify ownership of a domain. + * Domain verification is an optional step to confirm ownership of a domain. Once a + * domain has been verified in a Mandrill account, other accounts may not have their + * messages signed by that domain unless they also verify the domain. This prevents + * other Mandrill accounts from sending mail signed by your domain. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} domain a domain name at which you can receive email + * @option params {String} mailbox a mailbox at the domain where the verification email should be sent + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + verifyDomain(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return more detailed information about a single sender, including aggregates of recent stats + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} address the email address of the sender + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + info(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + + /** + * Return the recent history (hourly stats for the last 30 days) for a sender + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} address the email address of the sender + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + timeSeries(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } + + export class Metadata { + constructor(master: Mandrill); + /** + * Get the list of custom metadata fields indexed for the account. + * @param {Object} params the hash of the parameters to pass to the request + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + list(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + /** + * Add a new custom metadata field to be indexed for the account. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name a unique identifier for the metadata field + * @option params {String} view_template optional Mustache template to control how the metadata is rendered in your activity log + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + add(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + /** + * Update an existing custom metadata field. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the unique identifier of the metadata field to update + * @option params {String} view_template optional Mustache template to control how the metadata is rendered in your activity log + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + update(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + /** + * Delete an existing custom metadata field. Deletion isn't instataneous, and /metadata/list will continue to return the field until the asynchronous deletion process is complete. + * @param {Object} params the hash of the parameters to pass to the request + * @option params {String} name the unique identifier of the metadata field to update + * @param {Function} onsuccess an optional callback to execute when the API call is successfully made + * @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception + */ + delete(params: any, onsuccess?: ICallback, onerror?: ICallback): void; + } +} \ No newline at end of file diff --git a/mandrill-api/mandrill-tests.ts b/mandrill-api/mandrill-tests.ts new file mode 100644 index 0000000000..bbdaeb71fc --- /dev/null +++ b/mandrill-api/mandrill-tests.ts @@ -0,0 +1,14 @@ +/// + +import mandrill = require('mandrill-api'); + +var + M = new mandrill.Mandrill('key', false), + cb: mandrill.ICallback = function(asd){ + + }; + + +M.templates.add({}); +M.webhooks.delete({id: 1}); +M.call('url', {}, cb, cb); \ No newline at end of file diff --git a/node-uuid/node-uuid-tests.ts b/node-uuid/node-uuid-tests.ts index 9ad3c1cfcd..e922c04de3 100644 --- a/node-uuid/node-uuid-tests.ts +++ b/node-uuid/node-uuid-tests.ts @@ -23,7 +23,14 @@ var buf : number[] = [] uuid.parse(uid4, buf, offset) uuid.unparse(buf, offset) -uuid.v1(options, padding, offset) -uuid.v2(options, padding, offset) -uuid.v3(options, padding, offset) -uuid.v4(options, padding, offset) +var uid21: number[] = uuid.v1(options, padding, offset) +var uid22: number[] = uuid.v2(options, padding, offset) +var uid23: number[] = uuid.v3(options, padding, offset) +var uid24: number[] = uuid.v4(options, padding, offset) + +var buffer: Buffer; + +var uid31: Buffer = uuid.v1(options, buffer, offset) +var uid32: Buffer = uuid.v2(options, buffer, offset) +var uid33: Buffer = uuid.v3(options, buffer, offset) +var uid34: Buffer = uuid.v4(options, buffer, offset) diff --git a/node-uuid/node-uuid.d.ts b/node-uuid/node-uuid.d.ts index d1e1e8c2eb..b069e8f37f 100644 --- a/node-uuid/node-uuid.d.ts +++ b/node-uuid/node-uuid.d.ts @@ -11,39 +11,43 @@ interface UUIDOptions { * Node id as Array of 6 bytes (per 4.1.6). * Default: Randomly generated ID. See note 1. */ - node: any[] + node?: any[] /** * (Number between 0 - 0x3fff) RFC clock sequence. * Default: An internally maintained clockseq is used. */ - clockseq: number + clockseq?: number /** * (Number | Date) Time in milliseconds since unix Epoch. * Default: The current time is used. */ - msecs: any + msecs?: any /** * (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if msecs is unspecified. * Default: internal uuid counter is used, as per 4.2.1.2. */ - nsecs: number + nsecs?: number } interface UUID { - v1(options?: UUIDOptions, buffer?: number[], offset?: number): string - v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v1(options?: UUIDOptions): string + v1(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer - v2(options?: UUIDOptions, buffer?: number[], offset?: number): string - v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v2(options?: UUIDOptions): string + v2(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer - v3(options?: UUIDOptions, buffer?: number[], offset?: number): string - v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v3(options?: UUIDOptions): string + v3(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer - v4(options?: UUIDOptions, buffer?: number[], offset?: number): string - v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): string + v4(options?: UUIDOptions): string + v4(options?: UUIDOptions, buffer?: number[], offset?: number): number[] + v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer parse(id: string, buffer?: number[], offset?: number): number[] parse(id: string, buffer?: Buffer, offset?: number): Buffer diff --git a/node/node.d.ts b/node/node.d.ts index 3760cd108a..3771ba8226 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -15,7 +15,7 @@ * * ************************************************/ declare var process: NodeJS.Process; -declare var global: any; +declare var global: NodeJS.Global; declare var __filename: string; declare var __dirname: string; @@ -190,6 +190,70 @@ declare module NodeJS { send?(message: any, sendHandle?: any): void; } + export interface Global { + Array: typeof Array; + ArrayBuffer: typeof ArrayBuffer; + Boolean: typeof Boolean; + Buffer: typeof Buffer; + DataView: typeof DataView; + Date: typeof Date; + Error: typeof Error; + EvalError: typeof EvalError; + Float32Array: typeof Float32Array; + Float64Array: typeof Float64Array; + Function: typeof Function; + GLOBAL: Global; + Infinity: typeof Infinity; + Int16Array: typeof Int16Array; + Int32Array: typeof Int32Array; + Int8Array: typeof Int8Array; + Intl: typeof Intl; + JSON: typeof JSON; + Map: typeof Map; + Math: typeof Math; + NaN: typeof NaN; + Number: typeof Number; + Object: typeof Object; + Promise: Function; + RangeError: typeof RangeError; + ReferenceError: typeof ReferenceError; + RegExp: typeof RegExp; + Set: typeof Set; + String: typeof String; + Symbol: Function; + SyntaxError: typeof SyntaxError; + TypeError: typeof TypeError; + URIError: typeof URIError; + Uint16Array: typeof Uint16Array; + Uint32Array: typeof Uint32Array; + Uint8Array: typeof Uint8Array; + Uint8ClampedArray: Function; + WeakMap: typeof WeakMap; + WeakSet: Function; + clearImmediate: (immediateId: any) => void; + clearInterval: (intervalId: NodeJS.Timer) => void; + clearTimeout: (timeoutId: NodeJS.Timer) => void; + console: typeof console; + decodeURI: typeof decodeURI; + decodeURIComponent: typeof decodeURIComponent; + encodeURI: typeof encodeURI; + encodeURIComponent: typeof encodeURIComponent; + escape: (str: string) => string; + eval: typeof eval; + global: Global; + isFinite: typeof isFinite; + isNaN: typeof isNaN; + parseFloat: typeof parseFloat; + parseInt: typeof parseInt; + process: Process; + root: Global; + setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => any; + setInterval: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; + undefined: typeof undefined; + unescape: (str: string) => string; + } + export interface Timer { ref() : void; unref() : void; diff --git a/oauth.js/oauth.js-tests.ts b/oauth.js/oauth.js-tests.ts new file mode 100644 index 0000000000..81fa694b86 --- /dev/null +++ b/oauth.js/oauth.js-tests.ts @@ -0,0 +1,95 @@ +/// + +var encoded1: string = OAuth.percentEncode("abcあいう"); +var encoded2: string = OAuth.percentEncode(["abc", "あいう"]); +var decoded1: string = OAuth.decodePercent("abc%E3%81%82%E3%81%84%E3%81%86"); + +var list: OAuth.ParameterList; +list = OAuth.getParameterList([["name1", "value1"], ["name2", "value2"]]); +list = OAuth.getParameterList({ name1: "value1", name2: "value2" }); +list = OAuth.getParameterList("name1=value1&name2=value2"); + +var map: OAuth.ParameterMap; +map = OAuth.getParameterMap([["name1", "value1"], ["name2", "value2"]]); +map = OAuth.getParameterMap({ name1: "value1", name2: "value2" }); +map = OAuth.getParameterMap("name1=value1&name2=value2"); + +var param: string; +param = OAuth.getParameter([["name1", "value1"], ["name2", "value2"]], "name1"); +param = OAuth.getParameter({ name1: "value1", name2: "value2" }, "name1"); +param = OAuth.getParameter("name1=value1&name2=value2", "name1"); + +var formEncoded1: string = OAuth.formEncode([["name1", "value1"], ["name2", "value2"]]); +var formEncoded2: string = OAuth.formEncode({ name1: "value1", name2: "value2" }); + +var formDecoded1: OAuth.ParameterList = OAuth.decodeForm("name1=value1&name2=value2"); + +var message1: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [] }; +OAuth.setParameter(message1, "name1", "value1"); +var message2: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: {} }; +OAuth.setParameter(message2, "name1", "value1"); + +var message3: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [] }; +OAuth.setParameters(message3, [["name1", "value1"], ["name2", "value2"]]); +OAuth.setParameters(message3, { name3: "value3", name4: "value4" }); +OAuth.setParameters(message3, "name5=value5&name6=value6"); +var message4: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: {} }; +OAuth.setParameters(message4, [["name1", "value1"], ["name2", "value2"]]); +OAuth.setParameters(message4, { name3: "value3", name4: "value4" }); +OAuth.setParameters(message4, "name5=value5&name6=value6"); + +var accessor: OAuth.Accessor = { consumerKey: "ck", consumerSecret: "cs", token: "t", tokenSecret: "ts" }; +var message5: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +OAuth.completeRequest(message5, accessor); +var message6: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: { name1: "value1" } }; +OAuth.completeRequest(message6, accessor); + +var message7: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +OAuth.setTimestampAndNonce(message7); +var message8: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: { name1: "value1" } }; +OAuth.setTimestampAndNonce(message8); + +var url1: string = OAuth.addToURL("http://example.org/", [["name1", "value1"]]); +var url2: string = OAuth.addToURL("http://example.org/?name1=value1", [["name1", "value1"]]); +var url3: string = OAuth.addToURL("http://example.org/", { name1: "value1" }); +var url4: string = OAuth.addToURL("http://example.org/?name1=value1", { name1: "value1" }); + +var authorizationHeader1: string = OAuth.getAuthorizationHeader("realm", [["name1", "value1"], ["oauth_param1", "oauth_value1"]]); +var authorizationHeader2: string = OAuth.getAuthorizationHeader("realm", { name1: "value1", oauth_param1: "oauth_value1" }); +var authorizationHeader3: string = OAuth.getAuthorizationHeader("realm", "name1=value1&oauth_param1=oauth_value1"); + +OAuth.correctTimestampFromSrc(); +OAuth.correctTimestampFromSrc("timestamp_param_name"); + +OAuth.correctTimestamp((new Date()).getTime() / 1000); + +var timeCorrectionMsec: number = OAuth.timeCorrectionMsec; + +var timestamp: number = OAuth.timestamp(); + +var nonce: string = OAuth.nonce(16); + + +var message9: OAuth.Message = { method: "GET", action: "http://example.org/1", parameters: [] }; +var baseString: string = OAuth.SignatureMethod.getBaseString(message9); + +var normalizedUrl: string = OAuth.SignatureMethod.normalizeUrl("http://example.org:80/2"); + +var uri: OAuth.Uri = OAuth.SignatureMethod.parseUri("http://example.org:80/3?name1=value1&name2=value2"); + +var normalizedParameters1: string = OAuth.SignatureMethod.normalizeParameters([["name1", "value1"], ["name2", "value2"]]); +var normalizedParameters2: string = OAuth.SignatureMethod.normalizeParameters({ name1: "value1", name2: "value2" }); + +var message10: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +OAuth.SignatureMethod.sign(message9, accessor); + +var signatureMethodConstructor: { new (): OAuth.SignatureMethod; } = + OAuth.SignatureMethod.makeSubclass(function getSignature(baseString) { return this.key }); +OAuth.SignatureMethod.registerMethodClass(["PLAINTEXT"], signatureMethodConstructor); + +var signatureMethod1: OAuth.SignatureMethod = OAuth.SignatureMethod.newMethod("PLAINTEXT", accessor); +var message11: OAuth.Message = { action: "http://example.org/", method: "GET", parameters: [["name1", "value1"]] }; +var signature: string = signatureMethod1.sign(message11); +var signatureMethod2: OAuth.SignatureMethod = new signatureMethodConstructor(); +signatureMethod2.initialize("PLAINTEXT", accessor); + diff --git a/oauth.js/oauth.js.d.ts b/oauth.js/oauth.js.d.ts new file mode 100644 index 0000000000..24baa09903 --- /dev/null +++ b/oauth.js/oauth.js.d.ts @@ -0,0 +1,197 @@ +// Type definitions for JavaScript software for implementing an OAuth consumer +// Project: https://code.google.com/p/oauth/ +// Definitions by: NOBUOKA Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module OAuth { + + /** An Array of name-value pairs [[name, value], [name2, value2]]. */ + type ParameterList = [string, string][]; + + /** A map {name: value, name2: value2}. */ + type ParameterMap = { [name: string]: string; }; + + type ParameterListOrMap = ParameterList|ParameterMap; + + /** + * An OAuth message is represented as an object like this: + * { method: "GET", action: "http://server.com/path", parameters: ... } + */ + interface Message { + action: string; + method: string; + parameters: ParameterListOrMap; + } + + /** + * SignatureMethod expects an accessor object to be like this: + * {tokenSecret: "lakjsdflkj...", consumerSecret: "QOUEWRI..", accessorSecret: "xcmvzc..."} + * The accessorSecret property is optional. + */ + interface Accessor { + consumerKey: string; + consumerSecret: string; + accessorSecret?: string; + token: string; + tokenSecret: string; + } + + /** + * Encode text value according to OAuth Percent Encoding. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.6} + * @param s Target text value. + */ + function percentEncode(s: string): string; + + /** + * Encode text values according to OAuth Percent Encoding. + * Encoded values are joined with an ampersand character (&) in between them. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.6} + * @param s Target text values. + */ + function percentEncode(s: string[]): string; + + /** + * Decode percent-encoded value. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.6} + * @param s Target percent-encoded value. + */ + function decodePercent(s: string): string; + + /** + * Convert the given parameters to an Array of name-value pairs. + */ + function getParameterList(parameters: ParameterListOrMap): ParameterList; + + /** + * Convert the given parameters to an Array of name-value pairs. + */ + function getParameterList(parameters: string): ParameterList; + + /** + * Convert the given parameters to a map from name to value. + */ + function getParameterMap(parameters: ParameterListOrMap): ParameterMap; + + /** + * Convert the given parameters to a map from name to value. + */ + function getParameterMap(parameters: string): ParameterMap; + + function getParameter(parameters: ParameterListOrMap, name: string): string; + function getParameter(parameters: string, name: string): string; + + function formEncode(parameters: ParameterListOrMap): string; + + function decodeForm(form: string): ParameterList; + + function setParameter(message: Message, name: string, value: string): void; + + function setParameters(message: Message, parameters: ParameterListOrMap): void; + function setParameters(message: Message, parameters: string): void; + + /** + * Fill in parameters to help construct a request message. + * This function doesn't fill in every parameter. + * @param message Target request message. + * @param accessor Accessor object. The accessorSecret property is optional. + */ + function completeRequest(message: Message, accessor: Accessor): void; + + function setTimestampAndNonce(message: Message): void; + + /** + * Add specified parameters into URL as query parameters. + * @param url URL that parameters added into. + * @param parameters Parameters added into URL. + * @return New URL string. + */ + function addToURL(url: string, parameters: ParameterListOrMap): string; + + /** Construct the value of the Authorization header for an HTTP request. */ + function getAuthorizationHeader(realm: string, parameters: ParameterListOrMap): string; + function getAuthorizationHeader(realm: string, parameters: string): string; + + /** Correct the time using a parameter from the URL from which the last script was loaded. */ + function correctTimestampFromSrc(parameterName?: string): void; + + /** Generate timestamps starting with the given value. */ + function correctTimestamp(timestamp: number): void; + + /** The difference between the correct time and my clock. */ + var timeCorrectionMsec: number; + + function timestamp(): number; + + function nonce(length: number): string; + + interface Uri { + source: string; + protocol: string; + authority: string; + userInfo: string; + user: string; + password: string; + host: string; + port: string; + relative: string; + path: string; + directory: string; + file: string; + query: string; + anchor: string; + } + + interface SignatureMethodStatic { + sign(message: Message, accessor: Accessor): void; + + /** Instantiate a SignatureMethod for the given method name. */ + newMethod(name: string, accessor: Accessor): SignatureMethod; + + /** A map from signature method name to constructor. */ + REGISTERED: { [name: string]: { new (): SignatureMethod }; }; + + /** + * Subsequently, the given constructor will be used for the named methods. + * The constructor will be called with no parameters. + * The resulting object should usually implement getSignature(baseString). + * You can easily define such a constructor by calling makeSubclass method. + */ + registerMethodClass(names: string[], classConstructor: { new(): SignatureMethod }): void; + + /** + * Create a subclass of OAuth.SignatureMethod, with the given getSignature function. + * @param getSignatureFunction + */ + makeSubclass(getSignatureFunction: (baseString: string) => string): { new(): SignatureMethod }; + + /** + * Generate a signature base string from a Message object. + * @see {@link https://tools.ietf.org/html/rfc5849#section-3.4.1} + * @param message Source of the signature base string. + */ + getBaseString(message: Message): string; + + normalizeUrl(url: string): string; + + parseUri(str: string): Uri; + + normalizeParameters(parameters: ParameterListOrMap): string; + } + + interface SignatureMethod { + getSignature(baseString: string): string; + + key: string; + + /** Add a signature to the message. */ + sign(message: Message): string; + + /** Set the key string for signing. */ + initialize(name: string, accessor: Accessor): void; + } + + var SignatureMethod: SignatureMethodStatic; + +} + diff --git a/parallel/parallel.d.ts b/parallel/parallel.d.ts index 049ecda7d9..8d880f6984 100644 --- a/parallel/parallel.d.ts +++ b/parallel/parallel.d.ts @@ -102,3 +102,7 @@ declare class Parallel { public require(fn: Function): Parallel; } +/* commonjs binding for npm use */ +declare module "paralleljs" { + export = Parallel; +} \ No newline at end of file diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index 54fce3ada5..caf0fa8e0a 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -234,6 +234,10 @@ declare module "react/addons" { type: string; } + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -308,6 +312,7 @@ declare module "react/addons" { (event: E): void; } + interface DragEventHandler extends EventHandler {} interface ClipboardEventHandler extends EventHandler {} interface KeyboardEventHandler extends EventHandler {} interface FocusEventHandler extends EventHandler {} @@ -341,14 +346,14 @@ declare module "react/addons" { onSubmit?: FormEventHandler; onClick?: MouseEventHandler; onDoubleClick?: MouseEventHandler; - onDrag?: MouseEventHandler; - onDragEnd?: MouseEventHandler; - onDragEnter?: MouseEventHandler; - onDragExit?: MouseEventHandler; - onDragLeave?: MouseEventHandler; - onDragOver?: MouseEventHandler; - onDragStart?: MouseEventHandler; - onDrop?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; onMouseDown?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; diff --git a/react/react-global.d.ts b/react/react-global.d.ts index f7b7859d4b..c3fa9fc7cd 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -234,6 +234,10 @@ declare module React { type: string; } + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -308,6 +312,7 @@ declare module React { (event: E): void; } + interface DragEventHandler extends EventHandler {} interface ClipboardEventHandler extends EventHandler {} interface KeyboardEventHandler extends EventHandler {} interface FocusEventHandler extends EventHandler {} @@ -341,14 +346,14 @@ declare module React { onSubmit?: FormEventHandler; onClick?: MouseEventHandler; onDoubleClick?: MouseEventHandler; - onDrag?: MouseEventHandler; - onDragEnd?: MouseEventHandler; - onDragEnter?: MouseEventHandler; - onDragExit?: MouseEventHandler; - onDragLeave?: MouseEventHandler; - onDragOver?: MouseEventHandler; - onDragStart?: MouseEventHandler; - onDrop?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; onMouseDown?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; diff --git a/react/react.d.ts b/react/react.d.ts index 64796ddf44..d92279305d 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -234,6 +234,10 @@ declare module "react" { type: string; } + interface DragEvent extends SyntheticEvent { + dataTransfer: DataTransfer; + } + interface ClipboardEvent extends SyntheticEvent { clipboardData: DataTransfer; } @@ -308,6 +312,7 @@ declare module "react" { (event: E): void; } + interface DragEventHandler extends EventHandler {} interface ClipboardEventHandler extends EventHandler {} interface KeyboardEventHandler extends EventHandler {} interface FocusEventHandler extends EventHandler {} @@ -341,14 +346,14 @@ declare module "react" { onSubmit?: FormEventHandler; onClick?: MouseEventHandler; onDoubleClick?: MouseEventHandler; - onDrag?: MouseEventHandler; - onDragEnd?: MouseEventHandler; - onDragEnter?: MouseEventHandler; - onDragExit?: MouseEventHandler; - onDragLeave?: MouseEventHandler; - onDragOver?: MouseEventHandler; - onDragStart?: MouseEventHandler; - onDrop?: MouseEventHandler; + onDrag?: DragEventHandler; + onDragEnd?: DragEventHandler; + onDragEnter?: DragEventHandler; + onDragExit?: DragEventHandler; + onDragLeave?: DragEventHandler; + onDragOver?: DragEventHandler; + onDragStart?: DragEventHandler; + onDrop?: DragEventHandler; onMouseDown?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index c2013f6c49..f2388fc129 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -15,7 +15,7 @@ declare module restangular { $object: T; } - interface ICollectionPromise extends ng.IPromise { + interface ICollectionPromise extends ng.IPromise { push(object: any): ICollectionPromise; call(methodName: string, params?: any): ICollectionPromise; get(fieldName: string): ICollectionPromise; @@ -93,7 +93,7 @@ declare module restangular { withConfig(configurer: (RestangularProvider: IProvider) => any): IService; restangularizeElement(parent: any, element: any, route: string, collection?: any, reqParams?: any): IElement; restangularizeCollection(parent: any, element: any, route: string): ICollection; - service(route: string, parent: any): IService; + service(route: string, parent?: any): IService; stripRestangular(element: any): any; } @@ -114,6 +114,7 @@ declare module restangular { patch(queryParams?: any, headers?: any): IPromise; clone(): IElement; plain(): any; + plain(): T; withHttpConfig(httpConfig: IRequestConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; @@ -130,6 +131,9 @@ declare module restangular { patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; withHttpConfig(httpConfig: IRequestConfig): ICollection; + clone(): ICollection; + plain(): any; + plain(): T[]; getRestangularUrl(): string; } } diff --git a/restify/restify-tests.ts b/restify/restify-tests.ts index 3ff16da556..3e0697c1d4 100644 --- a/restify/restify-tests.ts +++ b/restify/restify-tests.ts @@ -99,23 +99,117 @@ server.del( /(.*)/, send); server.get( /(.*)/, send); server.head(/(.*)/, send); -new restify.ConflictError("test"); -new restify.InvalidArgumentError("message"); -new restify.RestError("message"); -new restify.BadDigestError("message"); -new restify.BadMethodError("message"); -new restify.BadRequestError('test'); -new restify.InternalError("message"); -new restify.InvalidContentError("message"); -new restify.InvalidCredentialsError("message"); -new restify.InvalidHeaderError("message"); -new restify.InvalidVersionError("message"); -new restify.MissingParameterError("message"); -new restify.NotAuthorizedError("message"); -new restify.RequestExpiredError("jjmessage"); -new restify.RequestThrottledError("message"); -new restify.ResourceNotFoundError("message"); -new restify.WrongAcceptError("message"); + +new restify.BadRequestError(); +new restify.UnauthorizedError(); +new restify.PaymentRequiredError(); +new restify.ForbiddenError(); +new restify.NotFoundError(); +new restify.MethodNotAllowedError(); +new restify.NotAcceptableError(); +new restify.ProxyAuthenticationRequiredError(); +new restify.RequestTimeoutError(); +new restify.ConflictError(); +new restify.GoneError(); +new restify.LengthRequiredError(); +new restify.RequestEntityTooLargeError(); +new restify.RequesturiTooLargeError(); +new restify.UnsupportedMediaTypeError(); +new restify.RequestedRangeNotSatisfiableError(); +new restify.ExpectationFailedError(); +new restify.ImATeapotError(); +new restify.UnprocessableEntityError(); +new restify.LockedError(); +new restify.FailedDependencyError(); +new restify.UnorderedCollectionError(); +new restify.UpgradeRequiredError(); +new restify.PreconditionRequiredError(); +new restify.TooManyRequestsError(); +new restify.RequestHeaderFieldsTooLargeError(); +new restify.InternalServerError(); +new restify.NotImplementedError(); +new restify.BadGatewayError(); +new restify.ServiceUnavailableError(); +new restify.GatewayTimeoutError(); +new restify.HttpVersionNotSupportedError(); +new restify.VariantAlsoNegotiatesError(); +new restify.InsufficientStorageError(); +new restify.BandwidthLimitExceededError(); +new restify.NotExtendedError(); +new restify.NetworkAuthenticationRequiredError(); +new restify.RestError(); + +new restify.BadRequestError(new Error(), 'foo'); +new restify.UnauthorizedError(new Error(), 'foo'); +new restify.PaymentRequiredError(new Error(), 'foo'); +new restify.ForbiddenError(new Error(), 'foo'); +new restify.NotFoundError(new Error(), 'foo'); +new restify.MethodNotAllowedError(new Error(), 'foo'); +new restify.NotAcceptableError(new Error(), 'foo'); +new restify.ProxyAuthenticationRequiredError(new Error(), 'foo'); +new restify.RequestTimeoutError(new Error(), 'foo'); +new restify.ConflictError(new Error(), 'foo'); +new restify.GoneError(new Error(), 'foo'); +new restify.LengthRequiredError(new Error(), 'foo'); +new restify.RequestEntityTooLargeError(new Error(), 'foo'); +new restify.RequesturiTooLargeError(new Error(), 'foo'); +new restify.UnsupportedMediaTypeError(new Error(), 'foo'); +new restify.RequestedRangeNotSatisfiableError(new Error(), 'foo'); +new restify.ExpectationFailedError(new Error(), 'foo'); +new restify.ImATeapotError(new Error(), 'foo'); +new restify.UnprocessableEntityError(new Error(), 'foo'); +new restify.LockedError(new Error(), 'foo'); +new restify.FailedDependencyError(new Error(), 'foo'); +new restify.UnorderedCollectionError(new Error(), 'foo'); +new restify.UpgradeRequiredError(new Error(), 'foo'); +new restify.PreconditionRequiredError(new Error(), 'foo'); +new restify.TooManyRequestsError(new Error(), 'foo'); +new restify.RequestHeaderFieldsTooLargeError(new Error(), 'foo'); +new restify.InternalServerError(new Error(), 'foo'); +new restify.NotImplementedError(new Error(), 'foo'); +new restify.BadGatewayError(new Error(), 'foo'); +new restify.ServiceUnavailableError(new Error(), 'foo'); +new restify.GatewayTimeoutError(new Error(), 'foo'); +new restify.HttpVersionNotSupportedError(new Error(), 'foo'); +new restify.VariantAlsoNegotiatesError(new Error(), 'foo'); +new restify.InsufficientStorageError(new Error(), 'foo'); +new restify.BandwidthLimitExceededError(new Error(), 'foo'); +new restify.NotExtendedError(new Error(), 'foo'); +new restify.NetworkAuthenticationRequiredError(new Error(), 'foo'); +new restify.RestError(new Error(), 'foo'); + +new restify.PreconditionFailedError(new Error(), 'foo'); +new restify.BadDigestError(new Error(), 'foo'); +new restify.BadMethodError(new Error(), 'foo'); +new restify.InternalError(new Error(), 'foo'); +new restify.InvalidArgumentError(new Error(), 'foo'); +new restify.InvalidContentError(new Error(), 'foo'); +new restify.InvalidCredentialsError(new Error(), 'foo'); +new restify.InvalidHeaderError(new Error(), 'foo'); +new restify.InvalidVersionError(new Error(), 'foo'); +new restify.MissingParameterError(new Error(), 'foo'); +new restify.NotAuthorizedError(new Error(), 'foo'); +new restify.RequestExpiredError(new Error(), 'foo'); +new restify.RequestThrottledError(new Error(), 'foo'); +new restify.ResourceNotFoundError(new Error(), 'foo'); +new restify.WrongAcceptError(new Error(), 'foo'); + +new restify.PreconditionFailedError(); +new restify.BadDigestError(); +new restify.BadMethodError(); +new restify.InternalError(); +new restify.InvalidArgumentError(); +new restify.InvalidContentError(); +new restify.InvalidCredentialsError(); +new restify.InvalidHeaderError(); +new restify.InvalidVersionError(); +new restify.MissingParameterError(); +new restify.NotAuthorizedError(); +new restify.RequestExpiredError(); +new restify.RequestThrottledError(); +new restify.ResourceNotFoundError(); +new restify.WrongAcceptError(); + server.name = ""; server.version = ""; diff --git a/restify/restify.d.ts b/restify/restify.d.ts index e890ef2b2e..596637f23c 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -179,25 +179,68 @@ declare module "restify" { export function createStringClient(options?: ClientOptions): Client; export function createClient(options?: ClientOptions): HttpClient; - export class ConflictError { constructor(message?: any); } - export class InvalidArgumentError { constructor(message?: any); } - export class RestError { constructor(message?: any); } - export class BadDigestError { constructor(message: any); } - export class BadMethodError { constructor(message: any); } - export class BadRequestError { constructor(message: any); } - export class InternalError { constructor(message: any); } - export class InvalidContentError { constructor(message: any); } - export class InvalidCredentialsError { constructor(message: any); } - export class InvalidHeaderError { constructor(message: any); } - export class InvalidVersionError { constructor(message: any); } - export class MissingParameterError { constructor(message: any); } - export class NotAuthorizedError { constructor(message: any); } - export class RequestExpiredError { constructor(message: any); } - export class RequestThrottledError { constructor(message: any); } - export class ResourceNotFoundError { constructor(message: any); } - export class WrongAcceptError { constructor(message: any); } - export class UnsupportedMediaTypeError { constructor(message: any); } - export class RequestTimeoutError { constructor(message: any); } + export class HttpError { constructor(cause: any, message?: any); } + + class DefiniteHttpError { + constructor(message?: any); + constructor(cause: any, message?: any); + } + + export class BadRequestError extends DefiniteHttpError {} + export class UnauthorizedError extends DefiniteHttpError {} + export class PaymentRequiredError extends DefiniteHttpError {} + export class ForbiddenError extends DefiniteHttpError {} + export class NotFoundError extends DefiniteHttpError {} + export class MethodNotAllowedError extends DefiniteHttpError {} + export class NotAcceptableError extends DefiniteHttpError {} + export class ProxyAuthenticationRequiredError extends DefiniteHttpError {} + export class RequestTimeoutError extends DefiniteHttpError {} + export class ConflictError extends DefiniteHttpError {} + export class GoneError extends DefiniteHttpError {} + export class LengthRequiredError extends DefiniteHttpError {} + export class RequestEntityTooLargeError extends DefiniteHttpError {} + export class RequesturiTooLargeError extends DefiniteHttpError {} + export class UnsupportedMediaTypeError extends DefiniteHttpError {} + export class RequestedRangeNotSatisfiableError extends DefiniteHttpError {} + export class ExpectationFailedError extends DefiniteHttpError {} + export class ImATeapotError extends DefiniteHttpError {} + export class UnprocessableEntityError extends DefiniteHttpError {} + export class LockedError extends DefiniteHttpError {} + export class FailedDependencyError extends DefiniteHttpError {} + export class UnorderedCollectionError extends DefiniteHttpError {} + export class UpgradeRequiredError extends DefiniteHttpError {} + export class PreconditionRequiredError extends DefiniteHttpError {} + export class TooManyRequestsError extends DefiniteHttpError {} + export class RequestHeaderFieldsTooLargeError extends DefiniteHttpError {} + export class InternalServerError extends DefiniteHttpError {} + export class NotImplementedError extends DefiniteHttpError {} + export class BadGatewayError extends DefiniteHttpError {} + export class ServiceUnavailableError extends DefiniteHttpError {} + export class GatewayTimeoutError extends DefiniteHttpError {} + export class HttpVersionNotSupportedError extends DefiniteHttpError {} + export class VariantAlsoNegotiatesError extends DefiniteHttpError {} + export class InsufficientStorageError extends DefiniteHttpError {} + export class BandwidthLimitExceededError extends DefiniteHttpError {} + export class NotExtendedError extends DefiniteHttpError {} + export class NetworkAuthenticationRequiredError extends DefiniteHttpError {} + export class RestError extends DefiniteHttpError {} + + export class PreconditionFailedError extends RestError {} + export class BadDigestError extends RestError {} + export class BadMethodError extends RestError {} + export class InternalError extends RestError {} + export class InvalidArgumentError extends RestError {} + export class InvalidContentError extends RestError {} + export class InvalidCredentialsError extends RestError {} + export class InvalidHeaderError extends RestError {} + export class InvalidVersionError extends RestError {} + export class MissingParameterError extends RestError {} + export class NotAuthorizedError extends RestError {} + export class RequestExpiredError extends RestError {} + export class RequestThrottledError extends RestError {} + export class ResourceNotFoundError extends RestError {} + export class WrongAcceptError extends RestError {} + export function acceptParser(parser: any): RequestHandler; export function authorizationParser(): RequestHandler; diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 0bbfe3f6d5..8766745b80 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -101,6 +101,8 @@ model.belongsTo(model); model.belongsTo(model, assocOpts); model.hasMany(model); model.hasMany(model, assocOpts); +model.belongsToMany(model); +model.belongsToMany(model, assocOpts); promiseMe = model.sync(); promiseMe = model.drop(dropOpts); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 08eb472724..85d473f28d 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -909,6 +909,14 @@ declare module "sequelize" */ belongsTo(target: Model, options?: AssociationOptions): void; + /** + * Creates an association to connect sources with multiple targets. Furthermore the targets can also have connections to multiple sources. + * + * @param target + * @param options + */ + belongsToMany(target: Model, options?: AssociationOptions): void; + /** * Create an association that is either 1:m or n:m. * diff --git a/sprintf-js/sprintf-js.d.ts b/sprintf-js/sprintf-js.d.ts new file mode 100644 index 0000000000..fba1925b6c --- /dev/null +++ b/sprintf-js/sprintf-js.d.ts @@ -0,0 +1,71 @@ +// Type definitions for sprintf-js +// Project: https://www.npmjs.com/package/sprintf-js +// Definitions by: Jason Swearingen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/** sprintf.js is a complete open source JavaScript sprintf implementation for the browser and node.js. + +Its prototype is simple: + +string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) +*/ +declare module "sprintf-js" { + /** sprintf.js is a complete open source JavaScript sprintf implementation for the browser and node.js. +Its prototype is simple: + string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]]) + +==Placeholders== + The placeholders in the format string are marked by % and are followed by one or more of these elements. see "fmt" arg for more docs on placeholders. + +==Argument swapping== +You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to: + sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants") + And, of course, you can repeat the placeholders without having to increase the number of arguments. + +==Named arguments== +Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - ( and ) - and begin with a keyword that refers to a key: + var user = {name: "Dolly"} + sprintf("Hello %(name)s", user) // Hello Dolly +Keywords in replacement fields can be optionally followed by any number of keywords or indexes: + var users = [{name: "Dolly"},{name: "Molly"},{name: "Polly"}] + sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly +Note: mixing positional and named placeholders is not (yet) supported + +==Computed values== +You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly. + sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890 + sprintf("Current date and time: %s", function() { return new Date().toString() }) + */ + export function sprintf( + /** The placeholders in the format string are marked by % and are followed by one or more of these elements, in this order: + +An optional number followed by a $ sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string. +An optional + sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the - sign is used on negative numbers. +An optional padding specifier that says what character to use for padding (if specified). Possible values are 0 or any other character precedeed by a ' (single quote). The default is to pad with spaces. +An optional - sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result. +An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. +An optional precision modifier, consisting of a . (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used on a string, it causes the result to be truncated. +A type specifier that can be any of: +% - yields a literal % character +b - yields an integer as a binary number +c - yields an integer as the character with that ASCII value +d or i - yields an integer as a signed decimal number +e - yields a float using scientific notation +u - yields an integer as an unsigned decimal number +f - yields a float as is +o - yields an integer as an octal number +s - yields a string as is +x - yields an integer as a hexadecimal number (lower-case) +X - yields an integer as a hexadecimal number (upper-case) + */ + fmt: string, + /** */ + ...args: any[] + ): string; + /** vsprintf is the same as sprintf except that it accepts an array of arguments, rather than a variable number of arguments: + + vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"]) +*/ + export function vsprintf(fmt: string, args: any[]): string; +} diff --git a/sprintf-js/sprintf-tests.ts b/sprintf-js/sprintf-tests.ts new file mode 100644 index 0000000000..ba48ccab79 --- /dev/null +++ b/sprintf-js/sprintf-tests.ts @@ -0,0 +1,14 @@ +/// + +import sprintf = require('sprintf-js'); + +var str: string; +var num: number; + +sprintf.sprintf(str, str); +sprintf.sprintf(str, str, num); +sprintf.sprintf(str, num, str); + +sprintf.vsprintf(str, [str]); +sprintf.vsprintf(str, [str, num]); +sprintf.vsprintf(str, [num, str]); diff --git a/threejs/three.d.ts b/threejs/three.d.ts index a9255f3b5e..7c4aca5920 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4151,13 +4151,13 @@ declare module THREE { } export class SkinnedMesh extends Mesh { - constructor(geometry?: Geometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: ShaderMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: ShaderMaterial, useVertexTexture?: boolean); bindMode: string; bindMatrix: Matrix4; @@ -4517,6 +4517,7 @@ declare module THREE { generateMipmaps: boolean; shareDepthFrom: any; + setSize(width: number, height: number): void; clone(): WebGLRenderTarget; dispose(): void; diff --git a/twix/twix-tests.ts b/twix/twix-tests.ts new file mode 100644 index 0000000000..bc0ef9ae1e --- /dev/null +++ b/twix/twix-tests.ts @@ -0,0 +1,225 @@ +/// + +var someMoment = moment("20111031", "YYYYMMDD"); +var otherMoment = moment("20120620", "YYYYMMDD"); +var startTime = moment('20120701'); +var endTime = moment('20120801'); + +someMoment.twix(otherMoment); +someMoment.twix('2012-05-25'); +someMoment.twix({ year: 2012, month: 5, day: 25 }); +someMoment.twix("05/25/1982", "MM/DD/YYYY", { parseStrict: true }); + +someMoment.twix(otherMoment, "MM/DD/YYYY", { parseStrict: true }); + +var range = moment(someMoment).twix(otherMoment); +var range2 = moment.twix(someMoment, otherMoment); +var range3 = someMoment.twix(otherMoment); + +moment('1982-05-25').twix('1982-05-26', { allDay: true }); + +moment('1982-05-25').twix('1982-05-26', true); + +moment().twix(moment()).isValid(); //=> true +moment().twix(moment().add(1, "day")).isValid(); //=> true +moment().twix(moment().subtract(1, "day")).isValid(); //=> false + +moment("1982-05-25T05:00").twix("1982-05-26T06:00").isSame("day"); //=> false +moment("1982-05-25T05:00").twix("1982-05-25T06:00").isSame("day"); //=> true +moment("1982-05-25T05:00").twix("1982-05-25T06:00").isSame("year"); //=> true + +moment("1982-05-25").twix("1982-05-26").isPast(); //=> true + +moment("2054-05-25").twix("2054-05-26").isFuture(); //=> true + +moment("2054-05-25").twix(moment().add(1, "hour")).isCurrent(); //=> true + +moment("1982-05-25").twix("1982-05-28").contains("1982-05-26"); //=> true + +moment("1982-05-25T5:30").twix("1982-05-25T6:30").length("hours") //=> 1 +moment("1982-05-25T5:00").twix("1982-05-30T6:00").length("days") //=> 6 + +moment("1982-05-25T5:00").twix("1982-05-25T6:00").count("days") //=> 1 +moment("1982-05-25T5:00").twix("1982-05-26T6:00").count("days") //=> 2 + +moment("1982-05-25T5:00").twix("1982-05-25T6:00").countInner("days") //=> 0 +moment("1982-05-24T5:00").twix("1982-05-26T6:00").countInner("days") //=> 1 + +var iter = moment("1982-05-25T5:00").twix("1982-05-26T6:00").iterate("days"); +iter.hasNext(); //=> true +iter.next(); //=> moment("1982-05-25") +iter.next(); //=> moment("1982-05-26") +iter.hasNext(); //=> false +iter.next(); //=> null + +var iter = moment("16", "hh").twix("1982-05-26T6:00").iterate(2, 'hours'); +iter.next().format('LT'); //=> '4:00 PM' +iter.next().format('LT'); //=> '6:00 PM' + +var duration = moment.duration({ hours: 2, minutes: 30, seconds: 20 }); +var iter = moment("16", "hh").twix(someMoment).iterate(duration); +iter.next().format('LT'); //=> '4:00 PM' +iter.next().format('LT'); //=> '6:30 PM' +iter.next().format('LT'); //=> '9:00 PM' + +var iter2 = moment("1982-05-24T5:00").twix("1982-05-27T6:00").iterateInner("days"); +iter.hasNext(); //=> true +iter.next(); //=> moment("1982-05-25") +iter.next(); //=> moment("1982-05-26") +iter.hasNext(); //=> false +iter.next(); //=> null + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.overlaps(range2); //=> true + +var range1 = moment("1982-05-25").twix("1982-08-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.engulfs(range2); //=> true +range2.engulfs(range1); //=> false + +var range1 = moment("1982-05-25").twix("1982-08-30"); +var range2 = moment("1982-05-25").twix("1982-08-30"); + +range1.equals(range2); //=> true +range2.equals(range1); //=> true + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.union(range2); //=> 5/25/82 - 6/13/1982 + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.intersection(range2); //=> 5/27/82 - 5/30/1982 + +var range1 = moment("1982-05-24").twix("1982-05-28", true); +var range2 = moment("1982-05-22").twix("1982-05-26", true); +var xorred = range1.xor(range2); + +xorred[0].format() //=> 'May 22 - 23, 1982' +xorred[1].format() //=> 'May 27 - 28, 1982' + +var range1 = moment("1982-05-23").twix("1982-05-28", true); +var range2 = moment("1982-05-25").twix("1982-05-26", true); +var diff = range1.difference(range2); + +diff[0].format(); //=> 'May 23 - 24, 1982' +diff[1].format(); //=> 'May 27 - 28, 1982' + +var range = moment("1982-05-25T05:01").twix("1982-05-25T07:30"); + +var splits = range.split(1, "hour"); +splits[0].format({ showDate: false }); //=> '5:01 - 6:01 AM' +splits[1].format({ showDate: false }); //=> '6:01 - 7:01 AM' +splits[2].format({ showDate: false }); //=> '7:01 - 7:30 AM' + +//other signatures +range.split(moment.duration({ "h": 1 })).length; //=> 3 +range.split(moment("1982-05-25T06:00")).length; //=> 2 +range.split(moment("1982-05-25T06:00"), moment("1982-05-25T07:00")).length; //=> 3 + +var d = moment.duration(2, "days"); +var range4 = d.afterMoment("1982-05-25"); //=> 5/25/1982 - 5/27/1982 + +var d = moment.duration(2, "days"); +d.beforeMoment("1982-05-25"); //=> 5/23/1982 - 5/25/1982 + +var range = moment("1982-05-25").twix("1982-05-28"); +range.asDuration("days"); //=> duration object with {days: 3} + +var range = moment("1982-05-25T8:00").twix("1982-05-25T10:00"); +range.humanizeLength(); //=> "2 hours" + +range = moment("1982-05-25").twix("2013-01-01"); +range.humanizeLength(); //=> 31 years + +var range = moment("1982-05-25T9:00").twix("1982-05-25T12:00"); + +range.simpleFormat(); //=> '1982-05-25T09:00:00-04:00 - 1982-05-25T12:00:00-04:00' + +range.simpleFormat("ddd, hA"); //=> 'Tue, 9AM - Tue, 12PM' + +var range = moment("1982-05-25").twix("1982-05-26", { allDay: true }); + +range.simpleFormat(); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00 (all day)' +range.simpleFormat("YYYY - MM - DD"); //=> '1982-05-25 - 1982-05-26 (all day)' + +range.simpleFormat(null, { allDay: "-- all day! --" }); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00 -- all day! --' + +range.simpleFormat(null, { allDay: null }); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00' + +range.simpleFormat("HH:mm", { template: function (left, right) { return left + " | " + right; } }); //=> '16:21 | 17:21' + +moment.twixClass.formatTemplate = function (left, right) { return left + " | " + right; }; +range.simpleFormat("HH:mm"); //=> '16:29 | 17:29' + +moment("1982-01-25T09:00").twix("1982-01-25T11:00").format(); //=> 'Jan 25, 1982, 9 - 11 AM' +moment("1982-01-25T9:00").twix("1982-01-26T13:00").format(); //=> 'Jan 25, 9 AM - Jan 26, 1 PM, 1982' + +moment("2012-01-25").twix("2012-01-25", { allDay: true }).format(); //=> Jan 25 +moment("1982-01-25").twix("1982-01-25", { allDay: true }).format(); //=> Jan 25, 1982 +moment("2012-01-25").twix("2012-01-26", { allDay: true }).format(); //=> Jan 25 - 26 +moment("1982-01-25").twix("1982-02-25", { allDay: true }).format(); //=> Jan 25 - Feb 25, 1982 +moment("1982-01-25").twix(new Date(), { allDay: true }).format(); //=> Jan 25, 1982 - Jan 9, 2012 + +moment("1982-01-25T9:30").twix("1/25/1982 1:30 PM").format(); //=> Jan 25, 1982, 9:30 AM - 1:30 PM +moment("1982-01-25T9:30").twix(new Date()).format(); //=> Jan 25, 1982, 9:30 AM - Jan 9, 2012, 3:05 AM +moment("1982-01-25").twix("1982-01-27").format(); //=> Jan 25, 12 AM - Jan 27, 12 AM, 1982 + +var twix = moment("2012-05-25T9:00").twix("2012-05-25T10:00"); + +twix.format(); //=> May 25, 9 - 10 AM +twix.format({ implicitMinutes: false, groupMeridiems: false }); //=> May 25, 9:00 AM - 10:00 AM + +var twix = moment().twix(moment().add('days', 1)); +twix.format({ implicitYear: false }); //=> Mar 28, 1:13 AM - Mar 29, 1:13 AM, 2013 + +moment("2012-05-25T16:00").twix("2012-05-25T17:00").format({ twentyFourHour: true }); //=> May 25, 16:00 - 17:00 + +moment("2012-01-25T8:00").twix("2012-01-25T17:00").format({ + monthFormat: "MMMM", + dayFormat: "Do" +}); + +moment("2012-05-25T8:00").twix("2012-05-25T17:00").format({ spaceBeforeMeridiem: false }); //=> May 25, 8AM - 5PM + +moment("2012-05-25T8:00").twix("2012-05-25T17:00").format({ showDate: false }); //=> 8 AM - 5 PM + +moment("2012-01-25").twix("2012-01-25", { allDay: true }).format({ showDate: false }); //=> All day + +moment.lang("fr"); +moment().twix(moment().add(3, "month")).simpleFormat("MMMM"); //=> 'juillet - octobre' + +moment("1982-05-25").twix(moment("1982-05-27")).format(); //=> '25 mai, 0:00 - 27 mai, 0:00, 1982' + +moment("1982-05-25").twix(moment("1982-05-27")).format({ + groupMeridiems: true, + spaceBeforeMeridiem: true, + showDate: true, + showDayOfWeek: false, + twentyFourHour: false, + implicitMinutes: true, + implicitYear: true, + yearFormat: "YYYY", + monthFormat: "MMM", + weekdayFormat: "ddd", + dayFormat: "D", + meridiemFormat: "A", + hourFormat: "h", + minuteFormat: "mm", + allDay: "all day", + explicitAllDay: false, + lastNightEndsAt: 0 +}); //=> '25 mai, 0:00 - 27 mai, 0:00, 1982' + +var t = moment("1982-01-25T09:30").twix("1982-01-25T13:30"); + +t.format(); //=> Jan 25, 1982, 9:30 AM - 1:30 PM + +t.isSame("day"); //=> true +t.humanizeLength(); //=> "4 hours" +t.count("days"); //=> 1 \ No newline at end of file diff --git a/twix/twix.d.ts b/twix/twix.d.ts new file mode 100644 index 0000000000..e82df73be3 --- /dev/null +++ b/twix/twix.d.ts @@ -0,0 +1,134 @@ +// Type definitions for twix.js 0.6.3 +// Project: https://github.com/icambron/twix.js +// Definitions by: j3ko +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module moment { + interface Moment { + twix(date: Date): Twix; + twix(date: Date, allDay: boolean): Twix; + twix(date: Date, options: TwixFormatOptions): Twix; + twix(date: Date, format: string, options: TwixFormatOptions): Twix; + + twix(date: Moment): Twix; + twix(date: Moment, allDay: boolean): Twix; + twix(date: Moment, options: TwixFormatOptions): Twix; + twix(date: Moment, format: string, options: TwixFormatOptions): Twix; + + twix(date: MomentInput): Twix; + twix(date: MomentInput, allDay: boolean): Twix; + twix(date: MomentInput, options: TwixFormatOptions): Twix; + twix(date: MomentInput, format: string, options: TwixFormatOptions): Twix; + + twix(date: number): Twix; + twix(date: number, allDay: boolean): Twix; + twix(date: number, options: TwixFormatOptions): Twix; + twix(date: number, format: string, options: TwixFormatOptions): Twix; + + twix(date: number[]): Twix; + twix(date: number[], allDay: boolean): Twix; + twix(date: number[], options: TwixFormatOptions): Twix; + twix(date: number[], format: string, options: TwixFormatOptions): Twix; + + twix(date: string): Twix; + twix(date: string, allDay: boolean): Twix; + twix(date: string, options: TwixFormatOptions): Twix; + twix(date: string, format: string, options: TwixFormatOptions): Twix; + } + + interface MomentStatic { + twix(start: Moment, end: Moment): Twix; + twixClass: TwixStatic; + } + + interface TwixFormatOptions { + groupMeridiems?: boolean; + spaceBeforeMeridiem?: boolean; + showDate?: boolean; + showDayOfWeek?: boolean; + twentyFourHour?: boolean; + implicitMinutes?: boolean; + implicitYear?: boolean; + yearFormat?: string; + monthFormat?: string; + weekdayFormat?: string; + dayFormat?: string; + meridiemFormat?: string; + hourFormat?: string; + minuteFormat?: string; + allDay?: any; // boolean | string + explicitAllDay?: boolean; + lastNightEndsAt?: number; + } + + interface TwixSimpleFormatOptions { + allDay?: string; + template?: (left: any, right: any) => any; + } + + interface TwixIter { + hasNext(): boolean; + next(): Twix; + } + + interface Duration { + afterMoment(date: string): string; + beforeMoment(date: string): string; + } + + interface Twix { + isPast(): boolean; + isFuture(): boolean; + isCurrent(): boolean; + isSame(period: string): boolean; + contains(date: string): boolean; + contains(date: Date): boolean; + contains(date: Moment): boolean; + length(period: string): number; + count(period: string): number; + countInner(period: string): number; + + iterate(period: string): TwixIter; + iterate(num: number, period: string): TwixIter; + iterate(duration: Duration): TwixIter; + + iterateInner(period: string): TwixIter; + iterateInner(num: number, period: string): TwixIter; + + overlaps(other: Twix): boolean; + engulfs(other: Twix): boolean; + equals(other: Twix): boolean; + union(other: Twix): string; + intersection(other: Twix): string; + + xor(other: Twix): Twix[]; + difference(other: Twix): Twix[]; + split(num: number, period: string): Twix[]; + split(other: Moment): Twix[]; + split(start: Moment, end: Moment): Twix[]; + split(duration: Duration): Twix[]; + + humanizeLength(): string; + simpleFormat(): string; + simpleFormat(format: string): string; + simpleFormat(format: string, options: TwixSimpleFormatOptions): string; + + format(): string; + format(options: TwixFormatOptions): string; + + asDuration(period: string): Duration; + isValid(): boolean; + } + + interface TwixStatic { + formatTemplate?: (left: any, right: any) => any; + } +} + +declare module 'twix' { + var _tmp: moment.MomentStatic; + + export = _tmp; +} \ No newline at end of file diff --git a/type-name/type-name-tests.ts b/type-name/type-name-tests.ts new file mode 100644 index 0000000000..57ae32d371 --- /dev/null +++ b/type-name/type-name-tests.ts @@ -0,0 +1,5 @@ +/// + +import typeName = require("type-name"); +console.log(typeName('foo') === 'string'); +console.log(typeName([1, 2]) === 'Array'); diff --git a/type-name/type-name.d.ts b/type-name/type-name.d.ts new file mode 100644 index 0000000000..f94b96d4fe --- /dev/null +++ b/type-name/type-name.d.ts @@ -0,0 +1,11 @@ +// Type definitions for type-name v1.0.1 +// Project: https://github.com/twada/type-name/ +// Definitions by: OKUNOKENTARO +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function typeName(anyVar: any): string; +declare module typeName {} + +declare module "type-name" { + export = typeName; +} \ No newline at end of file diff --git a/uniq/uniq-tests.ts b/uniq/uniq-tests.ts new file mode 100644 index 0000000000..b9facc8e23 --- /dev/null +++ b/uniq/uniq-tests.ts @@ -0,0 +1,7 @@ +import unique = require("uniq"); +var data = [1, 2, 2, 3, 4, 5, 5, 5, 6]; +var datastr = ["1", "2", "2", "3", "4", "5", "5", "5", "6"]; +var dataMix = ["1", 2,"2", {"2":2}, "3", "4", "5", "5", "5", "6"]; +console.log(unique(data)); +console.log(unique(datastr)); +console.log(unique(dataMix)); diff --git a/uniq/uniq.d.ts b/uniq/uniq.d.ts new file mode 100644 index 0000000000..f682262c91 --- /dev/null +++ b/uniq/uniq.d.ts @@ -0,0 +1,15 @@ +// Type definitions for uniq +// Project: https://www.npmjs.com/package/uniq +// Definitions by: Hans Windhoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface Uniq{ + (ip:Array): Array; +} + +declare var uniq :Uniq; + +declare module "uniq" { +export = uniq; +}