Merge branch 'master' of https://github.com/stephenlautier/DefinitelyTyped into localforage

Conflicts:
	angular-localForage/angular-localForage.d.ts
	localForage/localForage-tests.ts
	localForage/localForage.d.ts
This commit is contained in:
Stephen Lautier
2015-09-17 00:21:09 +02:00
53 changed files with 3582 additions and 704 deletions
@@ -0,0 +1,84 @@
/// <reference path="./amazon-product-api.d.ts" />
/// <reference path="../node/node.d.ts"/>
import amazon = require('amazon-product-api');
var client = amazon.createClient({
awsId: process.env.AWS_ACCESS_KEY_ID,
awsSecret: process.env.AWS_SECRET,
awsTag: process.env.AWS_ASSOCIATE_TAG
});
// Item Search
var searchQuery = {
director: 'Quentin Tarantino',
actor: 'Samuel L. Jackson',
searchIndex: 'DVD',
audienceRating: 'R',
responseGroup: 'ItemAttributes,Offers,Images'
};
client.itemSearch(searchQuery).then((results) => {
console.log(getResultCount(results) + " search results");
}).catch(function(err){
console.log(err);
});
client.itemSearch(searchQuery, (err, results) => {
if(err) {
console.log(err);
return;
}
console.log(getResultCount(results) + " search results");
});
// Item Lookup
var lookupQuery = {
itemId: 'B00008OE6I',
idType: 'ASIN',
responseGroup: 'OfferFull',
Condition: 'All'
};
client.itemLookup(lookupQuery).then((results) => {
console.log(getResultCount(results) + " lookup results");
}).catch(function(err){
console.log(err);
});
client.itemLookup(lookupQuery, (err, results) => {
if(err) {
console.log(err);
return;
}
console.log(getResultCount(results) + " lookup results");
});
// Browse Node Lookup
var nodeLookupQuery = {
browseNodeId: '2625373011'
};
client.browseNodeLookup(nodeLookupQuery).then((results) => {
console.log(getResultCount(results) + " node lookup results");
}).catch(function(err){
console.log(err);
});
client.browseNodeLookup(nodeLookupQuery, (err, results) => {
if(err) {
console.log(err);
return;
}
console.log(getResultCount(results) + " node lookup results");
});
function getResultCount(results: Object[]) {
return results != undefined ? results.length : 0;
}
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for amazon-product-api
// Project: https://github.com/t3chnoboy/amazon-product-api
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../es6-promise/es6-promise.d.ts"/>
declare module "amazon-product-api" {
interface ICredentials {
awsId: string,
awsSecret: string,
awsTag: string
}
interface IAmazonProductQueryCallback {
(err: string, results: Object[]): void;
}
interface IAmazonProductClient {
itemSearch(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
itemLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
browseNodeLookup(query: any, callback?: IAmazonProductQueryCallback) : Promise<Object[]>;
}
export function createClient(credentials:ICredentials) : IAmazonProductClient;
}
+265
View File
@@ -0,0 +1,265 @@
/// <reference path="amplify-deferred.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
// Copied examples directly from AmplifyJs site
// Subscribe and publish with no data
amplify.subscribe("nodataexample", function () {
alert("nodataexample topic published!");
});
// Subscribe and publish with data
amplify.publish("nodataexample");
amplify.subscribe("dataexample", function (data) {
alert(data.foo); // bar
});
amplify.publish("dataexample", { foo: "bar" });
amplify.subscribe("dataexample2", function (param1, param2) {
alert(param1 + param2); // barbaz
});
//...
amplify.publish("dataexample2", "bar", "baz");
// Subscribe and publish with context and data
amplify.subscribe("datacontextexample", $("p:first"), function (data) {
this.text(data.exampleText); // first p element would have "foo bar baz" as text
});
amplify.publish("datacontextexample", { exampleText: "foo bar baz" });
// Subscribe to a topic with high priority
amplify.subscribe("priorityexample", function (data) {
alert(data.foo);
});
amplify.subscribe("priorityexample", function (data) {
if (data.foo === "oops") {
return false;
}
}, 1);
// Store data with amplify storage picking the default storage technology:
amplify.publish("priorityexample", { foo: "bar" });
amplify.publish("priorityexample", { foo: "oops" });
amplify.store("storeExample1", { foo: "bar" });
amplify.store("storeExample2", "baz");
// retrieve the data later via the key
var myStoredValue = amplify.store("storeExample1"),
myStoredValue2 = amplify.store("storeExample2"),
myStoredValues = amplify.store();
myStoredValue.foo; // bar
myStoredValue2; // baz
myStoredValues.storeExample1.foo; // bar
myStoredValues.storeExample2; // baz
// Store data explicitly with session storage
amplify.store.sessionStorage("explicitExample", { foo2: "baz" });
// retrieve the data later via the key
var myStoredValue2 = amplify.store.sessionStorage("explicitExample");
myStoredValue2.foo2; // baz
// REQUEST
// Set up and use a request utilizing Ajax
amplify.request.define("ajaxExample1", "ajax", {
url: "/myApiUrl",
dataType: "json",
type: "GET"
});
// later in code
amplify.request("ajaxExample1", function (data) {
data.foo; // bar
});
// Set up and use a request utilizing Ajax and Caching
amplify.request.define("ajaxExample2", "ajax", {
url: "/myApiUrl",
dataType: "json",
type: "GET",
cache: "persist"
});
// later in code
amplify.request("ajaxExample2", function (data) {
data.foo; // bar
});
// a second call will result in pulling from the cache
amplify.request("ajaxExample2", function (data) {
data.baz; // qux
})
// Set up and use a RESTful request utilizing Ajax
amplify.request.define("ajaxRESTFulExample", "ajax", {
url: "/myRestFulApi/{type}/{id}",
type: "GET"
})
// later in code
amplify.request("ajaxRESTFulExample",
{
type: "foo",
id: "bar"
},
function (data) {
// /myRESTFulApi/foo/bar was the URL used
data.foo; // bar
}
);
// POST data with Ajax
amplify.request.define("ajaxPostExample", "ajax", {
url: "/myRestFulApi",
type: "POST"
})
// later in code
amplify.request("ajaxPostExample",
{
type: "foo",
id: "bar"
},
function (data) {
data.foo; // bar
}
);
// Using data maps
// When searching Twitter, the key for the search phrase is q.If we want a more descriptive name, such as term, we can use a data map:
amplify.request.define("twitter-search", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: {
term: "q"
}
});
amplify.request("twitter-search", { term: "amplifyjs" });
// Similarly, we can create a request that searches for mentions, by accepting a username:
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: function (data) {
return {
q: "@" + data.user
};
}
});
amplify.request("twitter-mentions", { user: "amplifyjs" });
// Setting up and using decoders
//Example:
var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
error(data.message, data.status);
} else {
error(data.message, "fatal");
}
};
//a new decoder can be added to the amplifyDecoders interface
interface amplifyDecoders {
appEnvelope: amplifyDecoder;
}
amplify.request.decoders.appEnvelope = appEnvelopeDecoder;
//but you can also just add it via an index
amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder;
amplify.request.define("decoderExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: "appEnvelope"
});
amplify.request({
resourceId: "decoderExample",
success: function (data) {
data.foo; // bar
},
error: function (message, level) {
alert("always handle errors with alerts.");
}
});
// POST with caching and single - use decoder
// Example:
amplify.request.define("decoderSingleExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
error(data.message, data.status);
} else {
error(data.message, "fatal");
}
}
});
amplify.request({
resourceId: "decoderSingleExample",
success: function (data) {
data.foo; // bar
},
error: function (message, level) {
alert("always handle errors with alerts.");
}
});
// Handling Status
// Status in Success and Error Callbacks
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
amplify.request.define("statusExample1", "ajax", {
//...
});
amplify.request({
resourceId: "statusExample1",
success: function (data, status) {
},
error: function (data, status) {
}
});
amplify.request({
resourceId: "statusExample1"
}).done(function (data, status) {
}).fail(function (data, status) {
}).always(function (data, status) { });
@@ -0,0 +1 @@
+182
View File
@@ -0,0 +1,182 @@
// Type definitions for AmplifyJs 1.1.0 using JQuery Deferred
// Project: http://amplifyjs.com/
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>, Laurentiu Stamate <https://github.com/laurentiustamate94>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
interface amplifyRequestSettings {
resourceId: string;
data?: any;
success?: (...args: any[]) => void;
error?: (...args: any[]) => void;
}
interface amplifyDecoder {
(
data?: any,
status?: string,
xhr?: JQueryXHR,
success?: (...args: any[]) => void,
error?: (...args: any[]) => void
): void
}
interface amplifyDecoders {
[decoderName: string]: amplifyDecoder;
jsSend: amplifyDecoder;
}
interface amplifyAjaxSettings extends JQueryAjaxSettings {
cache?: any;
dataMap?: {} | ((data: any) => {});
decoder?: any /* string or amplifyDecoder */;
}
interface amplifyRequest {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): JQueryPromise<any>;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: amplifyRequestSettings): JQueryPromise<any>;
/***
* Define a resource.
* resourceId: Identifier string for the resource.
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
* Any settings found in jQuery.ajax().
* cache: See the cache section for more details.
* decoder: See the decoder section for more details.
*/
define(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void;
/***
* Define a custom request.
* resourceId: Identifier string for the resource.
* resource: Function to handle requests. Receives a hash with the following properties:
* resourceId: Identifier string for the resource.
* data: Data provided by the user.
* success: Callback to invoke on success.
* error: Callback to invoke on error.
*/
define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void;
decoders: amplifyDecoders;
cache: any;
}
interface amplifySubscribe {
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
*/
(topic: string, callback: Function): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* context: What this will be when the callback is invoked.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, context: any, callback: Function, priority?: number): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, callback: Function, priority?: number): void;
}
interface amplifyStorageTypeStore {
/***
* Stores a value for a given key using the default storage type.
*
* key: Identifier for the value being stored.
* value: The value to store. The value can be anything that can be serialized as JSON.
* [options]: A set of key/value pairs that relate to settings for storing the value.
*/
(key: string, value: any, options?: any): void;
/***
* Gets a stored value based on the key.
*/
(key: string): any;
/***
* Gets a hash of all stored values.
*/
(): any;
}
interface amplifyStore extends amplifyStorageTypeStore {
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
localStorage: amplifyStorageTypeStore;
/***
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
sessionStorage: amplifyStorageTypeStore;
/***
* Firefox 2+
*/
globalStorage: amplifyStorageTypeStore;
/***
* IE 5 - 7
*/
userData: amplifyStorageTypeStore;
/***
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: amplifyStorageTypeStore;
}
interface amplifyStatic {
subscribe: amplifySubscribe;
/***
* Remove a subscription.
* topic: The topic being unsubscribed from.
* callback: The callback that was originally subscribed.
*/
unsubscribe(topic: string, callback: Function): void;
/***
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
store: amplifyStore;
request: amplifyRequest;
}
declare var amplify: amplifyStatic;
+1 -1
View File
@@ -45,7 +45,7 @@ declare module angular.growl {
/**
* Pre-defined server error interceptor.
*/
serverMessagesInterceptor: (string|Function)[];
serverMessagesInterceptor: (string|IHttpInterceptorFactory)[];
/**
* Set default TTL settings.
+2 -2
View File
@@ -22,8 +22,8 @@ declare module angular.localForage {
}
interface ILocalForageService {
setDriver(driver:string):angular.IPromise<void>;
driver<T>():lf.ILocalForage;
driver(): LocalForageDriver;
setDriver(name: string | string[]): angular.IPromise<void>;
setItem(key:string, value:any):angular.IPromise<void>;
setItem(keys:Array<string>, values:Array<any>):angular.IPromise<void>;
+1 -1
View File
@@ -16,7 +16,7 @@ declare module ngtoaster {
error(params: IPopParams): void
error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
toasterId?:number): void
into(params: IPopParams): void
info(params: IPopParams): void
info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
toasterId?:number): void
wait(params: IPopParams): void
+2 -2
View File
@@ -30,11 +30,11 @@ declare module angular.animate {
/**
* Globally enables / disables animations.
*
* @param value If provided then set the animation on or off.
* @param element If provided then the element will be used to represent the enable/disable operation.
* @param value If provided then set the animation on or off.
* @returns current animation state
*/
enabled(value?: boolean, element?: JQuery): boolean;
enabled(element?: JQuery, value?: boolean): boolean;
/**
* Performs an inline animation on the element.
+84 -56
View File
@@ -1312,51 +1312,25 @@ declare module angular {
/**
* Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations.
*/
defaults: IRequestConfig;
defaults: IHttpProviderDefaults;
/**
* Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes.
*/
pendingRequests: any[];
pendingRequests: IRequestConfig[];
}
/**
* Object describing the request to be made and how it should be processed.
* see http://docs.angularjs.org/api/ng/service/$http#usage
*/
interface IRequestShortcutConfig {
interface IRequestShortcutConfig extends IHttpProviderDefaults {
/**
* {Object.<string|Object>}
* Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified.
*/
params?: any;
/**
* Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent.
*/
headers?: any;
/**
* Name of HTTP header to populate with the XSRF token.
*/
xsrfHeaderName?: string;
/**
* Name of cookie containing the XSRF token.
*/
xsrfCookieName?: string;
/**
* {boolean|Cache}
* If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
*/
cache?: any;
/**
* whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.
*/
withCredentials?: boolean;
/**
* {string|Object}
* Data to be sent as the request message data.
@@ -1364,25 +1338,12 @@ declare module angular {
data?: any;
/**
* {function(data, headersGetter)|Array.<function(data, headersGetter)>}
* Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version.
*/
transformRequest?: any;
/**
* {function(data, headersGetter)|Array.<function(data, headersGetter)>}
* Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version.
*/
transformResponse?: any;
/**
* {number|Promise}
* Timeout in milliseconds, or promise that should abort the request when resolved.
*/
timeout?: any;
timeout?: number|IPromise<any>;
/**
* See requestType.
* See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
*/
responseType?: string;
}
@@ -1425,31 +1386,98 @@ declare module angular {
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>|TResult, errorCallback?: (response: IHttpPromiseCallbackArg<any>) => any): IPromise<TResult>;
}
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
interface IHttpResquestTransformer {
(data: any, headersGetter: IHttpHeadersGetter): any;
}
// The definition of fields are the same as IHttpPromiseCallbackArg
interface IHttpResponseTransformer {
(data: any, headersGetter: IHttpHeadersGetter, status: number): any;
}
interface IHttpRequestConfigHeaders {
[requestType: string]: string|(() => string);
common?: string|(() => string);
get?: string|(() => string);
post?: string|(() => string);
put?: string|(() => string);
patch?: string|(() => string);
}
/**
* Object that controls the defaults for $http provider
* Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured
* via defaults and the docs do not say which. The following is based on the inspection of the source code.
* https://docs.angularjs.org/api/ng/service/$http#defaults
* https://docs.angularjs.org/api/ng/service/$http#usage
* https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section
*/
interface IHttpProviderDefaults {
cache?: boolean;
/**
* {boolean|Cache}
* If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching.
*/
cache?: any;
/**
* Transform function or an array of such functions. The transform function takes the http request body and
* headers and returns its transformed (typically serialized) version.
* @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses}
*/
transformRequest?: ((data: any, headersGetter?: any) => any)|((data: any, headersGetter?: any) => any)[];
xsrfCookieName?: string;
transformRequest?: IHttpResquestTransformer |IHttpResquestTransformer[];
/**
* Transform function or an array of such functions. The transform function takes the http response body and
* headers and returns its transformed (typically deserialized) version.
*/
transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[];
/**
* Map of strings or functions which return strings representing HTTP headers to send to the server. If the
* return value of a function is null, the header will not be sent.
* The key of the map is the request verb in lower case. The "common" key applies to all requests.
* @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers}
*/
headers?: IHttpRequestConfigHeaders;
/** Name of HTTP header to populate with the XSRF token. */
xsrfHeaderName?: string;
/** Name of cookie containing the XSRF token. */
xsrfCookieName?: string;
/**
* whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information.
*/
withCredentials?: boolean;
headers?: {
common?: any;
post?: any;
put?: any;
patch?: any;
}
/**
* A function used to the prepare string representation of request parameters (specified as an object). If
* specified as string, it is interpreted as a function registered with the $injector. Defaults to
* $httpParamSerializer.
*/
paramSerializer?: string | ((obj: any) => string);
}
interface IHttpInterceptor {
request?: (config: IRequestConfig) => IRequestConfig|IPromise<IRequestConfig>;
requestError?: (rejection: any) => any;
response?: <T>(response: IHttpPromiseCallbackArg<T>) => IPromise<T>|T;
responseError?: (rejection: any) => any;
}
interface IHttpInterceptorFactory {
(...args: any[]): IHttpInterceptor;
}
interface IHttpProvider extends IServiceProvider {
defaults: IHttpProviderDefaults;
interceptors: any[];
/**
* Register service factories (names or implementations) for interceptors which are called before and after
* each request.
*/
interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[];
useApplyAsync(): boolean;
useApplyAsync(value: boolean): IHttpProvider;
@@ -1693,7 +1721,7 @@ declare module angular {
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotatedFunction: any[]): string[];
get<T>(name: string): T;
get<T>(name: string, caller?: string): T;
has(name: string): boolean;
instantiate<T>(typeConstructor: Function, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="codemirror.d.ts" />
/// <reference path="searchcursor.d.ts" />
var doc = new CodeMirror.Doc('text some string and another text match');
var cursor = doc.getSearchCursor('text', new CodeMirror.Pos(0,0), false);
cursor = doc.getSearchCursor('text', new CodeMirror.Pos(0,0));
cursor = doc.getSearchCursor('text');
cursor.find(false);
cursor.findNext();
cursor.findPrevious();
cursor.from();
cursor.to();
cursor.replace("blah");
cursor.replace("text", "origin");
+45
View File
@@ -0,0 +1,45 @@
// Type definitions for CodeMirror
// Project: https://github.com/marijnh/CodeMirror
// Definitions by: jacqt <https://github.com/jacqt>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module CodeMirror {
interface Doc {
/** This method can be used to implement search/replace functionality.
* `query`: This can be a regular * expression or a string (only strings will match across lines -
* if they contain newlines).
* `start`: This provides the starting position of the search. It can be a `{line, ch} object,
* or can be left off to default to the start of the document
* `caseFold`: This is only relevant when matching a string. IT will cause the search to be case-insenstive */
getSearchCursor(query: string | RegExp, start?: Position, caseFold?: boolean): SearchCursor;
}
interface SearchCursor {
/** Searches forward or backward from the current position. The return value indicates whether a match was
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
* you want to extract matched groups */
find(reverse: boolean): boolean | any[];
/** Searches forward from the current position. The return value indicates whether a match was
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
* you want to extract matched groups */
findNext(): boolean | any[];
/** Searches backward from the current position. The return value indicates whether a match was
* found. If matching a regular expression, the return value will be the array returned by the match method, in case
* you want to extract matched groups */
findPrevious(): boolean | any[];
/** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
* objects pointing the start of the match. */
from(): Position;
/** Only valid when the last call to find, findNext, or findPrevious did not return false. Returns {line, ch}
* objects pointing the end of the match. */
to(): Position;
/** Replaces the currently found match with the given text and adjusts the cursor position to reflect the deplacement. */
replace(text: string, origin?: string): void;
}
}
+2
View File
@@ -7,4 +7,6 @@ cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
cordova.plugins.Keyboard.close();
cordova.plugins.Keyboard.disableScroll(true);
cordova.plugins.Keyboard.disableScroll(false);
cordova.plugins.Keyboard.show();
cordova.plugins.Keyboard.close();
console.log(cordova.plugins.Keyboard.isVisible);
+8
View File
@@ -17,6 +17,14 @@ declare module Ionic {
* Close the keyboard if it is open.
*/
close(): void;
/**
* Force keyboard to be shown on Android.
* This typically helps if autofocus on a text element does not pop up the keyboard automatically
*
* Supported Platforms: Android, Blackberry 10
*/
show(): void;
/**
* Disable native scrolling, useful if you are using JavaScript to scroll
+6
View File
@@ -106,6 +106,8 @@ declare module "express" {
use(handler: ErrorRequestHandler): T;
use(path: string, ...handler: RequestHandler[]): T;
use(path: string, handler: ErrorRequestHandler): T;
use(path: string[], ...handler: RequestHandler[]): T;
use(path: string[], handler: ErrorRequestHandler[]): T;
}
export function Router(options?: any): Router;
@@ -410,6 +412,10 @@ declare module "express" {
originalUrl: string;
url: string;
baseUrl: string;
app: Application;
}
interface MediaType {
+42
View File
@@ -0,0 +1,42 @@
/// <reference path="gulp-shell.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import shell = require('gulp-shell');
import gulp = require('gulp');
gulp.task('example', function () {
return gulp.src('*.js', {read: false})
.pipe(shell([
'echo <%= f(file.path) %>',
'ls -l <%= file.path %>'
], {
templateData: {
f: function (s: string) {
return s.replace(/$/, '.bak')
}
}
}))
});
gulp.task('shorthand', shell.task([
'echo hello',
'echo world'
]));
var paths: any = {
js: ['*.js', 'test/*.js']
};
gulp.task('test', shell.task('mocha -R spec'));
gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha -- -R spec'));
gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls'));
gulp.task('lint', shell.task('eslint ' + paths.js.join(' ')));
gulp.task('default', ['coverage', 'lint']);
gulp.task('watch', function () {
gulp.watch(paths.js, ['default'])
});
+68
View File
@@ -0,0 +1,68 @@
// Type definitions for gulp-shell
// Project: https://github.com/sun-zheng-an/gulp-shell
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "gulp-shell" {
namespace shell {
interface Shell {
(commands: string|string[], options?: Option): NodeJS.ReadWriteStream;
task(commands: string|string[], options?: Option): () => NodeJS.ReadWriteStream;
}
interface Option {
/**
* You can add a custom error message for when the command fails. This can be a template which can be
* interpolated with the current command, some file info (e.g. file.path) and some error info
* (e.g. error.code).
* @default 'Command `<%= command %>` failed with exit code <%= error.code %>'
*/
errorMessage?: string;
/**
* By default, it will emit an error event when the command finishes unsuccessfully.
* @default false
*/
ignoreErrors?: boolean;
/**
* By default, it will print the command output.
* @default false
*/
quiet?: boolean;
/**
* Sets the current working directory for the command.
* @default process.cwd()
*/
cwd?: string;
/**
* The data that can be accessed in template.
*/
templateData?: any;
/**
* You won't need to set this option unless you encounter a "stdout maxBuffer exceeded" error.
* @default 16MB(16 * 1024 * 1024)
*/
maxBuffer?: number;
/**
* The maximum amount of time in milliseconds the process is allowed to run.
* @default
*/
timeout?: number;
/**
* By default, all the commands will be executed in an environment with all the variables in process.env
* and PATH prepended by ./node_modules/.bin (allowing you to run executables in your Node's dependencies).
* You can override any environment variables with this option.
* For example, setting it to {PATH: process.env.PATH} will reset the PATH
* if the default one brings your some troubles.
*/
env?: any;
}
}
var shell: shell.Shell;
export = shell;
}
+15 -15
View File
@@ -58,7 +58,7 @@ declare module jasmine {
function addMatchers(matchers: CustomMatcherFactories): void;
function stringMatching(str: string): Any;
function stringMatching(str: RegExp): Any;
interface Any {
new (expectedClass: any): any;
@@ -72,7 +72,7 @@ declare module jasmine {
length: number;
[n: number]: T;
}
interface ArrayContaining {
new (sample: any[]): any;
@@ -279,21 +279,21 @@ declare module jasmine {
isNot?: boolean;
message(): any;
toBe(expected: any): boolean;
toEqual(expected: any): boolean;
toMatch(expected: any): boolean;
toBeDefined(): boolean;
toBeUndefined(): boolean;
toBeNull(): boolean;
toBe(expected: any, expectationFailOutput?: any): boolean;
toEqual(expected: any, expectationFailOutput?: any): boolean;
toMatch(expected: any, expectationFailOutput?: any): boolean;
toBeDefined(expectationFailOutput?: any): boolean;
toBeUndefined(expectationFailOutput?: any): boolean;
toBeNull(expectationFailOutput?: any): boolean;
toBeNaN(): boolean;
toBeTruthy(): boolean;
toBeFalsy(): boolean;
toBeTruthy(expectationFailOutput?: any): boolean;
toBeFalsy(expectationFailOutput?: any): boolean;
toHaveBeenCalled(): boolean;
toHaveBeenCalledWith(...params: any[]): boolean;
toContain(expected: any): boolean;
toBeLessThan(expected: any): boolean;
toBeGreaterThan(expected: any): boolean;
toBeCloseTo(expected: any, precision: any): boolean;
toContain(expected: any, expectationFailOutput?: any): boolean;
toBeLessThan(expected: any, expectationFailOutput?: any): boolean;
toBeGreaterThan(expected: any, expectationFailOutput?: any): boolean;
toBeCloseTo(expected: any, precision: any, expectationFailOutput?: any): boolean;
toContainHtml(expected: string): boolean;
toContainText(expected: string): boolean;
toThrow(expected?: any): boolean;
@@ -450,7 +450,7 @@ declare module jasmine {
/** By chaining the spy with calls.reset(), will clears all tracking for a spy **/
reset(): void;
}
interface CallInfo {
/** The context (the this) for the call */
object: any;
+28
View File
@@ -0,0 +1,28 @@
/// <reference path="level-sublevel.d.ts" />
import levelup = require('levelup');
import sublevel = require('level-sublevel');
var db = sublevel(levelup('./tmp/sublevel-example'));
var sub = db.sublevel('stuff');
db.put('foo', 'bar', err => {});
sub.put('foo', 'bar', err => {});
db.pre((ch, add) => {
add({
key: ''+Date.now(),
value: ch.key,
type: 'put',
prefix: sub
})
});
var sub1 = db.sublevel('SUB_1');
var sub2 = db.sublevel('SUM_2');
sub1.batch([
{ key: 'key', value: 'Value', type: 'put' },
{ key: 'key', value: 'Value', type: 'put', prefix: sub2 }
], err => { if (err) throw err; });
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for level-sublevel
// Project: https://github.com/dominictarr/level-sublevel
// Definitions by: Bas Pennings <https://github.com/basp/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../levelup/levelup.d.ts" />
interface Hook {
(ch: any, add: (op: Batch|boolean) => void): void;
}
interface Batch {
prefix?: Sublevel;
}
interface Sublevel extends LevelUp {
sublevel(key: string): Sublevel;
pre(hook: Hook): Function;
}
declare module "level-sublevel" {
function sublevel(levelup: LevelUp): Sublevel;
export = sublevel;
}
+2 -2
View File
@@ -22,8 +22,8 @@ interface LevelUp {
del(key: any, options ?: { keyEncoding?: string; sync?: boolean }, callback ?: (error: any) => any): void;
batch(array: Batch[], options?: { keyEncoding?: string; valueEncoding?: string; sync?: boolean }, callback?: (error?: any)=>any);
batch(array: Batch[], callback?: (error?: any)=>any);
batch(array: Batch[], options?: { keyEncoding?: string; valueEncoding?: string; sync?: boolean }, callback?: (error?: any)=>any): void;
batch(array: Batch[], callback?: (error?: any)=>any): void;
batch():LevelUpChain;
isOpen():boolean;
isClosed():boolean;
+19 -1
View File
@@ -1,6 +1,10 @@
/// <reference path="localForage.d.ts" />
<<<<<<< HEAD
import {default as localForage} from "localforage";
=======
declare var localForage: LocalForage;
>>>>>>> 5f480287834a2615274eea31574b713e64decf17
() => {
localForage.clear((err: any) => {
@@ -18,7 +22,7 @@ import {default as localForage} from "localforage";
var newNumber: number = num;
});
localForage.key(0,(err: any, value: string) => {
localForage.key(0, (err: any, value: string) => {
var newError: any = err;
var newValue: string = value;
});
@@ -33,12 +37,17 @@ import {default as localForage} from "localforage";
var newStr: string = str
});
<<<<<<< HEAD
localForage.getItem<string>("key").then((value) => {
var newStr: string = value
});
localForage.getItem<number>("keyNumber").then((value) => {
var newValue: number = value
=======
localForage.getItem<string>("key").then((str: string) => {
var newStr: string = str;
>>>>>>> 5f480287834a2615274eea31574b713e64decf17
});
localForage.setItem("key", "value",(err: any, str: string) => {
@@ -50,8 +59,13 @@ import {default as localForage} from "localforage";
var v: string = value;
});
<<<<<<< HEAD
localForage.setItem("keyNumber", 1337).then((value) => {
var v: number = value;
=======
localForage.setItem("key", "value").then((str: string) => {
var newStr: string = str;
>>>>>>> 5f480287834a2615274eea31574b713e64decf17
});
localForage.removeItem("key",(err: any) => {
@@ -63,6 +77,7 @@ import {default as localForage} from "localforage";
});
<<<<<<< HEAD
var config = localForage.config({
name: "testyo",
driver: localForage.LOCALSTORAGE
@@ -71,5 +86,8 @@ import {default as localForage} from "localforage";
var store = localForage.createInstance({
name: "da instance",
driver: localForage.LOCALSTORAGE
=======
localForage.removeItem("key").then(() => {
>>>>>>> 5f480287834a2615274eea31574b713e64decf17
});
}
+72 -98
View File
@@ -5,103 +5,77 @@
/// <reference path="../es6-promise/es6-promise.d.ts" />
declare module lf {
interface ILocalForage extends ILocalForageStatic {
/**
* Removes every key from the database, returning it to a blank slate.
*/
clear(callback: IErrorCallback): void;
/**
* Iterate over all value/key pairs in datastore.
*/
iterate<T>(iterateCallback: IIterateCallback<T>): void;
/**
* Get the name of a key based on its ID.
*/
key(keyIndex: number, callback: IKeyCallback): void;
/**
* Get the list of all keys in the datastore.
*/
keys(callback: IKeysCallback): void;
/**
* Gets the number of keys in the offline store (i.e. its “length”).
*/
length(callback: INumberCallback): void;
/**
* Gets an item from the storage library and supplies the result to a callback.
* If the key does not exist, getItem() will return null.
*/
getItem<T>(key: string, callback: ICallback<T>): void;
getItem<T>(key: string): Promise<T>;
/**
* Saves data to an offline store.
*/
setItem<T>(key: string, value: T, callback: ICallback<T>): void;
setItem<T>(key: string, value: T): Promise<T>;
/**
* Removes the value of a key from the offline store.
*/
removeItem(key: string, callback: IErrorCallback): void;
removeItem(key: string): Promise<void>;
}
interface ILocalForageStatic {
INDEXEDDB: string;
LOCALSTORAGE: string;
WEBSQL: string;
/**
* Set and persist localForage options. This must be called before any other calls to localForage are made, but can be called after localForage is loaded.
* If you set any config values with this method they will persist after driver changes, so you can call config() then setDriver()
* @param {ILocalForageConfig} options?
*/
config(options?: ILocalForageConfig): boolean;
createInstance(options?: ILocalForageConfig): ILocalForage;
defineDriver(driverObject?: any): void;
/**
* Force usage of a particular driver or drivers, if available.
* @param {string} driver
*/
setDriver(driver: string): void;
supports(driverName: string): boolean;
}
interface ILocalForageConfig {
description?: string;
driver?: string;
name?: string;
size?: number;
storeName?: string;
version?: number;
}
interface ICallback<T> {
(err: any, value: T): void
}
interface IIterateCallback<T> {
(value: T, key: string, iterationNumber: number): void
}
interface IErrorCallback {
(err: any): void
}
interface IKeyCallback {
(err: any, keyName: string): void
}
interface IKeysCallback {
(err: any, keys: Array<string>): void
}
interface INumberCallback {
(err: any, numberOfKeys: number): void
}
interface LocalForageOptions {
driver?: LocalForageDriver | LocalForageDriver[];
name?: string;
size?: number;
storeName?: string;
version?: string;
description?: string;
}
declare module "localforage" {
var localforage: lf.ILocalForage;
export default localforage;
}
interface LocalForageDriver {
_driver: string;
_initStorage(options: LocalForageOptions): void;
_support: boolean | Promise<boolean>;
clear(callback: (err: any) => void): void;
getItem(key: string, callback: (err: any, value: any) => void): void;
key(keyIndex: number, callback: (err: any, key: string) => void): void;
keys(callback: (err: any, keys: string[]) => void): void;
length(callback: (err: any, numberOfKeys: number) => void): void;
removeItem(key: string, callback: (err: any) => void): void;
setItem(key: string, value: any, callback: (err: any, value: any) => void): void;
}
interface LocalForage {
LOCALSTORAGE: string;
WEBSQL: string;
INDEXEDDB: string;
config(options: LocalForageOptions): void;
driver(): LocalForageDriver;
setDriver(driver: string | string[]): Promise<void>;
setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void;
defineDriver(driver: LocalForageDriver): Promise<void>;
defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void;
getItem<T>(key: string): Promise<T>;
getItem<T>(key: string, callback: (err: any, value: T) => void): void;
setItem<T>(key: string, value: T): Promise<T>;
setItem<T>(key: string, value: T, callback: (err: any, value: T) => void): void;
removeItem(key: string): Promise<void>;
removeItem(key: string, callback: (err: any) => void): void;
clear(): Promise<void>;
clear(callback: (err: any) => void): void;
length(): Promise<number>;
length(callback: (err: any, numberOfKeys: number) => void): void;
key(keyIndex: number): Promise<string>;
key(keyIndex: number, callback: (err: any, key: string) => void): void;
keys(): Promise<string[]>;
keys(callback: (err: any, keys: string[]) => void): void;
iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise<any>;
iterate(iteratee: (value: any, key: string, iterationNumber: number) => any,
callback: (err: any, result: any) => void): void;
}
+99 -27
View File
@@ -439,6 +439,20 @@ result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1,
result = _([1, 2, 3]).thru<number>((value: number[]) => value, any);
}
// _.prototype.commit
{
let result: _.LoDashWrapper<number>;
result = _(42).commit();
}
{
let result: _.LoDashArrayWrapper<any>;
result = _<any>([]).commit();
}
{
let result: _.LoDashObjectWrapper<any>;
result = _({}).commit();
}
/**************
* Collection *
**************/
@@ -1552,11 +1566,14 @@ result = <boolean>_({}).has(42);
result = <boolean>_({}).has(true);
result = <boolean>_({}).has(['', 42, true]);
interface FirstSecond {
first: string;
second: string;
// _.invert
{
let result: TResult;
result = _.invert<Object, TResult>({});
result = _.invert<Object, TResult>({}, true);
result = _({}).invert<TResult>().value();
result = _({}).invert<TResult>(true).value();
}
result = <FirstSecond>_.invert({ 'first': 'moe', 'second': 'larry' });
// _.isEqual (alias: _.eq)
result = <boolean>_.isEqual(1, 1);
@@ -1664,9 +1681,27 @@ interface TestPickFn {
result = _({}).pick<TResult>(testPickFn, any).value();
}
// _.result
{
let testResultPath: number|string|boolean|Array<number|string|boolean>;
let testResultDefaultValue: TResult;
let result: TResult;
result = _.result<{}, TResult>({}, testResultPath);
result = _.result<{}, TResult>({}, testResultPath, testResultDefaultValue);
result = _({}).result<TResult>(testResultPath);
result = _({}).result<TResult>(testResultPath, testResultDefaultValue);
}
// _.set
result = <{ a: { b: { c: number; }}[]}>_.set({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c', 4);
result = <{ a: { b: { c: number; }}[]}>_({ 'a': [{ 'b': { 'c': 3 } }] }).set('a[0].b.c', 4).value();
{
let testSetObject: TResult;
let testSetPath: {toSting(): string};
let result: TResult;
result = _.set(testSetObject, testSetPath, any);
result = _.set(testSetObject, [testSetPath], any);
result = _(testSetObject).set(testSetPath, any).value();
result = _(testSetObject).set([testSetPath], any).value();
}
result = <number[]>_.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function (r: number[], num: number) {
num *= num;
@@ -1716,8 +1751,6 @@ var testAttempFn: TestAttemptFn;
result = <TResult|Error>_.attempt<TResult>(testAttempFn);
result = <TResult|Error>_(testAttempFn).attempt<TResult>();
var lodash = <typeof _>_.noConflict();
result = <number>_.random(0, 5);
result = <number>_.random(5);
result = <number>_.random(5, true);
@@ -1735,22 +1768,6 @@ result = <void>_<string>([]).noop(true, 'a', 1);
result = <void>_({}).noop(true, 'a', 1);
result = <void>_(any).noop(true, 'a', 1);
var object = {
'cheese': 'crumpets',
'one': 1,
'nested': {
'two': 2
},
'stuff': function () {
return 'nonsense';
}
};
result = <string>_.result(object, 'cheese');
result = <string>_.result(object, 'stuff');
result = _.result<number>(object, 'one');
result = _.result<number>(object, ['nested', 'two'] );
var tempObject = {};
result = <typeof _>_.runInContext(tempObject);
@@ -1941,9 +1958,32 @@ result = <string[]>_.words('fred, barney, & pebbles', /[^, ]+/g);
result = <string[]>_('fred, barney, & pebbles').words();
result = <string[]>_('fred, barney, & pebbles').words(/[^, ]+/g);
/**********
* Utilities *
***********/
/***********
* Utility *
***********/
// _.callback
{
let result: (...args: any[]) => TResult;
result = _.callback<TResult>(Function);
result = _.callback<TResult>(Function, any);
result = _(Function).callback<TResult>().value();
result = _(Function).callback<TResult>(any).value();
}
{
let result: (object: any) => TResult;
result = _.callback<TResult>('');
result = _.callback<TResult>('', any);
result = _('').callback<TResult>().value();
result = _('').callback<TResult>(any).value();
}
{
let result: (object: any) => boolean;
result = _.callback({});
result = _.callback({}, any);
result = _({}).callback().value();
result = _({}).callback(any).value();
}
// _.constant
result = <() => number>_.constant<number>(1);
@@ -1973,6 +2013,29 @@ result = <() => {}>_({}).constant<{}>();
result = _<boolean>([]).identity();
}
// _.iteratee
{
let result: (...args: any[]) => TResult;
result = _.iteratee<TResult>(Function);
result = _.iteratee<TResult>(Function, any);
result = _(Function).iteratee<TResult>().value();
result = _(Function).iteratee<TResult>(any).value();
}
{
let result: (object: any) => TResult;
result = _.iteratee<TResult>('');
result = _.iteratee<TResult>('', any);
result = _('').iteratee<TResult>().value();
result = _('').iteratee<TResult>(any).value();
}
{
let result: (object: any) => boolean;
result = _.iteratee({});
result = _.iteratee({}, any);
result = _({}).iteratee().value();
result = _({}).iteratee(any).value();
}
// _.method
class TestMethod {
a = {
@@ -2012,6 +2075,15 @@ result = <number>(_(TestMethodOfObject).methodOf<number>(1, 2).value())(['a', '0
result = _(testMixinSource).mixin<TResult>(testMixinOptions).value();
}
// _.noConflict
{
let result: typeof _;
result = _.noConflict();
result = _(42).noConflict();
result = _<any>([]).noConflict();
result = _({}).noConflict();
}
// _.uniqueId
result = <string>_.uniqueId();
result = <string>_.uniqueId('');
+190 -31
View File
@@ -2056,6 +2056,16 @@ declare module _ {
thisArg?: any): LoDashArrayWrapper<TResult>;
}
// _.prototype.commit
interface LoDashWrapperBase<T, TWrapper> {
/**
* Executes the chained sequence and returns the wrapped result.
*
* @return Returns the new lodash wrapper instance.
*/
commit(): TWrapper;
}
/**************
* Collection *
**************/
@@ -7190,11 +7200,21 @@ declare module _ {
//_.invert
interface LoDashStatic {
/**
* Creates an object composed of the inverted keys and values of the given object.
* @param object The object to invert.
* @return The created inverted object.
**/
invert(object: any): any;
* Creates an object composed of the inverted keys and values of object. If object contains duplicate values,
* subsequent values overwrite property assignments of previous values unless multiValue is true.
*
* @param object The object to invert.
* @param multiValue Allow multiple values per key.
* @return Returns the new inverted object.
*/
invert<T extends {}, TResult extends {}>(object: T, multiValue?: boolean): TResult;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.invert
*/
invert<TResult extends {}>(multiValue?: boolean): LoDashObjectWrapper<TResult>;
}
//_.isEqual
@@ -7540,26 +7560,59 @@ declare module _ {
): LoDashObjectWrapper<TResult>;
}
//_.result
interface LoDashStatic {
/**
* This method is like _.get except that if the resolved value is a function its invoked with the this binding
* of its parent object and its result is returned.
*
* @param object The object to query.
* @param path The path of the property to resolve.
* @param defaultValue The value returned if the resolved value is undefined.
* @return Returns the resolved value.
*/
result<TObject, TResult>(
object: TObject,
path: number|string|boolean|Array<number|string|boolean>,
defaultValue?: TResult
): TResult;
}
interface LoDashWrapperBase<T, TWrapper> {
/**
* @see _.result
*/
result<TResult>(
path: number|string|boolean|Array<number|string|boolean>,
defaultValue?: TResult
): TResult;
}
//_.set
interface LoDashStatic {
/**
* Sets the property value of path on object. If a portion of path does not exist it is created.
* Sets the property value of path on object. If a portion of path does not exist its created.
*
* @param object The object to augment.
* @param path The path of the property to set.
* @param value The value to set.
* @return Returns object.
**/
set<T>(object: T,
path: string|string[],
value: any): T;
*/
set<T>(
object: T,
path: StringRepresentable|StringRepresentable[],
value: any
): T;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.set
**/
set(path: string|string[],
value: any): LoDashObjectWrapper<T>;
*/
set(
path: StringRepresentable|StringRepresentable[],
value: any
): LoDashObjectWrapper<T>;
}
//_.transform
@@ -8117,6 +8170,64 @@ declare module _ {
attempt<TResult>(): TResult|Error;
}
//_.callback
interface LoDashStatic {
/**
* Creates a function that invokes func with the this binding of thisArg and arguments of the created function.
* If func is a property name the created callback returns the property value for a given element. If func is
* an object the created callback returns true for elements that contain the equivalent object properties,
* otherwise it returns false.
*
* @param func The value to convert to a callback.
* @param thisArg The this binding of func.
* @result Returns the callback.
*/
callback<TResult>(
func: Function,
thisArg?: any
): (...args: any[]) => TResult;
/**
* @see _.callback
*/
callback<TResult>(
func: string,
thisArg?: any
): (object: any) => TResult;
/**
* @see _.callback
*/
callback(
func: Object,
thisArg?: any
): (object: any) => boolean;
/**
* @see _.callback
*/
callback<TResult>(): (value: TResult) => TResult;
}
interface LoDashWrapper<T> {
/**
* @see _.callback
*/
callback<TResult>(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.callback
*/
callback(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>;
/**
* @see _.callback
*/
callback<TResult>(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>;
}
//_.identity
interface LoDashStatic {
/**
@@ -8148,6 +8259,57 @@ declare module _ {
identity(): T;
}
//_.iteratee
interface LoDashStatic {
/**
* @see _.callback
*/
iteratee<TResult>(
func: Function,
thisArg?: any
): (...args: any[]) => TResult;
/**
* @see _.callback
*/
iteratee<TResult>(
func: string,
thisArg?: any
): (object: any) => TResult;
/**
* @see _.callback
*/
iteratee(
func: Object,
thisArg?: any
): (object: any) => boolean;
/**
* @see _.callback
*/
iteratee<TResult>(): (value: TResult) => TResult;
}
interface LoDashWrapper<T> {
/**
* @see _.callback
*/
iteratee<TResult>(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.callback
*/
iteratee(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>;
/**
* @see _.callback
*/
iteratee<TResult>(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>;
}
//_.method
interface LoDashStatic {
/**
@@ -8262,9 +8424,17 @@ declare module _ {
//_.noConflict
interface LoDashStatic {
/**
* Reverts the '_' variable to its previous value and returns a reference to the lodash function.
* @return The lodash function.
**/
* Reverts the _ variable to its previous value and returns a reference to the lodash function.
*
* @return Returns the lodash function.
*/
noConflict(): typeof _;
}
interface LoDashWrapperBase<T, TWrapper> {
/**
* @see _.noConflict
*/
noConflict(): typeof _;
}
@@ -8379,21 +8549,6 @@ declare module _ {
random(min: number, max: number, floating?: boolean): number;
}
//_.result
interface LoDashStatic {
/**
* Resolves the value of property on object. If property is a function it will be invoked with
* the this binding of object and its result returned, else the property value is returned. If
* object is false then undefined is returned.
* @param object The object to query.
* @param path The path of the property to resolve.
* @param defaultValue The value returned if the resolved value is undefined.
* @return The resolved value.
**/
result<T>(object: any, path: string|string[], defaultValue?: T): T;
}
//_.runInContext
interface LoDashStatic {
/**
@@ -8514,6 +8669,10 @@ declare module _ {
interface Dictionary<T> {
[index: string]: T;
}
interface StringRepresentable {
toString(): string;
}
}
declare module "lodash" {
+67 -1
View File
@@ -71,8 +71,74 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any)
console.error('Error happened calling Query: ' + err.name + " " + err.message);
}
else {
console.info(requestStoredProcedureWithOutput.parameters.output.value);
console.info(requestStoredProcedureWithOutput.parameters['output'].value);
}
});
}
});
function test_table() {
var table = new sql.Table('#temp_table');
table.create = true;
table.columns.add('name', sql.VarChar(sql.MAX), { nullable: false });
table.columns.add('type', sql.Int, { nullable: false });
table.columns.add('amount', sql.Decimal(7, 2), { nullable: false });
table.rows.add('name', 42, 3.50);
table.rows.add('name2', 7, 3.14);
}
function test_promise_returns() {
// Methods return a promises if the callback is omitted.
var connection: sql.Connection = new sql.Connection(config);
connection.connect().then(() => { });
connection.close().then(() => { });
var preparedStatment = new sql.PreparedStatement(connection);
preparedStatment.prepare("SELECT @myValue").then(() => { });
preparedStatment.execute({ myValue: 1 }).then((recordSet) => { });
preparedStatment.unprepare().then(() => { });
var transaction = new sql.Transaction(connection);
transaction.begin().then(() => { });
transaction.commit().then(() => { });
transaction.rollback().then(() => { });
var request = new sql.Request();
request.batch('create procedure #temporary as select * from table').then((recordset) => { });
request.bulk(new sql.Table("table_name")).then(() => { });
request.query('SELECT 1').then((recordset) => { });
request.execute('procedure_name').then((recordset) => { });
}
function test_request_constructor() {
// Request can be constructed with a connection, preparedStatment, transaction or no arguments
var connection: sql.Connection = new sql.Connection(config);
var preparedStatment = new sql.PreparedStatement(connection);
var transaction = new sql.Transaction(connection);
var request1 = new sql.Request(connection);
var request2 = new sql.Request(preparedStatment);
var request3 = new sql.Request(transaction);
var request4 = new sql.Request();
}
function test_classes_extend_eventemitter() {
var connection: sql.Connection = new sql.Connection(config);
var transaction = new sql.Transaction();
var request = new sql.Request();
var preparedStatment = new sql.PreparedStatement();
connection.on('connect', () => { });
transaction.on('begin', () => { });
transaction.on('commit', () => { });
transaction.on('rollback', () => { });
request.on('done', () => { });
request.on('error', () => { });
preparedStatment.on('error', () => { })
}
+208 -62
View File
@@ -1,53 +1,131 @@
// Type definitions for mssql
// Type definitions for mssql v2.2.0
// Project: https://www.npmjs.com/package/mssql
// Definitions by: COLSA Corporation <http://www.colsa.com/>
// Definitions by: COLSA Corporation <http://www.colsa.com/>, Ben Farr <https://github.com/jaminfarr>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../es6-promise/es6-promise.d.ts" />
declare module "mssql" {
import events = require('events');
export var Date: any;
export var DateTime: any;
export var DateTime2: any;
export var DateTimeOffset: any;
export var SmallDateTime: any;
export var Time: any;
export var Char: any;
export var VarChar:any;
export var NChar: any;
export var NVarChar: any;
export var Text:any;
export var NText:any;
export var Xml: any;
export var TinyInt:any;
export var SmallInt:any;
export var Int: any;
export var BigInt:any;
export var Decimal:any;
export var Float:any;
export var Real:any;
export var SmallMoney:any;
export var Money:any;
export var Numeric:any;
export var Bit: any;
export var Binary: any;
export var VarBinary: any;
export var TVP: any;
export var UniqueIdentifier: any;
export var Image: any;
export var UDT: any;
export var Geography: any;
export var Geometry: any;
type sqlTypeWithNoParams = { type: sqlTypeFactoryWithNoParams }
type sqlTypeWithLength = { type: sqlTypeFactoryWithLength, length: number }
type sqlTypeWithScale = { type: sqlTypeFactoryWithScale, scale: number }
type sqlTypeWithPrecisionScale = { type: sqlTypeFactoryWithPrecisionScale, precision: number, scale: number }
type sqlTypeWithTvpType = { type: sqlTypeFactoryWithTvpType, tvpType: any }
export interface options {
type sqlTypeFactoryWithNoParams = () => sqlTypeWithNoParams;
type sqlTypeFactoryWithLength = (length?: number) => sqlTypeWithLength;
type sqlTypeFactoryWithScale = (scale?: number) => sqlTypeWithScale;
type sqlTypeFactoryWithPrecisionScale = (precision?: number, scale?: number) => sqlTypeWithPrecisionScale;
type sqlTypeFactoryWithTvpType = (tvpType: any) => sqlTypeWithTvpType;
export var VarChar: sqlTypeFactoryWithLength;
export var NVarChar: sqlTypeFactoryWithLength;
export var Text: sqlTypeFactoryWithNoParams;
export var Int: sqlTypeFactoryWithNoParams;
export var BigInt: sqlTypeFactoryWithNoParams;
export var TinyInt: sqlTypeFactoryWithNoParams;
export var SmallInt: sqlTypeFactoryWithNoParams;
export var Bit: sqlTypeFactoryWithNoParams;
export var Float: sqlTypeFactoryWithNoParams;
export var Numeric: sqlTypeFactoryWithPrecisionScale;
export var Decimal: sqlTypeFactoryWithPrecisionScale;
export var Real: sqlTypeFactoryWithNoParams;
export var Date: sqlTypeFactoryWithNoParams;
export var DateTime: sqlTypeFactoryWithNoParams;
export var DateTime2: sqlTypeFactoryWithScale;
export var DateTimeOffset: sqlTypeFactoryWithScale;
export var SmallDateTime: sqlTypeFactoryWithNoParams;
export var Time: sqlTypeFactoryWithScale;
export var UniqueIdentifier: sqlTypeFactoryWithNoParams;
export var SmallMoney: sqlTypeFactoryWithNoParams;
export var Money: sqlTypeFactoryWithNoParams;
export var Binary: sqlTypeFactoryWithNoParams;
export var VarBinary: sqlTypeFactoryWithLength;
export var Image: sqlTypeFactoryWithNoParams;
export var Xml: sqlTypeFactoryWithNoParams;
export var Char: sqlTypeFactoryWithLength;
export var NChar: sqlTypeFactoryWithLength;
export var NText: sqlTypeFactoryWithNoParams;
export var TVP: sqlTypeFactoryWithTvpType;
export var UDT: sqlTypeFactoryWithNoParams;
export var Geography: sqlTypeFactoryWithNoParams;
export var Geometry: sqlTypeFactoryWithNoParams;
export var TYPES: {
VarChar: sqlTypeFactoryWithLength;
NVarChar: sqlTypeFactoryWithLength;
Text: sqlTypeFactoryWithNoParams;
Int: sqlTypeFactoryWithNoParams;
BigInt: sqlTypeFactoryWithNoParams;
TinyInt: sqlTypeFactoryWithNoParams;
SmallInt: sqlTypeFactoryWithNoParams;
Bit: sqlTypeFactoryWithNoParams;
Float: sqlTypeFactoryWithNoParams;
Numeric: sqlTypeFactoryWithPrecisionScale;
Decimal: sqlTypeFactoryWithPrecisionScale;
Real: sqlTypeFactoryWithNoParams;
Date: sqlTypeFactoryWithNoParams;
DateTime: sqlTypeFactoryWithNoParams;
DateTime2: sqlTypeFactoryWithScale;
DateTimeOffset: sqlTypeFactoryWithScale;
SmallDateTime: sqlTypeFactoryWithNoParams;
Time: sqlTypeFactoryWithScale;
UniqueIdentifier: sqlTypeFactoryWithNoParams;
SmallMoney: sqlTypeFactoryWithNoParams;
Money: sqlTypeFactoryWithNoParams;
Binary: sqlTypeFactoryWithNoParams;
VarBinary: sqlTypeFactoryWithLength;
Image: sqlTypeFactoryWithNoParams;
Xml: sqlTypeFactoryWithNoParams;
Char: sqlTypeFactoryWithLength;
NChar: sqlTypeFactoryWithLength;
NText: sqlTypeFactoryWithNoParams;
TVP: sqlTypeFactoryWithTvpType;
UDT: sqlTypeFactoryWithNoParams;
Geography: sqlTypeFactoryWithNoParams;
Geometry: sqlTypeFactoryWithNoParams;
};
export var MAX: number;
export var fix: boolean;
export var Promise: any;
interface IMap extends Array<{js: any, sql: any }> {
register(jstype: any, sql: any): void;
}
export var map: IMap;
export var DRIVERS: string[];
type recordSet = any;
type IIsolationLevel = number;
export var ISOLATION_LEVEL: {
READ_UNCOMMITTED: IIsolationLevel
READ_COMMITTED: IIsolationLevel
REPEATABLE_READ: IIsolationLevel
SERIALIZABLE: IIsolationLevel
SNAPSHOT: IIsolationLevel
}
export interface IOptions {
encrypt: boolean;
}
export interface pool {
export interface IPool {
min: number;
max: number;
idleTimeoutMillis: number;
}
export var pool: IPool;
export interface config {
driver?: string;
user?: string;
@@ -59,18 +137,26 @@ declare module "mssql" {
connectionTimeout?: number;
requestTimeout?: number;
stream?: boolean;
options?: options;
pool?: pool;
options?: IOptions;
pool?: IPool;
}
export class Connection {
export class Connection extends events.EventEmitter {
public connected: boolean;
public connecting: boolean;
public driver: string;
public constructor(config: config, callback?: (err?: any) => void);
public connect(): Promise<void>;
public connect(callback: (err: any) => void): void;
public close(): Promise<void>;
public close(callback: (err: any) => void): void;
}
public connect(callback?: (err?: any) => void): void;
public close(): void;
export class ConnectionError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
class columns {
@@ -78,7 +164,7 @@ declare module "mssql" {
}
class rows {
public add(row: any): void;
public add(...row: any[]): void;
}
export class Table {
@@ -86,37 +172,97 @@ declare module "mssql" {
public columns: columns;
public rows: rows;
public constructor(tableName: string);
}
export class Request {
interface IRequestParameters {
[name: string]: {
name: string;
type: any;
io: number;
value: any;
length: number;
scale: number;
precision: number;
tvpType: any;
}
}
export class Request extends events.EventEmitter {
public connection: Connection;
public transaction: Transaction;
public pstatement: PreparedStatement;
public parameters: IRequestParameters;
public verbose: boolean;
public multiple: boolean;
public canceled: boolean;
public stream: any;
public constructor(connection?: Connection);
public execute(procedure: string, callback?: (err?: any, recordsets?: any, returnValue?: any) => void): void;
public constructor(transaction: Transaction);
public constructor(preparedStatement: PreparedStatement);
public execute(procedure: string): Promise<recordSet>;
public execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void;
public input(name: string, value: any): void;
public input(name: string, type: any, value: any): void;
public output(name: string, type: any, value?: any): void;
public pipe(stream: any): void;
public query(command: string, callback?: (err?: any, recordset?: any) => void): void;
public batch(batch: string, callback?: (err?: any, recordset?: any) => void): void;
public bulk(table: Table, callback?: (err?: any, rowCount?: any) => void): void;
public pipe(stream: NodeJS.WritableStream): void;
public query(command: string): Promise<void>;
public query(command: string, callback: (err?: any, recordset?: any) => void): void;
public batch(batch: string): Promise<recordSet>;
public batch(batch: string, callback: (err?: any, recordset?: any) => void): void;
public bulk(table: Table): Promise<void>;
public bulk(table: Table, callback: (err: any, rowCount: any) => void): void;
public cancel(): void;
public parameters: any;
}
export class Transaction {
export class RequestError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
export class Transaction extends events.EventEmitter {
public connection: Connection;
public isolationLevel: IIsolationLevel;
public constructor(connection?: Connection);
public begin(isolationLevel?: any, callback?: (err?: any) => void): void;
public begin(callback?: (err?: any) => void): void;
public commit(callback?: (err?: any) => void): void;
public rollback(callback?: (err?: any) => void): void;
public begin(isolationLevel?: IIsolationLevel): Promise<void>;
public begin(isolationLevel?: IIsolationLevel, callback?: (err?: any) => void): void;
public commit(): Promise<void>;
public commit(callback: (err?: any) => void): void;
public rollback(): Promise<void>;
public rollback(callback: (err?: any) => void): void;
}
export class PreparedStatement {
export class TransactionError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
export class PreparedStatement extends events.EventEmitter {
public connection: Connection;
public transaction: Transaction;
public prepared: boolean;
public statement: string;
public parameters: IRequestParameters;
public multiple: boolean;
public stream: any;
public constructor(connection?: Connection);
public input(name: string, type: any): void;
public output(name: string, type: any): void;
public prepare(statement: string, callback?: (err?: any) => void): void;
public execute(values: any, callback?: (err?: any) => void): void;
public unprepare(callback?: (err?: any) => void): void;
public prepare(statement?: string): Promise<void>;
public prepare(statement?: string, callback?: (err?: any) => void): void;
public execute(values: Object): Promise<recordSet>;
public execute(values: Object, callback: (err: any, recordSet: recordSet) => void): void;
public unprepare(): Promise<void>;
public unprepare(callback: (err?: any) => void): void;
}
export class PreparedStatementError implements Error {
constructor(message: string, code?: any)
public name: string;
public message: string;
public code: string;
}
}
+2
View File
@@ -34,6 +34,8 @@ assert.doesNotThrow(() => {
fs.writeFile("thebible.txt",
"Do unto others as you would have them do unto you.",
assert.ifError);
fs.write(1234, "test");
fs.writeFile("Harry Potter",
"\"You be wizzing, Harry,\" jived Dumbledore.",
+22 -29
View File
@@ -1062,6 +1062,7 @@ declare module "fs" {
atime: Date;
mtime: Date;
ctime: Date;
birthtime: Date;
}
interface FSWatcher extends events.EventEmitter {
@@ -1214,6 +1215,9 @@ declare module "fs" {
export function fsyncSync(fd: number): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function write(fd: number, data: any, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, encoding: string, callback?: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
@@ -1671,14 +1675,13 @@ declare module "stream" {
readable: boolean;
constructor(opts?: ReadableOptions);
_read(size: number): void;
read(size?: number): string|Buffer;
read(size?: number): any;
setEncoding(encoding: string): void;
pause(): void;
resume(): void;
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
unshift(chunk: string): void;
unshift(chunk: Buffer): void;
unshift(chunk: any): void;
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
push(chunk: any, encoding?: string): boolean;
}
@@ -1691,15 +1694,12 @@ declare module "stream" {
export class Writable extends events.EventEmitter implements NodeJS.WritableStream {
writable: boolean;
constructor(opts?: WritableOptions);
_write(data: Buffer, encoding: string, callback: Function): void;
_write(data: string, encoding: string, callback: Function): void;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
_write(chunk: any, encoding: string, callback: Function): void;
write(chunk: any, cb?: Function): boolean;
write(chunk: any, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
end(chunk: any, cb?: Function): void;
end(chunk: any, encoding?: string, cb?: Function): void;
}
export interface DuplexOptions extends ReadableOptions, WritableOptions {
@@ -1710,15 +1710,12 @@ declare module "stream" {
export class Duplex extends Readable implements NodeJS.ReadWriteStream {
writable: boolean;
constructor(opts?: DuplexOptions);
_write(data: Buffer, encoding: string, callback: Function): void;
_write(data: string, encoding: string, callback: Function): void;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
_write(chunk: any, encoding: string, callback: Function): void;
write(chunk: any, cb?: Function): boolean;
write(chunk: any, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
end(chunk: any, cb?: Function): void;
end(chunk: any, encoding?: string, cb?: Function): void;
}
export interface TransformOptions extends ReadableOptions, WritableOptions {}
@@ -1728,8 +1725,7 @@ declare module "stream" {
readable: boolean;
writable: boolean;
constructor(opts?: TransformOptions);
_transform(chunk: Buffer, encoding: string, callback: Function): void;
_transform(chunk: string, encoding: string, callback: Function): void;
_transform(chunk: any, encoding: string, callback: Function): void;
_flush(callback: Function): void;
read(size?: number): any;
setEncoding(encoding: string): void;
@@ -1737,17 +1733,14 @@ declare module "stream" {
resume(): void;
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
unpipe<T extends NodeJS.WritableStream>(destination?: T): void;
unshift(chunk: string): void;
unshift(chunk: Buffer): void;
unshift(chunk: any): void;
wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream;
push(chunk: any, encoding?: string): boolean;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
write(str: string, encoding?: string, cb?: Function): boolean;
write(chunk: any, cb?: Function): boolean;
write(chunk: any, encoding?: string, cb?: Function): boolean;
end(): void;
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
end(chunk: any, cb?: Function): void;
end(chunk: any, encoding?: string, cb?: Function): void;
}
export class PassThrough extends Transform {}
+9
View File
@@ -0,0 +1,9 @@
/// <reference path="./qs.d.ts" />
import qs = require('qs');
qs.stringify({ a: 'b' });
qs.stringify({ a: 'b', c: 'd' }, { delimiter: '&' });
qs.parse('a=b');
qs.parse('a=b&c=d', { delimiter: '&' });
Vendored
+35
View File
@@ -0,0 +1,35 @@
// Type definitions for qs
// Project: https://github.com/hapijs/qs
// Definitions by: Roman Korneev <https://github.com/RWander>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module QueryString {
interface IStringifyOptions {
delimiter?: string;
strictNullHandling?: boolean;
skipNulls?: boolean;
encode?: boolean;
filter?: any;
arrayFormat?: any;
indices?: string;
}
interface IParseOptions {
delimiter?: string;
depth?: number;
arrayLimit?: number;
parseArrays?: boolean;
allowDots?: boolean;
plainObjects?: boolean;
allowPrototypes?: boolean;
parameterLimit?: number;
strictNullHandling?: boolean;
}
function stringify(obj: any, options?: IStringifyOptions): string;
function parse(str: string, options?: IParseOptions): any;
}
declare module "qs" {
export = QueryString;
}
+2 -2
View File
@@ -135,7 +135,7 @@ declare namespace __React {
constructor(props?: P, context?: any);
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
setState(state: S, callback?: () => any): void;
forceUpdate(): void;
forceUpdate(callBack?: () => any): void;
render(): JSX.Element;
props: P;
state: S;
@@ -932,7 +932,7 @@ declare module "react/addons" {
constructor(props?: P, context?: any);
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
setState(state: S, callback?: () => any): void;
forceUpdate(): void;
forceUpdate(callBack?: () => any): void;
render(): JSX.Element;
props: P;
state: S;
+29 -3
View File
@@ -4,6 +4,7 @@ import redis = require('redis');
var value: any;
var valueArr: any[];
var commandArr: any[][];
var num: number;
var str: string;
var bool: boolean;
@@ -40,6 +41,7 @@ client.end();
// Connection (http://redis.io/commands#connection)
client.auth(str, resCallback);
client.ping(numCallback);
client.unref();
// Strings (http://redis.io/commands#strings)
client.append(str, str, numCallback);
@@ -49,9 +51,7 @@ client.set(str, str, strCallback);
client.get(str, strCallback);
client.exists(str, numCallback);
client.publish(str, value);
client.subscribe(str);
// Event handlers
client.on(str, messageHandler);
client.once(str, messageHandler);
@@ -62,5 +62,31 @@ client.get(args);
client.get(args, resCallback);
client.set(args);
client.set(args, resCallback);
client.mset(args, resCallback);
client.incr(str, resCallback);
// Friendlier hash commands
client.hgetall(str, resCallback);
client.hmset(str, value, resCallback);
client.hmset(str, str, str, str, str, resCallback);
// Publish / Subscribe
client.publish(str, value);
client.subscribe(str);
// Multi
client.multi()
.scard(str)
.smembers(str)
.keys('*', resCallback)
.dbsize()
.exec(resCallback);
client.multi(commandArr).exec();
// Monitor mode
client.monitor(resCallback);
// Send command
client.send_command(str, args, resCallback);
+604 -332
View File
@@ -1,6 +1,6 @@
// Type definitions for redis
// Type definitions for redis 0.12.1
// Project: https://github.com/mranney/node_redis
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>, Peter Harris <https://github.com/CodeAnimal>
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>, Peter Harris <https://github.com/CodeAnimal>, TANAKA Koichi <https://github.com/MugeSo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts
@@ -8,347 +8,619 @@
/// <reference path="../node/node.d.ts" />
declare module "redis" {
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;
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;
interface MessageHandler {
(channel: string, message: any): void;
}
export function print(err:Error, reply: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;
}
export var debug_mode:boolean;
interface ResCallbackT<R> {
(err: Error, res: R): void;
}
interface MessageHandler {
(channel:string, message:any): void;
}
interface ServerInfo {
redis_version: string;
versions: number[];
}
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 ClientOpts {
parser?: string;
return_buffers?: boolean;
detect_buffers?: boolean;
socket_nodelay?: boolean;
no_ready_check?: boolean;
enable_offline_queue?: boolean;
retry_max_delay?: number;
connect_timeout?: number;
max_attempts?: number;
auth_pass?: string;
}
interface ResCallbackT<R> {
(err:Error, res:R): void;
}
interface RedisClient extends NodeJS.EventEmitter {
// event: connect
// event: error
// event: message
// event: pmessage
// event: subscribe
// event: psubscribe
// event: unsubscribe
// event: punsubscribe
interface ServerInfo {
redis_version: string;
versions: number[];
}
connected: boolean;
retry_delay: number;
retry_backoff: number;
command_queue: any[];
offline_queue: any[];
server_info: ServerInfo;
interface ClientOpts {
parser?: string;
return_buffers?: boolean;
detect_buffers?: boolean;
socket_nodelay?: boolean;
socket_keepalive?: boolean;
no_ready_check?: boolean;
enable_offline_queue?: boolean;
retry_max_delay?: number;
connect_timeout?: number;
max_attempts?: number;
auth_pass?: string;
family?: string;
command_queue_high_water?: number;
command_queue_low_water?: number;
}
end(): void;
interface RedisClient extends NodeJS.EventEmitter {
// event: connect
// event: error
// event: message
// event: pmessage
// event: subscribe
// event: psubscribe
// event: unsubscribe
// event: punsubscribe
// Connection (http://redis.io/commands#connection)
auth(password: string, callback?: ResCallbackT<any>): void;
ping(callback?: ResCallbackT<number>): void;
connected: boolean;
retry_delay: number;
retry_backoff: number;
command_queue: any[];
offline_queue: any[];
server_info: ServerInfo;
// 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;
end(): void;
unref(): void;
publish(channel: string, value: any): void;
subscribe(channel: string): void;
// Low level command execution
send_command(command:string, ...args:any[]): boolean;
/*
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"));
*/
// Connection (http://redis.io/commands#connection)
auth(password:string, callback?:ResCallbackT<any>): boolean;
ping(callback?:ResCallbackT<number>): boolean;
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;
}
// Strings (http://redis.io/commands#strings)
append(key:string, value:string, callback?:ResCallbackT<number>): boolean;
bitcount(key:string, callback?:ResCallbackT<number>): boolean;
bitcount(key:string, start:number, end:number, callback?:ResCallbackT<number>): boolean;
set(key:string, value:string, callback?:ResCallbackT<string>): boolean;
get(key:string, callback?:ResCallbackT<string>): boolean;
exists(key:string, value:string, callback?:ResCallbackT<number>): boolean;
publish(channel:string, value:any): boolean;
subscribe(channel:string): boolean;
/*
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?:ResCallbackT<string>): boolean;
get(...args:any[]): boolean;
set(args:any[], callback?:ResCallbackT<string>): boolean;
set(...args:any[]): boolean;
setnx(args:any[], callback?:ResCallbackT<any>): boolean;
setnx(...args:any[]): boolean;
setex(args:any[], callback?:ResCallbackT<any>): boolean;
setex(...args:any[]): boolean;
append(args:any[], callback?:ResCallbackT<any>): boolean;
append(...args:any[]): boolean;
strlen(args:any[], callback?:ResCallbackT<any>): boolean;
strlen(...args:any[]): boolean;
del(args:any[], callback?:ResCallbackT<any>): boolean;
del(...args:any[]): boolean;
exists(args:any[], callback?:ResCallbackT<any>): boolean;
exists(...args:any[]): boolean;
setbit(args:any[], callback?:ResCallbackT<any>): boolean;
setbit(...args:any[]): boolean;
getbit(args:any[], callback?:ResCallbackT<any>): boolean;
getbit(...args:any[]): boolean;
setrange(args:any[], callback?:ResCallbackT<any>): boolean;
setrange(...args:any[]): boolean;
getrange(args:any[], callback?:ResCallbackT<any>): boolean;
getrange(...args:any[]): boolean;
substr(args:any[], callback?:ResCallbackT<any>): boolean;
substr(...args:any[]): boolean;
incr(args:any[], callback?:ResCallbackT<any>): boolean;
incr(...args:any[]): boolean;
decr(args:any[], callback?:ResCallbackT<any>): boolean;
decr(...args:any[]): boolean;
mget(args:any[], callback?:ResCallbackT<any>): boolean;
mget(...args:any[]): boolean;
rpush(...args:any[]): boolean;
lpush(args:any[], callback?:ResCallbackT<any>): boolean;
lpush(...args:any[]): boolean;
rpushx(args:any[], callback?:ResCallbackT<any>): boolean;
rpushx(...args:any[]): boolean;
lpushx(args:any[], callback?:ResCallbackT<any>): boolean;
lpushx(...args:any[]): boolean;
linsert(args:any[], callback?:ResCallbackT<any>): boolean;
linsert(...args:any[]): boolean;
rpop(args:any[], callback?:ResCallbackT<any>): boolean;
rpop(...args:any[]): boolean;
lpop(args:any[], callback?:ResCallbackT<any>): boolean;
lpop(...args:any[]): boolean;
brpop(args:any[], callback?:ResCallbackT<any>): boolean;
brpop(...args:any[]): boolean;
brpoplpush(args:any[], callback?:ResCallbackT<any>): boolean;
brpoplpush(...args:any[]): boolean;
blpop(args:any[], callback?:ResCallbackT<any>): boolean;
blpop(...args:any[]): boolean;
llen(args:any[], callback?:ResCallbackT<any>): boolean;
llen(...args:any[]): boolean;
lindex(args:any[], callback?:ResCallbackT<any>): boolean;
lindex(...args:any[]): boolean;
lset(args:any[], callback?:ResCallbackT<any>): boolean;
lset(...args:any[]): boolean;
lrange(args:any[], callback?:ResCallbackT<any>): boolean;
lrange(...args:any[]): boolean;
ltrim(args:any[], callback?:ResCallbackT<any>): boolean;
ltrim(...args:any[]): boolean;
lrem(args:any[], callback?:ResCallbackT<any>): boolean;
lrem(...args:any[]): boolean;
rpoplpush(args:any[], callback?:ResCallbackT<any>): boolean;
rpoplpush(...args:any[]): boolean;
sadd(args:any[], callback?:ResCallbackT<any>): boolean;
sadd(...args:any[]): boolean;
srem(args:any[], callback?:ResCallbackT<any>): boolean;
srem(...args:any[]): boolean;
smove(args:any[], callback?:ResCallbackT<any>): boolean;
smove(...args:any[]): boolean;
sismember(args:any[], callback?:ResCallbackT<any>): boolean;
sismember(...args:any[]): boolean;
scard(args:any[], callback?:ResCallbackT<any>): boolean;
scard(...args:any[]): boolean;
spop(args:any[], callback?:ResCallbackT<any>): boolean;
spop(...args:any[]): boolean;
srandmember(args:any[], callback?:ResCallbackT<any>): boolean;
srandmember(...args:any[]): boolean;
sinter(args:any[], callback?:ResCallbackT<any>): boolean;
sinter(...args:any[]): boolean;
sinterstore(args:any[], callback?:ResCallbackT<any>): boolean;
sinterstore(...args:any[]): boolean;
sunion(args:any[], callback?:ResCallbackT<any>): boolean;
sunion(...args:any[]): boolean;
sunionstore(args:any[], callback?:ResCallbackT<any>): boolean;
sunionstore(...args:any[]): boolean;
sdiff(args:any[], callback?:ResCallbackT<any>): boolean;
sdiff(...args:any[]): boolean;
sdiffstore(args:any[], callback?:ResCallbackT<any>): boolean;
sdiffstore(...args:any[]): boolean;
smembers(args:any[], callback?:ResCallbackT<any>): boolean;
smembers(...args:any[]): boolean;
zadd(args:any[], callback?:ResCallbackT<any>): boolean;
zadd(...args:any[]): boolean;
zincrby(args:any[], callback?:ResCallbackT<any>): boolean;
zincrby(...args:any[]): boolean;
zrem(args:any[], callback?:ResCallbackT<any>): boolean;
zrem(...args:any[]): boolean;
zremrangebyscore(args:any[], callback?:ResCallbackT<any>): boolean;
zremrangebyscore(...args:any[]): boolean;
zremrangebyrank(args:any[], callback?:ResCallbackT<any>): boolean;
zremrangebyrank(...args:any[]): boolean;
zunionstore(args:any[], callback?:ResCallbackT<any>): boolean;
zunionstore(...args:any[]): boolean;
zinterstore(args:any[], callback?:ResCallbackT<any>): boolean;
zinterstore(...args:any[]): boolean;
zrange(args:any[], callback?:ResCallbackT<any>): boolean;
zrange(...args:any[]): boolean;
zrangebyscore(args:any[], callback?:ResCallbackT<any>): boolean;
zrangebyscore(...args:any[]): boolean;
zrevrangebyscore(args:any[], callback?:ResCallbackT<any>): boolean;
zrevrangebyscore(...args:any[]): boolean;
zcount(args:any[], callback?:ResCallbackT<any>): boolean;
zcount(...args:any[]): boolean;
zrevrange(args:any[], callback?:ResCallbackT<any>): boolean;
zrevrange(...args:any[]): boolean;
zcard(args:any[], callback?:ResCallbackT<any>): boolean;
zcard(...args:any[]): boolean;
zscore(args:any[], callback?:ResCallbackT<any>): boolean;
zscore(...args:any[]): boolean;
zrank(args:any[], callback?:ResCallbackT<any>): boolean;
zrank(...args:any[]): boolean;
zrevrank(args:any[], callback?:ResCallbackT<any>): boolean;
zrevrank(...args:any[]): boolean;
hset(args:any[], callback?:ResCallbackT<any>): boolean;
hset(...args:any[]): boolean;
hsetnx(args:any[], callback?:ResCallbackT<any>): boolean;
hsetnx(...args:any[]): boolean;
hget(args:any[], callback?:ResCallbackT<any>): boolean;
hget(...args:any[]): boolean;
hmset(args:any[], callback?:ResCallbackT<any>): boolean;
hmset(key:string, hash:any, callback?:ResCallbackT<any>): boolean;
hmset(...args:any[]): boolean;
hmget(args:any[], callback?:ResCallbackT<any>): boolean;
hmget(...args:any[]): boolean;
hincrby(args:any[], callback?:ResCallbackT<any>): boolean;
hincrby(...args:any[]): boolean;
hdel(args:any[], callback?:ResCallbackT<any>): boolean;
hdel(...args:any[]): boolean;
hlen(args:any[], callback?:ResCallbackT<any>): boolean;
hlen(...args:any[]): boolean;
hkeys(args:any[], callback?:ResCallbackT<any>): boolean;
hkeys(...args:any[]): boolean;
hvals(args:any[], callback?:ResCallbackT<any>): boolean;
hvals(...args:any[]): boolean;
hgetall(args:any[], callback?:ResCallbackT<any>): boolean;
hgetall(...args:any[]): boolean;
hgetall(key:string, callback?:ResCallbackT<any>): boolean;
hexists(args:any[], callback?:ResCallbackT<any>): boolean;
hexists(...args:any[]): boolean;
incrby(args:any[], callback?:ResCallbackT<any>): boolean;
incrby(...args:any[]): boolean;
decrby(args:any[], callback?:ResCallbackT<any>): boolean;
decrby(...args:any[]): boolean;
getset(args:any[], callback?:ResCallbackT<any>): boolean;
getset(...args:any[]): boolean;
mset(args:any[], callback?:ResCallbackT<any>): boolean;
mset(...args:any[]): boolean;
msetnx(args:any[], callback?:ResCallbackT<any>): boolean;
msetnx(...args:any[]): boolean;
randomkey(args:any[], callback?:ResCallbackT<any>): boolean;
randomkey(...args:any[]): boolean;
select(args:any[], callback?:ResCallbackT<any>): void;
select(...args:any[]): void;
move(args:any[], callback?:ResCallbackT<any>): boolean;
move(...args:any[]): boolean;
rename(args:any[], callback?:ResCallbackT<any>): boolean;
rename(...args:any[]): boolean;
renamenx(args:any[], callback?:ResCallbackT<any>): boolean;
renamenx(...args:any[]): boolean;
expire(args:any[], callback?:ResCallbackT<any>): boolean;
expire(...args:any[]): boolean;
expireat(args:any[], callback?:ResCallbackT<any>): boolean;
expireat(...args:any[]): boolean;
keys(args:any[], callback?:ResCallbackT<any>): boolean;
keys(...args:any[]): boolean;
dbsize(args:any[], callback?:ResCallbackT<any>): boolean;
dbsize(...args:any[]): boolean;
auth(args:any[], callback?:ResCallbackT<any>): void;
auth(...args:any[]): void;
ping(args:any[], callback?:ResCallbackT<any>): boolean;
ping(...args:any[]): boolean;
echo(args:any[], callback?:ResCallbackT<any>): boolean;
echo(...args:any[]): boolean;
save(args:any[], callback?:ResCallbackT<any>): boolean;
save(...args:any[]): boolean;
bgsave(args:any[], callback?:ResCallbackT<any>): boolean;
bgsave(...args:any[]): boolean;
bgrewriteaof(args:any[], callback?:ResCallbackT<any>): boolean;
bgrewriteaof(...args:any[]): boolean;
shutdown(args:any[], callback?:ResCallbackT<any>): boolean;
shutdown(...args:any[]): boolean;
lastsave(args:any[], callback?:ResCallbackT<any>): boolean;
lastsave(...args:any[]): boolean;
type(args:any[], callback?:ResCallbackT<any>): boolean;
type(...args:any[]): boolean;
multi(args:any[], callback?:ResCallbackT<any>): Multi;
multi(...args:any[]): Multi;
exec(args:any[], callback?:ResCallbackT<any>): boolean;
exec(...args:any[]): boolean;
discard(args:any[], callback?:ResCallbackT<any>): boolean;
discard(...args:any[]): boolean;
sync(args:any[], callback?:ResCallbackT<any>): boolean;
sync(...args:any[]): boolean;
flushdb(args:any[], callback?:ResCallbackT<any>): boolean;
flushdb(...args:any[]): boolean;
flushall(args:any[], callback?:ResCallbackT<any>): boolean;
flushall(...args:any[]): boolean;
sort(args:any[], callback?:ResCallbackT<any>): boolean;
sort(...args:any[]): boolean;
info(args:any[], callback?:ResCallbackT<any>): boolean;
info(...args:any[]): boolean;
monitor(args:any[], callback?:ResCallbackT<any>): boolean;
monitor(...args:any[]): boolean;
ttl(args:any[], callback?:ResCallbackT<any>): boolean;
ttl(...args:any[]): boolean;
persist(args:any[], callback?:ResCallbackT<any>): boolean;
persist(...args:any[]): boolean;
slaveof(args:any[], callback?:ResCallbackT<any>): boolean;
slaveof(...args:any[]): boolean;
debug(args:any[], callback?:ResCallbackT<any>): boolean;
debug(...args:any[]): boolean;
config(args:any[], callback?:ResCallbackT<any>): boolean;
config(...args:any[]): boolean;
subscribe(args:any[], callback?:ResCallbackT<any>): boolean;
subscribe(...args:any[]): boolean;
unsubscribe(args:any[], callback?:ResCallbackT<any>): boolean;
unsubscribe(...args:any[]): boolean;
psubscribe(args:any[], callback?:ResCallbackT<any>): boolean;
psubscribe(...args:any[]): boolean;
punsubscribe(args:any[], callback?:ResCallbackT<any>): boolean;
punsubscribe(...args:any[]): boolean;
publish(args:any[], callback?:ResCallbackT<any>): boolean;
publish(...args:any[]): boolean;
watch(args:any[], callback?:ResCallbackT<any>): boolean;
watch(...args:any[]): boolean;
unwatch(args:any[], callback?:ResCallbackT<any>): boolean;
unwatch(...args:any[]): boolean;
cluster(args:any[], callback?:ResCallbackT<any>): boolean;
cluster(...args:any[]): boolean;
restore(args:any[], callback?:ResCallbackT<any>): boolean;
restore(...args:any[]): boolean;
migrate(args:any[], callback?:ResCallbackT<any>): boolean;
migrate(...args:any[]): boolean;
dump(args:any[], callback?:ResCallbackT<any>): boolean;
dump(...args:any[]): boolean;
object(args:any[], callback?:ResCallbackT<any>): boolean;
object(...args:any[]): boolean;
client(args:any[], callback?:ResCallbackT<any>): boolean;
client(...args:any[]): boolean;
eval(args:any[], callback?:ResCallbackT<any>): boolean;
eval(...args:any[]): boolean;
evalsha(args:any[], callback?:ResCallbackT<any>): boolean;
evalsha(...args:any[]): boolean;
quit(args:any[], callback?:ResCallbackT<any>): boolean;
quit(...args:any[]): boolean;
}
interface Multi {
exec(callback?:ResCallbackT<any[]>): boolean;
get(args:any[], callback?:ResCallbackT<string>): Multi;
get(...args:any[]): Multi;
set(args:any[], callback?:ResCallbackT<string>): Multi;
set(...args:any[]): Multi;
setnx(args:any[], callback?:ResCallbackT<any>): Multi;
setnx(...args:any[]): Multi;
setex(args:any[], callback?:ResCallbackT<any>): Multi;
setex(...args:any[]): Multi;
append(args:any[], callback?:ResCallbackT<any>): Multi;
append(...args:any[]): Multi;
strlen(args:any[], callback?:ResCallbackT<any>): Multi;
strlen(...args:any[]): Multi;
del(args:any[], callback?:ResCallbackT<any>): Multi;
del(...args:any[]): Multi;
exists(args:any[], callback?:ResCallbackT<any>): Multi;
exists(...args:any[]): Multi;
setbit(args:any[], callback?:ResCallbackT<any>): Multi;
setbit(...args:any[]): Multi;
getbit(args:any[], callback?:ResCallbackT<any>): Multi;
getbit(...args:any[]): Multi;
setrange(args:any[], callback?:ResCallbackT<any>): Multi;
setrange(...args:any[]): Multi;
getrange(args:any[], callback?:ResCallbackT<any>): Multi;
getrange(...args:any[]): Multi;
substr(args:any[], callback?:ResCallbackT<any>): Multi;
substr(...args:any[]): Multi;
incr(args:any[], callback?:ResCallbackT<any>): Multi;
incr(...args:any[]): Multi;
decr(args:any[], callback?:ResCallbackT<any>): Multi;
decr(...args:any[]): Multi;
mget(args:any[], callback?:ResCallbackT<any>): Multi;
mget(...args:any[]): Multi;
rpush(...args:any[]): Multi;
lpush(args:any[], callback?:ResCallbackT<any>): Multi;
lpush(...args:any[]): Multi;
rpushx(args:any[], callback?:ResCallbackT<any>): Multi;
rpushx(...args:any[]): Multi;
lpushx(args:any[], callback?:ResCallbackT<any>): Multi;
lpushx(...args:any[]): Multi;
linsert(args:any[], callback?:ResCallbackT<any>): Multi;
linsert(...args:any[]): Multi;
rpop(args:any[], callback?:ResCallbackT<any>): Multi;
rpop(...args:any[]): Multi;
lpop(args:any[], callback?:ResCallbackT<any>): Multi;
lpop(...args:any[]): Multi;
brpop(args:any[], callback?:ResCallbackT<any>): Multi;
brpop(...args:any[]): Multi;
brpoplpush(args:any[], callback?:ResCallbackT<any>): Multi;
brpoplpush(...args:any[]): Multi;
blpop(args:any[], callback?:ResCallbackT<any>): Multi;
blpop(...args:any[]): Multi;
llen(args:any[], callback?:ResCallbackT<any>): Multi;
llen(...args:any[]): Multi;
lindex(args:any[], callback?:ResCallbackT<any>): Multi;
lindex(...args:any[]): Multi;
lset(args:any[], callback?:ResCallbackT<any>): Multi;
lset(...args:any[]): Multi;
lrange(args:any[], callback?:ResCallbackT<any>): Multi;
lrange(...args:any[]): Multi;
ltrim(args:any[], callback?:ResCallbackT<any>): Multi;
ltrim(...args:any[]): Multi;
lrem(args:any[], callback?:ResCallbackT<any>): Multi;
lrem(...args:any[]): Multi;
rpoplpush(args:any[], callback?:ResCallbackT<any>): Multi;
rpoplpush(...args:any[]): Multi;
sadd(args:any[], callback?:ResCallbackT<any>): Multi;
sadd(...args:any[]): Multi;
srem(args:any[], callback?:ResCallbackT<any>): Multi;
srem(...args:any[]): Multi;
smove(args:any[], callback?:ResCallbackT<any>): Multi;
smove(...args:any[]): Multi;
sismember(args:any[], callback?:ResCallbackT<any>): Multi;
sismember(...args:any[]): Multi;
scard(args:any[], callback?:ResCallbackT<any>): Multi;
scard(...args:any[]): Multi;
spop(args:any[], callback?:ResCallbackT<any>): Multi;
spop(...args:any[]): Multi;
srandmember(args:any[], callback?:ResCallbackT<any>): Multi;
srandmember(...args:any[]): Multi;
sinter(args:any[], callback?:ResCallbackT<any>): Multi;
sinter(...args:any[]): Multi;
sinterstore(args:any[], callback?:ResCallbackT<any>): Multi;
sinterstore(...args:any[]): Multi;
sunion(args:any[], callback?:ResCallbackT<any>): Multi;
sunion(...args:any[]): Multi;
sunionstore(args:any[], callback?:ResCallbackT<any>): Multi;
sunionstore(...args:any[]): Multi;
sdiff(args:any[], callback?:ResCallbackT<any>): Multi;
sdiff(...args:any[]): Multi;
sdiffstore(args:any[], callback?:ResCallbackT<any>): Multi;
sdiffstore(...args:any[]): Multi;
smembers(args:any[], callback?:ResCallbackT<any>): Multi;
smembers(...args:any[]): Multi;
zadd(args:any[], callback?:ResCallbackT<any>): Multi;
zadd(...args:any[]): Multi;
zincrby(args:any[], callback?:ResCallbackT<any>): Multi;
zincrby(...args:any[]): Multi;
zrem(args:any[], callback?:ResCallbackT<any>): Multi;
zrem(...args:any[]): Multi;
zremrangebyscore(args:any[], callback?:ResCallbackT<any>): Multi;
zremrangebyscore(...args:any[]): Multi;
zremrangebyrank(args:any[], callback?:ResCallbackT<any>): Multi;
zremrangebyrank(...args:any[]): Multi;
zunionstore(args:any[], callback?:ResCallbackT<any>): Multi;
zunionstore(...args:any[]): Multi;
zinterstore(args:any[], callback?:ResCallbackT<any>): Multi;
zinterstore(...args:any[]): Multi;
zrange(args:any[], callback?:ResCallbackT<any>): Multi;
zrange(...args:any[]): Multi;
zrangebyscore(args:any[], callback?:ResCallbackT<any>): Multi;
zrangebyscore(...args:any[]): Multi;
zrevrangebyscore(args:any[], callback?:ResCallbackT<any>): Multi;
zrevrangebyscore(...args:any[]): Multi;
zcount(args:any[], callback?:ResCallbackT<any>): Multi;
zcount(...args:any[]): Multi;
zrevrange(args:any[], callback?:ResCallbackT<any>): Multi;
zrevrange(...args:any[]): Multi;
zcard(args:any[], callback?:ResCallbackT<any>): Multi;
zcard(...args:any[]): Multi;
zscore(args:any[], callback?:ResCallbackT<any>): Multi;
zscore(...args:any[]): Multi;
zrank(args:any[], callback?:ResCallbackT<any>): Multi;
zrank(...args:any[]): Multi;
zrevrank(args:any[], callback?:ResCallbackT<any>): Multi;
zrevrank(...args:any[]): Multi;
hset(args:any[], callback?:ResCallbackT<any>): Multi;
hset(...args:any[]): Multi;
hsetnx(args:any[], callback?:ResCallbackT<any>): Multi;
hsetnx(...args:any[]): Multi;
hget(args:any[], callback?:ResCallbackT<any>): Multi;
hget(...args:any[]): Multi;
hmset(args:any[], callback?:ResCallbackT<any>): Multi;
hmset(key:string, hash:any, callback?:ResCallbackT<any>): Multi;
hmset(...args:any[]): Multi;
hmget(args:any[], callback?:ResCallbackT<any>): Multi;
hmget(...args:any[]): Multi;
hincrby(args:any[], callback?:ResCallbackT<any>): Multi;
hincrby(...args:any[]): Multi;
hdel(args:any[], callback?:ResCallbackT<any>): Multi;
hdel(...args:any[]): Multi;
hlen(args:any[], callback?:ResCallbackT<any>): Multi;
hlen(...args:any[]): Multi;
hkeys(args:any[], callback?:ResCallbackT<any>): Multi;
hkeys(...args:any[]): Multi;
hvals(args:any[], callback?:ResCallbackT<any>): Multi;
hvals(...args:any[]): Multi;
hgetall(args:any[], callback?:ResCallbackT<any>): Multi;
hgetall(...args:any[]): Multi;
hgetall(key:string, callback?:ResCallbackT<any>): Multi;
hexists(args:any[], callback?:ResCallbackT<any>): Multi;
hexists(...args:any[]): Multi;
incrby(args:any[], callback?:ResCallbackT<any>): Multi;
incrby(...args:any[]): Multi;
decrby(args:any[], callback?:ResCallbackT<any>): Multi;
decrby(...args:any[]): Multi;
getset(args:any[], callback?:ResCallbackT<any>): Multi;
getset(...args:any[]): Multi;
mset(args:any[], callback?:ResCallbackT<any>): Multi;
mset(...args:any[]): Multi;
msetnx(args:any[], callback?:ResCallbackT<any>): Multi;
msetnx(...args:any[]): Multi;
randomkey(args:any[], callback?:ResCallbackT<any>): Multi;
randomkey(...args:any[]): Multi;
select(args:any[], callback?:ResCallbackT<any>): void;
select(...args:any[]): Multi;
move(args:any[], callback?:ResCallbackT<any>): Multi;
move(...args:any[]): Multi;
rename(args:any[], callback?:ResCallbackT<any>): Multi;
rename(...args:any[]): Multi;
renamenx(args:any[], callback?:ResCallbackT<any>): Multi;
renamenx(...args:any[]): Multi;
expire(args:any[], callback?:ResCallbackT<any>): Multi;
expire(...args:any[]): Multi;
expireat(args:any[], callback?:ResCallbackT<any>): Multi;
expireat(...args:any[]): Multi;
keys(args:any[], callback?:ResCallbackT<any>): Multi;
keys(...args:any[]): Multi;
dbsize(args:any[], callback?:ResCallbackT<any>): Multi;
dbsize(...args:any[]): Multi;
auth(args:any[], callback?:ResCallbackT<any>): void;
auth(...args:any[]): void;
ping(args:any[], callback?:ResCallbackT<any>): Multi;
ping(...args:any[]): Multi;
echo(args:any[], callback?:ResCallbackT<any>): Multi;
echo(...args:any[]): Multi;
save(args:any[], callback?:ResCallbackT<any>): Multi;
save(...args:any[]): Multi;
bgsave(args:any[], callback?:ResCallbackT<any>): Multi;
bgsave(...args:any[]): Multi;
bgrewriteaof(args:any[], callback?:ResCallbackT<any>): Multi;
bgrewriteaof(...args:any[]): Multi;
shutdown(args:any[], callback?:ResCallbackT<any>): Multi;
shutdown(...args:any[]): Multi;
lastsave(args:any[], callback?:ResCallbackT<any>): Multi;
lastsave(...args:any[]): Multi;
type(args:any[], callback?:ResCallbackT<any>): Multi;
type(...args:any[]): Multi;
multi(args:any[], callback?:ResCallbackT<any>): Multi;
multi(...args:any[]): Multi;
exec(args:any[], callback?:ResCallbackT<any>): Multi;
exec(...args:any[]): Multi;
discard(args:any[], callback?:ResCallbackT<any>): Multi;
discard(...args:any[]): Multi;
sync(args:any[], callback?:ResCallbackT<any>): Multi;
sync(...args:any[]): Multi;
flushdb(args:any[], callback?:ResCallbackT<any>): Multi;
flushdb(...args:any[]): Multi;
flushall(args:any[], callback?:ResCallbackT<any>): Multi;
flushall(...args:any[]): Multi;
sort(args:any[], callback?:ResCallbackT<any>): Multi;
sort(...args:any[]): Multi;
info(args:any[], callback?:ResCallbackT<any>): Multi;
info(...args:any[]): Multi;
monitor(args:any[], callback?:ResCallbackT<any>): Multi;
monitor(...args:any[]): Multi;
ttl(args:any[], callback?:ResCallbackT<any>): Multi;
ttl(...args:any[]): Multi;
persist(args:any[], callback?:ResCallbackT<any>): Multi;
persist(...args:any[]): Multi;
slaveof(args:any[], callback?:ResCallbackT<any>): Multi;
slaveof(...args:any[]): Multi;
debug(args:any[], callback?:ResCallbackT<any>): Multi;
debug(...args:any[]): Multi;
config(args:any[], callback?:ResCallbackT<any>): Multi;
config(...args:any[]): Multi;
subscribe(args:any[], callback?:ResCallbackT<any>): Multi;
subscribe(...args:any[]): Multi;
unsubscribe(args:any[], callback?:ResCallbackT<any>): Multi;
unsubscribe(...args:any[]): Multi;
psubscribe(args:any[], callback?:ResCallbackT<any>): Multi;
psubscribe(...args:any[]): Multi;
punsubscribe(args:any[], callback?:ResCallbackT<any>): Multi;
punsubscribe(...args:any[]): Multi;
publish(args:any[], callback?:ResCallbackT<any>): Multi;
publish(...args:any[]): Multi;
watch(args:any[], callback?:ResCallbackT<any>): Multi;
watch(...args:any[]): Multi;
unwatch(args:any[], callback?:ResCallbackT<any>): Multi;
unwatch(...args:any[]): Multi;
cluster(args:any[], callback?:ResCallbackT<any>): Multi;
cluster(...args:any[]): Multi;
restore(args:any[], callback?:ResCallbackT<any>): Multi;
restore(...args:any[]): Multi;
migrate(args:any[], callback?:ResCallbackT<any>): Multi;
migrate(...args:any[]): Multi;
dump(args:any[], callback?:ResCallbackT<any>): Multi;
dump(...args:any[]): Multi;
object(args:any[], callback?:ResCallbackT<any>): Multi;
object(...args:any[]): Multi;
client(args:any[], callback?:ResCallbackT<any>): Multi;
client(...args:any[]): Multi;
eval(args:any[], callback?:ResCallbackT<any>): Multi;
eval(...args:any[]): Multi;
evalsha(args:any[], callback?:ResCallbackT<any>): Multi;
evalsha(...args:any[]): Multi;
quit(args:any[], callback?:ResCallbackT<any>): Multi;
quit(...args:any[]): Multi;
}
}
-1
View File
@@ -39,7 +39,6 @@ declare module RedlockTypes {
servers: any[]; // array of redis.RedisClient
constructor(clients: any[], options?: RedlockOptions);
//new (clients: any[], options?: IRedlockOptions);
acquire(resource: string, ttl: number, callback?: NodeifyCallback<Lock>): Promise<Lock>;
lock(resource: string, ttl: number, callback?: NodeifyCallback<Lock>): Promise<Lock>;
+41
View File
@@ -0,0 +1,41 @@
/// <reference path="./riotcontrol.d.ts" />
import riotcontrol = require('riotcontrol');
{
let store: RiotControl.Store;
let result: void;
result = riotcontrol.addStore(store);
}
{
let events: string;
let fn: Function;
let result: void;
result = riotcontrol.on(events, fn);
}
{
let name: string;
let fn: Function;
let result: void;
result = riotcontrol.one(name, fn);
}
{
let events: string;
let fn: Function;
let result: void;
result = riotcontrol.off(events);
result = riotcontrol.off(events, fn);
}
{
let name: string;
let arg: any;
let result: void;
result = riotcontrol.trigger(name);
result = riotcontrol.trigger(name, arg);
result = riotcontrol.trigger(name, arg, arg);
result = riotcontrol.trigger(name, arg, arg, arg);
}
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for RiotControl
// Project: https://github.com/jimsparkman/RiotControl
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module RiotControl {
interface Store {
on(events: string, fn: Function): Store;
one(name: string, fn: Function): Store;
off(events: string, fn?: Function): Store;
trigger(name: string, ...args: any[]): Store;
}
var _stores: Store[];
function addStore(store: Store): void;
function on(events: string, fn: Function): void;
function one(name: string, fn: Function): void;
function off(events: string, fn?: Function): void;
function trigger(name: string, ...args: any[]): void;
}
declare module "riotcontrol" {
export = RiotControl;
}
+2 -2
View File
@@ -7,9 +7,9 @@ var promise: Promise<number> = new Promise<number>(function (resolve, reject) {}
promise.should.be.Promise;
(10).should.not.be.a.Promise;
promise.should.be.fulfilled;
promise.should.be.fulfilled();
promise.should.be.rejected;
promise.should.be.rejected();
promise.should.be.rejectedWith(Error);
promise.should.be.rejectedWith('boom');
+2 -2
View File
@@ -5,8 +5,8 @@
interface ShouldAssertion {
Promise: ShouldAssertion;
fulfilled: ShouldAssertion;
rejected: ShouldAssertion;
fulfilled(): ShouldAssertion;
rejected(): ShouldAssertion;
rejectedWith(message: (string | Function | RegExp), properties?: Object): ShouldAssertion;
rejectedWith(message: Object): ShouldAssertion;
finally: ShouldAssertion;
+4 -4
View File
@@ -3,9 +3,9 @@
// Definitions by: Gregor Woiwode <https://github.com/gregonnet>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface SimplebarOpions {
interface SimplebarOptions {
autoHide?: boolean;
wrapContent?: boolean
wrapContent?: boolean;
}
interface JQuery {
@@ -18,7 +18,7 @@ interface JQuery {
*
* @param indicator if scrollbar should be faded out automatically.
*/
(options?: SimplebarOpions): JQuery;
(options?: SimplebarOptions): JQuery;
};
}
@@ -32,6 +32,6 @@ interface JQueryStatic {
*
* @param indicator if scrollbar should be faded out automatically.
*/
(options?: SimplebarOpions): JQuery;
(options?: SimplebarOptions): JQuery;
};
}
+3 -3
View File
@@ -1530,9 +1530,9 @@ declare module Slick {
public expandGroup(...varArgs: string[]): void;
public getGroups(): Group<T, any>[];
public getIdxById(id: string): number;
public getRowById(): T;
public getRowById(id: string): number;
public getItemById(id: any): T;
public getItemByIdx(): T;
public getItemByIdx(idx: number): T;
public mapRowsToIds(rowArray: T[]): string[];
public setRefreshHints(hints: RefreshHints): void;
public setFilterArgs(args: any): void;
@@ -1546,7 +1546,7 @@ declare module Slick {
public getLength(): number;
public getItem(index: number): T;
public getItemMetadata(index?: number): void;
public getItemMetadata(index?: number): TotalsRowMetadata<T>;
public onRowCountChanged: Slick.Event<OnRowCountChangedEventData>;
public onRowsChanged: Slick.Event<OnRowsChangedEventData>;
+58
View File
@@ -0,0 +1,58 @@
/// <reference path="../socket.io/socket.io.d.ts"/>
/// <reference path="socket.io.users.d.ts" />
/// <reference path="../node/node.d.ts" />
/// <reference path="../express/express.d.ts" />
var express = require('express');
var app = express();
var httpServer = require('http').createServer(app);
var io = require('socket.io')(httpServer);
import ioUsers = require("socket.io.users");
ioUsers.Session(app, {
"secret": "socket.io.users secret test",
"resave": true,
"saveUninitialized": true
});
io.use(ioUsers.Middleware());
var users = ioUsers.Users.of("/");
var userDisconnected = (user: ioUsers.User) => {
console.log(user.get("username") + " has disconnected from all web browser windows or/and tabs");
}
var setUsername = (user: ioUsers.User, data: any) => {
console.log(user.ip + ' is for first time visiting our site. He/she wants ' + data.username + ' for username');
user.set("username", data.username);
}
var joinRoom = (user: ioUsers.User, roomToJoin: string) => {
console.log(user.get("username") + ' joined to ' + roomToJoin);
}
var leaveRoom = (user: ioUsers.User, roomToJoin: string) => {
console.log(user.get("username") + ' joined to ' + roomToJoin);
}
var sendMessage = (user: ioUsers.User, data: any) => {
console.log(user.get("username") + 'send ' + data.content + ' to room: ' + data.room);
}
users.on('disconnected', userDisconnected);
users.on('set username', setUsername);
users.on('join room', joinRoom); //notify other = user joined room or (GLOBAL) room created.
users.on('leave room', leaveRoom); //notify other = user left room or (GLOBAL) room removed.
users.on("send message", sendMessage); //notify other = receive message.
httpServer.on('uncaughtException', function(err: any) {
console.log(err);
})
var httpPort = 80;
httpServer.listen(httpPort, function() {
console.log("Server is running on " + httpPort);
});
+79
View File
@@ -0,0 +1,79 @@
// Type definitions for socket.io.users
// Project: https://github.com/nodets/socket.io.users
// Definitions by: Makis Maropoulos <https://github.com/kataras>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../express/express.d.ts" />
/// <reference path="../express-session/express-session.d.ts" />
/// <reference path="../socket.io/socket.io.d.ts" />
declare module "socket.io.users" {
import { EventEmitter } from 'events';
import { Application } from "express";
import { SessionOptions } from "express-session";
var CONNECTION_EVENTS: string[];
var Middleware: () => (socket: SocketIO.Socket, next: () => any) => void;
var Session: (app: Application, options?: SessionOptions) => void;
type SocketUserList = {
[namespace: string]: Users;
};
class Namespaces {
private static socketUsersList: any;
static attach(namespace: string, socketUsersObj: Users): void;
static get(namespace: string): Users;
}
class User {
id: string | number;
socket: SocketIO.Socket;
sockets: SocketIO.Socket[];
rooms: string[];
ip: string;
remoteAddresses: string[];
store: any;
attach(socket: SocketIO.Socket): void;
detachSocket(socket: SocketIO.Socket): void;
detach(): void;
join(room: string): boolean;
leave(room: string): void;
leaveAll(): void;
/** same as in, checks if this user is inside a room */
belong(room: string): boolean;
/** same as belong, checks if this user is inside a room */
in(room: string): boolean;
set(key: string, value: any, callback?: () => void): void;
get: (key: string) => any;
toString(): string;
emit(...args: any[]): void;
to(room: string): SocketIO.Socket;
}
class Users extends EventEmitter {
namespace: string;
users: User[];
constructor(namespace?: string);
static of(namespace?: string): Users;
takeId: (request: any) => string | number;
create(socket: SocketIO.Socket): User;
getById(id: string | number): User;
get(socket: SocketIO.Socket): User;
list(): User[];
size(): number;
push(_user: User): void;
add(socket: SocketIO.Socket): User;
indexOf(user: User): number;
remove(user: User): void;
room(room: string): User[];
in(room: string): User[];
from(room: string): User[];
update(user: User): void;
emitAll(...args: any[]): void;
registerSocketEvents(currentUser: User): void;
}
}
+327
View File
@@ -0,0 +1,327 @@
/// <reference path="svg-sprite.d.ts" />
import SVGSpriter = require('svg-sprite');
import * as fs from 'fs';
var config: SVGSpriter.Config;
//
// README.md
//
// Create spriter instance (see below for `config` examples)
var spriter = new SVGSpriter(config);
// Add SVG source files — the manual way ...
spriter.add('assets/svg-1.svg', null, fs.readFileSync('assets/svg-1.svg', {encoding: 'utf-8'}));
spriter.add('assets/svg-2.svg', null, fs.readFileSync('assets/svg-2.svg', {encoding: 'utf-8'}));
/* ... */
// Compile the sprite
spriter.compile(function(error: any, result: any) {
/* ... Write `result` files to disk or do whatever with them ... */
});
// General configuration options
config = {
dest : '.', // Main output directory
log : null, // Logging verbosity (default: no logging)
shape : { // SVG shape related options
id : { // SVG shape ID related options
separator : '--', // Separator for directory name traversal
generator : function(svg: string) { /*...*/ return ''; }, // SVG shape ID generator callback
pseudo : '~' // File name separator for shape states (e.g. ':hover')
},
dimension : { // Dimension related options
maxWidth : 2000, // Max. shape width
maxHeight : 2000, // Max. shape height
precision : 2, // Floating point precision
attributes : false, // Width and height attributes on embedded shapes
},
spacing : { // Spacing related options
padding : 0, // Padding around all shapes
box : 'content' // Padding strategy (similar to CSS `box-sizing`)
},
transform : ['svgo'], // List of transformations / optimizations
meta : null, // Path to YAML file with meta / accessibility data
align : null, // Path to YAML file with extended alignment data
dest : null // Output directory for optimized intermediate SVG shapes
},
svg : { // General options for created SVG files
xmlDeclaration : true, // Add XML declaration to SVG sprite
doctypeDeclaration : true, // Add DOCTYPE declaration to SVG sprite
namespaceIDs : true, // Add namespace token to all IDs in SVG shapes
dimensionAttributes : true // Width and height attributes on the sprite
},
variables : {} // Custom Mustache templating variables and functions
};
// Output modes
config = {
mode : {
css : true, // Create a «css» sprite
view : true, // Create a «view» sprite
defs : true, // Create a «defs» sprite
symbol : true, // Create a «symbol» sprite
stack : true // Create a «stack» sprite
}
};
config = {
mode: {
css: {
// Configuration for the «css» sprite
// ...
}
}
};
// Common mode properties
config = {
mode : {
mode1 : {
dest : "<mode>", // Mode specific output directory
prefix : "svg-%s", // Prefix for CSS selectors
dimensions : "-dims", // Suffix for dimension CSS selectors
sprite : "svg/sprite.<mode>.svg", // Sprite path and name
bust : true, // Cache busting (mode dependent default value)
render : { // Stylesheet rendering definitions
/* -------------------------------------------
css : false, // CSS stylesheet options
scss : false, // Sass stylesheet options
less : false, // LESS stylesheet options
styl : false // Stylus stylesheet options
<custom> : ... // Custom stylesheet options
------------------------------------------- */
},
example : false // Create an HTML example document
}
}
};
// Basic examples
// A.) Standalone sprite
config = {
mode : {
inline : true, // Prepare for inline embedding
symbol : true // Create a «symbol» sprite
}
};
// B.) CSS sprite with Sass resource
config = {
mode : {
css : { // Create a «css» sprite
render : {
scss : true // Render a Sass stylesheet
}
}
}
};
// C.) Multiple sprites
config = {
mode : {
defs : true,
symbol : true,
stack : true
}
};
// D.) No sprite at all
config = {
shape : {
dest : 'path/to/out/dir'
}
};
//
// docs/configuration.md
//
config = {
shape : {
id : { // SVG shape ID related options
separator : '--', // Separator for directory name traversal
generator : function(svg: string) { /*...*/ return ''; }, // SVG shape ID generator callback
pseudo : '~', // File name separator for shape states (e.g. ':hover')
whitespace : '_' // Whitespace replacement for shape IDs
},
dimension : { // Dimension related options
maxWidth : 2000, // Max. shape width
maxHeight : 2000, // Max. shape height
precision : 2, // Floating point precision
attributes : false, // Width and height attributes on embedded shapes
},
spacing : { // Spacing related options
padding : 0, // Padding around all shapes
box : 'content' // Padding strategy (similar to CSS `box-sizing`)
},
transform : ['svgo'], // List of transformations / optimizations
meta : null, // Path to YAML file with meta / accessibility data
align : null, // Path to YAML file with extended alignment data
dest : null // Output directory for optimized intermediate SVG shapes
}
};
config = // SVGO transformation with default configuration
{
shape : {
transform : ['svgo']
/* ... */
}
};
config = // Equivalent transformation to ['svgo']
{
shape : {
transform : [
{svgo : {}}
]
/* ... */
}
};
config = // SVGO transformation with custom plugin configuration
{
shape : {
transform : [
{svgo : {
plugins : [
{transformsWithOnePath: true},
{moveGroupAttrsToElems: false}
]
}}
]
/* ... */
}
};
config = // SVGO transformation with custom plugin configuration
{
shape : {
transform : [
{custom :
/**
* Custom callback transformation
*
* @param {SVGShape} shape SVG shape object
* @param {SVGSpriter} spriter SVG spriter
* @param {Function} callback Callback
* @return {void}
*/
function(shape, sprite, callback) {
/* ... */
callback(null);
}
}
]
/* ... */
}
};
config = // Custom global post-processing transformation
{
svg : {
transform : [
/**
* Custom sprite SVG transformation
*
* @param {String} svg Sprite SVG
* @return {String} Processed SVG
*/
function(svg) {
/* ... */
return svg;
},
/* ... */
]
}
};
config = {
variables : {
now : +new Date(),
png : function() {
return function(sprite: any, render: any) {
return render(sprite).split('.svg').join('.png');
}
}
}
};
config = // Activate the «css» mode with default configuration
{
mode : {
css : true
}
};
config = // Equivalent: Provide an empty configuration object
{
mode : {
css : {}
}
};
config = // Multiple sprites of the same output mode
{
mode : {
sprite1 : {
mode : 'css' // Sprite with «css» mode
},
sprite2 : {
mode : 'css' // Another sprite with «css» mode
}
}
};
config = {
mode : {
css : {
example : true
}
}
};
config = {
mode : {
css : {
example : {}
}
}
};
config = {
mode : {
css : {
render : {
css : {
template : 'path/to/template.html', // relative to current working directory
dest : 'path/to/demo.html' // relative to current output directory
}
}
}
}
};
config = {
mode : {
css : {
example : false
}
}
};
+362
View File
@@ -0,0 +1,362 @@
// Type definitions for svg-sprite
// Project: https://github.com/jkphl/svg-sprite
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../vinyl/vinyl.d.ts" />
/// <reference path="../winston/winston.d.ts" />
declare module "svg-sprite" {
import File = require('vinyl');
import winston = require('winston');
namespace sprite {
interface SVGSpriterConstructor extends NodeJS.EventEmitter {
/**
* The spriter's constructor (always the entry point)
* @param config Main configuration for the spriting process
*/
new(config: Config): SVGSpriter;
}
interface SVGSpriter {
/**
* Registering source SVG files
* @param file Absolute path to the SVG file or a vinyl file object carrying all the necessary values (the following arguments are ignored then).
* @param name The "local" part of the file path, possibly including subdirectories which will get traversed to CSS selectors using the shape.id.separator configuration option.
* @param svg SVG file content.
*/
add(file: string|File, name: string, svg: string): SVGSpriter;
/**
* Registering source SVG files
* @param file Absolute path to the SVG file or a vinyl file object carrying all the necessary values (the following arguments are ignored then).
*/
add(file: File): SVGSpriter;
/**
* Triggering the sprite compilation
* @param config Configuration object setting the output mode parameters for a single compilation run. If omitted, the mode property of the main configuration used for the constructor will be used.
* @param callback Callback triggered when the compilation has finished.
*/
compile(config: Config, callback: CompileCallback): SVGSpriter;
/**
* Triggering the sprite compilation
* @param callback Callback triggered when the compilation has finished.
*/
compile(callback: CompileCallback): void;
/**
* Accessing the intermediate SVG resources
* @param dest Base directory for the SVG files in case the will be written to disk.
* @param callback Callback triggered when the shapes are available.
*/
getShapes(dest: string, callback: GetShapesCallback): void;
}
interface Config {
/**
* Main output directory
* @default '.'
*/
dest?: string;
/**
* Logging verbosity or custom logger
*/
log?: string|winston.LoggerInstance;
/**
* SVG shape configuration
*/
shape?: Shape;
/**
* Sprite SVG options
*/
svg?: Svg;
/**
* Custom templating variables
*/
variables?: any;
/**
* Output mode configurations
*/
mode?: Mode;
}
/**
* All settings affecting the SVG shapes of the sprite
*/
interface Shape {
/**
* SVG shape ID related options
*/
id?: {
/**
* Separator for directory name traversal
*/
separator?: string;
/**
* SVG shape ID generator callback
*/
generator?: string|((svg: string) => string);
/**
* File name separator for shape states (e.g. ':hover')
*/
pseudo?: string;
/**
* Whitespace replacement for shape IDs
*/
whitespace?: string;
};
/**
* Dimension related options
*/
dimension?: {
/**
* Max. shape width
*/
maxWidth?: number;
/**
* Max. shape height
*/
maxHeight?: number;
/**
* Floating point precision
*/
precision?: number;
/**
* Width and height attributes on embedded shapes
*/
attributes?: boolean;
};
/**
* Spacing related options
*/
spacing?: {
/**
* Padding around all shapes
*/
padding?: number|number[];
/**
* Padding strategy (similar to CSS `box-sizing`)
*/
box?: string;
};
/**
* List of transformations / optimizations
*/
transform?: (string|CustomConfigurationTransform|CustomCallbackTransform)[];
/**
* Path to YAML file with meta / accessibility data
*/
meta?: string;
/**
* Path to YAML file with extended alignment data
*/
align?: string;
/**
* Output directory for optimized intermediate SVG shapes
*/
dest?: string;
}
/**
* Pre-defined shape transformation with custom configuration
*/
interface CustomConfigurationTransform {
[transformationName: string]: {
plugins?: { [transformationName: string]: boolean }[];
}
}
/**
* Custom callback transformation
*/
interface CustomCallbackTransform {
[transformationName: string]: {
/**
* Custom callback transformation
* @param shape SVG shape object
* @param sprite SVG spriter
* @param callback Callback
*/
(shape: any, sprite: SVGSpriter, callback: Function): any;
}
}
interface Svg {
/**
* Output an XML declaration at the very beginning of each compiled sprite.
* If you provide a non-empty string here, it will be used one-to-one as declaration (e.g. <?xml version="1.0" encoding="utf-8"?>).
* If you set this to TRUE, *svg-sprite* will look at the registered shapes for an XML declaration and use the first one it can find.
* @default true
*/
xmlDeclaration?: boolean|string;
/**
* Include a <DOCTYPE> declaration in each compiled sprite. If you provide a non-empty string here,
* it will be used one-to-one as declaration (e.g. <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">).
* If you set this to TRUE, *svg-sprite* will look at the registered shapes for a DOCTYPE declaration and use the first one it can find.
* @default true
*/
doctypeDeclaration?: boolean|string;
/**
* In order to avoid ID clashes, the default behavior is to namespace all IDs in the source SVGs before compiling them into a sprite.
* Each ID is prepended with a unique string. In some situations, it might be desirable to disable ID namespacing, e.g. when you want to script the resulting sprite.
* Just set svg.namespaceIDs to FALSE then and be aware that you might also want to disable SVGO's ID minification (shape.transform.svgo.plugins: [{cleanupIDs: false}]).
* @default true
*/
namespaceIDs?: boolean;
/**
* In order to avoid CSS class name ambiguities, the default behavior is to namespace CSS class names in the source SVGs before compiling them into a sprite.
* Each class name is prepended with a unique string. Disable this option to keep the class names untouched.
* @default true
*/
namespaceClassnames?: boolean;
/**
* If truthy, width and height attributes will be set on the sprite's <svg> element (where applicable).
* @default true
*/
dimensionAttributes?: boolean;
/**
* Shorthand for applying custom attributes to the outermost <svg> element.
* Please be aware that certain attributes (e.g. viewBox) will be calculated dynamically and override custom rootAttributes in any case.
*/
rootAttributes?: any;
/**
* Floating point precision for CSS positioning values (defaults to -1 meaning highest possible precision).
*/
precision?: number;
/**
* Callback (or list of callbacks) that will be applied to the resulting SVG sprites as global [post-processing transformation](#svg-sprite-customization).
* transform: FunctionArray
*/
transform?: SvgTransformer|SvgTransformer[];
}
interface SvgTransformer {
/**
* Custom sprite SVG transformation
* @param svg Sprite SVG
* @return Processed SVG
*/
(svg: string): string;
}
interface Mode {
css?: CssAndViewSpecificModeConfig|boolean;
view?: CssAndViewSpecificModeConfig|boolean;
defs?: DefsAndSymbolSpecificModeConfig|boolean;
symbol?: DefsAndSymbolSpecificModeConfig|boolean;
stack?: ModeConfig|boolean;
[customConfigName: string]: ModeConfig;
}
interface ModeConfig {
/**
* Base directory for sprite and CSS file output. If not absolute, the path will be resolved using the main output directory (see global dest option).
* @default "<mode>"
*/
dest?: string;
/**
* Used for prefixing the [shape ID](#shape-ids) during CSS selector construction. If the value is empty,
* no prefix will be used. The prefix may contain the placeholder "%s" (e.g. ".svg %s-svg"),
* which will then get replaced by the shape ID. Please be aware that "%" is a special character
* in this context and that you'll have to escape it by another percent sign ("%%") in case you want
* to output it to your stylesheets (e.g. for a [Sass placeholder selector](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#placeholder_selectors_)).
* @default ".svg-%s"
*/
prefix?: string;
/**
* A non-empty string value will trigger the creation of additional CSS rules specifying the dimensions of each shape in the sprite.
* The string will be used as suffix to mode.<mode>.prefix during CSS selector construction and may contain the placeholder "%s",
* which will get replaced by the value of mode.<mode>.prefix.
* A boolean TRUE will cause the dimensions to be included directly into each shape's CSS rule (only available for «css» and «view» sprites).
* @default "-dims"
*/
dimensions?: string|boolean;
/**
* SVG sprite path and file name, relative to the mode.<mode>.dest directory.
* You may omit the file extension, in which case it will be set to ".svg" automatically.
* @default "svg/sprite.<mode>.svg"
*/
sprite?: string;
/**
* Add a content based hash to the name of the sprite file so that clients reliably reload the sprite
* when it's content changes («cache busting»). Defaults to false except for «css» and «view» sprites.
* @default truefalse
*/
bust?: boolean;
/**
* Collection of [stylesheet rendering configurations](#rendering-configurations).
* The keys are used as file extensions as well as file return keys. At present,
* there are default templates for the file extensions css ([CSS](http://www.w3.org/Style/CSS/)),
* scss ([Sass](http://sass-lang.com/)), less ([Less](http://lesscss.org/)) and styl ([Stylus](http://learnboost.github.io/stylus/)),
* which all reside in the directory tmpl/css. Example: {css: true, scss: {dest: '_sprite.scss'}}
* @default {}
*/
render?: { [key: string]: RenderingConfiguration };
/**
* Enabling this will trigger the creation of an HTML document demoing the usage of the sprite. Please see below for details on [rendering configurations](#rendering-configurations).
* @default false
*/
example?: RenderingConfiguration;
/**
* Specify svg-sprite which output mode to use with this configuration
*/
mode?: string;
}
interface RenderingConfiguration {
/**
* HTML document Mustache template
* @default "tmpl/<mode>/sprite.html"
*/
template?: string;
/**
* HTML document destination
* @default "sprite.<mode>.html"
*/
dest?: string;
}
interface CssAndViewSpecificModeConfig extends ModeConfig {
/**
* The arrangement of the shapes within the sprite. Might be "vertical", "horizontal", "diagonal" or "packed"
* (with the latter being the most compact type). It depends on your project which layout is best for you.
* @default "packed"
*/
layout?: string;
/**
* If given and not empty, this will be the selector name of a CSS rule commonly specifying the background-image
* and background-repeat properties for all the shapes in the sprite (thus saving some bytes by not unnecessarily repeating them for each shape)
*/
common?: string;
/**
* If given and not empty, a mixin with this name will be added to supporting output formats (e.g. Sass, LESS, Stylus),
* specifying the background-image and background-repeat properties for all the shapes in the sprite.
* You may use it for creating custom CSS within @media rules. The mixin acts much like the common rule.
* In fact, you can even combine the two - if both are enabled, the common rule will use the mixin internally.
*/
mixin?: string;
}
interface DefsAndSymbolSpecificModeConfig extends ModeConfig {
/**
* If you want to embed the sprite into your HTML source, you will want to set this to true
* in order to prevent the creation of SVG namespace declarations and to set some other attributes for effectively hiding the library sprite.
* @default false
*/
inline?: boolean;
}
interface CompileCallback {
(error: Error, result: any, data: any): any;
}
interface GetShapesCallback {
(error: Error, result: File[]): any;
}
}
var sprite: sprite.SVGSpriterConstructor;
export = sprite;
}
+15
View File
@@ -0,0 +1,15 @@
/// <reference path="tooltipster.d.ts" />
$(function() {
var tooltips = <JQueryTooltipster.ITooltipsterInstance[]>$("#tooltip").tooltipster({
content: "hi friend!",
delay: 300,
functionAfter: (origin) => {
console.log("tooltip closed!");
},
multiple: true
});
tooltips[0].show();
tooltips[0].hide();
tooltips[0].destroy();
});
+278
View File
@@ -0,0 +1,278 @@
// Type definitions for tooltipster
// Project: https://github.com/iamceege/tooltipster
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare module JQueryTooltipster {
/**
* Tooltipster options @see http://iamceege.github.io/tooltipster/
*/
export interface ITooltipsterOptions {
/**
* Determines how the tooltip will animate in and out. Feel free to modify or create custom transitions in the tooltipster.css file.
* In IE9 and 8, all animations default to a JavaScript generated, fade animation. Default: 'fade'
*/
animation?: string;
/**
* Adds the "speech bubble arrow" to the tooltip. Default: true
*/
arrow?: boolean;
/**
* Select a specific color for the "speech bubble arrow". Default: will inherit the tooltip's background color
*/
arrowColor?: string;
/**
* If autoClose is set to false, the tooltip will never close unless you call the 'hide' method yourself. Default: true
*/
autoClose?: boolean;
/**
* If set, this will override the content of the tooltip. Default: null
*/
content?: string;
/**
* If the content of the tooltip is provided as a string, it is displayed as plain text by default.
* If this content should actually be interpreted as HTML, set this option to true. Default: false
*/
contentAsHTML?: string;
/**
* If you provide a jQuery object to the 'content' option, this sets if it is a clone of this object that should actually be used. Default: true
*/
contentCloning?: boolean;
/**
* Tooltipster logs notices into the console when you're doing something you ideally shouldn't be doing. Set to false to disable logging. Default: true
*/
debug?: boolean;
/**
* Delay how long it takes (in milliseconds) for the tooltip to start animating in. Default: 200
*/
delay?: number;
/**
* Set a minimum width for the tooltip. Default: 0 (auto width)
*/
minWidth?: number;
/**
* Set a maximum width for the tooltip. Default: null (no max width)
*/
maxWidth?: number;
/**
* Create a custom function to be fired only once at instantiation. If the function returns a value, this value will become the content of the tooltip.
* @param origin
* @param content
*/
functionInit?: (origin: JQuery, content: string) => void;
/**
* Create a custom function to be fired before the tooltip opens. This function may prevent or hold off the opening.
* @param origin
* @param continueTooltip
*/
functionBefore?: (origin: JQuery, continueTooltip: () => void) => void;
/**
* Create a custom function to be fired when the tooltip and its contents have been added to the DOM.
* @param origin
* @param tooltip
*/
functionReady?: (origin: JQuery, tooltip: JQuery) => void;
/**
* Create a custom function to be fired once the tooltip has been closed and removed from the DOM.
* @param origin
*/
functionAfter?: (origin: JQuery) => void;
/**
* If true, the tooltip will close if its origin is clicked. This option only applies when 'trigger' is 'hover' and 'autoClose' is false. Default: false
*/
hideOnClick?: boolean;
/**
* If using the iconDesktop or iconTouch options, this sets the content for your icon. Default: '(?)'
*/
icon?: string|JQuery;
/**
* If you provide a jQuery object to the 'icon' option, this sets if it is a clone of this object that should actually be used. Default: true
*/
iconCloning?: boolean;
/**
* Generate an icon next to your content that is responsible for activating the tooltip on non-touch devices. Default: false
*/
iconDesktop?: boolean;
/**
* If using the iconDesktop or iconTouch options, this sets the class on the icon (used to style the icon). Default: 'tooltipster-icon'
*/
iconTheme?: string;
/**
* Generate an icon next to your content that is responsible for activating the tooltip on touch devices (tablets, phones, etc). Default: false
*/
iconTouch?: boolean;
/**
* Give users the possibility to interact with the tooltip. Unless autoClose is set to false, the tooltip will still close if the user moves away from or clicks out of the tooltip.
* Default: false
*/
interactive?: boolean;
/**
* If the tooltip is interactive and activated by a hover event, set the amount of time (milliseconds) allowed for a user to hover off
* of the tooltip activator (origin) on to the tooltip itself - keeping the tooltip from closing. Default: 350
*/
interactiveTolerance?: number;
/**
* Allows you to put multiple tooltips on a single element. Read further instructions down this page. Default: false
*/
multiple?: boolean;
/**
* Offsets the tooltip (in pixels) farther left/right from the origin. Default: 0
*/
offsetX?: number;
/**
* Offsets the tooltip (in pixels) farther up/down from the origin. Default: 0
*/
offsetY?: number;
/**
* If true, only one tooltip will be allowed to be active at a time. Non-autoclosing tooltips will not be closed though. Default: false
*/
onlyOne?: boolean;
/**
* Set the position of the tooltip. Default: 'top'
* Possible values: right, left, top, top-right, top-left, bottom, bottom-right, bottom-left
*/
position?: string;
/**
* Will reposition the tooltip if the origin moves. As this option may have an impact on performance, we suggest you enable it only if you need to. Default: false
*/
positionTracker?: boolean;
/**
* Called after the tooltip has been repositioned by the position tracker (if enabled).
* Default: A function that will close the tooltip if the trigger is 'hover' and autoClose is false.
*/
positionTrackerCallback?: Function;
/**
* Specify if a TITLE attribute should be restored on the HTML element after a call to the 'destroy' method.
* This attribute may be omitted, or be restored with the value that existed before Tooltipster was initialized, or be restored with the stringified value of the current content.
* Note: in case of multiple tooltips on a single element, only the last destroyed tooltip may trigger a restoration. Default: 'current'
*
* Possible values: 'none', 'previous' or 'current'
*/
restoration?: string;
/**
* Set the speed of the animation. Default: 350
*/
speed?: number;
/**
* How long the tooltip should be allowed to live before closing. Default: 0 (disabled)
*/
timer?: number;
/**
* Set the theme (CSS class) used for your tooltip. Default: 'tooltipster-default'
*/
theme?: string;
/**
*
* If set to false, tooltips will not show on pure-touch devices, unless you open them yourself with the 'show' method.
* Touch gestures on devices which also have a mouse will still open the tooltips though. Default: true
*/
touchDevices?: boolean;
/**
* Set how tooltips should be activated and closed.
* Possible values: hover, click or custom.
*/
trigger?: string;
/**
* If a tooltip is open while its content is updated, play a subtle animation when the content changes. Default: true
*/
updateAnimation?: boolean;
}
/**
* Tooltipster tooltip instance object.
*/
export interface ITooltipsterInstance {
/**
* Updates the content of the tooltip.
* @param value
* @returns {}
*/
content(value: string): JQuery;
/**
* Shows the tooltip.
*/
show(): void;
/**
* Hides the tooltip (this will aslo causo it to be removed from the DOM, not simply hides it), however leaving the listeners.
*/
hide(): void;
/**
* Disables the tooltip, causing it to not show unless its re-enabled.
*/
disable(): void;
/**
* Enables the tooltip.
*/
enable(): void;
/**
* Destroy the tooltip and its listeners.
*/
destroy(): void;
/**
* Reposition and resize the tooltip.
*/
reposition(): void;
/**
* Returns the root element of the tooltip.
*/
elementTooltip(): JQuery;
/**
* Returns the root element of the icon if there is one, otherwise 'undefined'.
*/
elementIcon(): JQuery;
}
}
interface JQuery {
tooltipster(options?: JQueryTooltipster.ITooltipsterOptions): JQuery|JQueryTooltipster.ITooltipsterInstance[];
}
+2 -2
View File
@@ -119,8 +119,8 @@ declare module Twitter.Typeahead {
* 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;
*/
displayKey?: string | ((obj: any) => string);
/**
* A hash of templates to be used when rendering the dataset.
+8
View File
@@ -100,3 +100,11 @@ gridApi.core.queueGridRefresh()
gridApi.core.queueRefresh();
gridApi.core.registerColumnsProcessor(colProcessor, 100);
var rowEntityToScrollTo = {anObject: 'inGridOptionsData'};
var columnDefToScrollTo: uiGrid.IColumnDef;
gridInstance.scrollTo();
gridInstance.scrollTo(rowEntityToScrollTo);
gridInstance.scrollTo(rowEntityToScrollTo, columnDefToScrollTo);
var selectedRowEntities: Array<any> = gridApi.selection.getSelectedRows();
var selectedGridRows: Array<uiGrid.IGridRow> = gridApi.selection.getSelectedGridRows();
+3 -3
View File
@@ -445,7 +445,7 @@ declare module uiGrid {
* @param {IColumnDef} colDef to make visible
* @returns {ng.IPromise<any>} a promise that is resolved after any scrolling is finished
*/
scrollTo(rowEntity: IGridRow, colDef: IColumnDef): ng.IPromise<any>;
scrollTo(rowEntity?: any, colDef?: IColumnDef): ng.IPromise<any>;
/**
* Scrolls the grid to make a certain row and column combo visible,
* in the case that it is not completely visible on the screen already.
@@ -2823,12 +2823,12 @@ declare module uiGrid {
* returns all selected rows as gridRows
* @returns {Array<IGridRow>} The selected rows
*/
getSelectedGridRows(): Array<IGridRow>;
getSelectedGridRows(): Array<uiGrid.IGridRow>;
/**
* Gets selected rows as entities
* @returns {Array<any>} Selected row entities
*/
getSelectedRows(): Array<IGridRow>;
getSelectedRows(): Array<any>;
/**
* Selects all rows. Does nothing if multiselect = false
* @param {ng.IAngularEvent} event object if raised from event
+30 -5
View File
@@ -3,10 +3,24 @@
var myApp = angular.module('testModule')
myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: angular.ui.IStickyStateProvider) => {
var state: angular.ui.IStickyState = {
var state: angular.ui.IStickyState = {
name: 'test',
sticky: true,
controller: ($previousState: angular.ui.IPreviousStateService) => {
sticky: true,
dsr: {
default: 'substate',
params: ['param1', 'param2'],
fn: function ($dsr$) {
return $dsr$.to;
}
},
onInactivate: function ($state: angular.ui.IState) {
var iAmInjectedByInjector = $state;
},
onReactivate: function ($state: angular.ui.IState) {
var iAmInjectedByInjector = $state;
},
controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => {
$previousState.memo('test-memo1');
$previousState.memo('test-memo2', 'test-state-name2');
$previousState.memo('test-memo3', 'test-state-name3', {});
@@ -14,8 +28,19 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a
$previousState.go('test-memo2', {
location: true,
notify: true
});
}
});
$previousState.get();
$previousState.get('test-memo1');
$deepstateRedirect.reset('statename1', {
'stateParam1': ['value1', 'value2'],
'stateParam2': 'value'
});
},
views: {
//named views are mandatory
'name1': {}
}
};
$stickyStateProvider.enableDebug(true);
+77 -9
View File
@@ -1,6 +1,6 @@
// Type definitions for UI-Router Extras 0.0.14+ (ct.ui.router.extras module)
// Project: https://github.com/christopherthielen/ui-router-extras
// Definitions by: Michael Putters <https://github.com/mputters>
// Definitions by: Michael Putters <https://github.com/mputters/>, Marcel van de Kamp <https://github.com/marcel-k/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
@@ -13,12 +13,54 @@ declare module 'angular-ui-router-extras' {
declare module angular.ui {
/**
/*
* $deepStateRedirect
*/
interface IDeepStateRedirectService {
/*
* This method resets stored $deepStateRedirect data so following transitions will behave like there have not been previous transitions.
* @param stateParams Can be passed in to select specific states to reset:
* {
* 'paramName': 'paramvalue' | ['list', 'of', 'possible', 'paramvalues']
* }
*/
reset(stateName: string, stateParams?: { [key: string]: string | string[] }): void;
}
/*
* Docs: http://christopherthielen.github.io/ui-router-extras/#/dsr
*/
interface IDeepStateRedirectConfig {
/*
* If no deep state has been recorded, DSR will instead redirect to the default substate and params that you specify.
* If default is a string it is interpreted as the substate.
*/
default?: string | IRedirectParams;
/*
* Specify params: true if your DSR state takes parameters.
* If only a subset of the parameters should be included in the parameter grouping for recording deep states,
* specify an array of parameter names.
*/
params?: boolean | string[];
/*
* A callback function that determines whether or not the redirect should actually occur, or changes the redirect to some other state.
* Return an object: IRedirectParams to change the redirect
*/
fn?($dsr$: { redirect: IRedirectParams; to: IRedirectParams }): boolean | IRedirectParams;
}
interface IRedirectParams {
state: string;
params?: ui.IStateParamsService;
}
/*
* Previous state
*/
interface IPreviousState {
state: IState;
params?: {};
interface IPreviousState {
state: IState;
params?: ui.IStateParamsService;
}
/**
@@ -54,16 +96,42 @@ declare module angular.ui {
* @param memoName Memo name
*/
forget(memoName: string): void;
}
}
/**
* Sticky state
*/
* Sticky state
*/
interface IStickyState extends angular.ui.IState {
/*
* When marking a state sticky, the state must target its own unique named ui-view.
* Docs: http://christopherthielen.github.io/ui-router-extras/#/sticky
*/
sticky?: boolean;
/*
* The most-recently-activate substate of the DSR marked state is remembered.
* When the DSR marked state is transitioned to directly, UI-Router Extras will instead redirect to the remembered state and parameters.
* Docs: http://christopherthielen.github.io/ui-router-extras/#/dsr
*/
deepStateRedirect?: boolean | IDeepStateRedirectConfig;
/*
* Shortname deepStateRedirect prop
*/
dsr?: boolean | IDeepStateRedirectConfig;
/*
* Function (injectable). Called when a sticky state is navigated away from (inactivated).
*/
onInactivate?: Function;
/*
* Function (injectable). Called when an inactive sticky state is navigated to (reactivated).
*/
onReactivate?: Function;
/*
* Note: named views are mandatory when using sticky states!
*/
views?: {};
}
/**
* Sticky state service
*/
+2 -8
View File
@@ -1614,13 +1614,6 @@ interface UnderscoreStatic {
**/
chain<T>(obj: T[]): _Chain<T>;
chain<T extends {}>(obj: T): _Chain<T>;
/**
* Extracts the value of a wrapped object.
* @param obj Wrapped object to extract the value from.
* @return Value of `obj`.
**/
value<T, TResult>(obj: T): TResult;
}
interface Underscore<T> {
@@ -2463,7 +2456,8 @@ interface Underscore<T> {
/**
* Wrapped type `any`.
* @see _.value
* Extracts the value of a wrapped object.
* @return Value of the wrapped object.
**/
value<TResult>(): TResult;
}