mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-10-26 12:10:44 +08:00
Merge branch 'master' of github.com:borisyankov/DefinitelyTyped
This commit is contained in:
commit
214a2a3dca
109 files changed
+12817
-1280
No files matched your search
+17
-1
@@ -13,12 +13,15 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft))
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [angularLocalStorage](https://github.com/agrublev/angularLocalStorage) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [angular-file-upload](https://github.com/danialfarid/angular-file-upload) (by [John Reilly](https://github.com/johnnyreilly))
|
||||
* [angular-spinner](https://github.com/urish/angular-spinner) (by [Marcin Biegała](https://github.com/Biegal))
|
||||
* [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib))
|
||||
* [Angular Hotkeys](https://github.com/chieffancypants/angular-hotkeys/) (by [Jason Zhao](https://github.com/jlz27))
|
||||
* [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong))
|
||||
* [Angular Translate](http://pascalprecht.github.io/angular-translate/) (by [Michel Salib](https://github.com/michelsalib))
|
||||
* [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap) (by [Brian Surowiec](https://github.com/xt0rted))
|
||||
* [any-db](https://github.com/grncdr/node-any-db) (by [Rogier Schouten](https://github.com/rogier-schouten))
|
||||
* [any-db-transaction](https://github.com/grncdr/node-any-db-transaction) (by [Rogier Schouten](https://github.com/rogier-schouten))
|
||||
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
|
||||
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
|
||||
* [asciify](https://github.com/olizilla/asciify) (by [Alan](http://alan.norbauer.com))
|
||||
@@ -45,6 +48,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Browser Harness](https://github.com/scriby/browser-harness) (by [Chris Scribner](https://github.com/scriby))
|
||||
* [bucks](https://github.com/CyberAgent/bucks.js) (by [Shunsuke Ohtani](https://github.com/zaneli))
|
||||
* [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [CanvasJS](http://canvasjs.com) (by [Mark Overholt](https://github.com/mover5))
|
||||
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Chroma.js](https://github.com/gka/chroma.js) (by [Sebastian Brückner](https://github.com/invliD))
|
||||
@@ -85,6 +89,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Ext JS](http://www.sencha.com/products/extjs/) (by [Brian Kotek](https://github.com/brian428))
|
||||
* [Fabric.js](http://fabricjs.com/) (by [Oliver Klemencic](https://github.com/oklemencic/))
|
||||
* [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [FastClick](https://github.com/ftlabs/fastclick) (by [Shinnosuke Watanabe](https://github.com/shinnn))
|
||||
* [File API: Directories and System](http://www.w3.org/TR/file-system-api/) (by [Kon](http://phyzkit.net/))
|
||||
* [File API: Writer](http://www.w3.org/TR/file-writer-api/) (by [Kon](http://phyzkit.net/))
|
||||
* [Finch](https://github.com/stoodder/finchjs) (by [David Sichau](https://github.com/DavidSichau/))
|
||||
@@ -128,13 +133,14 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [HelloJS](http://adodson.com/hello.js) (by [Pavel Zika](https://github.com/PavelPZ))
|
||||
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
|
||||
* [Highland](http://highlandjs.org/) (by [Bart van der Schoor](https://github.com/Bartvds/))
|
||||
* [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
* [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee) and [Jeremy Hull](https://github.com/sourrust))
|
||||
* [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Html2Canvas.js](https://github.com/niklasvh/html2canvas/) (by [Richard Hepburn](https://github.com/rwhepburn))
|
||||
* [htmlparser2](https://github.com/fb55/htmlparser2/) (by [James Roland Cabresos](https://github.com/staticfunction))
|
||||
* [http-string-parser](https://github.com/apiaryio/http-string-parser) (by [MIZUNE Pine](https://github.com/pine613))
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter))
|
||||
* [i18n-node](https://github.com/mashpie/i18n-node) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Imagemagick](http://github.com/rsms/node-imagemagick) (by [Carlos Ballesteros Velasco](https://github.com/soywiz))
|
||||
@@ -212,6 +218,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [JSDeferred](http://cho45.stfuawsc.com/jsdeferred/) (by [Daisuke Mino](https://github.com/minodisk))
|
||||
* [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [JSON-Pointer](https://www.npmjs.org/package/json-pointer) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [JsRender](http://www.jsviews.com/#jsrender) (by [Kensuke MATSUZAKI](https://github.com/zakki))
|
||||
* [jStorage](http://www.jstorage.info/) (by [Danil Flores](https://github.com/dflor003/))
|
||||
* [jsTree](http://www.jstree.com/) (by [Adam Pluciński](https://github.com/adaskothebeast))
|
||||
@@ -231,6 +238,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Knockout.Rx](https://github.com/Igorbek/knockout.rx) (by [Igor Oleinikov](https://github.com/Igorbek))
|
||||
* [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig))
|
||||
* [Knockout.Viewmodel](http://coderenaissance.github.com/knockout.viewmodel/) (by [Oisin Grehan](https://github.com/oising))
|
||||
* [Knockstrap](http://faulknercs.github.io/Knockstrap/) (by [Adam Pluciński](https://github.com/adaskothebeast))
|
||||
* [ko.editables](http://romanych.github.com/ko.editables/) (by [Oisin Grehan](https://github.com/oising))
|
||||
* [KoLite](https://github.com/CodeSeven/kolite) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Lazy.js](http://danieltao.com/lazy.js/) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
@@ -274,14 +282,17 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [nock](https://github.com/pgte/nock) (by [bonnici](https://github.com/bonnici))
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
* [node_redis](https://github.com/mranney/node_redis) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [node-azure](https://github.com/Azure/azure-sdk-for-node) (by [Andrew Gaspar](https://github.com/AndrewGaspar), [Anti Veeranna](https://github.com/antiveeranna) and [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [node-ffi](https://github.com/rbranson/node-ffi) (by [Paul Loyd](https://github.com/loyd))
|
||||
* [node-form](https://github.com/rsamec/form) (by [Roman Samec](https://github.com/rsamec))
|
||||
* [node-git](https://github.com/christkv/node-git) (by [vvakame](https://github.com/vvakame))
|
||||
* [nodeunit](https://github.com/caolan/nodeunit) (by [Jeff Goddard](https://github.com/jedigo))
|
||||
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [node-tar](https://github.com/npm/node-tar) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [node-uuid](https://github.com/broofa/node-uuid) (by [Jeff May](https://github.com/jeffmay))
|
||||
* [notify.js](https://github.com/alexgibson/notify.js) (by [soundTricker](https://github.com/soundTricker))
|
||||
* [npm](https://github.com/npm/npm) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [NProgress](https://github.com/rstacruz/nprogress) (by [Judah Gabriel Himango](https://github.com/judahgabriel))
|
||||
* [Numeral.js](https://github.com/adamwdraper/Numeral-js) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [object-path](https://github.com/mariocasciaro/object-path) (by [Paulo Cesar](https://github.com/pocesar/))
|
||||
@@ -291,6 +302,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Optimist](https://github.com/substack/node-optimist) (by [Carlos Ballesteros Velasco](https://github.com/soywiz))
|
||||
* [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [passport-facebook](https://github.com/jaredhanson/passport-facebook) (by [James Roland Cabresos](https://github.com/staticfunction/))
|
||||
* [passport-local](https://github.com/jaredhanson/passport-local) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [passport-strategy](https://github.com/jaredhanson/passport-strategy) (by [Lior Mualem](https://github.com/liorm))
|
||||
* [pathwatcher](http://atom.github.io/node-pathwatcher/) (by [vvakame](https://github.com/vvakame))
|
||||
* [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
@@ -302,6 +314,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Physijs](http://chandlerprall.github.io/Physijs/) (by [gyoh_k](https://github.com/gyohk))
|
||||
* [Pickadate.js](https://github.com/amsul/pickadate.js) (by [Adi Dahiya](https://github.com/adidahiya))
|
||||
* [PixiJS](https://github.com/GoodBoyDigital/pixi.js) (by [Pedro Casaubon](https://github.com/xperiments))
|
||||
* [Platform](https://github.com/bestiejs/platform.js) (by [Jake Hickman](https://github.com/JakeH))
|
||||
* [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/))
|
||||
@@ -331,6 +344,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Selenium WebDriverJS](https://code.google.com/p/selenium/) (by [Bill Armstrong](https://github.com/BillArmstrong))
|
||||
* [Semver](https://github.com/isaacs/node-semver) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [Sencha Touch](http://www.sencha.com/products/touch/) (by [Brian Kotek](https://github.com/brian428))
|
||||
* [sendgrid](https://github.com/sendgrid/sendgrid-nodejs) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [SharePoint](http://sptypescript.codeplex.com) (by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru) and [Andrey Markeev](http://markeev.com))
|
||||
* [ShellJS](http://shelljs.org) (by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
* [Showdown](https://github.com/coreyti/showdown) (by [Chris Bowdon](https://github.com/cbowdon))
|
||||
@@ -349,9 +363,11 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [source-map](https://github.com/mozilla/source-map) (by [Morten Houston Ludvigsen](https://github.com/MortenHoustonLudvigsen))
|
||||
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [sqlite3](https://github.com/mapbox/node-sqlite3) (by [Nick Malaguti](https://github.com/nmalaguti))
|
||||
* [stampit](https://github.com/ericelliott/stampit) (by [Vasyl Boroviak](https://github.com/koresar))
|
||||
* [status-bar](https://github.com/atom/status-bar) (by [vvakame](https://github.com/vvakame))
|
||||
* [stripe](https://stripe.com/) (by [Eric J. Smith](https://github.com/ejsmith/))
|
||||
* [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [stylus](https://github.com/LearnBoost/stylus) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Swiper](http://www.idangero.us/sliders/swiper) (by [Sebastián Galiano](https://github.com/sgaliano))
|
||||
* [SwipeView](http://cubiq.org/swipeview) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/// <reference path="angular-file-upload.d.ts" />
|
||||
|
||||
module controllers {
|
||||
|
||||
"use strict";
|
||||
|
||||
var controllerId = "upload";
|
||||
|
||||
class Upload {
|
||||
|
||||
static $inject = ["$upload"];
|
||||
constructor(
|
||||
private $upload: ng.angularFileUpload.IUploadService
|
||||
) {
|
||||
}
|
||||
|
||||
onFileSelect($files: File[]) {
|
||||
//$files: an array of files selected, each file has name, size, and type.
|
||||
var uploads: ng.IPromise<any>[] = [];
|
||||
for (var i = 0; i < $files.length; i++) {
|
||||
var file = $files[i];
|
||||
uploads.push(this.$upload.upload<any>({
|
||||
url: "/api/upload",
|
||||
method: "POST",
|
||||
data: {
|
||||
extraData: {
|
||||
fileName: file.name, test: "anything"
|
||||
}
|
||||
},
|
||||
file: file
|
||||
})
|
||||
.progress((evt: any) => {
|
||||
console.log('progress');
|
||||
})
|
||||
.then(success => {
|
||||
// file is uploaded successfully
|
||||
console.log(success.data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module("app").controller(controllerId, Upload);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for Angular File Upload 1.6.7
|
||||
// Project: https://github.com/danialfarid/angular-file-upload
|
||||
// Definitions by: John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ng.angularFileUpload {
|
||||
|
||||
interface IUploadService {
|
||||
|
||||
http<T>(config: IFileUploadConfig): IUploadPromise<T>;
|
||||
upload<T>(config: IFileUploadConfig): IUploadPromise<T>;
|
||||
}
|
||||
|
||||
interface IUploadPromise<T> extends IHttpPromise<T> {
|
||||
|
||||
progress(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
|
||||
}
|
||||
|
||||
interface IFileUploadConfig extends ng.IRequestConfig {
|
||||
|
||||
file: File;
|
||||
fileName?: string;
|
||||
}
|
||||
}
|
||||
+7
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Translate (pascalprecht.translate module)
|
||||
// Type definitions for Angular Translate v2.4.0 (pascalprecht.translate module)
|
||||
// Project: https://github.com/PascalPrecht/angular-translate
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -42,7 +42,7 @@ declare module ng.translate {
|
||||
instant(translationId: string, interpolateParams?: any, interpolationId?: string): string;
|
||||
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string };
|
||||
isPostCompilingEnabled(): boolean;
|
||||
preferredLanguage(): string;
|
||||
preferredLanguage(langKey?: string): string;
|
||||
proposedLanguage(): string;
|
||||
refresh(langKey?: string): ng.IPromise<void>;
|
||||
storage(): IStorage;
|
||||
@@ -50,6 +50,8 @@ declare module ng.translate {
|
||||
use(): string;
|
||||
use(key: string): ng.IPromise<string>;
|
||||
useFallbackLanguage(langKey?: string): void;
|
||||
versionInfo(): string;
|
||||
loaderCache(): any;
|
||||
}
|
||||
|
||||
interface ITranslateProvider extends ng.IServiceProvider {
|
||||
@@ -61,14 +63,14 @@ declare module ng.translate {
|
||||
useMessageFormatInterpolation(): ITranslateProvider;
|
||||
useInterpolation(factory: string): ITranslateProvider;
|
||||
useSanitizeValueStrategy(value: string): ITranslateProvider;
|
||||
preferredLanguage(): string;
|
||||
preferredLanguage(): ITranslateProvider;
|
||||
preferredLanguage(language: string): ITranslateProvider;
|
||||
translationNotFoundIndicator(indicator: string): ITranslateProvider;
|
||||
translationNotFoundIndicatorLeft(): string;
|
||||
translationNotFoundIndicatorLeft(indicator: string): ITranslateProvider;
|
||||
translationNotFoundIndicatorRight(): string;
|
||||
translationNotFoundIndicatorRight(indicator: string): ITranslateProvider;
|
||||
fallbackLanguage(): string;
|
||||
fallbackLanguage(): ITranslateProvider;
|
||||
fallbackLanguage(language: string): ITranslateProvider;
|
||||
fallbackLanguage(languages: string[]): ITranslateProvider;
|
||||
use(): string;
|
||||
@@ -89,5 +91,6 @@ declare module ng.translate {
|
||||
determinePreferredLanguage(fn?: () => void): ITranslateProvider;
|
||||
registerAvailableLanguageKeys(): string[];
|
||||
registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider;
|
||||
useLoaderCache(cache?: any): ITranslateProvider;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -75,7 +75,7 @@ declare module ng.route {
|
||||
* - key - {string}: a name of a dependency to be injected into the controller.
|
||||
* - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead.
|
||||
*/
|
||||
resolve?: any;
|
||||
resolve?: {[key: string]: any};
|
||||
/**
|
||||
* {(string|function())=}
|
||||
* Value to update $location path with and trigger route redirection.
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
/// <reference path="../any-db/any-db.d.ts" />
|
||||
/// <reference path="any-db-transaction.d.ts" />
|
||||
|
||||
"use strict";
|
||||
|
||||
import anyDB = require("any-db");
|
||||
import begin = require("any-db-transaction");
|
||||
|
||||
var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb");
|
||||
|
||||
|
||||
var transaction = begin(conn);
|
||||
var transaction2 = begin(transaction);
|
||||
|
||||
begin(conn, { autoRollback: true });
|
||||
begin(conn, (error: Error, result: begin.Transaction): void => {
|
||||
});
|
||||
|
||||
transaction.query("SELECT * FROM MyTable");
|
||||
|
||||
transaction.commit();
|
||||
transaction.commit((error: Error): void => {
|
||||
});
|
||||
|
||||
transaction.rollback();
|
||||
transaction.rollback((error: Error): void => {
|
||||
});
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
// Type definitions for any-db-transaction 2.2.1
|
||||
// Project: https://github.com/grncdr/node-any-db-transaction
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../any-db/any-db.d.ts" />
|
||||
|
||||
declare module "any-db-transaction" {
|
||||
import anyDB = require("any-db");
|
||||
|
||||
module begin {
|
||||
/**
|
||||
* Transaction objects are are simple wrappers around a Connection that also implement the Queryable API,
|
||||
* but guarantee that all queries take place within a single database transaction or not at all. Note that
|
||||
* begin also understands how to acquire (and release) a connection from a ConnectionPool as well, so you
|
||||
* can simply pass a pool to it: var tx = begin(pool)
|
||||
*
|
||||
* By default, any queries that error during a transaction will cause an automatic rollback. If a query has
|
||||
* no callback, the transaction will also handle (and re-emit) 'error' events for the Query instance.
|
||||
* This enables handling errors for an entire transaction in a single place.
|
||||
*
|
||||
* Transactions may also be nested by passing a Transaction to begin and these nested transactions can
|
||||
* safely error and rollback without rolling back their parent transaction
|
||||
*
|
||||
* Transaction events:
|
||||
* 'query', query - emitted immediately after .query is called on a connection via tx.query. The argument is a query object.
|
||||
* 'commit:start' - Emitted when .commit() is called.
|
||||
* 'commit:complete' - Emitted after the transaction has committed.
|
||||
* 'rollback:start' - Emitted when .rollback() is called.
|
||||
* 'rollback:complete' - Emitted after the transaction has rolled back.
|
||||
* 'close' - Emitted after rollback or commit completes.
|
||||
* 'error', err - Emitted under three conditions:
|
||||
* There was an error acquiring a connection.
|
||||
* Any query performed in this transaction emits an error that would otherwise go unhandled.
|
||||
* Any of query, begin, commit, or rollback are called after the connection has already been committed or rolled back.
|
||||
* Note that the 'error' event may be emitted multiple times! depending on the callback you are registering, you way want to wrap it using [once][].
|
||||
*/
|
||||
interface Transaction extends anyDB.Queryable {
|
||||
|
||||
/**
|
||||
* Issue a COMMIT (or RELEASE ... in the case of nested transactions) statement to the database.
|
||||
* If a continuation is provided it will be called (possibly with an error) after the COMMIT
|
||||
* statement completes. The transaction object itself will be unusable after calling commit().
|
||||
*/
|
||||
commit(callback?: (error: Error) => void): void;
|
||||
|
||||
/**
|
||||
* The same as Transaction.commit but issues a ROLLBACK. Again, the transaction will be unusable after calling this method.
|
||||
*/
|
||||
rollback(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
interface TransactionOptions {
|
||||
/**
|
||||
* Adapter name e.g. 'mysql'
|
||||
*/
|
||||
adapter?: anyDB.Adapter;
|
||||
/**
|
||||
* SQL statement for beginning a transaction, default 'BEGIN'
|
||||
*/
|
||||
begin?: string;
|
||||
/**
|
||||
* SQL statement for committing a transaction, default 'COMMIT'
|
||||
*/
|
||||
commit?: string;
|
||||
/**
|
||||
* SQL statement for rolling back a transaction, default 'ROLLBACK'
|
||||
*/
|
||||
rollback?: string;
|
||||
/**
|
||||
* Callback for transaction
|
||||
*/
|
||||
callback?: (error: Error, transaction: Transaction) => void;
|
||||
/**
|
||||
* Rollback automatically on error, default true
|
||||
*/
|
||||
autoRollback?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a transaction
|
||||
*/
|
||||
function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
function begin(q: anyDB.Queryable, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
function begin(q: anyDB.Queryable, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
function begin(q: anyDB.Queryable, options?: begin.TransactionOptions, beginStatement?: string, callback?: (error: Error, transaction: begin.Transaction) => void): begin.Transaction;
|
||||
|
||||
export = begin;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
/// <reference path="any-db.d.ts" />
|
||||
|
||||
"use strict";
|
||||
|
||||
import anyDB = require("any-db");
|
||||
|
||||
var conn: anyDB.Connection = anyDB.createConnection("mysql://user:password@localhost/testdb");
|
||||
var sql: string = "SELECT * FROM questions";
|
||||
|
||||
conn.query(sql, [1, "boo"]);
|
||||
|
||||
conn.query(sql).on("data", (row: Object[]): void => {
|
||||
// nothing
|
||||
});
|
||||
|
||||
conn.query(sql, [1, "s"], (error: Error, result: anyDB.ResultSet): void => {
|
||||
result.rows.length;
|
||||
result.fields.length;
|
||||
});
|
||||
|
||||
conn.end();
|
||||
|
||||
|
||||
var poolConfig: anyDB.PoolConfig = {
|
||||
min: 1,
|
||||
max: 200
|
||||
};
|
||||
|
||||
var pool: anyDB.ConnectionPool = anyDB.createPool("mysql://user:password@localhost/testdb", poolConfig);
|
||||
|
||||
pool.query(sql).on("data", (row: Object[]): void => {
|
||||
// nothing
|
||||
});
|
||||
|
||||
pool.close((error: Error): void => {
|
||||
});
|
||||
|
||||
Vendored
+303
@@ -0,0 +1,303 @@
|
||||
// Type definitions for any-db 2.1.0
|
||||
// Project: https://github.com/grncdr/node-any-db
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "any-db" {
|
||||
import events = require("events");
|
||||
import stream = require("stream");
|
||||
|
||||
export interface ConnectOpts {
|
||||
adapter: string;
|
||||
}
|
||||
|
||||
export interface Adapter {
|
||||
name: string;
|
||||
/**
|
||||
* Create a new connection object. In common usage, config will be created by parse-db-url and passed to the adapter by any-db.
|
||||
* If a continuation is given, it must be called, either with an error or the established connection.
|
||||
*/
|
||||
createConnection(opts: ConnectOpts, callback?: (error: Error, result: Connection) => void): Connection;
|
||||
|
||||
/**
|
||||
* Create a Query that may eventually be executed later on by a Connection. While this function is rarely needed by user code,
|
||||
* it makes it possible for ConnectionPool.query and Transaction.query to fulfill the Queryable.query contract
|
||||
* by synchronously returning a Query stream
|
||||
*/
|
||||
createQuery(text: string, params?: any[], callback?: (error: Error, result: ResultSet) => void): Query;
|
||||
createQuery(query: Query): Query;
|
||||
}
|
||||
/**
|
||||
* Other properties are driver specific
|
||||
*/
|
||||
export interface Field {
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* ResultSet objects are just plain data that collect results of a query when a continuation
|
||||
* is provided to Queryable.query. The lastInsertId is optional, and currently supported by
|
||||
* sqlite3 and mysql but not postgres, because it is not supported by Postgres itself.
|
||||
*/
|
||||
export interface ResultSet {
|
||||
/**
|
||||
* Affected rows. Note e.g. for INSERT queries the rows property is not filled even
|
||||
* though rowCount is non-zero.
|
||||
*/
|
||||
rowCount: number;
|
||||
/**
|
||||
* Result rows
|
||||
*/
|
||||
rows: Object[];
|
||||
/**
|
||||
* Result field descriptions
|
||||
*/
|
||||
fields: Field[];
|
||||
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
fieldCount?: number;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
lastInsertId?: any;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
affectedRows?: number;
|
||||
/**
|
||||
* Not supported by all drivers.
|
||||
*/
|
||||
changedRows?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query objects are returned by the Queryable.query method, available on connections,
|
||||
* pools, and transactions. Queries are instances of Readable, and as such can be piped
|
||||
* through transforms and support backpressure for more efficient memory-usage on very
|
||||
* large results sets. (Note: at this time the sqlite3 driver does not support backpressure)
|
||||
*
|
||||
* Internally, Query instances are created by a database Adapter and may have more methods,
|
||||
* properties, and events than are described here. Consult the documentation for your
|
||||
* specific adapter to find out about any extensions.
|
||||
*
|
||||
* Events:
|
||||
*
|
||||
* Error event
|
||||
* The 'error' event is emitted at most once per query. Note that this event will be
|
||||
* emitted for errors even if a callback was provided, the callback will
|
||||
* simply be subscribed to the 'error' event.
|
||||
* One argument is passed to event listeners:
|
||||
* error - the error object.
|
||||
*
|
||||
* Fields event
|
||||
* A 'fields' event is emmitted before any 'data' events.
|
||||
* One argument is passed to event listeners:
|
||||
* fields - an array of [Field][ResultSet] objects.
|
||||
*
|
||||
* The following events are part of the stream.Readable interface which is implemented by Query:
|
||||
*
|
||||
* Data event
|
||||
* A 'data' event is emitted for each row in the query result set.
|
||||
* One argument is passed to event listeners:
|
||||
* row contains the contents of a single row in the query result
|
||||
*
|
||||
* Close event
|
||||
* A 'close' event is emitted when the query completes.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* End event
|
||||
* An 'end' event is emitted after all query results have been consumed.
|
||||
* No arguments are passed to event listeners.
|
||||
*/
|
||||
export interface Query extends stream.Readable {
|
||||
/**
|
||||
* The SQL query as a string. If you are using MySQL this will contain
|
||||
* interpolated values after the query has been enqueued by a connection.
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* The array of parameter values.
|
||||
*/
|
||||
values: any[];
|
||||
|
||||
/**
|
||||
* The callback (if any) that was provided to Queryable.query. Note that
|
||||
* Query objects must not use a closed over reference to their callback,
|
||||
* as other any-db libraries may rely on modifying the callback property
|
||||
* of a Query they did not create.
|
||||
*/
|
||||
callback: (error: Error, results: ResultSet) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Events:
|
||||
* The 'query' event is emitted immediately before a query is executed. One argument is passed to event handlers:
|
||||
* - query: a Query object
|
||||
*/
|
||||
export interface Queryable extends events.EventEmitter {
|
||||
/**
|
||||
* The Adapter instance that will be used by this Queryable for creating Query instances and/or connections.
|
||||
*/
|
||||
adapter: Adapter;
|
||||
|
||||
/**
|
||||
* Execute a SQL statement using bound parameters (if they are provided) and return a Query object
|
||||
* that is a Readable stream of the resulting rows. If a Continuation<ResultSet> is provided the rows
|
||||
* returned by the database will be aggregated into a [ResultSet][] which will be passed to the
|
||||
* continuation after the query has completed.
|
||||
* The second form is not needed for normal use, but must be implemented by adapters to work correctly
|
||||
* with ConnectionPool and Transaction. See Adapter.createQuery for more details.
|
||||
*/
|
||||
query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query
|
||||
|
||||
/**
|
||||
* The second form is not needed for normal use, but must be implemented by adapters to work correctly
|
||||
* with ConnectionPool and Transaction. See Adapter.createQuery for more details.
|
||||
*/
|
||||
// query(query: Query): Query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connection objects are obtained using createConnection from Any-DB or ConnectionPool.acquire,
|
||||
* both of which delegate to the createConnection implementation of the specified adapter.
|
||||
* While all Connection objects implement the Queryable interface, the implementations in
|
||||
* each adapter may add additional methods or emit additional events. If you need to access a
|
||||
* feature of your database that is not described here (such as Postgres' server-side prepared
|
||||
* statements), consult the documentation for your adapter.
|
||||
*
|
||||
* Events:
|
||||
* Error event
|
||||
* The 'error' event is emitted when there is a connection-level error.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* Open event
|
||||
* The 'open' event is emitted when the connection has been established and is ready to query.
|
||||
* No arguments are passed to event listeners.
|
||||
*
|
||||
* Close event
|
||||
* The 'close' event is emitted when the connection has been closed.
|
||||
* No arguments are passed to event listeners.
|
||||
*/
|
||||
export interface Connection extends Queryable {
|
||||
/**
|
||||
* Close the database connection. If a continuation is provided it
|
||||
* will be called after the connection has closed.
|
||||
*/
|
||||
end(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
export interface ConnectionStatic {
|
||||
new(): Connection;
|
||||
|
||||
name: string;
|
||||
createConnection(): void;
|
||||
createPool(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* ConnectionPool events
|
||||
* 'acquire' - emitted whenever pool.acquire is called
|
||||
* 'release' - emitted whenever pool.release is called
|
||||
* 'query', query - emitted immediately after .query is called on a
|
||||
* connection via pool.query. The argument is a Query object.
|
||||
* 'close' - emitted when the connection pool has closed all of it
|
||||
* connections after a call to close().
|
||||
*/
|
||||
export interface ConnectionPool extends Queryable {
|
||||
/**
|
||||
* Implements Queryable.query by automatically acquiring a connection
|
||||
* and releasing it when the query completes.
|
||||
*/
|
||||
query(text: string, params?: any[], callback?: (error: Error, results: ResultSet) => void): Query;
|
||||
|
||||
/**
|
||||
* Remove a connection from the pool. If you use this method you must
|
||||
* return the connection back to the pool using ConnectionPool.release
|
||||
*/
|
||||
acquire(callback: (error: Error, result: Connection) => void): void;
|
||||
|
||||
/**
|
||||
* Return a connection to the pool. This should only be called with connections
|
||||
* you've manually acquired. You must not continue to use the connection after releasing it.
|
||||
*/
|
||||
release(connection: Connection): void;
|
||||
|
||||
/**
|
||||
* Stop giving out new connections, and close all existing database connections as they
|
||||
* are returned to the pool.
|
||||
*/
|
||||
close(callback?: (error: Error) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A PoolConfig is generally a plain object with any of the following properties (they are all optional):
|
||||
*/
|
||||
export interface PoolConfig {
|
||||
/**
|
||||
* min (default 0) The minimum number of connections to keep open in the pool.
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* max (default 10) The maximum number of connections to keep open in the pool.
|
||||
* When this limit is reached further requests for connections will queue waiting
|
||||
* for an existing connection to be released back into the pool.
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* (default 30000) The maximum amount of time a connection can sit idle in the pool before being reaped
|
||||
*/
|
||||
idleTimeout?: number;
|
||||
/**
|
||||
* (default 1000) How frequently the pool should check for connections that are old enough to be reaped.
|
||||
*/
|
||||
reapInterval?: number;
|
||||
/**
|
||||
* (default true) When this is true, the pool will reap connections that
|
||||
* have been idle for more than idleTimeout milliseconds.
|
||||
*/
|
||||
refreshIdle?: boolean;
|
||||
/**
|
||||
* Called immediately after a connection is first established. Use this to do one-time setup of new connections.
|
||||
* The supplied Connection will not be added to the pool until you pass it to the done continuation.
|
||||
*/
|
||||
onConnect?: (connection: Connection, ready: (error: Error, result: Connection) => void) => void;
|
||||
/**
|
||||
* Called each time a connection is returned to the pool. Use this to restore a connection to
|
||||
* it's original state (e.g. rollback transactions, set the database session vars). If reset
|
||||
* fails to call the done continuation the connection will be lost in limbo.
|
||||
*/
|
||||
reset?: (connection: Connection, done: (error: Error) => void) => void;
|
||||
/**
|
||||
* (default function (err) { return true }) - Called when an error is encountered
|
||||
* by pool.query or emitted by an idle connection. If shouldDestroyConnection(error)
|
||||
* is truthy the connection will be destroyed, otherwise it will be reset.
|
||||
*/
|
||||
shouldDestroyConnection?: (error: Error) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a database connection.
|
||||
* @param url String of the form adapter://user:password@host/database
|
||||
* @param callback
|
||||
* @returns Connection object.
|
||||
*/
|
||||
export function createConnection(url: string, callback?: (error: Error, connection: Connection) => void): Connection;
|
||||
|
||||
/**
|
||||
* Create a database connection.
|
||||
* @param opts Object with adapter name and any properties that the given adapter requires
|
||||
* @param callback
|
||||
* @returns Connection object.
|
||||
*/
|
||||
export function createConnection(opts: ConnectOpts, callback?: (error: Error, connection: Connection) => void): Connection;
|
||||
|
||||
|
||||
export function createPool(url: string, config: PoolConfig): ConnectionPool;
|
||||
export function createPool(opts: ConnectOpts, config: PoolConfig): ConnectionPool;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/// <reference path="bcrypt.d.ts" />
|
||||
|
||||
import bcrypt = require("bcrypt");
|
||||
|
||||
var num: number;
|
||||
var str: string;
|
||||
var bool: boolean;
|
||||
|
||||
str = bcrypt.genSaltSync();
|
||||
str = bcrypt.genSaltSync(num);
|
||||
|
||||
bcrypt.genSalt(function (err: Error, salt: string): void {
|
||||
str = salt;
|
||||
});
|
||||
bcrypt.genSalt(num, function (err: Error, salt: string): void {
|
||||
str = salt;
|
||||
});
|
||||
|
||||
str = bcrypt.hashSync(str, str);
|
||||
str = bcrypt.hashSync(str, num);
|
||||
|
||||
bcrypt.hash(str, str, function (err: Error, encrypted: string):void {
|
||||
str = encrypted;
|
||||
})
|
||||
bcrypt.hash(str, num, function (err: Error, encrypted: string): void {
|
||||
str = encrypted;
|
||||
});
|
||||
|
||||
bool = bcrypt.compareSync(str, str);
|
||||
bcrypt.compare(str, str, function (err: Error, same: boolean): void {
|
||||
bool = same;
|
||||
});
|
||||
|
||||
num = bcrypt.getRounds(str);
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// Type definitions for bcrypt
|
||||
// Project: https://www.npmjs.org/package/bcrypt
|
||||
// Definitions by: Peter Harris <https://github.com/codeanimal>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "bcrypt" {
|
||||
/**
|
||||
* @param rounds The cost of processing the data. Default 10.
|
||||
*/
|
||||
export function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* @param rounds The cost of processing the data. Default 10.
|
||||
* @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void;
|
||||
/**
|
||||
* @param callback A callback to be fire once the sald has been generated. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function genSalt(callback: (err: Error, salt: string) => void): void;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param salt The salt to be used in encryption.
|
||||
*/
|
||||
export function hashSync(data: any, salt: string): string;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param rounds A salt will be generated using the rounds specified.
|
||||
*/
|
||||
export function hashSync(data: any, rounds: number): string;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param salt The salt to be used in encryption.
|
||||
* @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function hash(data: any, salt: string, callback: (err: Error, encrypted: string) => void): void;
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param rounds A salt will be generated using the rounds specified.
|
||||
* @param callback A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function hash(data: any, rounds: number, callback: (err: Error, encrypted: string) => void): void;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param encrypted The data to be compared against.
|
||||
*/
|
||||
export function compareSync(data: any, encrypted: string): boolean;
|
||||
|
||||
/**
|
||||
* @param data The data to be encrypted.
|
||||
* @param encrypted The data to be compared against.
|
||||
* @param callback A callback to be fire once the data has been compared. Uses eio making it asynchronous.
|
||||
*/
|
||||
export function compare(data: any, encrypted: string, callback: (err: Error, same: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Return the number of rounds used to encrypt a given hash
|
||||
*
|
||||
* @param encrypted Hash from which the number of rounds used should be extracted.
|
||||
*/
|
||||
export function getRounds(encrypted: string): number;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ bi = BigInt.trim(bi, num);
|
||||
BigInt.addInt_(bi, num);
|
||||
BigInt.add_(bi, bi);
|
||||
BigInt.copy_(bi, bi);
|
||||
num = BigInt.copyInt_(bi, num);
|
||||
BigInt.copyInt_(bi, num);
|
||||
BigInt.GCD_(bi, bi);
|
||||
b = BigInt.inverseMod_(bi, bi);
|
||||
BigInt.mod_(bi, bi);
|
||||
|
||||
Vendored
+388
-114
@@ -1,8 +1,11 @@
|
||||
// Type definitions for BigInt v5.5.1
|
||||
// Type definitions for BigInt v5.5.3
|
||||
// Project: https://github.com/Evgenus/BigInt
|
||||
// Definitions by: Eugene Chernyshov <https://github.com/Evgenus>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Development repository: https://github.com/Evgenus/bigint-typescript-definitions
|
||||
// For answers, fixes and cutting edge version please see development repository.
|
||||
|
||||
declare module BigInt {
|
||||
export interface BigInt extends Array<number> {
|
||||
}
|
||||
@@ -11,361 +14,632 @@ declare module BigInt {
|
||||
(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a random number generator.
|
||||
*
|
||||
* @param {IRandom} random function that returns random number.
|
||||
*/
|
||||
export function setRandom(random: IRandom): void;
|
||||
|
||||
/**
|
||||
* bigInt add(x,y)
|
||||
* return (x+y) for bigInts x and y.
|
||||
*
|
||||
* @param {BigInt} x The BigInt augend.
|
||||
* @param {BigInt} y The BigInt addend.
|
||||
*
|
||||
* @return {BigInt} A sum as BigInt.
|
||||
*/
|
||||
export function add(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt addInt(x,n)
|
||||
* return (x+n) where x is a bigInt and n is an integer.
|
||||
*
|
||||
* @param {BigInt} x The BigInt augend.
|
||||
* @param {number} n The number addend.
|
||||
*
|
||||
* @return {BigInt} A sum as BigInt.
|
||||
*/
|
||||
export function addInt(x: BigInt, n: number): BigInt;
|
||||
|
||||
interface bigInt2str_T<T> {
|
||||
/**
|
||||
* string bigInt2str(x,base)
|
||||
* return a string form of bigInt x in a given base, with 2 <= base <= 95
|
||||
*/
|
||||
(x: BigInt, base: T): string;
|
||||
}
|
||||
|
||||
interface bigInt2strSignature extends bigInt2str_T<string>, bigInt2str_T<number>{
|
||||
}
|
||||
|
||||
export var bigInt2str: bigInt2strSignature;
|
||||
/**
|
||||
* return a string form of bigInt x in a given base, with 2 <= base <= 95.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to stringify.
|
||||
* @param {number} base The base as radix number.
|
||||
*
|
||||
* @return {string} A string representation of given BigInt.
|
||||
*/
|
||||
export function bigInt2str(x: BigInt, base: number): string;
|
||||
|
||||
/**
|
||||
* int bitSize(x)
|
||||
* return how many bits long the bigInt x is, not counting leading zeros
|
||||
* return a string form of bigInt x in a given base, with 2 <= base <= 95.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to stringify.
|
||||
* @param {string} base The base as vocabulary of characters.
|
||||
*
|
||||
* @return {string} A string representation of given BigInt.
|
||||
*/
|
||||
export function bigInt2str(x: BigInt, base: string): string;
|
||||
|
||||
/**
|
||||
* return how many bits long the bigInt x is, not counting leading zeros.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
*
|
||||
* @return {number} A size in BigInt as number.
|
||||
*/
|
||||
export function bitSize(x: BigInt): number;
|
||||
|
||||
/**
|
||||
* bigInt dup(x)
|
||||
* return a copy of bigInt x
|
||||
* return a copy of bigInt x.
|
||||
*
|
||||
* @param {BigInt} x Source BigInt to be copied.
|
||||
*
|
||||
* @return {BigInt} A copy of this object.
|
||||
*/
|
||||
export function dup(x: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* boolean equals(x,y)
|
||||
* is the bigInt x equal to the bigint y?
|
||||
*
|
||||
* @param {BigInt} x BigInt to be compared.
|
||||
* @param {BigInt} y BigInt to be compared.
|
||||
*
|
||||
* @return {boolean} true if the objects are considered equal, false if they are not.
|
||||
*/
|
||||
export function equals(x: BigInt, y: BigInt): boolean;
|
||||
|
||||
/**
|
||||
* boolean equalsInt(x,y)
|
||||
* is bigint x equal to integer y?
|
||||
*
|
||||
* @param {BigInt} x BigInt to be compared.
|
||||
* @param {BigInt} y BigInt to be compared.
|
||||
*
|
||||
* @return {boolean} true if the objects are considered equal, false if not.
|
||||
*/
|
||||
export function equalsInt(x: BigInt, y: number): boolean;
|
||||
|
||||
/**
|
||||
* bigInt expand(x,n)
|
||||
* return a copy of x with at least n elements, adding leading zeros if needed
|
||||
* return a copy of x with at least n elements, adding leading zeros if needed.
|
||||
*
|
||||
* @param {BigInt} value The source object to copy.
|
||||
* @param {number} n The minimal number of elements.
|
||||
*
|
||||
* @return {BigInt} A copy of given BigInt.
|
||||
*/
|
||||
export function expand(value: BigInt, n: number): BigInt;
|
||||
|
||||
/**
|
||||
* Array findPrimes(n)
|
||||
* return array of all primes less than integer n
|
||||
* return array of all primes less than integer n.
|
||||
*
|
||||
* @param {number} n Upper limit of search.
|
||||
*
|
||||
* @return {Array} The found primes as Array.
|
||||
*/
|
||||
export function findPrimes(n: number): number[];
|
||||
|
||||
/**
|
||||
* bigInt GCD(x,y)
|
||||
* return greatest common divisor of bigInts x and y (each with same number of elements).
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {BigInt} y The BigInt to process.
|
||||
*
|
||||
* @return {BigInt} A greatest common divisor as BigInt.
|
||||
*/
|
||||
export function GCD(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* boolean greater(x,y)
|
||||
* is x>y? (x and y are nonnegative bigInts)
|
||||
*
|
||||
* @param {BigInt} x BigInt to be compared.
|
||||
* @param {BigInt} y BigInt to be compared.
|
||||
*
|
||||
* @return {boolean} true if x is greater, false if it's not.
|
||||
*/
|
||||
export function greater(x: BigInt, y: BigInt): boolean;
|
||||
|
||||
/**
|
||||
* boolean greaterShift(x,y,shift)
|
||||
* is (x <<(shift*bpe)) > y?
|
||||
*
|
||||
* @param {BigInt} x BigInt to be compared.
|
||||
* @param {BigInt} y BigInt to be compared.
|
||||
* @param {number} shift The shift amount in bits.
|
||||
*
|
||||
* @return {boolean} true if x is greater, false if it's not.
|
||||
*/
|
||||
export function greaterShift(x: BigInt, y: BigInt, shift: number): boolean;
|
||||
|
||||
/**
|
||||
* bigInt int2bigInt(t,n,m)
|
||||
* return a bigInt equal to integer t, with at least n bits and m array elements
|
||||
* return a bigInt equal to integer t, with at least n bits and m array elements.
|
||||
*
|
||||
* @param {number} t The number to process.
|
||||
* @param {number=} n (Optional) the number to process.
|
||||
* @param {number=} m (Optional) the number to process.
|
||||
*
|
||||
* @return {BigInt} A BigInt equivalent of given number.
|
||||
*/
|
||||
export function int2bigInt(t: number, n?: number, m?: number): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt inverseMod(x,n)
|
||||
* return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null
|
||||
* return (x**(-1) mod n) for bigInts x and n. If no inverse exists, it returns null.
|
||||
*
|
||||
* @param {BigInt} x The BigInt base.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*
|
||||
* @return {BigInt} A BigInt remainder.
|
||||
*/
|
||||
export function inverseMod(x: BigInt, n: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* int inverseModInt(x,n)
|
||||
* return x**(-1) mod n, for integers x and n. Return 0 if there is no inverse
|
||||
* return x**(-1) mod n, for integers x and n.
|
||||
* Return 0 if there is no inverse.
|
||||
*
|
||||
* @param {number} x The BigInt base.
|
||||
* @param {number} n The BigInt divisor.
|
||||
*
|
||||
* @return {BigInt} A BigInt remainder.
|
||||
*/
|
||||
export function inverseModInt(x: number, n: number): BigInt;
|
||||
|
||||
/**
|
||||
* boolean isZero(x)
|
||||
* is the bigInt x equal to zero?
|
||||
*
|
||||
* @param {BigInt} x BigInt to be compared.
|
||||
*
|
||||
* @return {boolean} true if zero, false if not.
|
||||
*/
|
||||
export function isZero(x: BigInt): boolean;
|
||||
|
||||
/**
|
||||
* boolean millerRabin(x,b)
|
||||
* does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is bigInt, 1<b<x)
|
||||
* does one round of Miller-Rabin base integer b say that bigInt x is possibly prime?
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {BigInt} b The BigInt to process. (b is bigInt, 1<b<x)
|
||||
*
|
||||
* @return {boolean} true if it is prime, false if it is not.
|
||||
*/
|
||||
export function millerRabin(x: BigInt, b: BigInt): boolean;
|
||||
|
||||
/**
|
||||
* boolean millerRabinInt(x,b)
|
||||
* does one round of Miller-Rabin base integer b say that bigInt x is possibly prime? (b is int, 1<b<x)
|
||||
* does one round of Miller-Rabin base integer b say that bigInt x is possibly prime?
|
||||
*
|
||||
* @param {number} x The number to process.
|
||||
* @param {number} b The number to process. (b is int, 1<b<x)
|
||||
*
|
||||
* @return {boolean} true if it is prime, false if it is not.
|
||||
*/
|
||||
export function millerRabinInt(x: number, b: number): boolean;
|
||||
|
||||
/**
|
||||
* bigInt mod(x,n)
|
||||
* return a new bigInt equal to (x mod n) for bigInts x and n.
|
||||
*
|
||||
* @param {BigInt} x The dividend.
|
||||
* @param {BigInt} n The divisor.
|
||||
*
|
||||
* @return {BigInt} A remainder as BigInt.
|
||||
*/
|
||||
export function mod(x: BigInt, n: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* int modInt(x,n)
|
||||
* return x mod n for bigInt x and integer n.
|
||||
*
|
||||
* @param {BigInt} x The dividend.
|
||||
* @param {number} n The divisor.
|
||||
*
|
||||
* @return {number} A remainder as number.
|
||||
*/
|
||||
export function modInt(x: BigInt, n: number): number;
|
||||
|
||||
/**
|
||||
* bigInt mult(x,y)
|
||||
* return x*y for bigInts x and y. This is faster when y<x.
|
||||
*
|
||||
* @param {BigInt} x The multiplicand.
|
||||
* @param {BigInt} y The multiplier.
|
||||
*
|
||||
* @return {BigInt} A product as BigInt.
|
||||
*/
|
||||
export function mult(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt multMod(x,y,n)
|
||||
* return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
|
||||
* return (x*y mod n) for bigInts x,y,n. For greater speed, let y<x.
|
||||
*
|
||||
* @param {BigInt} x The multiplicand.
|
||||
* @param {BigInt} y The multiplier.
|
||||
* @param {BigInt} n The divisor.
|
||||
*
|
||||
* @return {BigInt} A remainder as BigInt.
|
||||
*/
|
||||
export function multMod(x: BigInt, y: BigInt, n: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* boolean negative(x)
|
||||
* is bigInt x negative?
|
||||
*
|
||||
* @param {BigInt} x BigInt to be compared.
|
||||
*
|
||||
* @return {boolean} true if x is negative, false if x is positive.
|
||||
*/
|
||||
export function negative(x: BigInt): boolean;
|
||||
|
||||
/**
|
||||
* bigInt powMod(x,y,n)
|
||||
* return (x**y mod n) where x,y,n are bigInts and ** is exponentiation. 0**0=1. Faster for odd n.
|
||||
* return (x**y mod n) where x,y,n are bigInts and ** is exponentiation.
|
||||
* 0**0=1. Faster for odd n.
|
||||
*
|
||||
* @param {BigInt} x The BigInt base.
|
||||
* @param {BigInt} y The BigInt exponent.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*
|
||||
* @return {BigInt} A remainder as BigInt.
|
||||
*/
|
||||
export function powMod(x: BigInt, y: BigInt, n: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt randBigInt(n,s)
|
||||
* return an n-bit random BigInt (n>=1). If s=1, then the most significant of those n bits is set to 1.
|
||||
* return an n-bit random BigInt (n>=1).
|
||||
* If s=1, then the most significant of those n bits is set to 1.
|
||||
*
|
||||
* @param {number} n The number of bits (n>=1).
|
||||
* @param {number} s The sign bit.
|
||||
*
|
||||
* @return {BigInt} A new random BigInt.
|
||||
*/
|
||||
export function randBigInt(n: number, s: number): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt randTruePrime(k)
|
||||
* return a new, random, k-bit, true prime bigInt using Maurer's algorithm.
|
||||
*
|
||||
* @param {number} k The number of bits.
|
||||
*
|
||||
* @return {BigInt} A new random BigInt.
|
||||
*/
|
||||
export function randTruePrime(k: number): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt randProbPrime(k)
|
||||
* return a new, random, k-bit, probable prime bigInt (probability it's composite less than 2^-80).
|
||||
* return a new, random, k-bit, probable prime bigInt.
|
||||
* Probability it's composite less than 2^- 80.
|
||||
*
|
||||
* @param {number} k The number of bits.
|
||||
*
|
||||
* @return {BigInt} A new probably random BigInt.
|
||||
*/
|
||||
export function randProbPrime(k: number): BigInt;
|
||||
|
||||
interface str2bigInt_T<T> {
|
||||
/**
|
||||
* bigInt str2bigInt(s,b,n,m)
|
||||
* return a bigInt for number represented in string s in base b with at least n bits and m array elements
|
||||
*/
|
||||
(s: string, b: T, n?: number, m?: number): BigInt;
|
||||
}
|
||||
|
||||
interface str2bigIntSignature extends str2bigInt_T<number>, str2bigInt_T<string> {
|
||||
}
|
||||
|
||||
export var str2bigInt: str2bigIntSignature;
|
||||
/**
|
||||
* return a bigInt for number represented in string s in base b with at least n bits and m array
|
||||
* elements.
|
||||
*
|
||||
* @param {string} s The string representation of number.
|
||||
* @param {number} b The base as radix number.
|
||||
* @param {number=} n (Optional) minimal bit length as number.
|
||||
* @param {number=} m (Optional) the number of array elements as number.
|
||||
*
|
||||
* @return {BigInt} A parsed BigInt.
|
||||
*/
|
||||
export function str2bigInt(s: string, b: number, n?: number, m?: number): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt sub(x,y)
|
||||
* return (x-y) for bigInts x and y. Negative answers will be 2s complement
|
||||
* return a bigInt for number represented in string s in base b with at least n bits and m array
|
||||
* elements.
|
||||
*
|
||||
* @param {string} s The string representation of number.
|
||||
* @param {string} b The base as string vocabulary of characters.
|
||||
* @param {number=} n (Optional) minimal bit length as number.
|
||||
* @param {number=} m (Optional) the number of array elements as number.
|
||||
*
|
||||
* @return {BigInt} A parsed BigInt.
|
||||
*/
|
||||
export function str2bigInt(s: string, b: string, n?: number, m?: number): BigInt;
|
||||
|
||||
/**
|
||||
* return (x-y) for bigInts x and y.
|
||||
* Negative answers will be 2s complement.
|
||||
*
|
||||
* @param {BigInt} x The minuend as BigInt.
|
||||
* @param {BigInt} y The subtrahend as BigInt.
|
||||
*
|
||||
* @return {BigInt} A difference BigInt.
|
||||
*/
|
||||
export function sub(x: BigInt, y: BigInt): BigInt;
|
||||
|
||||
/**
|
||||
* bigInt trim(x,k)
|
||||
* return a copy of x with exactly k leading zero elements
|
||||
* return a copy of x with exactly k leading zero elements.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to be copied.
|
||||
* @param {number} k The number of zeroes.
|
||||
*
|
||||
* @return {BigInt} A copy BigInt.
|
||||
*/
|
||||
export function trim(x: BigInt, k: number): BigInt;
|
||||
|
||||
/**
|
||||
* void addInt_(x,n)
|
||||
* do x=x+n where x is a bigInt and n is an integer
|
||||
* do x=x+n where x is a bigInt and n is an integer.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt accumulator.
|
||||
* @param {number} n The number addend.
|
||||
*/
|
||||
export function addInt_(x: BigInt, n: number): void;
|
||||
|
||||
/**
|
||||
* void add_(x,y)
|
||||
* do x=x+y for bigInts x and y
|
||||
* do x=x+y for bigInts x and y.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt accumulator.
|
||||
* @param {BigInt} y The BigInt addend.
|
||||
*/
|
||||
export function add_(x: BigInt, y: BigInt): void;
|
||||
|
||||
/**
|
||||
* void copy_(x,y)
|
||||
* do x=y on bigInts x and y
|
||||
* do x=y on bigInts x and y.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt destination.
|
||||
* @param {BigInt} y The BigInt source.
|
||||
*/
|
||||
export function copy_(x: BigInt, y: BigInt): void;
|
||||
|
||||
/**
|
||||
* void copyInt_(x,n)
|
||||
* do x=n on bigInt x and integer n
|
||||
* do x=n on bigInt x and integer n.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt destination.
|
||||
* @param {number} n The number source.
|
||||
*/
|
||||
export function copyInt_(x: BigInt, n: number): number;
|
||||
export function copyInt_(x: BigInt, n: number): void;
|
||||
|
||||
/**
|
||||
* void GCD_(x,y)
|
||||
* set x to the greatest common divisor of bigInts x and y, (y is destroyed). (This never overflows its array).
|
||||
* set x to the greatest common divisor of bigInts x and y, (y is destroyed).
|
||||
* This never overflows its array.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt first dividend.
|
||||
* @param {BigInt} y The BigInt second dividend.
|
||||
*/
|
||||
export function GCD_(x: BigInt, y: BigInt): void;
|
||||
|
||||
/**
|
||||
* boolean inverseMod_(x,n)
|
||||
* do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist
|
||||
* do x=x**(-1) mod n, for bigInts x and n. Returns 1 (0) if inverse does (doesn't) exist.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt base and the remainder result.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*
|
||||
* @return {boolean} true if inverse does exist, false if doesn't.
|
||||
*/
|
||||
export function inverseMod_(x: BigInt, n: BigInt): boolean;
|
||||
|
||||
/**
|
||||
* void mod_(x,n)
|
||||
* do x=x mod n for bigInts x and n. (This never overflows its array).
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt dividend and the remainder result.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*/
|
||||
export function mod_(x: BigInt, n: BigInt): void;
|
||||
|
||||
/**
|
||||
* void mult_(x,y)
|
||||
* do x=x*y for bigInts x and y.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt multiplicand and the product result.
|
||||
* @param {BigInt} y The BigInt multiplier.
|
||||
*/
|
||||
export function mult_(x: BigInt, y: BigInt): void;
|
||||
|
||||
/**
|
||||
* void multMod_(x,y,n)
|
||||
* do x=x*y mod n for bigInts x,y,n.
|
||||
* do x=x*y mod n for bigInts x,y,n.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt multiplicand and the remainder result.
|
||||
* @param {BigInt} y The BigInt multiplier.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*/
|
||||
export function multMod_(x: BigInt, y: BigInt, n: BigInt): void;
|
||||
|
||||
/**
|
||||
* void powMod_(x,y,n)
|
||||
* do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation. 0**0=1.
|
||||
* do x=x**y mod n, where x,y,n are bigInts (n is odd) and ** is exponentiation.
|
||||
* 0**0=1.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt base and the remainder result.
|
||||
* @param {BigInt} y The BigInt exponent.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*/
|
||||
export function powMod_(x: BigInt, y: BigInt, n: BigInt): void;
|
||||
|
||||
/**
|
||||
* void randBigInt_(b,n,s)
|
||||
* do b = an n-bit random BigInt. if s=1, then nth bit (most significant bit) is set to 1. n>=1.
|
||||
* do b = an n-bit random BigInt.
|
||||
* if s=1, then nth bit (most significant bit) is set to 1. n>=1.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} b The BigInt destination.
|
||||
* @param {number} n The number of bits.
|
||||
* @param {number} s The sign bit number.
|
||||
*/
|
||||
export function randBigInt_(b: BigInt, n: number, s: number): void;
|
||||
|
||||
/**
|
||||
* void randTruePrime_(ans,k)
|
||||
* do ans = a random k-bit true random prime (not just probable prime) with 1 in the msb.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} ans The destination.
|
||||
* @param {number} k The number of bits.
|
||||
*/
|
||||
export function randTruePrime_(ans: BigInt, k: number): void;
|
||||
|
||||
/**
|
||||
* void sub_(x,y)
|
||||
* do x=x-y for bigInts x and y. Negative answers will be 2s complement.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt minuend and the result difference.
|
||||
* @param {BigInt} y The BigInt subtrahend .
|
||||
*/
|
||||
export function sub_(x: BigInt, y: BigInt): void;
|
||||
|
||||
/**
|
||||
* void addShift_(x,y,ys)
|
||||
* do x=x+(y<<(ys*bpe))
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt accumulator.
|
||||
* @param {BigInt} y The BigInt addend to be shifted.
|
||||
* @param {number} ys The number of shift amount.
|
||||
*/
|
||||
export function addShift_(x: BigInt, y: BigInt, ys: number): void;
|
||||
|
||||
/**
|
||||
* void carry_(x)
|
||||
* do carries and borrows so each element of the bigInt x fits in bpe bits.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
*/
|
||||
export function carry_(x: BigInt): void;
|
||||
|
||||
/**
|
||||
* void divide_(x,y,q,r)
|
||||
* divide x by y giving quotient q and remainder r
|
||||
* divide x by y giving quotient q and remainder r.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt dividend.
|
||||
* @param {BigInt} y The BigInt divisor.
|
||||
* @param {BigInt} q The BigInt quotient.
|
||||
* @param {BigInt} r The BigInt remainder.
|
||||
*/
|
||||
export function divide_(x: BigInt, y: BigInt, q: BigInt, r: BigInt): void;
|
||||
|
||||
/**
|
||||
* int divInt_(x,n)
|
||||
* do x=floor(x/n) for bigInt x and integer n, and return the remainder. (This never overflows its array).
|
||||
* do x=floor(x/n) for bigInt x and integer n, and return the remainder.
|
||||
* This never overflows its array.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt dividend and the quotient result.
|
||||
* @param {number} n The number divisor.
|
||||
*
|
||||
* @return {number} A number remainder.
|
||||
*/
|
||||
export function divInt_(x: BigInt, n: number): number;
|
||||
|
||||
/**
|
||||
* void eGCD_(x,y,d,a,b)
|
||||
* sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y
|
||||
* sets a,b,d to positive bigInts such that d = GCD_(x,y) = a*x-b*y.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {BigInt} y The BigInt to process.
|
||||
* @param {BigInt} d The BigInt to process.
|
||||
* @param {BigInt} a The BigInt to process.
|
||||
* @param {BigInt} b The BigInt to process.
|
||||
*/
|
||||
export function eGCD_(x: BigInt, y: BigInt, d: BigInt, a: BigInt, b: BigInt): void;
|
||||
|
||||
/**
|
||||
* void halve_(x)
|
||||
* do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement. (This never overflows its array).
|
||||
* do x=floor(|x|/2)*sgn(x) for bigInt x in 2's complement.
|
||||
* This never overflows its array.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
*/
|
||||
export function halve_(x: BigInt): void;
|
||||
|
||||
/**
|
||||
* void leftShift_(x,n)
|
||||
* left shift bigInt x by n bits. n<bpe.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {number} n The number of bits.
|
||||
*/
|
||||
export function leftShift_(x: BigInt, n: number): void;
|
||||
|
||||
/**
|
||||
* void linComb_(x,y,a,b)
|
||||
* do x=a*x+b*y for bigInts x and y and integers a and b
|
||||
* do x=a*x+b*y for bigInts x and y and integers a and b.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt first multiplicand.
|
||||
* @param {BigInt} y The BigInt second multiplicand.
|
||||
* @param {number} a The number first multiplier.
|
||||
* @param {number} b The number second multiplier.
|
||||
*/
|
||||
export function linComb_(x: BigInt, y: BigInt, a: number, b: number): void;
|
||||
|
||||
/**
|
||||
* void linCombShift_(x,y,b,ys)
|
||||
* do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys
|
||||
/**
|
||||
* do x=x+b*(y<<(ys*bpe)) for bigInts x and y, and integers b and ys.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {BigInt} y The BigInt to process.
|
||||
* @param {number} b The number to process.
|
||||
* @param {number} ys The number shift.
|
||||
*/
|
||||
export function linCombShift_(x: BigInt, y: BigInt, b: number, ys: number): void;
|
||||
|
||||
/**
|
||||
* void mont_(x,y,n,np)
|
||||
* Montgomery multiplication (see comments where the function is defined)
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {BigInt} y The BigInt to process.
|
||||
* @param {BigInt} n The BigInt to process.
|
||||
* @param {number} np The np.
|
||||
*/
|
||||
export function mont_(x: BigInt, y: BigInt, n: BigInt, np: number): void;
|
||||
|
||||
/**
|
||||
* void multInt_(x,n)
|
||||
* do x=x*n where x is a bigInt and n is an integer.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt multiplicand and the result product.
|
||||
* @param {number} n The number multiplier.
|
||||
*/
|
||||
export function multInt_(x: BigInt, n: number): void;
|
||||
|
||||
/**
|
||||
* void rightShift_(x,n)
|
||||
* right shift bigInt x by n bits. 0 <= n < bpe. (This never overflows its array).
|
||||
* right shift bigInt x by n bits. 0 <= n < bpe.
|
||||
* This never overflows its array.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt to process.
|
||||
* @param {number} n The number to process.
|
||||
*/
|
||||
export function rightShift_(x: BigInt, n: number): void;
|
||||
|
||||
/**
|
||||
* void squareMod_(x,n)
|
||||
* do x=x*x mod n for bigInts x,n
|
||||
* do x=x*x mod n for bigInts x,n.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt base and the result remainder.
|
||||
* @param {BigInt} n The BigInt divisor.
|
||||
*/
|
||||
export function squareMod_(x: BigInt, n: BigInt): void;
|
||||
|
||||
/**
|
||||
* void subShift_(x,y,ys)
|
||||
* do x=x-(y<<(ys*bpe)). Negative answers will be 2s complement.
|
||||
*
|
||||
* @private Intend to be internal function.
|
||||
*
|
||||
* @param {BigInt} x The BigInt minuend and the result difference.
|
||||
* @param {BigInt} y The BigInt shifted subtrahend .
|
||||
* @param {number} ys The number shift amount.
|
||||
*/
|
||||
export function subShift_(x: BigInt, y: BigInt, ys: number): void;
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
/// <reference path="canvasjs.d.ts" />
|
||||
|
||||
module CanvasJS.Tests {
|
||||
// Column Chart
|
||||
var columnChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
title: {
|
||||
text: "Top Oil Reserves",
|
||||
},
|
||||
axisY: {
|
||||
title: "Reserves(MMbbl)"
|
||||
},
|
||||
legend: {
|
||||
verticalAlign: "bottom",
|
||||
horizontalAlign: "center"
|
||||
},
|
||||
theme: "theme2",
|
||||
data: [
|
||||
{
|
||||
type: "column",
|
||||
showInLegend: true,
|
||||
legendMarkerColor: "grey",
|
||||
legendText: "MMbbl = one million barrels",
|
||||
dataPoints: [
|
||||
{ y: 297571, label: "Venezuela" },
|
||||
{ y: 267017, label: "Saudi" },
|
||||
{ y: 175200, label: "Canada" },
|
||||
{ y: 154580, label: "Iran" },
|
||||
{ y: 116000, label: "Russia" },
|
||||
{ y: 97800, label: "UAE" },
|
||||
{ y: 20682, label: "US" },
|
||||
{ y: 20350, label: "China" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
columnChart.render();
|
||||
|
||||
// Line Chart
|
||||
var lineChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
theme: "theme2",
|
||||
title: {
|
||||
text: "Earthquakes - per month"
|
||||
},
|
||||
axisX: {
|
||||
valueFormatString: "MMM",
|
||||
interval: 1,
|
||||
intervalType: "month"
|
||||
|
||||
},
|
||||
axisY: {
|
||||
includeZero: false
|
||||
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "line",
|
||||
//lineThickness: 3,
|
||||
dataPoints: [
|
||||
{ x: new Date(2012, 0, 1), y: 450 },
|
||||
{ x: new Date(2012, 1, 1), y: 414 },
|
||||
{ x: new Date(2012, 2, 1), y: 520, indexLabel: "highest", markerColor: "red", markerType: "triangle" },
|
||||
{ x: new Date(2012, 3, 1), y: 460 },
|
||||
{ x: new Date(2012, 4, 1), y: 450 },
|
||||
{ x: new Date(2012, 5, 1), y: 500 },
|
||||
{ x: new Date(2012, 6, 1), y: 480 },
|
||||
{ x: new Date(2012, 7, 1), y: 480 },
|
||||
{ x: new Date(2012, 8, 1), y: 410, indexLabel: "lowest", markerColor: "DarkSlateGrey", markerType: "cross" },
|
||||
{ x: new Date(2012, 9, 1), y: 500 },
|
||||
{ x: new Date(2012, 10, 1), y: 480 },
|
||||
{ x: new Date(2012, 11, 1), y: 510 }
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
});
|
||||
lineChart.render();
|
||||
|
||||
// Spline Chart
|
||||
var splineChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
theme: "theme2",
|
||||
title: {
|
||||
text: "Game of Thrones, Viewers of the first airing on HBO"
|
||||
},
|
||||
axisY: {
|
||||
includeZero: false,
|
||||
// suffix: " k",
|
||||
valueFormatString: "#,,.",
|
||||
suffix: " mn"
|
||||
},
|
||||
toolTip: {
|
||||
shared: true
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "spline",
|
||||
showInLegend: true,
|
||||
name: "Season 2",
|
||||
// markerSize: 0,
|
||||
// color: "rgba(54,158,173,.6)",
|
||||
dataPoints: [
|
||||
{ label: "Ep. 1", y: 3858000 },
|
||||
{ label: "Ep. 2", y: 3759000 },
|
||||
{ label: "Ep. 3", y: 3766000 },
|
||||
{ label: "Ep. 4", y: 3654000 },
|
||||
{ label: "Ep. 5", y: 3903000 },
|
||||
{ label: "Ep. 6", y: 3879000 },
|
||||
{ label: "Ep. 7", y: 3694000 },
|
||||
{ label: "Ep. 8", y: 3864000 },
|
||||
{ label: "Ep. 9", y: 3384000 },
|
||||
{ label: "Ep. 10", y: 4200000 }
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "spline",
|
||||
showInLegend: true,
|
||||
// markerSize: 0,
|
||||
name: "Season 1",
|
||||
dataPoints: [
|
||||
{ label: "Ep. 1", y: 2220000 },
|
||||
{ label: "Ep. 2", y: 2200000 },
|
||||
{ label: "Ep. 3", y: 2440000 },
|
||||
{ label: "Ep. 4", y: 2450000 },
|
||||
{ label: "Ep. 5", y: 2580000 },
|
||||
{ label: "Ep. 6", y: 2440000 },
|
||||
{ label: "Ep. 7", y: 2400000 },
|
||||
{ label: "Ep. 8", y: 2720000 },
|
||||
{ label: "Ep. 9", y: 2660000 },
|
||||
{ label: "Ep. 10", y: 3040000 }
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
legend: {
|
||||
cursor: "pointer",
|
||||
itemclick: function (e) {
|
||||
if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) {
|
||||
e.dataSeries.visible = false;
|
||||
}
|
||||
else {
|
||||
e.dataSeries.visible = true;
|
||||
}
|
||||
splineChart.render();
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
splineChart.render();
|
||||
|
||||
// Bar Chart
|
||||
var barChart = new CanvasJS.Chart("chartContainer", {
|
||||
|
||||
title: {
|
||||
text: "Fortune Global 500 Companies by Country"
|
||||
},
|
||||
axisX: {
|
||||
interval: 1,
|
||||
gridThickness: 0,
|
||||
labelFontSize: 10,
|
||||
labelFontStyle: "normal",
|
||||
labelFontWeight: "normal",
|
||||
labelFontFamily: "Lucida Sans Unicode"
|
||||
},
|
||||
axisY: {
|
||||
interlacedColor: "rgba(1,77,101,.2)",
|
||||
gridColor: "rgba(1,77,101,.1)"
|
||||
},
|
||||
data: [
|
||||
{
|
||||
type: "bar",
|
||||
name: "companies",
|
||||
axisYType: "secondary",
|
||||
color: "#014D65",
|
||||
dataPoints: [
|
||||
{ y: 5, label: "Sweden" },
|
||||
{ y: 6, label: "Taiwan" },
|
||||
{ y: 7, label: "Russia" },
|
||||
{ y: 8, label: "Spain" },
|
||||
{ y: 8, label: "Brazil" },
|
||||
{ y: 8, label: "India" },
|
||||
{ y: 9, label: "Italy" },
|
||||
{ y: 9, label: "Australia" },
|
||||
{ y: 12, label: "Canada" },
|
||||
{ y: 13, label: "South Korea" },
|
||||
{ y: 13, label: "Netherlands" },
|
||||
{ y: 15, label: "Switzerland" },
|
||||
{ y: 28, label: "Britain" },
|
||||
{ y: 32, label: "Germany" },
|
||||
{ y: 32, label: "France" },
|
||||
{ y: 68, label: "Japan" },
|
||||
{ y: 73, label: "China" },
|
||||
{ y: 132, label: "US" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
barChart.render();
|
||||
|
||||
// Pie Chart
|
||||
var pieChart = new CanvasJS.Chart("chartContainer",
|
||||
{
|
||||
title: {
|
||||
text: "Desktop Search Engine Market Share, Dec-2012"
|
||||
},
|
||||
legend: {
|
||||
verticalAlign: "center",
|
||||
horizontalAlign: "left",
|
||||
fontSize: 20,
|
||||
fontFamily: "Helvetica"
|
||||
},
|
||||
theme: "theme2",
|
||||
data: [
|
||||
{
|
||||
type: "pie",
|
||||
indexLabelFontFamily: "Garamond",
|
||||
indexLabelFontSize: 20,
|
||||
indexLabel: "{label} {y}%",
|
||||
startAngle: -20,
|
||||
showInLegend: true,
|
||||
toolTipContent: "{legendText} {y}%",
|
||||
dataPoints: [
|
||||
{ y: 83.24, legendText: "Google", label: "Google" },
|
||||
{ y: 8.16, legendText: "Yahoo!", label: "Yahoo!" },
|
||||
{ y: 4.67, legendText: "Bing", label: "Bing" },
|
||||
{ y: 1.67, legendText: "Baidu", label: "Baidu" },
|
||||
{ y: 0.98, legendText: "Others", label: "Others" }
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
pieChart.render();
|
||||
|
||||
addColorSet("MyColorSet", [
|
||||
"123456",
|
||||
"blue",
|
||||
"red",
|
||||
"orange"
|
||||
]);
|
||||
|
||||
addCultureInfo("js", {
|
||||
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||
});
|
||||
}
|
||||
Vendored
+959
@@ -0,0 +1,959 @@
|
||||
// Type definitions for CanvasJS v1.5.1 GA
|
||||
// Project: http://canvasjs.com/
|
||||
// Definitions by: Mark Overholt <https://github.com/mover5>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module CanvasJS {
|
||||
class Chart {
|
||||
|
||||
/**
|
||||
* The current options of the chart.
|
||||
*/
|
||||
options: ChartOptions;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of CanvasJS Chart.
|
||||
* @param containerId the DOM ID of the location where the chart is to be rendered
|
||||
* @param options the options used to render the chart
|
||||
*/
|
||||
constructor(containerId: string, options?: ChartOptions);
|
||||
|
||||
/**
|
||||
* Renders the chart.
|
||||
* @param options an optional set of options that will override the constructed values.
|
||||
*/
|
||||
render(options?: ChartOptions): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new chart color set
|
||||
* @param the name of the color set
|
||||
* @param an array of colors.
|
||||
*/
|
||||
function addColorSet(colorSetName: string, colorSetArray: string[]): void;
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new culture info for your chart
|
||||
* @param culture the name of the culture
|
||||
* @param the information used by this culture
|
||||
*/
|
||||
function addCultureInfo(culture: string, info: CultureInfo): void;
|
||||
|
||||
interface CultureInfo {
|
||||
/**
|
||||
* Character used to separate fractional part from the whole number.
|
||||
*/
|
||||
decimalSeparator?: string;
|
||||
/**
|
||||
* Also referred to as Thousand Separator
|
||||
*/
|
||||
digitGroupSeparator?: string;
|
||||
/**
|
||||
* Text is shown inside the Button till v1.4
|
||||
* v1.5 onwards Text is shown as tooltip.
|
||||
*/
|
||||
zoomText?: string;
|
||||
/**
|
||||
* Text is shown inside the Button till v1.4
|
||||
* v1.5 onwards Text is shown as tooltip.
|
||||
*/
|
||||
panText?: string;
|
||||
/**
|
||||
* Text is shown inside the Button till v1.4
|
||||
* v1.5 onwards Text is shown as tooltip.
|
||||
*/
|
||||
resetText?: string;
|
||||
/**
|
||||
* Set text is shown instead of Save as PNG.
|
||||
*/
|
||||
savePNGText?: string;
|
||||
/**
|
||||
* Set text is shown instead of Save as JPG.
|
||||
*/
|
||||
saveJPGText?: string;
|
||||
/**
|
||||
* Tool Tip for Menu Button.
|
||||
*/
|
||||
menuText?: string;
|
||||
/**
|
||||
* Day names starting from Sunday. Should be exactly 7 in total.
|
||||
*/
|
||||
days?: string[];
|
||||
/**
|
||||
* Short Day names starting from Sunday. Should be exactly 7 in total.
|
||||
*/
|
||||
shortDays?: string[];
|
||||
/**
|
||||
* Month Names starting from January
|
||||
*/
|
||||
months?: string[];
|
||||
/**
|
||||
* Short Month Names starting from January
|
||||
*/
|
||||
shortMonths?: string[];
|
||||
}
|
||||
|
||||
interface ChartOptions {
|
||||
/**
|
||||
* Enables / Disables Chart interactivity like toolTip, mouse and touch events
|
||||
* Default: true
|
||||
* Example: false, true
|
||||
*/
|
||||
interactivityEnabled?: boolean;
|
||||
/**
|
||||
* Enables Animation while rendering the Chart.
|
||||
* Default: true
|
||||
* Example: false, true
|
||||
*/
|
||||
animationEnabled?: boolean;
|
||||
/**
|
||||
* While exporting any chart, “Chart” is used as the default fine name with corresponding extension “jpg” or “png”. You can override this name using exportFileName property.
|
||||
* Default: Chart
|
||||
*/
|
||||
exportFileName?: string;
|
||||
/**
|
||||
* Setting exportEnabled to true enables the export feature. As of now JPG & PNG formats are supported. Export feature is available in all Chart Types.
|
||||
* Default: false
|
||||
* Options: true, false
|
||||
*/
|
||||
exportEnabled?: boolean;
|
||||
/**
|
||||
* Setting zoomEnabled to true enables zooming and panning feature of Chart. This way you can zoom into an area of interest when there is a large amount of data. This will also allow you to pan through the chart. If not set, the property is automatically enabled for large number of dataPoints. You can switch between zooming & panning using the toolbar that appears on the chart. After Zooming in, you can reset the chart by clicking the reset button.
|
||||
* Default: false
|
||||
* Options: true, false
|
||||
*/
|
||||
zoomEnabled?: boolean;
|
||||
/**
|
||||
* Sets the theme of the Chart. Various predefined themes are bundled along with the library. User can easily switch these themes by changing theme property to the below mentioned options.
|
||||
* Default: “theme1″
|
||||
* Options: “theme1″,”theme2″, “theme3″
|
||||
*/
|
||||
theme?: string;
|
||||
/**
|
||||
* Sets the background color of entire Chart Area. Values can be “HTML Color Name”, “hex code” or “rgba values”
|
||||
* Default: “white”
|
||||
* Example: “yellow”, “#F5DEB3″..
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
* Sets the colorSet of the Chart. Color Set is an array of colors that are used to render data. Various predefined Color Sets are bundled along with the library. You can either choose from the pre-defined Color Sets or define your own Color Set.
|
||||
* Default: “colorset1″ or as defined in the selected theme
|
||||
* Example: “colorSet1″, “colorSet2″, “colorSet3″
|
||||
*/
|
||||
colorSet?: string;
|
||||
/**
|
||||
* CanvasJS allows you to localize various culture / language / country specific elements in the Chart like number formatting style – where you can choose which character to use as a decimal separator and as a digit group separator (also referred to as a thousand separator). By default CanvasJS is set to Neutral English Culture – “en”.
|
||||
* Default: “en”
|
||||
*/
|
||||
culture?: string;
|
||||
/**
|
||||
* Sets the width of the Chart.
|
||||
* Default: Takes chart container’s width by default. If the width is not set for the chart container, defaults to 500.
|
||||
* Example: 380, 500, 720
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* Sets the width of the Chart
|
||||
* Default: Takes chart container’s height by default. If the height is not set for the chart container, defaults to 400.
|
||||
* Example: 260, 300, 400
|
||||
*/
|
||||
height?: number;
|
||||
/**
|
||||
* Title allows you to set content, appearance and position of Chart’s Title.
|
||||
*/
|
||||
title: ChartTitleOptions;
|
||||
/**
|
||||
* Whenever the chart contains multiple dataSeries, it is recommended to represent each dataSeries in a legend. This way it becomes easier for the user to know what exactly is represented by each of the dataSeries. In case of Pie and Doughnut charts, an entry is created for each dataPoint and in rest of the chart types entries are created for each dataSeries.
|
||||
* You can selectively show or hide a dataSeries in the Legend using showInLegend property of dataSeries.
|
||||
*/
|
||||
legend?: ChartLegendOptions;
|
||||
/**
|
||||
* axisX object lets you set various parameters of X Axis like interval, grid lines, etc. It is mostly horizontal, except when we are working with Bar Charts, where axisX is vertical.
|
||||
*/
|
||||
axisX?: ChartAxisXOptions;
|
||||
/**
|
||||
* axisY object lets you set various parameters of Y Axis like interval, grid lines, etc. It is mostly vertical, except when we are working with Bar Charts, where axisY is horizontal.
|
||||
*/
|
||||
axisY?: ChartAxisYOptions;
|
||||
/**
|
||||
* toolTip object lets user set behaviour of toolTip at global level like enabling/disabling animation, setting Border Color, sharing toolTip between multiple dataSeries, etc. You can also disable the toolTip by setting enabled property to false.
|
||||
*/
|
||||
toolTip?: ChartToolTipOptions;
|
||||
/**
|
||||
* data is an array of dataSeries Objects.
|
||||
*/
|
||||
data: ChartDataOptions[];
|
||||
}
|
||||
|
||||
interface ChartTitleOptions {
|
||||
/**
|
||||
* Sets the Title’s text.
|
||||
* Default: null
|
||||
* Example: “Chart title”
|
||||
*/
|
||||
text?: string;
|
||||
/**
|
||||
* This property lets you align the Chart Title vertically.
|
||||
* Default: “top”
|
||||
* Options: “top”, “center”, “bottom”
|
||||
*/
|
||||
verticalAlign?: string;
|
||||
/**
|
||||
* This property lets you align the Chart Title horizontally.
|
||||
* Default: “center”
|
||||
* Options: “left”, “right”, “center”
|
||||
*/
|
||||
horizontalAlign?: string;
|
||||
/**
|
||||
* Sets the font Size of Chart Title in pixels.
|
||||
* Default: Automatically Calculated based on Chart Size
|
||||
* Example: 16,18,22 ..
|
||||
*/
|
||||
fontSize?: number;
|
||||
/**
|
||||
* Sets the Font Family of Chart Title.
|
||||
* Default: “Calibri, Optima, Candara, Verdana, Geneva, sans-serif”
|
||||
* Example: “arial” , “tahoma”, “verdana” ..
|
||||
*/
|
||||
fontFamily?: string;
|
||||
/**
|
||||
* Sets the Font Weight used in the Chart Title.
|
||||
* Default: “bold”
|
||||
* Options: “lighter”, “normal”, “bold” , “bolder”
|
||||
*/
|
||||
fontWeight?: string;
|
||||
/**
|
||||
* Sets the font color of Chart Title. The value of fontColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “#3A3A3A”
|
||||
* Example: “red”, “#FAC003″ ..
|
||||
*/
|
||||
fontColor?: string;
|
||||
/**
|
||||
* Sets the fontStyle of Chart Title. fontStyle can be set to one of the below options.
|
||||
* Default: “normal”
|
||||
* Options: “normal”, “italic” , “oblique”
|
||||
*/
|
||||
fontStyle?: string;
|
||||
/**
|
||||
* Sets the thickness of border around the Title in pixels. To display border around title, set the borderThickness to a number greater than zero.
|
||||
* Default: 0
|
||||
* Example: 2,4 ..
|
||||
*/
|
||||
borderThickness?: number;
|
||||
/**
|
||||
* To display rounded borders around the title, set the cornerRadius of title. Higher the value, more rounded are the corners.
|
||||
* Default: 0
|
||||
* Options: 5,8 ..
|
||||
*/
|
||||
cornerRadius?: number;
|
||||
/**
|
||||
* Sets the color of border around Chart Title. Values of borderColor can be “HTML Color Name” or “hex” code .
|
||||
* Default: “black”
|
||||
* Example: “red”, “#FF0000″ ..
|
||||
*/
|
||||
borderColor?: string;
|
||||
/**
|
||||
* Sets the background color of Chart Title. Values can be “HTML Color Name” or “hex” code.
|
||||
* Default: null
|
||||
* Example: “red”, “#FF0000″ ..
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
/**
|
||||
* This property lets you set margin around the Chart Title in pixels.
|
||||
* Default: 10
|
||||
* Example: 4,12 ..
|
||||
*/
|
||||
margin?: number;
|
||||
/**
|
||||
* This property allows you to set the padding for Chart Title
|
||||
* Default: 0
|
||||
* Example: 5, 8 ..
|
||||
*/
|
||||
padding?: number;
|
||||
}
|
||||
|
||||
interface ChartLegendOptions {
|
||||
/**
|
||||
* Sets the font Size of Legend Text in pixels.
|
||||
* Default: 12
|
||||
* Example: 16,18,22 ..
|
||||
*/
|
||||
fontSize?: number;
|
||||
/**
|
||||
* Sets the Font Family of Legend Text.
|
||||
* Default: “calibri”
|
||||
* Example: “arial” , “tahoma”, “verdana” ..
|
||||
*/
|
||||
fontFamily?: string;
|
||||
/**
|
||||
* Sets the font color of Legend Text . The value of fontColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “black”
|
||||
* Example: “red”, “#FAC003″ ..
|
||||
*/
|
||||
fontColor?: string;
|
||||
/**
|
||||
* Sets the Font Weight of Legend Text.
|
||||
* Default: “normal”
|
||||
* Example: “lighter”, “normal”, “bold” , “bolder”
|
||||
*/
|
||||
fontWeight?: string;
|
||||
/**
|
||||
* Sets the fontStyle of Legend Text. fontStyle can be set to one of the below options.
|
||||
* Default: “normal”
|
||||
* Example: “normal”, “italic” , “oblique”
|
||||
*/
|
||||
fontStyle?: string;
|
||||
/**
|
||||
* This property lets you align the Legend Position vertically.
|
||||
* Default: “bottom”
|
||||
* Example: “top”, “center”, “bottom”
|
||||
*/
|
||||
verticalAlign?: string;
|
||||
/**
|
||||
* This property lets you align the Legend Position horizontally.
|
||||
* Default: “right”
|
||||
* Example: “left”, “right”, “center”
|
||||
*/
|
||||
horizontalAlign?: string;
|
||||
/**
|
||||
* Sets the mouseover event handler for the legend, which is triggered when the user moves the mouse(input device) over a legend item. After the event is triggered, the event related data is passed as a parameter to the assigned event handler. Parameters passed to the function are shown in the Event Object section below.
|
||||
* @param event a chart event
|
||||
*/
|
||||
itemmouseover?: (event: ChartEvent) => void;
|
||||
/**
|
||||
* Sets the mousemove event handler for the legend, which is triggered when the user moves the mouse(input device) within a legend item. When the event is triggered, the event related data is passed as a parameter to the assigned event handler. Parameters passed to the function are shown in the Event Object section below.
|
||||
* @param event a chart event
|
||||
*/
|
||||
itemmousemove?: (event: ChartEvent) => void;
|
||||
/**
|
||||
* Sets the mouseout event handler for the legend, which is triggered when the user moves the mouse pointer outside a legend item. After the event is triggered, the event related data is passed as a parameter to the assigned event handler. Parameters passed to the function are shown in the Event Object section below.
|
||||
* @param event a chart event
|
||||
*/
|
||||
itemmouseout?: (event: ChartEvent) => void;
|
||||
/**
|
||||
* Sets the click event handler for the legend, which is triggered when the user clicks on a legend item. After the event is triggered, the event related data is passed as a parameter to the assigned event handler. Parameters passed to the function are shown in the Event Object section below.
|
||||
* @param event a chart event
|
||||
*/
|
||||
itemclick?: (event: ChartEvent) => void;
|
||||
}
|
||||
|
||||
interface ChartEvent {
|
||||
/**
|
||||
* The x value of the item
|
||||
*/
|
||||
x: any;
|
||||
/**
|
||||
* The y value of the item
|
||||
*/
|
||||
y: number;
|
||||
/**
|
||||
* The chart object
|
||||
*/
|
||||
chart: Chart;
|
||||
/**
|
||||
* The datapoint options
|
||||
*/
|
||||
dataPoint: ChartDataPoint;
|
||||
/**
|
||||
* The data series options
|
||||
*/
|
||||
dataSeries: ChartDataOptions;
|
||||
/**
|
||||
* The index of the data point
|
||||
*/
|
||||
dataPointIndex: number;
|
||||
/**
|
||||
* The index of the data series
|
||||
*/
|
||||
dataSeriesIndex: number;
|
||||
}
|
||||
|
||||
interface ChartAxisXOptions {
|
||||
/**
|
||||
* Sets the Axis Title.
|
||||
* Default: null
|
||||
* Example: “Axis X Title”
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Sets the Font Color of Axis Title. The value of titleFontColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “#666666″
|
||||
* Example: “red”, “#006400″ .
|
||||
*/
|
||||
titleFontColor?: string;
|
||||
/**
|
||||
* Sets the Font Size of Axis Title in pixels.
|
||||
* Default: Automatically Calculated based on Chart Size
|
||||
* Example: 16, 25 ..
|
||||
*/
|
||||
titleFontSize?: number;
|
||||
/**
|
||||
* Sets the Font Family of Axis Title.
|
||||
* Default: “Calibri, Optima, Candara, Verdana, Geneva, sans-serif”
|
||||
* Example: “calibri”, “tahoma, “verdana” ..
|
||||
*/
|
||||
titleFontFamily?: string;
|
||||
/**
|
||||
* Sets the Font Weight used in the Axis Title. It can be set to one of the options below.
|
||||
* Default: “normal”
|
||||
* Options: “lighter”, “normal”, “bold” , “bolder”
|
||||
*/
|
||||
titleFontWeight?: string;
|
||||
/**
|
||||
* Sets the Font Style of Axis Title. It can be set to one of the below options.
|
||||
* Default: “normal”
|
||||
* Options: “normal”, “italic” , “oblique”
|
||||
*/
|
||||
titleFontStyle?: string;
|
||||
/**
|
||||
* This property lets you set margin between chart’s boundary and Axis.
|
||||
* Default: 2
|
||||
* Example: 8, 10..
|
||||
*/
|
||||
margin?: number;
|
||||
/**
|
||||
* Sets the angle for Axis Labels.
|
||||
* Default: null
|
||||
* Example: 20, 45, -30 ..
|
||||
*/
|
||||
labelAngle?: number;
|
||||
/**
|
||||
* Sets the Axis Label color. The value of labelFontColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “grey”
|
||||
* Example: “red”, “#FAC003″ ..
|
||||
*/
|
||||
labelFontColor?: string;
|
||||
/**
|
||||
* Sets the Axis Label Font Size in pixels.
|
||||
* Default: Automatically Calculated based on Chart Size
|
||||
* Example: 16, 18, 22..
|
||||
*/
|
||||
labelFontSize?: number;
|
||||
/**
|
||||
* Sets the Font Family of Axis labels.
|
||||
* Default: “Calibri, Optima, Candara, Verdana, Geneva, sans-serif”
|
||||
* Example: “calibri”, “tahoma”, “verdana” ..
|
||||
*/
|
||||
labelFontFamily?: string;
|
||||
/**
|
||||
* Set the font Weight used in Axis Labels. It can be set to one of the options below.
|
||||
* Default: “normal”
|
||||
* Options: “lighter”, “normal”, “bold” , “bolder”
|
||||
*/
|
||||
labelFontWeight?: string;
|
||||
/**
|
||||
* Sets the Font Style of Axis Labels. It can be set to one of the below options.
|
||||
* Default: “normal”
|
||||
* Options: “italic”, “oblique”, “normal”
|
||||
*/
|
||||
labelFontStyle?: string;
|
||||
/**
|
||||
* A string that prepends all the labels on axisX.
|
||||
* Default: null
|
||||
* Example: “$”,”cat”..
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* A string that appends all the labels on axisX.
|
||||
* Default: null
|
||||
* Example: “$”,”cat”..
|
||||
*/
|
||||
suffix?: string;
|
||||
/**
|
||||
* Defines how values must be formatted before they appear on Axis X. You can format numbers and date time values using this property. Below you will find descriptive table explaining various specifiers with example.
|
||||
*/
|
||||
valueFormatString?: string;
|
||||
/**
|
||||
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
minimum?: number;
|
||||
/**
|
||||
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
maximum?: number;
|
||||
/**
|
||||
* Sets the distance between Tick Marks, Grid Lines and Interlaced Colors.
|
||||
* Default: Automatically Calculated
|
||||
* Example: 50, 75..
|
||||
*/
|
||||
interval?: number;
|
||||
/**
|
||||
* intervalType is the unit of interval property. intervalType is by default set to “number” and hence you need to specify the interval type (eg “week”, “month”, etc) depending on the type of interval you intend to set. If required interval is 3 months, you need to provide interval as 3 and intervalType as “month”
|
||||
* Default: Automatically handled when interval property is not set. Defaults to “number” when you set the interval.
|
||||
* Option: “number”,”millisecond” ,”second”,” minute”, “hour”, “day”, “month” ,”year”
|
||||
* Example: for interval as 15 minutes, set interval as 15, and set intervalType as “minute”,
|
||||
*/
|
||||
intervalType?: string;
|
||||
/**
|
||||
* Sets the length of Tick Marks that are drawn on the Axis.
|
||||
* Default: 5
|
||||
* Example: 10, 14..
|
||||
*/
|
||||
tickLength?: number;
|
||||
/**
|
||||
* Sets the color of Tick Marks drawn on the axis. The value of tickColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “#BBBBBB”
|
||||
* Example: “red”, “#006400″.
|
||||
*/
|
||||
tickColor?: string;
|
||||
/**
|
||||
* Sets the thickness of the Tick Marks in pixels.
|
||||
* Default: 2
|
||||
* Example: 3, 4..
|
||||
*/
|
||||
tickThickness?: number;
|
||||
/**
|
||||
* Sets the color of Axis line. Axis line color can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “#BBBBBB”
|
||||
* Example: “blue”,”#21AB13″..
|
||||
*/
|
||||
lineColor?: string;
|
||||
/**
|
||||
* Sets the Thickness of Axis line in pixels.
|
||||
* Default: 2
|
||||
* Example: 2, 4..
|
||||
*/
|
||||
lineThickness?: string;
|
||||
/**
|
||||
* Sets the Interlacing Color that alternates between the set interval. If the interval is not set explicitly, then the auto calculated interval is considered. The value of interlacedColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: null
|
||||
* Example: “#F8F1E4″, “#FEFDDF” ….
|
||||
*/
|
||||
interlaceColor?: string;
|
||||
/**
|
||||
* Sets the Thickness of Grid Lines. To display grid on Axis X, set the Grid Thickness to a number greater than zero.
|
||||
* Default: 0
|
||||
* Example: 2,4 ..
|
||||
*/
|
||||
gridThickness?: number;
|
||||
/**
|
||||
* Sets the Color of Grid Lines. Value of gridColor can be a “HTML Color Name” or “hex” code .
|
||||
* Default: “#BBBBBB”
|
||||
* Example: “red”, “#FEFDDF” ..
|
||||
*/
|
||||
gridColor?: string;
|
||||
/**
|
||||
* Strip Lines are vertical or horizontal lines used to highlight/mark a certain region on the plot area. You can choose whether to draw a line at a specific position or shade a region on the plot area. Strip Lines are sometimes referred to as trend lines.
|
||||
* If you want to just mark a certain position on the axis, you can set the value attribute and it’ll draw a line at that position with the set thickness. If you want to shade a region instead, you need to set startValue and endValue attributes. This will fill the area within the specified range.
|
||||
* In the case you set startValue and endValue attributes, value and thickness attributes are ignored (as either a single thread of line can exist, or a shaded region between two given points).
|
||||
* Strip Lines can be displayed using AxisX or AxisY’s stripLines array. This allows you to have one or more strip lines on both x & y axis.
|
||||
*/
|
||||
stripLines?: ChartStripLines;
|
||||
}
|
||||
|
||||
interface ChartStripLines {
|
||||
/**
|
||||
* Sets the point where the stripLine has to be plotted or drawn along the axis X.
|
||||
* Default: null
|
||||
* Example: 20,30,100,50
|
||||
*/
|
||||
value?: number;
|
||||
/**
|
||||
* Sets the point where the stripLine’s shaded region begins on the x-axis.
|
||||
* Default: null
|
||||
* Example: 20,30,100,50
|
||||
*/
|
||||
startValue?: number;
|
||||
/**
|
||||
* Sets the point where the stripLine’s shaded region ends on the x-axis.
|
||||
* Default: null
|
||||
* Example: 50,60,200,300
|
||||
*/
|
||||
endValue?: number;
|
||||
/**
|
||||
* Sets the thickness of the stripLine in pixels.
|
||||
* Default: 2
|
||||
* Example: 2,4,5,6
|
||||
*/
|
||||
thickness?: number;
|
||||
/**
|
||||
* Sets the color of the stripLine.
|
||||
* Default: “orange”
|
||||
* Example: “green”, “#23EA23″
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* Sets the label of the stripLine. These are shown on top of axis labels.
|
||||
* Default: “” (empty string)
|
||||
* Example: “Threshold”, “Deaths in 1920″
|
||||
*/
|
||||
label?: string;
|
||||
/**
|
||||
* Sets the background color of stripLine’s label.
|
||||
* Default: “#eeeeee”
|
||||
* Example: “red”,”#fabd76″
|
||||
*/
|
||||
labelBackgroundColor?: string;
|
||||
/**
|
||||
* Sets the font-family of stripLine’s label. If the first font is not found in the system from the specified font-family list, it tries to use the next font in the list.
|
||||
* Default: “arial”
|
||||
* Example: “Arial, Trebuchet MS, Tahoma, sans-serif”
|
||||
*/
|
||||
labelFontFamily?: string;
|
||||
/**
|
||||
* Sets the font color of label.
|
||||
* Default: “orange”
|
||||
* Example: “blue”,”#4135e9″
|
||||
*/
|
||||
labelFontColor?: string;
|
||||
/**
|
||||
* Sets the font size of the label in pixels.
|
||||
* Default: 12
|
||||
* Example: 18,19,20,22
|
||||
*/
|
||||
labelFontSize?: number;
|
||||
/**
|
||||
* Sets the font weight of stripLine’s label.
|
||||
* Default: “normal”
|
||||
* Example: “lighter”,”normal”,”bold”,”bolder”
|
||||
*/
|
||||
labelFontWeight?: string;
|
||||
/**
|
||||
* Sets the font style of stripLine’s label.
|
||||
* Default: “normal”
|
||||
* Example: “normal”,”italic”,”oblique”
|
||||
*/
|
||||
labelFontStyle?: string;
|
||||
}
|
||||
|
||||
interface ChartAxisYOptions extends ChartAxisXOptions {
|
||||
/**
|
||||
* When includeZero is set to true, axisY sets the range in such a way that Zero is a part of it. It is set to true by default. But, whenever y values are very big and difference among dataPoints are hard to judge, setting includeZero to false makes axisY to set a range that makes the differences prominently visible.
|
||||
* Default: true
|
||||
* Example: true, false
|
||||
*/
|
||||
includeZero?: boolean;
|
||||
}
|
||||
|
||||
interface ChartToolTipOptions {
|
||||
/**
|
||||
* Enables or Disables the toolTip for the chart.
|
||||
* Default: True
|
||||
* Example: True, False
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* In a Multi-Series or a Combination Chart, it is often required to display all values common to x value in a single bubble. Setting shared to true will show in a common bubble all the values of y from each series next to their name.
|
||||
* Default: True
|
||||
* Example: True, False
|
||||
*/
|
||||
shared?: boolean;
|
||||
/**
|
||||
* toolTip for entire chart can be set by adding content at toolTip object. content can either be a string or a custom function that returns HTML/String to be displayed inside the toolTip.
|
||||
* Default: auto
|
||||
*/
|
||||
content?: string;
|
||||
/**
|
||||
* While mouse hovers from one dataPoint to another there is a smooth transition in toolTip. This effect can be controlled by animationEnabled Property. Setting it to false, will disable the animation and toolTip will directly switch from one dataPoint to the other.
|
||||
* Default: True
|
||||
* Example: True, False
|
||||
*/
|
||||
animationEnabled?: boolean;
|
||||
/**
|
||||
* Sets the border color around Tool Tip. When not set it takes the color of corresponding dataSeries or dataPoint.
|
||||
* Default: dataSeries color/ dataPoint color
|
||||
* Example: “red”, “#808080″..
|
||||
*/
|
||||
borderColor?: string;
|
||||
}
|
||||
|
||||
interface ChartDataCommon {
|
||||
/**
|
||||
* Sets the dataPoint Name. dataPoint name is shown in various places like toolTip & legend unless overridden.
|
||||
* Default: Automatically Named (“dataPoint 1″, “dataPoint 2″ .. )
|
||||
* Example: “apple”, “mango” ..
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Sets the color of dataSeries. The value of tickColor can be a “HTML Color Name” or “Hex Code”.
|
||||
* Default: Automatically set from Theme.
|
||||
* Example: “red”, “green” ..
|
||||
*/
|
||||
color?: string;
|
||||
/**
|
||||
* Instead of setting string values for all indexLabels, you can also use keywords like x, y, etc that will automatically show corresponding properties as indexLabel. This will allow you to define indexLabel at the series level once. While setting indexLabel you specify a keyword by enclosing it in flower brackets like {x}, {y}, {color}, etc.
|
||||
* Range Charts have two indexLabels – one for each y value. This requires the use of a special keyword #index to show index label on either sides of the column/bar/area.
|
||||
* eg: indexLabel: “{x}: {y[#index]}”
|
||||
* Important keywords to keep in mind are. {x}, {y}, {name}, {label}.
|
||||
* Default: null
|
||||
* Example: “{label}”, “Win”, “x: {x}, y: {y} ”
|
||||
*/
|
||||
indexLabel?: string;
|
||||
/**
|
||||
* Using this property you can define whether to render indexLabel “inside” or “outside” the dataPoint.
|
||||
* Default: “outside”
|
||||
* Example: “outside”, “inside”
|
||||
*/
|
||||
indexLabelPlacement?: string;
|
||||
/**
|
||||
* Sets the Orientation of indexLabel to “horizontal” or “vertical”.
|
||||
* Default: “horizontal”
|
||||
* Options: “horizontal”, “vertical”
|
||||
*/
|
||||
indexLabelOrientation?: string;
|
||||
/**
|
||||
* Sets the Background color of Index Labels. The value of indexLabelBackgroundColor can be a “HTML Color Name” or “Hex Code”.
|
||||
* Default: null
|
||||
* Example: “red”, “#FAC003″ ..
|
||||
*/
|
||||
indexLabelBackgroundColor?: string;
|
||||
/**
|
||||
* Sets the Index Label’s Font Style. It can be set to one of the below options.
|
||||
* Default: “normal”
|
||||
* Options: “italic”, “oblique”, “normal”
|
||||
*/
|
||||
indexLabelFontStyle?: string;
|
||||
/**
|
||||
* Sets the Index Label’s Font color. The value of IndexLabelFontColor can be a “HTML Color Name” or “Hex Code”.
|
||||
* Default: “grey”
|
||||
* Example: “red”, “#FAC003″ ..
|
||||
*/
|
||||
indexLabelFontColor?: string;
|
||||
/**
|
||||
* Sets the Index Label’s Font Size in pixels.
|
||||
* Default: 18
|
||||
* Example: 12, 16, 22..
|
||||
*/
|
||||
indexLabelFontSize?: number;
|
||||
/**
|
||||
* Sets the Index Label’s Font Family.
|
||||
* Default: “Calibri, Optima, Candara, Verdana, Geneva, sans-serif”
|
||||
* Example: “calibri”, “tahoma”, “verdana”..
|
||||
*/
|
||||
indexLabelFontFamily?: string;
|
||||
/**
|
||||
* Sets the Index Label’s Font Weight. It can be set to one of the below options.
|
||||
* Default: “normal”
|
||||
* Example: “lighter”, “normal” ,”bold” , “bolder”
|
||||
*/
|
||||
indexLabelFontWeight?: string;
|
||||
/**
|
||||
* Sets the color of line connecting index labels with their dataPoint. It is only applicable for pie and doughnut chart when indexLabelPlacment is outside. The value of indexLineColor can be a “HTML Color Name” or “Hex Code”.
|
||||
* Default: “lightgrey”
|
||||
* Example: “red”, “#FAC003″ ..
|
||||
*/
|
||||
indexLabelLineColor?: string;
|
||||
/**
|
||||
* Sets the thickness of line connecting indexLabel with its corresponding dataPoint. It is only applicable for pie and doughnut chart when indexLabelPlacement is set to “outside”.
|
||||
* Default: 2
|
||||
* Example: 4, 6
|
||||
*/
|
||||
indexLabelLineThickness?: string;
|
||||
/**
|
||||
* Default Tooltip can be modified at dataSeries or dataPoint level. You can add content to be displayed in toolTip using toolTipContent. toolTipContent set at dataPoint will override toolTipContent set at dataSeries level.
|
||||
* Default: auto set depending on chart type.
|
||||
*/
|
||||
toolTipContent?: string;
|
||||
/**
|
||||
* Sets marker type to be rendered at each dataPoint. While markers are helpful in highlighting individual dataPoints, they do not help much when the dataPoints are crowded. In case of large number of dataPoints it is recommended to disable markers in order to improve the appearance and performance of chart.
|
||||
* Same marker type is also used in legend unless overridden by legendMarkerType property.
|
||||
* Default: “circle”
|
||||
* Options: “none”, “circle”, “square”, “triangle” and “cross”
|
||||
*/
|
||||
markerType?: string;
|
||||
/**
|
||||
* Sets the color of marker that is displayed on the Chart. Legend Marker for the series uses the same Color as set here unless overridden using legendMarkerColor property.
|
||||
* Default: dataSeries Color
|
||||
* Example: “red”, “#008000″ ..
|
||||
*/
|
||||
markerColor?: string;
|
||||
/**
|
||||
* Sets the Size of the marker that is drawn. To display marker in area Chart, set markerSize to a value greater than zero. For line, scatter chart, size it is automatically set unless overridden.
|
||||
* Default: auto. Zero for area chart
|
||||
* Example: 5, 10..
|
||||
*/
|
||||
markerSize?: number;
|
||||
/**
|
||||
* Sets the border color around marker. Value of markerBorderColor can be “HTML Color Name” or “hex code”.
|
||||
* Default: dataSeries color.
|
||||
* Example: “red”, “#008000″ ..
|
||||
*/
|
||||
markerBorderColor?: string;
|
||||
/**
|
||||
* Sets the thickness of the Marker’s Border in pixels.
|
||||
* Default: 1
|
||||
* Example: 2,4 ..
|
||||
*/
|
||||
markerBorderThickness?: number;
|
||||
/**
|
||||
* Sets the text that describes the dataSeries in legend.
|
||||
* Default: “DataSeries 1″, “DataSeries 2″ ..etc
|
||||
* Example: “2010″, “2011″..
|
||||
*/
|
||||
legendText?: string;
|
||||
/**
|
||||
* Sets the Legend Marker to one of the options below. This property is used to override the default marker in legend, which is same as dataSeries Marker Type.
|
||||
* Default: same as markerType
|
||||
* Options: “circle”, “square”, “cross” and “triangle”
|
||||
*/
|
||||
legendMarkerType?: string;
|
||||
/**
|
||||
* Sets the click event handler for dataSeries which is triggered when user clicks on a dataSeries. Upon event, a parameter that contains event related data is sent to the assigned event handler. Parameter includes dataPoint and dataSeries corresponding to the event.
|
||||
* Default: null
|
||||
*/
|
||||
click?: (event: ChartEvent) => void;
|
||||
/**
|
||||
* Sets the color of marker that is displayed on legend. This property overrides default Marker’s Color in Legend, which is same as dataSeries Marker Color. Value of legendMarkerColor can be “HTML Color Name” or “hex code”.
|
||||
* Default: dataSeries marker color
|
||||
* Example: “red”, “#008000″ ..
|
||||
*/
|
||||
legendMarkerColor?: string;
|
||||
/**
|
||||
* Sets the mouseover event handler for dataSeries which is triggered when user moves Mouse Over a dataSeries. Upon event, a parameter that contains event related data is sent to the assigned event handler. Parameter includes dataPoint and dataSeries corresponding to the event.
|
||||
* Default: null
|
||||
*/
|
||||
mouseover?: (event: ChartEvent) => void;
|
||||
/**
|
||||
* Sets the mousemove event handler for dataSeries which is triggered when user Moves mouse on a dataSeries. Upon event, a parameter that contains event related data is sent to the assigned event handler. Parameter includes dataPoint and dataSeries corresponding to the event.
|
||||
* Default: null
|
||||
*/
|
||||
mousemove?: (event: ChartEvent) => void;
|
||||
/**
|
||||
* Sets the mouseout event handler for dataSeries which is triggered when user moves mouse out of a dataSeries. Upon event, a parameter that contains event related data is sent to the assigned event handler. Parameter includes dataPoint and dataSeries corresponding to the event.
|
||||
* Default: null
|
||||
*/
|
||||
mouseout?: (event: ChartEvent) => void;
|
||||
}
|
||||
|
||||
interface ChartDataOptions extends ChartDataCommon {
|
||||
/**
|
||||
* Sets the visibility of dataSeries. Data Series is visible by default and you can hide the same by setting visible property to false.
|
||||
* Default: true
|
||||
* Example: true, false
|
||||
*/
|
||||
visible?: boolean;
|
||||
/**
|
||||
* Sets the type of chart to be rendered for corresponding dataSeries. One can choose from the following options.
|
||||
* Default: “column”
|
||||
* Options:
|
||||
* “line”
|
||||
* “column”
|
||||
* “bar”
|
||||
* “area”
|
||||
* “spline”
|
||||
* “splineArea”
|
||||
* “stepLine”
|
||||
* “scatter”
|
||||
* “bubble”
|
||||
* “stackedColumn”
|
||||
* “stackedBar”
|
||||
* “stackedArea”
|
||||
* “stackedColumn100″
|
||||
* “stackedBar100″
|
||||
* “stackedArea100″
|
||||
* “pie”
|
||||
* “doughnut”
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
* Setting axisYType lets you choose between primary and secondary Y Axis for a dataSeries to plot against. By choosing “secondary” Axis you can plot the series against axisY2.
|
||||
* In case of Multi-Series or Combinational Charts, one can assign primary axis to some series and secondary axis to other series.
|
||||
* This is helpful when dataSeries objects use different unit of measurement or range of data. By default, all series are plotted against primary Y axis.
|
||||
* Default: “primary”
|
||||
* Options: “primary”, “secondary”
|
||||
*/
|
||||
axisYType?: string;
|
||||
/**
|
||||
* This defines the data type of x values. Data Type is normally figured out by default based on the object type that is assigned to x. But if you are providing time stamp (which is integer) values instead of Date objects, you’ll have to explicitly set the xValueType to “dateTime”.
|
||||
* Default: Automatically Calculated
|
||||
* Options: “number”, “dateTime”
|
||||
*/
|
||||
xValueType?: string;
|
||||
/**
|
||||
* Defines how y axis values must be formatted before they appear on the indexLabel or toolTip. You can format numbers and date time values using this property.
|
||||
*/
|
||||
yValueFormatString?: string;
|
||||
/**
|
||||
* Defines how x axis values must be formatted before they appear on the indexLabel or toolTip. You can format numbers and date time values using this property.
|
||||
*/
|
||||
xValueFormatString?: string;
|
||||
/**
|
||||
* Defines how z values is formatted before they appear on the indexLabel or toolTip. You can format numbers using this property.
|
||||
*/
|
||||
zValueFormatString?: string;
|
||||
/**
|
||||
* Sets the bevel property, which creates a chiselled effect at the corners of a Column Charts and Bar Charts.
|
||||
* Default: “true”
|
||||
* Example: “true”, “false”
|
||||
*/
|
||||
bevelEnabled?: boolean;
|
||||
/**
|
||||
* Sets opacity of the filled color.
|
||||
* Default: .7 for Area Charts and 1 for all other chart types.
|
||||
*/
|
||||
fillOpacity?: number;
|
||||
/**
|
||||
* Sets the starting Angle of the Pie or Doughnut Chart in degrees.
|
||||
* Default: 0
|
||||
* Example: 30, 240, -100..
|
||||
*/
|
||||
startAngle?: number;
|
||||
/**
|
||||
* Sets the thickness of line in line charts and area charts.
|
||||
* Default: 2
|
||||
* Example: 3,4..
|
||||
*/
|
||||
lineThickness?: number;
|
||||
/**
|
||||
* Setting this property to true makes the dataSeries to appear in legend. In case of pie/ doughnut chart, dataPoints of the single series chart appear in legend.
|
||||
* Default: false
|
||||
* Options: false, true
|
||||
*/
|
||||
showInLegend?: boolean;
|
||||
/**
|
||||
* In candle Stick chart, when Closing Price is greater than Opening price, the body is filled with white by default and it can be overridden by risingColor property.
|
||||
* Default: “white”
|
||||
* Options: “red”, “#DD7E86″, etc.
|
||||
*/
|
||||
risingColor?: string;
|
||||
/**
|
||||
* It represents collection dataPoint inside dataSeries .
|
||||
*/
|
||||
dataPoints: ChartDataPoint[];
|
||||
}
|
||||
|
||||
interface ChartDataPoint extends ChartDataCommon {
|
||||
/**
|
||||
* Sets the x value. It determines the position of the dataPoint on X Axis. It can be numeric or a dateTime value. Values can be positive or Negative.
|
||||
* Default: null
|
||||
* Example: 10, 20, 30 ..
|
||||
* new Date(2011, 08, 01)
|
||||
*/
|
||||
x?: any;
|
||||
/**
|
||||
* Sets the y value of dataPoint. It determines the position of dataPoint on Y Axis. Values can be positive or Negative
|
||||
* Default: null
|
||||
* Example: 5, 20, -30 ..
|
||||
*/
|
||||
y?: number;
|
||||
/**
|
||||
* Sets the z value of dataPoint. It is only applicable in case of Bubble chart. This value determines the size of the bubble.
|
||||
* Default: 1
|
||||
* Example: 10, 20, 35..
|
||||
*/
|
||||
z?: number;
|
||||
/**
|
||||
* Sets label value of a dataPoint. The value appears next to the dataPoint on axisX Line. If not provided, it takes x value for label.
|
||||
* Default: x value
|
||||
* Example: “label1″, “label2″..
|
||||
*/
|
||||
label?: string;
|
||||
/**
|
||||
* Sets the exploded value of dataPoint. It is applicable only in case of Pie and Doughnut Charts. This property causes the Pie/Doughnut slice to separate out.
|
||||
* Default: true
|
||||
* Example: true, false
|
||||
*/
|
||||
exploded?: boolean;
|
||||
/**
|
||||
* Sets the color of marker that is displayed on legend. This property works only with Pie and Doughnut charts. Value of legendMarkerColor can be “HTML Color Name” or “hex” code.
|
||||
* Default: dataSeries marker color
|
||||
* Example: “red”, “#008000″..
|
||||
*/
|
||||
legendMarkerColor?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
/// <reference path="chart.d.ts" />
|
||||
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('example-chart');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
Chart.defaults.global = {
|
||||
animation: true,
|
||||
animationSteps: 60,
|
||||
animationEasing: "easeOutQuart",
|
||||
showScale: true,
|
||||
scaleOverride: false,
|
||||
scaleSteps: null,
|
||||
scaleStepWidth: null,
|
||||
scaleStartValue: null,
|
||||
scaleLineColor: "rgba(0,0,0,.1)",
|
||||
scaleLineWidth: 1,
|
||||
scaleShowLabels: true,
|
||||
scaleLabel: "<%=value%>",
|
||||
scaleIntegersOnly: true,
|
||||
scaleBeginAtZero: false,
|
||||
scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
||||
scaleFontSize: 12,
|
||||
scaleFontStyle: "normal",
|
||||
scaleFontColor: "#666",
|
||||
responsive: false,
|
||||
maintainAspectRatio: true,
|
||||
showTooltips: true,
|
||||
tooltipEvents: ["mousemove", "touchstart", "touchmove"],
|
||||
tooltipFillColor: "rgba(0,0,0,0.8)",
|
||||
tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
||||
tooltipFontSize: 14,
|
||||
tooltipFontStyle: "normal",
|
||||
tooltipFontColor: "#fff",
|
||||
tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
||||
tooltipTitleFontSize: 14,
|
||||
tooltipTitleFontStyle: "bold",
|
||||
tooltipTitleFontColor: "#fff",
|
||||
tooltipYPadding: 6,
|
||||
tooltipXPadding: 6,
|
||||
tooltipCaretSize: 8,
|
||||
tooltipCornerRadius: 6,
|
||||
tooltipXOffset: 10,
|
||||
tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",
|
||||
multiTooltipTemplate: "<%= value %>",
|
||||
onAnimationProgress: function () { },
|
||||
onAnimationComplete: function () { }
|
||||
}
|
||||
|
||||
var lineData: LinearChartData = {
|
||||
labels: ['03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00'],
|
||||
datasets: [
|
||||
{
|
||||
label: 'Accepted',
|
||||
fillColor: 'rgba(220,220,220,0.2)',
|
||||
strokeColor: 'rgba(220,220,220,1)',
|
||||
pointColor: 'rgba(220,220,220,1)',
|
||||
pointStrokeColor: '#fff',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(220,220,220,1)',
|
||||
data: [65, 59, 80, 81, 56, 55, 40]
|
||||
},
|
||||
{
|
||||
label: 'Quarantined',
|
||||
fillColor: 'rgba(151,187,205,0.2)',
|
||||
strokeColor: 'rgba(151,187,205,1)',
|
||||
pointColor: 'rgba(151,187,205,1)',
|
||||
pointStrokeColor: '#fff',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(151,187,205,1)',
|
||||
data: [28, 48, 40, 19, 86, 27, 90]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var myLineChart = new Chart(ctx).Line(lineData, {
|
||||
scaleShowGridLines: true,
|
||||
scaleGridLineColor: "rgba(0,0,0,.05)",
|
||||
scaleGridLineWidth: 1,
|
||||
bezierCurve: true,
|
||||
bezierCurveTension: 0.4,
|
||||
pointDot: true,
|
||||
pointDotRadius: 4,
|
||||
pointDotStrokeWidth: 1,
|
||||
pointHitDetectionRadius: 20,
|
||||
datasetStroke: true,
|
||||
datasetStrokeWidth: 2,
|
||||
datasetFill: true,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
|
||||
var myLineChartLegend: string = myLineChart.generateLegend();
|
||||
var myLineChartImage: string = myLineChart.toBase64Image();
|
||||
myLineChart.addData([1, 2, 3, 4, 5, 6, 7], 'new');
|
||||
myLineChart.clear();
|
||||
myLineChart.removeData();
|
||||
myLineChart.resize();
|
||||
myLineChart.update();
|
||||
myLineChart.stop();
|
||||
myLineChart.destroy();
|
||||
|
||||
var barData: LinearChartData = {
|
||||
labels: ["January", "February", "March", "April", "May", "June", "July"],
|
||||
datasets: [
|
||||
{
|
||||
label: "My First dataset",
|
||||
fillColor: "rgba(220,220,220,0.5)",
|
||||
strokeColor: "rgba(220,220,220,0.8)",
|
||||
highlightFill: "rgba(220,220,220,0.75)",
|
||||
highlightStroke: "rgba(220,220,220,1)",
|
||||
data: [65, 59, 80, 81, 56, 55, 40]
|
||||
},
|
||||
{
|
||||
label: "My Second dataset",
|
||||
fillColor: "rgba(151,187,205,0.5)",
|
||||
strokeColor: "rgba(151,187,205,0.8)",
|
||||
highlightFill: "rgba(151,187,205,0.75)",
|
||||
highlightStroke: "rgba(151,187,205,1)",
|
||||
data: [28, 48, 40, 19, 86, 27, 90]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var myBarChart = new Chart(ctx).Bar(barData, {
|
||||
scaleBeginAtZero: true,
|
||||
scaleShowGridLines: true,
|
||||
scaleGridLineColor: "rgba(0,0,0,.05)",
|
||||
scaleGridLineWidth: 1,
|
||||
barShowStroke: true,
|
||||
barStrokeWidth: 2,
|
||||
barValueSpacing: 5,
|
||||
barDatasetSpacing: 1,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
|
||||
var myBarChartLegend: string = myBarChart.generateLegend();
|
||||
var myBarChartImage: string = myBarChart.toBase64Image();
|
||||
myBarChart.addData([1, 2, 3, 4, 5, 6, 7], 'new');
|
||||
myBarChart.clear();
|
||||
myBarChart.removeData();
|
||||
myBarChart.resize();
|
||||
myBarChart.update();
|
||||
myBarChart.stop();
|
||||
myBarChart.destroy();
|
||||
|
||||
var radarData: LinearChartData = {
|
||||
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
|
||||
datasets: [
|
||||
{
|
||||
label: "My First dataset",
|
||||
fillColor: "rgba(220,220,220,0.2)",
|
||||
strokeColor: "rgba(220,220,220,1)",
|
||||
pointColor: "rgba(220,220,220,1)",
|
||||
pointStrokeColor: "#fff",
|
||||
pointHighlightFill: "#fff",
|
||||
pointHighlightStroke: "rgba(220,220,220,1)",
|
||||
data: [65, 59, 90, 81, 56, 55, 40]
|
||||
},
|
||||
{
|
||||
label: "My Second dataset",
|
||||
fillColor: "rgba(151,187,205,0.2)",
|
||||
strokeColor: "rgba(151,187,205,1)",
|
||||
pointColor: "rgba(151,187,205,1)",
|
||||
pointStrokeColor: "#fff",
|
||||
pointHighlightFill: "#fff",
|
||||
pointHighlightStroke: "rgba(151,187,205,1)",
|
||||
data: [28, 48, 40, 19, 96, 27, 100]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var myRadarChart = new Chart(ctx).Radar(radarData, {
|
||||
scaleShowLine: true,
|
||||
angleShowLineOut: true,
|
||||
scaleShowLabels: false,
|
||||
scaleBeginAtZero: true,
|
||||
angleLineColor: "rgba(0,0,0,.1)",
|
||||
angleLineWidth: 1,
|
||||
pointLabelFontFamily: "'Arial'",
|
||||
pointLabelFontStyle: "normal",
|
||||
pointLabelFontSize: 10,
|
||||
pointLabelFontColor: "#666",
|
||||
pointDot: true,
|
||||
pointDotRadius: 3,
|
||||
pointDotStrokeWidth: 1,
|
||||
pointHitDetectionRadius: 20,
|
||||
datasetStroke: true,
|
||||
datasetStrokeWidth: 2,
|
||||
datasetFill: true,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].lineColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
|
||||
var myRadarChartLegend: string = myRadarChart.generateLegend();
|
||||
var myRadarChartImage: string = myRadarChart.toBase64Image();
|
||||
myRadarChart.addData([1, 2, 3, 4, 5, 6, 7], 'new');
|
||||
myRadarChart.clear();
|
||||
myRadarChart.removeData();
|
||||
myRadarChart.resize();
|
||||
myRadarChart.update();
|
||||
myRadarChart.stop();
|
||||
myRadarChart.destroy();
|
||||
|
||||
var polarAreaData: CircularChartData[] = [
|
||||
{
|
||||
value: 300,
|
||||
color: "#F7464A",
|
||||
highlight: "#FF5A5E",
|
||||
label: "Red"
|
||||
},
|
||||
{
|
||||
value: 50,
|
||||
color: "#46BFBD",
|
||||
highlight: "#5AD3D1",
|
||||
label: "Green"
|
||||
},
|
||||
{
|
||||
value: 100,
|
||||
color: "#FDB45C",
|
||||
highlight: "#FFC870",
|
||||
label: "Yellow"
|
||||
},
|
||||
{
|
||||
value: 40,
|
||||
color: "#949FB1",
|
||||
highlight: "#A8B3C5",
|
||||
label: "Grey"
|
||||
},
|
||||
{
|
||||
value: 120,
|
||||
color: "#4D5360",
|
||||
highlight: "#616774",
|
||||
label: "Dark Grey"
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
var myPolarAreaChart = new Chart(ctx).PolarArea(polarAreaData, {
|
||||
scaleShowLabelBackdrop: true,
|
||||
scaleBackdropColor: "rgba(255,255,255,0.75)",
|
||||
scaleBeginAtZero: true,
|
||||
scaleBackdropPaddingY: 2,
|
||||
scaleBackdropPaddingX: 2,
|
||||
scaleShowLine: true,
|
||||
segmentShowStroke: true,
|
||||
segmentStrokeColor: "#fff",
|
||||
segmentStrokeWidth: 2,
|
||||
animationSteps: 100,
|
||||
animationEasing: "easeOutBounce",
|
||||
animateRotate: true,
|
||||
animateScale: false,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
|
||||
var myPolarAreaChartLegend: string = myPolarAreaChart.generateLegend();
|
||||
var myPolarAreaChartImage: string = myPolarAreaChart.toBase64Image();
|
||||
myPolarAreaChart.addData([{
|
||||
value: 120,
|
||||
color: "#4D5360",
|
||||
highlight: "#616774",
|
||||
label: "Dark Grey"
|
||||
}], 0);
|
||||
myPolarAreaChart.clear();
|
||||
myPolarAreaChart.removeData(0);
|
||||
myPolarAreaChart.resize();
|
||||
myPolarAreaChart.update();
|
||||
myPolarAreaChart.stop();
|
||||
myPolarAreaChart.destroy();
|
||||
|
||||
var pieData: CircularChartData[] = [
|
||||
{
|
||||
value: 300,
|
||||
color: "#F7464A",
|
||||
highlight: "#FF5A5E",
|
||||
label: "Red"
|
||||
},
|
||||
{
|
||||
value: 50,
|
||||
color: "#46BFBD",
|
||||
highlight: "#5AD3D1",
|
||||
label: "Green"
|
||||
},
|
||||
{
|
||||
value: 100,
|
||||
color: "#FDB45C",
|
||||
highlight: "#FFC870",
|
||||
label: "Yellow"
|
||||
}
|
||||
];
|
||||
|
||||
// For a pie chart
|
||||
var myPieChart = new Chart(ctx).Pie(pieData, {
|
||||
segmentShowStroke: true,
|
||||
segmentStrokeColor: "#fff",
|
||||
segmentStrokeWidth: 2,
|
||||
percentageInnerCutout: 0,
|
||||
animationSteps: 100,
|
||||
animationEasing: "easeOutBounce",
|
||||
animateRotate: true,
|
||||
animateScale: false,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
|
||||
var myPieChartLegend: string = myPieChart.generateLegend();
|
||||
var myPieChartImage: string = myPieChart.toBase64Image();
|
||||
myPieChart.addData([{
|
||||
value: 120,
|
||||
color: "#4D5360",
|
||||
highlight: "#616774",
|
||||
label: "Dark Grey"
|
||||
}], 0);
|
||||
myPieChart.clear();
|
||||
myPieChart.removeData(0);
|
||||
myPieChart.resize();
|
||||
myPieChart.update();
|
||||
myPieChart.stop();
|
||||
myPieChart.destroy();
|
||||
|
||||
// And for a doughnut chart
|
||||
var myDoughnutChart = new Chart(ctx).Doughnut(pieData, {
|
||||
segmentShowStroke: true,
|
||||
segmentStrokeColor: "#fff",
|
||||
segmentStrokeWidth: 2,
|
||||
percentageInnerCutout: 50,
|
||||
animationSteps: 100,
|
||||
animationEasing: "easeOutBounce",
|
||||
animateRotate: true,
|
||||
animateScale: false,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
|
||||
var myDoughnutChartLegend: string = myDoughnutChart.generateLegend();
|
||||
var myDoughnutChartImage: string = myDoughnutChart.toBase64Image();
|
||||
myPieChart.addData([{
|
||||
value: 120,
|
||||
color: "#4D5360",
|
||||
highlight: "#616774",
|
||||
label: "Dark Grey"
|
||||
}], 0);
|
||||
myDoughnutChart.clear();
|
||||
myDoughnutChart.removeData(0);
|
||||
myDoughnutChart.resize();
|
||||
myDoughnutChart.update();
|
||||
myDoughnutChart.stop();
|
||||
myDoughnutChart.destroy();
|
||||
Vendored
+205
@@ -0,0 +1,205 @@
|
||||
// Type definitions for Chart.js
|
||||
// Project: https://github.com/nnnick/Chart.js
|
||||
// Definitions by: Steve Fenton <https://github.com/Steve-Fenton>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface ChartDataSet {
|
||||
label: string;
|
||||
fillColor: string;
|
||||
strokeColor: string;
|
||||
|
||||
/* Line, Radar */
|
||||
pointColor?: string;
|
||||
pointStrokeColor?: string;
|
||||
pointHighlightFill?: string;
|
||||
pointHighlightStroke?: string;
|
||||
|
||||
/* Bar */
|
||||
highlightFill?: string;
|
||||
highlightStroke?: string;
|
||||
data: number[];
|
||||
}
|
||||
|
||||
interface LinearChartData {
|
||||
labels: string[];
|
||||
datasets: ChartDataSet[];
|
||||
}
|
||||
|
||||
interface CircularChartData {
|
||||
value: number;
|
||||
color: string;
|
||||
highlight: string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
interface ChartSettings {
|
||||
animation: boolean;
|
||||
animationSteps: number;
|
||||
animationEasing: string;
|
||||
showScale: boolean;
|
||||
scaleOverride: boolean;
|
||||
scaleSteps: number;
|
||||
scaleStepWidth: number;
|
||||
scaleStartValue: number;
|
||||
scaleLineColor: string;
|
||||
scaleLineWidth: number;
|
||||
scaleShowLabels: boolean;
|
||||
scaleLabel: string;
|
||||
scaleIntegersOnly: boolean;
|
||||
scaleBeginAtZero: boolean;
|
||||
scaleFontFamily: string;
|
||||
scaleFontSize: number;
|
||||
scaleFontStyle: string;
|
||||
scaleFontColor: string;
|
||||
responsive: boolean;
|
||||
maintainAspectRatio: boolean;
|
||||
showTooltips: boolean;
|
||||
tooltipEvents: string[];
|
||||
tooltipFillColor: string;
|
||||
tooltipFontFamily: string;
|
||||
tooltipFontSize: number;
|
||||
tooltipFontStyle: string;
|
||||
tooltipFontColor: string;
|
||||
tooltipTitleFontFamily: string;
|
||||
tooltipTitleFontSize: number;
|
||||
tooltipTitleFontStyle: string;
|
||||
tooltipTitleFontColor: string;
|
||||
tooltipYPadding: number;
|
||||
tooltipXPadding: number;
|
||||
tooltipCaretSize: number;
|
||||
tooltipCornerRadius: number;
|
||||
tooltipXOffset: number;
|
||||
tooltipTemplate: string;
|
||||
multiTooltipTemplate: string;
|
||||
onAnimationProgress: () => any;
|
||||
onAnimationComplete: () => any;
|
||||
}
|
||||
|
||||
interface ChartOptions {
|
||||
scaleShowGridLines?: boolean;
|
||||
scaleGridLineColor?: string;
|
||||
scaleGridLineWidth?: number;
|
||||
legendTemplate?: string;
|
||||
}
|
||||
|
||||
interface PointsAtEvent {
|
||||
value: number;
|
||||
label: string;
|
||||
datasetLabel: string;
|
||||
strokeColor: string;
|
||||
fillColor: string;
|
||||
highlightFill: string;
|
||||
highlightStroke: string;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface ChartInstance {
|
||||
clear: () => void;
|
||||
stop: () => void;
|
||||
resize: () => void;
|
||||
destroy: () => void;
|
||||
toBase64Image: () => string;
|
||||
generateLegend: () => string;
|
||||
}
|
||||
|
||||
interface LinearInstance extends ChartInstance {
|
||||
getPointsAtEvent: (event: Event) => PointsAtEvent[];
|
||||
update: () => void;
|
||||
addData: (valuesArray: number[], label: string) => void;
|
||||
removeData: () => void;
|
||||
}
|
||||
|
||||
interface CircularInstance extends ChartInstance {
|
||||
getSegmentsAtEvent: (event: Event) => {}[];
|
||||
update: () => void;
|
||||
addData: (valuesArray: CircularChartData[], index: number) => void;
|
||||
removeData: (index: number) => void;
|
||||
}
|
||||
|
||||
interface LineChartOptions extends ChartOptions {
|
||||
bezierCurve?: boolean;
|
||||
bezierCurveTension?: number;
|
||||
pointDot?: boolean;
|
||||
pointDotRadius?: number;
|
||||
pointDotStrokeWidth?: number;
|
||||
pointHitDetectionRadius?: number;
|
||||
datasetStroke?: boolean;
|
||||
datasetStrokeWidth?: number;
|
||||
datasetFill?: boolean;
|
||||
}
|
||||
|
||||
interface BarChartOptions extends ChartOptions {
|
||||
scaleBeginAtZero?: boolean;
|
||||
barShowStroke?: boolean;
|
||||
barStrokeWidth?: number;
|
||||
barValueSpacing?: number;
|
||||
barDatasetSpacing?: number;
|
||||
}
|
||||
|
||||
interface RadarChartOptions {
|
||||
scaleShowLine?: boolean;
|
||||
angleShowLineOut?: boolean;
|
||||
scaleShowLabels?: boolean;
|
||||
scaleBeginAtZero?: boolean;
|
||||
angleLineColor?: string;
|
||||
angleLineWidth?: number;
|
||||
pointLabelFontFamily?: string;
|
||||
pointLabelFontStyle?: string;
|
||||
pointLabelFontSize?: number;
|
||||
pointLabelFontColor?: string;
|
||||
pointDot?: boolean;
|
||||
pointDotRadius?: number;
|
||||
pointDotStrokeWidth?: number;
|
||||
pointHitDetectionRadius?: number;
|
||||
datasetStroke?: boolean;
|
||||
datasetStrokeWidth?: number;
|
||||
datasetFill?: boolean;
|
||||
legendTemplate?: string;
|
||||
}
|
||||
|
||||
interface PolarAreaChartOptions {
|
||||
scaleShowLabelBackdrop?: boolean;
|
||||
scaleBackdropColor?: string;
|
||||
scaleBeginAtZero?: boolean;
|
||||
scaleBackdropPaddingY?: number;
|
||||
scaleBackdropPaddingX?: number;
|
||||
scaleShowLine?: boolean;
|
||||
segmentShowStroke?: boolean;
|
||||
segmentStrokeColor?: string;
|
||||
segmentStrokeWidth?: number;
|
||||
animationSteps?: number;
|
||||
animationEasing?: string;
|
||||
animateRotate?: boolean;
|
||||
animateScale?: boolean;
|
||||
legendTemplate?: string;
|
||||
}
|
||||
|
||||
interface PieChartOptions {
|
||||
segmentShowStroke?: boolean;
|
||||
segmentStrokeColor?: string;
|
||||
segmentStrokeWidth?: number;
|
||||
percentageInnerCutout?: number;
|
||||
animationSteps?: number;
|
||||
animationEasing?: string;
|
||||
animateRotate?: boolean;
|
||||
animateScale?: boolean;
|
||||
legendTemplate?: string;
|
||||
}
|
||||
|
||||
interface Chart {
|
||||
Line(data: LinearChartData, options?: LineChartOptions): LinearInstance;
|
||||
Bar(data: LinearChartData, options?: BarChartOptions): LinearInstance;
|
||||
Radar(data: LinearChartData, options?: RadarChartOptions): LinearInstance;
|
||||
|
||||
PolarArea(data: CircularChartData[], options?: PolarAreaChartOptions): CircularInstance;
|
||||
Pie(data: CircularChartData[], options?: PieChartOptions): CircularInstance;
|
||||
Doughnut(data: CircularChartData[], options?: PieChartOptions): CircularInstance;
|
||||
}
|
||||
|
||||
declare var Chart: {
|
||||
new (context: CanvasRenderingContext2D): Chart;
|
||||
defaults: {
|
||||
global: ChartSettings;
|
||||
}
|
||||
};
|
||||
Vendored
+110
@@ -806,4 +806,114 @@ declare module CodeMirror {
|
||||
By default, a marker appears only in its target document. */
|
||||
shared?: boolean;
|
||||
}
|
||||
|
||||
interface StringStream {
|
||||
lastColumnPos: number;
|
||||
lastColumnValue: number;
|
||||
lineStart: number;
|
||||
|
||||
/**
|
||||
* Current position in the string.
|
||||
*/
|
||||
pos: number;
|
||||
|
||||
/**
|
||||
* Where the stream's position was when it was first passed to the token function.
|
||||
*/
|
||||
start: number;
|
||||
|
||||
/**
|
||||
* The current line's content.
|
||||
*/
|
||||
string: string;
|
||||
|
||||
/**
|
||||
* Number of spaces per tab character.
|
||||
*/
|
||||
tabSize: number;
|
||||
|
||||
/**
|
||||
* Returns true only if the stream is at the end of the line.
|
||||
*/
|
||||
eol(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true only if the stream is at the start of the line.
|
||||
*/
|
||||
sol(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the next character in the stream without advancing it. Will return an null at the end of the line.
|
||||
*/
|
||||
peek(): string;
|
||||
|
||||
/**
|
||||
* Returns the next character in the stream and advances it. Also returns null when no more characters are available.
|
||||
*/
|
||||
next(): string;
|
||||
|
||||
/**
|
||||
* match can be a character, a regular expression, or a function that takes a character and returns a boolean.
|
||||
* If the next character in the stream 'matches' the given argument, it is consumed and returned.
|
||||
* Otherwise, undefined is returned.
|
||||
*/
|
||||
eat(match: string): string;
|
||||
eat(match: RegExp): string;
|
||||
eat(match: (char: string) => boolean): string;
|
||||
|
||||
/**
|
||||
* Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten.
|
||||
*/
|
||||
eatWhile(match: string): boolean;
|
||||
eatWhile(match: RegExp): boolean;
|
||||
eatWhile(match: (char: string) => boolean): boolean;
|
||||
|
||||
/**
|
||||
* Shortcut for eatWhile when matching white-space.
|
||||
*/
|
||||
eatSpace(): boolean;
|
||||
|
||||
/**
|
||||
* Moves the position to the end of the line.
|
||||
*/
|
||||
skipToEnd(): void;
|
||||
|
||||
/**
|
||||
* Skips to the next occurrence of the given character, if found on the current line (doesn't advance the stream if
|
||||
* the character does not occur on the line).
|
||||
*
|
||||
* Returns true if the character was found.
|
||||
*/
|
||||
skipTo(ch: string): boolean;
|
||||
|
||||
/**
|
||||
* Act like a multi-character eat - if consume is true or not given - or a look-ahead that doesn't update the stream
|
||||
* position - if it is false. pattern can be either a string or a regular expression starting with ^. When it is a
|
||||
* string, caseFold can be set to true to make the match case-insensitive. When successfully matching a regular
|
||||
* expression, the returned value will be the array returned by match, in case you need to extract matched groups.
|
||||
*/
|
||||
match(pattern: string, consume?: boolean, caseFold?: boolean): boolean;
|
||||
match(pattern: RegExp, consume?: boolean): string[];
|
||||
|
||||
/**
|
||||
* Backs up the stream n characters. Backing it up further than the start of the current token will cause things to
|
||||
* break, so be careful.
|
||||
*/
|
||||
backUp(n: number): void;
|
||||
|
||||
/**
|
||||
* Returns the column (taking into account tabs) at which the current token starts.
|
||||
*/
|
||||
column(): number;
|
||||
|
||||
/**
|
||||
* Tells you how far the current line has been indented, in spaces. Corrects for tab characters.
|
||||
*/
|
||||
indentation(): number;
|
||||
|
||||
/**
|
||||
* Get the string between the start of the current token and the current stream position.
|
||||
*/
|
||||
current(): string;
|
||||
}
|
||||
}
|
||||
Vendored
+10
-5
@@ -841,6 +841,11 @@ declare module D3 {
|
||||
entries(values: any[]): NestKeyValue[];
|
||||
}
|
||||
|
||||
export interface MapKeyValue<T> {
|
||||
key: string;
|
||||
value: T;
|
||||
}
|
||||
|
||||
export interface Map<T> {
|
||||
has(key: string): boolean;
|
||||
get(key: string): T;
|
||||
@@ -848,7 +853,7 @@ declare module D3 {
|
||||
remove(key: string): boolean;
|
||||
keys(): string[];
|
||||
values(): T[];
|
||||
entries(): any[][]; // Actually of form [key: string, val: T][], but this is inexpressible in Typescript
|
||||
entries(): MapKeyValue<T>[];
|
||||
forEach(func: (key: string, value: T) => void ): void;
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
@@ -1902,13 +1907,13 @@ declare module D3 {
|
||||
/**
|
||||
* Get the accessor function that controls where the line is defined.
|
||||
*/
|
||||
(): (data: any, index ?: number) => boolean;
|
||||
(): (data: any, index?: number) => boolean;
|
||||
/**
|
||||
* Set the accessor function that controls where the area is defined.
|
||||
*
|
||||
* @param defined The new accessor function
|
||||
*/
|
||||
(defined: (data: any) => boolean): Line;
|
||||
(defined: (data: any, index?: number) => boolean): Line;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2198,13 +2203,13 @@ declare module D3 {
|
||||
/**
|
||||
* Get the accessor function that controls where the area is defined.
|
||||
*/
|
||||
(): (data: any) => any;
|
||||
(): (data: any, index?: number) => any;
|
||||
/**
|
||||
* Set the accessor function that controls where the area is defined.
|
||||
*
|
||||
* @param defined The new accessor function
|
||||
*/
|
||||
(defined: (data: any) => any): Area;
|
||||
(defined: (data: any, index?: number) => any): Area;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+16
-1
@@ -424,7 +424,22 @@ declare module "express" {
|
||||
* @param code
|
||||
*/
|
||||
status(code: number): Response;
|
||||
|
||||
|
||||
/**
|
||||
* Set the response HTTP status code to `statusCode` and send its string representation as the response body.
|
||||
* @link http://expressjs.com/4x/api.html#res.sendStatus
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* res.sendStatus(200); // equivalent to res.status(200).send('OK')
|
||||
* res.sendStatus(403); // equivalent to res.status(403).send('Forbidden')
|
||||
* res.sendStatus(404); // equivalent to res.status(404).send('Not Found')
|
||||
* res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error')
|
||||
*
|
||||
* @param code
|
||||
*/
|
||||
sendStatus(code: number): Send;
|
||||
|
||||
/**
|
||||
* Set Link header field with the given `links`.
|
||||
*
|
||||
|
||||
Vendored
+28
@@ -607,6 +607,21 @@ declare module fabric {
|
||||
loadFromDatalessJSON(json, callback: () => void): void;
|
||||
}
|
||||
|
||||
export interface IPattern {
|
||||
(options: IPatternOptions): IPattern;
|
||||
|
||||
initialise(options: IPatternOptions): IPattern;
|
||||
|
||||
toLive(ctx: CanvasRenderingContext2D): IPattern;
|
||||
toObject(): any;
|
||||
toSVG(): string;
|
||||
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
repeat: string;
|
||||
source: any;
|
||||
}
|
||||
|
||||
export interface IBrightnessFilter {
|
||||
}
|
||||
export interface IInvertFilter {
|
||||
@@ -658,6 +673,13 @@ declare module fabric {
|
||||
stateful?: boolean;
|
||||
}
|
||||
|
||||
export interface IPatternOptions {
|
||||
source: any;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
repeat: string;
|
||||
}
|
||||
|
||||
export interface IRectOptions extends IObjectOptions {
|
||||
x?: number;
|
||||
y?: number;
|
||||
@@ -697,6 +719,12 @@ declare module fabric {
|
||||
prototype: any;
|
||||
}
|
||||
|
||||
var Pattern: {
|
||||
new (options: IPatternOptions): IPattern;
|
||||
|
||||
prototype: any;
|
||||
}
|
||||
|
||||
var Circle: {
|
||||
ATTRIBUTE_NAMES: string[];
|
||||
fromElement(element: SVGElement, options: ICircleOptions): ICircle;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/// <reference path="fastclick.d.ts" />
|
||||
|
||||
// on browser
|
||||
new FastClick(document.body);
|
||||
new FastClick(document.getElementById('foo'), {tapDelay: 50});
|
||||
new FastClick(document.getElementsByTagName('p')[0], {touchBoundary: 50});
|
||||
var fc = FastClick.attach(document.body);
|
||||
fc.determineEventType(document.getElementsByClassName('foo')).concat('bar');
|
||||
fc.findControl(document.querySelector('label'));
|
||||
fc.focus(document.querySelectorAll('section')[0]);
|
||||
document.body.addEventListener('click', function(e) {
|
||||
fc.getTargetElementFromEventTarget(e.target);
|
||||
fc.needsClick(e.target);
|
||||
fc.needsFocus(e.target);
|
||||
});
|
||||
|
||||
// on CommonJS environment
|
||||
import fastclick = require('fastclick');
|
||||
fastclick(document.body);
|
||||
new fastclick.FastClick(document.links[0]);
|
||||
new fastclick.FastClick(document.links[1], {tapDelay: 50});
|
||||
new fastclick.FastClick(document.links[2], {touchBoundary: 50});
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for FastClick v1.0.3
|
||||
// Project: https://github.com/ftlabs/fastclick
|
||||
// Definitions by: Shinnosuke Watanabe <https://github.com/shinnn>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface FastClickObject {
|
||||
lastTouchIdentifier: number;
|
||||
layer: Element;
|
||||
tapDelay: number;
|
||||
targetElement: any;
|
||||
touchBoundary: number;
|
||||
touchStartX: number;
|
||||
touchStartY: number;
|
||||
trackingClick: boolean;
|
||||
trackingClickStart: number;
|
||||
destroy(): void;
|
||||
determineEventType(targetElement: any): string;
|
||||
findControl(labelElement: any /* EventTarget | HTMLLabelElement */): any;
|
||||
focus(targetElement: any /* EventTarget | Element */): void;
|
||||
getTargetElementFromEventTarget(eventTarget: EventTarget): any;
|
||||
needsClick(target: any /* EventTarget | Element */): boolean;
|
||||
needsFocus(target: any /* EventTarget | Element */): boolean;
|
||||
}
|
||||
|
||||
interface FastClickOptions {
|
||||
touchBoundary?: number;
|
||||
tapDelay?: number;
|
||||
}
|
||||
|
||||
interface FastClickStatic {
|
||||
new(layer: any, options?: FastClickOptions): FastClickObject;
|
||||
attach(layer: any, options?: FastClickOptions): FastClickObject;
|
||||
}
|
||||
|
||||
declare module "fastclick" {
|
||||
function fastclick(layer: any, options?: FastClickOptions): FastClickObject;
|
||||
module fastclick {
|
||||
var FastClick: FastClickStatic;
|
||||
}
|
||||
|
||||
export = fastclick;
|
||||
}
|
||||
|
||||
declare var FastClick: FastClickStatic;
|
||||
+5
-5
@@ -14,8 +14,8 @@ declare module google {
|
||||
|
||||
export interface ChartSpecs {
|
||||
chartType: string;
|
||||
containerId: string;
|
||||
oprtions?: Object;
|
||||
containerId?: string;
|
||||
options?: Object;
|
||||
dataTable?: Object;
|
||||
dataSourceUrl?: string;
|
||||
query?: string;
|
||||
@@ -75,7 +75,7 @@ declare module google {
|
||||
addRows(rows: DataObjectCell[][]): number;
|
||||
addRows(rows: any[][]): number;
|
||||
clone(): DataTable;
|
||||
getColumnId(columnIndex: number): String;
|
||||
getColumnId(columnIndex: number): string;
|
||||
getColumnLabel(columnIndex: number): string;
|
||||
getColumnPattern(columnIndex: number): string;
|
||||
getColumnProperties(columnIndex: number): Properties;
|
||||
@@ -445,8 +445,8 @@ declare module google {
|
||||
|
||||
class ChartBase {
|
||||
constructor(element: Element);
|
||||
getSelection(): any[];
|
||||
setSelection(selection: any[]): void;
|
||||
getSelection(): VisualizationSelectionArray[];
|
||||
setSelection(selection: VisualizationSelectionArray[]): void;
|
||||
clearChart(): void;
|
||||
getImageURI(): string;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1263,8 +1263,8 @@ declare module google.maps {
|
||||
}
|
||||
|
||||
export class poly {
|
||||
containsLocation(point: LatLng, polygon: Polygon): boolean;
|
||||
isLocationOnEdge(point: LatLng, poly: any, tolerance?: number): boolean;
|
||||
static containsLocation(point: LatLng, polygon: Polygon): boolean;
|
||||
static isLocationOnEdge(point: LatLng, poly: any, tolerance?: number): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-6
@@ -2,20 +2,28 @@
|
||||
|
||||
import gulp = require("gulp");
|
||||
|
||||
var typescript: any = null; // this would be the TypeScript compiler
|
||||
var jasmine: any = null; // this would be the jasmine test runner
|
||||
var typescript: IGulpPlugin = null; // this would be the TypeScript compiler
|
||||
var jasmine: IGulpPlugin = null; // this would be the jasmine test runner
|
||||
|
||||
gulp.task('compile', function()
|
||||
{
|
||||
gulp.src("**/*.ts")
|
||||
.pipe(typescript)
|
||||
.dest('out')
|
||||
.pipe(typescript())
|
||||
.pipe(gulp.dest('out'))
|
||||
});
|
||||
|
||||
gulp.task('test', ['compile'], function()
|
||||
gulp.task('compile2', function(callback: (err?: any) => void)
|
||||
{
|
||||
gulp.src("**/*.ts")
|
||||
.pipe(typescript())
|
||||
.pipe(gulp.dest('out'))
|
||||
.on('end', callback);
|
||||
});
|
||||
|
||||
gulp.task('test', ['compile', 'compile2'], function()
|
||||
{
|
||||
gulp.src("out/test/**/*.js")
|
||||
.pipe(jasmine);
|
||||
.pipe(jasmine());
|
||||
});
|
||||
|
||||
gulp.task('default', ['compile', 'test']);
|
||||
Vendored
+19
-17
@@ -3,6 +3,8 @@
|
||||
// Definitions by: Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module gulp {
|
||||
|
||||
/**
|
||||
@@ -171,15 +173,10 @@ declare module gulp {
|
||||
interface ITaskCallback {
|
||||
/**
|
||||
* Defines a task.
|
||||
* Tasks may be made asynchronous if they return a promise or a stream.
|
||||
*/
|
||||
(): any;
|
||||
|
||||
/**
|
||||
* Defines an asynchronous task.
|
||||
* Tasks may be made asynchronous if they are passing a callback or return a promise or a stream.
|
||||
* @param cb callback used to signal asynchronous completion. Caller includes <code>err</code> in case of error.
|
||||
*/
|
||||
(cb:(err?:any)=>void): void;
|
||||
(cb?:(err?:any)=>void): any;
|
||||
}
|
||||
|
||||
interface EventEmitter {
|
||||
@@ -193,7 +190,7 @@ declare module gulp {
|
||||
* @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, fn:ITaskCallback): Gulp;
|
||||
task(name:string, fn:ITaskCallback): any;
|
||||
|
||||
/**
|
||||
* Define a task.
|
||||
@@ -202,7 +199,7 @@ declare module gulp {
|
||||
* @param dep an array of tasks to be executed and completed before your task will run.
|
||||
* @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()).
|
||||
*/
|
||||
task(name:string, dep:string[], fn?:ITaskCallback): Gulp;
|
||||
task(name:string, dep:string[], fn?:ITaskCallback): any;
|
||||
|
||||
|
||||
/**
|
||||
@@ -210,14 +207,14 @@ declare module gulp {
|
||||
* @param glob a glob string, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string, opt?:ISrcOptions): Gulp;
|
||||
src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Takes a glob and represents a file structure. Can be piped to plugins.
|
||||
* @param glob an array of glob strings, using node-glob syntax
|
||||
* @param opt an optional option object
|
||||
*/
|
||||
src(glob:string[], opt?:ISrcOptions): Gulp;
|
||||
src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -227,7 +224,7 @@ declare module gulp {
|
||||
* @param outFolder the path (output folder) to write files to.
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:string, opt?:IDestOptions): Gulp;
|
||||
dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders.
|
||||
@@ -236,16 +233,17 @@ declare module gulp {
|
||||
* @param outFolder a function that converts a vinyl File instance into an output path
|
||||
* @param opt
|
||||
*/
|
||||
dest(outFolder:(file:string)=>string, opt?:IDestOptions): Gulp;
|
||||
dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
|
||||
/**
|
||||
* Forwards the current Gulp instance, along with its contained files, to the specified receiver.
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
*
|
||||
* @param receiver the receiver
|
||||
* @param glob a single glob or array of globs that indicate which files to watch for changes.
|
||||
* @param tasks names of task(s) to run when a file changes, added with gulp.task()
|
||||
*/
|
||||
pipe(receiver:any): Gulp;
|
||||
|
||||
watch(glob:string, tasks:string[]): EventEmitter;
|
||||
watch(glob:string[], tasks:string[]): EventEmitter;
|
||||
|
||||
/**
|
||||
* Watch files and do something when a file changes. This always returns an EventEmitter that emits change events.
|
||||
@@ -284,3 +282,7 @@ declare module "gulp" {
|
||||
var _tmp:gulp.Gulp;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
interface IGulpPlugin {
|
||||
(...args: any[]): NodeJS.ReadWriteStream;
|
||||
}
|
||||
Vendored
+82
@@ -0,0 +1,82 @@
|
||||
// Type definitions for highlight.js v7.5.0
|
||||
// Project: https://github.com/isagalaev/highlight.js
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "highlight.js"
|
||||
{
|
||||
module hljs
|
||||
{
|
||||
export var LANGUAGES: { [name: string] : any; };
|
||||
|
||||
export function blockText(block: Node, ignoreNewLines: boolean) : string;
|
||||
export function blockLanguage(block: Node) : string;
|
||||
|
||||
export function highlight(language_name: string, value: string) : IHighlightResult
|
||||
export function highlightAuto(text: string) : IHighlightResult
|
||||
|
||||
export function fixMarkup(value: string, tabReplace: boolean, useBR: boolean) : string;
|
||||
|
||||
export function highlightBlock(block: Node, tabReplace?: boolean, useBR?: boolean) : void;
|
||||
|
||||
export function initHighlighting(): void;
|
||||
export function initHighlightingOnLoad(): void;
|
||||
|
||||
export var tabReplace : string;
|
||||
|
||||
// Common regexps
|
||||
export var IDENT_RE: string;
|
||||
export var UNDERSCORE_IDENT_RE: string;
|
||||
export var NUMBER_RE: string;
|
||||
export var C_NUMBER_RE: string;
|
||||
export var BINARY_NUMBER_RE: string;
|
||||
export var RE_STARTERS_RE: string;
|
||||
|
||||
// Common modes
|
||||
export var BACKSLASH_ESCAPE : IMode;
|
||||
export var APOS_STRING_MODE : IMode;
|
||||
export var QUOTE_STRING_MODE : IMode;
|
||||
export var C_LINE_COMMENT_MODE : IMode;
|
||||
export var C_BLOCK_COMMENT_MODE : IMode;
|
||||
export var HASH_COMMENT_MODE : IMode;
|
||||
export var NUMBER_MODE : IMode;
|
||||
export var C_NUMBER_MODE : IMode;
|
||||
export var BINARY_NUMBER_MODE : IMode;
|
||||
|
||||
export interface IHighlightResult
|
||||
{
|
||||
relevance: number;
|
||||
keyword_count: number;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface IAutoHighlightResult extends IHighlightResult
|
||||
{
|
||||
language: string;
|
||||
second_best?: IAutoHighlightResult;
|
||||
}
|
||||
|
||||
// Reference:
|
||||
// https://github.com/isagalaev/highlight.js/blob/master/docs/reference.rst
|
||||
export interface IMode
|
||||
{
|
||||
className?: string;
|
||||
begin: string;
|
||||
end?: string;
|
||||
beginWithKeyword?: boolean;
|
||||
endsWithParent?: boolean;
|
||||
lexems?: string;
|
||||
keywords?: Object;
|
||||
illegal?: string;
|
||||
excludeBegin?: boolean;
|
||||
excludeEnd?: boolean;
|
||||
returnBegin?: boolean;
|
||||
returnEnd?: boolean;
|
||||
contains?: IMode[];
|
||||
starts?: string;
|
||||
subLanguage?: string;
|
||||
relevance?: number;
|
||||
}
|
||||
}
|
||||
export = hljs;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import hljs = require("highlight.js");
|
||||
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
|
||||
var lang = "cs";
|
||||
|
||||
hljs.tabReplace = " "; // 4 spaces
|
||||
hljs.configure({ tabReplace: " " }); // 4 spaces
|
||||
|
||||
var hl = hljs.highlight(lang, code).value;
|
||||
hl = hljs.highlightAuto(code).value;
|
||||
hl = hljs.highlightAuto(code).value;
|
||||
Vendored
+92
-20
@@ -1,28 +1,37 @@
|
||||
// Type definitions for highlight.js
|
||||
// Type definitions for highlight.js v8.2.0
|
||||
// Project: https://github.com/isagalaev/highlight.js
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee/>
|
||||
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee/>, Jeremy Hull <https://github.com/sourrust>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "highlight.js"
|
||||
{
|
||||
module hljs
|
||||
{
|
||||
export var LANGUAGES: { [name: string] : any; };
|
||||
export function highlight(
|
||||
name: string,
|
||||
value: string,
|
||||
ignore_illegals?: boolean,
|
||||
continuation?: boolean) : IHighlightResult;
|
||||
export function highlightAuto(
|
||||
value: string,
|
||||
languageSubset?: string[]) : IAutoHighlightResult;
|
||||
|
||||
export function blockText(block: Node, ignoreNewLines: boolean) : string;
|
||||
export function blockLanguage(block: Node) : string;
|
||||
export function fixMarkup(value: string) : string;
|
||||
|
||||
export function highlight(language_name: string, value: string) : IHighlightResult
|
||||
export function highlightAuto(text: string) : IHighlightResult
|
||||
export function highlightBlock(block: Node) : void;
|
||||
|
||||
export function fixMarkup(value: string, tabReplace: boolean, useBR: boolean) : string;
|
||||
export function configure(options: IOptions): void;
|
||||
|
||||
export function highlightBlock(block: Node, tabReplace?: boolean, useBR?: boolean) : void;
|
||||
|
||||
export function initHighlighting(): void;
|
||||
export function initHighlightingOnLoad(): void;
|
||||
|
||||
export var tabReplace : string;
|
||||
export function registerLanguage(
|
||||
name: string,
|
||||
language: (hljs?: HLJSStatic) => IModeBase): void;
|
||||
export function listLanguages(): string[];
|
||||
export function getLanguage(name: string): IMode;
|
||||
|
||||
export function inherit(parent: Object, obj: Object): Object;
|
||||
|
||||
// Common regexps
|
||||
export var IDENT_RE: string;
|
||||
@@ -36,46 +45,109 @@ declare module "highlight.js"
|
||||
export var BACKSLASH_ESCAPE : IMode;
|
||||
export var APOS_STRING_MODE : IMode;
|
||||
export var QUOTE_STRING_MODE : IMode;
|
||||
export var PHRASAL_WORDS_MODE : IMode;
|
||||
export var C_LINE_COMMENT_MODE : IMode;
|
||||
export var C_BLOCK_COMMENT_MODE : IMode;
|
||||
export var HASH_COMMENT_MODE : IMode;
|
||||
export var NUMBER_MODE : IMode;
|
||||
export var C_NUMBER_MODE : IMode;
|
||||
export var BINARY_NUMBER_MODE : IMode;
|
||||
export var CSS_NUMBER_MODE : IMode;
|
||||
export var REGEX_MODE : IMode;
|
||||
export var TITLE_MODE : IMode;
|
||||
export var UNDERSCORE_TITLE_MODE : IMode;
|
||||
|
||||
export interface IHighlightResult
|
||||
export interface IHighlightResultBase
|
||||
{
|
||||
relevance: number;
|
||||
keyword_count: number;
|
||||
language: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface IAutoHighlightResult extends IHighlightResult
|
||||
export interface IAutoHighlightResult extends IHighlightResultBase
|
||||
{
|
||||
language: string;
|
||||
second_best?: IAutoHighlightResult;
|
||||
}
|
||||
|
||||
export interface IHighlightResult extends IHighlightResultBase
|
||||
{
|
||||
top: ICompiledMode;
|
||||
}
|
||||
|
||||
export interface HLJSStatic
|
||||
{
|
||||
inherit(parent: Object, obj: Object): Object;
|
||||
|
||||
// Common regexps
|
||||
IDENT_RE: string;
|
||||
UNDERSCORE_IDENT_RE: string;
|
||||
NUMBER_RE: string;
|
||||
C_NUMBER_RE: string;
|
||||
BINARY_NUMBER_RE: string;
|
||||
RE_STARTERS_RE: string;
|
||||
|
||||
// Common modes
|
||||
BACKSLASH_ESCAPE : IMode;
|
||||
APOS_STRING_MODE : IMode;
|
||||
QUOTE_STRING_MODE : IMode;
|
||||
PHRASAL_WORDS_MODE : IMode;
|
||||
C_LINE_COMMENT_MODE : IMode;
|
||||
C_BLOCK_COMMENT_MODE : IMode;
|
||||
HASH_COMMENT_MODE : IMode;
|
||||
NUMBER_MODE : IMode;
|
||||
C_NUMBER_MODE : IMode;
|
||||
BINARY_NUMBER_MODE : IMode;
|
||||
CSS_NUMBER_MODE : IMode;
|
||||
REGEX_MODE : IMode;
|
||||
TITLE_MODE : IMode;
|
||||
UNDERSCORE_TITLE_MODE : IMode;
|
||||
}
|
||||
|
||||
// Reference:
|
||||
// https://github.com/isagalaev/highlight.js/blob/master/docs/reference.rst
|
||||
export interface IMode
|
||||
export interface IModeBase
|
||||
{
|
||||
className?: string;
|
||||
begin: string;
|
||||
aliases?: string[];
|
||||
begin?: string;
|
||||
end?: string;
|
||||
beginWithKeyword?: boolean;
|
||||
case_insensitive?: boolean;
|
||||
beginKeyword?: string;
|
||||
endsWithParent?: boolean;
|
||||
lexems?: string;
|
||||
keywords?: Object;
|
||||
illegal?: string;
|
||||
excludeBegin?: boolean;
|
||||
excludeEnd?: boolean;
|
||||
returnBegin?: boolean;
|
||||
returnEnd?: boolean;
|
||||
contains?: IMode[];
|
||||
starts?: string;
|
||||
subLanguage?: string;
|
||||
subLanguageMode?: string;
|
||||
relevance?: number;
|
||||
variants?: IMode[];
|
||||
}
|
||||
|
||||
export interface IMode extends IModeBase
|
||||
{
|
||||
keywords?: any;
|
||||
contains?: IMode[];
|
||||
}
|
||||
|
||||
export interface ICompiledMode extends IModeBase
|
||||
{
|
||||
compiled: boolean;
|
||||
contains?: ICompiledMode[];
|
||||
keywords?: Object;
|
||||
terminators: RegExp;
|
||||
terminator_end?: string;
|
||||
}
|
||||
|
||||
export interface IOptions
|
||||
{
|
||||
classPrefix?: string;
|
||||
tabReplace?: string;
|
||||
useBR?: boolean;
|
||||
languages?: string[];
|
||||
}
|
||||
}
|
||||
export = hljs;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* howler-tests.ts
|
||||
* Created by xperiments on 02/09/14.
|
||||
*/
|
||||
///<reference path="howler.d.ts"/>
|
||||
|
||||
|
||||
Howler.codecs('ogg');
|
||||
Howler.iOSAutoEnable = true;
|
||||
var sound = new Howl({
|
||||
urls: ['sound.mp3']
|
||||
}).play();
|
||||
|
||||
|
||||
var sound = new Howl({
|
||||
urls: ['sound.mp3', 'sound.ogg', 'sound.wav'],
|
||||
autoplay: true,
|
||||
loop: true,
|
||||
volume: 0.5,
|
||||
onend: function() {
|
||||
console.log('Finished!');
|
||||
}
|
||||
});
|
||||
|
||||
var sound = new Howl({
|
||||
urls: ['sounds.mp3', 'sounds.ogg'],
|
||||
sprite: {
|
||||
blast: [0, 1000],
|
||||
laser: [2000, 3000],
|
||||
winner: [4000, 7500]
|
||||
}
|
||||
});
|
||||
|
||||
// shoot the laser!
|
||||
sound.play('laser');
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
// Type definitions for howler.js v1.1.25
|
||||
// Project: https://github.com/goldfire/howler.js
|
||||
// Definitions by: Pedro Casaubon <https://github.com/xperiments/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare class HowlerGlobal {
|
||||
mute(): HowlerGlobal;
|
||||
unmute(): HowlerGlobal;
|
||||
volume(): number;
|
||||
volume(volume: number): HowlerGlobal;
|
||||
codecs(extension: string): boolean;
|
||||
iOSAutoEnable: boolean;
|
||||
}
|
||||
|
||||
declare var Howler: HowlerGlobal;
|
||||
|
||||
|
||||
interface IHowlCallback {
|
||||
(): void;
|
||||
}
|
||||
interface IHowlSoundSpriteDefinition {
|
||||
[name: string]: number[]
|
||||
}
|
||||
interface IHowlProperties {
|
||||
autoplay?: boolean;
|
||||
buffer?: boolean;
|
||||
format?: string;
|
||||
loop?: boolean;
|
||||
sprite?: IHowlSoundSpriteDefinition;
|
||||
volume?: number;
|
||||
urls?: string[];
|
||||
onend?: IHowlCallback;
|
||||
onload?: IHowlCallback;
|
||||
onloaderror?: IHowlCallback;
|
||||
onpause?: IHowlCallback;
|
||||
onplay?: IHowlCallback;
|
||||
}
|
||||
|
||||
|
||||
declare class Howl {
|
||||
|
||||
autoplay: Boolean;
|
||||
buffer: Boolean;
|
||||
format: string;
|
||||
rate: number;
|
||||
model: string;
|
||||
onend: IHowlCallback;
|
||||
onload: IHowlCallback;
|
||||
onloaderror: IHowlCallback;
|
||||
onpause: IHowlCallback;
|
||||
onplay: IHowlCallback;
|
||||
constructor(properties: IHowlProperties);
|
||||
play(sprite?: string, callback?: (soundId: number) => void): Howl;
|
||||
pause(soundId?: number): Howl;
|
||||
stop(soundId?: number): Howl;
|
||||
mute(soundId?: number): Howl;
|
||||
unmute(soundId?: number): Howl;
|
||||
fade(from: number, to: number, duration: number, callback?: IHowlCallback, soundId?: number): Howl;
|
||||
loop(): boolean;
|
||||
loop(loop: boolean): Howl;
|
||||
pos(position?: number, soundId?: number): number;
|
||||
pos3d(x: number, y: number, z: number, soundId?: number): any;
|
||||
sprite(definition?: IHowlSoundSpriteDefinition): IHowlSoundSpriteDefinition;
|
||||
volume(): number;
|
||||
volume(volume?: number, soundId?: number): Howl;
|
||||
urls(): string[];
|
||||
urls(urls: string[]): Howl;
|
||||
on(event: string, listener?: () => void): Howl;
|
||||
off(event: string, listener?: () => void): Howl;
|
||||
unload(): void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
|
||||
*
|
||||
* Created by using code samples from https://github.com/mashpie/i18n-node.
|
||||
*/
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="i18n-node.d.ts" />
|
||||
|
||||
import express = require("express");
|
||||
import i18n = require("i18n");
|
||||
|
||||
var app = express();
|
||||
var req: express.Request;
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
* https://github.com/mashpie/i18n-node#configure
|
||||
*/
|
||||
i18n.configure({
|
||||
locales: ['en', 'de'],
|
||||
directory: __dirname + '/locales'
|
||||
});
|
||||
|
||||
i18n.configure({
|
||||
// setup some locales - other locales default to en silently
|
||||
locales: ['en', 'de'],
|
||||
|
||||
// you may alter a site wide default locale
|
||||
defaultLocale: 'de',
|
||||
|
||||
// sets a custom cookie name to parse locale settings from - defaults to NULL
|
||||
cookie: 'yourcookiename',
|
||||
|
||||
// where to store json files - defaults to './locales' relative to modules directory
|
||||
directory: './mylocales',
|
||||
|
||||
// whether to write new locale information to disk - defaults to true
|
||||
updateFiles: false,
|
||||
|
||||
// what to use as the indentation unit - defaults to "\t"
|
||||
indent: "\t",
|
||||
|
||||
// setting extension of json files - defaults to '.json' (you might want to set this to '.js' according to webtranslateit)
|
||||
extension: '.js',
|
||||
|
||||
// setting prefix of json files name - default to none '' (in case you use different locale files naming scheme (webapp-en.json), rather then just en.json)
|
||||
prefix: 'webapp-',
|
||||
|
||||
// enable object notation
|
||||
objectNotation: false
|
||||
});
|
||||
|
||||
/**
|
||||
* Usage in global scope
|
||||
* https://github.com/mashpie/i18n-node#example-usage-in-global-scope
|
||||
*/
|
||||
var greeting = i18n.__('Hello');
|
||||
|
||||
/**
|
||||
* Usage in Express
|
||||
* https://github.com/mashpie/i18n-node#example-usage-in-expressjs
|
||||
*/
|
||||
// Configuration
|
||||
app.configure(function () {
|
||||
// default: using 'accept-language' header to guess language settings
|
||||
app.use(i18n.init);
|
||||
});
|
||||
|
||||
app.get('/de', function (_req, res) {
|
||||
var greeting = res.__('Hello');
|
||||
});
|
||||
|
||||
/**
|
||||
* __()
|
||||
* https://github.com/mashpie/i18n-node#__
|
||||
*/
|
||||
// global (this.locale == 'de')
|
||||
i18n.__('Hello'); // Hallo
|
||||
i18n.__('Hello %s', 'Marcus'); // Hallo Marcus
|
||||
i18n.__('Hello {{name}}', { name: 'Marcus' }); // Hallo Marcus
|
||||
|
||||
// scoped via req object (req.locale == 'de')
|
||||
req.__('Hello'); // Hallo
|
||||
req.__('Hello %s', 'Marcus'); // Hallo Marcus
|
||||
req.__('Hello {{name}}', { name: 'Marcus' }); // Hallo Marcus
|
||||
|
||||
// passing specific locale
|
||||
i18n.__({ phrase: 'Hello', locale: 'fr' }); // Salut
|
||||
i18n.__({ phrase: 'Hello %s', locale: 'fr' }, 'Marcus'); // Salut Marcus
|
||||
i18n.__({ phrase: 'Hello {{name}}', locale: 'fr' }, { name: 'Marcus' }); // Salut Marcus
|
||||
|
||||
/**
|
||||
* __n()
|
||||
* https://github.com/mashpie/i18n-node#__n
|
||||
*/
|
||||
// global (this.locale == 'de')
|
||||
i18n.__n("%s cat", "%s cats", 1); // 1 Katze
|
||||
i18n.__n("%s cat", "%s cats", 3); // 3 Katzen
|
||||
|
||||
// scoped via req object (req.locale == 'de')
|
||||
req.__n("%s cat", "%s cats", 1); // 1 Katze
|
||||
req.__n("%s cat", "%s cats", 3); // 3 Katzen
|
||||
|
||||
// passing specific locale
|
||||
i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr" }, 1); // 1 chat
|
||||
i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr" }, 3); // 3 chat
|
||||
i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr", count: 1 }); // 1 chat
|
||||
i18n.__n({ singular: "%s cat", plural: "%s cats", locale: "fr", count: 3 }); // 3 chat
|
||||
|
||||
/**
|
||||
* setLocale()
|
||||
* https://github.com/mashpie/i18n-node#setlocale
|
||||
*/
|
||||
i18n.setLocale('de');
|
||||
i18n.setLocale(req, 'de');
|
||||
req.setLocale('de');
|
||||
|
||||
/**
|
||||
* getLocale()
|
||||
* https://github.com/mashpie/i18n-node#getlocale
|
||||
*/
|
||||
i18n.getLocale(); // --> de
|
||||
i18n.getLocale(req); // --> de
|
||||
req.getLocale(); // --> de
|
||||
|
||||
/**
|
||||
* getCatalog()
|
||||
* https://github.com/mashpie/i18n-node#getcatalog
|
||||
*/
|
||||
i18n.getCatalog(); // returns all locales
|
||||
i18n.getCatalog('de'); // returns just 'de'
|
||||
|
||||
i18n.getCatalog(req); // returns all locales
|
||||
i18n.getCatalog(req, 'de'); // returns just 'de'
|
||||
|
||||
req.getCatalog(); // returns all locales
|
||||
req.getCatalog('de'); // returns just 'de'
|
||||
|
||||
Vendored
+339
@@ -0,0 +1,339 @@
|
||||
// Type definitions for i18n-node 0.5.0
|
||||
// Project: https://github.com/mashpie/i18n-node
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
declare module i18n {
|
||||
export interface ConfigurationOptions {
|
||||
/** Setup some locales - other locales default to en silently */
|
||||
locales?: string[];
|
||||
/** Alter a site wide default locale */
|
||||
defaultLocale?: string;
|
||||
|
||||
/**
|
||||
* Sets a custom cookie name to parse locale settings from
|
||||
* @default null
|
||||
*/
|
||||
cookie?: string;
|
||||
/**
|
||||
* Where to store json files, relative to modules directory
|
||||
* @default "./locales"
|
||||
*/
|
||||
directory?: string;
|
||||
|
||||
/**
|
||||
* whether to write new locale information to disk
|
||||
* @default true
|
||||
*/
|
||||
updateFiles?: boolean;
|
||||
|
||||
/**
|
||||
* What to use as the indentation unit
|
||||
* @default "\t"
|
||||
*/
|
||||
indent?: string;
|
||||
|
||||
/**
|
||||
* Setting extension of json files (you might want to set this to '.js' according to webtranslateit)
|
||||
* @default ".json"
|
||||
*/
|
||||
extension?: string;
|
||||
|
||||
/**
|
||||
* Enable object notation
|
||||
* @default false
|
||||
*/
|
||||
objectNotation?: boolean;
|
||||
}
|
||||
export interface TranslateOptions {
|
||||
phrase: string;
|
||||
locale?: string;
|
||||
}
|
||||
export interface PluralOptions {
|
||||
singular: string;
|
||||
plural: string;
|
||||
count?: number;
|
||||
locale?: string;
|
||||
}
|
||||
export interface Replacements {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface LocaleCatalog {
|
||||
[key: string]: string;
|
||||
}
|
||||
export interface GlobalCatalog {
|
||||
[key: string]: LocaleCatalog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure current i18n instance
|
||||
* @param {ConfigurationOptions} options - configuration options for i18n
|
||||
*/
|
||||
function configure(options: ConfigurationOptions): void;
|
||||
|
||||
/**
|
||||
* Initialize i18n middleware for express
|
||||
* @param {Express.Request} request - Current express request
|
||||
* @param {Express.Response} response - Current express response
|
||||
* @param {Function} next - Callback to continue process
|
||||
*/
|
||||
function init(request: Express.Request, response: Express.Response, next?: Function): void;
|
||||
|
||||
//#region __()
|
||||
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {string} phrase - The phrase to translate
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __(phrase: string, ...replace: string[]): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {string} phrase - The phrase to translate
|
||||
* @param {Object} replacements - An object containing replacements
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __(phrase: string, replacements: Replacements): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {TranslateOptions} options - Options for translation
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __(options: TranslateOptions): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {TranslateOptions} options - Options for translation
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __(options: TranslateOptions, ...replace: string[]): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {TranslateOptions} options - Options for translation
|
||||
* @param {Object} replacements - An object containing replacements
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __(options: TranslateOptions, replacements: Replacements): string;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region __n()
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {PluralOptions} options - Options for plural translate
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __n(options: PluralOptions): string;
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {PluralOptions} options - Options for plural translate
|
||||
* @param {number} count - The number which allow to select from plural to singular
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __n(options: PluralOptions, count: number): string;
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {string} singular - The singular pharse to translate if count is <= 1
|
||||
* @param {string} plural - The plural pharse to translate if count is > 1
|
||||
* @param {number} count - The number which allow to select from plural to singular
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __n(singular: string, plural: string, count: number): string;
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {string} singular - The singular pharse to translate if count is <= 1
|
||||
* @param {string} plural - The plural pharse to translate if count is > 1
|
||||
* @param {number} count - The number which allow to select from plural to singular
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
function __n(singular: string, plural: string, count: string): string;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Locale
|
||||
|
||||
/**
|
||||
* Change the current active locale
|
||||
* @param {string} locale - The locale to set as default
|
||||
*/
|
||||
function setLocale(locale: string): void;
|
||||
/**
|
||||
* Change the current active locale for specified request
|
||||
* @param {Express.Request} request - The request to change locale on
|
||||
* @param {string} locale - The locale to set as default
|
||||
*/
|
||||
function setLocale(request: Express.Request, locale: string): void;
|
||||
|
||||
/**
|
||||
* Get the current active locale
|
||||
* @returns {string} The current locale in request
|
||||
*/
|
||||
function getLocale(): string;
|
||||
/**
|
||||
* Get the current active locale for specified request
|
||||
* @param {Express.Request} request - The request to get locale for
|
||||
* @returns {string} The current locale in request
|
||||
*/
|
||||
function getLocale(request: Express.Request): string;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Catalog
|
||||
|
||||
/**
|
||||
* Get the current global catalog
|
||||
* @returns {GlobalCatalog} The current global catalog
|
||||
*/
|
||||
function getCatalog(): GlobalCatalog;
|
||||
/**
|
||||
* Get the catalog for the given locale
|
||||
* @param {string} locale - The locale to get catalog for
|
||||
* @returns {LocaleCatalog} The specified locale catalog
|
||||
*/
|
||||
function getCatalog(locale: string): LocaleCatalog;
|
||||
/**
|
||||
* Get the current active locale catalog for specified request
|
||||
* @param {Express.Request} request - The request to get locale catalog for
|
||||
* @returns {LocaleCatalog} The current locale catalog for the specified request
|
||||
*/
|
||||
function getCatalog(request: Express.Request): LocaleCatalog;
|
||||
/**
|
||||
* Get the current locale catalog for specified request and specified locale
|
||||
* @param {Express.Request} request - The request to get locale catalog for
|
||||
* @param {string} locale - The locale to get catalog for
|
||||
* @returns {LocaleCatalog} The specified locale catalog
|
||||
*/
|
||||
function getCatalog(request: Express.Request, locale: string): LocaleCatalog;
|
||||
|
||||
//#endregion
|
||||
|
||||
/**
|
||||
* Override the current request locale by using the query param (?locale=en)
|
||||
* @param {Express.Request} [request] - The request to override locale for
|
||||
*/
|
||||
function overrideLocaleFromQuery(request?: Express.Request): void;
|
||||
|
||||
/**
|
||||
* Get current i18n-node version
|
||||
* @member {string}
|
||||
*/
|
||||
var version: string;
|
||||
}
|
||||
|
||||
interface i18nAPI {
|
||||
locale: string;
|
||||
|
||||
//#region __()
|
||||
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {string} phrase - The phrase to translate
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__(phrase: string, ...replace: string[]): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {string} phrase - The phrase to translate
|
||||
* @param {Object} replacements - An object containing replacements
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__(phrase: string, replacements: i18n.Replacements): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {TranslateOptions} options - Options for translation
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__(options: i18n.TranslateOptions): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {TranslateOptions} options - Options for translation
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__(options: i18n.TranslateOptions, ...replace: string[]): string;
|
||||
/**
|
||||
* Translate the given phrase using locale configuration
|
||||
* @param {TranslateOptions} options - Options for translation
|
||||
* @param {Object} replacements - An object containing replacements
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__(options: i18n.TranslateOptions, replacements: i18n.Replacements): string;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region __n()
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {PluralOptions} options - Options for plural translate
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__n(options: i18n.PluralOptions): string;
|
||||
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {PluralOptions} options - Options for plural translate
|
||||
* @param {number} count - The number which allow to select from plural to singular
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__n(options: i18n.PluralOptions, count: number): string;
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {string} singular - The singular pharse to translate if count is <= 1
|
||||
* @param {string} plural - The plural pharse to translate if count is > 1
|
||||
* @param {number} count - The number which allow to select from plural to singular
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__n(singular: string, plural: string, count: number): string;
|
||||
/**
|
||||
* Translate with plural condition the given phrase and count using locale configuration
|
||||
* @param {string} singular - The singular pharse to translate if count is <= 1
|
||||
* @param {string} plural - The plural pharse to translate if count is > 1
|
||||
* @param {number} count - The number which allow to select from plural to singular
|
||||
* @returns {string} The translated phrase
|
||||
*/
|
||||
__n(singular: string, plural: string, count: string): string;
|
||||
|
||||
//#endregion
|
||||
|
||||
/**
|
||||
* Get the current active locale
|
||||
* @returns {string} The current locale in request
|
||||
*/
|
||||
getLocale(): string;
|
||||
/**
|
||||
* Change the current active locale
|
||||
* @param {string} locale - The locale to set as default
|
||||
*/
|
||||
setLocale(locale: string): void;
|
||||
|
||||
/**
|
||||
* Get the current global catalog
|
||||
* @returns {GlobalCatalog} The current global catalog
|
||||
*/
|
||||
getCatalog(): i18n.GlobalCatalog;
|
||||
/**
|
||||
* Get the catalog for the given locale
|
||||
* @param {string} locale - The locale to get catalog for
|
||||
* @returns {LocaleCatalog} The specified locale catalog
|
||||
*/
|
||||
getCatalog(locale: string): i18n.LocaleCatalog;
|
||||
}
|
||||
|
||||
declare module "i18n" {
|
||||
export = i18n;
|
||||
}
|
||||
|
||||
declare module Express {
|
||||
export interface Request extends i18nAPI {
|
||||
languages: string[];
|
||||
regions: string[];
|
||||
language: string;
|
||||
region: string;
|
||||
}
|
||||
export interface Response extends i18nAPI {
|
||||
locals: i18nAPI
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/// <reference path="i18next.d.ts" />
|
||||
|
||||
declare function done(): void;
|
||||
|
||||
|
||||
describe('i18next', function () {
|
||||
|
||||
var i18n = $.i18n
|
||||
@@ -685,6 +685,23 @@ describe('i18next', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('exists functionality', function () {
|
||||
var resStore = {
|
||||
dev: { translation: { empty: '' } },
|
||||
en: { translation: {} },
|
||||
'en-US': { translation: {} }
|
||||
};
|
||||
|
||||
beforeEach(function (done) {
|
||||
i18n.init($.extend(opts, { resStore: resStore }),
|
||||
function (t) { done(); });
|
||||
});
|
||||
|
||||
it('it should be able to test if a key exists', function () {
|
||||
expect(i18n.exists('empty')).to.be(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resource string as array', function () {
|
||||
var resStore = {
|
||||
dev: { translation: { testarray: ["title", "text"] } },
|
||||
|
||||
Vendored
+4
-3
@@ -109,6 +109,7 @@ interface I18nextStatic {
|
||||
};
|
||||
t(key: string, options?: any): string;
|
||||
translate(key: string, options?: any): string;
|
||||
exists(key: string, options?: any): boolean;
|
||||
}
|
||||
|
||||
// jQuery extensions
|
||||
@@ -118,9 +119,9 @@ interface JQueryStatic {
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/* Note: options are same options as used by the translate function. Alternatively by
|
||||
setting init option or translation option 'useDataAttrOptions = true' the Options
|
||||
for translation will be read and cached in the elements data-i18n-options attribute.
|
||||
/* Note: options are same options as used by the translate function. Alternatively by
|
||||
setting init option or translation option 'useDataAttrOptions = true' the Options
|
||||
for translation will be read and cached in the elements data-i18n-options attribute.
|
||||
*/
|
||||
i18n: (options?: I18nextOptions) => void;
|
||||
}
|
||||
|
||||
@@ -103,5 +103,6 @@ interact.deltaSource("page");
|
||||
interact.restrict({
|
||||
"drag": rectangle,
|
||||
"resize": rectangle,
|
||||
"gesture": rectangle
|
||||
"gesture": rectangle,
|
||||
"elementRect": { top: 0, left: 0, bottom: 1, right: 1 }
|
||||
});
|
||||
Vendored
+4
-3
@@ -1,7 +1,7 @@
|
||||
// Type definitions for Interacting for interact.js v1.0.17
|
||||
// Type definitions for Interacting for interact.js v1.0.25
|
||||
// Project: https://github.com/taye/interact.js
|
||||
// Definitions by: Douglas Eichelberger <https://github.com/dduugg>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyType
|
||||
// Definitions by: Douglas Eichelberger <https://github.com/dduugg>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// API documentation: http://interactjs.io/docs
|
||||
|
||||
@@ -157,6 +157,7 @@ interface Restrict {
|
||||
drag?: any;
|
||||
gesture?: any;
|
||||
resize?: any;
|
||||
elementRect?: {[direction: string]: number};
|
||||
}
|
||||
|
||||
interface InteractEvent {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="ip.d.ts" />
|
||||
|
||||
import ip = require('ip');
|
||||
|
||||
var myIP = ip.address();
|
||||
|
||||
ip.cidr("192.168.0.1/24");
|
||||
ip.fromLong(ip.toLong(myIP));
|
||||
ip.fromPrefixLen(24);
|
||||
ip.isEqual("192.168.0.1", myIP);
|
||||
ip.isLoopback("127.0.0.1");
|
||||
ip.isPrivate(myIP);
|
||||
ip.isPublic(myIP);
|
||||
ip.loopback("ipv6");
|
||||
ip.mask("192.168.0.1", "255.255.255.0");
|
||||
ip.not("255.255.255.0");
|
||||
ip.or("192.168.0.1", "255.255.255.0");
|
||||
var buff:any = ip.toBuffer(myIP);
|
||||
ip.toString(buff);
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
// Type definitions for node-ip
|
||||
// Project: https://github.com/indutny/node-ip
|
||||
// Definitions by: Peter Harris <https://github.com/codeanimal>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface NodeBuffer { }
|
||||
|
||||
declare module "ip" {
|
||||
/**
|
||||
* Check two IP address are the same.
|
||||
**/
|
||||
export function isEqual(ip1: string, ip2: string): boolean;
|
||||
|
||||
/**
|
||||
* Convert an IP string into a buffer.
|
||||
**/
|
||||
export function toBuffer(ip: string, buffer?: number, offset?: number): NodeBuffer;
|
||||
|
||||
/**
|
||||
* Convert an IP buffer into a string.
|
||||
**/
|
||||
export function toString(ip: NodeBuffer, offset?: number, length?: number): string;
|
||||
|
||||
/**
|
||||
* Get the subnet mask from a CIDR prefix length.
|
||||
*
|
||||
* @param family The IP family is infered from the prefixLength, but can be explicity specified as either "ipv4" or "ipv6".
|
||||
**/
|
||||
export function fromPrefixLen(prefixLength: number, family?:string): string;
|
||||
|
||||
/**
|
||||
* Get the network ID IP address from an IP address and its subnet mask.
|
||||
**/
|
||||
export function mask(ip: string, mask: string): string;
|
||||
|
||||
/**
|
||||
* Get the network ID IP address from an IP address in CIDR notation.
|
||||
**/
|
||||
export function cidr(cidr: string): string;
|
||||
|
||||
/**
|
||||
* Get the bitwise inverse (NOT every octet) of an IP address or subnet mask.
|
||||
**/
|
||||
export function not(ip: string): string;
|
||||
|
||||
/**
|
||||
* Get the bitwise OR of two IP addresses (usually an IP address and a subnet mask).
|
||||
**/
|
||||
export function or(ip: string, mask:string): string;
|
||||
|
||||
/**
|
||||
* Check whether an IP is within a private IP address range.
|
||||
**/
|
||||
export function isPrivate(ip: string): boolean;
|
||||
|
||||
/**
|
||||
* Check whether an IP is within a public IP address range.
|
||||
**/
|
||||
export function isPublic(ip: string): boolean;
|
||||
|
||||
/**
|
||||
* Check whether an IP is a loopback address.
|
||||
**/
|
||||
export function isLoopback(ip: string): boolean;
|
||||
|
||||
/**
|
||||
* Get the loopback address for an IP family.
|
||||
*
|
||||
* @param family The family can be either "ipv4" or "ipv6". Default: "ipv4".
|
||||
**/
|
||||
export function loopback(family?: string): string;
|
||||
|
||||
/**
|
||||
* Get the address for the network interface on the current system with the specified 'name'.
|
||||
* If no interface name is specified, the first IPv4 address or loopback address is returned.
|
||||
*
|
||||
* @param name The name can be any named interface, or 'public' or 'private'.
|
||||
* @param family The family can be either "ipv4" or "ipv6". Default: "ipv4".
|
||||
**/
|
||||
export function address(name?: string, family?: string):string;
|
||||
|
||||
/**
|
||||
* Convert a string IPv4 IP address to the equivalent long numeric value.
|
||||
**/
|
||||
export function toLong(ip: string): number;
|
||||
|
||||
/**
|
||||
* Convert an IPv4 IP address from its the long numeric value to a string.
|
||||
**/
|
||||
export function fromLong(ip: number): string;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ function test_disable() {
|
||||
}
|
||||
|
||||
function test_reload() {
|
||||
$.pjax.reload();
|
||||
$.pjax.reload("#pjax-container");
|
||||
}
|
||||
|
||||
function test_defauluts() {
|
||||
|
||||
Vendored
+1
-1
@@ -131,7 +131,7 @@ interface PjaxStatic {
|
||||
/**
|
||||
* Reload current page with pjax.
|
||||
*/
|
||||
reload(): JQueryXHR;
|
||||
reload(container: string, options?: PjaxSettings): JQueryXHR;
|
||||
}
|
||||
|
||||
interface JQuerySupport {
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
|
||||
*
|
||||
* Created by using code samples from https://github.com/auth0/node-jsonwebtoken.
|
||||
*/
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="jsonwebtoken.d.ts" />
|
||||
|
||||
import jwt = require("jsonwebtoken");
|
||||
import fs = require("fs");
|
||||
|
||||
var token: string;
|
||||
var cert: Buffer;
|
||||
|
||||
/**
|
||||
* jwt.sign
|
||||
* https://github.com/auth0/node-jsonwebtoken#usage
|
||||
*/
|
||||
// sign with default (HMAC SHA256)
|
||||
token = jwt.sign({ foo: 'bar' }, 'shhhhh');
|
||||
|
||||
// sign with RSA SHA256
|
||||
cert = fs.readFileSync('private.key'); // get private key
|
||||
token = jwt.sign({ foo: 'bar' }, cert, { algorithm: 'RS256'});
|
||||
|
||||
/**
|
||||
* jwt.verify
|
||||
* https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback
|
||||
*/
|
||||
// verify a token symmetric
|
||||
jwt.verify(token, 'shhhhh', function(err, decoded) {
|
||||
console.log(decoded.foo) // bar
|
||||
});
|
||||
|
||||
// invalid token
|
||||
jwt.verify(token, 'wrong-secret', function(err, decoded) {
|
||||
// err
|
||||
// decoded undefined
|
||||
});
|
||||
|
||||
// verify a token asymmetric
|
||||
cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, function(err, decoded) {
|
||||
console.log(decoded.foo) // bar
|
||||
});
|
||||
|
||||
// verify audience
|
||||
cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { audience: 'urn:foo' }, function(err, decoded) {
|
||||
// if audience mismatch, err == invalid audience
|
||||
});
|
||||
|
||||
// verify issuer
|
||||
cert = fs.readFileSync('public.pem'); // get public key
|
||||
jwt.verify(token, cert, { audience: 'urn:foo', issuer: 'urn:issuer' }, function(err, decoded) {
|
||||
// if issuer mismatch, err == invalid issuer
|
||||
});
|
||||
|
||||
/**
|
||||
* jwt.decode
|
||||
* https://github.com/auth0/node-jsonwebtoken#jwtdecodetoken
|
||||
*/
|
||||
var decoded = jwt.decode(token);
|
||||
Vendored
+79
@@ -0,0 +1,79 @@
|
||||
// Type definitions for jsonwebtoken 0.4.0
|
||||
// Project: https://github.com/auth0/node-jsonwebtoken
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "jsonwebtoken" {
|
||||
|
||||
export interface SignOptions {
|
||||
/**
|
||||
* Signature algorithm. Could be one of these values :
|
||||
* - HS256: HMAC using SHA-256 hash algorithm
|
||||
* - HS384: HMAC using SHA-384 hash algorithm
|
||||
* - HS512: HMAC using SHA-512 hash algorithm
|
||||
* - RS256: RSASSA using SHA-256 hash algorithm
|
||||
* - RS384: RSASSA using SHA-384 hash algorithm
|
||||
* - RS512: RSASSA using SHA-512 hash algorithm
|
||||
* - ES256: ECDSA using P-256 curve and SHA-256 hash algorithm
|
||||
* - ES384: ECDSA using P-384 curve and SHA-384 hash algorithm
|
||||
* - ES512: ECDSA using P-521 curve and SHA-512 hash algorithm
|
||||
* - none: No digital signature or MAC value included
|
||||
*/
|
||||
algorithm?: string;
|
||||
/** @member {number} - Lifetime for the token in minutes */
|
||||
expiresInMinutes?: number;
|
||||
audience?: string;
|
||||
subject?: string;
|
||||
issuer?: string;
|
||||
}
|
||||
|
||||
export interface VerifyOptions {
|
||||
audience?: string;
|
||||
issuer?: string;
|
||||
}
|
||||
|
||||
export interface VerifyCallbak {
|
||||
(err: Error, decoded: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign the given payload into a JSON Web Token string
|
||||
* @param {String|Object|Buffer} payload - Payload to sign, could be an literal, buffer or string
|
||||
* @param {String|Buffer} secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
|
||||
* @param {SignOptions} [options] - Options for the signature
|
||||
* @returns {String} The JSON Web Token string
|
||||
*/
|
||||
export function sign(payload: string, secretOrPrivateKey: string): string;
|
||||
export function sign(payload: string, secretOrPrivateKey: Buffer): string;
|
||||
export function sign(payload: Buffer, secretOrPrivateKey: string): string;
|
||||
export function sign(payload: Buffer, secretOrPrivateKey: Buffer): string;
|
||||
export function sign(payload: Object, secretOrPrivateKey: string): string;
|
||||
export function sign(payload: Object, secretOrPrivateKey: Buffer): string;
|
||||
export function sign(payload: string, secretOrPrivateKey: string, options: SignOptions): string;
|
||||
export function sign(payload: string, secretOrPrivateKey: Buffer, options: SignOptions): string;
|
||||
export function sign(payload: Buffer, secretOrPrivateKey: string, options: SignOptions): string;
|
||||
export function sign(payload: Buffer, secretOrPrivateKey: Buffer, options: SignOptions): string;
|
||||
export function sign(payload: Object, secretOrPrivateKey: string, options: SignOptions): string;
|
||||
export function sign(payload: Object, secretOrPrivateKey: Buffer, options: SignOptions): string;
|
||||
|
||||
/**
|
||||
* Verify given token using a secret or a public key to get a decoded token
|
||||
* @param {String} token - JWT string to verify
|
||||
* @param {String|Buffer} secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA.
|
||||
* @param {VerifyOptions} [options] - Options for the verification
|
||||
* @param {Function} callback - Callback to get the decoded token on
|
||||
*/
|
||||
function verify(token: string, secretOrPublicKey: string, callback: VerifyCallbak): void;
|
||||
function verify(token: string, secretOrPublicKey: Buffer, callback: VerifyCallbak): void;
|
||||
function verify(token: string, secretOrPublicKey: string, options: VerifyOptions, callback: VerifyCallbak): void;
|
||||
function verify(token: string, secretOrPublicKey: Buffer, options: VerifyOptions, callback: VerifyCallbak): void;
|
||||
|
||||
/**
|
||||
* Returns the decoded payload without verifying if the signature is valid.
|
||||
* @param {String} token - JWT string to decode
|
||||
* @returns {Object} The decoded Token
|
||||
*/
|
||||
function decode(token: string): any;
|
||||
}
|
||||
@@ -69,6 +69,12 @@ var advancedTree = $("#briefcasetree").jstree({
|
||||
|
||||
var a = $('a').jstree();
|
||||
|
||||
// test search node
|
||||
a.search('test', false, true);
|
||||
|
||||
//test redraw node
|
||||
a.redraw_node($('#node1'), false, false, false);
|
||||
|
||||
|
||||
//tree with new unique plugin parameters
|
||||
var treeWithUnique = $('#treeWithUnique').jstree({
|
||||
|
||||
Vendored
+14
-5
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jsTree v3.0.3
|
||||
// Type definitions for jsTree v3.0.4
|
||||
// Project: http://www.jstree.com/
|
||||
// Definitions by: Adam Pluciński <https://github.com/adaskothebeast>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -555,8 +555,9 @@ interface JSTreeStaticDefaultsSearch {
|
||||
case_sensitive: boolean;
|
||||
|
||||
/**
|
||||
* Indicates if the tree should be filtered to show only matching nodes
|
||||
* (keep in mind this can be a heavy on large trees in old browsers). Default is `false`.
|
||||
* Indicates if the tree should be filtered (by default) to show only matching nodes
|
||||
* (keep in mind this can be a heavy on large trees in old browsers).
|
||||
* This setting can be changed at runtime when calling the search method. Default is `false`.
|
||||
* @name $.jstree.defaults.search.show_only_matches
|
||||
* @plugin search
|
||||
*/
|
||||
@@ -1183,8 +1184,15 @@ interface JSTree extends JQuery {
|
||||
show_icon: (obj: any) => void;
|
||||
|
||||
/**
|
||||
* redraws a single node. Used internally.
|
||||
* @private
|
||||
* @name redraw_node(node, deep, is_callback)
|
||||
* @param {mixed} node the node to redraw
|
||||
* @param {Boolean} deep should child nodes be redrawn too
|
||||
* @param {Boolean} is_callback is this a recursion call
|
||||
* @param {Boolean} force_render should children of closed parents be drawn anyway
|
||||
*/
|
||||
redraw_node: (obj: any, deep: boolean, is_callback: boolean) => any;
|
||||
redraw_node: (obj: any, deep?: boolean, is_callback?: boolean, force_render?: boolean) => any;
|
||||
|
||||
/**
|
||||
* show the node checkbox icons
|
||||
@@ -1308,10 +1316,11 @@ interface JSTree extends JQuery {
|
||||
* @name search(str [, skip_async])
|
||||
* @param {String} str the search string
|
||||
* @param {Boolean} skip_async if set to true server will not be queried even if configured
|
||||
* @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers)
|
||||
* @plugin search
|
||||
* @trigger search.jstree
|
||||
*/
|
||||
search: (str: string, skip_async?: boolean) => void;
|
||||
search: (str: string, skip_async?: boolean, show_only_matches?: boolean) => void;
|
||||
|
||||
/**
|
||||
* used to clear the last search (removes classes and shows all nodes if filtering is on)
|
||||
|
||||
Vendored
+52
-1
@@ -161,6 +161,7 @@ interface KnockoutBindingHandlers {
|
||||
enable: KnockoutBindingHandler;
|
||||
disable: KnockoutBindingHandler;
|
||||
value: KnockoutBindingHandler;
|
||||
textInput: KnockoutBindingHandler;
|
||||
hasfocus: KnockoutBindingHandler;
|
||||
checked: KnockoutBindingHandler;
|
||||
options: KnockoutBindingHandler;
|
||||
@@ -556,7 +557,13 @@ interface KnockoutBindingProvider {
|
||||
}
|
||||
|
||||
interface KnockoutComponents {
|
||||
register(componentName: string, definition: KnockoutComponentDefinition): void;
|
||||
// overloads for register method:
|
||||
register(componentName: string, config: KnockoutComponentRegister): void;
|
||||
register(componentName: string, config: KnockoutComponentRegisterStringTemplate): void;
|
||||
register(componentName: string, config: KnockoutComponentRegisterFnViewModel): void;
|
||||
register(componentName: string, config: KnockoutComponentRegisterStringTemplateFnViewModel): void;
|
||||
register(componentName: string, config: KnockoutComponentRegisterAMD): void;
|
||||
|
||||
isRegistered(componentName: string): boolean;
|
||||
unregister(componentName: string): void;
|
||||
get(componentName: string, callback: (definition: KnockoutComponentDefinition) => void): void;
|
||||
@@ -566,6 +573,50 @@ interface KnockoutComponents {
|
||||
getComponentNameForNode(node: Node): string;
|
||||
}
|
||||
|
||||
/* interfaces for register overloads*/
|
||||
|
||||
interface KnockoutComponentRegister {
|
||||
template: KnockoutComponentTemplate;
|
||||
viewModel?: KnockoutComponentConfigViewModel;
|
||||
}
|
||||
|
||||
interface KnockoutComponentRegisterAMD {
|
||||
// load self-describing module using AMD module name
|
||||
require: string;
|
||||
}
|
||||
|
||||
interface KnockoutComponentRegisterFnViewModel {
|
||||
template: KnockoutComponentTemplate;
|
||||
viewModel?: (params: any) => any;
|
||||
}
|
||||
|
||||
interface KnockoutComponentRegisterStringTemplate {
|
||||
template: string;
|
||||
viewModel?: KnockoutComponentConfigViewModel;
|
||||
}
|
||||
|
||||
interface KnockoutComponentRegisterStringTemplateFnViewModel {
|
||||
template: string;
|
||||
viewModel?: (params: any) => any;
|
||||
}
|
||||
|
||||
interface KnockoutComponentConfigViewModel {
|
||||
instance?: any;
|
||||
createViewModel? (params?: any, componentInfo?: KnockoutComponentInfo): any;
|
||||
require?: string;
|
||||
}
|
||||
|
||||
interface KnockoutComponentTemplate {
|
||||
// specify element id (string) or a node
|
||||
element?: any;
|
||||
// AMD module load
|
||||
require?: string;
|
||||
}
|
||||
|
||||
interface KnockoutComponentInfo {
|
||||
element: any;
|
||||
}
|
||||
/* end register overloads */
|
||||
interface KnockoutComponentDefinition {
|
||||
template: Node[];
|
||||
createViewModel?(params: any, options: { element: Node; }): any;
|
||||
|
||||
@@ -602,4 +602,49 @@ function test_allBindingsAccessor() {
|
||||
var fnAccessorBinding = allBindingsAccessor().myBindingName;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function test_Components() {
|
||||
|
||||
function test_Register() {
|
||||
// test all possible ko.components.register() overloads
|
||||
var nodeArray = [new Node, new Node];
|
||||
var singleNode = new Node;
|
||||
|
||||
// ------- string-templates with different viewmodel overloads:
|
||||
|
||||
// string template and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: "string-template", viewModel: function (params) { return null; } });
|
||||
|
||||
// string template and instance vm
|
||||
ko.components.register("name", { template: "string-template", viewModel: { instance: null } });
|
||||
|
||||
// string template and createViewModel factory method
|
||||
ko.components.register("name", { template: "string-template", viewModel: { createViewModel: function (params: any, componentInfo: KnockoutComponentInfo) { return null; } } });
|
||||
|
||||
// string template and require module vm
|
||||
ko.components.register("name", { template: "string-template", viewModel: { require: "module" } });
|
||||
|
||||
// ------- non-string templates
|
||||
|
||||
// viewmodel as function and four types of template
|
||||
ko.components.register("name", { template: { element: "elementID" }, viewModel: function (params) { return null; } });
|
||||
// Node template for element and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: { element: singleNode }, viewModel: function (params) { return null; } });
|
||||
// object template for element and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: nodeArray, viewModel: function (params) { return null; } });
|
||||
// object template for element and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: { require: "module" }, viewModel: function (params) { return null; } });
|
||||
|
||||
// viewmodel as object, and four types of non-string tempalte
|
||||
ko.components.register("name", { template: { element: "elementID" }, viewModel: { instance: null } });
|
||||
// Node template for element and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: { element: singleNode }, viewModel: { instance: null } });
|
||||
// object template for element and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: nodeArray, viewModel: { instance: null } });
|
||||
// object template for element and inline function (commonly used in examples)
|
||||
ko.components.register("name", { template: { require: "module" }, viewModel: { instance: null } });
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="../bootstrap/bootstrap.d.ts" />
|
||||
///<reference path="../knockout/knockout.d.ts" />
|
||||
/// <reference path="knockstrap.d.ts" />
|
||||
|
||||
|
||||
// test unique id
|
||||
var adaskoUnitqueId: string = ko.utils.uniqueId('adaskothebeast');
|
||||
|
||||
class Sample {
|
||||
public property1: KnockoutObservable<string>;
|
||||
|
||||
constructor() {
|
||||
this.property1 = ko.observable('test');
|
||||
}
|
||||
}
|
||||
|
||||
var sample = new Sample();
|
||||
|
||||
// test unwrap properties
|
||||
var unwrappedProperties = ko.utils.unwrapProperties(sample);
|
||||
|
||||
var kts: KnockoutTemplateSources;
|
||||
var stringTemplate = kts.stringTemplate('string-template');
|
||||
var stname = stringTemplate.templateName;
|
||||
|
||||
ko.stringTemplateEngine.instance.allowTemplateRewriting = true;
|
||||
|
||||
var templateSource = ko.stringTemplateEngine.instance.makeTemplateSource('template');
|
||||
ko.stringTemplateEngine.instance.addTemplate('test', {});
|
||||
ko.stringTemplateEngine.instance.removeTemplate('test');
|
||||
ko.stringTemplateEngine.instance.isTemplateExist('test');
|
||||
|
||||
|
||||
var alertbh = ko.bindingHandlers.alert;
|
||||
var carouselbh = ko.bindingHandlers.carousel;
|
||||
var checkboxbh = ko.bindingHandlers.checkbox;
|
||||
var modalbh = ko.bindingHandlers.modal;
|
||||
var popoverbh = ko.bindingHandlers.popover;
|
||||
var progressbh = ko.bindingHandlers.progress;
|
||||
var radiobh = ko.bindingHandlers.radio;
|
||||
var togglebh = ko.bindingHandlers.toggle;
|
||||
var tooltipbh = ko.bindingHandlers.tooltip;
|
||||
Vendored
+163
@@ -0,0 +1,163 @@
|
||||
// Type definitions for Knockstrap
|
||||
// Project: http://faulknercs.github.io/Knockstrap/
|
||||
// Definitions by: Adam Pluciński <https://github.com/adaskothebeast>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="../bootstrap/bootstrap.d.ts" />
|
||||
///<reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
interface KnockoutUtils {
|
||||
uniqueId(prefix: string): string;
|
||||
unwrapProperties(wrappedProperies: any): any;
|
||||
}
|
||||
|
||||
interface KnockoutTemplateSources {
|
||||
stringTemplate: {
|
||||
prototype: KnockstrapStringTemplate;
|
||||
new (template: string): KnockstrapStringTemplate;
|
||||
};
|
||||
}
|
||||
|
||||
interface KnockstrapStringTemplate extends KnockoutTemplateSourcesDomElement {
|
||||
templateName: string;
|
||||
}
|
||||
|
||||
interface KnockoutStatic {
|
||||
stringTemplateEngine: {
|
||||
prototype: KnockstrapStringTemplateEngine;
|
||||
new (): KnockstrapStringTemplateEngine;
|
||||
instance: KnockstrapStringTemplateEngine;
|
||||
}
|
||||
}
|
||||
|
||||
interface KnockstrapStringTemplateEngine extends KnockoutNativeTemplateEngine {
|
||||
allowTemplateRewriting: boolean;
|
||||
makeTemplateSource(template: string): KnockstrapStringTemplate;
|
||||
addTemplate(name: string, template: any): void;
|
||||
removeTemplate(name: string): void;
|
||||
isTemplateExist(name: string): boolean;
|
||||
getTemplate(name: string): any;
|
||||
}
|
||||
|
||||
interface KnockoutBindingHandlers {
|
||||
alert: AlertKnockoutBindingHandler;
|
||||
carousel: CarouselKnockoutBindingHandler;
|
||||
checkbox: KnockoutBindingHandler;
|
||||
modal: ModalKnockoutBindingHandler;
|
||||
popover: PopoverKnockoutBindingHandler;
|
||||
progress: ProgressKnockoutBindingHandler;
|
||||
radio: KnockoutBindingHandler;
|
||||
toggle: KnockoutBindingHandler;
|
||||
tooltip: KnockoutBindingHandler;
|
||||
}
|
||||
|
||||
interface KnockoutControlsDescendantBindings {
|
||||
controlsDescendantBindings: boolean;
|
||||
}
|
||||
|
||||
interface AlertKnockoutBindingHandler extends KnockoutBindingHandler {
|
||||
init? (element: any,
|
||||
valueAccessor: () => any,
|
||||
allBindingsAccessor: KnockoutAllBindingsAccessor,
|
||||
viewModel: any,
|
||||
bindingContext: KnockoutBindingContext): KnockoutControlsDescendantBindings;
|
||||
}
|
||||
|
||||
interface CarouselKnockoutBindingHandler extends KnockoutBindingHandler {
|
||||
init? (element: any,
|
||||
valueAccessor: () => any,
|
||||
allBindingsAccessor: KnockoutAllBindingsAccessor,
|
||||
viewModel: any,
|
||||
bindingContext: KnockoutBindingContext): KnockoutControlsDescendantBindings;
|
||||
defaults: KnockstrapCarouselDefaults;
|
||||
}
|
||||
|
||||
interface KnockstrapCarouselDefaults {
|
||||
css: string;
|
||||
controlsTemplate: KnockstrapCarouselDefaultsControlsTemplate;
|
||||
indicatorsTemplate: KnockstrapCarouselDefaultsIndicatorsTemplate;
|
||||
itemTemplate: KnockstrapCarouselDefaultsItemTemplate;
|
||||
}
|
||||
|
||||
interface KnockstrapDefaultsTemplateBase {
|
||||
name: string;
|
||||
templateEngine: KnockstrapStringTemplateEngine;
|
||||
}
|
||||
|
||||
interface KnockstrapCarouselDefaultsControlsTemplate extends KnockstrapDefaultsTemplateBase {
|
||||
dataConverter(value: any): KnockstrapCarouselDefaultsIdDataConverted;
|
||||
|
||||
}
|
||||
|
||||
interface KnockstrapCarouselDefaultsIdDataConverted {
|
||||
id: KnockoutComputed<string>;
|
||||
}
|
||||
|
||||
interface KnockstrapCarouselDefaultsIndicatorsTemplate extends KnockstrapDefaultsTemplateBase {
|
||||
dataConverter(value: any): KnockstrapCarouselDefaultsIdItemsDataConverted;
|
||||
}
|
||||
|
||||
interface KnockstrapCarouselDefaultsIdItemsDataConverted extends KnockstrapCarouselDefaultsIdDataConverted {
|
||||
items: any;
|
||||
}
|
||||
|
||||
interface KnockstrapCarouselDefaultsItemTemplate extends KnockstrapDefaultsTemplateBase {
|
||||
converter(value: any): any;
|
||||
}
|
||||
|
||||
interface ModalKnockoutBindingHandler extends KnockoutBindingHandler {
|
||||
init? (element: any,
|
||||
valueAccessor: () => any,
|
||||
allBindingsAccessor: KnockoutAllBindingsAccessor,
|
||||
viewModel: any,
|
||||
bindingContext: KnockoutBindingContext): KnockoutControlsDescendantBindings;
|
||||
defaults: KnockstrapModalDefaults;
|
||||
}
|
||||
|
||||
interface KnockstrapModalDefaults {
|
||||
css: string;
|
||||
attributes: KnockstrapModalDefaultsAttributes;
|
||||
headerTemplate: KnockstrapDefaultsTemplateBase;
|
||||
bodyTemplate: KnockstrapDefaultsTemplateBase;
|
||||
footerTemplate: KnockstrapModalDefaultsFooterTemplate;
|
||||
}
|
||||
|
||||
interface KnockstrapModalDefaultsAttributes {
|
||||
role: string;
|
||||
}
|
||||
|
||||
interface KnockstrapModalDefaultsFooterTemplate extends KnockstrapDefaultsTemplateBase {
|
||||
data: KnockstrapModalDefaultsFooterData;
|
||||
}
|
||||
|
||||
interface KnockstrapModalDefaultsFooterData {
|
||||
closeLabel: string;
|
||||
primaryLabel: string;
|
||||
}
|
||||
|
||||
interface PopoverKnockoutBindingHandler extends KnockoutBindingHandler {
|
||||
init? (element: any,
|
||||
valueAccessor: () => any,
|
||||
allBindingsAccessor: KnockoutAllBindingsAccessor,
|
||||
viewModel: any,
|
||||
bindingContext: KnockoutBindingContext): KnockoutControlsDescendantBindings;
|
||||
}
|
||||
|
||||
interface ProgressKnockoutBindingHandler extends KnockoutBindingHandler {
|
||||
init? (element: any,
|
||||
valueAccessor: () => any,
|
||||
allBindingsAccessor: KnockoutAllBindingsAccessor,
|
||||
viewModel: any,
|
||||
bindingContext: KnockoutBindingContext): KnockoutControlsDescendantBindings;
|
||||
defaults: KnockstrapProgressDefaults;
|
||||
}
|
||||
|
||||
interface KnockstrapProgressDefaults {
|
||||
css: string;
|
||||
text: string;
|
||||
textHidden: boolean;
|
||||
striped: boolean;
|
||||
type: string;
|
||||
animated: boolean;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ var now = moment();
|
||||
var day7 = moment([2010, 1, 14, 15, 25, 50, 125]);
|
||||
var day8 = moment([2010]);
|
||||
var day9 = moment([2010, 6]);
|
||||
var day10 = moment([2010, 6, 10]);
|
||||
var day10 = moment([2010, 6, 10]);
|
||||
var array = [2010, 1, 14, 15, 25, 50, 125];
|
||||
var day11 = moment(Date.UTC.apply({}, array));
|
||||
var day12 = moment.unix(1318781876);
|
||||
@@ -62,8 +62,8 @@ a.hours();
|
||||
a.local();
|
||||
a.hours();
|
||||
|
||||
moment("2011-10-10", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-50", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-10", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-50", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-10T10:20:90").isValid();
|
||||
moment([2011, 0, 1]).isValid();
|
||||
moment([2011, 0, 50]).isValid();
|
||||
@@ -74,32 +74,39 @@ moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).sec
|
||||
moment().add('days', 7);
|
||||
moment().add('days', 7).add('months', 1);
|
||||
moment().add({days:7,months:1});
|
||||
moment().add('milliseconds', 1000000);
|
||||
moment().add('milliseconds', 1000000);
|
||||
moment().add('days', 360);
|
||||
moment([2010, 0, 31]);
|
||||
moment([2010, 0, 31]);
|
||||
moment([2010, 0, 31]).add('months', 1);
|
||||
var m = moment(new Date(2011, 2, 12, 5, 0, 0));
|
||||
m.hours();
|
||||
m.hours();
|
||||
m.add('days', 1).hours();
|
||||
var m2 = moment(new Date(2011, 2, 12, 5, 0, 0));
|
||||
var m2 = moment(new Date(2011, 2, 12, 5, 0, 0));
|
||||
m2.hours();
|
||||
m2.add('hours', 24).hours();
|
||||
m2.add('hours', 24).hours();
|
||||
var duration = moment.duration({'days': 1});
|
||||
moment([2012, 0, 31]).add(duration);
|
||||
|
||||
moment().add('seconds', 1);
|
||||
moment().add('seconds', '1');
|
||||
moment().add(1, 'seconds');
|
||||
|
||||
moment().add('1', 'seconds');
|
||||
moment().add('seconds', '1');
|
||||
|
||||
moment().subtract('days', 7);
|
||||
|
||||
moment().seconds(30);
|
||||
moment().minutes(30);
|
||||
|
||||
moment().hours(12);
|
||||
moment().hours(12);
|
||||
moment().date(5);
|
||||
moment().day(5);
|
||||
moment().day("Sunday");
|
||||
moment().month(5);
|
||||
moment().month("January");
|
||||
moment().year(1984);
|
||||
moment().startOf('year');
|
||||
moment().startOf('year');
|
||||
moment().month(0).date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
moment().startOf('hour');
|
||||
moment().minutes(0).seconds(0).milliseconds(0);
|
||||
@@ -120,10 +127,10 @@ moment().isoWeek(45);
|
||||
moment().isoWeeks();
|
||||
moment().isoWeeks(45);
|
||||
|
||||
var getMilliseconds: number = moment().milliseconds();
|
||||
var getSeconds: number = moment().seconds();
|
||||
var getMinutes: number = moment().minutes();
|
||||
var getHours: number = moment().hours();
|
||||
var getMilliseconds: number = moment().milliseconds();
|
||||
var getSeconds: number = moment().seconds();
|
||||
var getMinutes: number = moment().minutes();
|
||||
var getHours: number = moment().hours();
|
||||
var getDate: number = moment().date();
|
||||
var getDay: number = moment().day();
|
||||
var getMonth: number = moment().month();
|
||||
@@ -138,11 +145,11 @@ a3.utc();
|
||||
a3.hours();
|
||||
|
||||
var a4 = moment([2010, 1, 14, 15, 25, 50, 125]);
|
||||
a4.format("dddd, MMMM Do YYYY, h:mm:ss a");
|
||||
a4.format("dddd, MMMM Do YYYY, h:mm:ss a");
|
||||
a4.format("ddd, hA");
|
||||
|
||||
moment().format('\\L');
|
||||
moment().format('[today] DDDD');
|
||||
moment().format('[today] DDDD');
|
||||
|
||||
var a5 = moment([2007, 0, 29]);
|
||||
var b5 = moment([2007, 0, 28]);
|
||||
@@ -151,8 +158,8 @@ a5.from(b5);
|
||||
var a6 = moment([2007, 0, 29]);
|
||||
var b6 = moment([2007, 0, 28]);
|
||||
a6.from(b6);
|
||||
a6.from([2007, 0, 28]);
|
||||
a6.from(new Date(2007, 0, 28));
|
||||
a6.from([2007, 0, 28]);
|
||||
a6.from(new Date(2007, 0, 28));
|
||||
a6.from("1-28-2007");
|
||||
|
||||
var a7 = moment();
|
||||
@@ -161,23 +168,23 @@ a7.from(b7);
|
||||
|
||||
var start = moment([2007, 0, 5]);
|
||||
var end = moment([2007, 0, 10]);
|
||||
start.from(end);
|
||||
start.from(end);
|
||||
start.from(end, true);
|
||||
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow(true);
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow(true);
|
||||
|
||||
var a8 = moment([2007, 0, 29]);
|
||||
var b8 = moment([2007, 0, 28]);
|
||||
a8.diff(b8) ;
|
||||
a8.diff(b8, 'days');
|
||||
a8.diff(b8, 'years')
|
||||
a8.diff(b8, 'years')
|
||||
a8.diff(b8, 'years', true);
|
||||
|
||||
moment([2007, 0, 29]).toDate();
|
||||
moment([2007, 1, 23]).toISOString();
|
||||
moment(1318874398806).valueOf();
|
||||
moment(1318874398806).valueOf();
|
||||
moment(1318874398806).unix();
|
||||
moment([2000]).isLeapYear();
|
||||
moment().zone();
|
||||
@@ -191,12 +198,12 @@ moment.isMoment(moment());
|
||||
moment.localeData('fr');
|
||||
moment(1316116057189).fromNow();
|
||||
|
||||
moment.localeData('en');
|
||||
moment.localeData('en');
|
||||
var globalLang = moment();
|
||||
var localLang = moment();
|
||||
localLang.localeData('fr');
|
||||
localLang.format('LLLL');
|
||||
globalLang.format('LLLL');
|
||||
localLang.localeData('fr');
|
||||
localLang.format('LLLL');
|
||||
globalLang.format('LLLL');
|
||||
|
||||
moment.duration(100);
|
||||
moment.duration(2, 'seconds');
|
||||
@@ -223,8 +230,13 @@ adur.subtract(bdur).days();
|
||||
adur.subtract(1).days();
|
||||
adur.subtract(1, 'd').days();
|
||||
|
||||
// Defining a custom language:
|
||||
moment.localeData('en', {
|
||||
// Selecting a language
|
||||
moment.locale();
|
||||
moment.locale('en');
|
||||
moment.locale(['en', 'fr']);
|
||||
|
||||
// Defining a custom language:
|
||||
moment.locale('en', {
|
||||
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||||
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||||
@@ -282,14 +294,14 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
months : [
|
||||
"January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December"
|
||||
]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
months : function (momentToFormat: Moment, format: string) {
|
||||
// momentToFormat is the moment currently being formatted
|
||||
// format is the formatting string
|
||||
@@ -301,14 +313,14 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
monthsShort : [
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
monthsShort : function (momentToFormat: Moment, format: string) {
|
||||
if (/^MMMM/.test(format)) {
|
||||
return this.nominative[momentToFormat.month()];
|
||||
@@ -318,39 +330,39 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdays : [
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdays : function (momentToFormat: Moment) {
|
||||
return this.weekdays[momentToFormat.day()];
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysShort : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysShort : function (momentToFormat: Moment) {
|
||||
return this.weekdaysShort[momentToFormat.day()];
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysMin : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysMin : function (momentToFormat: Moment) {
|
||||
return this.weekdaysMin[momentToFormat.day()];
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
longDateFormat : {
|
||||
LT: "h:mm A",
|
||||
L: "MM/DD/YYYY",
|
||||
@@ -364,7 +376,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
longDateFormat : {
|
||||
LT: "h:mm A",
|
||||
L: "MM/DD/YYYY",
|
||||
@@ -374,7 +386,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
relativeTime : {
|
||||
future: "in %s",
|
||||
past: "%s ago",
|
||||
@@ -392,7 +404,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
meridiem : function (hour, minute, isLowercase) {
|
||||
if (hour < 9) {
|
||||
return "早上";
|
||||
@@ -408,7 +420,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
calendar : {
|
||||
lastDay : '[Yesterday at] LT',
|
||||
sameDay : '[Today at] LT',
|
||||
@@ -421,7 +433,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
ordinal : function (number) {
|
||||
var b = number % 10;
|
||||
var output = (~~ (number % 100 / 10) === 1) ? 'th' :
|
||||
|
||||
+51
-46
@@ -16,7 +16,7 @@ var now = moment();
|
||||
var day7 = moment([2010, 1, 14, 15, 25, 50, 125]);
|
||||
var day8 = moment([2010]);
|
||||
var day9 = moment([2010, 6]);
|
||||
var day10 = moment([2010, 6, 10]);
|
||||
var day10 = moment([2010, 6, 10]);
|
||||
var array = [2010, 1, 14, 15, 25, 50, 125];
|
||||
var day11 = moment(Date.UTC.apply({}, array));
|
||||
var day12 = moment.unix(1318781876);
|
||||
@@ -60,8 +60,8 @@ a.hours();
|
||||
a.local();
|
||||
a.hours();
|
||||
|
||||
moment("2011-10-10", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-50", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-10", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-50", "YYYY-MM-DD").isValid();
|
||||
moment("2011-10-10T10:20:90").isValid();
|
||||
moment([2011, 0, 1]).isValid();
|
||||
moment([2011, 0, 50]).isValid();
|
||||
@@ -72,16 +72,16 @@ moment().add('days', 7).subtract('months', 1).year(2009).hours(0).minutes(0).sec
|
||||
moment().add('days', 7);
|
||||
moment().add('days', 7).add('months', 1);
|
||||
moment().add({days:7,months:1});
|
||||
moment().add('milliseconds', 1000000);
|
||||
moment().add('milliseconds', 1000000);
|
||||
moment().add('days', 360);
|
||||
moment([2010, 0, 31]);
|
||||
moment([2010, 0, 31]);
|
||||
moment([2010, 0, 31]).add('months', 1);
|
||||
var m = moment(new Date(2011, 2, 12, 5, 0, 0));
|
||||
m.hours();
|
||||
m.hours();
|
||||
m.add('days', 1).hours();
|
||||
var m2 = moment(new Date(2011, 2, 12, 5, 0, 0));
|
||||
var m2 = moment(new Date(2011, 2, 12, 5, 0, 0));
|
||||
m2.hours();
|
||||
m2.add('hours', 24).hours();
|
||||
m2.add('hours', 24).hours();
|
||||
var duration = moment.duration({'days': 1});
|
||||
moment([2012, 0, 31]).add(duration);
|
||||
|
||||
@@ -97,14 +97,14 @@ moment().subtract('days', 7);
|
||||
moment().seconds(30);
|
||||
moment().minutes(30);
|
||||
|
||||
moment().hours(12);
|
||||
moment().hours(12);
|
||||
moment().date(5);
|
||||
moment().day(5);
|
||||
moment().day("Sunday");
|
||||
moment().month(5);
|
||||
moment().month("January");
|
||||
moment().year(1984);
|
||||
moment().startOf('year');
|
||||
moment().startOf('year');
|
||||
moment().month(0).date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
moment().startOf('hour');
|
||||
moment().minutes(0).seconds(0).milliseconds(0);
|
||||
@@ -125,10 +125,10 @@ moment().isoWeek(45);
|
||||
moment().isoWeeks();
|
||||
moment().isoWeeks(45);
|
||||
|
||||
var getMilliseconds: number = moment().milliseconds();
|
||||
var getSeconds: number = moment().seconds();
|
||||
var getMinutes: number = moment().minutes();
|
||||
var getHours: number = moment().hours();
|
||||
var getMilliseconds: number = moment().milliseconds();
|
||||
var getSeconds: number = moment().seconds();
|
||||
var getMinutes: number = moment().minutes();
|
||||
var getHours: number = moment().hours();
|
||||
var getDate: number = moment().date();
|
||||
var getDay: number = moment().day();
|
||||
var getMonth: number = moment().month();
|
||||
@@ -143,11 +143,11 @@ a3.utc();
|
||||
a3.hours();
|
||||
|
||||
var a4 = moment([2010, 1, 14, 15, 25, 50, 125]);
|
||||
a4.format("dddd, MMMM Do YYYY, h:mm:ss a");
|
||||
a4.format("dddd, MMMM Do YYYY, h:mm:ss a");
|
||||
a4.format("ddd, hA");
|
||||
|
||||
moment().format('\\L');
|
||||
moment().format('[today] DDDD');
|
||||
moment().format('[today] DDDD');
|
||||
|
||||
var a5 = moment([2007, 0, 29]);
|
||||
var b5 = moment([2007, 0, 28]);
|
||||
@@ -156,8 +156,8 @@ a5.from(b5);
|
||||
var a6 = moment([2007, 0, 29]);
|
||||
var b6 = moment([2007, 0, 28]);
|
||||
a6.from(b6);
|
||||
a6.from([2007, 0, 28]);
|
||||
a6.from(new Date(2007, 0, 28));
|
||||
a6.from([2007, 0, 28]);
|
||||
a6.from(new Date(2007, 0, 28));
|
||||
a6.from("1-28-2007");
|
||||
|
||||
var a7 = moment();
|
||||
@@ -166,23 +166,23 @@ a7.from(b7);
|
||||
|
||||
var start = moment([2007, 0, 5]);
|
||||
var end = moment([2007, 0, 10]);
|
||||
start.from(end);
|
||||
start.from(end);
|
||||
start.from(end, true);
|
||||
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow(true);
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow();
|
||||
moment([2007, 0, 29]).fromNow(true);
|
||||
|
||||
var a8 = moment([2007, 0, 29]);
|
||||
var b8 = moment([2007, 0, 28]);
|
||||
a8.diff(b8) ;
|
||||
a8.diff(b8, 'days');
|
||||
a8.diff(b8, 'years')
|
||||
a8.diff(b8, 'years')
|
||||
a8.diff(b8, 'years', true);
|
||||
|
||||
moment([2007, 0, 29]).toDate();
|
||||
moment([2007, 1, 23]).toISOString();
|
||||
moment(1318874398806).valueOf();
|
||||
moment(1318874398806).valueOf();
|
||||
moment(1318874398806).unix();
|
||||
moment([2000]).isLeapYear();
|
||||
moment().zone();
|
||||
@@ -196,12 +196,12 @@ moment.isMoment(moment());
|
||||
moment.localeData('fr');
|
||||
moment(1316116057189).fromNow();
|
||||
|
||||
moment.localeData('en');
|
||||
moment.localeData('en');
|
||||
var globalLang = moment();
|
||||
var localLang = moment();
|
||||
localLang.localeData('fr');
|
||||
localLang.format('LLLL');
|
||||
globalLang.format('LLLL');
|
||||
localLang.localeData('fr');
|
||||
localLang.format('LLLL');
|
||||
globalLang.format('LLLL');
|
||||
|
||||
moment.duration(100);
|
||||
moment.duration(2, 'seconds');
|
||||
@@ -228,8 +228,13 @@ adur.subtract(bdur).days();
|
||||
adur.subtract(1).days();
|
||||
adur.subtract(1, 'd').days();
|
||||
|
||||
// Defining a custom language:
|
||||
moment.localeData('en', {
|
||||
// Selecting a language
|
||||
moment.locale();
|
||||
moment.locale('en');
|
||||
moment.locale(['en', 'fr']);
|
||||
|
||||
// Defining a custom language:
|
||||
moment.locale('en', {
|
||||
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||||
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
||||
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||||
@@ -287,14 +292,14 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
months : [
|
||||
"January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December"
|
||||
]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
months : function (momentToFormat: Moment, format: string) {
|
||||
// momentToFormat is the moment currently being formatted
|
||||
// format is the formatting string
|
||||
@@ -306,14 +311,14 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
monthsShort : [
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
monthsShort : function (momentToFormat: Moment, format: string) {
|
||||
if (/^MMMM/.test(format)) {
|
||||
return this.nominative[momentToFormat.month()];
|
||||
@@ -323,39 +328,39 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdays : [
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdays : function (momentToFormat: Moment) {
|
||||
return this.weekdays[momentToFormat.day()];
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysShort : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysShort : function (momentToFormat: Moment) {
|
||||
return this.weekdaysShort[momentToFormat.day()];
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysMin : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
weekdaysMin : function (momentToFormat: Moment) {
|
||||
return this.weekdaysMin[momentToFormat.day()];
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
longDateFormat : {
|
||||
LT: "h:mm A",
|
||||
L: "MM/DD/YYYY",
|
||||
@@ -369,7 +374,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
longDateFormat : {
|
||||
LT: "h:mm A",
|
||||
L: "MM/DD/YYYY",
|
||||
@@ -379,7 +384,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
relativeTime : {
|
||||
future: "in %s",
|
||||
past: "%s ago",
|
||||
@@ -397,7 +402,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
meridiem : function (hour, minute, isLowercase) {
|
||||
if (hour < 9) {
|
||||
return "早上";
|
||||
@@ -413,7 +418,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
calendar : {
|
||||
lastDay : '[Yesterday at] LT',
|
||||
sameDay : '[Today at] LT',
|
||||
@@ -426,7 +431,7 @@ moment.localeData('en', {
|
||||
}
|
||||
});
|
||||
|
||||
moment.localeData('en', {
|
||||
moment.locale('en', {
|
||||
ordinal : function (number) {
|
||||
var b = number % 10;
|
||||
var output = (~~ (number % 100 / 10) === 1) ? 'th' :
|
||||
|
||||
Vendored
+5
-2
@@ -382,8 +382,11 @@ interface MomentStatic {
|
||||
lang(language?: string): string;
|
||||
lang(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
localeData(language?: string): string;
|
||||
localeData(language?: string, definition?: MomentLanguage): string;
|
||||
locale(language?: string): string;
|
||||
locale(language?: string[]): string;
|
||||
locale(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
localeData(language?: string): MomentLanguage;
|
||||
|
||||
longDateFormat: any;
|
||||
relativeTime: any;
|
||||
|
||||
Vendored
+5
-5
@@ -178,7 +178,7 @@ declare module "mongodb" {
|
||||
// Current definition by documentation version 1.3.13 (28.08.2013)
|
||||
export interface DbCreateOptions {
|
||||
// the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = ‘majority’ or tag acknowledges the write.
|
||||
w?: string;
|
||||
w?: any;
|
||||
|
||||
// set the timeout for waiting for write concern to finish (combines with w option).
|
||||
wtimeout?: number;
|
||||
@@ -272,11 +272,11 @@ declare module "mongodb" {
|
||||
update(selector: Object, document: any, options: { safe?: boolean; upsert?: any; multi?: boolean; serializeFunctions?: boolean; }, callback: (err: Error, result: any) => void): void;
|
||||
|
||||
distinct(key: string, query: Object, callback: (err: Error, result: any) => void): void;
|
||||
distinct(key: string, query: Object, options: { readPreferences: string; }, callback: (err: Error, result: any) => void): void;
|
||||
distinct(key: string, query: Object, options: { readPreference: string; }, callback: (err: Error, result: any) => void): void;
|
||||
|
||||
count(callback: (err: Error, result: any) => void): void;
|
||||
count(query: Object, callback: (err: Error, result: any) => void): void;
|
||||
count(query: Object, options: { readPreferences: string; }, callback: (err: Error, result: any) => void): void;
|
||||
count(query: Object, options: { readPreference: string; }, callback: (err: Error, result: any) => void): void;
|
||||
|
||||
drop(callback?: (err: Error, result: any) => void): void;
|
||||
|
||||
@@ -429,7 +429,7 @@ declare module "mongodb" {
|
||||
showDiskLoc?: boolean;
|
||||
comment?: String;
|
||||
raw?: boolean;
|
||||
readPreferences?: String;
|
||||
readPreference?: String;
|
||||
partial?: boolean;
|
||||
}
|
||||
|
||||
@@ -438,6 +438,6 @@ declare module "mongodb" {
|
||||
serializeFunctions?: any;
|
||||
raw?: boolean;
|
||||
pkFactory?: any;
|
||||
readPreferences?: string;
|
||||
readPreference?: string;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -153,7 +153,7 @@ declare module "mongoose" {
|
||||
findByIdAndRemove(id: string, options: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findByIdAndUpdate(id: string, update: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findByIdAndUpdate(id: string, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findOne(cond: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findOne(cond?: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findOne(cond: Object, fields: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findOne(cond: Object, fields: Object, options: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
findOneAndRemove(cond: Object, callback?: (err: any, res: T) => void): Query<T>;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="mustache-0.7.3.d.ts" />
|
||||
|
||||
var view = { title: "Joe", calc: function () { return 2 + 4; } };
|
||||
var output = Mustache.render("{{title}} spends {{calc}}", view);
|
||||
|
||||
var person = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" };
|
||||
var template = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
|
||||
var html = Mustache.to_html(template, person);
|
||||
|
||||
var writer = Mustache.compile(template);
|
||||
var writerOutput = writer(view);
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for Mustache 0.7.3
|
||||
// Project: https://github.com/janl/mustache.js
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
interface MustacheScanner {
|
||||
string: string;
|
||||
tail: string;
|
||||
pos: number;
|
||||
|
||||
eos(): boolean;
|
||||
scan(re: RegExp): string;
|
||||
scanUntil(re: RegExp): string;
|
||||
}
|
||||
|
||||
interface MustacheContext {
|
||||
view: any;
|
||||
parent: MustacheContext;
|
||||
|
||||
clearCache(): void;
|
||||
push(view: any): MustacheContext;
|
||||
lookup(name: string): any;
|
||||
}
|
||||
|
||||
interface MustacheWriter {
|
||||
(view: any): string;
|
||||
|
||||
clearCache(): void;
|
||||
compile(template: string, tags: any): any;
|
||||
compilePartial(name: string, template: string, tags: any): any;
|
||||
compileTokens(tokens: string[], template: string): any;
|
||||
render(template: string, view: any, partials: any): any;
|
||||
}
|
||||
|
||||
interface MustacheStatic {
|
||||
name: string;
|
||||
version: string;
|
||||
tags: string;
|
||||
Scanner: MustacheScanner;
|
||||
Context: MustacheContext;
|
||||
Writer: MustacheWriter;
|
||||
escape: any;
|
||||
|
||||
parse(template: string, tags: any): any;
|
||||
clearCache(): MustacheWriter;
|
||||
compile(template: string): MustacheWriter;
|
||||
compile(template: string, tags: any): MustacheWriter;
|
||||
compilePartial(name: string, template: string, tags: any): MustacheWriter;
|
||||
compileTokens(tokens: string[], template: string): MustacheWriter;
|
||||
render(template: string, view: any, partials?: any): string;
|
||||
to_html(template: string, view: any, partials?: any, send?: any): string;
|
||||
}
|
||||
|
||||
declare var Mustache: MustacheStatic;
|
||||
@@ -1,11 +1,14 @@
|
||||
/// <reference path="mustache.d.ts" />
|
||||
|
||||
var view = { title: "Joe", calc: function () { return 2 + 4; } };
|
||||
var output = Mustache.render("{{title}} spends {{calc}}", view);
|
||||
var view1 = { title: "Joe", calc: function () { return 2 + 4; } };
|
||||
var template1 = "{{title}} spends {{calc}}";
|
||||
var output = Mustache.render(template1, view1);
|
||||
|
||||
var person;
|
||||
var template = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
|
||||
var html = Mustache.to_html(template, person);
|
||||
var view2 = { forename: "Jane", calc: function () { return 10 + 5; } };
|
||||
var template2 = "{{forename}} spends {{calc}}";
|
||||
Mustache.parse(template2, null);
|
||||
var output2 = Mustache.render(template2, view2);
|
||||
|
||||
var writer = Mustache.compile(template);
|
||||
var writerOutput = writer(view);
|
||||
var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" };
|
||||
var template3 = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
|
||||
var html = Mustache.to_html(template3, view3);
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+13
-18
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Mustache 0.7
|
||||
// Type definitions for Mustache 0.8.2
|
||||
// Project: https://github.com/janl/mustache.js
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -15,21 +15,20 @@ interface MustacheScanner {
|
||||
}
|
||||
|
||||
interface MustacheContext {
|
||||
view;
|
||||
parent;
|
||||
view: any;
|
||||
parentContext: MustacheContext;
|
||||
|
||||
clearCache();
|
||||
push(view): MustacheContext;
|
||||
push(view: any): MustacheContext;
|
||||
lookup(name: string): any;
|
||||
}
|
||||
|
||||
interface MustacheWriter {
|
||||
(view: any): string;
|
||||
clearCache();
|
||||
compile(template: string, tags);
|
||||
compilePartial(name, template, tags);
|
||||
compileTokens(tokens, template);
|
||||
render(template, view, partials);
|
||||
|
||||
clearCache(): void;
|
||||
parse(template: string, tags?: any): any;
|
||||
render(template: string, view: any, partials: any): string;
|
||||
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
|
||||
}
|
||||
|
||||
interface MustacheStatic {
|
||||
@@ -39,16 +38,12 @@ interface MustacheStatic {
|
||||
Scanner: MustacheScanner;
|
||||
Context: MustacheContext;
|
||||
Writer: MustacheWriter;
|
||||
escape;
|
||||
escape: any;
|
||||
|
||||
parse(template: string, tags);
|
||||
clearCache(): MustacheWriter;
|
||||
compile(template: string): MustacheWriter;
|
||||
compile(template: string, tags): MustacheWriter;
|
||||
compilePartial(name: string, template: string, tags): MustacheWriter;
|
||||
compileTokens(tokens, template: string): MustacheWriter;
|
||||
parse(template: string, tags?: any): any;
|
||||
render(template: string, view: any, partials?: any): string;
|
||||
to_html(template: string, view: any, partials?: any, send?): string;
|
||||
to_html(template: string, view: any, partials?: any, send?: any): any;
|
||||
}
|
||||
|
||||
declare var Mustache: MustacheStatic;
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+1528
-60
File diff suppressed because it is too large.
Load diff
@@ -59,6 +59,10 @@ class Networker extends events.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Url tests : http://nodejs.org/api/url.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
@@ -69,6 +73,10 @@ url.format({
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
|
||||
var helloUrl = url.parse('http://example.com/?hello=world', true)
|
||||
assert.equal(helloUrl.query.hello, 'world');
|
||||
|
||||
|
||||
// Old and new util.inspect APIs
|
||||
util.inspect(["This is nice"], false, 5);
|
||||
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
|
||||
|
||||
Vendored
+1
-1
@@ -658,7 +658,7 @@ declare module "url" {
|
||||
host: string;
|
||||
pathname: string;
|
||||
search: string;
|
||||
query: string;
|
||||
query: any; // string | Object
|
||||
slashes: boolean;
|
||||
hash?: string;
|
||||
path?: string;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
|
||||
*
|
||||
* Created by using code samples from https://github.com/npm/npm#using-npm-programmatically.
|
||||
*/
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="npm.d.ts" />
|
||||
|
||||
import npm = require("npm");
|
||||
|
||||
npm.load({}, function (er) {
|
||||
if (er) {
|
||||
return console.error(er);
|
||||
}
|
||||
|
||||
npm.commands.install(["some", "args"], function (er, data) {
|
||||
if (er) {
|
||||
return console.error(er);
|
||||
}
|
||||
|
||||
// command succeeded, and data might have some info
|
||||
});
|
||||
|
||||
npm.on("log", function (message: string) {
|
||||
console.log(message);
|
||||
});
|
||||
})
|
||||
Vendored
+461
@@ -0,0 +1,461 @@
|
||||
// Type definitions for npm 2.0.0
|
||||
// Project: https://github.com/npm/npm
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module NPM {
|
||||
export interface Static extends NodeJS.EventEmitter {
|
||||
config: Config;
|
||||
commands: Commands;
|
||||
rollbacks: any[];
|
||||
spinner: Spinner;
|
||||
fullList: string[];
|
||||
abbrevs: Dictionary<string>;
|
||||
|
||||
prefix: string;
|
||||
bin: string;
|
||||
globalBin: string;
|
||||
dir: string;
|
||||
globalDir: string;
|
||||
root: string;
|
||||
cache: string;
|
||||
tmp: string;
|
||||
|
||||
|
||||
load(cli: ConfigOptions): void;
|
||||
load(callback: SimpleCallback<Config>): void;
|
||||
load(cli: ConfigOptions, callback: SimpleCallback<Config>): void;
|
||||
|
||||
deref(command: string): string;
|
||||
}
|
||||
|
||||
//#region Commands Interfaces
|
||||
|
||||
export interface Commands {
|
||||
// Commands
|
||||
install: CommandFunction;
|
||||
uninstall: CommandFunction;
|
||||
cache: CommandFunction;
|
||||
config: CommandFunction;
|
||||
set: CommandFunction;
|
||||
get: CommandFunction;
|
||||
update: CommandFunction;
|
||||
outdated: CommandFunction;
|
||||
prune: CommandFunction;
|
||||
submodule: CommandFunction;
|
||||
pack: CommandFunction;
|
||||
dedupe: CommandFunction;
|
||||
|
||||
rebuild: CommandFunction;
|
||||
link: CommandFunction;
|
||||
|
||||
publish: CommandFunction;
|
||||
star: CommandFunction;
|
||||
stars: CommandFunction;
|
||||
tag: CommandFunction;
|
||||
adduser: CommandFunction;
|
||||
unpublish: CommandFunction;
|
||||
owner: CommandFunction;
|
||||
deprecate: CommandFunction;
|
||||
shrinkwrap: CommandFunction;
|
||||
|
||||
help: CommandFunction;
|
||||
"help-search": CommandFunction;
|
||||
ls: CommandFunction;
|
||||
search: CommandFunction;
|
||||
view: CommandFunction;
|
||||
init: CommandFunction;
|
||||
version: CommandFunction;
|
||||
edit: CommandFunction;
|
||||
explore: CommandFunction;
|
||||
docs: CommandFunction;
|
||||
repo: CommandFunction;
|
||||
bugs: CommandFunction;
|
||||
faq: CommandFunction;
|
||||
root: CommandFunction;
|
||||
prefix: CommandFunction;
|
||||
bin: CommandFunction;
|
||||
whoami: CommandFunction;
|
||||
|
||||
test: CommandFunction;
|
||||
stop: CommandFunction;
|
||||
start: CommandFunction;
|
||||
restart: CommandFunction;
|
||||
"run-script": CommandFunction;
|
||||
completion: CommandFunction;
|
||||
|
||||
//Aliases
|
||||
rm: CommandFunction; // uninstall
|
||||
r: CommandFunction; // uninstall
|
||||
un: CommandFunction; // uninstall
|
||||
unlink: CommandFunction; // uninstall
|
||||
remove: CommandFunction; // uninstall
|
||||
rb: CommandFunction; // rebuild
|
||||
list: CommandFunction; // ls
|
||||
la: CommandFunction; // ls
|
||||
ll: CommandFunction; // ls
|
||||
i: CommandFunction; // install
|
||||
isntall: CommandFunction; // install
|
||||
up: CommandFunction; // update
|
||||
c: CommandFunction; // config
|
||||
info: CommandFunction; // view
|
||||
show: CommandFunction; // view
|
||||
find: CommandFunction; // search
|
||||
s: CommandFunction; // search
|
||||
se: CommandFunction; // search
|
||||
author: CommandFunction; // owner
|
||||
home: CommandFunction; // docs
|
||||
issues: CommandFunction; // bugs
|
||||
unstar: CommandFunction; // star
|
||||
apihelp: CommandFunction; // help
|
||||
long: CommandFunction; // adduser
|
||||
"add-user": CommandFunction; // adduser
|
||||
tst: CommandFunction; // test
|
||||
t: CommandFunction; // test
|
||||
"find-dupes": CommandFunction; // dedupe
|
||||
ddp: CommandFunction; // dedupe
|
||||
v: CommandFunction; // view
|
||||
|
||||
// plumbing
|
||||
build: CommandFunction;
|
||||
unbuild: CommandFunction;
|
||||
xmas: CommandFunction;
|
||||
substack: CommandFunction;
|
||||
visnup: CommandFunction;
|
||||
|
||||
}
|
||||
|
||||
export interface CommandFunction {
|
||||
(args: string[], callback: CommandCallback): void;
|
||||
}
|
||||
|
||||
export interface CommandCallback {
|
||||
(err?: Error, result?: any, result2?: any, result3?: any, result4?: any): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Other Interfaces
|
||||
|
||||
export interface Spinner {
|
||||
int: string;
|
||||
started: boolean;
|
||||
start(): void;
|
||||
stop(): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Config Interfaces
|
||||
|
||||
export interface ConfigStatic {
|
||||
new (base: Config): Config;
|
||||
(base: Config): Config;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
loaded: boolean;
|
||||
sources: Dictionary<ConfigSource>;
|
||||
rootConf: Config;
|
||||
usingBuiltin: boolean;
|
||||
root?: Config;
|
||||
Conf: ConfigStatic;
|
||||
defs: ConfigDefs;
|
||||
|
||||
get(setting: string): string;
|
||||
set(setting: string, value: string): void;
|
||||
|
||||
loadPrefix(cb: ErrorCallback): void;
|
||||
loadCAFile(caFilePath: string, cb: ErrorCallback): void;
|
||||
loadUid(cb: SimpleCallback<string>): void;
|
||||
setUser(cb: ErrorCallback): void;
|
||||
findPrefix(prefix: string, cb: SimpleCallback<string>): void;
|
||||
getCredentialsByURI(uri: string): Credentials;
|
||||
setCredentialsByURI(uri: string, cred: Credentials): void;
|
||||
|
||||
loadExtras(cb: ErrorCallback): void;
|
||||
save(where: string, cb: ErrorCallback): Config;
|
||||
addFile(file: string, name: string): Config;
|
||||
parse(content: string, file: string): any;
|
||||
add(data: Object, marker: Object): any;
|
||||
addEnv(env: Dictionary<string>): any;
|
||||
}
|
||||
|
||||
export interface ConfigDefs {
|
||||
defaults: ConfigOptions;
|
||||
types: ConfigTypes;
|
||||
}
|
||||
|
||||
export interface ConfigOptions {
|
||||
"always-auth"?: boolean;
|
||||
"bin-links"?: boolean;
|
||||
browser?: string;
|
||||
|
||||
ca?: any; // string | string[]
|
||||
cafile?: string;
|
||||
|
||||
cache?: string;
|
||||
|
||||
"cache-lock-stale"?: number;
|
||||
"cache-lock-retries"?: number;
|
||||
"cache-lock-wait"?: number;
|
||||
|
||||
"cache-max"?: number;
|
||||
"cache-min"?: number;
|
||||
|
||||
cert?: string;
|
||||
|
||||
color?: any; // boolean | string ("always")
|
||||
depth?: number;
|
||||
description?: boolean;
|
||||
dev?: boolean;
|
||||
editor?: string;
|
||||
"engine-strict"?: boolean;
|
||||
force?: boolean;
|
||||
|
||||
"fetch-retries"?: number;
|
||||
"fetch-retry-factor"?: number;
|
||||
"fetch-retry-mintimeout"?: number;
|
||||
"fetch-retry-maxtimeout"?: number;
|
||||
|
||||
git?: string;
|
||||
"git-tag-version"?: boolean;
|
||||
|
||||
global?: boolean;
|
||||
globalconfig?: string;
|
||||
group?: any; // number | string
|
||||
heading?: string;
|
||||
"ignore-scripts"?: boolean;
|
||||
"init-module"?: string;
|
||||
"init.author.name"?: string;
|
||||
"init.author.email"?: string;
|
||||
"init.author.url"?: string;
|
||||
"init.version"?: string;
|
||||
"init.license"?: string;
|
||||
json?: boolean;
|
||||
key?: string;
|
||||
link?: boolean;
|
||||
"local-address"?: string;
|
||||
loglevel?: string;
|
||||
logstream?: NodeJS.ReadWriteStream;
|
||||
long?: boolean;
|
||||
message?: string;
|
||||
"node-version"?: string;
|
||||
npat?: boolean;
|
||||
"onload-script"?: boolean;
|
||||
optional?: boolean;
|
||||
parseable?: boolean;
|
||||
prefix?: string;
|
||||
production?: boolean;
|
||||
"proprietary-attribs"?: boolean;
|
||||
proxy?: any; // boolean | string
|
||||
"https-proxy"?: string;
|
||||
"user-agent"?: string;
|
||||
"rebuild-bundle"?: boolean;
|
||||
registry?: string;
|
||||
rollback?: boolean;
|
||||
save?: boolean;
|
||||
"save-bundle"?: boolean;
|
||||
"save-dev"?: boolean;
|
||||
"save-exact"?: boolean;
|
||||
"save-optional"?: boolean;
|
||||
"save-prefix"?: string;
|
||||
scope?: string;
|
||||
searchopts?: string;
|
||||
searchexclude?: string;
|
||||
searchsort?: string;
|
||||
shell?: string;
|
||||
shrinkwrap?: boolean;
|
||||
"sign-git-tag"?: boolean;
|
||||
spin?: any; // boolean | string ("always")
|
||||
"strict-ssl"?: boolean;
|
||||
tag?: string;
|
||||
tmp?: string;
|
||||
unicode?: boolean;
|
||||
"unsafe-perm"?: boolean;
|
||||
usage?: boolean;
|
||||
user?: any; // string | number
|
||||
userconfig?: string;
|
||||
umask?: number;
|
||||
version?: boolean;
|
||||
versions?: boolean;
|
||||
viewer?: string;
|
||||
|
||||
_exit?: boolean;
|
||||
}
|
||||
|
||||
export interface ConfigTypes {
|
||||
"always-auth": typeof Boolean;
|
||||
"bin-links": typeof Boolean;
|
||||
browser: any[];
|
||||
|
||||
ca: any[];
|
||||
cafile: typeof String;
|
||||
cache: typeof String;
|
||||
|
||||
"cache-lock-stale": typeof Number;
|
||||
"cache-lock-retries": typeof Number;
|
||||
"cache-lock-wait": typeof Number;
|
||||
|
||||
"cache-max": typeof Number;
|
||||
"cache-min": typeof Number;
|
||||
|
||||
cert: typeof String;
|
||||
|
||||
color: any[];
|
||||
depth: typeof Number;
|
||||
description: typeof Boolean;
|
||||
dev: typeof Boolean;
|
||||
editor: typeof String;
|
||||
"engine-strict": typeof Boolean;
|
||||
force: typeof Boolean;
|
||||
|
||||
"fetch-retries": typeof Number;
|
||||
"fetch-retry-factor": typeof Number;
|
||||
"fetch-retry-mintimeout": typeof Number;
|
||||
"fetch-retry-maxtimeout": typeof Number;
|
||||
|
||||
git: typeof String;
|
||||
"git-tag-version": typeof Boolean;
|
||||
|
||||
global: typeof Boolean;
|
||||
globalconfig: typeof String;
|
||||
group: any[];
|
||||
heading: typeof String;
|
||||
"ignore-scripts": typeof Boolean;
|
||||
"init-module": typeof String;
|
||||
"init.author.name": typeof String;
|
||||
"init.author.email": typeof String;
|
||||
"init.author.url": typeof String;
|
||||
"init.version": typeof String;
|
||||
"init.license": typeof String;
|
||||
json: typeof Boolean;
|
||||
key: any[];
|
||||
link: typeof Boolean;
|
||||
"local-address": typeof String;
|
||||
loglevel: any[];
|
||||
logstream: any; // typeof stream.Stream
|
||||
long: typeof Boolean;
|
||||
message: typeof String;
|
||||
"node-version": any[];
|
||||
npat: typeof Boolean;
|
||||
"onload-script": any[];
|
||||
optional: typeof Boolean;
|
||||
parseable: typeof Boolean;
|
||||
prefix: typeof String;
|
||||
production: typeof Boolean;
|
||||
"proprietary-attribs": typeof Boolean;
|
||||
proxy: any[];
|
||||
"https-proxy": any[];
|
||||
"user-agent": typeof String;
|
||||
"rebuild-bundle": Boolean;
|
||||
registry: any[];
|
||||
rollback: typeof Boolean;
|
||||
save: typeof Boolean;
|
||||
"save-bundle": typeof Boolean;
|
||||
"save-dev": typeof Boolean;
|
||||
"save-exact": typeof Boolean;
|
||||
"save-optional": typeof Boolean;
|
||||
"save-prefix": typeof String;
|
||||
scope: typeof String;
|
||||
searchopts: typeof String;
|
||||
searchexclude: any[];
|
||||
searchsort: any[];
|
||||
shell: typeof String;
|
||||
shrinkwrap: typeof Boolean;
|
||||
"sign-git-tag": typeof Boolean;
|
||||
spin: any[];
|
||||
"strict-ssl": typeof Boolean;
|
||||
tag: typeof String;
|
||||
tmp: typeof String;
|
||||
unicode: typeof Boolean;
|
||||
"unsafe-perm": typeof Boolean;
|
||||
usage: typeof Boolean;
|
||||
user: any; // String | Number
|
||||
userconfig: typeof String;
|
||||
umask: typeof Number;
|
||||
version: typeof Boolean;
|
||||
versions: typeof Boolean;
|
||||
viewer: typeof String;
|
||||
|
||||
_exit: typeof Boolean;
|
||||
}
|
||||
|
||||
export interface ConfigShorthands {
|
||||
s: any[];
|
||||
d: any[];
|
||||
dd: any[];
|
||||
ddd: any[];
|
||||
noreg: any[];
|
||||
N: any[];
|
||||
reg: any[];
|
||||
"no-reg": any[];
|
||||
silent: any[];
|
||||
verbose: any[];
|
||||
quiet: any[];
|
||||
q: any[];
|
||||
h: any[];
|
||||
H: any[];
|
||||
"?": any[];
|
||||
help: any[];
|
||||
v: any[];
|
||||
f: any[];
|
||||
gangster: any[];
|
||||
gangsta: any[];
|
||||
desc: any[];
|
||||
"no-desc": any[];
|
||||
"local": any[];
|
||||
l: any[];
|
||||
m: any[];
|
||||
p: any[];
|
||||
porcelain: any[];
|
||||
g: any[];
|
||||
S: any[];
|
||||
D: any[];
|
||||
E: any[];
|
||||
O: any[];
|
||||
y: any[];
|
||||
n: any[];
|
||||
B: any[];
|
||||
C: any[];
|
||||
}
|
||||
|
||||
export interface ConfigSource {
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
scope: string;
|
||||
token?: string;
|
||||
password?: string;
|
||||
username?: string;
|
||||
email?: string;
|
||||
auth?: string;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Utilities Interfaces
|
||||
|
||||
export interface Dictionary<T> {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
export interface ErrorCallback {
|
||||
(err?: Error): void;
|
||||
}
|
||||
|
||||
export interface SimpleCallback<T> {
|
||||
(err?: Error, result?: T): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
declare module "npm" {
|
||||
var npm: NPM.Static;
|
||||
export = npm;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Created by Maxime LUCE <https://github.com/SomaticIT>.
|
||||
*/
|
||||
|
||||
import express = require("express");
|
||||
import passport = require('passport');
|
||||
import local = require('passport-local');
|
||||
|
||||
//#region Test Models
|
||||
interface IUser {
|
||||
username: string;
|
||||
}
|
||||
|
||||
class User implements IUser {
|
||||
public username: string;
|
||||
public password: string;
|
||||
|
||||
static findOne(user: IUser, callback: (err: Error, user: User) => void): void {
|
||||
callback(null, new User());
|
||||
}
|
||||
|
||||
verifyPassword(password: string): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
// Sample from https://github.com/jaredhanson/passport-local#configure-strategy
|
||||
passport.use(new local.Strategy(function (username, password, done) {
|
||||
User.findOne({ username: username }, function (err, user) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return done(null, false);
|
||||
}
|
||||
|
||||
if (!user.verifyPassword(password)) {
|
||||
return done(null, false);
|
||||
}
|
||||
|
||||
return done(null, user);
|
||||
});
|
||||
}));
|
||||
|
||||
// Sample from https://github.com/jaredhanson/passport-local#authenticate-requests
|
||||
var app = express();
|
||||
app.post('/login',
|
||||
passport.authenticate('local', { failureRedirect: '/login' }),
|
||||
function (req, res) {
|
||||
res.redirect('/');
|
||||
});
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for passport-local 1.0.0
|
||||
// Project: https://github.com/jaredhanson/passport-local
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../passport/passport.d.ts"/>
|
||||
|
||||
declare module 'passport-local' {
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
interface IStrategyOptions {
|
||||
usernameField?: string;
|
||||
passwordField?: string;
|
||||
}
|
||||
|
||||
interface IVerifyOptions {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface VerifyFunction {
|
||||
(username: string, password: string, done: (error: any, user?: any, options?: IVerifyOptions) => void): void;
|
||||
}
|
||||
|
||||
class Strategy implements passport.Strategy {
|
||||
constructor(options: IStrategyOptions, verify: VerifyFunction);
|
||||
constructor(verify: VerifyFunction);
|
||||
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="pickadate.d.ts" />
|
||||
|
||||
function testApiMethods(api: Pickadate.Api) {
|
||||
api.clear();
|
||||
api.close();
|
||||
api.close(true);
|
||||
api.get('value');
|
||||
api.get('value', 'yyyy-mm-dd');
|
||||
api.off('open');
|
||||
api.off('open', 'close', 'render');
|
||||
api.on('set', (context: {[key: string]: any}) => { });
|
||||
api.on('get', () => { });
|
||||
api.open();
|
||||
api.open(true);
|
||||
api.render();
|
||||
api.render(true);
|
||||
api.set('value', '2014-09-23');
|
||||
api.set({
|
||||
value: '2014-09-23',
|
||||
max: new Date(2014, 12, 1)
|
||||
});
|
||||
api.start();
|
||||
api.stop();
|
||||
api.trigger('open');
|
||||
|
||||
api.start().open().close().stop();
|
||||
|
||||
var pickerInputElement = api.$node;
|
||||
pickerInputElement.show();
|
||||
|
||||
var pickerRootElement = api.$root;
|
||||
pickerRootElement.show();
|
||||
}
|
||||
|
||||
var datePickerInput = $("input.date");
|
||||
|
||||
datePickerInput.pickadate();
|
||||
|
||||
datePickerInput.pickadate({
|
||||
monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
|
||||
weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
||||
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||||
showMonthsShort: true,
|
||||
showWeekdaysFull: true,
|
||||
|
||||
today: 'Today',
|
||||
clear: 'Clear',
|
||||
close: 'Close',
|
||||
|
||||
labelMonthNext: 'Next month',
|
||||
labelMonthPrev: 'Previous month',
|
||||
labelMonthSelect: 'Select a month',
|
||||
labelYearSelect: 'Select a year',
|
||||
|
||||
// Formats
|
||||
format: 'd mmmm, yyyy',
|
||||
formatSubmit: 'yyyy-mm-dd',
|
||||
hiddenPrefix: 'foo',
|
||||
hiddenSuffix: '_submit',
|
||||
hiddenName: 'bar',
|
||||
|
||||
// Editable input
|
||||
editable: true,
|
||||
|
||||
// Dropdown selectors
|
||||
selectYears: true,
|
||||
selectMonths: 10,
|
||||
|
||||
// First day of the week
|
||||
firstDay: 0,
|
||||
|
||||
// Date limits
|
||||
min: new Date(2013, 3, 20),
|
||||
max: [2013, 7, 14],
|
||||
|
||||
// Disable dates
|
||||
disable: [ new Date(2013, 3, 21) ],
|
||||
|
||||
// Root container
|
||||
container: '.root-container',
|
||||
|
||||
// Events
|
||||
onStart: () => { },
|
||||
onRender: () => { },
|
||||
onOpen: () => { },
|
||||
onClose: () => { },
|
||||
onSet: (context: {[key: string]: any}) => { },
|
||||
onStop: () => { }
|
||||
});
|
||||
|
||||
datePickerInput.pickadate({
|
||||
klass: {
|
||||
// The element states
|
||||
input: 'picker__input',
|
||||
active: 'picker__input--active',
|
||||
|
||||
// The root picker and states *
|
||||
picker: 'picker',
|
||||
opened: 'picker--opened',
|
||||
focused: 'picker--focused',
|
||||
|
||||
// The picker holder
|
||||
holder: 'picker__holder',
|
||||
|
||||
// The picker frame, wrapper, and box
|
||||
frame: 'picker__frame',
|
||||
wrap: 'picker__wrap',
|
||||
box: 'picker__box',
|
||||
|
||||
// The picker header
|
||||
header: 'picker__header',
|
||||
|
||||
// Month navigation
|
||||
navPrev: 'picker__nav--prev',
|
||||
navNext: 'picker__nav--next',
|
||||
navDisabled: 'picker__nav--disabled',
|
||||
|
||||
// Month & year labels
|
||||
month: 'picker__month',
|
||||
year: 'picker__year',
|
||||
|
||||
// Month & year dropdowns
|
||||
selectMonth: 'picker__select--month',
|
||||
selectYear: 'picker__select--year',
|
||||
|
||||
// Table of dates
|
||||
table: 'picker__table',
|
||||
|
||||
// Weekday labels
|
||||
weekdays: 'picker__weekday',
|
||||
|
||||
// Day states
|
||||
day: 'picker__day',
|
||||
disabled: 'picker__day--disabled',
|
||||
selected: 'picker__day--selected',
|
||||
highlighted: 'picker__day--highlighted',
|
||||
now: 'picker__day--today',
|
||||
infocus: 'picker__day--infocus',
|
||||
outfocus: 'picker__day--outfocus',
|
||||
|
||||
// The picker footer
|
||||
footer: 'picker__footer',
|
||||
|
||||
// Today, clear, & close buttons
|
||||
buttonClear: 'picker__button--clear',
|
||||
buttonClose: 'picker__button--close',
|
||||
buttonToday: 'picker__button--today'
|
||||
}
|
||||
});
|
||||
|
||||
var datePickerApi = <Pickadate.Api> datePickerInput.pickadate('picker');
|
||||
|
||||
datePickerInput.pickadate('open');
|
||||
datePickerInput.pickadate('get', 'value');
|
||||
|
||||
testApiMethods(datePickerApi);
|
||||
|
||||
// ====================================================================================================================
|
||||
|
||||
var timePickerInput = $("input.time");
|
||||
|
||||
timePickerInput.pickatime();
|
||||
|
||||
timePickerInput.pickatime({
|
||||
// Translations and clear button
|
||||
clear: 'Clear',
|
||||
|
||||
// Formats
|
||||
format: 'h:i A',
|
||||
formatLabel: '<b>h</b>:i <!i>a</!i>',
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenPrefix: 'prefix__',
|
||||
hiddenSuffix: '__suffix',
|
||||
|
||||
// Editable input
|
||||
editable: true,
|
||||
|
||||
// Time intervals
|
||||
interval: 30,
|
||||
|
||||
// Time limits
|
||||
min: new Date(2013, 3, 20, 7),
|
||||
max: [7, 14],
|
||||
|
||||
// Disable times
|
||||
disable: [ new Date(2013, 3, 21, 7) ],
|
||||
|
||||
// Root container
|
||||
container: '.root-container',
|
||||
|
||||
// Events
|
||||
onStart: () => { },
|
||||
onRender: () => { },
|
||||
onOpen: () => { },
|
||||
onClose: () => { },
|
||||
onSet: (context: {[key: string]: any}) => { },
|
||||
onStop: () => { }
|
||||
});
|
||||
|
||||
timePickerInput.pickatime({
|
||||
klass: {
|
||||
// The element states
|
||||
input: 'picker__input',
|
||||
active: 'picker__input--active',
|
||||
|
||||
// The root picker and states *
|
||||
picker: 'picker picker--time',
|
||||
opened: 'picker--opened',
|
||||
focused: 'picker--focused',
|
||||
|
||||
// The picker holder
|
||||
holder: 'picker__holder',
|
||||
|
||||
// The picker frame, wrapper, and box
|
||||
frame: 'picker__frame',
|
||||
wrap: 'picker__wrap',
|
||||
box: 'picker__box',
|
||||
|
||||
// List of times
|
||||
list: 'picker__list',
|
||||
listItem: 'picker__list-item',
|
||||
|
||||
// Time states
|
||||
disabled: 'picker__list-item--disabled',
|
||||
selected: 'picker__list-item--selected',
|
||||
highlighted: 'picker__list-item--highlighted',
|
||||
viewset: 'picker__list-item--viewset',
|
||||
now: 'picker__list-item--now',
|
||||
|
||||
// Clear button
|
||||
buttonClear: 'picker__button--clear'
|
||||
}
|
||||
});
|
||||
|
||||
var timePickerApi = <Pickadate.Api> timePickerInput.pickatime('picker');
|
||||
|
||||
timePickerInput.pickatime('open');
|
||||
timePickerInput.pickatime('get', 'value');
|
||||
|
||||
testApiMethods(timePickerApi);
|
||||
|
||||
Vendored
+317
@@ -0,0 +1,317 @@
|
||||
// Type definitions for pickadate.js 3.5.4
|
||||
// Project: https://github.com/amsul/pickadate.js
|
||||
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Pickadate {
|
||||
|
||||
export interface Api {
|
||||
/**
|
||||
* Clear the value in the picker's input element.
|
||||
*/
|
||||
clear(): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Close the picker.
|
||||
*
|
||||
* @param keepFocus whether to retain focus on the input element (default: false)
|
||||
*/
|
||||
close(keepFocus?: boolean): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Get the properties, objects, and states of the picker.
|
||||
*
|
||||
* @param field one of [ "value", "select", "highlight", "view", "min", "max", "open", "start", "id", "disable", "enable" ]
|
||||
* @param format string formatter (available for certain fields)
|
||||
*/
|
||||
get(field: string, format?: string): any;
|
||||
|
||||
/**
|
||||
* Unbind callbacks that are bound using the `on` method.
|
||||
* @param methodName one of [ "open, "close", "render", "start", "stop", "set" ]
|
||||
*/
|
||||
off(methodName: string, ...moreMethodNames: string[]): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Attach an event handler for the picker. Only "set" events callbacks receive a "context" object.
|
||||
*
|
||||
* @param methodName event to attach handler to, one of [ "open", "close", "render", "start", "stop", or "set" ]
|
||||
* @param callback event handler
|
||||
*/
|
||||
on(methodName: string, callback: (context?: any) => void): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Open the picker.
|
||||
*
|
||||
* @param keepFocus whether to focus the input element (default: true)
|
||||
*/
|
||||
open(keepFocus?: boolean): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Refresh the picker after adding something to the holder.
|
||||
* By default, only the “face” of the picker (i.e. the box element), has its contents re-rendered.
|
||||
*
|
||||
* @param fromRoot whether to render the entire picker from the root up (default: false)
|
||||
*/
|
||||
render(fromRoot?: boolean): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Set the properties, objects, and states of the picker.
|
||||
*
|
||||
* @param field one of [ "clear", "select", "highlight", "view", "min", "max", "disable", "enable", "interval" ]
|
||||
* @param value the thing you want to set
|
||||
*/
|
||||
set(field: string, value: any, options?: {[key: string]: any}): Pickadate.Api;
|
||||
/**
|
||||
* Batch set picker options after initialization.
|
||||
*/
|
||||
set(values: {[field: string]: any}, options?: {[key: string]: any}): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Rebuild the picker.
|
||||
*/
|
||||
start(): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Destroy the picker.
|
||||
*/
|
||||
stop(): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* Trigger a picker event.
|
||||
* @param eventName the event to trigger
|
||||
*/
|
||||
trigger(eventName: string): Pickadate.Api;
|
||||
|
||||
/**
|
||||
* The picker's relative <input> element.
|
||||
*/
|
||||
$node: JQuery;
|
||||
|
||||
/**
|
||||
* The picker's relative root holder element.
|
||||
*/
|
||||
$root: JQuery;
|
||||
|
||||
/**
|
||||
* The picker's relative hidden element, which is undefined if there's no formatSubmit option.
|
||||
* This is meant to be mostly for internal use.
|
||||
*/
|
||||
_hidden: JQuery;
|
||||
}
|
||||
|
||||
export interface DateOptions {
|
||||
// String and translations
|
||||
monthsFull?: string[];
|
||||
monthsShort?: string[];
|
||||
weekdaysFull?: string[];
|
||||
weekdaysShort?: string[]
|
||||
showMonthsShort?: boolean;
|
||||
showWeekdaysFull?: boolean;
|
||||
|
||||
// Button labels (if falsy, the corresponding button is disabled)
|
||||
today?: string;
|
||||
clear?: string;
|
||||
close?: string;
|
||||
|
||||
// Accessibility labels
|
||||
labelMonthNext?: string;
|
||||
labelMonthPrev?: string;
|
||||
labelMonthSelect?: string;
|
||||
labelYearSelect?: string;
|
||||
|
||||
// Formats
|
||||
format?: string;
|
||||
formatSubmit?: string;
|
||||
hiddenPrefix?: string;
|
||||
hiddenSuffix?: string;
|
||||
hiddenName?: string;
|
||||
|
||||
// Editable input
|
||||
editable?: boolean;
|
||||
|
||||
// Number of months to show in the month selection dropdown OR a boolean
|
||||
selectMonths?: any;
|
||||
// Number of years to show in the month selection dropdown OR a boolean
|
||||
selectYears?: any;
|
||||
|
||||
// First day of the week
|
||||
firstDay?: number
|
||||
|
||||
// Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week)
|
||||
disable?: any[];
|
||||
|
||||
// Root container selector
|
||||
container?: string
|
||||
|
||||
// Events
|
||||
onStart?: () => void;
|
||||
onRender?: () => void;
|
||||
onOpen?: () => void;
|
||||
onClose?: () => void;
|
||||
onSet?: (context: {[key: string]: any}) => void;
|
||||
onStop?: () => void;
|
||||
|
||||
// Classes
|
||||
klass?: DateKlassOptions;
|
||||
}
|
||||
|
||||
export interface DateKlassOptions {
|
||||
// The element states
|
||||
input?: string;
|
||||
active?: string;
|
||||
|
||||
// The root picker and states
|
||||
picker?: string;
|
||||
opened?: string;
|
||||
focused?: string;
|
||||
|
||||
// The picker holder
|
||||
holder?: string;
|
||||
|
||||
// The picker frame, wrapper, and box
|
||||
frame?: string;
|
||||
wrap?: string;
|
||||
box?: string;
|
||||
|
||||
// The picker header
|
||||
header?: string;
|
||||
|
||||
// Month navigation
|
||||
navPrev?: string;
|
||||
navNext?: string;
|
||||
navDisabled?: string;
|
||||
|
||||
// Month & year labels
|
||||
month?: string;
|
||||
year?: string;
|
||||
|
||||
// Month & year dropdowns
|
||||
selectMonth?: string;
|
||||
selectYear?: string;
|
||||
|
||||
// Table of dates
|
||||
table?: string;
|
||||
|
||||
// Weekday labels
|
||||
weekdays?: string;
|
||||
|
||||
// Day states
|
||||
day?: string;
|
||||
disabled?: string;
|
||||
selected?: string;
|
||||
highlighted?: string;
|
||||
now?: string;
|
||||
infocus?: string;
|
||||
outfocus?: string;
|
||||
|
||||
// The picker footer
|
||||
footer?: string;
|
||||
|
||||
// Today, clear, & close buttons
|
||||
buttonClear?: string;
|
||||
buttonClose?: string;
|
||||
buttonToday?: string
|
||||
}
|
||||
|
||||
export interface TimeOptions {
|
||||
// Translations and clear button
|
||||
clear?: string;
|
||||
|
||||
// Formats
|
||||
format?: string;
|
||||
formatLabel?: string;
|
||||
formatSubmit?: string;
|
||||
hiddenPrefix?: string;
|
||||
hiddenSuffix?: string;
|
||||
|
||||
// Editable input
|
||||
editable?: boolean;
|
||||
|
||||
// Time intervals
|
||||
interval?: number;
|
||||
|
||||
// Time limits (can be Dates, arrays formatted as [HOUR, MINUTE], integers, or booleans)
|
||||
min?: any;
|
||||
max?: any;
|
||||
|
||||
// Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week)
|
||||
disable?: any[];
|
||||
|
||||
// Root container selector
|
||||
container?: string
|
||||
|
||||
// Events
|
||||
onStart?: () => void;
|
||||
onRender?: () => void;
|
||||
onOpen?: () => void;
|
||||
onClose?: () => void;
|
||||
onSet?: (context: {[key: string]: any}) => void;
|
||||
onStop?: () => void;
|
||||
|
||||
// Classes
|
||||
klass?: TimeKlassOptions;
|
||||
}
|
||||
|
||||
export interface TimeKlassOptions {
|
||||
// The element states
|
||||
input?: string;
|
||||
active?: string;
|
||||
|
||||
// The root picker and states
|
||||
picker?: string;
|
||||
opened?: string;
|
||||
focused?: string;
|
||||
|
||||
// The picker holder
|
||||
holder?: string;
|
||||
|
||||
// The picker frame, wrapper, and box
|
||||
frame?: string;
|
||||
wrap?: string;
|
||||
box?: string;
|
||||
|
||||
// List of times
|
||||
list?: string;
|
||||
listItem?: string;
|
||||
|
||||
// Time states
|
||||
disabled?: string;
|
||||
selected?: string;
|
||||
highlighted?: string;
|
||||
viewset?: string;
|
||||
now?: string;
|
||||
|
||||
// Clear button
|
||||
buttonClear?: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Initialize a date picker.
|
||||
*/
|
||||
pickadate(options?: Pickadate.DateOptions): any;
|
||||
|
||||
/**
|
||||
* Access objects attached to the picker or invoke API methods after initialization.
|
||||
* If keyword is "picker", this returns a PickadateApi.
|
||||
* @param keyword "picker", an object name, or method name
|
||||
* @param arguments any arguments to pass to the method
|
||||
*/
|
||||
pickadate(keyword: string, ...arguments: any[]): any;
|
||||
|
||||
/**
|
||||
* Initialize a time picker.
|
||||
*/
|
||||
pickatime(options?: Pickadate.TimeOptions): any;
|
||||
|
||||
/**
|
||||
* Access objects attached to the picker or invoke API methods after initialization.
|
||||
* If keyword is "picker", this returns a PickadateApi.
|
||||
* @param keyword "picker", an object name, or method name
|
||||
* @param arguments any arguments to pass to the method
|
||||
*/
|
||||
pickatime(keyword: string, ...arguments: any[]): any;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="precise.d.ts" />
|
||||
|
||||
import precise = require("precise");
|
||||
|
||||
var timer = precise().start();
|
||||
|
||||
setTimeout(function () {
|
||||
console.log(timer.stop().diff());
|
||||
}, 1000);
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for precise
|
||||
// Project: https://www.npmjs.org/package/precise
|
||||
// Definitions by: Peter Harris <https://github.com/codeanimal>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "precise" {
|
||||
/**
|
||||
* Precise factory
|
||||
*/
|
||||
function _precise(): _precise.Precise;
|
||||
|
||||
module _precise {
|
||||
class Precise {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Starts a timer
|
||||
*/
|
||||
start(): Precise;
|
||||
|
||||
/**
|
||||
* Stops a timer
|
||||
*/
|
||||
stop(): Precise;
|
||||
|
||||
/**
|
||||
* Returns the nanoseconds from `start()` to `stop()`
|
||||
*/
|
||||
diff(): number;
|
||||
}
|
||||
}
|
||||
|
||||
export = _precise;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/// <reference path="radius.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import radius = require('radius');
|
||||
|
||||
var radius_secret: string = "shhhh"
|
||||
|
||||
radius.add_dictionary("./");
|
||||
var encodedPacket: Buffer = radius.encode({
|
||||
code: "Access-Request",
|
||||
secret: radius_secret,
|
||||
attributes: {
|
||||
"NAS-IP-Address": "10.5.5.5",
|
||||
"User-Name": "me",
|
||||
"User-Password": "its-a-secret"
|
||||
}
|
||||
});
|
||||
|
||||
var radiusPacket: radius.RadiusPacket = radius.decode({
|
||||
packet: encodedPacket,
|
||||
secret: radius_secret
|
||||
});
|
||||
|
||||
var response: Buffer;
|
||||
|
||||
if (radiusPacket.attributes["User-Name"] == "me" && radiusPacket.attributes["User-Password"] == "its-a-secret") {
|
||||
response = radius.encode_response({
|
||||
packet: radiusPacket,
|
||||
code: "Access-Accept",
|
||||
secret: radius_secret
|
||||
});
|
||||
} else {
|
||||
response = radius.encode_response({
|
||||
packet: radiusPacket,
|
||||
code: "Access-Reject",
|
||||
secret: radius_secret
|
||||
});
|
||||
}
|
||||
|
||||
console.log(radius.verify_response({
|
||||
request: encodedPacket,
|
||||
response: response,
|
||||
secret: radius_secret
|
||||
}));
|
||||
Vendored
+106
@@ -0,0 +1,106 @@
|
||||
// Type definitions for node-radius
|
||||
// Project: https://github.com/retailnext/node-radius
|
||||
// Definitions by: Peter Harris <https://github.com/codeanimal>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "radius" {
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusdecodeargs} for more info.
|
||||
**/
|
||||
export function decode(args: DecodeArgsWithSecret): RadiusPacket;
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusdecode_without_secretargs} for more info.
|
||||
**/
|
||||
export function decode_without_secret(args: DecodeArgs): RadiusPacket;
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusencodeargs} for more info.
|
||||
**/
|
||||
export function encode(args: EncodeArgs): Buffer;
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusencode_responseargs} for more info.
|
||||
**/
|
||||
export function encode_response(args: EncodeResponseArgs): Buffer;
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusverify_responseargs} for more info.
|
||||
**/
|
||||
export function verify_response(args: VerifyResponseArgs):boolean;
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusadd_dictionarypath} for more info.
|
||||
*
|
||||
* @param path Can be either a path to a file or a directory.
|
||||
**/
|
||||
export function add_dictionary(path:string): void;
|
||||
|
||||
export function unload_dictionaries(): void;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusdecode_without_secretargs} for more info.
|
||||
**/
|
||||
interface DecodeArgs {
|
||||
packet: Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusdecodeargs} for more info.
|
||||
**/
|
||||
interface DecodeArgsWithSecret extends DecodeArgs {
|
||||
secret: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusencodeargs} for more info.
|
||||
**/
|
||||
interface EncodeArgs {
|
||||
code: string;
|
||||
secret: string;
|
||||
identifier?: number;
|
||||
/**
|
||||
* This can be an object: { attribute_name: attribute_value, ... },
|
||||
* an array within an array: [ [ attribute_name, attribute_value ], ... ],
|
||||
* or if you haven't loaded a dictionary for the attributes: [ [ attribute_id, Buffer ], ... ].
|
||||
*
|
||||
* Tag field-attributes can be specified like so: [ [ attribute_name, tag_number, attribute_value ] ... ]
|
||||
**/
|
||||
attributes?: any;
|
||||
add_message_authenticator?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusencode_responseargs} for more info.
|
||||
**/
|
||||
interface EncodeResponseArgs {
|
||||
packet: RadiusPacket;
|
||||
code: string;
|
||||
secret: string;
|
||||
attributes?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link https://github.com/retailnext/node-radius#radiusverify_responseargs} for more info.
|
||||
**/
|
||||
interface VerifyResponseArgs {
|
||||
request: Buffer;
|
||||
response: Buffer;
|
||||
secret: string;
|
||||
}
|
||||
|
||||
interface RadiusPacket {
|
||||
code: string;
|
||||
identifier: number;
|
||||
length: number;
|
||||
attributes: any;
|
||||
raw_attributes: Array<Array<any>>
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ client.bitcount(str, numCallback);
|
||||
client.bitcount(str, num, num, numCallback);
|
||||
client.set(str, str, strCallback);
|
||||
client.get(str, strCallback);
|
||||
client.exists(str, str, numCallback);
|
||||
client.exists(str, numCallback);
|
||||
|
||||
client.publish(str, value);
|
||||
client.subscribe(str);
|
||||
@@ -60,3 +60,5 @@ client.get(args);
|
||||
client.get(args, resCallback);
|
||||
client.set(args);
|
||||
client.set(args, resCallback);
|
||||
|
||||
client.incr(str, resCallback);
|
||||
Vendored
+309
-180
@@ -1,12 +1,14 @@
|
||||
// Type definitions for redis
|
||||
// Project: https://github.com/mranney/node_redis
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>, Peter Harris <https://github.com/CodeAnimal>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts
|
||||
|
||||
declare module "redis" {
|
||||
export function createClient(port_arg: number, host_arg: string, options: ClientOpts): RedisClient;
|
||||
export function createClient(port_arg: number, host_arg?: string, options?: ClientOpts): RedisClient;
|
||||
export function createClient(unix_socket: string, options?: ClientOpts): RedisClient;
|
||||
export function createClient(options?: ClientOpts): RedisClient;
|
||||
export function print(err: Error, reply: any): void;
|
||||
export var debug_mode: boolean;
|
||||
|
||||
@@ -14,17 +16,14 @@ declare module "redis" {
|
||||
(channel: string, message: any): void;
|
||||
}
|
||||
|
||||
interface ResCallback {
|
||||
(err: Error, res: any): void;
|
||||
}
|
||||
interface CommandT<R> { //This is a placeholder to be used eventually, to not have to define each command twice, or four times if all caps versions are to be implemented.
|
||||
(args: any[], callback?: ResCallbackT<R>): void;
|
||||
(...args: any[]): void;
|
||||
}
|
||||
|
||||
interface NumCallback {
|
||||
(err: Error, reply: number): void;
|
||||
}
|
||||
|
||||
interface StringCallback {
|
||||
(err: Error, reply: string): void;
|
||||
}
|
||||
interface ResCallbackT<R> {
|
||||
(err: Error, res: R): void;
|
||||
}
|
||||
|
||||
interface ServerInfo {
|
||||
redis_version: string;
|
||||
@@ -45,180 +44,310 @@ declare module "redis" {
|
||||
}
|
||||
|
||||
interface RedisClient {
|
||||
// event: connect
|
||||
// event: error
|
||||
// event: message
|
||||
// event: pmessage
|
||||
// event: subscribe
|
||||
// event: psubscribe
|
||||
// event: unsubscribe
|
||||
// event: punsubscribe
|
||||
// event: connect
|
||||
// event: error
|
||||
// event: message
|
||||
// event: pmessage
|
||||
// event: subscribe
|
||||
// event: psubscribe
|
||||
// event: unsubscribe
|
||||
// event: punsubscribe
|
||||
|
||||
connected: boolean;
|
||||
retry_delay: number;
|
||||
retry_backoff: number;
|
||||
command_queue: any[];
|
||||
offline_queue: any[];
|
||||
server_info: ServerInfo;
|
||||
connected: boolean;
|
||||
retry_delay: number;
|
||||
retry_backoff: number;
|
||||
command_queue: any[];
|
||||
offline_queue: any[];
|
||||
server_info: ServerInfo;
|
||||
|
||||
end(): void;
|
||||
end(): void;
|
||||
|
||||
// Connection (http://redis.io/commands#connection)
|
||||
auth(password: string, callback?: ResCallback): void;
|
||||
ping(callback?: NumCallback): void;
|
||||
// Connection (http://redis.io/commands#connection)
|
||||
auth(password: string, callback?: ResCallbackT<any>): void;
|
||||
ping(callback?: ResCallbackT<number>): void;
|
||||
|
||||
// Strings (http://redis.io/commands#strings)
|
||||
append(key: string, value: string, callback?: NumCallback): void;
|
||||
bitcount(key: string, callback?: NumCallback): void;
|
||||
bitcount(key: string, start: number, end: number, callback?: NumCallback): void;
|
||||
set(key: string, value: string, callback?: StringCallback): void;
|
||||
get(key: string, callback?: StringCallback): void;
|
||||
exists(key: string, value: string, callback?: NumCallback): void;
|
||||
// Strings (http://redis.io/commands#strings)
|
||||
append(key: string, value: string, callback?: ResCallbackT<number>): void;
|
||||
bitcount(key: string, callback?: ResCallbackT<number>): void;
|
||||
bitcount(key: string, start: number, end: number, callback?: ResCallbackT<number>): void;
|
||||
set(key: string, value: string, callback?: ResCallbackT<string>): void;
|
||||
get(key: string, callback?: ResCallbackT<string>): void;
|
||||
exists(key: string, value: string, callback?: ResCallbackT<number>): void;
|
||||
|
||||
publish(channel: string, value: any): void;
|
||||
subscribe(channel: string): void;
|
||||
on(channel: string, handler: MessageHandler): void;
|
||||
publish(channel: string, value: any): void;
|
||||
subscribe(channel: string): void;
|
||||
on(channel: string, handler: MessageHandler): void;
|
||||
|
||||
/*
|
||||
commands = set_union([
|
||||
"get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr",
|
||||
"incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex",
|
||||
"lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore",
|
||||
"sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore",
|
||||
"zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx",
|
||||
"hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx",
|
||||
"randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave",
|
||||
"bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl",
|
||||
"persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster",
|
||||
"restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands"));
|
||||
*/
|
||||
/*
|
||||
commands = set_union([
|
||||
"get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr",
|
||||
"incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex",
|
||||
"lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore",
|
||||
"sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore",
|
||||
"zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx",
|
||||
"hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx",
|
||||
"randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave",
|
||||
"bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl",
|
||||
"persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster",
|
||||
"restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands"));
|
||||
*/
|
||||
|
||||
get(args: any[], callback?: ResCallback): void;
|
||||
set(args: any[], callback?: ResCallback): void;
|
||||
setnx(args: any[], callback?: ResCallback): void;
|
||||
setex(args: any[], callback?: ResCallback): void;
|
||||
append(args: any[], callback?: ResCallback): void;
|
||||
strlen(args: any[], callback?: ResCallback): void;
|
||||
del(args: any[], callback?: ResCallback): void;
|
||||
exists(args: any[], callback?: ResCallback): void;
|
||||
setbit(args: any[], callback?: ResCallback): void;
|
||||
getbit(args: any[], callback?: ResCallback): void;
|
||||
setrange(args: any[], callback?: ResCallback): void;
|
||||
getrange(args: any[], callback?: ResCallback): void;
|
||||
substr(args: any[], callback?: ResCallback): void;
|
||||
incr(args: any[], callback?: ResCallback): void;
|
||||
decr(args: any[], callback?: ResCallback): void;
|
||||
mget(args: any[], callback?: ResCallback): void;
|
||||
rpush(args: any[], callback?: ResCallback): void;
|
||||
lpush(args: any[], callback?: ResCallback): void;
|
||||
rpushx(args: any[], callback?: ResCallback): void;
|
||||
lpushx(args: any[], callback?: ResCallback): void;
|
||||
linsert(args: any[], callback?: ResCallback): void;
|
||||
rpop(args: any[], callback?: ResCallback): void;
|
||||
lpop(args: any[], callback?: ResCallback): void;
|
||||
brpop(args: any[], callback?: ResCallback): void;
|
||||
brpoplpush(args: any[], callback?: ResCallback): void;
|
||||
blpop(args: any[], callback?: ResCallback): void;
|
||||
llen(args: any[], callback?: ResCallback): void;
|
||||
lindex(args: any[], callback?: ResCallback): void;
|
||||
lset(args: any[], callback?: ResCallback): void;
|
||||
lrange(args: any[], callback?: ResCallback): void;
|
||||
ltrim(args: any[], callback?: ResCallback): void;
|
||||
lrem(args: any[], callback?: ResCallback): void;
|
||||
rpoplpush(args: any[], callback?: ResCallback): void;
|
||||
sadd(args: any[], callback?: ResCallback): void;
|
||||
srem(args: any[], callback?: ResCallback): void;
|
||||
smove(args: any[], callback?: ResCallback): void;
|
||||
sismember(args: any[], callback?: ResCallback): void;
|
||||
scard(args: any[], callback?: ResCallback): void;
|
||||
spop(args: any[], callback?: ResCallback): void;
|
||||
srandmember(args: any[], callback?: ResCallback): void;
|
||||
sinter(args: any[], callback?: ResCallback): void;
|
||||
sinterstore(args: any[], callback?: ResCallback): void;
|
||||
sunion(args: any[], callback?: ResCallback): void;
|
||||
sunionstore(args: any[], callback?: ResCallback): void;
|
||||
sdiff(args: any[], callback?: ResCallback): void;
|
||||
sdiffstore(args: any[], callback?: ResCallback): void;
|
||||
smembers(args: any[], callback?: ResCallback): void;
|
||||
zadd(args: any[], callback?: ResCallback): void;
|
||||
zincrby(args: any[], callback?: ResCallback): void;
|
||||
zrem(args: any[], callback?: ResCallback): void;
|
||||
zremrangebyscore(args: any[], callback?: ResCallback): void;
|
||||
zremrangebyrank(args: any[], callback?: ResCallback): void;
|
||||
zunionstore(args: any[], callback?: ResCallback): void;
|
||||
zinterstore(args: any[], callback?: ResCallback): void;
|
||||
zrange(args: any[], callback?: ResCallback): void;
|
||||
zrangebyscore(args: any[], callback?: ResCallback): void;
|
||||
zrevrangebyscore(args: any[], callback?: ResCallback): void;
|
||||
zcount(args: any[], callback?: ResCallback): void;
|
||||
zrevrange(args: any[], callback?: ResCallback): void;
|
||||
zcard(args: any[], callback?: ResCallback): void;
|
||||
zscore(args: any[], callback?: ResCallback): void;
|
||||
zrank(args: any[], callback?: ResCallback): void;
|
||||
zrevrank(args: any[], callback?: ResCallback): void;
|
||||
hset(args: any[], callback?: ResCallback): void;
|
||||
hsetnx(args: any[], callback?: ResCallback): void;
|
||||
hget(args: any[], callback?: ResCallback): void;
|
||||
hmset(args: any[], callback?: ResCallback): void;
|
||||
hmget(args: any[], callback?: ResCallback): void;
|
||||
hincrby(args: any[], callback?: ResCallback): void;
|
||||
hdel(args: any[], callback?: ResCallback): void;
|
||||
hlen(args: any[], callback?: ResCallback): void;
|
||||
hkeys(args: any[], callback?: ResCallback): void;
|
||||
hvals(args: any[], callback?: ResCallback): void;
|
||||
hgetall(args: any[], callback?: ResCallback): void;
|
||||
hexists(args: any[], callback?: ResCallback): void;
|
||||
incrby(args: any[], callback?: ResCallback): void;
|
||||
decrby(args: any[], callback?: ResCallback): void;
|
||||
getset(args: any[], callback?: ResCallback): void;
|
||||
mset(args: any[], callback?: ResCallback): void;
|
||||
msetnx(args: any[], callback?: ResCallback): void;
|
||||
randomkey(args: any[], callback?: ResCallback): void;
|
||||
select(args: any[], callback?: ResCallback): void;
|
||||
move(args: any[], callback?: ResCallback): void;
|
||||
rename(args: any[], callback?: ResCallback): void;
|
||||
renamenx(args: any[], callback?: ResCallback): void;
|
||||
expire(args: any[], callback?: ResCallback): void;
|
||||
expireat(args: any[], callback?: ResCallback): void;
|
||||
keys(args: any[], callback?: ResCallback): void;
|
||||
dbsize(args: any[], callback?: ResCallback): void;
|
||||
auth(args: any[], callback?: ResCallback): void;
|
||||
ping(args: any[], callback?: ResCallback): void;
|
||||
echo(args: any[], callback?: ResCallback): void;
|
||||
save(args: any[], callback?: ResCallback): void;
|
||||
bgsave(args: any[], callback?: ResCallback): void;
|
||||
bgrewriteaof(args: any[], callback?: ResCallback): void;
|
||||
shutdown(args: any[], callback?: ResCallback): void;
|
||||
lastsave(args: any[], callback?: ResCallback): void;
|
||||
type(args: any[], callback?: ResCallback): void;
|
||||
multi(args: any[], callback?: ResCallback): void;
|
||||
exec(args: any[], callback?: ResCallback): void;
|
||||
discard(args: any[], callback?: ResCallback): void;
|
||||
sync(args: any[], callback?: ResCallback): void;
|
||||
flushdb(args: any[], callback?: ResCallback): void;
|
||||
flushall(args: any[], callback?: ResCallback): void;
|
||||
sort(args: any[], callback?: ResCallback): void;
|
||||
info(args: any[], callback?: ResCallback): void;
|
||||
monitor(args: any[], callback?: ResCallback): void;
|
||||
ttl(args: any[], callback?: ResCallback): void;
|
||||
persist(args: any[], callback?: ResCallback): void;
|
||||
slaveof(args: any[], callback?: ResCallback): void;
|
||||
debug(args: any[], callback?: ResCallback): void;
|
||||
config(args: any[], callback?: ResCallback): void;
|
||||
subscribe(args: any[], callback?: ResCallback): void;
|
||||
unsubscribe(args: any[], callback?: ResCallback): void;
|
||||
psubscribe(args: any[], callback?: ResCallback): void;
|
||||
punsubscribe(args: any[], callback?: ResCallback): void;
|
||||
publish(args: any[], callback?: ResCallback): void;
|
||||
watch(args: any[], callback?: ResCallback): void;
|
||||
unwatch(args: any[], callback?: ResCallback): void;
|
||||
cluster(args: any[], callback?: ResCallback): void;
|
||||
restore(args: any[], callback?: ResCallback): void;
|
||||
migrate(args: any[], callback?: ResCallback): void;
|
||||
dump(args: any[], callback?: ResCallback): void;
|
||||
object(args: any[], callback?: ResCallback): void;
|
||||
client(args: any[], callback?: ResCallback): void;
|
||||
eval(args: any[], callback?: ResCallback): void;
|
||||
evalsha(args: any[], callback?: ResCallback): void;
|
||||
get(args: any[], callback?: ResCallbackT<string>): void;
|
||||
get(...args: any[]): void;
|
||||
set(args: any[], callback?: ResCallbackT<string>): void;
|
||||
set(...args: any[]): void;
|
||||
setnx(args: any[], callback?: ResCallbackT<any>): void;
|
||||
setnx(...args: any[]): void;
|
||||
setex(args: any[], callback?: ResCallbackT<any>): void;
|
||||
setex(...args: any[]): void;
|
||||
append(args: any[], callback?: ResCallbackT<any>): void;
|
||||
append(...args: any[]): void;
|
||||
strlen(args: any[], callback?: ResCallbackT<any>): void;
|
||||
strlen(...args: any[]): void;
|
||||
del(args: any[], callback?: ResCallbackT<any>): void;
|
||||
del(...args: any[]): void;
|
||||
exists(args: any[], callback?: ResCallbackT<any>): void;
|
||||
exists(...args: any[]): void;
|
||||
setbit(args: any[], callback?: ResCallbackT<any>): void;
|
||||
setbit(...args: any[]): void;
|
||||
getbit(args: any[], callback?: ResCallbackT<any>): void;
|
||||
getbit(...args: any[]): void;
|
||||
setrange(args: any[], callback?: ResCallbackT<any>): void;
|
||||
setrange(...args: any[]): void;
|
||||
getrange(args: any[], callback?: ResCallbackT<any>): void;
|
||||
getrange(...args: any[]): void;
|
||||
substr(args: any[], callback?: ResCallbackT<any>): void;
|
||||
substr(...args: any[]): void;
|
||||
incr(args: any[], callback?: ResCallbackT<any>): void;
|
||||
incr(...args: any[]): void;
|
||||
decr(args: any[], callback?: ResCallbackT<any>): void;
|
||||
decr(...args: any[]): void;
|
||||
mget(args: any[], callback?: ResCallbackT<any>): void;
|
||||
mget(...args: any[]): void;
|
||||
rpush(...args: any[]): void;
|
||||
lpush(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lpush(...args: any[]): void;
|
||||
rpushx(args: any[], callback?: ResCallbackT<any>): void;
|
||||
rpushx(...args: any[]): void;
|
||||
lpushx(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lpushx(...args: any[]): void;
|
||||
linsert(args: any[], callback?: ResCallbackT<any>): void;
|
||||
linsert(...args: any[]): void;
|
||||
rpop(args: any[], callback?: ResCallbackT<any>): void;
|
||||
rpop(...args: any[]): void;
|
||||
lpop(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lpop(...args: any[]): void;
|
||||
brpop(args: any[], callback?: ResCallbackT<any>): void;
|
||||
brpop(...args: any[]): void;
|
||||
brpoplpush(args: any[], callback?: ResCallbackT<any>): void;
|
||||
brpoplpush(...args: any[]): void;
|
||||
blpop(args: any[], callback?: ResCallbackT<any>): void;
|
||||
blpop(...args: any[]): void;
|
||||
llen(args: any[], callback?: ResCallbackT<any>): void;
|
||||
llen(...args: any[]): void;
|
||||
lindex(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lindex(...args: any[]): void;
|
||||
lset(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lset(...args: any[]): void;
|
||||
lrange(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lrange(...args: any[]): void;
|
||||
ltrim(args: any[], callback?: ResCallbackT<any>): void;
|
||||
ltrim(...args: any[]): void;
|
||||
lrem(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lrem(...args: any[]): void;
|
||||
rpoplpush(args: any[], callback?: ResCallbackT<any>): void;
|
||||
rpoplpush(...args: any[]): void;
|
||||
sadd(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sadd(...args: any[]): void;
|
||||
srem(args: any[], callback?: ResCallbackT<any>): void;
|
||||
srem(...args: any[]): void;
|
||||
smove(args: any[], callback?: ResCallbackT<any>): void;
|
||||
smove(...args: any[]): void;
|
||||
sismember(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sismember(...args: any[]): void;
|
||||
scard(args: any[], callback?: ResCallbackT<any>): void;
|
||||
scard(...args: any[]): void;
|
||||
spop(args: any[], callback?: ResCallbackT<any>): void;
|
||||
spop(...args: any[]): void;
|
||||
srandmember(args: any[], callback?: ResCallbackT<any>): void;
|
||||
srandmember(...args: any[]): void;
|
||||
sinter(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sinter(...args: any[]): void;
|
||||
sinterstore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sinterstore(...args: any[]): void;
|
||||
sunion(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sunion(...args: any[]): void;
|
||||
sunionstore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sunionstore(...args: any[]): void;
|
||||
sdiff(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sdiff(...args: any[]): void;
|
||||
sdiffstore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sdiffstore(...args: any[]): void;
|
||||
smembers(args: any[], callback?: ResCallbackT<any>): void;
|
||||
smembers(...args: any[]): void;
|
||||
zadd(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zadd(...args: any[]): void;
|
||||
zincrby(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zincrby(...args: any[]): void;
|
||||
zrem(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrem(...args: any[]): void;
|
||||
zremrangebyscore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zremrangebyscore(...args: any[]): void;
|
||||
zremrangebyrank(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zremrangebyrank(...args: any[]): void;
|
||||
zunionstore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zunionstore(...args: any[]): void;
|
||||
zinterstore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zinterstore(...args: any[]): void;
|
||||
zrange(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrange(...args: any[]): void;
|
||||
zrangebyscore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrangebyscore(...args: any[]): void;
|
||||
zrevrangebyscore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrevrangebyscore(...args: any[]): void;
|
||||
zcount(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zcount(...args: any[]): void;
|
||||
zrevrange(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrevrange(...args: any[]): void;
|
||||
zcard(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zcard(...args: any[]): void;
|
||||
zscore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zscore(...args: any[]): void;
|
||||
zrank(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrank(...args: any[]): void;
|
||||
zrevrank(args: any[], callback?: ResCallbackT<any>): void;
|
||||
zrevrank(...args: any[]): void;
|
||||
hset(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hset(...args: any[]): void;
|
||||
hsetnx(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hsetnx(...args: any[]): void;
|
||||
hget(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hget(...args: any[]): void;
|
||||
hmset(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hmset(key: string, hash: any, callback?: ResCallbackT<any>): void;
|
||||
hmset(...args: any[]): void;
|
||||
hmget(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hmget(...args: any[]): void;
|
||||
hincrby(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hincrby(...args: any[]): void;
|
||||
hdel(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hdel(...args: any[]): void;
|
||||
hlen(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hlen(...args: any[]): void;
|
||||
hkeys(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hkeys(...args: any[]): void;
|
||||
hvals(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hvals(...args: any[]): void;
|
||||
hgetall(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hgetall(...args: any[]): void;
|
||||
hgetall(key: string, callback?: ResCallbackT<any>): void;
|
||||
hexists(args: any[], callback?: ResCallbackT<any>): void;
|
||||
hexists(...args: any[]): void;
|
||||
incrby(args: any[], callback?: ResCallbackT<any>): void;
|
||||
incrby(...args: any[]): void;
|
||||
decrby(args: any[], callback?: ResCallbackT<any>): void;
|
||||
decrby(...args: any[]): void;
|
||||
getset(args: any[], callback?: ResCallbackT<any>): void;
|
||||
getset(...args: any[]): void;
|
||||
mset(args: any[], callback?: ResCallbackT<any>): void;
|
||||
mset(...args: any[]): void;
|
||||
msetnx(args: any[], callback?: ResCallbackT<any>): void;
|
||||
msetnx(...args: any[]): void;
|
||||
randomkey(args: any[], callback?: ResCallbackT<any>): void;
|
||||
randomkey(...args: any[]): void;
|
||||
select(args: any[], callback?: ResCallbackT<any>): void;
|
||||
select(...args: any[]): void;
|
||||
move(args: any[], callback?: ResCallbackT<any>): void;
|
||||
move(...args: any[]): void;
|
||||
rename(args: any[], callback?: ResCallbackT<any>): void;
|
||||
rename(...args: any[]): void;
|
||||
renamenx(args: any[], callback?: ResCallbackT<any>): void;
|
||||
renamenx(...args: any[]): void;
|
||||
expire(args: any[], callback?: ResCallbackT<any>): void;
|
||||
expire(...args: any[]): void;
|
||||
expireat(args: any[], callback?: ResCallbackT<any>): void;
|
||||
expireat(...args: any[]): void;
|
||||
keys(args: any[], callback?: ResCallbackT<any>): void;
|
||||
keys(...args: any[]): void;
|
||||
dbsize(args: any[], callback?: ResCallbackT<any>): void;
|
||||
dbsize(...args: any[]): void;
|
||||
auth(args: any[], callback?: ResCallbackT<any>): void;
|
||||
auth(...args: any[]): void;
|
||||
ping(args: any[], callback?: ResCallbackT<any>): void;
|
||||
ping(...args: any[]): void;
|
||||
echo(args: any[], callback?: ResCallbackT<any>): void;
|
||||
echo(...args: any[]): void;
|
||||
save(args: any[], callback?: ResCallbackT<any>): void;
|
||||
save(...args: any[]): void;
|
||||
bgsave(args: any[], callback?: ResCallbackT<any>): void;
|
||||
bgsave(...args: any[]): void;
|
||||
bgrewriteaof(args: any[], callback?: ResCallbackT<any>): void;
|
||||
bgrewriteaof(...args: any[]): void;
|
||||
shutdown(args: any[], callback?: ResCallbackT<any>): void;
|
||||
shutdown(...args: any[]): void;
|
||||
lastsave(args: any[], callback?: ResCallbackT<any>): void;
|
||||
lastsave(...args: any[]): void;
|
||||
type(args: any[], callback?: ResCallbackT<any>): void;
|
||||
type(...args: any[]): void;
|
||||
multi(args: any[], callback?: ResCallbackT<any>): void;
|
||||
multi(...args: any[]): void;
|
||||
exec(args: any[], callback?: ResCallbackT<any>): void;
|
||||
exec(...args: any[]): void;
|
||||
discard(args: any[], callback?: ResCallbackT<any>): void;
|
||||
discard(...args: any[]): void;
|
||||
sync(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sync(...args: any[]): void;
|
||||
flushdb(args: any[], callback?: ResCallbackT<any>): void;
|
||||
flushdb(...args: any[]): void;
|
||||
flushall(args: any[], callback?: ResCallbackT<any>): void;
|
||||
flushall(...args: any[]): void;
|
||||
sort(args: any[], callback?: ResCallbackT<any>): void;
|
||||
sort(...args: any[]): void;
|
||||
info(args: any[], callback?: ResCallbackT<any>): void;
|
||||
info(...args: any[]): void;
|
||||
monitor(args: any[], callback?: ResCallbackT<any>): void;
|
||||
monitor(...args: any[]): void;
|
||||
ttl(args: any[], callback?: ResCallbackT<any>): void;
|
||||
ttl(...args: any[]): void;
|
||||
persist(args: any[], callback?: ResCallbackT<any>): void;
|
||||
persist(...args: any[]): void;
|
||||
slaveof(args: any[], callback?: ResCallbackT<any>): void;
|
||||
slaveof(...args: any[]): void;
|
||||
debug(args: any[], callback?: ResCallbackT<any>): void;
|
||||
debug(...args: any[]): void;
|
||||
config(args: any[], callback?: ResCallbackT<any>): void;
|
||||
config(...args: any[]): void;
|
||||
subscribe(args: any[], callback?: ResCallbackT<any>): void;
|
||||
subscribe(...args: any[]): void;
|
||||
unsubscribe(args: any[], callback?: ResCallbackT<any>): void;
|
||||
unsubscribe(...args: any[]): void;
|
||||
psubscribe(args: any[], callback?: ResCallbackT<any>): void;
|
||||
psubscribe(...args: any[]): void;
|
||||
punsubscribe(args: any[], callback?: ResCallbackT<any>): void;
|
||||
punsubscribe(...args: any[]): void;
|
||||
publish(args: any[], callback?: ResCallbackT<any>): void;
|
||||
publish(...args: any[]): void;
|
||||
watch(args: any[], callback?: ResCallbackT<any>): void;
|
||||
watch(...args: any[]): void;
|
||||
unwatch(args: any[], callback?: ResCallbackT<any>): void;
|
||||
unwatch(...args: any[]): void;
|
||||
cluster(args: any[], callback?: ResCallbackT<any>): void;
|
||||
cluster(...args: any[]): void;
|
||||
restore(args: any[], callback?: ResCallbackT<any>): void;
|
||||
restore(...args: any[]): void;
|
||||
migrate(args: any[], callback?: ResCallbackT<any>): void;
|
||||
migrate(...args: any[]): void;
|
||||
dump(args: any[], callback?: ResCallbackT<any>): void;
|
||||
dump(...args: any[]): void;
|
||||
object(args: any[], callback?: ResCallbackT<any>): void;
|
||||
object(...args: any[]): void;
|
||||
client(args: any[], callback?: ResCallbackT<any>): void;
|
||||
client(...args: any[]): void;
|
||||
eval(args: any[], callback?: ResCallbackT<any>): void;
|
||||
eval(...args: any[]): void;
|
||||
evalsha(args: any[], callback?: ResCallbackT<any>): void;
|
||||
evalsha(...args: any[]): void;
|
||||
quit(args: any[], callback?: ResCallbackT<any>): void;
|
||||
quit(...args: any[]): void;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ var options: request.Options = {
|
||||
|
||||
},
|
||||
jar: value,
|
||||
form: value,
|
||||
form: obj,
|
||||
oauth: value,
|
||||
aws: aws,
|
||||
qs: obj,
|
||||
|
||||
Vendored
+1
-1
@@ -61,7 +61,7 @@ declare module 'request' {
|
||||
uri?: string;
|
||||
callback?: (error: any, response: any, body: any) => void;
|
||||
jar?: any; // CookieJar
|
||||
form?: FormData;
|
||||
form?: any; // Object or string
|
||||
oauth?: OAuthOptions;
|
||||
aws?: AWSOptions;
|
||||
hawk ?: HawkOptions;
|
||||
|
||||
Vendored
+46
@@ -49,6 +49,8 @@ declare module Rx {
|
||||
|
||||
export module helpers {
|
||||
function noop(): void;
|
||||
function notDefined(value: any): boolean;
|
||||
function isScheduler(value: any): boolean;
|
||||
function identity<T>(value: T): T;
|
||||
function defaultNow(): number;
|
||||
function defaultComparer(left: any, right: any): boolean;
|
||||
@@ -394,6 +396,50 @@ declare module Rx {
|
||||
defer<T>(observableFactory: () => Observable<T>): Observable<T>;
|
||||
defer<T>(observableFactory: () => IPromise<T>): Observable<T>;
|
||||
empty<T>(scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param mapFn Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T, TResult>(array: T[], mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable<TResult>;
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param [mapFn] Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T>(array: T[], mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array-like object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param mapFn Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T, TResult>(array: { length: number;[index: number]: T; }, mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable<TResult>;
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array-like object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param [mapFn] Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T>(array: { length: number;[index: number]: T; }, mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array-like or iterable object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param [mapFn] Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T>(iterable: any, mapFn?: (value: any, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
fromArray<T>(array: T[], scheduler?: IScheduler): Observable<T>;
|
||||
fromArray<T>(array: { length: number;[index: number]: T; }, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
|
||||
Vendored
+28
-28
@@ -16,46 +16,46 @@ declare module Rx {
|
||||
|
||||
fromCallback: {
|
||||
// with single result callback without selector
|
||||
<TResult>(func: (callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
<TResult>(func: (callback: (result: TResult) => any) => any, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: (result: TResult) => any) => any, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: (result: TResult) => any) => any, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (result: TResult) => any) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
// with any callback with selector
|
||||
<TCallbackResult, TResult>(func: (callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): () => Observable<TResult>;
|
||||
<T1, TCallbackResult, TResult>(func: (arg1: T1, callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
<TCallbackResult, TResult>(func: (callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): () => Observable<TResult>;
|
||||
<T1, TCallbackResult, TResult>(func: (arg1: T1, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
// with any callback without selector
|
||||
<TResult>(func: (callback: Function) => any, scheduler?: IScheduler, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
<TResult>(func: (callback: Function) => any, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: Function) => any, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
// with any function with selector
|
||||
<TCallbackResult, TResult>(func: Function, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (...args: any[]) => Observable<TResult>;
|
||||
<TCallbackResult, TResult>(func: Function, context: any, selector: (args: TCallbackResult[]) => TResult): (...args: any[]) => Observable<TResult>;
|
||||
// with any function without selector
|
||||
<TResult>(func: Function, scheduler?: IScheduler, context?: any): (...args: any[]) => Observable<TResult>;
|
||||
<TResult>(func: Function, context?: any): (...args: any[]) => Observable<TResult>;
|
||||
};
|
||||
|
||||
fromNodeCallback: {
|
||||
// with single result callback without selector
|
||||
<T>(func: (callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): () => Observable<T>;
|
||||
<T1, T>(func: (arg1: T1, callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<T>;
|
||||
<T1, T2, T>(func: (arg1: T1, arg2: T2, callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<T>;
|
||||
<T1, T2, T3, T>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<T>;
|
||||
<T>(func: (callback: (err: any, result: T) => any) => any, context?: any): () => Observable<T>;
|
||||
<T1, T>(func: (arg1: T1, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1) => Observable<T>;
|
||||
<T1, T2, T>(func: (arg1: T1, arg2: T2, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1, arg2: T2) => Observable<T>;
|
||||
<T1, T2, T3, T>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<T>;
|
||||
// with any callback with selector
|
||||
<TC, TR>(func: (callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): () => Observable<TR>;
|
||||
<T1, TC, TR>(func: (arg1: T1, callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TC, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TC, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
<TC, TR>(func: (callback: Function) => any, context: any, selector: (results: TC[]) => TR): () => Observable<TR>;
|
||||
<T1, TC, TR>(func: (arg1: T1, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TC, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TC, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
// with any callback without selector
|
||||
<TR>(func: (callback: Function) => any, scheduler?: IScheduler, context?: any): () => Observable<TR>;
|
||||
<T1, TR>(func: (arg1: T1, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
<TR>(func: (callback: Function) => any, context?: any): () => Observable<TR>;
|
||||
<T1, TR>(func: (arg1: T1, callback: Function) => any, context?: any): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, context?: any): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
// with any function with selector
|
||||
<TC, T>(func: Function, scheduler: IScheduler, context: any, selector: (results: TC[]) => T): (...args: any[]) => Observable<T>;
|
||||
<TC, T>(func: Function, context: any, selector: (results: TC[]) => T): (...args: any[]) => Observable<T>;
|
||||
// with any function without selector
|
||||
<T>(func: Function, scheduler?: IScheduler, context?: any): (...args: any[]) => Observable<T>;
|
||||
<T>(func: Function, context?: any): (...args: any[]) => Observable<T>;
|
||||
};
|
||||
|
||||
fromEvent<T>(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
|
||||
|
||||
+13
-17
@@ -10,8 +10,8 @@ module Rx.Tests.Async {
|
||||
var sch: Rx.IScheduler;
|
||||
|
||||
function start() {
|
||||
obsNum = Rx.Observable.start(()=> 10, sch, obsStr);
|
||||
obsNum = Rx.Observable.start(()=> 10, sch);
|
||||
obsNum = Rx.Observable.start(()=> 10, obsStr, sch);
|
||||
obsNum = Rx.Observable.start(() => 10, obsStr);
|
||||
obsNum = Rx.Observable.start(()=> 10);
|
||||
}
|
||||
|
||||
@@ -27,38 +27,34 @@ module Rx.Tests.Async {
|
||||
// 0 arguments
|
||||
var func0: (cb: (result: number)=> void)=> void;
|
||||
obsNum = Rx.Observable.fromCallback(func0)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, sch)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, sch, obsStr)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, sch, obsStr, (results: number[]) => results[0])();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr, (results: number[]) => results[0])();
|
||||
|
||||
// 1 argument
|
||||
var func1: (a: string, cb: (result: number)=> void)=> number;
|
||||
obsNum = Rx.Observable.fromCallback(func1)("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, sch)("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, sch, {})("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, sch, {}, (results: number[]) => results[0])("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {})("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {}, (results: number[]) => results[0])("");
|
||||
|
||||
// 2 arguments
|
||||
var func2: (a: number, b: string, cb: (result: string) => number) => Date;
|
||||
obsStr = Rx.Observable.fromCallback(func2)(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, sch)(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, sch, {})(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, sch, {}, (results: string[]) => results[0])(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {})(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {}, (results: string[]) => results[0])(1, "");
|
||||
|
||||
// 3 arguments
|
||||
var func3: (a: number, b: string, c: boolean, cb: (result: string) => number) => Date;
|
||||
obsStr = Rx.Observable.fromCallback(func3)(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, sch)(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, sch, {})(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, sch, {}, (results: string[]) => results[0])(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {})(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {}, (results: string[]) => results[0])(1, "", true);
|
||||
|
||||
// multiple results
|
||||
var func0m: (cb: (result1: number, result2: number, result3: number) => void) => void;
|
||||
obsNum = Rx.Observable.fromCallback(func0m, sch, obsStr, (results: number[]) => results[0])();
|
||||
obsNum = Rx.Observable.fromCallback(func0m, obsStr, (results: number[]) => results[0])();
|
||||
var func1m: (a: string, cb: (result1: number, result2: number, result3: number) => void) => void;
|
||||
obsNum = Rx.Observable.fromCallback(func1m, sch, obsStr, (results: number[]) => results[0])("");
|
||||
obsNum = Rx.Observable.fromCallback(func1m, obsStr, (results: number[]) => results[0])("");
|
||||
var func2m: (a: string, b: number, cb: (result1: string, result2: string, result3: string) => void) => void;
|
||||
obsStr = Rx.Observable.fromCallback(func2m, sch, obsStr, (results: string[]) => results[0])("", 10);
|
||||
obsStr = Rx.Observable.fromCallback(func2m, obsStr, (results: string[]) => results[0])("", 10);
|
||||
}
|
||||
|
||||
function toPromise() {
|
||||
|
||||
Vendored
+26
-26
@@ -8,33 +8,33 @@
|
||||
|
||||
declare module Rx {
|
||||
interface ObservableStatic {
|
||||
start<T>(func: () => T, scheduler?: IScheduler, context?: any): Observable<T>;
|
||||
start<T>(func: () => T, context?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
toAsync<TResult>(func: () => TResult, scheduler?: IScheduler, context?: any): () => Observable<TResult>;
|
||||
toAsync<T1, TResult>(func: (arg1: T1) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
toAsync<T1, TResult>(func: (arg1?: T1) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1) => Observable<TResult>;
|
||||
toAsync<T1, TResult>(func: (...args: T1[]) => TResult, scheduler?: IScheduler, context?: any): (...args: T1[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2: T2) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2?: T2) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2?: T2) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1?: T1, arg2?: T2) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1, arg2?: T2) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1: T1, ...args: T2[]) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, ...args: T2[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1?: T1, ...args: T2[]) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1, ...args: T2[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3?: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2?: T2, arg3?: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1, arg2?: T2, arg3?: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, ...args: T3[]) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, ...args: T3[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2?: T2, ...args: T3[]) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2?: T2, ...args: T3[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1?: T1, arg2?: T2, ...args: T3[]) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1, arg2?: T2, ...args: T3[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4?: T4) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3, arg4?: T4) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3, arg4?: T4) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2?: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3, arg4?: T4) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1, arg2?: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, ...args: T4[]) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3, ...args: T4[]) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => TResult, scheduler?: IScheduler, context?: any): (arg1: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => TResult, scheduler?: IScheduler, context?: any): (arg1?: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<TResult>(func: () => TResult, context?: any, scheduler?: IScheduler): () => Observable<TResult>;
|
||||
toAsync<T1, TResult>(func: (arg1: T1) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1) => Observable<TResult>;
|
||||
toAsync<T1, TResult>(func: (arg1?: T1) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1) => Observable<TResult>;
|
||||
toAsync<T1, TResult>(func: (...args: T1[]) => TResult, context?: any, scheduler?: IScheduler): (...args: T1[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1: T1, arg2?: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1?: T1, arg2?: T2) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1: T1, ...args: T2[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, ...args: T2[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, TResult>(func: (arg1?: T1, ...args: T2[]) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, ...args: T2[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3?: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, arg3?: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, arg3?: T3) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, ...args: T3[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, ...args: T3[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1: T1, arg2?: T2, ...args: T3[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, ...args: T3[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, TResult>(func: (arg1?: T1, arg2?: T2, ...args: T3[]) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, ...args: T3[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3, arg4?: T4) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, arg3?: T3, arg4?: T4) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2: T2, arg3?: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
|
||||
toAsync<T1, T2, T3, T4, TResult>(func: (arg1?: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => TResult, context?: any, scheduler?: IScheduler): (arg1?: T1, arg2?: T2, arg3?: T3, ...args: T4[]) => Observable<TResult>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -49,8 +49,8 @@ declare module Rx {
|
||||
interface ObservableStatic {
|
||||
interval(period: number, scheduler?: IScheduler): Observable<number>;
|
||||
interval(dutTime: number, period: number, scheduler?: IScheduler): Observable<number>;
|
||||
timer(dueTime: number, period: number, scheduler: IScheduler): Observable<number>;
|
||||
timer(dueTime: number, scheduler: IScheduler): Observable<number>;
|
||||
timer(dueTime: number, period: number, scheduler?: IScheduler): Observable<number>;
|
||||
timer(dueTime: number, scheduler?: IScheduler): Observable<number>;
|
||||
generateWithRelativeTime<TState, TResult>(
|
||||
initialState: TState,
|
||||
condition: (state: TState) => boolean,
|
||||
|
||||
Vendored
+2
-2
@@ -17,8 +17,8 @@ declare module Rx {
|
||||
}
|
||||
|
||||
interface ObservableStatic {
|
||||
timer(dueTime: Date, period: number, scheduler: IScheduler): Observable<number>;
|
||||
timer(dueTime: Date, scheduler: IScheduler): Observable<number>;
|
||||
timer(dueTime: Date, period: number, scheduler?: IScheduler): Observable<number>;
|
||||
timer(dueTime: Date, scheduler?: IScheduler): Observable<number>;
|
||||
|
||||
generateWithAbsoluteTime<TState, TResult>(
|
||||
initialState: TState,
|
||||
|
||||
+73
-1
@@ -3150,4 +3150,76 @@ declare module webdriver {
|
||||
|
||||
declare module 'selenium-webdriver' {
|
||||
export = webdriver;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'selenium-webdriver/testing' {
|
||||
|
||||
/**
|
||||
* Registers a new test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
function describe(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Defines a suppressed test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
function xdescribe(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call after the current suite finishes.
|
||||
* @param fn
|
||||
*/
|
||||
function after(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call after each test in a suite.
|
||||
* @param fn
|
||||
*/
|
||||
function afterEach(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call before the current suite starts.
|
||||
* @param fn
|
||||
*/
|
||||
function before(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call before each test in a suite.
|
||||
* @param fn
|
||||
*/
|
||||
function beforeEach(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Add a test to the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
function it(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* An alias for {@link #it()} that flags the test as the only one that should
|
||||
* be run within the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
function iit(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Adds a test to the current suite while suppressing it so it is not run.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
function xit(name: string, fn: Function): void;
|
||||
}
|
||||
|
||||
declare module 'selenium-webdriver/executors' {
|
||||
/**
|
||||
* Creates a command executor that uses WebDriver's JSON wire protocol.
|
||||
* @param url The server's URL, or a promise that will resolve to that URL.
|
||||
* @returns {!webdriver.CommandExecutor} The new command executor.
|
||||
*/
|
||||
function createExecutor(url: any): webdriver.CommandExecutor;
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
/**
|
||||
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
|
||||
*
|
||||
* Created by using code samples from https://github.com/sendgrid/sendgrid-nodejs#usage
|
||||
*/
|
||||
|
||||
///<reference path="../node/node.d.ts" />
|
||||
///<reference path="sendgrid.d.ts" />
|
||||
|
||||
import sg = require("sendgrid");
|
||||
var sendgrid = sg("api_user", "api_key");
|
||||
|
||||
/*
|
||||
* Simple Usage
|
||||
*/
|
||||
var payload = {
|
||||
to: 'to@example.com',
|
||||
from: 'from@other.com',
|
||||
subject: 'Saying Hi',
|
||||
text: 'This is my first email through SendGrid'
|
||||
};
|
||||
sendgrid.send(payload, function (err, json) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
console.log(json);
|
||||
});
|
||||
|
||||
/**
|
||||
* Email:
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#email
|
||||
*/
|
||||
var email = new sendgrid.Email({
|
||||
to: 'foo@bar.com',
|
||||
from: 'you@yourself.com',
|
||||
subject: 'Subject goes here',
|
||||
text: 'Hello world'
|
||||
});
|
||||
|
||||
sendgrid.send(email, function (err, json) {
|
||||
if (err) {
|
||||
return console.error(err);
|
||||
}
|
||||
console.log(json);
|
||||
});
|
||||
|
||||
/**
|
||||
* Setting Params
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setting-params
|
||||
*/
|
||||
var email = new sendgrid.Email({ to: 'person@email.com' });
|
||||
email.to = "different@email.com";
|
||||
email.replyto = "reply-here@email.com";
|
||||
email.subject = "This is a subject";
|
||||
|
||||
/**
|
||||
* addTo
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addto
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.addTo('foo@bar.com');
|
||||
email.addTo('another@another.com');
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
|
||||
/**
|
||||
* setFrom
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setfrom
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setFrom('foo@bar.com');
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
/**
|
||||
* setSubject
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setsubject
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setSubject('Some subject');
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
/**
|
||||
* setText
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#settext
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setText('Some text');
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
/**
|
||||
* setHtml
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#sethtml
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setHtml('<h1>Some html</h1>');
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
/**
|
||||
* addHeader
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addheader
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setHeaders({ full: 'hearts' }); // headers = {full: 'hearts'}
|
||||
email.addHeader('spin', 'attack'); // headers = {full: 'hearts', spin: 'attack'}
|
||||
email.addHeader('mask', 'salesman'); // headers = {full: 'hearts', spin: 'attack', mask: 'salesman'}
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
/**
|
||||
* setHeaders
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setheaders
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setHeaders({ full: 'hearts' }); // headers = {full: 'hearts'}
|
||||
email.setHeaders({ mask: 'salesman' }); // headers = {mask: 'salesman'}
|
||||
sendgrid.send(email, function (err, json) { });
|
||||
|
||||
/**
|
||||
* addSubstitution
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addsubstitution
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.addSubstitution('keep', 'secret'); // sub = {keep: ['secret']}
|
||||
email.addSubstitution('other', ['one', 'two']); // sub = {keep: ['secret'], other: ['one', 'two']}
|
||||
|
||||
/**
|
||||
* setSubstitutions
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setsubstitutions
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setSubstitutions({ keep: ['secret'], other: ['one', 'two'] }); // sub = {keep: ['secret'], other: ['one', 'two']});
|
||||
|
||||
/**
|
||||
* addSection
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addsection
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.addSection({ '-charge-': 'This ship is useless.' }); // section = {'-charge-': 'This ship is useless.'}
|
||||
|
||||
/**
|
||||
* setSections
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setsections
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setSections({ '-charge-': 'This ship is useless.' }); // section = {'-charge-': 'This ship is useless.'}
|
||||
|
||||
/**
|
||||
* addUniqueArg
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#adduniquearg
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setUniqueArgs({ cow: 'chicken' }); // unique_args = {cow: 'chicken'}
|
||||
email.addUniqueArg({ cat: 'dog' }); // unique_args = {cow: 'chicken', cat: 'dog'}
|
||||
|
||||
/**
|
||||
* setUniqueArgs
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setuniqueargs
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setUniqueArgs({ cow: 'chicken' }); // unique_args = {cow: 'chicken'}
|
||||
email.setUniqueArgs({ dad: 'proud' }); // unique_args = {dad: 'proud'}
|
||||
|
||||
|
||||
/**
|
||||
* addCategory
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addcategory
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.addCategory('tactics'); // category = ['tactics']
|
||||
email.addCategory('advanced'); // category = ['tactics', 'advanced']
|
||||
|
||||
/**
|
||||
* setCategories
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setcategories
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.setCategories(['tactics']); // category = ['tactics']
|
||||
email.setCategories(['snowball-fight']); // category = ['snowball-fight']
|
||||
|
||||
/**
|
||||
* addFilter
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addfilter
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.addFilter('footer', 'enable', 1);
|
||||
email.addFilter('footer', 'text/html', '<strong>boo</strong>');
|
||||
|
||||
/**
|
||||
* setFilters
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#setfilters
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
var email = new sendgrid.Email();
|
||||
email.setFilters({
|
||||
'footer': {
|
||||
'setting': {
|
||||
'enable': 1,
|
||||
'text/plain': 'You can haz footers!'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* addFile
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#addfile
|
||||
*/
|
||||
var email = new sendgrid.Email();
|
||||
email.addFile({
|
||||
filename: 'secret.txt',
|
||||
content: new Buffer('You will never know....')
|
||||
});
|
||||
// or
|
||||
email.addFile({
|
||||
filename: 'icon.jpg',
|
||||
url: 'http://i.imgur.com/2fDh8.jpg'
|
||||
});
|
||||
// or
|
||||
email.addFile({
|
||||
path: '../files/resume.txt'
|
||||
});
|
||||
// or
|
||||
email.addFile({
|
||||
cid: 'the_logo', // should match cid value in html
|
||||
path: '../files/logo.png'
|
||||
});
|
||||
email.setHtml('<div>Our logo:<img src="cid:the_logo"></div>');
|
||||
|
||||
/**
|
||||
* Options - Changing URL
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#changing-url
|
||||
*/
|
||||
var sendgrid1 = sg('username', 'password', { "protocol": "http", "host": "sendgrid.org", "endpoint": "/send", "port": "80" });
|
||||
var sendgrid2 = sg('username', 'password', { "uri": "http://sendgrid.org:80/send" });
|
||||
|
||||
/**
|
||||
* Options - Request
|
||||
* https://github.com/sendgrid/sendgrid-nodejs#request
|
||||
*/
|
||||
var sendgrid3 = sg('username', 'password', { proxy: "http://localproxy:3128" });
|
||||
// or
|
||||
import https = require('https');
|
||||
var agent = new https.Agent();
|
||||
agent.maxSockets = 500; // Set Max Sockets to 500
|
||||
var sendgrid4 = sg('username', 'password', { web: { pool: agent } });
|
||||
|
||||
|
||||
Vendored
+169
@@ -0,0 +1,169 @@
|
||||
// Type definitions for sendgrid 1.1.0
|
||||
// Project: https://github.com/sendgrid/sendgrid-nodejs
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Sendgrid {
|
||||
//#region Options
|
||||
|
||||
export interface UriParts {
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: string;
|
||||
endpoint: string;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
protocol?: string;
|
||||
host?: string;
|
||||
port?: string;
|
||||
endpoint?: string;
|
||||
uri?: string;
|
||||
proxy?: string;
|
||||
web?: {
|
||||
pool?: any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface OptionsExport {
|
||||
uriParts: UriParts;
|
||||
uri: string;
|
||||
|
||||
proxy?: string;
|
||||
web?: {
|
||||
pool?: any;
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Email
|
||||
|
||||
export interface EmailOptions {
|
||||
to?: any;
|
||||
toname?: string;
|
||||
from?: string;
|
||||
fromname?: string;
|
||||
subject?: string;
|
||||
text?: string;
|
||||
html?: string;
|
||||
bcc?: any;
|
||||
replyto?: string;
|
||||
date?: Date;
|
||||
headers?: { [key: string]: string };
|
||||
files?: FileHandlerOptions[];
|
||||
smtpapi?: any;
|
||||
}
|
||||
|
||||
export class Email {
|
||||
to: any;
|
||||
toname: string;
|
||||
from: string;
|
||||
fromname: string;
|
||||
subject: string;
|
||||
text: string;
|
||||
html: string;
|
||||
bcc: any;
|
||||
replyto: string;
|
||||
date: Date;
|
||||
headers: { [key: string]: string };
|
||||
files: FileHandler[];
|
||||
smtpapi: any;
|
||||
|
||||
constructor();
|
||||
constructor(options: EmailOptions);
|
||||
|
||||
addTo(address: string): void;
|
||||
addHeader(type: string, value: string): void;
|
||||
addSubstitution(type: string, value: string): void;
|
||||
addSubstitution(type: string, value: string[]): void;
|
||||
addSection(section: { [key: string]: string }): void;
|
||||
addUniqueArg(uarg: { [key: string]: string }): void;
|
||||
addCategory(category: string): void;
|
||||
addFilter(filter: string, command: string, value: number): void;
|
||||
addFilter(filter: string, command: string, value: string): void;
|
||||
addFile(file: FileHandlerOptions): void;
|
||||
|
||||
setFrom(address: string): void;
|
||||
setSubject(subject: string): void;
|
||||
setText(text: string): void;
|
||||
setHtml(html: string): void;
|
||||
setHeaders(headers: { [key: string]: string }): void;
|
||||
setSubstitutions(substitutions: { [key: string]: string[] }): void;
|
||||
setSections(sections: { [key: string]: string }): void;
|
||||
setUniqueArgs(uargs: { [key: string]: string }): void;
|
||||
setCategories(categories: string[]): void;
|
||||
setFilters(filters: any): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region FileHandler
|
||||
|
||||
export interface FileHandlerOptions {
|
||||
filename?: string;
|
||||
contentType?: string;
|
||||
cid?: string;
|
||||
path?: string;
|
||||
url?: string;
|
||||
content?: any;
|
||||
}
|
||||
|
||||
export class FileHandler {
|
||||
filename: string;
|
||||
contentType: string;
|
||||
cid: string;
|
||||
|
||||
type: string;
|
||||
content: string;
|
||||
path: string;
|
||||
url: string;
|
||||
|
||||
constructor(options: FileHandlerOptions);
|
||||
|
||||
loadContent(callback: HandlerCallback): void;
|
||||
|
||||
static handlers: {
|
||||
content: Handler;
|
||||
path: Handler;
|
||||
url: Handler;
|
||||
none: Handler;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Handler {
|
||||
(file: FileHandler, callback: HandlerCallback): void;
|
||||
}
|
||||
|
||||
export interface HandlerCallback {
|
||||
(hasError: boolean, error: Error): void;
|
||||
(hasError: boolean, error: string): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Sendgrid Class
|
||||
|
||||
interface Constructor {
|
||||
(api_user: string, api_key: string, options?: Options): Instance;
|
||||
new (api_user: string, api_key: string, options?: Options): Instance;
|
||||
}
|
||||
|
||||
export interface Instance {
|
||||
version: string;
|
||||
api_user: string;
|
||||
api_key: string;
|
||||
options: OptionsExport;
|
||||
Email: typeof Email;
|
||||
|
||||
send(email: EmailOptions, callback: (err: Error, json: any) => any): void;
|
||||
send(email: Email, callback: (err: Error, json: any) => any): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
declare module "sendgrid" {
|
||||
var ctor: Sendgrid.Constructor;
|
||||
export = ctor;
|
||||
}
|
||||
@@ -3,12 +3,17 @@
|
||||
|
||||
declare var expect: chai.ExpectStatic;
|
||||
|
||||
import chai = require('chai');
|
||||
import sinonChai = require('sinon-chai');
|
||||
|
||||
chai.use(sinonChai);
|
||||
|
||||
function test() {
|
||||
var spy: Function;
|
||||
var anotherSpy: Function;
|
||||
var context;
|
||||
var match;
|
||||
|
||||
var context: any;
|
||||
var match: any;
|
||||
|
||||
expect(spy).to.have.been.called;
|
||||
expect(spy).to.have.been.calledOnce;
|
||||
expect(spy).to.have.been.calledTwice;
|
||||
|
||||
Vendored
+5
@@ -26,3 +26,8 @@ declare module chai {
|
||||
always: Expect;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "sinon-chai" {
|
||||
function exports(_chai: typeof chai, utils: any): void;
|
||||
export = exports;
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
/// <reference path="stampit.d.ts" />
|
||||
|
||||
var a = stampit().enclose(() => {
|
||||
var a = 'a';
|
||||
this.getA = () => {
|
||||
return a;
|
||||
};
|
||||
});
|
||||
a(); // Object -- so far so good.
|
||||
a().getA(); // "a"
|
||||
|
||||
|
||||
var b = stampit().enclose(function () {
|
||||
var a = 'b';
|
||||
this.getB = function () {
|
||||
return a;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
var c = stampit.compose(a, b);
|
||||
var foo = c(); // we won't throw this one away...
|
||||
foo.getA(); // "a"
|
||||
foo.getB(); // "b"
|
||||
|
||||
|
||||
// Some more privileged methods, with some private data.
|
||||
// Use stampit.mixIn() to make this feel declarative:
|
||||
var availability = stampit().enclose(function () {
|
||||
var isOpen = false; // private
|
||||
|
||||
return stampit.mixIn(this, {
|
||||
open: function open() {
|
||||
isOpen = true;
|
||||
return this;
|
||||
},
|
||||
close: function close() {
|
||||
isOpen = false;
|
||||
return this;
|
||||
},
|
||||
isOpen: function isOpenMethod() {
|
||||
return isOpen;
|
||||
}
|
||||
});
|
||||
});
|
||||
// Hre's a mixin with public methods, and some state:
|
||||
var membership = stampit({
|
||||
members: {},
|
||||
add: function (member: any) {
|
||||
this.members[member.name] = member;
|
||||
return this;
|
||||
},
|
||||
getMember: function (name: any) {
|
||||
return this.members[name];
|
||||
}
|
||||
},
|
||||
{
|
||||
members: {}
|
||||
});
|
||||
// Let's set some defaults:
|
||||
var defaults = stampit().state({
|
||||
name: 'The Saloon',
|
||||
specials: 'Whisky, Gin, Tequila'
|
||||
});
|
||||
|
||||
// Classical inheritance has nothing on this. No parent/child coupling. No deep inheritance hierarchies.
|
||||
// Just good, clean code reusability.
|
||||
var bar = stampit.compose(defaults, availability, membership);
|
||||
// Note that you can override state on instantiation:
|
||||
var myBar = bar({name: 'Moe\'s'});
|
||||
// Silly, but proves that everything is as it should be.
|
||||
myBar.add({name: 'Homer' }).open().getMember('Homer');
|
||||
|
||||
|
||||
|
||||
var myStamp = stampit().methods({
|
||||
foo: function () {
|
||||
return 'foo';
|
||||
},
|
||||
methodOverride: function () {
|
||||
return false;
|
||||
}
|
||||
}).methods({
|
||||
bar: function () {
|
||||
return 'bar'
|
||||
},
|
||||
methodOverride: function () {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
myStamp.state({
|
||||
foo: {bar: 'bar'},
|
||||
stateOverride: false
|
||||
}).state({
|
||||
bar: 'bar',
|
||||
stateOverride: true
|
||||
});
|
||||
|
||||
myStamp.enclose(function () {
|
||||
var secret = 'foo';
|
||||
|
||||
this.getSecret = function () {
|
||||
return secret;
|
||||
};
|
||||
}).enclose(function () {
|
||||
this.a = true;
|
||||
}).enclose({
|
||||
bar: function bar() {
|
||||
this.b = true;
|
||||
}
|
||||
}, {
|
||||
baz: function baz() {
|
||||
this.c = true;
|
||||
}
|
||||
});
|
||||
|
||||
var obj = myStamp.create();
|
||||
obj.getSecret && obj.a && obj.b && obj.c; // true
|
||||
|
||||
var newStamp = stampit(null, { defaultNum: 1 }).compose(myStamp);
|
||||
|
||||
|
||||
|
||||
var obj1 = stampit().methods({
|
||||
a: function () { return 'a'; }
|
||||
}, {
|
||||
b: function () { return 'b'; }
|
||||
}).create();
|
||||
|
||||
var obj2 = stampit().state({
|
||||
a: 'a'
|
||||
}, {
|
||||
b: 'b'
|
||||
}).create();
|
||||
|
||||
var obj = defaults.compose(newStamp, membership, availability).create();
|
||||
|
||||
|
||||
|
||||
// The old constructor / class thing...
|
||||
var Constructor = function Constructor() {
|
||||
this.thing = 'initialized';
|
||||
};
|
||||
Constructor.prototype.foo = function foo() { return 'foo'; };
|
||||
|
||||
// The conversion
|
||||
var oldskool = stampit.convertConstructor(Constructor);
|
||||
|
||||
// A new stamp to compose with...
|
||||
var newskool = stampit().methods({
|
||||
bar: function bar() { return 'bar'; }
|
||||
// your methods here...
|
||||
}).enclose(function () {
|
||||
this.baz = 'baz';
|
||||
});
|
||||
|
||||
// Now you can compose those old constructors just like you could
|
||||
// with any other stamp...
|
||||
var myThing = stampit.compose(oldskool, newskool);
|
||||
|
||||
var t = myThing();
|
||||
|
||||
t.thing; // 'initialized',
|
||||
|
||||
t.foo(); // 'foo',
|
||||
|
||||
t.bar(); // 'bar'
|
||||
Vendored
+155
@@ -0,0 +1,155 @@
|
||||
// Type definitions for stampit
|
||||
// Project: https://github.com/ericelliott/stampit
|
||||
// Definitions by: Vasyl Boroviak <https://github.com/koresar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var stampit: stampit.Stampit;
|
||||
|
||||
declare module stampit {
|
||||
interface Stampit {
|
||||
/**
|
||||
* Return a factory (akaStamp) function that will produce new objects using the
|
||||
* prototypes that are passed in or composed.
|
||||
* @param methods A map of method names and bodies for delegation.
|
||||
* @param state A map of property names and values to clone for each new object.
|
||||
* @param enclose A closure (function) used to create private data and privileged methods.
|
||||
* */
|
||||
(methods?:{}, state?:{}, enclose?:{(...encloseArgs:any[]): void}[]):stampit.Stamp;
|
||||
|
||||
/**
|
||||
* Take two or more Stamps and combine them to produce a new Stamp.
|
||||
* Combining overrides properties with last-in priority.
|
||||
* @param stamps Stamps produced by stampit.
|
||||
* @return A new Stamp made of all the given.
|
||||
*/
|
||||
compose(...stamps:Stamp[]): Stamp;
|
||||
|
||||
/**
|
||||
* Take a destination object followed by one or more source objects,
|
||||
* and copy the source object properties to the destination object,
|
||||
* with last in priority overrides.
|
||||
* @param destination An object to copy properties to.
|
||||
* @param source Objects to copy properties from.
|
||||
* @return The destination object.
|
||||
*/
|
||||
mixIn(destination:any, ...source:any[]): any;
|
||||
|
||||
/**
|
||||
* Alias for mixIn.
|
||||
* Take a destination object followed by one or more source objects,
|
||||
* and copy the source object properties to the destination object,
|
||||
* with last in priority overrides.
|
||||
* @param destination An object to copy properties to.
|
||||
* @param source Objects to copy properties from.
|
||||
* @return The destination object.
|
||||
*/
|
||||
extend(destination:any, ...source:any[]): any;
|
||||
|
||||
/**
|
||||
* Check if an object is a Stamp.
|
||||
* @param obj An object to check.
|
||||
* @return true if the object is a Stamp; otherwise - false.
|
||||
*/
|
||||
isStamp(obj:any): boolean;
|
||||
|
||||
/**
|
||||
* Take an old-fashioned JS constructor and return a Stamp
|
||||
* that you can freely compose with other Stamps.
|
||||
* @param Constructor Old-fashioned constructor function.
|
||||
* @return A new Stamp based on the given constructor.
|
||||
*/
|
||||
convertConstructor(Constructor:any): Stamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory function that will produce new objects using the
|
||||
* prototypes that are passed in or composed.
|
||||
*/
|
||||
export interface Stamp {
|
||||
/**
|
||||
* Just like calling stamp() invokes the stamp and returns a new object instance.
|
||||
* @param state Properties you wish to set on the new objects.
|
||||
* @param encloseArgs The remaining arguments are passed to all .enclose() functions.
|
||||
* WARNING Avoid using two different .enclose() functions that expect different arguments.
|
||||
* .enclose() functions that take arguments should not be considered safe to compose
|
||||
* with other .enclose() functions that also take arguments. Taking arguments with
|
||||
* an .enclose() function is an anti-pattern that should be avoided, when possible.
|
||||
* @return A new object composed of the Stamps and prototypes provided.
|
||||
*/
|
||||
(state?:{}, ...encloseArgs:any[]): any;
|
||||
|
||||
/**
|
||||
* Just like calling stamp(), stamp.create() invokes the stamp and returns a new instance.
|
||||
* @param state Properties you wish to set on the new objects.
|
||||
* @param encloseArgs The remaining arguments are passed to all .enclose() functions.
|
||||
* WARNING Avoid using two different .enclose() functions that expect different arguments.
|
||||
* .enclose() functions that take arguments should not be considered safe to compose
|
||||
* with other .enclose() functions that also take arguments. Taking arguments with
|
||||
* an .enclose() function is an anti-pattern that should be avoided, when possible.
|
||||
* @return A new object composed of the Stamps and prototypes provided.
|
||||
*/
|
||||
create(state?:{}, ...encloseArgs:any[]): any;
|
||||
|
||||
/**
|
||||
* An object map containing the fixed prototypes.
|
||||
*/
|
||||
fixed: Fixed;
|
||||
|
||||
/**
|
||||
* Add methods to the methods prototype. Chainable.
|
||||
* @param methods Object(s) containing map of method names and bodies for delegation.
|
||||
* @return Self.
|
||||
*/
|
||||
methods(...methods:{}[]): Stamp;
|
||||
|
||||
/**
|
||||
* Take n objects and add them to the state prototype. Changes `this` object. Chainable.
|
||||
* @param states Object(s) containing map of property names and values to clone for each new object.
|
||||
* @return Self.
|
||||
*/
|
||||
state(...states:{}[]): Stamp;
|
||||
|
||||
/**
|
||||
* Take n functions, an array of functions, or n objects and add the functions to the enclose prototype.
|
||||
* Functions passed into .enclose() are called any time an object is instantiated.
|
||||
* That happens when the stamp function is invoked, or when the .create() method is called.
|
||||
* Changes `this` object. Chainable.
|
||||
* @param functions Closures (functions) used to create private data and privileged methods.
|
||||
* @return Self.
|
||||
*/
|
||||
enclose(...functions:{(...encloseArgs:any[]): void}[]): Stamp;
|
||||
|
||||
/**
|
||||
* Take n functions, an array of functions, or n objects and add the functions to the enclose prototype.
|
||||
* Functions passed into .enclose() are called any time an object is instantiated.
|
||||
* That happens when the stamp function is invoked, or when the .create() method is called.
|
||||
* Changes `this` object. Chainable.
|
||||
* @param methods Function properties of these objects will be treated as closure functions.
|
||||
* @return Self.
|
||||
*/
|
||||
enclose(...methods:{}[]): Stamp;
|
||||
|
||||
/**
|
||||
* Take one or more Stamps and
|
||||
* combine them with `this` to produce and return a new Stamp.
|
||||
* Combining overrides properties with last-in priority.
|
||||
* NOT chainable.
|
||||
* @param stamps Stampit factories, aka Stamps.
|
||||
* @return A new Stamp composed from arguments and `this`.
|
||||
*/
|
||||
compose(...stamps:Stamp[]): Stamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object map containing the fixed prototypes.
|
||||
*/
|
||||
interface Fixed {
|
||||
methods: {};
|
||||
state: {};
|
||||
enclose: {(...encloseArgs:any[]): void}[];
|
||||
}
|
||||
}
|
||||
|
||||
declare module "stampit" {
|
||||
export = stampit;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
|
||||
*
|
||||
* Created by using code samples from https://github.com/LearnBoost/stylus/blob/master/docs/js.md.
|
||||
*/
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="stylus.d.ts" />
|
||||
|
||||
import stylus = require("stylus");
|
||||
|
||||
var str = "This is a stylus test";
|
||||
|
||||
/**
|
||||
* Basic Usage
|
||||
*/
|
||||
stylus.render(str, { filename: 'nesting.css' }, function(err, css){
|
||||
if (err) throw err;
|
||||
console.log(css);
|
||||
});
|
||||
|
||||
stylus(str)
|
||||
.set('filename', 'nesting.css')
|
||||
.render(function (err, css) {
|
||||
// logic
|
||||
});
|
||||
|
||||
/**
|
||||
* .set(setting, value)
|
||||
* https://github.com/LearnBoost/stylus/blob/master/docs/js.md#setsetting-value
|
||||
*/
|
||||
stylus(str)
|
||||
.set('filename', __dirname + '/test.styl')
|
||||
.set('paths', [__dirname, __dirname + '/mixins'])
|
||||
.render(function (err, css) {
|
||||
// logic
|
||||
});
|
||||
|
||||
/**
|
||||
* .include(path)
|
||||
* https://github.com/LearnBoost/stylus/blob/master/docs/js.md#includepath
|
||||
*/
|
||||
stylus(str)
|
||||
.include(require('nib').path)
|
||||
.include(process.env.HOME + '/mixins')
|
||||
.render(function (err, css) {
|
||||
// logic
|
||||
});
|
||||
|
||||
/**
|
||||
* .import(path)
|
||||
* https://github.com/LearnBoost/stylus/blob/master/docs/js.md#importpath
|
||||
*/
|
||||
stylus(str)
|
||||
.set('filename', __dirname + '/test.styl')
|
||||
.import('mixins/vendor')
|
||||
.render(function (err, css) {
|
||||
if (err) throw err;
|
||||
console.log(css);
|
||||
});
|
||||
|
||||
/**
|
||||
* .define(name, node|fn)
|
||||
* https://github.com/LearnBoost/stylus/blob/master/docs/js.md#definename-node
|
||||
*/
|
||||
stylus(str)
|
||||
.define('has-canvas', stylus.nodes.false)
|
||||
.define('some-setting', new stylus.nodes.String('some value'))
|
||||
|
||||
.define('string', 'some string')
|
||||
.define('number', 15.5)
|
||||
.define('some-bool', true)
|
||||
.define('list', [1, 2, 3])
|
||||
.define('list', [1, 2, [3, 4, [5, 6]]])
|
||||
.define('list', { foo: 'bar', bar: 'baz' })
|
||||
.define('families', ['Helvetica Neue', 'Helvetica', 'sans-serif'])
|
||||
|
||||
.define('get-list', function () {
|
||||
return ['foo', 'bar', 'baz'];
|
||||
})
|
||||
|
||||
.render(function (err, css) {
|
||||
if (err) throw err;
|
||||
console.log(css);
|
||||
});
|
||||
|
||||
/**
|
||||
* .use(fn)
|
||||
* https://github.com/LearnBoost/stylus/blob/master/docs/js.md#usefn
|
||||
*/
|
||||
var mylib = function (style: Stylus.Renderer) {
|
||||
style.define('number', 15.5);
|
||||
style.define('get-list', function () {
|
||||
return ['foo', 'bar', 'baz'];
|
||||
});
|
||||
};
|
||||
|
||||
stylus(str)
|
||||
.use(mylib)
|
||||
.render(function (err, css) {
|
||||
if (err) throw err;
|
||||
console.log(css);
|
||||
});
|
||||
Vendored
+1439
File diff suppressed because it is too large.
Load diff
+51
-14
@@ -2,24 +2,61 @@
|
||||
|
||||
import swig = require('swig');
|
||||
|
||||
var swigObj: swig.Swig;
|
||||
var value: any;
|
||||
var str: string;
|
||||
var num: number;
|
||||
var bool: boolean;
|
||||
|
||||
var opts: swig.Options = {
|
||||
allowErrors: bool,
|
||||
autoescape: bool,
|
||||
cache: bool,
|
||||
encoding: str,
|
||||
filters: value,
|
||||
root: str,
|
||||
tags: value,
|
||||
extensions: value,
|
||||
tzOffset: num
|
||||
function replaceMs(input:string): string {
|
||||
return input.replace(/m/g, 'f');
|
||||
}
|
||||
|
||||
var opts: swig.SwigOptions = {
|
||||
autoescape: bool,
|
||||
cache: value,
|
||||
cmtControls: ["", ""],
|
||||
loader: swig.loaders.fs(),
|
||||
locals: { testVal: "my test" },
|
||||
tagControls: ["", ""],
|
||||
varControls: ["", ""]
|
||||
};
|
||||
|
||||
swig.init(opts);
|
||||
value = swig.compileFile(str);
|
||||
value = swig.compile(str);
|
||||
value = swig.compile(str, opts);
|
||||
swig.setDefaults(opts);
|
||||
swig.setDefaultTZOffset(num);
|
||||
swigObj = new swig.Swig(opts);
|
||||
str = swig.compileFile(str)();
|
||||
swig.compileFile(str, {}, function (err: Error, render: (locals: any) => string) {
|
||||
str = render({});
|
||||
});
|
||||
str = swig.compile(str)();
|
||||
str = swig.compile(str, opts)();
|
||||
swig.invalidateCache();
|
||||
swig.setFilter("replaceMs", replaceMs);
|
||||
swig.setTag('tacos', function (): boolean { return true; }, function (): string { return 'Tacos' }, true, true);
|
||||
swig.setExtension("test", function (v: string) { return 'test: ' + v });
|
||||
value = swig.precompile(str, opts);
|
||||
str = swig.render(str, opts);
|
||||
str = swig.renderFile(str, {});
|
||||
swig.renderFile(str, {}, function (err: Error, output: string) {
|
||||
|
||||
});
|
||||
console.log(swig.version);
|
||||
|
||||
|
||||
str = swigObj.compileFile(str)();
|
||||
swigObj.compileFile(str, opts, function (err: Error, render: (locals: any) => string) {
|
||||
str = render({});
|
||||
});
|
||||
str = swigObj.compile(str)();
|
||||
str = swigObj.compile(str, opts)();
|
||||
swigObj.invalidateCache();
|
||||
swigObj.setFilter("replaceMs", replaceMs);
|
||||
swigObj.setTag('tacos', function (): boolean { return true; }, function (): string { return 'Tacos' }, true, true);
|
||||
swigObj.setExtension("test", function (v: string) { return 'test: ' + v });
|
||||
value = swigObj.precompile(str, opts);
|
||||
str = swigObj.render(str, opts);
|
||||
str = swigObj.renderFile(str, {});
|
||||
swigObj.renderFile(str, {}, function (err: Error, output: string) {
|
||||
|
||||
});
|
||||
Vendored
+150
-19
@@ -1,27 +1,158 @@
|
||||
// Type definitions for swig
|
||||
// Project: http://github.com/paularmstrong/swig
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Definitions by: Peter Harris <https://github.com/CodeAnimal>, Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Imported from: https://github.com/soywiz/typescript-node-definitions/swig.d.ts
|
||||
|
||||
// API Documentation : http://paularmstrong.github.io/swig/docs/api/
|
||||
|
||||
declare module "swig" {
|
||||
export function init(options: Options): void;
|
||||
export function compileFile(filepath: string): any;
|
||||
export function compile(source: string, options?: Options): any;
|
||||
export function renderFile(pathName: string, locals?: any, cb?: (err: any, output: string) => void): string;
|
||||
export class Swig {
|
||||
constructor(options?: SwigOptions);
|
||||
|
||||
export interface Options {
|
||||
allowErrors?: boolean;
|
||||
autoescape?: boolean;
|
||||
cache?: boolean;
|
||||
encoding?: string;
|
||||
filters?: any;
|
||||
root?: string;
|
||||
tags?: any;
|
||||
extensions?: any;
|
||||
tzOffset?: number;
|
||||
}
|
||||
}
|
||||
setFilter(
|
||||
name: string,
|
||||
method: (input: any, ...args: any[]) => string
|
||||
): void;
|
||||
setTag(
|
||||
name: string,
|
||||
parse: (str?: string, line?: string, parser?: Object, types?: lexer.TYPES, stack?: any, opts?: Object, swig?: Swig) => boolean,
|
||||
compile: (compiler?: (content?: string, parents?: any, options?: any, blockName?: string) => string, args?: any[], content?: string, parents?: any, options?: any, blockName?: string) => string,
|
||||
ends?: boolean,
|
||||
blockLevel?: boolean
|
||||
): void;
|
||||
setExtension(name: string, object: any): void;
|
||||
parseFile(pathName: string, options?: any): parser.ParseReturn;
|
||||
precompile(source: string, options?: SwigOptions): any;
|
||||
compile(source: string, options?: SwigOptions): (locals?: any) => string;
|
||||
compileFile(pathname: string, options: SwigOptions, cb: (err: Error, compiledRender: (locals?: any) => string) => void): void;
|
||||
compileFile(pathname: string, options?: SwigOptions): (locals?: any) => string;
|
||||
render(source: string, options?: SwigOptions): string;
|
||||
renderFile(pathName: string, locals: any, cb: (err: Error, output: string) => void): void;
|
||||
renderFile(pathName: string, locals?: any): string
|
||||
run(templateFn: Function, locals?: any, filePath?: string): string;
|
||||
invalidateCache(): void;
|
||||
|
||||
loaders: typeof loaders;
|
||||
}
|
||||
|
||||
export module lexer {
|
||||
export enum TYPES {
|
||||
/** Whitespace */
|
||||
WHITESPACE = 0,
|
||||
/** Plain string */
|
||||
STRING = 1,
|
||||
/** Variable filter */
|
||||
FILTER = 2,
|
||||
/** Empty variable filter */
|
||||
FILTEREMPTY = 3,
|
||||
/** Function */
|
||||
FUNCTION = 4,
|
||||
/** Function with no arguments */
|
||||
FUNCTIONEMPTY = 5,
|
||||
/** Open parenthesis */
|
||||
PARENOPEN = 6,
|
||||
/** Close parenthesis */
|
||||
PARENCLOSE = 7,
|
||||
/** Comma */
|
||||
COMMA = 8,
|
||||
/** Variable */
|
||||
VAR = 9,
|
||||
/** Number */
|
||||
NUMBER = 10,
|
||||
/** Math operator */
|
||||
OPERATOR = 11,
|
||||
/** Open square bracket */
|
||||
BRACKETOPEN = 12,
|
||||
/** Close square bracket */
|
||||
BRACKETCLOSE = 13,
|
||||
/** Key on an object using dot-notation */
|
||||
DOTKEY = 14,
|
||||
/** Start of an array */
|
||||
ARRAYOPEN = 15,
|
||||
/** End of an array
|
||||
* Currently unused
|
||||
ARRAYCLOSE = 16, */
|
||||
/** Open curly brace */
|
||||
CURLYOPEN = 17,
|
||||
/** Close curly brace */
|
||||
CURLYCLOSE = 18,
|
||||
/** Colon (:) */
|
||||
COLON = 19,
|
||||
/** JavaScript-valid comparator */
|
||||
COMPARATOR = 20,
|
||||
/** Boolean logic */
|
||||
LOGIC = 21,
|
||||
/** Boolean logic "not" */
|
||||
NOT = 22,
|
||||
/** true or false */
|
||||
BOOL = 23,
|
||||
/** Variable assignment */
|
||||
ASSIGNMENT = 24,
|
||||
/** Start of a method */
|
||||
METHODOPEN = 25,
|
||||
/** End of a method
|
||||
* Currently unused
|
||||
METHODEND = 26, */
|
||||
/** Unknown type */
|
||||
UNKNOWN = 100
|
||||
}
|
||||
|
||||
export function read(str: string): string[];
|
||||
}
|
||||
|
||||
export module parser {
|
||||
interface ParseReturn {
|
||||
name: string;
|
||||
parent: any;
|
||||
tokens: any[];
|
||||
blocks: any;
|
||||
}
|
||||
}
|
||||
|
||||
export interface SwigOptions {
|
||||
autoescape?: boolean;
|
||||
cache?: any;
|
||||
cmtControls?: string[];
|
||||
loader?: TemplateLoader;
|
||||
locals?: any;
|
||||
tagControls?: string[];
|
||||
varControls?: string[];
|
||||
}
|
||||
|
||||
export interface TemplateLoader {
|
||||
resolve(to: string, from: string): string;
|
||||
load(identifier: string, callback?: (err: Error, data: any) => void): void;
|
||||
load(identifier:string): any;
|
||||
}
|
||||
|
||||
export module loaders {
|
||||
export function fs(basepath?: string, encoding?: string): TemplateLoader;
|
||||
export function memory(mapping: any, basepath?: string): TemplateLoader;
|
||||
}
|
||||
|
||||
export var version: string;
|
||||
export function setDefaults(options: SwigOptions): void;
|
||||
export function setDefaultTZOffset(offset: number): void;
|
||||
export function setFilter(
|
||||
name: string,
|
||||
method: (input: any, ...args: any[]) => string
|
||||
): void;
|
||||
export function setTag(
|
||||
name: string,
|
||||
parse: (str?: string, line?: string, parser?: Object, types?: lexer.TYPES, stack?: any, opts?: Object, swig?: Swig) => boolean,
|
||||
compile: (compiler?: (content?: string, parents?: any, options?: any, blockName?: string) => string, args?: any[], content?: string, parents?: any, options?: any, blockName?: string) => string,
|
||||
ends?: boolean,
|
||||
blockLevel?: boolean
|
||||
): void;
|
||||
export function setExtension(name: string, object: any): void;
|
||||
export function parseFile(pathName: string, options?: any): parser.ParseReturn;
|
||||
export function precompile(source: string, options?: SwigOptions): any;
|
||||
export function compile(source: string, options?: SwigOptions): (locals?: any) => string;
|
||||
export function compileFile(pathname: string, options: SwigOptions, cb: (err: Error, compiledRender: (locals?: any) => string) => void): void;
|
||||
export function compileFile(pathname: string, options?: SwigOptions): (locals?: any) => string;
|
||||
export function render(source: string, options?: SwigOptions): string;
|
||||
export function renderFile(pathName: string, locals: any, cb: (err: Error, output: string) => void): void;
|
||||
export function renderFile(pathName: string, locals?: any): string
|
||||
export function run(templateFn: Function, locals?: any, filePath?: string): string;
|
||||
export function invalidateCache(): void;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
|
||||
*
|
||||
* Created by using code samples from https://github.com/npm/node-tar.
|
||||
*/
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="tar.d.ts" />
|
||||
|
||||
import tar = require("tar");
|
||||
import fs = require("fs");
|
||||
|
||||
/**
|
||||
* Quick Extract
|
||||
*/
|
||||
fs.createReadStream("path/to/file.tar").pipe(tar.Extract("path/to/extract"));
|
||||
|
||||
/**
|
||||
* Use with events
|
||||
*/
|
||||
var readStream = fs.createReadStream("/path/to/file.tar");
|
||||
var extract = tar.Extract("/path/to/target");
|
||||
|
||||
readStream.pipe(extract);
|
||||
|
||||
extract.on("entry", (entry: any) => {
|
||||
|
||||
});
|
||||
Vendored
+209
@@ -0,0 +1,209 @@
|
||||
// Type definitions for tar v1.0.1
|
||||
// Project: https://github.com/npm/node-tar
|
||||
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "tar" {
|
||||
import stream = require("stream");
|
||||
|
||||
//#region Interfaces
|
||||
|
||||
export interface HeaderProperties {
|
||||
path?: string;
|
||||
mode?: number;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
size?: number;
|
||||
mtime?: number;
|
||||
uname?: string;
|
||||
gname?: string;
|
||||
devmaj?: number;
|
||||
devmin?: number;
|
||||
}
|
||||
|
||||
export interface ExtractOptions {
|
||||
type?: string;
|
||||
Directory?: boolean;
|
||||
path?: string;
|
||||
strip?: number;
|
||||
}
|
||||
|
||||
export interface ParseStream extends NodeJS.ReadWriteStream {
|
||||
position: number;
|
||||
|
||||
_stream: stream.Stream;
|
||||
_ended: boolean;
|
||||
|
||||
_streamEnd(): void;
|
||||
_process(c: Buffer): void;
|
||||
_startEntry(c: Buffer): void;
|
||||
}
|
||||
|
||||
export interface PackStream extends NodeJS.ReadWriteStream {
|
||||
writable: boolean;
|
||||
readable: boolean;
|
||||
|
||||
_noProprietary: boolean;
|
||||
_global: HeaderProperties;
|
||||
_buffer: stream.Stream[];
|
||||
_currentEntry: any;
|
||||
_processing: boolean;
|
||||
_pipeRoot: stream.Stream;
|
||||
_needDrain: boolean;
|
||||
_paused: boolean;
|
||||
|
||||
addGlobal(props: HeaderProperties): void;
|
||||
add(stream: stream.Stream): boolean;
|
||||
destroy(): void;
|
||||
|
||||
_process(): void;
|
||||
}
|
||||
|
||||
export interface ExtractStream extends ParseStream {
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Enums
|
||||
|
||||
export var fields: {
|
||||
path: number;
|
||||
mode: number;
|
||||
uid: number;
|
||||
gid: number;
|
||||
size: number;
|
||||
mtime: number;
|
||||
cksum: number;
|
||||
type: number;
|
||||
linkpath: number;
|
||||
ustar: number;
|
||||
ustarvar: number;
|
||||
uname: number;
|
||||
gname: number;
|
||||
devmaj: number;
|
||||
devmin: number;
|
||||
prefix: number;
|
||||
fill: number;
|
||||
};
|
||||
|
||||
export var fieldSize: number[];
|
||||
export var fieldOffs: number[];
|
||||
export var fieldEnds: number[];
|
||||
|
||||
/**
|
||||
* Different values of the 'type' field
|
||||
* paths match the values of Stats.isX() functions, where appropriate
|
||||
*/
|
||||
export var types: {
|
||||
0: string;
|
||||
"\0": string;
|
||||
"": string;
|
||||
1: string;
|
||||
2: string;
|
||||
3: string;
|
||||
4: string;
|
||||
5: string;
|
||||
6: string;
|
||||
7: string;
|
||||
g: string;
|
||||
x: string;
|
||||
A: string;
|
||||
D: string;
|
||||
I: string;
|
||||
K: string;
|
||||
L: string;
|
||||
M: string;
|
||||
N: string;
|
||||
S: string;
|
||||
V: string;
|
||||
X: string;
|
||||
File: string;
|
||||
OldFile: string;
|
||||
Link: string;
|
||||
SymbolicLick: string;
|
||||
CharacterDevice: string;
|
||||
BlockDevice: string;
|
||||
Directory: string;
|
||||
FIFO: string;
|
||||
ContiguousFile: string;
|
||||
GlobalExtendedHeader: string;
|
||||
ExtendedHeader: string;
|
||||
SolarisACL: string;
|
||||
GNUDumpDir: string;
|
||||
INode: string;
|
||||
NextFileHasLonLinkPath: string;
|
||||
NextFileHasLongPath: string;
|
||||
ContinuationFile: string;
|
||||
TapeVolumeHeader: string;
|
||||
OldExtendedHeader: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Values for the mode field
|
||||
*/
|
||||
export var modes: {
|
||||
suid: number;
|
||||
sgid: number;
|
||||
svtx: number;
|
||||
uread: number;
|
||||
uwrite: number;
|
||||
uexec: number;
|
||||
gread: number;
|
||||
gwrite: number;
|
||||
gexec: number;
|
||||
oread: number;
|
||||
owrite: number;
|
||||
oexec: number;
|
||||
};
|
||||
|
||||
export var numeric: {
|
||||
mode: boolean;
|
||||
uid: boolean;
|
||||
gid: boolean;
|
||||
size: boolean;
|
||||
mtime: boolean;
|
||||
devmaj: boolean;
|
||||
devmin: boolean;
|
||||
cksum: boolean;
|
||||
atime: boolean;
|
||||
ctime: boolean;
|
||||
dev: boolean;
|
||||
ino: boolean;
|
||||
nlink: boolean;
|
||||
};
|
||||
|
||||
export var knownExtended: {
|
||||
atime: boolean;
|
||||
charset: boolean;
|
||||
comment: boolean;
|
||||
ctime: boolean;
|
||||
gid: boolean;
|
||||
gname: boolean;
|
||||
linkpat: boolean;
|
||||
mtime: boolean;
|
||||
path: boolean;
|
||||
realtime: boolean;
|
||||
security: boolean;
|
||||
size: boolean;
|
||||
uid: boolean;
|
||||
uname: boolean;
|
||||
};
|
||||
|
||||
export var headerSize: number;
|
||||
export var blockSize: number;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Global Methods
|
||||
|
||||
export function Parse(): ParseStream;
|
||||
|
||||
export function Pack(props: HeaderProperties): PackStream;
|
||||
|
||||
export function Extract(path: string): ExtractStream;
|
||||
export function Extract(opts: ExtractOptions): ExtractStream;
|
||||
|
||||
//#endregion
|
||||
}
|
||||
Vendored
+3
-3
@@ -2378,7 +2378,7 @@ declare module THREE {
|
||||
|
||||
set(min: Vector2, max: Vector2): Box2;
|
||||
setFromPoints(points: Vector2[]): Box2;
|
||||
setFromCenterAndSize(center: Vector2, size: number): Box2;
|
||||
setFromCenterAndSize(center: Vector2, size: Vector2): Box2;
|
||||
copy(box: Box2): Box2;
|
||||
makeEmpty(): Box2;
|
||||
empty(): boolean;
|
||||
@@ -2408,7 +2408,7 @@ declare module THREE {
|
||||
|
||||
set(min: Vector3, max: Vector3): Box3;
|
||||
setFromPoints(points: Vector3[]): Box3;
|
||||
setFromCenterAndSize(center: Vector3, size: number): Box3;
|
||||
setFromCenterAndSize(center: Vector3, size: Vector3): Box3;
|
||||
setFromObject(object: Object3D): Box3;
|
||||
copy(box: Box3): Box3;
|
||||
makeEmpty(): Box3;
|
||||
@@ -5604,7 +5604,7 @@ declare module THREE {
|
||||
cone: Mesh;
|
||||
|
||||
setDirection(dir: Vector3): void;
|
||||
setLength(length: number): void;
|
||||
setLength(length: number, headLength?: number, headWidth?: number): void;
|
||||
setColor(hex: number): void;
|
||||
}
|
||||
|
||||
|
||||
+230
-15
@@ -4,7 +4,6 @@
|
||||
//
|
||||
// Examples from http://twitter.github.com/typeahead.js/examples
|
||||
//
|
||||
declare var Hogan: string;
|
||||
|
||||
var substringMatcher = function (strs: any) {
|
||||
return function findMatches(q: any, cb: any) {
|
||||
@@ -24,11 +23,11 @@ var substringMatcher = function (strs: any) {
|
||||
// JavaScript object, refer to typeahead docs for more info
|
||||
matches.push({ value: str });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
cb(matches);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
|
||||
'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
|
||||
@@ -41,18 +40,234 @@ var states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
|
||||
'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
|
||||
];
|
||||
|
||||
$('#the-basics .typeahead').typeahead({
|
||||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
},
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
source: substringMatcher(states)
|
||||
});
|
||||
|
||||
module valueTest {
|
||||
function test_method_names() {
|
||||
$('#the-basics .typeahead').typeahead('destroy');
|
||||
$('#the-basics .typeahead').typeahead('open');
|
||||
$('#the-basics .typeahead').typeahead('close');
|
||||
$('#the-basics .typeahead').typeahead('val');
|
||||
$('#the-basics .typeahead').typeahead('val', 'test value');
|
||||
}
|
||||
|
||||
|
||||
function test_options() {
|
||||
|
||||
var dataSets: Twitter.Typeahead.Dataset[] = [];
|
||||
|
||||
function with_empty_options() {
|
||||
$('#the-basics .typeahead').typeahead({}, dataSets);
|
||||
}
|
||||
|
||||
function with_hint_option() {
|
||||
$('#the-basics .typeahead').typeahead({ hint: true }, dataSets);
|
||||
}
|
||||
|
||||
function with_highlight_option() {
|
||||
$('#the-basics .typeahead').typeahead({ highlight: true }, dataSets);
|
||||
}
|
||||
|
||||
function with_minLength_option() {
|
||||
$('#the-basics .typeahead').typeahead({ minLength: 1 }, dataSets);
|
||||
}
|
||||
|
||||
function with_all_options() {
|
||||
$('#the-basics .typeahead').typeahead({
|
||||
hint: true,
|
||||
highlight: true,
|
||||
minLength: 1
|
||||
},
|
||||
dataSets
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function test_datasets_array() {
|
||||
|
||||
var options: Twitter.Typeahead.Options = {};
|
||||
|
||||
function with_only_source() {
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
source: substringMatcher(states)
|
||||
}]);
|
||||
}
|
||||
|
||||
function with_name_option() {
|
||||
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
name: 'states',
|
||||
source: substringMatcher(states),
|
||||
}]);
|
||||
}
|
||||
|
||||
function with_displayKey_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
displayKey: 'value',
|
||||
source: substringMatcher(states)
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
function with_templates_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
function with_all_options() {
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
function with_multiple_datasets() {
|
||||
$('#the-basics .typeahead').typeahead(options, [
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
},
|
||||
{
|
||||
name: 'states alternative',
|
||||
displayKey: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function test_datasets_objects() {
|
||||
|
||||
var options: Twitter.Typeahead.Options = {};
|
||||
|
||||
function with_only_source() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states)
|
||||
});
|
||||
}
|
||||
|
||||
function with_name_option() {
|
||||
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
name: 'states',
|
||||
source: substringMatcher(states),
|
||||
});
|
||||
}
|
||||
|
||||
function with_displayKey_option() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
displayKey: 'value',
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function with_templates_option() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function with_all_options() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function with_multiple_objects() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
},
|
||||
{
|
||||
name: 'states alternative',
|
||||
displayKey: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function test_dataset_templates() {
|
||||
|
||||
var options: Twitter.Typeahead.Options = {};
|
||||
|
||||
function with_no_options() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: {}
|
||||
});
|
||||
}
|
||||
|
||||
function with_empty_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: { empty: 'no results' }
|
||||
});
|
||||
}
|
||||
|
||||
function with_footer_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: { footer: 'custom footer' }
|
||||
});
|
||||
}
|
||||
|
||||
function with_header_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: { header: 'custom header' }
|
||||
});
|
||||
}
|
||||
|
||||
function with_suggestion_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: {
|
||||
suggestion: function(context) {
|
||||
return context.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function with_all_options() {
|
||||
$('#the-basics .typeahead').typeahead(options, {
|
||||
source: substringMatcher(states),
|
||||
templates: {
|
||||
empty: 'no results',
|
||||
footer: 'custom footer',
|
||||
header: 'custom header',
|
||||
suggestion: function(context) {
|
||||
return context.name;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function test_value() {
|
||||
var value: string = $('foo').typeahead('val');
|
||||
$('foo').typeahead('val', value);
|
||||
}
|
||||
Vendored
+53
-52
@@ -8,7 +8,7 @@
|
||||
interface JQuery {
|
||||
|
||||
/**
|
||||
* Destroys previously initialized typeaheads. This entails reverting
|
||||
* Destroys previously initialized typeaheads. This entails reverting
|
||||
* DOM modifications and removing event handlers.
|
||||
*
|
||||
* @constructor
|
||||
@@ -17,7 +17,7 @@ interface JQuery {
|
||||
typeahead(methodName: 'destroy'): JQuery;
|
||||
|
||||
/**
|
||||
* Opens the dropdown menu of typeahead. Note that being open does not mean that the menu is visible.
|
||||
* Opens the dropdown menu of typeahead. Note that being open does not mean that the menu is visible.
|
||||
* The menu is only visible when it is open and has content.
|
||||
*
|
||||
* @constructor
|
||||
@@ -68,7 +68,7 @@ interface JQuery {
|
||||
* @param query The query to be set in case method 'val' is used.
|
||||
*/
|
||||
typeahead(methodName: string, query: string): JQuery;
|
||||
|
||||
|
||||
/**
|
||||
* Accomodates specifying options such as hint and highlight.
|
||||
* This is in correspondence to the examples mentioned in http://twitter.github.io/typeahead.js/examples/
|
||||
@@ -92,38 +92,38 @@ interface JQuery {
|
||||
|
||||
declare module Twitter.Typeahead {
|
||||
/**
|
||||
* A dataset is an object that defines a set of data that hydrates
|
||||
* A dataset is an object that defines a set of data that hydrates
|
||||
* suggestions. Typeaheads can be backed by multiple datasets.
|
||||
* Given a query, a typeahead instance will inspect its backing
|
||||
* Given a query, a typeahead instance will inspect its backing
|
||||
* datasets and display relevant suggestions to the end-user.
|
||||
*/
|
||||
interface Dataset {
|
||||
/**
|
||||
* The backing data source for suggestions.
|
||||
* Expected to be a function with the signature (query, cb).
|
||||
* It is expected that the function will compute the suggestion set (i.e. an array of JavaScript objects) for query and then invoke cb with said set.
|
||||
* cb can be invoked synchronously or asynchronously.
|
||||
*
|
||||
* The backing data source for suggestions.
|
||||
* Expected to be a function with the signature (query, cb).
|
||||
* It is expected that the function will compute the suggestion set (i.e. an array of JavaScript objects) for query and then invoke cb with said set.
|
||||
* cb can be invoked synchronously or asynchronously.
|
||||
*
|
||||
*/
|
||||
source: (query: string, cb: (result: any) => void) => void;
|
||||
|
||||
/**
|
||||
* The name of the dataset.
|
||||
* This will be appended to tt-dataset- to form the class name of the containing DOM element.
|
||||
* Must only consist of underscores, dashes, letters (a-z), and numbers.
|
||||
/**
|
||||
* The name of the dataset.
|
||||
* This will be appended to tt-dataset- to form the class name of the containing DOM element.
|
||||
* Must only consist of underscores, dashes, letters (a-z), and numbers.
|
||||
* Defaults to a random number.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* For a given suggestion object, determines the string representation of it.
|
||||
* This will be used when setting the value of the input control after a suggestion is selected. Can be either a key string or a function that transforms a suggestion object into a string.
|
||||
* For a given suggestion object, determines the string representation of it.
|
||||
* This will be used when setting the value of the input control after a suggestion is selected. Can be either a key string or a function that transforms a suggestion object into a string.
|
||||
* Defaults to value.
|
||||
*/
|
||||
displayKey?: string;
|
||||
|
||||
/**
|
||||
* A hash of templates to be used when rendering the dataset.
|
||||
* A hash of templates to be used when rendering the dataset.
|
||||
* Note a precompiled template is a function that takes a JavaScript object as its first argument and returns a HTML string.
|
||||
*/
|
||||
templates?: Templates;
|
||||
@@ -133,45 +133,45 @@ declare module Twitter.Typeahead {
|
||||
interface Templates {
|
||||
|
||||
/**
|
||||
* Rendered when 0 suggestions are available for the given query.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* Rendered when 0 suggestions are available for the given query.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* If it's a precompiled template, the passed in context will contain query
|
||||
*/
|
||||
empty?: string;
|
||||
|
||||
/**
|
||||
* Rendered at the bottom of the dataset.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* If it's a precompiled template, the passed in context will contain query and isEmpty.
|
||||
*/
|
||||
footer?: string;
|
||||
|
||||
/**
|
||||
* Rendered at the top of the dataset.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* Rendered at the top of the dataset.
|
||||
* Can be either a HTML string or a precompiled template.
|
||||
* If it's a precompiled template, the passed in context will contain query and isEmpty.
|
||||
*/
|
||||
header?: string;
|
||||
|
||||
/**
|
||||
* Used to render a single suggestion.
|
||||
* If set, this has to be a precompiled template.
|
||||
* The associated suggestion object will serve as the context.
|
||||
* Used to render a single suggestion.
|
||||
* If set, this has to be a precompiled template.
|
||||
* The associated suggestion object will serve as the context.
|
||||
* Defaults to the value of displayKey wrapped in a p tag i.e. <p>{{value}}</p>.
|
||||
*/
|
||||
suggestion?: (datum: any) => string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* When initializing a typeahead, there are a number of options you can configure.
|
||||
*/
|
||||
interface Options {
|
||||
/**
|
||||
* highlight: If true, when suggestions are rendered,
|
||||
* highlight: If true, when suggestions are rendered,
|
||||
* pattern matches for the current query in text nodes will be wrapped in a strong element.
|
||||
* Defaults to false.
|
||||
* Defaults to false.
|
||||
*/
|
||||
highlight?: boolean;
|
||||
|
||||
@@ -186,6 +186,7 @@ declare module Twitter.Typeahead {
|
||||
minLength?: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare module Bloodhound
|
||||
{
|
||||
interface BloodhoundOptions<T>
|
||||
@@ -203,14 +204,14 @@ declare module Bloodhound
|
||||
* @constructor
|
||||
* @param query tokenizer query
|
||||
*/
|
||||
queryTokenizer?: any;
|
||||
queryTokenizer?: any;
|
||||
/**
|
||||
* The max number of suggestions to return from Bloodhound#get.
|
||||
* The max number of suggestions to return from Bloodhound#get.
|
||||
* If not reached, the data source will attempt to backfill the suggestions from remote. Defaults to 5
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* If set, this is expected to be a function with the signature (remoteMatch, localMatch) that returns true if the datums are duplicates or false otherwise.
|
||||
* If set, this is expected to be a function with the signature (remoteMatch, localMatch) that returns true if the datums are duplicates or false otherwise.
|
||||
* If not set, duplicate detection will not be performed.
|
||||
*/
|
||||
dupDetector?: (remoteMatch: T, localMatch: T) => boolean;
|
||||
@@ -233,8 +234,8 @@ declare module Bloodhound
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefetched data is fetched and processed on initialization.
|
||||
* If the browser supports localStorage, the processed data will be cached
|
||||
* Prefetched data is fetched and processed on initialization.
|
||||
* If the browser supports localStorage, the processed data will be cached
|
||||
* there to prevent additional network requests on subsequent page loads.
|
||||
*/
|
||||
interface PrefetchOptions<T>
|
||||
@@ -244,13 +245,13 @@ declare module Bloodhound
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The time (in milliseconds) the prefetched data should be cached
|
||||
* The time (in milliseconds) the prefetched data should be cached
|
||||
* in localStorage. Defaults to 86400000 (1 day).
|
||||
*/
|
||||
ttl?: number;
|
||||
/**
|
||||
* A function that transforms the response body into an array of datums.
|
||||
*
|
||||
*
|
||||
* @param parsedResponse Response body
|
||||
*/
|
||||
filter?: (parsedResponse: any) => T[];
|
||||
@@ -270,37 +271,37 @@ declare module Bloodhound
|
||||
|
||||
/**
|
||||
* Remote data is only used when the data provided by local and prefetch
|
||||
* is insufficient. In order to prevent an obscene number of requests
|
||||
* is insufficient. In order to prevent an obscene number of requests
|
||||
* being made to remote endpoint, typeahead.js rate-limits remote requests.
|
||||
*/
|
||||
interface RemoteOptions<T>
|
||||
{
|
||||
/**
|
||||
* A URL to make requests to when the data provided by local and
|
||||
* A URL to make requests to when the data provided by local and
|
||||
* prefetch is insufficient. Required.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The pattern in url that will be replaced with the user's query
|
||||
* The pattern in url that will be replaced with the user's query
|
||||
* when a request is made. Defaults to %QUERY.
|
||||
*/
|
||||
wildcard?: string;
|
||||
/**
|
||||
* Overrides the request URL. If set, no wildcard substitution will
|
||||
* Overrides the request URL. If set, no wildcard substitution will
|
||||
* be performed on url.
|
||||
*
|
||||
*
|
||||
* @param url Replacement URL
|
||||
* @param uriEncodedQuery Encoded query
|
||||
* @returns A valid URL
|
||||
*/
|
||||
replace?: (url: string, uriEncodedQuery: string) => string;
|
||||
/**
|
||||
* The function used for rate-limiting network requests.
|
||||
* The function used for rate-limiting network requests.
|
||||
* Can be either 'debounce' or 'throttle'. Defaults to 'debounce'.
|
||||
*/
|
||||
rateLimitby?: string;
|
||||
/**
|
||||
* The time interval in milliseconds that will be used by rateLimitFn.
|
||||
* The time interval in milliseconds that will be used by rateLimitFn.
|
||||
* Defaults to 300.
|
||||
*/
|
||||
rateLimitWait?: number;
|
||||
@@ -357,18 +358,18 @@ declare class Bloodhound<T> {
|
||||
*/
|
||||
public ttAdapter(): any;
|
||||
/**
|
||||
* Kicks off the initialization of the suggestion engine. This includes processing the data provided through local and fetching/processing the data provided through prefetch.
|
||||
* Until initialized, all other methods will behave as no-ops.
|
||||
* Kicks off the initialization of the suggestion engine. This includes processing the data provided through local and fetching/processing the data provided through prefetch.
|
||||
* Until initialized, all other methods will behave as no-ops.
|
||||
* Returns a jQuery promise which is resolved when engine has been initialized.
|
||||
*
|
||||
* After the initial call of initialize, how subsequent invocations of the method behave depends on the reinitialize argument.
|
||||
* If reinitialize is falsy, the method will not execute the initialization logic and will just return the same jQuery promise returned by the initial invocation.
|
||||
*
|
||||
* After the initial call of initialize, how subsequent invocations of the method behave depends on the reinitialize argument.
|
||||
* If reinitialize is falsy, the method will not execute the initialization logic and will just return the same jQuery promise returned by the initial invocation.
|
||||
* If reinitialize is truthy, the method will behave as if it were being called for the first time.
|
||||
*
|
||||
*
|
||||
* var promise1 = engine.initialize();
|
||||
* var promise2 = engine.initialize();
|
||||
* var promise3 = engine.initialize(true);
|
||||
*
|
||||
*
|
||||
* promise1 === promise2;
|
||||
* promise3 !== promise1 && promise3 !== promise2;
|
||||
*/
|
||||
@@ -388,7 +389,7 @@ declare class Bloodhound<T> {
|
||||
*/
|
||||
public clearPrefetchCache(): void;
|
||||
/**
|
||||
* If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience.
|
||||
* If you're using remote, Bloodhound will cache the 10 most recent responses in an effort to provide a better user experience.
|
||||
* clearRemoteCache offers a way to programmatically clear said cache.
|
||||
*/
|
||||
public clearRemoteCache(): void;
|
||||
@@ -398,8 +399,8 @@ declare class Bloodhound<T> {
|
||||
public noConflict(): any;
|
||||
|
||||
/**
|
||||
* Computes a set of suggestions for query. cb will be invoked with an array of datums that represent said set.
|
||||
* cb will always be invoked once synchronously with suggestions that were available on the client.
|
||||
* Computes a set of suggestions for query. cb will be invoked with an array of datums that represent said set.
|
||||
* cb will always be invoked once synchronously with suggestions that were available on the client.
|
||||
* If those suggestions are insufficient (# of suggestions is less than limit) and remote was configured, cb may also be invoked asynchronously with the suggestions available on the client mixed with suggestions from the remote source.
|
||||
*/
|
||||
public get(query: string, cb: (datums: T[]) => void): void;
|
||||
|
||||
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user