From 76ea613b90f40db3afae3ff77c21298d13775257 Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Mon, 20 Jul 2015 18:49:06 -0400 Subject: [PATCH 001/189] localforage typings --- localForage/localForage.d.ts | 135 ++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 65 deletions(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index b5c40dd61..6deef5277 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -3,71 +3,76 @@ // Definitions by: yuichi david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module lf { - interface ILocalForage { - /** - * 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(iterateCallback: IIterateCallback): 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(key: string, callback: ICallback): void - getItem(key: string): IPromise - /** - * Saves data to an offline store. - */ - setItem(key: string, value: T, callback: ICallback): void - setItem(key: string, value: T): IPromise - /** - * Removes the value of a key from the offline store. - */ - removeItem(key: string, callback: IErrorCallback): void - removeItem(key: string): IPromise - } +/// - interface ICallback { - (err: any, value: T): void - } +interface LocalForageOptions { + driver?: LocalForageDriver | LocalForageDriver[]; + + name?: string; + + size?: number; + + storeName?: string; + + version?: string; + + description?: string; +} - interface IIterateCallback { - (value: T, key: string, iterationNumber: number): void - } +interface LocalForageDriver { + _driver: string; + + _initStorage(options: LocalForageOptions): void; + + _support: boolean | Promise; + + 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 IErrorCallback { - (err: any): void - } - - interface IKeyCallback { - (err: any, keyName: string): void - } - - interface IKeysCallback { - (err: any, keys: Array): void - } - - interface INumberCallback { - (err: any, numberOfKeys: number): void - } - - interface IPromise { - then(callback: ICallback): void - } -} \ No newline at end of file +interface LocalForage { + LOCALSTORAGE: LocalForageDriver; + WEBSQL: LocalForageDriver; + INDEXEDDB: LocalForageDriver; + + config(options: LocalForageOptions): void; + + setDriver(driver: LocalForageDriver): void; + setDriver(driver: LocalForageDriver[]): void; + + getItem(key: string): Promise; + getItem(key: string, callback: (err: any, value: T) => void): void; + + setItem(key: string, value: T): Promise; + setItem(key: string, value: T, callback: (err: any, value: T) => void): void; + + removeItem(key: string): Promise; + removeItem(key: string, callback: (err: any) => void): void; + + clear(): Promise; + clear(callback: (err: any) => void): void; + + length(): Promise; + length(callback: (err: any, numberOfKeys: number) => void): void; + + key(keyIndex: number): Promise; + key(keyIndex: number, callback: (err: any, key: string) => void): void; + + keys(): Promise; + keys(callback: (err: any, keys: string[]) => void): void; + + iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise; + iterate(iteratee: (value: any, key: string, iterationNumber: number) => any, + callback: (err: any, result: any) => void): void; +} From e7335515d8bd5a258087918530842595554b909c Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Fri, 24 Jul 2015 18:01:38 -0400 Subject: [PATCH 002/189] Update localForage tests --- localForage/localForage-tests.ts | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 15638c1cb..59e429a76 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,13 +1,6 @@ /// -declare var localForage: lf.ILocalForage; -declare var callback: lf.ICallback; -declare var iterateCallback: lf.IIterateCallback; -declare var errorCallback: lf.IErrorCallback; -declare var keyCallback: lf.IKeyCallback; -declare var keysCallback: lf.IKeysCallback; -declare var numberCallback: lf.INumberCallback; -declare var promise: lf.IPromise; +declare var localForage: LocalForage; () => { localForage.clear((err: any) => { @@ -25,7 +18,7 @@ declare var promise: lf.IPromise; 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; }); @@ -40,9 +33,8 @@ declare var promise: lf.IPromise; var newStr: string = str }); - localForage.getItem("key").then((err: any, str: string) => { - var newError: any = err; - var newStr: string = str + localForage.getItem("key").then((str: string) => { + var newStr: string = str; }); localForage.setItem("key", "value",(err: any, str: string) => { @@ -50,8 +42,7 @@ declare var promise: lf.IPromise; var newStr: string = str }); - localForage.setItem("key", "value").then((err: any, str: string) => { - var newError: any = err; + localForage.setItem("key", "value").then((str: string) => { var newStr: string = str; }); @@ -59,10 +50,6 @@ declare var promise: lf.IPromise; var newError: any = err; }); - localForage.removeItem("key").then((err: any, str: string) => { - var newError: any = err; - var newStr: string = str + localForage.removeItem("key").then(() => { }); - - promise.then(callback); } From 90d7feb531e0935de1eebbac1bb5bedf8ab5ccc1 Mon Sep 17 00:00:00 2001 From: Gabriel Garcia Date: Fri, 24 Jul 2015 18:18:58 -0400 Subject: [PATCH 003/189] Correct misunderstanding of documentation --- angular-localForage/angular-localForage.d.ts | 4 ++-- localForage/localForage.d.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/angular-localForage/angular-localForage.d.ts b/angular-localForage/angular-localForage.d.ts index ee2aeeb6d..c7a8f7dae 100644 --- a/angular-localForage/angular-localForage.d.ts +++ b/angular-localForage/angular-localForage.d.ts @@ -22,8 +22,8 @@ declare module angular.localForage { } interface ILocalForageService { - setDriver(driver:string):angular.IPromise; - driver():lf.ILocalForage; + driver(): LocalForageDriver; + setDriver(name: string | string[]): angular.IPromise; setItem(key:string, value:any):angular.IPromise; setItem(keys:Array, values:Array):angular.IPromise; diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 6deef5277..d169d01e3 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -42,14 +42,17 @@ interface LocalForageDriver { } interface LocalForage { - LOCALSTORAGE: LocalForageDriver; - WEBSQL: LocalForageDriver; - INDEXEDDB: LocalForageDriver; + LOCALSTORAGE: string; + WEBSQL: string; + INDEXEDDB: string; config(options: LocalForageOptions): void; - setDriver(driver: LocalForageDriver): void; - setDriver(driver: LocalForageDriver[]): void; + driver(): LocalForageDriver; + setDriver(driver: string | string[]): Promise; + setDriver(driver: string | string[], callback: () => void, errorCallback: (error: any) => void): void; + defineDriver(driver: LocalForageDriver): Promise; + defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void; getItem(key: string): Promise; getItem(key: string, callback: (err: any, value: T) => void): void; From 39c95a0a56c3ccb7f29a91797099c48e61ba5388 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 10:43:39 +0900 Subject: [PATCH 004/189] redis: uniform indent to 4 spaces --- redis/redis.d.ts | 664 ++++++++++++++++++++++++----------------------- 1 file changed, 333 insertions(+), 331 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 8e9c97856..ec7220cee 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -1,6 +1,6 @@ // Type definitions for redis // Project: https://github.com/mranney/node_redis -// Definitions by: Carlos Ballesteros Velasco , Peter Harris +// Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi // Definitions: https://github.com/borisyankov/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/redis.d.ts @@ -8,347 +8,349 @@ /// 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 { //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): void; - (...args: any[]): void; - } + export var debug_mode:boolean; - interface ResCallbackT { - (err: Error, res: R): void; - } + interface MessageHandler { + (channel:string, message:any): void; + } - interface ServerInfo { - redis_version: string; - versions: number[]; - } + interface CommandT { //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): 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 { + (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; + no_ready_check?: boolean; + enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: number; + max_attempts?: number; + auth_pass?: string; + } - 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): void; - ping(callback?: ResCallbackT): 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): void; - bitcount(key: string, callback?: ResCallbackT): void; - bitcount(key: string, start: number, end: number, callback?: ResCallbackT): void; - set(key: string, value: string, callback?: ResCallbackT): void; - get(key: string, callback?: ResCallbackT): void; - exists(key: string, value: string, callback?: ResCallbackT): void; + end(): void; - publish(channel: string, value: any): void; - subscribe(channel: string): void; + // Connection (http://redis.io/commands#connection) + auth(password:string, callback?:ResCallbackT): void; + ping(callback?:ResCallbackT): void; - /* - commands = set_union([ - "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", - "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", - "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", - "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", - "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", - "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", - "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", - "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", - "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", - "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); - */ + // Strings (http://redis.io/commands#strings) + append(key:string, value:string, callback?:ResCallbackT): void; + bitcount(key:string, callback?:ResCallbackT): void; + bitcount(key:string, start:number, end:number, callback?:ResCallbackT): void; + set(key:string, value:string, callback?:ResCallbackT): void; + get(key:string, callback?:ResCallbackT): void; + exists(key:string, value:string, callback?:ResCallbackT): void; - get(args: any[], callback?: ResCallbackT): void; - get(...args: any[]): void; - set(args: any[], callback?: ResCallbackT): void; - set(...args: any[]): void; - setnx(args: any[], callback?: ResCallbackT): void; - setnx(...args: any[]): void; - setex(args: any[], callback?: ResCallbackT): void; - setex(...args: any[]): void; - append(args: any[], callback?: ResCallbackT): void; - append(...args: any[]): void; - strlen(args: any[], callback?: ResCallbackT): void; - strlen(...args: any[]): void; - del(args: any[], callback?: ResCallbackT): void; - del(...args: any[]): void; - exists(args: any[], callback?: ResCallbackT): void; - exists(...args: any[]): void; - setbit(args: any[], callback?: ResCallbackT): void; - setbit(...args: any[]): void; - getbit(args: any[], callback?: ResCallbackT): void; - getbit(...args: any[]): void; - setrange(args: any[], callback?: ResCallbackT): void; - setrange(...args: any[]): void; - getrange(args: any[], callback?: ResCallbackT): void; - getrange(...args: any[]): void; - substr(args: any[], callback?: ResCallbackT): void; - substr(...args: any[]): void; - incr(args: any[], callback?: ResCallbackT): void; - incr(...args: any[]): void; - decr(args: any[], callback?: ResCallbackT): void; - decr(...args: any[]): void; - mget(args: any[], callback?: ResCallbackT): void; - mget(...args: any[]): void; - rpush(...args: any[]): void; - lpush(args: any[], callback?: ResCallbackT): void; - lpush(...args: any[]): void; - rpushx(args: any[], callback?: ResCallbackT): void; - rpushx(...args: any[]): void; - lpushx(args: any[], callback?: ResCallbackT): void; - lpushx(...args: any[]): void; - linsert(args: any[], callback?: ResCallbackT): void; - linsert(...args: any[]): void; - rpop(args: any[], callback?: ResCallbackT): void; - rpop(...args: any[]): void; - lpop(args: any[], callback?: ResCallbackT): void; - lpop(...args: any[]): void; - brpop(args: any[], callback?: ResCallbackT): void; - brpop(...args: any[]): void; - brpoplpush(args: any[], callback?: ResCallbackT): void; - brpoplpush(...args: any[]): void; - blpop(args: any[], callback?: ResCallbackT): void; - blpop(...args: any[]): void; - llen(args: any[], callback?: ResCallbackT): void; - llen(...args: any[]): void; - lindex(args: any[], callback?: ResCallbackT): void; - lindex(...args: any[]): void; - lset(args: any[], callback?: ResCallbackT): void; - lset(...args: any[]): void; - lrange(args: any[], callback?: ResCallbackT): void; - lrange(...args: any[]): void; - ltrim(args: any[], callback?: ResCallbackT): void; - ltrim(...args: any[]): void; - lrem(args: any[], callback?: ResCallbackT): void; - lrem(...args: any[]): void; - rpoplpush(args: any[], callback?: ResCallbackT): void; - rpoplpush(...args: any[]): void; - sadd(args: any[], callback?: ResCallbackT): void; - sadd(...args: any[]): void; - srem(args: any[], callback?: ResCallbackT): void; - srem(...args: any[]): void; - smove(args: any[], callback?: ResCallbackT): void; - smove(...args: any[]): void; - sismember(args: any[], callback?: ResCallbackT): void; - sismember(...args: any[]): void; - scard(args: any[], callback?: ResCallbackT): void; - scard(...args: any[]): void; - spop(args: any[], callback?: ResCallbackT): void; - spop(...args: any[]): void; - srandmember(args: any[], callback?: ResCallbackT): void; - srandmember(...args: any[]): void; - sinter(args: any[], callback?: ResCallbackT): void; - sinter(...args: any[]): void; - sinterstore(args: any[], callback?: ResCallbackT): void; - sinterstore(...args: any[]): void; - sunion(args: any[], callback?: ResCallbackT): void; - sunion(...args: any[]): void; - sunionstore(args: any[], callback?: ResCallbackT): void; - sunionstore(...args: any[]): void; - sdiff(args: any[], callback?: ResCallbackT): void; - sdiff(...args: any[]): void; - sdiffstore(args: any[], callback?: ResCallbackT): void; - sdiffstore(...args: any[]): void; - smembers(args: any[], callback?: ResCallbackT): void; - smembers(...args: any[]): void; - zadd(args: any[], callback?: ResCallbackT): void; - zadd(...args: any[]): void; - zincrby(args: any[], callback?: ResCallbackT): void; - zincrby(...args: any[]): void; - zrem(args: any[], callback?: ResCallbackT): void; - zrem(...args: any[]): void; - zremrangebyscore(args: any[], callback?: ResCallbackT): void; - zremrangebyscore(...args: any[]): void; - zremrangebyrank(args: any[], callback?: ResCallbackT): void; - zremrangebyrank(...args: any[]): void; - zunionstore(args: any[], callback?: ResCallbackT): void; - zunionstore(...args: any[]): void; - zinterstore(args: any[], callback?: ResCallbackT): void; - zinterstore(...args: any[]): void; - zrange(args: any[], callback?: ResCallbackT): void; - zrange(...args: any[]): void; - zrangebyscore(args: any[], callback?: ResCallbackT): void; - zrangebyscore(...args: any[]): void; - zrevrangebyscore(args: any[], callback?: ResCallbackT): void; - zrevrangebyscore(...args: any[]): void; - zcount(args: any[], callback?: ResCallbackT): void; - zcount(...args: any[]): void; - zrevrange(args: any[], callback?: ResCallbackT): void; - zrevrange(...args: any[]): void; - zcard(args: any[], callback?: ResCallbackT): void; - zcard(...args: any[]): void; - zscore(args: any[], callback?: ResCallbackT): void; - zscore(...args: any[]): void; - zrank(args: any[], callback?: ResCallbackT): void; - zrank(...args: any[]): void; - zrevrank(args: any[], callback?: ResCallbackT): void; - zrevrank(...args: any[]): void; - hset(args: any[], callback?: ResCallbackT): void; - hset(...args: any[]): void; - hsetnx(args: any[], callback?: ResCallbackT): void; - hsetnx(...args: any[]): void; - hget(args: any[], callback?: ResCallbackT): void; - hget(...args: any[]): void; - hmset(args: any[], callback?: ResCallbackT): void; - hmset(key: string, hash: any, callback?: ResCallbackT): void; - hmset(...args: any[]): void; - hmget(args: any[], callback?: ResCallbackT): void; - hmget(...args: any[]): void; - hincrby(args: any[], callback?: ResCallbackT): void; - hincrby(...args: any[]): void; - hdel(args: any[], callback?: ResCallbackT): void; - hdel(...args: any[]): void; - hlen(args: any[], callback?: ResCallbackT): void; - hlen(...args: any[]): void; - hkeys(args: any[], callback?: ResCallbackT): void; - hkeys(...args: any[]): void; - hvals(args: any[], callback?: ResCallbackT): void; - hvals(...args: any[]): void; - hgetall(args: any[], callback?: ResCallbackT): void; - hgetall(...args: any[]): void; - hgetall(key: string, callback?: ResCallbackT): void; - hexists(args: any[], callback?: ResCallbackT): void; - hexists(...args: any[]): void; - incrby(args: any[], callback?: ResCallbackT): void; - incrby(...args: any[]): void; - decrby(args: any[], callback?: ResCallbackT): void; - decrby(...args: any[]): void; - getset(args: any[], callback?: ResCallbackT): void; - getset(...args: any[]): void; - mset(args: any[], callback?: ResCallbackT): void; - mset(...args: any[]): void; - msetnx(args: any[], callback?: ResCallbackT): void; - msetnx(...args: any[]): void; - randomkey(args: any[], callback?: ResCallbackT): void; - randomkey(...args: any[]): void; - select(args: any[], callback?: ResCallbackT): void; - select(...args: any[]): void; - move(args: any[], callback?: ResCallbackT): void; - move(...args: any[]): void; - rename(args: any[], callback?: ResCallbackT): void; - rename(...args: any[]): void; - renamenx(args: any[], callback?: ResCallbackT): void; - renamenx(...args: any[]): void; - expire(args: any[], callback?: ResCallbackT): void; - expire(...args: any[]): void; - expireat(args: any[], callback?: ResCallbackT): void; - expireat(...args: any[]): void; - keys(args: any[], callback?: ResCallbackT): void; - keys(...args: any[]): void; - dbsize(args: any[], callback?: ResCallbackT): void; - dbsize(...args: any[]): void; - auth(args: any[], callback?: ResCallbackT): void; - auth(...args: any[]): void; - ping(args: any[], callback?: ResCallbackT): void; - ping(...args: any[]): void; - echo(args: any[], callback?: ResCallbackT): void; - echo(...args: any[]): void; - save(args: any[], callback?: ResCallbackT): void; - save(...args: any[]): void; - bgsave(args: any[], callback?: ResCallbackT): void; - bgsave(...args: any[]): void; - bgrewriteaof(args: any[], callback?: ResCallbackT): void; - bgrewriteaof(...args: any[]): void; - shutdown(args: any[], callback?: ResCallbackT): void; - shutdown(...args: any[]): void; - lastsave(args: any[], callback?: ResCallbackT): void; - lastsave(...args: any[]): void; - type(args: any[], callback?: ResCallbackT): void; - type(...args: any[]): void; - multi(args: any[], callback?: ResCallbackT): void; - multi(...args: any[]): void; - exec(args: any[], callback?: ResCallbackT): void; - exec(...args: any[]): void; - discard(args: any[], callback?: ResCallbackT): void; - discard(...args: any[]): void; - sync(args: any[], callback?: ResCallbackT): void; - sync(...args: any[]): void; - flushdb(args: any[], callback?: ResCallbackT): void; - flushdb(...args: any[]): void; - flushall(args: any[], callback?: ResCallbackT): void; - flushall(...args: any[]): void; - sort(args: any[], callback?: ResCallbackT): void; - sort(...args: any[]): void; - info(args: any[], callback?: ResCallbackT): void; - info(...args: any[]): void; - monitor(args: any[], callback?: ResCallbackT): void; - monitor(...args: any[]): void; - ttl(args: any[], callback?: ResCallbackT): void; - ttl(...args: any[]): void; - persist(args: any[], callback?: ResCallbackT): void; - persist(...args: any[]): void; - slaveof(args: any[], callback?: ResCallbackT): void; - slaveof(...args: any[]): void; - debug(args: any[], callback?: ResCallbackT): void; - debug(...args: any[]): void; - config(args: any[], callback?: ResCallbackT): void; - config(...args: any[]): void; - subscribe(args: any[], callback?: ResCallbackT): void; - subscribe(...args: any[]): void; - unsubscribe(args: any[], callback?: ResCallbackT): void; - unsubscribe(...args: any[]): void; - psubscribe(args: any[], callback?: ResCallbackT): void; - psubscribe(...args: any[]): void; - punsubscribe(args: any[], callback?: ResCallbackT): void; - punsubscribe(...args: any[]): void; - publish(args: any[], callback?: ResCallbackT): void; - publish(...args: any[]): void; - watch(args: any[], callback?: ResCallbackT): void; - watch(...args: any[]): void; - unwatch(args: any[], callback?: ResCallbackT): void; - unwatch(...args: any[]): void; - cluster(args: any[], callback?: ResCallbackT): void; - cluster(...args: any[]): void; - restore(args: any[], callback?: ResCallbackT): void; - restore(...args: any[]): void; - migrate(args: any[], callback?: ResCallbackT): void; - migrate(...args: any[]): void; - dump(args: any[], callback?: ResCallbackT): void; - dump(...args: any[]): void; - object(args: any[], callback?: ResCallbackT): void; - object(...args: any[]): void; - client(args: any[], callback?: ResCallbackT): void; - client(...args: any[]): void; - eval(args: any[], callback?: ResCallbackT): void; - eval(...args: any[]): void; - evalsha(args: any[], callback?: ResCallbackT): void; - evalsha(...args: any[]): void; - quit(args: any[], callback?: ResCallbackT): void; - quit(...args: any[]): void; - } + publish(channel:string, value:any): void; + subscribe(channel:string): void; + + /* + commands = set_union([ + "get", "set", "setnx", "setex", "append", "strlen", "del", "exists", "setbit", "getbit", "setrange", "getrange", "substr", + "incr", "decr", "mget", "rpush", "lpush", "rpushx", "lpushx", "linsert", "rpop", "lpop", "brpop", "brpoplpush", "blpop", "llen", "lindex", + "lset", "lrange", "ltrim", "lrem", "rpoplpush", "sadd", "srem", "smove", "sismember", "scard", "spop", "srandmember", "sinter", "sinterstore", + "sunion", "sunionstore", "sdiff", "sdiffstore", "smembers", "zadd", "zincrby", "zrem", "zremrangebyscore", "zremrangebyrank", "zunionstore", + "zinterstore", "zrange", "zrangebyscore", "zrevrangebyscore", "zcount", "zrevrange", "zcard", "zscore", "zrank", "zrevrank", "hset", "hsetnx", + "hget", "hmset", "hmget", "hincrby", "hdel", "hlen", "hkeys", "hvals", "hgetall", "hexists", "incrby", "decrby", "getset", "mset", "msetnx", + "randomkey", "select", "move", "rename", "renamenx", "expire", "expireat", "keys", "dbsize", "auth", "ping", "echo", "save", "bgsave", + "bgrewriteaof", "shutdown", "lastsave", "type", "multi", "exec", "discard", "sync", "flushdb", "flushall", "sort", "info", "monitor", "ttl", + "persist", "slaveof", "debug", "config", "subscribe", "unsubscribe", "psubscribe", "punsubscribe", "publish", "watch", "unwatch", "cluster", + "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); + */ + + get(args:any[], callback?:ResCallbackT): void; + get(...args:any[]): void; + set(args:any[], callback?:ResCallbackT): void; + set(...args:any[]): void; + setnx(args:any[], callback?:ResCallbackT): void; + setnx(...args:any[]): void; + setex(args:any[], callback?:ResCallbackT): void; + setex(...args:any[]): void; + append(args:any[], callback?:ResCallbackT): void; + append(...args:any[]): void; + strlen(args:any[], callback?:ResCallbackT): void; + strlen(...args:any[]): void; + del(args:any[], callback?:ResCallbackT): void; + del(...args:any[]): void; + exists(args:any[], callback?:ResCallbackT): void; + exists(...args:any[]): void; + setbit(args:any[], callback?:ResCallbackT): void; + setbit(...args:any[]): void; + getbit(args:any[], callback?:ResCallbackT): void; + getbit(...args:any[]): void; + setrange(args:any[], callback?:ResCallbackT): void; + setrange(...args:any[]): void; + getrange(args:any[], callback?:ResCallbackT): void; + getrange(...args:any[]): void; + substr(args:any[], callback?:ResCallbackT): void; + substr(...args:any[]): void; + incr(args:any[], callback?:ResCallbackT): void; + incr(...args:any[]): void; + decr(args:any[], callback?:ResCallbackT): void; + decr(...args:any[]): void; + mget(args:any[], callback?:ResCallbackT): void; + mget(...args:any[]): void; + rpush(...args:any[]): void; + lpush(args:any[], callback?:ResCallbackT): void; + lpush(...args:any[]): void; + rpushx(args:any[], callback?:ResCallbackT): void; + rpushx(...args:any[]): void; + lpushx(args:any[], callback?:ResCallbackT): void; + lpushx(...args:any[]): void; + linsert(args:any[], callback?:ResCallbackT): void; + linsert(...args:any[]): void; + rpop(args:any[], callback?:ResCallbackT): void; + rpop(...args:any[]): void; + lpop(args:any[], callback?:ResCallbackT): void; + lpop(...args:any[]): void; + brpop(args:any[], callback?:ResCallbackT): void; + brpop(...args:any[]): void; + brpoplpush(args:any[], callback?:ResCallbackT): void; + brpoplpush(...args:any[]): void; + blpop(args:any[], callback?:ResCallbackT): void; + blpop(...args:any[]): void; + llen(args:any[], callback?:ResCallbackT): void; + llen(...args:any[]): void; + lindex(args:any[], callback?:ResCallbackT): void; + lindex(...args:any[]): void; + lset(args:any[], callback?:ResCallbackT): void; + lset(...args:any[]): void; + lrange(args:any[], callback?:ResCallbackT): void; + lrange(...args:any[]): void; + ltrim(args:any[], callback?:ResCallbackT): void; + ltrim(...args:any[]): void; + lrem(args:any[], callback?:ResCallbackT): void; + lrem(...args:any[]): void; + rpoplpush(args:any[], callback?:ResCallbackT): void; + rpoplpush(...args:any[]): void; + sadd(args:any[], callback?:ResCallbackT): void; + sadd(...args:any[]): void; + srem(args:any[], callback?:ResCallbackT): void; + srem(...args:any[]): void; + smove(args:any[], callback?:ResCallbackT): void; + smove(...args:any[]): void; + sismember(args:any[], callback?:ResCallbackT): void; + sismember(...args:any[]): void; + scard(args:any[], callback?:ResCallbackT): void; + scard(...args:any[]): void; + spop(args:any[], callback?:ResCallbackT): void; + spop(...args:any[]): void; + srandmember(args:any[], callback?:ResCallbackT): void; + srandmember(...args:any[]): void; + sinter(args:any[], callback?:ResCallbackT): void; + sinter(...args:any[]): void; + sinterstore(args:any[], callback?:ResCallbackT): void; + sinterstore(...args:any[]): void; + sunion(args:any[], callback?:ResCallbackT): void; + sunion(...args:any[]): void; + sunionstore(args:any[], callback?:ResCallbackT): void; + sunionstore(...args:any[]): void; + sdiff(args:any[], callback?:ResCallbackT): void; + sdiff(...args:any[]): void; + sdiffstore(args:any[], callback?:ResCallbackT): void; + sdiffstore(...args:any[]): void; + smembers(args:any[], callback?:ResCallbackT): void; + smembers(...args:any[]): void; + zadd(args:any[], callback?:ResCallbackT): void; + zadd(...args:any[]): void; + zincrby(args:any[], callback?:ResCallbackT): void; + zincrby(...args:any[]): void; + zrem(args:any[], callback?:ResCallbackT): void; + zrem(...args:any[]): void; + zremrangebyscore(args:any[], callback?:ResCallbackT): void; + zremrangebyscore(...args:any[]): void; + zremrangebyrank(args:any[], callback?:ResCallbackT): void; + zremrangebyrank(...args:any[]): void; + zunionstore(args:any[], callback?:ResCallbackT): void; + zunionstore(...args:any[]): void; + zinterstore(args:any[], callback?:ResCallbackT): void; + zinterstore(...args:any[]): void; + zrange(args:any[], callback?:ResCallbackT): void; + zrange(...args:any[]): void; + zrangebyscore(args:any[], callback?:ResCallbackT): void; + zrangebyscore(...args:any[]): void; + zrevrangebyscore(args:any[], callback?:ResCallbackT): void; + zrevrangebyscore(...args:any[]): void; + zcount(args:any[], callback?:ResCallbackT): void; + zcount(...args:any[]): void; + zrevrange(args:any[], callback?:ResCallbackT): void; + zrevrange(...args:any[]): void; + zcard(args:any[], callback?:ResCallbackT): void; + zcard(...args:any[]): void; + zscore(args:any[], callback?:ResCallbackT): void; + zscore(...args:any[]): void; + zrank(args:any[], callback?:ResCallbackT): void; + zrank(...args:any[]): void; + zrevrank(args:any[], callback?:ResCallbackT): void; + zrevrank(...args:any[]): void; + hset(args:any[], callback?:ResCallbackT): void; + hset(...args:any[]): void; + hsetnx(args:any[], callback?:ResCallbackT): void; + hsetnx(...args:any[]): void; + hget(args:any[], callback?:ResCallbackT): void; + hget(...args:any[]): void; + hmset(args:any[], callback?:ResCallbackT): void; + hmset(key:string, hash:any, callback?:ResCallbackT): void; + hmset(...args:any[]): void; + hmget(args:any[], callback?:ResCallbackT): void; + hmget(...args:any[]): void; + hincrby(args:any[], callback?:ResCallbackT): void; + hincrby(...args:any[]): void; + hdel(args:any[], callback?:ResCallbackT): void; + hdel(...args:any[]): void; + hlen(args:any[], callback?:ResCallbackT): void; + hlen(...args:any[]): void; + hkeys(args:any[], callback?:ResCallbackT): void; + hkeys(...args:any[]): void; + hvals(args:any[], callback?:ResCallbackT): void; + hvals(...args:any[]): void; + hgetall(args:any[], callback?:ResCallbackT): void; + hgetall(...args:any[]): void; + hgetall(key:string, callback?:ResCallbackT): void; + hexists(args:any[], callback?:ResCallbackT): void; + hexists(...args:any[]): void; + incrby(args:any[], callback?:ResCallbackT): void; + incrby(...args:any[]): void; + decrby(args:any[], callback?:ResCallbackT): void; + decrby(...args:any[]): void; + getset(args:any[], callback?:ResCallbackT): void; + getset(...args:any[]): void; + mset(args:any[], callback?:ResCallbackT): void; + mset(...args:any[]): void; + msetnx(args:any[], callback?:ResCallbackT): void; + msetnx(...args:any[]): void; + randomkey(args:any[], callback?:ResCallbackT): void; + randomkey(...args:any[]): void; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): void; + move(args:any[], callback?:ResCallbackT): void; + move(...args:any[]): void; + rename(args:any[], callback?:ResCallbackT): void; + rename(...args:any[]): void; + renamenx(args:any[], callback?:ResCallbackT): void; + renamenx(...args:any[]): void; + expire(args:any[], callback?:ResCallbackT): void; + expire(...args:any[]): void; + expireat(args:any[], callback?:ResCallbackT): void; + expireat(...args:any[]): void; + keys(args:any[], callback?:ResCallbackT): void; + keys(...args:any[]): void; + dbsize(args:any[], callback?:ResCallbackT): void; + dbsize(...args:any[]): void; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): void; + ping(...args:any[]): void; + echo(args:any[], callback?:ResCallbackT): void; + echo(...args:any[]): void; + save(args:any[], callback?:ResCallbackT): void; + save(...args:any[]): void; + bgsave(args:any[], callback?:ResCallbackT): void; + bgsave(...args:any[]): void; + bgrewriteaof(args:any[], callback?:ResCallbackT): void; + bgrewriteaof(...args:any[]): void; + shutdown(args:any[], callback?:ResCallbackT): void; + shutdown(...args:any[]): void; + lastsave(args:any[], callback?:ResCallbackT): void; + lastsave(...args:any[]): void; + type(args:any[], callback?:ResCallbackT): void; + type(...args:any[]): void; + multi(args:any[], callback?:ResCallbackT): void; + multi(...args:any[]): void; + exec(args:any[], callback?:ResCallbackT): void; + exec(...args:any[]): void; + discard(args:any[], callback?:ResCallbackT): void; + discard(...args:any[]): void; + sync(args:any[], callback?:ResCallbackT): void; + sync(...args:any[]): void; + flushdb(args:any[], callback?:ResCallbackT): void; + flushdb(...args:any[]): void; + flushall(args:any[], callback?:ResCallbackT): void; + flushall(...args:any[]): void; + sort(args:any[], callback?:ResCallbackT): void; + sort(...args:any[]): void; + info(args:any[], callback?:ResCallbackT): void; + info(...args:any[]): void; + monitor(args:any[], callback?:ResCallbackT): void; + monitor(...args:any[]): void; + ttl(args:any[], callback?:ResCallbackT): void; + ttl(...args:any[]): void; + persist(args:any[], callback?:ResCallbackT): void; + persist(...args:any[]): void; + slaveof(args:any[], callback?:ResCallbackT): void; + slaveof(...args:any[]): void; + debug(args:any[], callback?:ResCallbackT): void; + debug(...args:any[]): void; + config(args:any[], callback?:ResCallbackT): void; + config(...args:any[]): void; + subscribe(args:any[], callback?:ResCallbackT): void; + subscribe(...args:any[]): void; + unsubscribe(args:any[], callback?:ResCallbackT): void; + unsubscribe(...args:any[]): void; + psubscribe(args:any[], callback?:ResCallbackT): void; + psubscribe(...args:any[]): void; + punsubscribe(args:any[], callback?:ResCallbackT): void; + punsubscribe(...args:any[]): void; + publish(args:any[], callback?:ResCallbackT): void; + publish(...args:any[]): void; + watch(args:any[], callback?:ResCallbackT): void; + watch(...args:any[]): void; + unwatch(args:any[], callback?:ResCallbackT): void; + unwatch(...args:any[]): void; + cluster(args:any[], callback?:ResCallbackT): void; + cluster(...args:any[]): void; + restore(args:any[], callback?:ResCallbackT): void; + restore(...args:any[]): void; + migrate(args:any[], callback?:ResCallbackT): void; + migrate(...args:any[]): void; + dump(args:any[], callback?:ResCallbackT): void; + dump(...args:any[]): void; + object(args:any[], callback?:ResCallbackT): void; + object(...args:any[]): void; + client(args:any[], callback?:ResCallbackT): void; + client(...args:any[]): void; + eval(args:any[], callback?:ResCallbackT): void; + eval(...args:any[]): void; + evalsha(args:any[], callback?:ResCallbackT): void; + evalsha(...args:any[]): void; + quit(args:any[], callback?:ResCallbackT): void; + quit(...args:any[]): void; + } } From f371b44439297704fa3cb738a3ea17797cdf1027 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 10:54:20 +0900 Subject: [PATCH 005/189] redis: add properties to ClientOpts interface --- redis/redis.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index ec7220cee..886e285ca 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -39,12 +39,16 @@ declare module "redis" { 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; } interface RedisClient extends NodeJS.EventEmitter { From 0c3aa92a0b1d8da19600644123fc1652d8c87b1c Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 11:24:21 +0900 Subject: [PATCH 006/189] redis: update tests --- redis/redis-tests.ts | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/redis/redis-tests.ts b/redis/redis-tests.ts index 9c7003541..b65cad599 100644 --- a/redis/redis-tests.ts +++ b/redis/redis-tests.ts @@ -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,28 @@ 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); \ No newline at end of file From da1d0dcc70a919cd5e2ef29daec707b20d60bc65 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 11:27:08 +0900 Subject: [PATCH 007/189] redis: update tests --- redis/redis-tests.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redis/redis-tests.ts b/redis/redis-tests.ts index b65cad599..5acb02465 100644 --- a/redis/redis-tests.ts +++ b/redis/redis-tests.ts @@ -86,4 +86,7 @@ client.multi() client.multi(commandArr).exec(); // Monitor mode -client.monitor(resCallback); \ No newline at end of file +client.monitor(resCallback); + +// Send command +client.send_command(str, args, resCallback); \ No newline at end of file From 9ae4d7f7bac138e262f9061843378a22b4298f44 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 11:44:58 +0900 Subject: [PATCH 008/189] redis: fix return value type of command methods. --- redis/redis.d.ts | 528 +++++++++++++++++++++++------------------------ 1 file changed, 264 insertions(+), 264 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 886e285ca..78d49499d 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -71,19 +71,19 @@ declare module "redis" { end(): void; // Connection (http://redis.io/commands#connection) - auth(password:string, callback?:ResCallbackT): void; - ping(callback?:ResCallbackT): void; + auth(password:string, callback?:ResCallbackT): boolean; + ping(callback?:ResCallbackT): boolean; // Strings (http://redis.io/commands#strings) - append(key:string, value:string, callback?:ResCallbackT): void; - bitcount(key:string, callback?:ResCallbackT): void; - bitcount(key:string, start:number, end:number, callback?:ResCallbackT): void; - set(key:string, value:string, callback?:ResCallbackT): void; - get(key:string, callback?:ResCallbackT): void; - exists(key:string, value:string, callback?:ResCallbackT): void; + append(key:string, value:string, callback?:ResCallbackT): boolean; + bitcount(key:string, callback?:ResCallbackT): boolean; + bitcount(key:string, start:number, end:number, callback?:ResCallbackT): boolean; + set(key:string, value:string, callback?:ResCallbackT): boolean; + get(key:string, callback?:ResCallbackT): boolean; + exists(key:string, value:string, callback?:ResCallbackT): boolean; - publish(channel:string, value:any): void; - subscribe(channel:string): void; + publish(channel:string, value:any): boolean; + subscribe(channel:string): boolean; /* commands = set_union([ @@ -99,262 +99,262 @@ declare module "redis" { "restore", "migrate", "dump", "object", "client", "eval", "evalsha"], require("./lib/commands")); */ - get(args:any[], callback?:ResCallbackT): void; - get(...args:any[]): void; - set(args:any[], callback?:ResCallbackT): void; - set(...args:any[]): void; - setnx(args:any[], callback?:ResCallbackT): void; - setnx(...args:any[]): void; - setex(args:any[], callback?:ResCallbackT): void; - setex(...args:any[]): void; - append(args:any[], callback?:ResCallbackT): void; - append(...args:any[]): void; - strlen(args:any[], callback?:ResCallbackT): void; - strlen(...args:any[]): void; - del(args:any[], callback?:ResCallbackT): void; - del(...args:any[]): void; - exists(args:any[], callback?:ResCallbackT): void; - exists(...args:any[]): void; - setbit(args:any[], callback?:ResCallbackT): void; - setbit(...args:any[]): void; - getbit(args:any[], callback?:ResCallbackT): void; - getbit(...args:any[]): void; - setrange(args:any[], callback?:ResCallbackT): void; - setrange(...args:any[]): void; - getrange(args:any[], callback?:ResCallbackT): void; - getrange(...args:any[]): void; - substr(args:any[], callback?:ResCallbackT): void; - substr(...args:any[]): void; - incr(args:any[], callback?:ResCallbackT): void; - incr(...args:any[]): void; - decr(args:any[], callback?:ResCallbackT): void; - decr(...args:any[]): void; - mget(args:any[], callback?:ResCallbackT): void; - mget(...args:any[]): void; - rpush(...args:any[]): void; - lpush(args:any[], callback?:ResCallbackT): void; - lpush(...args:any[]): void; - rpushx(args:any[], callback?:ResCallbackT): void; - rpushx(...args:any[]): void; - lpushx(args:any[], callback?:ResCallbackT): void; - lpushx(...args:any[]): void; - linsert(args:any[], callback?:ResCallbackT): void; - linsert(...args:any[]): void; - rpop(args:any[], callback?:ResCallbackT): void; - rpop(...args:any[]): void; - lpop(args:any[], callback?:ResCallbackT): void; - lpop(...args:any[]): void; - brpop(args:any[], callback?:ResCallbackT): void; - brpop(...args:any[]): void; - brpoplpush(args:any[], callback?:ResCallbackT): void; - brpoplpush(...args:any[]): void; - blpop(args:any[], callback?:ResCallbackT): void; - blpop(...args:any[]): void; - llen(args:any[], callback?:ResCallbackT): void; - llen(...args:any[]): void; - lindex(args:any[], callback?:ResCallbackT): void; - lindex(...args:any[]): void; - lset(args:any[], callback?:ResCallbackT): void; - lset(...args:any[]): void; - lrange(args:any[], callback?:ResCallbackT): void; - lrange(...args:any[]): void; - ltrim(args:any[], callback?:ResCallbackT): void; - ltrim(...args:any[]): void; - lrem(args:any[], callback?:ResCallbackT): void; - lrem(...args:any[]): void; - rpoplpush(args:any[], callback?:ResCallbackT): void; - rpoplpush(...args:any[]): void; - sadd(args:any[], callback?:ResCallbackT): void; - sadd(...args:any[]): void; - srem(args:any[], callback?:ResCallbackT): void; - srem(...args:any[]): void; - smove(args:any[], callback?:ResCallbackT): void; - smove(...args:any[]): void; - sismember(args:any[], callback?:ResCallbackT): void; - sismember(...args:any[]): void; - scard(args:any[], callback?:ResCallbackT): void; - scard(...args:any[]): void; - spop(args:any[], callback?:ResCallbackT): void; - spop(...args:any[]): void; - srandmember(args:any[], callback?:ResCallbackT): void; - srandmember(...args:any[]): void; - sinter(args:any[], callback?:ResCallbackT): void; - sinter(...args:any[]): void; - sinterstore(args:any[], callback?:ResCallbackT): void; - sinterstore(...args:any[]): void; - sunion(args:any[], callback?:ResCallbackT): void; - sunion(...args:any[]): void; - sunionstore(args:any[], callback?:ResCallbackT): void; - sunionstore(...args:any[]): void; - sdiff(args:any[], callback?:ResCallbackT): void; - sdiff(...args:any[]): void; - sdiffstore(args:any[], callback?:ResCallbackT): void; - sdiffstore(...args:any[]): void; - smembers(args:any[], callback?:ResCallbackT): void; - smembers(...args:any[]): void; - zadd(args:any[], callback?:ResCallbackT): void; - zadd(...args:any[]): void; - zincrby(args:any[], callback?:ResCallbackT): void; - zincrby(...args:any[]): void; - zrem(args:any[], callback?:ResCallbackT): void; - zrem(...args:any[]): void; - zremrangebyscore(args:any[], callback?:ResCallbackT): void; - zremrangebyscore(...args:any[]): void; - zremrangebyrank(args:any[], callback?:ResCallbackT): void; - zremrangebyrank(...args:any[]): void; - zunionstore(args:any[], callback?:ResCallbackT): void; - zunionstore(...args:any[]): void; - zinterstore(args:any[], callback?:ResCallbackT): void; - zinterstore(...args:any[]): void; - zrange(args:any[], callback?:ResCallbackT): void; - zrange(...args:any[]): void; - zrangebyscore(args:any[], callback?:ResCallbackT): void; - zrangebyscore(...args:any[]): void; - zrevrangebyscore(args:any[], callback?:ResCallbackT): void; - zrevrangebyscore(...args:any[]): void; - zcount(args:any[], callback?:ResCallbackT): void; - zcount(...args:any[]): void; - zrevrange(args:any[], callback?:ResCallbackT): void; - zrevrange(...args:any[]): void; - zcard(args:any[], callback?:ResCallbackT): void; - zcard(...args:any[]): void; - zscore(args:any[], callback?:ResCallbackT): void; - zscore(...args:any[]): void; - zrank(args:any[], callback?:ResCallbackT): void; - zrank(...args:any[]): void; - zrevrank(args:any[], callback?:ResCallbackT): void; - zrevrank(...args:any[]): void; - hset(args:any[], callback?:ResCallbackT): void; - hset(...args:any[]): void; - hsetnx(args:any[], callback?:ResCallbackT): void; - hsetnx(...args:any[]): void; - hget(args:any[], callback?:ResCallbackT): void; - hget(...args:any[]): void; - hmset(args:any[], callback?:ResCallbackT): void; - hmset(key:string, hash:any, callback?:ResCallbackT): void; - hmset(...args:any[]): void; - hmget(args:any[], callback?:ResCallbackT): void; - hmget(...args:any[]): void; - hincrby(args:any[], callback?:ResCallbackT): void; - hincrby(...args:any[]): void; - hdel(args:any[], callback?:ResCallbackT): void; - hdel(...args:any[]): void; - hlen(args:any[], callback?:ResCallbackT): void; - hlen(...args:any[]): void; - hkeys(args:any[], callback?:ResCallbackT): void; - hkeys(...args:any[]): void; - hvals(args:any[], callback?:ResCallbackT): void; - hvals(...args:any[]): void; - hgetall(args:any[], callback?:ResCallbackT): void; - hgetall(...args:any[]): void; - hgetall(key:string, callback?:ResCallbackT): void; - hexists(args:any[], callback?:ResCallbackT): void; - hexists(...args:any[]): void; - incrby(args:any[], callback?:ResCallbackT): void; - incrby(...args:any[]): void; - decrby(args:any[], callback?:ResCallbackT): void; - decrby(...args:any[]): void; - getset(args:any[], callback?:ResCallbackT): void; - getset(...args:any[]): void; - mset(args:any[], callback?:ResCallbackT): void; - mset(...args:any[]): void; - msetnx(args:any[], callback?:ResCallbackT): void; - msetnx(...args:any[]): void; - randomkey(args:any[], callback?:ResCallbackT): void; - randomkey(...args:any[]): void; + get(args:any[], callback?:ResCallbackT): boolean; + get(...args:any[]): boolean; + set(args:any[], callback?:ResCallbackT): boolean; + set(...args:any[]): boolean; + setnx(args:any[], callback?:ResCallbackT): boolean; + setnx(...args:any[]): boolean; + setex(args:any[], callback?:ResCallbackT): boolean; + setex(...args:any[]): boolean; + append(args:any[], callback?:ResCallbackT): boolean; + append(...args:any[]): boolean; + strlen(args:any[], callback?:ResCallbackT): boolean; + strlen(...args:any[]): boolean; + del(args:any[], callback?:ResCallbackT): boolean; + del(...args:any[]): boolean; + exists(args:any[], callback?:ResCallbackT): boolean; + exists(...args:any[]): boolean; + setbit(args:any[], callback?:ResCallbackT): boolean; + setbit(...args:any[]): boolean; + getbit(args:any[], callback?:ResCallbackT): boolean; + getbit(...args:any[]): boolean; + setrange(args:any[], callback?:ResCallbackT): boolean; + setrange(...args:any[]): boolean; + getrange(args:any[], callback?:ResCallbackT): boolean; + getrange(...args:any[]): boolean; + substr(args:any[], callback?:ResCallbackT): boolean; + substr(...args:any[]): boolean; + incr(args:any[], callback?:ResCallbackT): boolean; + incr(...args:any[]): boolean; + decr(args:any[], callback?:ResCallbackT): boolean; + decr(...args:any[]): boolean; + mget(args:any[], callback?:ResCallbackT): boolean; + mget(...args:any[]): boolean; + rpush(...args:any[]): boolean; + lpush(args:any[], callback?:ResCallbackT): boolean; + lpush(...args:any[]): boolean; + rpushx(args:any[], callback?:ResCallbackT): boolean; + rpushx(...args:any[]): boolean; + lpushx(args:any[], callback?:ResCallbackT): boolean; + lpushx(...args:any[]): boolean; + linsert(args:any[], callback?:ResCallbackT): boolean; + linsert(...args:any[]): boolean; + rpop(args:any[], callback?:ResCallbackT): boolean; + rpop(...args:any[]): boolean; + lpop(args:any[], callback?:ResCallbackT): boolean; + lpop(...args:any[]): boolean; + brpop(args:any[], callback?:ResCallbackT): boolean; + brpop(...args:any[]): boolean; + brpoplpush(args:any[], callback?:ResCallbackT): boolean; + brpoplpush(...args:any[]): boolean; + blpop(args:any[], callback?:ResCallbackT): boolean; + blpop(...args:any[]): boolean; + llen(args:any[], callback?:ResCallbackT): boolean; + llen(...args:any[]): boolean; + lindex(args:any[], callback?:ResCallbackT): boolean; + lindex(...args:any[]): boolean; + lset(args:any[], callback?:ResCallbackT): boolean; + lset(...args:any[]): boolean; + lrange(args:any[], callback?:ResCallbackT): boolean; + lrange(...args:any[]): boolean; + ltrim(args:any[], callback?:ResCallbackT): boolean; + ltrim(...args:any[]): boolean; + lrem(args:any[], callback?:ResCallbackT): boolean; + lrem(...args:any[]): boolean; + rpoplpush(args:any[], callback?:ResCallbackT): boolean; + rpoplpush(...args:any[]): boolean; + sadd(args:any[], callback?:ResCallbackT): boolean; + sadd(...args:any[]): boolean; + srem(args:any[], callback?:ResCallbackT): boolean; + srem(...args:any[]): boolean; + smove(args:any[], callback?:ResCallbackT): boolean; + smove(...args:any[]): boolean; + sismember(args:any[], callback?:ResCallbackT): boolean; + sismember(...args:any[]): boolean; + scard(args:any[], callback?:ResCallbackT): boolean; + scard(...args:any[]): boolean; + spop(args:any[], callback?:ResCallbackT): boolean; + spop(...args:any[]): boolean; + srandmember(args:any[], callback?:ResCallbackT): boolean; + srandmember(...args:any[]): boolean; + sinter(args:any[], callback?:ResCallbackT): boolean; + sinter(...args:any[]): boolean; + sinterstore(args:any[], callback?:ResCallbackT): boolean; + sinterstore(...args:any[]): boolean; + sunion(args:any[], callback?:ResCallbackT): boolean; + sunion(...args:any[]): boolean; + sunionstore(args:any[], callback?:ResCallbackT): boolean; + sunionstore(...args:any[]): boolean; + sdiff(args:any[], callback?:ResCallbackT): boolean; + sdiff(...args:any[]): boolean; + sdiffstore(args:any[], callback?:ResCallbackT): boolean; + sdiffstore(...args:any[]): boolean; + smembers(args:any[], callback?:ResCallbackT): boolean; + smembers(...args:any[]): boolean; + zadd(args:any[], callback?:ResCallbackT): boolean; + zadd(...args:any[]): boolean; + zincrby(args:any[], callback?:ResCallbackT): boolean; + zincrby(...args:any[]): boolean; + zrem(args:any[], callback?:ResCallbackT): boolean; + zrem(...args:any[]): boolean; + zremrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zremrangebyscore(...args:any[]): boolean; + zremrangebyrank(args:any[], callback?:ResCallbackT): boolean; + zremrangebyrank(...args:any[]): boolean; + zunionstore(args:any[], callback?:ResCallbackT): boolean; + zunionstore(...args:any[]): boolean; + zinterstore(args:any[], callback?:ResCallbackT): boolean; + zinterstore(...args:any[]): boolean; + zrange(args:any[], callback?:ResCallbackT): boolean; + zrange(...args:any[]): boolean; + zrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrangebyscore(...args:any[]): boolean; + zrevrangebyscore(args:any[], callback?:ResCallbackT): boolean; + zrevrangebyscore(...args:any[]): boolean; + zcount(args:any[], callback?:ResCallbackT): boolean; + zcount(...args:any[]): boolean; + zrevrange(args:any[], callback?:ResCallbackT): boolean; + zrevrange(...args:any[]): boolean; + zcard(args:any[], callback?:ResCallbackT): boolean; + zcard(...args:any[]): boolean; + zscore(args:any[], callback?:ResCallbackT): boolean; + zscore(...args:any[]): boolean; + zrank(args:any[], callback?:ResCallbackT): boolean; + zrank(...args:any[]): boolean; + zrevrank(args:any[], callback?:ResCallbackT): boolean; + zrevrank(...args:any[]): boolean; + hset(args:any[], callback?:ResCallbackT): boolean; + hset(...args:any[]): boolean; + hsetnx(args:any[], callback?:ResCallbackT): boolean; + hsetnx(...args:any[]): boolean; + hget(args:any[], callback?:ResCallbackT): boolean; + hget(...args:any[]): boolean; + hmset(args:any[], callback?:ResCallbackT): boolean; + hmset(key:string, hash:any, callback?:ResCallbackT): boolean; + hmset(...args:any[]): boolean; + hmget(args:any[], callback?:ResCallbackT): boolean; + hmget(...args:any[]): boolean; + hincrby(args:any[], callback?:ResCallbackT): boolean; + hincrby(...args:any[]): boolean; + hdel(args:any[], callback?:ResCallbackT): boolean; + hdel(...args:any[]): boolean; + hlen(args:any[], callback?:ResCallbackT): boolean; + hlen(...args:any[]): boolean; + hkeys(args:any[], callback?:ResCallbackT): boolean; + hkeys(...args:any[]): boolean; + hvals(args:any[], callback?:ResCallbackT): boolean; + hvals(...args:any[]): boolean; + hgetall(args:any[], callback?:ResCallbackT): boolean; + hgetall(...args:any[]): boolean; + hgetall(key:string, callback?:ResCallbackT): boolean; + hexists(args:any[], callback?:ResCallbackT): boolean; + hexists(...args:any[]): boolean; + incrby(args:any[], callback?:ResCallbackT): boolean; + incrby(...args:any[]): boolean; + decrby(args:any[], callback?:ResCallbackT): boolean; + decrby(...args:any[]): boolean; + getset(args:any[], callback?:ResCallbackT): boolean; + getset(...args:any[]): boolean; + mset(args:any[], callback?:ResCallbackT): boolean; + mset(...args:any[]): boolean; + msetnx(args:any[], callback?:ResCallbackT): boolean; + msetnx(...args:any[]): boolean; + randomkey(args:any[], callback?:ResCallbackT): boolean; + randomkey(...args:any[]): boolean; select(args:any[], callback?:ResCallbackT): void; - select(...args:any[]): void; - move(args:any[], callback?:ResCallbackT): void; - move(...args:any[]): void; - rename(args:any[], callback?:ResCallbackT): void; - rename(...args:any[]): void; - renamenx(args:any[], callback?:ResCallbackT): void; - renamenx(...args:any[]): void; - expire(args:any[], callback?:ResCallbackT): void; - expire(...args:any[]): void; - expireat(args:any[], callback?:ResCallbackT): void; - expireat(...args:any[]): void; - keys(args:any[], callback?:ResCallbackT): void; - keys(...args:any[]): void; - dbsize(args:any[], callback?:ResCallbackT): void; - dbsize(...args:any[]): void; + select(...args:any[]): boolean; + move(args:any[], callback?:ResCallbackT): boolean; + move(...args:any[]): boolean; + rename(args:any[], callback?:ResCallbackT): boolean; + rename(...args:any[]): boolean; + renamenx(args:any[], callback?:ResCallbackT): boolean; + renamenx(...args:any[]): boolean; + expire(args:any[], callback?:ResCallbackT): boolean; + expire(...args:any[]): boolean; + expireat(args:any[], callback?:ResCallbackT): boolean; + expireat(...args:any[]): boolean; + keys(args:any[], callback?:ResCallbackT): boolean; + keys(...args:any[]): boolean; + dbsize(args:any[], callback?:ResCallbackT): boolean; + dbsize(...args:any[]): boolean; auth(args:any[], callback?:ResCallbackT): void; auth(...args:any[]): void; - ping(args:any[], callback?:ResCallbackT): void; - ping(...args:any[]): void; - echo(args:any[], callback?:ResCallbackT): void; - echo(...args:any[]): void; - save(args:any[], callback?:ResCallbackT): void; - save(...args:any[]): void; - bgsave(args:any[], callback?:ResCallbackT): void; - bgsave(...args:any[]): void; - bgrewriteaof(args:any[], callback?:ResCallbackT): void; - bgrewriteaof(...args:any[]): void; - shutdown(args:any[], callback?:ResCallbackT): void; - shutdown(...args:any[]): void; - lastsave(args:any[], callback?:ResCallbackT): void; - lastsave(...args:any[]): void; - type(args:any[], callback?:ResCallbackT): void; - type(...args:any[]): void; - multi(args:any[], callback?:ResCallbackT): void; - multi(...args:any[]): void; - exec(args:any[], callback?:ResCallbackT): void; - exec(...args:any[]): void; - discard(args:any[], callback?:ResCallbackT): void; - discard(...args:any[]): void; - sync(args:any[], callback?:ResCallbackT): void; - sync(...args:any[]): void; - flushdb(args:any[], callback?:ResCallbackT): void; - flushdb(...args:any[]): void; - flushall(args:any[], callback?:ResCallbackT): void; - flushall(...args:any[]): void; - sort(args:any[], callback?:ResCallbackT): void; - sort(...args:any[]): void; - info(args:any[], callback?:ResCallbackT): void; - info(...args:any[]): void; - monitor(args:any[], callback?:ResCallbackT): void; - monitor(...args:any[]): void; - ttl(args:any[], callback?:ResCallbackT): void; - ttl(...args:any[]): void; - persist(args:any[], callback?:ResCallbackT): void; - persist(...args:any[]): void; - slaveof(args:any[], callback?:ResCallbackT): void; - slaveof(...args:any[]): void; - debug(args:any[], callback?:ResCallbackT): void; - debug(...args:any[]): void; - config(args:any[], callback?:ResCallbackT): void; - config(...args:any[]): void; - subscribe(args:any[], callback?:ResCallbackT): void; - subscribe(...args:any[]): void; - unsubscribe(args:any[], callback?:ResCallbackT): void; - unsubscribe(...args:any[]): void; - psubscribe(args:any[], callback?:ResCallbackT): void; - psubscribe(...args:any[]): void; - punsubscribe(args:any[], callback?:ResCallbackT): void; - punsubscribe(...args:any[]): void; - publish(args:any[], callback?:ResCallbackT): void; - publish(...args:any[]): void; - watch(args:any[], callback?:ResCallbackT): void; - watch(...args:any[]): void; - unwatch(args:any[], callback?:ResCallbackT): void; - unwatch(...args:any[]): void; - cluster(args:any[], callback?:ResCallbackT): void; - cluster(...args:any[]): void; - restore(args:any[], callback?:ResCallbackT): void; - restore(...args:any[]): void; - migrate(args:any[], callback?:ResCallbackT): void; - migrate(...args:any[]): void; - dump(args:any[], callback?:ResCallbackT): void; - dump(...args:any[]): void; - object(args:any[], callback?:ResCallbackT): void; - object(...args:any[]): void; - client(args:any[], callback?:ResCallbackT): void; - client(...args:any[]): void; - eval(args:any[], callback?:ResCallbackT): void; - eval(...args:any[]): void; - evalsha(args:any[], callback?:ResCallbackT): void; - evalsha(...args:any[]): void; - quit(args:any[], callback?:ResCallbackT): void; - quit(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): boolean; + ping(...args:any[]): boolean; + echo(args:any[], callback?:ResCallbackT): boolean; + echo(...args:any[]): boolean; + save(args:any[], callback?:ResCallbackT): boolean; + save(...args:any[]): boolean; + bgsave(args:any[], callback?:ResCallbackT): boolean; + bgsave(...args:any[]): boolean; + bgrewriteaof(args:any[], callback?:ResCallbackT): boolean; + bgrewriteaof(...args:any[]): boolean; + shutdown(args:any[], callback?:ResCallbackT): boolean; + shutdown(...args:any[]): boolean; + lastsave(args:any[], callback?:ResCallbackT): boolean; + lastsave(...args:any[]): boolean; + type(args:any[], callback?:ResCallbackT): boolean; + type(...args:any[]): boolean; + multi(args:any[], callback?:ResCallbackT): boolean; + multi(...args:any[]): boolean; + exec(args:any[], callback?:ResCallbackT): boolean; + exec(...args:any[]): boolean; + discard(args:any[], callback?:ResCallbackT): boolean; + discard(...args:any[]): boolean; + sync(args:any[], callback?:ResCallbackT): boolean; + sync(...args:any[]): boolean; + flushdb(args:any[], callback?:ResCallbackT): boolean; + flushdb(...args:any[]): boolean; + flushall(args:any[], callback?:ResCallbackT): boolean; + flushall(...args:any[]): boolean; + sort(args:any[], callback?:ResCallbackT): boolean; + sort(...args:any[]): boolean; + info(args:any[], callback?:ResCallbackT): boolean; + info(...args:any[]): boolean; + monitor(args:any[], callback?:ResCallbackT): boolean; + monitor(...args:any[]): boolean; + ttl(args:any[], callback?:ResCallbackT): boolean; + ttl(...args:any[]): boolean; + persist(args:any[], callback?:ResCallbackT): boolean; + persist(...args:any[]): boolean; + slaveof(args:any[], callback?:ResCallbackT): boolean; + slaveof(...args:any[]): boolean; + debug(args:any[], callback?:ResCallbackT): boolean; + debug(...args:any[]): boolean; + config(args:any[], callback?:ResCallbackT): boolean; + config(...args:any[]): boolean; + subscribe(args:any[], callback?:ResCallbackT): boolean; + subscribe(...args:any[]): boolean; + unsubscribe(args:any[], callback?:ResCallbackT): boolean; + unsubscribe(...args:any[]): boolean; + psubscribe(args:any[], callback?:ResCallbackT): boolean; + psubscribe(...args:any[]): boolean; + punsubscribe(args:any[], callback?:ResCallbackT): boolean; + punsubscribe(...args:any[]): boolean; + publish(args:any[], callback?:ResCallbackT): boolean; + publish(...args:any[]): boolean; + watch(args:any[], callback?:ResCallbackT): boolean; + watch(...args:any[]): boolean; + unwatch(args:any[], callback?:ResCallbackT): boolean; + unwatch(...args:any[]): boolean; + cluster(args:any[], callback?:ResCallbackT): boolean; + cluster(...args:any[]): boolean; + restore(args:any[], callback?:ResCallbackT): boolean; + restore(...args:any[]): boolean; + migrate(args:any[], callback?:ResCallbackT): boolean; + migrate(...args:any[]): boolean; + dump(args:any[], callback?:ResCallbackT): boolean; + dump(...args:any[]): boolean; + object(args:any[], callback?:ResCallbackT): boolean; + object(...args:any[]): boolean; + client(args:any[], callback?:ResCallbackT): boolean; + client(...args:any[]): boolean; + eval(args:any[], callback?:ResCallbackT): boolean; + eval(...args:any[]): boolean; + evalsha(args:any[], callback?:ResCallbackT): boolean; + evalsha(...args:any[]): boolean; + quit(args:any[], callback?:ResCallbackT): boolean; + quit(...args:any[]): boolean; } } From 014ff4745d4b02f8408e5ba4f9dca8e5ea92893a Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 12:04:33 +0900 Subject: [PATCH 009/189] redis: add Multi interface as a return value of RedisClient.mult() --- redis/redis.d.ts | 266 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 264 insertions(+), 2 deletions(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 78d49499d..444b91c4c 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -296,8 +296,8 @@ declare module "redis" { lastsave(...args:any[]): boolean; type(args:any[], callback?:ResCallbackT): boolean; type(...args:any[]): boolean; - multi(args:any[], callback?:ResCallbackT): boolean; - multi(...args:any[]): boolean; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; exec(args:any[], callback?:ResCallbackT): boolean; exec(...args:any[]): boolean; discard(args:any[], callback?:ResCallbackT): boolean; @@ -357,4 +357,266 @@ declare module "redis" { quit(args:any[], callback?:ResCallbackT): boolean; quit(...args:any[]): boolean; } + + interface Multi { + exec(callback?:ResCallbackT): boolean; + + get(args:any[], callback?:ResCallbackT): Multi; + get(...args:any[]): Multi; + set(args:any[], callback?:ResCallbackT): Multi; + set(...args:any[]): Multi; + setnx(args:any[], callback?:ResCallbackT): Multi; + setnx(...args:any[]): Multi; + setex(args:any[], callback?:ResCallbackT): Multi; + setex(...args:any[]): Multi; + append(args:any[], callback?:ResCallbackT): Multi; + append(...args:any[]): Multi; + strlen(args:any[], callback?:ResCallbackT): Multi; + strlen(...args:any[]): Multi; + del(args:any[], callback?:ResCallbackT): Multi; + del(...args:any[]): Multi; + exists(args:any[], callback?:ResCallbackT): Multi; + exists(...args:any[]): Multi; + setbit(args:any[], callback?:ResCallbackT): Multi; + setbit(...args:any[]): Multi; + getbit(args:any[], callback?:ResCallbackT): Multi; + getbit(...args:any[]): Multi; + setrange(args:any[], callback?:ResCallbackT): Multi; + setrange(...args:any[]): Multi; + getrange(args:any[], callback?:ResCallbackT): Multi; + getrange(...args:any[]): Multi; + substr(args:any[], callback?:ResCallbackT): Multi; + substr(...args:any[]): Multi; + incr(args:any[], callback?:ResCallbackT): Multi; + incr(...args:any[]): Multi; + decr(args:any[], callback?:ResCallbackT): Multi; + decr(...args:any[]): Multi; + mget(args:any[], callback?:ResCallbackT): Multi; + mget(...args:any[]): Multi; + rpush(...args:any[]): Multi; + lpush(args:any[], callback?:ResCallbackT): Multi; + lpush(...args:any[]): Multi; + rpushx(args:any[], callback?:ResCallbackT): Multi; + rpushx(...args:any[]): Multi; + lpushx(args:any[], callback?:ResCallbackT): Multi; + lpushx(...args:any[]): Multi; + linsert(args:any[], callback?:ResCallbackT): Multi; + linsert(...args:any[]): Multi; + rpop(args:any[], callback?:ResCallbackT): Multi; + rpop(...args:any[]): Multi; + lpop(args:any[], callback?:ResCallbackT): Multi; + lpop(...args:any[]): Multi; + brpop(args:any[], callback?:ResCallbackT): Multi; + brpop(...args:any[]): Multi; + brpoplpush(args:any[], callback?:ResCallbackT): Multi; + brpoplpush(...args:any[]): Multi; + blpop(args:any[], callback?:ResCallbackT): Multi; + blpop(...args:any[]): Multi; + llen(args:any[], callback?:ResCallbackT): Multi; + llen(...args:any[]): Multi; + lindex(args:any[], callback?:ResCallbackT): Multi; + lindex(...args:any[]): Multi; + lset(args:any[], callback?:ResCallbackT): Multi; + lset(...args:any[]): Multi; + lrange(args:any[], callback?:ResCallbackT): Multi; + lrange(...args:any[]): Multi; + ltrim(args:any[], callback?:ResCallbackT): Multi; + ltrim(...args:any[]): Multi; + lrem(args:any[], callback?:ResCallbackT): Multi; + lrem(...args:any[]): Multi; + rpoplpush(args:any[], callback?:ResCallbackT): Multi; + rpoplpush(...args:any[]): Multi; + sadd(args:any[], callback?:ResCallbackT): Multi; + sadd(...args:any[]): Multi; + srem(args:any[], callback?:ResCallbackT): Multi; + srem(...args:any[]): Multi; + smove(args:any[], callback?:ResCallbackT): Multi; + smove(...args:any[]): Multi; + sismember(args:any[], callback?:ResCallbackT): Multi; + sismember(...args:any[]): Multi; + scard(args:any[], callback?:ResCallbackT): Multi; + scard(...args:any[]): Multi; + spop(args:any[], callback?:ResCallbackT): Multi; + spop(...args:any[]): Multi; + srandmember(args:any[], callback?:ResCallbackT): Multi; + srandmember(...args:any[]): Multi; + sinter(args:any[], callback?:ResCallbackT): Multi; + sinter(...args:any[]): Multi; + sinterstore(args:any[], callback?:ResCallbackT): Multi; + sinterstore(...args:any[]): Multi; + sunion(args:any[], callback?:ResCallbackT): Multi; + sunion(...args:any[]): Multi; + sunionstore(args:any[], callback?:ResCallbackT): Multi; + sunionstore(...args:any[]): Multi; + sdiff(args:any[], callback?:ResCallbackT): Multi; + sdiff(...args:any[]): Multi; + sdiffstore(args:any[], callback?:ResCallbackT): Multi; + sdiffstore(...args:any[]): Multi; + smembers(args:any[], callback?:ResCallbackT): Multi; + smembers(...args:any[]): Multi; + zadd(args:any[], callback?:ResCallbackT): Multi; + zadd(...args:any[]): Multi; + zincrby(args:any[], callback?:ResCallbackT): Multi; + zincrby(...args:any[]): Multi; + zrem(args:any[], callback?:ResCallbackT): Multi; + zrem(...args:any[]): Multi; + zremrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zremrangebyscore(...args:any[]): Multi; + zremrangebyrank(args:any[], callback?:ResCallbackT): Multi; + zremrangebyrank(...args:any[]): Multi; + zunionstore(args:any[], callback?:ResCallbackT): Multi; + zunionstore(...args:any[]): Multi; + zinterstore(args:any[], callback?:ResCallbackT): Multi; + zinterstore(...args:any[]): Multi; + zrange(args:any[], callback?:ResCallbackT): Multi; + zrange(...args:any[]): Multi; + zrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrangebyscore(...args:any[]): Multi; + zrevrangebyscore(args:any[], callback?:ResCallbackT): Multi; + zrevrangebyscore(...args:any[]): Multi; + zcount(args:any[], callback?:ResCallbackT): Multi; + zcount(...args:any[]): Multi; + zrevrange(args:any[], callback?:ResCallbackT): Multi; + zrevrange(...args:any[]): Multi; + zcard(args:any[], callback?:ResCallbackT): Multi; + zcard(...args:any[]): Multi; + zscore(args:any[], callback?:ResCallbackT): Multi; + zscore(...args:any[]): Multi; + zrank(args:any[], callback?:ResCallbackT): Multi; + zrank(...args:any[]): Multi; + zrevrank(args:any[], callback?:ResCallbackT): Multi; + zrevrank(...args:any[]): Multi; + hset(args:any[], callback?:ResCallbackT): Multi; + hset(...args:any[]): Multi; + hsetnx(args:any[], callback?:ResCallbackT): Multi; + hsetnx(...args:any[]): Multi; + hget(args:any[], callback?:ResCallbackT): Multi; + hget(...args:any[]): Multi; + hmset(args:any[], callback?:ResCallbackT): Multi; + hmset(key:string, hash:any, callback?:ResCallbackT): Multi; + hmset(...args:any[]): Multi; + hmget(args:any[], callback?:ResCallbackT): Multi; + hmget(...args:any[]): Multi; + hincrby(args:any[], callback?:ResCallbackT): Multi; + hincrby(...args:any[]): Multi; + hdel(args:any[], callback?:ResCallbackT): Multi; + hdel(...args:any[]): Multi; + hlen(args:any[], callback?:ResCallbackT): Multi; + hlen(...args:any[]): Multi; + hkeys(args:any[], callback?:ResCallbackT): Multi; + hkeys(...args:any[]): Multi; + hvals(args:any[], callback?:ResCallbackT): Multi; + hvals(...args:any[]): Multi; + hgetall(args:any[], callback?:ResCallbackT): Multi; + hgetall(...args:any[]): Multi; + hgetall(key:string, callback?:ResCallbackT): Multi; + hexists(args:any[], callback?:ResCallbackT): Multi; + hexists(...args:any[]): Multi; + incrby(args:any[], callback?:ResCallbackT): Multi; + incrby(...args:any[]): Multi; + decrby(args:any[], callback?:ResCallbackT): Multi; + decrby(...args:any[]): Multi; + getset(args:any[], callback?:ResCallbackT): Multi; + getset(...args:any[]): Multi; + mset(args:any[], callback?:ResCallbackT): Multi; + mset(...args:any[]): Multi; + msetnx(args:any[], callback?:ResCallbackT): Multi; + msetnx(...args:any[]): Multi; + randomkey(args:any[], callback?:ResCallbackT): Multi; + randomkey(...args:any[]): Multi; + select(args:any[], callback?:ResCallbackT): void; + select(...args:any[]): Multi; + move(args:any[], callback?:ResCallbackT): Multi; + move(...args:any[]): Multi; + rename(args:any[], callback?:ResCallbackT): Multi; + rename(...args:any[]): Multi; + renamenx(args:any[], callback?:ResCallbackT): Multi; + renamenx(...args:any[]): Multi; + expire(args:any[], callback?:ResCallbackT): Multi; + expire(...args:any[]): Multi; + expireat(args:any[], callback?:ResCallbackT): Multi; + expireat(...args:any[]): Multi; + keys(args:any[], callback?:ResCallbackT): Multi; + keys(...args:any[]): Multi; + dbsize(args:any[], callback?:ResCallbackT): Multi; + dbsize(...args:any[]): Multi; + auth(args:any[], callback?:ResCallbackT): void; + auth(...args:any[]): void; + ping(args:any[], callback?:ResCallbackT): Multi; + ping(...args:any[]): Multi; + echo(args:any[], callback?:ResCallbackT): Multi; + echo(...args:any[]): Multi; + save(args:any[], callback?:ResCallbackT): Multi; + save(...args:any[]): Multi; + bgsave(args:any[], callback?:ResCallbackT): Multi; + bgsave(...args:any[]): Multi; + bgrewriteaof(args:any[], callback?:ResCallbackT): Multi; + bgrewriteaof(...args:any[]): Multi; + shutdown(args:any[], callback?:ResCallbackT): Multi; + shutdown(...args:any[]): Multi; + lastsave(args:any[], callback?:ResCallbackT): Multi; + lastsave(...args:any[]): Multi; + type(args:any[], callback?:ResCallbackT): Multi; + type(...args:any[]): Multi; + multi(args:any[], callback?:ResCallbackT): Multi; + multi(...args:any[]): Multi; + exec(args:any[], callback?:ResCallbackT): Multi; + exec(...args:any[]): Multi; + discard(args:any[], callback?:ResCallbackT): Multi; + discard(...args:any[]): Multi; + sync(args:any[], callback?:ResCallbackT): Multi; + sync(...args:any[]): Multi; + flushdb(args:any[], callback?:ResCallbackT): Multi; + flushdb(...args:any[]): Multi; + flushall(args:any[], callback?:ResCallbackT): Multi; + flushall(...args:any[]): Multi; + sort(args:any[], callback?:ResCallbackT): Multi; + sort(...args:any[]): Multi; + info(args:any[], callback?:ResCallbackT): Multi; + info(...args:any[]): Multi; + monitor(args:any[], callback?:ResCallbackT): Multi; + monitor(...args:any[]): Multi; + ttl(args:any[], callback?:ResCallbackT): Multi; + ttl(...args:any[]): Multi; + persist(args:any[], callback?:ResCallbackT): Multi; + persist(...args:any[]): Multi; + slaveof(args:any[], callback?:ResCallbackT): Multi; + slaveof(...args:any[]): Multi; + debug(args:any[], callback?:ResCallbackT): Multi; + debug(...args:any[]): Multi; + config(args:any[], callback?:ResCallbackT): Multi; + config(...args:any[]): Multi; + subscribe(args:any[], callback?:ResCallbackT): Multi; + subscribe(...args:any[]): Multi; + unsubscribe(args:any[], callback?:ResCallbackT): Multi; + unsubscribe(...args:any[]): Multi; + psubscribe(args:any[], callback?:ResCallbackT): Multi; + psubscribe(...args:any[]): Multi; + punsubscribe(args:any[], callback?:ResCallbackT): Multi; + punsubscribe(...args:any[]): Multi; + publish(args:any[], callback?:ResCallbackT): Multi; + publish(...args:any[]): Multi; + watch(args:any[], callback?:ResCallbackT): Multi; + watch(...args:any[]): Multi; + unwatch(args:any[], callback?:ResCallbackT): Multi; + unwatch(...args:any[]): Multi; + cluster(args:any[], callback?:ResCallbackT): Multi; + cluster(...args:any[]): Multi; + restore(args:any[], callback?:ResCallbackT): Multi; + restore(...args:any[]): Multi; + migrate(args:any[], callback?:ResCallbackT): Multi; + migrate(...args:any[]): Multi; + dump(args:any[], callback?:ResCallbackT): Multi; + dump(...args:any[]): Multi; + object(args:any[], callback?:ResCallbackT): Multi; + object(...args:any[]): Multi; + client(args:any[], callback?:ResCallbackT): Multi; + client(...args:any[]): Multi; + eval(args:any[], callback?:ResCallbackT): Multi; + eval(...args:any[]): Multi; + evalsha(args:any[], callback?:ResCallbackT): Multi; + evalsha(...args:any[]): Multi; + quit(args:any[], callback?:ResCallbackT): Multi; + quit(...args:any[]): Multi; + } } From 907e23613e49fb5a979ee0e8cd0d8ad8b6f3cc43 Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 12:05:49 +0900 Subject: [PATCH 010/189] redis: add missing methods to RedisClient --- redis/redis.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 444b91c4c..c7e068d47 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -69,6 +69,10 @@ declare module "redis" { server_info: ServerInfo; end(): void; + unref(): void; + + // Low level command execution + send_command(command:string, ...args:any[]): boolean; // Connection (http://redis.io/commands#connection) auth(password:string, callback?:ResCallbackT): boolean; From af84e7675e25c62cf5ea4f89ac002d5875490f3a Mon Sep 17 00:00:00 2001 From: MugeSo Date: Thu, 20 Aug 2015 12:10:23 +0900 Subject: [PATCH 011/189] redis: write redis version --- redis/redis.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index c7e068d47..4f8041681 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redis +// Type definitions for redis 0.12.1 // Project: https://github.com/mranney/node_redis // Definitions by: Carlos Ballesteros Velasco , Peter Harris , TANAKA Koichi // Definitions: https://github.com/borisyankov/DefinitelyTyped From 83d5bc71bc6bffb4a43147ab062a7c64bccca63e Mon Sep 17 00:00:00 2001 From: MugeSo Date: Sat, 22 Aug 2015 00:27:06 +0900 Subject: [PATCH 012/189] redis: fix RedisClient.select returns void degraded in 9ae4d7f --- redis/redis.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 4f8041681..0e0a0a8a0 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -267,7 +267,7 @@ declare module "redis" { randomkey(args:any[], callback?:ResCallbackT): boolean; randomkey(...args:any[]): boolean; select(args:any[], callback?:ResCallbackT): void; - select(...args:any[]): boolean; + select(...args:any[]): void; move(args:any[], callback?:ResCallbackT): boolean; move(...args:any[]): boolean; rename(args:any[], callback?:ResCallbackT): boolean; From a132dbfacf6491d421abb213e13cd1fd6f3c222b Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sat, 29 Aug 2015 18:31:48 -0500 Subject: [PATCH 013/189] Replace Stream#_transform()s with single method with chunk: any --- node/node.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 027c654ac..d02311e2f 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1728,8 +1728,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; From a568ce93455b6fa6d7a229673bd37e801552ccb2 Mon Sep 17 00:00:00 2001 From: Artem Kozlov Date: Mon, 31 Aug 2015 10:42:56 +0200 Subject: [PATCH 014/189] typeahead. Allow funtction as displayKey. --- typeahead/typeahead.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 159caaacd..7317aa4c7 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -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. From 3cdf49b241fff4673f96ebf031eb37c0ac4fc605 Mon Sep 17 00:00:00 2001 From: error Date: Thu, 3 Sep 2015 12:35:32 -0500 Subject: [PATCH 015/189] add buttons property to ButtonOptions --- jqueryui/jqueryui.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index d5e60cd0d..dbf6161b5 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -87,6 +87,7 @@ declare module JQueryUI { icons?: any; label?: string; text?: boolean; + click?: (event?: Event) => void; } interface Button extends Widget, ButtonOptions { From 337a1387f0eb9373b4d4437b24ce45ef915ddd6a Mon Sep 17 00:00:00 2001 From: error Date: Thu, 3 Sep 2015 12:37:36 -0500 Subject: [PATCH 016/189] change ButtonOptions text property to string --- jqueryui/jqueryui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index dbf6161b5..5dadfa38b 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -86,7 +86,7 @@ declare module JQueryUI { disabled?: boolean; icons?: any; label?: string; - text?: boolean; + text?: string; click?: (event?: Event) => void; } From 0bc18bba93d7cb1601dab5a7e19b163a7b3bda41 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Fri, 4 Sep 2015 08:52:24 +0200 Subject: [PATCH 017/189] Fixed row getters in selection API. See: http://ui-grid.info/docs/#/api/ui.grid.selection.api:PublicApi getSelectedGridRows should return uiGrid.IGridRow, not the uiGrid.selection.IGridRow interface which only has the selection-specific properties. getSelectedRows returns the selected entities, not grid rows. --- ui-grid/ui-grid-tests.ts | 2 ++ ui-grid/ui-grid.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 21d42c021..485f7d378 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -100,3 +100,5 @@ gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); gridApi.core.registerColumnsProcessor(colProcessor, 100); +var selectedRowEntities: Array = gridApi.selection.getSelectedRows(); +var selectedGridRows: Array = gridApi.selection.getSelectedGridRows(); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 5f66eca1f..38a7aadbf 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -2823,12 +2823,12 @@ declare module uiGrid { * returns all selected rows as gridRows * @returns {Array} The selected rows */ - getSelectedGridRows(): Array; + getSelectedGridRows(): Array; /** * Gets selected rows as entities * @returns {Array} Selected row entities */ - getSelectedRows(): Array; + getSelectedRows(): Array; /** * Selects all rows. Does nothing if multiselect = false * @param {ng.IAngularEvent} event object if raised from event From 2e31771e4701df0cfefb3a17e18d0fdbe4cb5453 Mon Sep 17 00:00:00 2001 From: marcelk Date: Fri, 4 Sep 2015 14:48:14 +0200 Subject: [PATCH 018/189] Update Ui Router Extra's. Added deepstate redirect and extended stickystate. --- ui-router-extras/ui-router-extras-tests.ts | 35 +++++++-- ui-router-extras/ui-router-extras.d.ts | 86 +++++++++++++++++++--- 2 files changed, 107 insertions(+), 14 deletions(-) diff --git a/ui-router-extras/ui-router-extras-tests.ts b/ui-router-extras/ui-router-extras-tests.ts index 22d9e4f73..a87b95863 100644 --- a/ui-router-extras/ui-router-extras-tests.ts +++ b/ui-router-extras/ui-router-extras-tests.ts @@ -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); diff --git a/ui-router-extras/ui-router-extras.d.ts b/ui-router-extras/ui-router-extras.d.ts index 8e0c42828..df0d0aa3e 100644 --- a/ui-router-extras/ui-router-extras.d.ts +++ b/ui-router-extras/ui-router-extras.d.ts @@ -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 +// Definitions by: Michael Putters , Marcel van de Kamp // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -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 */ From 90e1dab8cd073844547e77ff41eb37a13ca97d11 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 6 Sep 2015 14:29:02 -0400 Subject: [PATCH 019/189] Updated for version 1.4.1, jsdoc documentaiton Updated jquery.cookie.d.ts to conform to the latest version of jquery.cookie (1.4.1). This meant adding a defaults property to the JQueryCookieStatic interface. Also added missing jsdoc documentation for better intellisense for editors that support it. The documentation uses the Github repo documentation where possible. --- jquery.cookie/jquery.cookie.d.ts | 84 +++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/jquery.cookie/jquery.cookie.d.ts b/jquery.cookie/jquery.cookie.d.ts index 06380f999..be88ca363 100644 --- a/jquery.cookie/jquery.cookie.d.ts +++ b/jquery.cookie/jquery.cookie.d.ts @@ -1,34 +1,106 @@ -// Type definitions for jQuery Cookie Plugin 1.3 +// Type definitions for jQuery Cookie Plugin 1.4.1 // Project: https://github.com/carhartl/jquery-cookie -// Definitions by: Roy Goode +// Definitions by: Roy Goode , Ben Lorantfy // Definitions: https://github.com/borisyankov/DefinitelyTyped /// interface JQueryCookieOptions { + /** + * Define lifetime of the cookie. Value can be a Number which will be interpreted as days from time of creation or a Date object. If omitted, the cookie becomes a session cookie. + */ expires?: any; + /** + * Define the path where the cookie is valid. By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior). If you want to make it available for instance across the entire domain use path: '/'. Default: path of page where the cookie was created. + */ path?: string; + /** + * Define the domain where the cookie is valid. Default: domain of page where the cookie was created. + */ domain?: string; + /** + * If true, the cookie transmission requires a secure protocol (https). Default: false. + */ secure?: boolean; } - +// +// The following jsdoc comments are used to add intellisense to editors that support it. Uses snippets +// of documentation from the Github repo when possible. +// +// The ordering here matters. For example, the read function with the converter parameter is purposefully after +// the set function. This is because the intellisense that shows up after you press comma should be the set first, +// since that is more common, then the conversion function if user starts typing a parameter with a function type interface JQueryCookieStatic { + /** + * By default the cookie value is encoded/decoded when writing/reading, using encodeURIComponent/decodeURIComponent. Bypass this by setting raw to true: + */ raw?: boolean; + /** + * Turn on automatic storage of JSON objects passed as the cookie value. Assumes JSON.stringify and JSON.parse + */ json?: boolean; - + /** + * Cookie attributes can be set globally by setting properties of the $.cookie.defaults object or individually for each call to $.cookie() by passing a plain object to the options argument. Per-call options override the default options. + */ + defaults?: JQueryCookieOptions; + /** + * Gets an object of cookies as key-value pairs + */ (): {[key:string]:string}; + /** + * Gets a cookie by name + * @param name The name of the cookie to get + */ (name: string): any; - (name: string, converter: (value: string) => any): any; + /** + * Sets a cookie + * @param name The name of the cookie to set + * @param value The value to set the cookie to + */ (name: string, value: string): void; + /** + * Gets a cookie by name after applying a conversion function to the value + * @param name The name of the cookie to get + * @param converter A conversion function to change the cookie's value to a different representation on the fly + */ + (name: string, converter: (value: string) => any): any; + /** + * Sets a cookie with some options + * @param name The name of the cookie to set + * @param value The value to set the cookie to + * @param options An object of options that change how the cookie is set + */ (name: string, value: string, options: JQueryCookieOptions): void; + /** + * Sets a cookie using .toString(), or if $.cookie.json is set to true using JSON.stringify() + * @param name The name of the cookie to set + * @param value The value to set the cookie to + */ (name: string, value: any): void; + /** + * Sets a cookie using .toString(), or if $.cookie.json is set to true using JSON.stringify() + * @param name The name of the cookie to set + * @param value The value to set the cookie to + * @param options An object of options that change how the cookie is set + */ (name: string, value: any, options: JQueryCookieOptions): void; } interface JQueryStatic { + /** + * A simple, lightweight jQuery plugin for reading, writing and deleting cookies. + */ cookie?: JQueryCookieStatic; - + /** + * Deletes a cookie + * @param name Name of cookie to delete + */ removeCookie(name: string): boolean; + /** + * Deletes a cookie + * @param name Name of cookie to delete + * @param options The same attributes (path, domain) as what the cookie was written with + */ removeCookie(name: string, options: JQueryCookieOptions): boolean; } From d2bf7eed77d8704ca03555d0b60071bb3ae0d7ee Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 6 Sep 2015 14:33:02 -0400 Subject: [PATCH 020/189] Updated to test new defaults property --- jquery.cookie/jquery.cookie-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.cookie/jquery.cookie-tests.ts b/jquery.cookie/jquery.cookie-tests.ts index 69a8c0412..ab9b8cb5a 100644 --- a/jquery.cookie/jquery.cookie-tests.ts +++ b/jquery.cookie/jquery.cookie-tests.ts @@ -35,3 +35,5 @@ $.cookie("test", testObject, cookieOptions); var result = $.cookie("test"); console.log(result.text); + +$.cookie.defaults = cookieOptions; From de418bbbb42567d24f8b26a390bb9a9dbb711084 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Mon, 7 Sep 2015 14:34:51 +0200 Subject: [PATCH 021/189] GridInstance.scrollTo takes an object in the data array as parameter, not a GridRow. Also, both parameters are optional. See https://github.com/angular-ui/ui-grid/blob/a42dab24532fb896725b9fc8359e4526e436c891/src/js/core/factories/Grid.js#L2419-L2440 --- ui-grid/ui-grid-tests.ts | 6 ++++++ ui-grid/ui-grid.d.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 485f7d378..4eedf8675 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -100,5 +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 = gridApi.selection.getSelectedRows(); var selectedGridRows: Array = gridApi.selection.getSelectedGridRows(); diff --git a/ui-grid/ui-grid.d.ts b/ui-grid/ui-grid.d.ts index 38a7aadbf..f9371fc5c 100644 --- a/ui-grid/ui-grid.d.ts +++ b/ui-grid/ui-grid.d.ts @@ -445,7 +445,7 @@ declare module uiGrid { * @param {IColumnDef} colDef to make visible * @returns {ng.IPromise} a promise that is resolved after any scrolling is finished */ - scrollTo(rowEntity: IGridRow, colDef: IColumnDef): ng.IPromise; + scrollTo(rowEntity?: any, colDef?: IColumnDef): ng.IPromise; /** * 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. From 925549c4eb5078662fff90d6d20b586118b09ed2 Mon Sep 17 00:00:00 2001 From: pallxk Date: Mon, 7 Sep 2015 21:06:54 +0800 Subject: [PATCH 022/189] underscore: remove method 'value' from interface 'UnderscoreStatic' --- underscore/underscore.d.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 1f8faf2e2..7dea66a84 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1614,13 +1614,6 @@ interface UnderscoreStatic { **/ chain(obj: T[]): _Chain; chain(obj: T): _Chain; - - /** - * Extracts the value of a wrapped object. - * @param obj Wrapped object to extract the value from. - * @return Value of `obj`. - **/ - value(obj: T): TResult; } interface Underscore { @@ -2463,7 +2456,8 @@ interface Underscore { /** * Wrapped type `any`. - * @see _.value + * Extracts the value of a wrapped object. + * @return Value of the wrapped object. **/ value(): TResult; } From 1e55782c9d47d996ab5c88988062020ce894e57b Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Mon, 7 Sep 2015 15:53:42 +0200 Subject: [PATCH 023/189] Add node-progress definition --- node-progress/node-progress.d.ts | 121 +++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 node-progress/node-progress.d.ts diff --git a/node-progress/node-progress.d.ts b/node-progress/node-progress.d.ts new file mode 100644 index 000000000..2c7e683ec --- /dev/null +++ b/node-progress/node-progress.d.ts @@ -0,0 +1,121 @@ +// Type definitions for node-progress v1.1.8 +// Project: https://github.com/tj/node-progress +// Definitions by: Sebastian Lenz +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +declare module "progress" +{ + /** + * These are keys in the options object you can pass to the progress bar along with total as seen in the example above. + */ + interface ProgressBarOptions + { + /** + * Total number of ticks to complete. + */ + total:number; + + /** + * The displayed width of the progress bar defaulting to total. + */ + width?:number; + + /** + * The output stream defaulting to stderr. + */ + stream?:NodeJS.WritableStream; + + /** + * Completion character defaulting to "=". + */ + complete?:string; + + /** + * Incomplete character defaulting to "-". + */ + incomplete?:string; + + /** + * Option to clear the bar on completion defaulting to false. + */ + clear?:boolean; + + /** + * Optional function to call when the progress bar completes. + */ + callback?:Function; + } + + + /** + * Flexible ascii progress bar. + */ + class ProgressBar + { + /** + * Initialize a `ProgressBar` with the given `fmt` string and `options` or + * `total`. + * + * Options: + * - `total` total number of ticks to complete + * - `width` the displayed width of the progress bar defaulting to total + * - `stream` the output stream defaulting to stderr + * - `complete` completion character defaulting to "=" + * - `incomplete` incomplete character defaulting to "-" + * - `renderThrottle` minimum time between updates in milliseconds defaulting to 16 + * - `callback` optional function to call when the progress bar completes + * - `clear` will clear the progress bar upon termination + * + * Tokens: + * - `:bar` the progress bar itself + * - `:current` current tick number + * - `:total` total ticks + * - `:elapsed` time elapsed in seconds + * - `:percent` completion percentage + * - `:eta` eta in seconds + */ + constructor(format:string, total:number); + constructor(format:string, options:ProgressBarOptions); + + + /** + * "tick" the progress bar with optional `len` and optional `tokens`. + */ + tick(tokens?:any):void; + tick(count?:number, tokens?:any):void; + + + /** + * Method to render the progress bar with optional `tokens` to place in the + * progress bar's `fmt` field. + */ + render(tokens?:any):void; + + + /** + * "update" the progress bar to represent an exact percentage. + * The ratio (between 0 and 1) specified will be multiplied by `total` and + * floored, representing the closest available "tick." For example, if a + * progress bar has a length of 3 and `update(0.5)` is called, the progress + * will be set to 1. + * + * A ratio of 0.5 will attempt to set the progress to halfway. + * + * @param ratio The ratio (between 0 and 1 inclusive) to set the + * overall completion to. + */ + update(ratio:number, tokens?:any):void; + + + /** + * Terminates a progress bar. + */ + terminate():void; + } + + + export = ProgressBar; +} From 2cdbc68f690138410785db1cb4fcbd64e36e4203 Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Mon, 7 Sep 2015 15:54:34 +0200 Subject: [PATCH 024/189] Add test case for node-progress --- node-progress/node-progress-test.ts | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 node-progress/node-progress-test.ts diff --git a/node-progress/node-progress-test.ts b/node-progress/node-progress-test.ts new file mode 100644 index 000000000..1e723aabe --- /dev/null +++ b/node-progress/node-progress-test.ts @@ -0,0 +1,32 @@ +/// + +var ProgressBar = require('progress'); + + +/** + * Usage example from https://github.com/tj/node-progress + */ +var bar = new ProgressBar(':bar', { total: 10 }); +var timer = setInterval(function () { + bar.tick(); + if (bar.complete) { + console.log('\ncomplete\n'); + clearInterval(timer); + } +}, 100); + + +/** + * Custom token example from https://github.com/tj/node-progress + */ +var bar = new ProgressBar(':current: :token1 :token2', { total: 3 }); + +bar.tick({ + 'token1': "Hello", + 'token2': "World!\n" +}); + +bar.tick(2, { + 'token1': "Goodbye", + 'token2': "World!" +}); From 223d643b9225cff5a876f12daa4598785cf5b239 Mon Sep 17 00:00:00 2001 From: laurentiustamate94 Date: Tue, 8 Sep 2015 07:09:02 +0300 Subject: [PATCH 025/189] Added amplify with JQuery Deferred support --- amplify-deferred/amplify-deferred-tests.ts | 265 ++++++++++++++++++ .../amplify-deferred-tests.ts.tscparams | 1 + amplify-deferred/amplify-deferred.d.ts | 182 ++++++++++++ 3 files changed, 448 insertions(+) create mode 100644 amplify-deferred/amplify-deferred-tests.ts create mode 100644 amplify-deferred/amplify-deferred-tests.ts.tscparams create mode 100644 amplify-deferred/amplify-deferred.d.ts diff --git a/amplify-deferred/amplify-deferred-tests.ts b/amplify-deferred/amplify-deferred-tests.ts new file mode 100644 index 000000000..957941cd2 --- /dev/null +++ b/amplify-deferred/amplify-deferred-tests.ts @@ -0,0 +1,265 @@ +/// +/// + +// 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) { }); + diff --git a/amplify-deferred/amplify-deferred-tests.ts.tscparams b/amplify-deferred/amplify-deferred-tests.ts.tscparams new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/amplify-deferred/amplify-deferred-tests.ts.tscparams @@ -0,0 +1 @@ + diff --git a/amplify-deferred/amplify-deferred.d.ts b/amplify-deferred/amplify-deferred.d.ts new file mode 100644 index 000000000..11e6d05e0 --- /dev/null +++ b/amplify-deferred/amplify-deferred.d.ts @@ -0,0 +1,182 @@ +// Type definitions for AmplifyJs 1.1.0 using JQuery Deferred +// Project: http://amplifyjs.com/ +// Definitions by: Jonas Eriksson , Laurentiu Stamate +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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; + + /*** + * 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; + + /*** + * 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; + From 2c55e6f76c8799c5a0b3a5c7e4cfc6da00aeaa4f Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Tue, 8 Sep 2015 12:18:05 +0200 Subject: [PATCH 026/189] Rename "node-progress" to "progress" --- node-progress/node-progress-test.ts => progress/progress-test.ts | 0 node-progress/node-progress.d.ts => progress/progress.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename node-progress/node-progress-test.ts => progress/progress-test.ts (100%) rename node-progress/node-progress.d.ts => progress/progress.d.ts (100%) diff --git a/node-progress/node-progress-test.ts b/progress/progress-test.ts similarity index 100% rename from node-progress/node-progress-test.ts rename to progress/progress-test.ts diff --git a/node-progress/node-progress.d.ts b/progress/progress.d.ts similarity index 100% rename from node-progress/node-progress.d.ts rename to progress/progress.d.ts From 5558a68cce3f867236f680e504737daaa5f0a80a Mon Sep 17 00:00:00 2001 From: Sebastian Lenz Date: Tue, 8 Sep 2015 12:20:06 +0200 Subject: [PATCH 027/189] Update test case --- progress/progress-test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progress/progress-test.ts b/progress/progress-test.ts index 1e723aabe..699c20b05 100644 --- a/progress/progress-test.ts +++ b/progress/progress-test.ts @@ -1,4 +1,4 @@ -/// +/// var ProgressBar = require('progress'); From 9cb9e74a21d7f539f38c89317166c3538410fec3 Mon Sep 17 00:00:00 2001 From: Riron Date: Tue, 8 Sep 2015 19:10:49 +0200 Subject: [PATCH 028/189] Ionic Keyboard plugin: Add show() method --- cordova-ionic/plugins/keyboard.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cordova-ionic/plugins/keyboard.d.ts b/cordova-ionic/plugins/keyboard.d.ts index 4ff9e293d..7a1cd38e1 100644 --- a/cordova-ionic/plugins/keyboard.d.ts +++ b/cordova-ionic/plugins/keyboard.d.ts @@ -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 From 8e62889ba3e00c7c22807241411e18f6189eb1b1 Mon Sep 17 00:00:00 2001 From: Riron Date: Tue, 8 Sep 2015 19:15:48 +0200 Subject: [PATCH 029/189] Ionic Keyboard plugin: Update test --- cordova-ionic/cordova-ionic-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cordova-ionic/cordova-ionic-tests.ts b/cordova-ionic/cordova-ionic-tests.ts index 69d1a3d82..a88c9c580 100644 --- a/cordova-ionic/cordova-ionic-tests.ts +++ b/cordova-ionic/cordova-ionic-tests.ts @@ -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); From cc25ee393ebb7867f8b75bc4f856d6ed39173f35 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Tue, 8 Sep 2015 14:09:17 -0500 Subject: [PATCH 030/189] Replace module "stream" `chunk: string` or `chunk: Buffer` arguments with `chunk: any` --- node/node.d.ts | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index d02311e2f..7147ee479 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1671,14 +1671,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(destination: T, options?: { end?: boolean; }): T; unpipe(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 +1690,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 +1706,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 {} @@ -1736,17 +1729,14 @@ declare module "stream" { resume(): void; pipe(destination: T, options?: { end?: boolean; }): T; unpipe(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 {} From c207dc9996cb588b7406b8861f8b2bdddac32ab1 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 8 Sep 2015 12:55:33 -0700 Subject: [PATCH 031/189] Changes to DataGridView type getRowById returns a number getItemByIdx accepts an index parameter getItemMetadata returns a TotalsRowMetadata --- slickgrid/SlickGrid.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index 60f0a24b6..03fe741d9 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -1527,9 +1527,9 @@ declare module Slick { public expandGroup(...varArgs: string[]): void; public getGroups(): Group[]; 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; @@ -1543,7 +1543,7 @@ declare module Slick { public getLength(): number; public getItem(index: number): T; - public getItemMetadata(index?: number): void; + public getItemMetadata(index?: number): TotalsRowMetadata; public onRowCountChanged: Slick.Event; public onRowsChanged: Slick.Event; From ff104ed7cc13a3eb2e89f46242c4dbdbbe66665e Mon Sep 17 00:00:00 2001 From: Roman Fromrome Date: Tue, 8 Sep 2015 15:59:55 -0700 Subject: [PATCH 032/189] optional expectationFailOutput parameter added to matchers optional expectationFailOutput parameter added to matchers for ability to track expectation fail reason in output message --- jasmine/jasmine.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 581353b34..184875fa2 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -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; From 79dfea3815d3731bf89afb96e15be8c77a9035cb Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 8 Sep 2015 22:45:18 -0400 Subject: [PATCH 033/189] `IInjectorService.get` has an optional 2nd param. `caller` is an optional string to provide the origin of the function call for error messages. https://docs.angularjs.org/api/auto/service/$injector#get --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d183167b5..90cf10a88 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1693,7 +1693,7 @@ declare module angular { interface IInjectorService { annotate(fn: Function): string[]; annotate(inlineAnnotatedFunction: any[]): string[]; - get(name: string): T; + get(name: string, caller?: string): T; has(name: string): boolean; instantiate(typeConstructor: Function, locals?: any): T; invoke(inlineAnnotatedFunction: any[]): any; From 44ccd778df52b56c320c45e3d8eaf02296c1e366 Mon Sep 17 00:00:00 2001 From: Artem Berezin Date: Wed, 9 Sep 2015 15:24:14 +1000 Subject: [PATCH 034/189] Update angularjs-toaster.d.ts fix typo: into -> info --- angularjs-toaster/angularjs-toaster.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs-toaster/angularjs-toaster.d.ts b/angularjs-toaster/angularjs-toaster.d.ts index 398704514..9f450b14b 100644 --- a/angularjs-toaster/angularjs-toaster.d.ts +++ b/angularjs-toaster/angularjs-toaster.d.ts @@ -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 From a42706711d711cf12ec26b8bb5f08520fc948253 Mon Sep 17 00:00:00 2001 From: Bill Chen Date: Wed, 19 Aug 2015 17:29:20 +0100 Subject: [PATCH 035/189] Completely typed AngularJS $http. Merged the defaults, added missing typings and refined others. --- angular-growl-v2/angular-growl-v2.d.ts | 2 +- angularjs/angular.d.ts | 138 +++++++++++++++---------- 2 files changed, 84 insertions(+), 56 deletions(-) diff --git a/angular-growl-v2/angular-growl-v2.d.ts b/angular-growl-v2/angular-growl-v2.d.ts index 1c324723f..81338aaca 100644 --- a/angular-growl-v2/angular-growl-v2.d.ts +++ b/angular-growl-v2/angular-growl-v2.d.ts @@ -45,7 +45,7 @@ declare module angular.growl { /** * Pre-defined server error interceptor. */ - serverMessagesInterceptor: (string|Function)[]; + serverMessagesInterceptor: (string|IHttpInterceptorFactory)[]; /** * Set default TTL settings. diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index d183167b5..b99cd15c4 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -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.} * 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.} - * 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.} - * 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; /** - * 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(successCallback: (response: IHttpPromiseCallbackArg) => IPromise|TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } + // 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; + requestError?: (rejection: any) => any; + response?: (response: IHttpPromiseCallbackArg) => IPromise|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; From 6a4bf3433dabc22f3f7a4557572c6c56c720ea34 Mon Sep 17 00:00:00 2001 From: Gregor Woiwode Date: Wed, 9 Sep 2015 12:00:12 +0200 Subject: [PATCH 036/189] Adds missing t to SimplebarOptions --- simplebar/simplebar.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/simplebar/simplebar.d.ts b/simplebar/simplebar.d.ts index 63173f432..bab795e1a 100755 --- a/simplebar/simplebar.d.ts +++ b/simplebar/simplebar.d.ts @@ -3,9 +3,9 @@ // Definitions by: Gregor Woiwode // 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; }; } From 45355cd1a55145748313f8e6d938f6df0f4de131 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Wed, 9 Sep 2015 13:15:35 +0300 Subject: [PATCH 037/189] Add more fs.write interfaces. --- node/node-tests.ts | 2 ++ node/node.d.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index 19f686ef5..a73a35e22 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -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.", diff --git a/node/node.d.ts b/node/node.d.ts index b7edca1f7..bc1229e63 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1214,6 +1214,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; From 44b86737dabf2dc8377b355559d2ceced5feada8 Mon Sep 17 00:00:00 2001 From: Dan Lewi Harkestad Date: Wed, 9 Sep 2015 19:34:04 +0200 Subject: [PATCH 038/189] Changed to single quotes per review feedback. --- ui-grid/ui-grid-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-grid/ui-grid-tests.ts b/ui-grid/ui-grid-tests.ts index 4eedf8675..f4bcdce7e 100644 --- a/ui-grid/ui-grid-tests.ts +++ b/ui-grid/ui-grid-tests.ts @@ -100,7 +100,7 @@ gridApi.core.queueGridRefresh() gridApi.core.queueRefresh(); gridApi.core.registerColumnsProcessor(colProcessor, 100); -var rowEntityToScrollTo = {anObject: "inGridOptionsData"}; +var rowEntityToScrollTo = {anObject: 'inGridOptionsData'}; var columnDefToScrollTo: uiGrid.IColumnDef; gridInstance.scrollTo(); gridInstance.scrollTo(rowEntityToScrollTo); From 4a86ba7d7f9227dc68c970f05dd667992fd8f40a Mon Sep 17 00:00:00 2001 From: Ryan McNamara Date: Wed, 9 Sep 2015 11:19:57 -0700 Subject: [PATCH 039/189] added definitely typed files and tests for flowjs and ngflow --- flowjs/flow/flowjs-tests.ts | 78 ++++++++++++++++++++++++++++++ flowjs/flow/flowjs.d.ts | 85 +++++++++++++++++++++++++++++++++ flowjs/ng-flow/ng-flow-tests.ts | 4 ++ flowjs/ng-flow/ng-flow.d.ts | 11 +++++ 4 files changed, 178 insertions(+) create mode 100644 flowjs/flow/flowjs-tests.ts create mode 100644 flowjs/flow/flowjs.d.ts create mode 100644 flowjs/ng-flow/ng-flow-tests.ts create mode 100644 flowjs/ng-flow/ng-flow.d.ts diff --git a/flowjs/flow/flowjs-tests.ts b/flowjs/flow/flowjs-tests.ts new file mode 100644 index 000000000..8bedad003 --- /dev/null +++ b/flowjs/flow/flowjs-tests.ts @@ -0,0 +1,78 @@ +/// + +// flow object +var flowObject: flowjs.IFlow; +var bool: boolean = flowObject.support; +bool = flowObject.supportDirectory; +var obj: Object = flowObject.opts; +var flowFileArray: flowjs.IFlowFile[] = flowObject.files; + +flowObject.assignBrowse( [], false, false, {}); +flowObject.assignDrop( []); +flowObject.unAssignDrop( []); +flowObject.on("", () => {}); +flowObject.off("", () => {}); +flowObject.upload(); +flowObject.pause(); +flowObject.resume(); +flowObject.cancel(); +flowObject.progress(); +bool = flowObject.isUploading(); +flowObject.addFile( {}); +flowObject.removeFile( {}); +var flowFile: flowjs.IFlowFile = flowObject.getFromUniqueIdentifier(""); +var num: number = flowObject.getSize(); +num = flowObject.sizeUploaded(); +num = flowObject.timeRemaining(); + +// flow options +var flowOptions: flowjs.IFlowOptions = {}; +flowOptions.target = ""; +flowOptions.singleFile = true; +flowOptions.chunkSize= 0; +flowOptions.forceChunkSize = true; +flowOptions.simultaneousUploads= 0; +flowOptions.fileParameterName = ""; +flowOptions.query = {}; +flowOptions.headers = {}; +flowOptions.withCredentials = true; +flowOptions.method = ""; +flowOptions.testMethod = ""; +flowOptions.uploadMethod = ""; +flowOptions.allowDuplicateUploads = true; +flowOptions.prioritizeFirstAndLastChunk = true; +flowOptions.testchunks = true; +flowOptions.preprocess = () => {}; +flowOptions.initFileFn = () => {}; +flowOptions.generateUniqueIdentifier = () => {}; +flowOptions.maxChunkRetries= 0; +flowOptions.chunkRetryInterval= 0; +flowOptions.progressCallbacksInterval= 0; +flowOptions.speedSmoothingFactor= 0; +flowOptions.successStatuses = [""]; +flowOptions.permanentErrors = [""]; + +// flow file +flowObject = flowFile.flowObj; +var htmlFile: File = flowFile.file; +var str: string = flowFile.name; +str = flowFile.relativePath; +num = flowFile.size; +str = flowFile.uniqueIdentifier; +num = flowFile.averageSpeed; +num = flowFile.currentSpeed; +var anyArray: any[] = flowFile.chunks; +bool = flowFile.paused; +bool = flowFile.error; +num = flowFile.progress(true); +flowFile.pause(); +flowFile.resume(); +flowFile.cancel(); +flowFile.retry(); +flowFile.bootstrap(); +bool = flowFile.isUploading(); +bool = flowFile.isComplete; +num = flowFile.sizeUploaded; +num = flowFile.timeRemaining; +str = flowFile.getExtension; +str = flowFile.getType; diff --git a/flowjs/flow/flowjs.d.ts b/flowjs/flow/flowjs.d.ts new file mode 100644 index 000000000..e9e90055b --- /dev/null +++ b/flowjs/flow/flowjs.d.ts @@ -0,0 +1,85 @@ +// Type definitions for flowjs +// Project: https://github.com/flowjs/flow.js +// Definitions by: Ryan McNamara +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module flowjs { + interface IFlow { + support: boolean; + supportDirectory: boolean; + opts: Object; + files: IFlowFile[]; + + assignBrowse(domNodes: HTMLElement[], isDirectory: boolean, singleFile: boolean, attributes: Object): void; + assignDrop(domNodes: HTMLElement[]): void; + unAssignDrop(domNodes: HTMLElement[]): void; + on(event: string, callback: Function): void; + off(event?: string, callback?: Function): void; + upload(): void; + pause(): void; + resume(): void; + cancel(): void; + progress(): number; + isUploading(): boolean; + addFile(file: File): void; + removeFile(file: IFlowFile): void; + getFromUniqueIdentifier(uniqueIdentifier: string): IFlowFile; + getSize(): number; + sizeUploaded(): number; + timeRemaining(): number; + } + + interface IFlowOptions { + target?: string; + singleFile?: boolean; + chunkSize?: number; + forceChunkSize?: boolean; + simultaneousUploads?: number; + fileParameterName?: string; + query?: Object; + headers?: Object; + withCredentials?: boolean; + method?: string; + testMethod?: string; + uploadMethod?: string; + allowDuplicateUploads?: boolean; + prioritizeFirstAndLastChunk?: boolean; + testchunks?: boolean; + preprocess?: Function; + initFileFn?: Function; + generateUniqueIdentifier?: Function; + maxChunkRetries?: number; + chunkRetryInterval?: number; + progressCallbacksInterval?: number; + speedSmoothingFactor?: number; + successStatuses?: string[]; + permanentErrors?: string[]; + } + + interface IFlowFile { + flowObj: IFlow; + file: File; + name: string; + relativePath: string; + size: number; + uniqueIdentifier: string; + averageSpeed: number; + currentSpeed: number; + chunks: any[]; + paused: boolean; + error: boolean; + + progress(relative: boolean): number; + pause(): void; + resume(): void; + cancel(): void; + retry(): void; + bootstrap(): void; + isUploading(): boolean; + isComplete: boolean; + sizeUploaded: number; + timeRemaining: number; + getExtension: string; + getType: string; + } +} diff --git a/flowjs/ng-flow/ng-flow-tests.ts b/flowjs/ng-flow/ng-flow-tests.ts new file mode 100644 index 000000000..beca6583c --- /dev/null +++ b/flowjs/ng-flow/ng-flow-tests.ts @@ -0,0 +1,4 @@ +/// + +var flowFactory: ng.flow.IFlowFactory; +flowFactory.create( {}); diff --git a/flowjs/ng-flow/ng-flow.d.ts b/flowjs/ng-flow/ng-flow.d.ts new file mode 100644 index 000000000..4ea0afefe --- /dev/null +++ b/flowjs/ng-flow/ng-flow.d.ts @@ -0,0 +1,11 @@ +// Type definitions for ng-flow +// Project: https://github.com/flowjs/ng-flow +// Definitions by: Ryan McNamara +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + +declare module ng.flow { + interface IFlowFactory { + create(options?: flowjs.IFlowOptions): flowjs.IFlow; + } +} From 0b289d58d920cc18b234948faae77e3513707b30 Mon Sep 17 00:00:00 2001 From: Anthony Guo Date: Wed, 9 Sep 2015 16:31:49 -0700 Subject: [PATCH 040/189] Add typings for CodeMirror's searchcursor add-on --- codemirror/searchcursor-tests.ts | 16 ++++++++++++ codemirror/searchcursor.d.ts | 45 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 codemirror/searchcursor-tests.ts create mode 100644 codemirror/searchcursor.d.ts diff --git a/codemirror/searchcursor-tests.ts b/codemirror/searchcursor-tests.ts new file mode 100644 index 000000000..2e87a8b59 --- /dev/null +++ b/codemirror/searchcursor-tests.ts @@ -0,0 +1,16 @@ +/// +/// + +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"); diff --git a/codemirror/searchcursor.d.ts b/codemirror/searchcursor.d.ts new file mode 100644 index 000000000..ed7af7a25 --- /dev/null +++ b/codemirror/searchcursor.d.ts @@ -0,0 +1,45 @@ +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: 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; + } +} From 2332fe2eaaed877248ac845491821cc5eb4179e5 Mon Sep 17 00:00:00 2001 From: Ritzlgrmft Date: Thu, 10 Sep 2015 10:36:36 +0200 Subject: [PATCH 041/189] Definitions added for Cordova plugin cordova-plugin-app-version (https://github.com/whiteoctober/cordova-plugin-app-version). --- cordova-plugin-app-version/appversion-tests.ts | 18 ++++++++++++++++++ cordova-plugin-app-version/appversion.d.ts | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 cordova-plugin-app-version/appversion-tests.ts create mode 100644 cordova-plugin-app-version/appversion.d.ts diff --git a/cordova-plugin-app-version/appversion-tests.ts b/cordova-plugin-app-version/appversion-tests.ts new file mode 100644 index 000000000..89858c3e5 --- /dev/null +++ b/cordova-plugin-app-version/appversion-tests.ts @@ -0,0 +1,18 @@ +/// +/// +cordova.getAppVersion.getAppName() + .then(appName=> { + console.log(appName) + }); +cordova.getAppVersion.getPackageName() + .then(packageName=> { + console.log(packageName); + }); +cordova.getAppVersion.getVersionCode() + .then(versionCode=> { + console.log(versionCode); + }); +cordova.getAppVersion.getVersionNumber() + .then(versionNumber=> { + console.log(versionNumber); + }); \ No newline at end of file diff --git a/cordova-plugin-app-version/appversion.d.ts b/cordova-plugin-app-version/appversion.d.ts new file mode 100644 index 000000000..4069e38da --- /dev/null +++ b/cordova-plugin-app-version/appversion.d.ts @@ -0,0 +1,8 @@ +interface Cordova { + getAppVersion: { + getAppName: () => ng.IPromise; + getPackageName: () => ng.IPromise; + getVersionCode: () => ng.IPromise; + getVersionNumber: () => ng.IPromise; + }; +} \ No newline at end of file From bc072529810ab95bc0abc0098b1eeb4bf0cff629 Mon Sep 17 00:00:00 2001 From: progre Date: Thu, 10 Sep 2015 20:02:57 +0900 Subject: [PATCH 042/189] Add birthtime to fs.Stats --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index b7edca1f7..4fc3332a6 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1062,6 +1062,7 @@ declare module "fs" { atime: Date; mtime: Date; ctime: Date; + birthtime: Date; } interface FSWatcher extends events.EventEmitter { From 7c44bc25f0a1ea0528378c50db21c3ebccfaa662 Mon Sep 17 00:00:00 2001 From: Zuo Haocheng Date: Thu, 10 Sep 2015 20:44:39 +0800 Subject: [PATCH 043/189] should-promised: Update definition for fulfilled and rejected --- should-promised/should-promised-tests.ts | 4 ++-- should-promised/should-promised.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/should-promised/should-promised-tests.ts b/should-promised/should-promised-tests.ts index 03167e663..50ea0b59a 100644 --- a/should-promised/should-promised-tests.ts +++ b/should-promised/should-promised-tests.ts @@ -7,9 +7,9 @@ var promise: Promise = new Promise(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'); diff --git a/should-promised/should-promised.d.ts b/should-promised/should-promised.d.ts index c6c95ba98..f7e2a97f5 100644 --- a/should-promised/should-promised.d.ts +++ b/should-promised/should-promised.d.ts @@ -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; From 9d8cbdb263e5d69de355a24aeb1465c8400c924a Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Wed, 9 Sep 2015 16:05:42 +0100 Subject: [PATCH 044/189] Correctly type d3.event --- d3/d3-tests.ts | 86 ++++++++++++++++++++++++++------------------------ d3/d3.d.ts | 31 ++++++++++++++---- 2 files changed, 68 insertions(+), 49 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 105e8f29c..414a2346e 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -139,7 +139,7 @@ function groupedBarChart() { .style("text-anchor", "end") .text("Population"); - var state = svg.selectAll(".state") + var state = svg.selectAll(".state") .data(data) .enter().append("g") .attr("class", "g") @@ -672,8 +672,8 @@ function dragMultiples() { function dragmove(d: { x: number; y: number }) { d3.select(this) - .attr("cx", d.x = Math.max(radius, Math.min(width - radius, ( d3.event).x))) - .attr("cy", d.y = Math.max(radius, Math.min(height - radius, ( d3.event).y))); + .attr("cx", d.x = Math.max(radius, Math.min(width - radius, ( d3.event).x))) + .attr("cy", d.y = Math.max(radius, Math.min(height - radius, ( d3.event).y))); } } @@ -873,7 +873,7 @@ function populationPyramid() { // Allow the arrow keys to change the displayed year. window.focus(); d3.select(window).on("keydown", function () { - switch (d3.event.keyCode) { + switch (( d3.event).keyCode) { case 37: year = Math.max(year0, year - 10); break; case 39: year = Math.min(year1, year + 10); break; } @@ -1167,7 +1167,7 @@ function azimuthalEquidistant() { .translate([width / 2, height / 2]) .clipAngle(180 - 1e-3) .precision(.1); - + var path = d3.geo.path() .projection(projection); @@ -1209,7 +1209,7 @@ function azimuthalEquidistant() { d3.select(self.frameElement).style("height", height + "px"); } - + //Example from http://bl.ocks.org/mbostock/4060366 function voronoiTesselation() { var width = 960, @@ -1237,7 +1237,7 @@ function voronoiTesselation() { .attr("r", 2); redraw(); - + function redraw() { path = path.data(voronoi(vertices).map(function (d) { return "M" + d.join("L") + "Z"; } ), String); path.exit().remove(); @@ -1254,7 +1254,7 @@ function forceDirectedVoronoi() { simulate = true, zoomToAdd = true, color = d3.scale.quantize().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]) - + var numVertices = (w*h) / 3000; var vertices = d3.range(numVertices).map(function(i) { var angle = radius * (i+10); @@ -1266,15 +1266,15 @@ function forceDirectedVoronoi() { var prevEventScale = 1; var zoom = d3.behavior.zoom().on("zoom", function(d,i) { if (zoomToAdd){ - if (( d3.event).scale > prevEventScale) { - var angle = radius * vertices.length; - vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}) - } else if (vertices.length > 2 && ( d3.event).scale != prevEventScale) { - vertices.pop(); - } - force.nodes(vertices).start() + if (( d3.event).scale > prevEventScale) { + var angle = radius * vertices.length; + vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}) + } else if (vertices.length > 2 && ( d3.event).scale != prevEventScale) { + vertices.pop(); + } + force.nodes(vertices).start() } else { - if (( d3.event).scale > prevEventScale) { + if (( d3.event).scale > prevEventScale) { radius+= .01 } else { radius -= .01 @@ -1285,18 +1285,18 @@ function forceDirectedVoronoi() { }); force.nodes(vertices).start() } - prevEventScale = ( d3.event).scale; + prevEventScale = ( d3.event).scale; }); - + d3.select(window) .on("keydown", function() { // shift - if(d3.event.keyCode == 16) { + if(( d3.event).keyCode == 16) { zoomToAdd = false } - + // s - if(d3.event.keyCode == 83) { + if(( d3.event).keyCode == 83) { simulate = !simulate if(simulate) { force.start() @@ -1308,38 +1308,38 @@ function forceDirectedVoronoi() { .on("keyup", function() { zoomToAdd = true }) - + var svg = d3.select("#chart") .append("svg") .attr("width", w) .attr("height", h) .call(zoom) - + var force = d3.layout.force() .charge(-300) .size([w, h]) .on("tick", update); - + force.nodes(vertices).start(); - + var circle = > svg.selectAll("circle"); var path = > svg.selectAll("path"); var link = > svg.selectAll("line"); - + function update() { path = path.data(d3_geom_voronoi(vertices)); path.enter().append("path") // drag node by dragging cell .call(d3.behavior.drag() .on("drag", function(d, i) { - vertices[i] = {x: vertices[i].x + ( d3.event).dx, y: vertices[i].y + ( d3.event).dy} + vertices[i] = {x: vertices[i].x + ( d3.event).dx, y: vertices[i].y + ( d3.event).dy} }) ) .style("fill", function(d, i) { return color(0) }) path.attr("d", function(d) { return "M" + d.join("L") + "Z"; }) .transition().duration(150).style("fill", function(d, i) { return color(d3.geom.polygon(d).area()) }) path.exit().remove(); - + circle = circle.data(vertices) circle.enter().append("circle") .attr("r", 0) @@ -1347,16 +1347,16 @@ function forceDirectedVoronoi() { circle.attr("cx", function(d) { return d.x; }) .attr("cy", function(d) { return d.y; }); circle.exit().transition().attr("r", 0).remove(); - + link = link.data(d3_geom_voronoi.links(vertices)) link.enter().append("line") link.attr("x1", function(d) { return d.source.x; }) .attr("y1", function(d) { return d.source.y; }) .attr("x2", function(d) { return d.target.x; }) .attr("y2", function(d) { return d.target.y; }) - + link.exit().remove() - + if(!simulate) force.stop() } } @@ -1521,7 +1521,7 @@ module hierarchicalEdgeBundling { .value(function (d) { return d.size; } ); var bundle = d3.layout.bundle(); - + var line = d3.svg.line.radial() .interpolate("bundle") .tension(.85) @@ -1851,7 +1851,7 @@ function chordDiagram() { [8010, 16145, 8090, 8045], [1013, 990, 940, 6907] ]; - + var chord = d3.layout.chord() .padding(.05) .sortSubgroups(d3.descending) @@ -2031,7 +2031,7 @@ function irisParallel() { } function drag(d: string) { - x.range()[i] = ( d3.event).x; + x.range()[i] = ( d3.event).x; traits.sort(function (a, b) { return x(a) - x(b); } ); g.attr("transform", function (d) { return "translate(" + x(d) + ")"; } ); foreground.attr("d", path); @@ -2085,14 +2085,14 @@ function healthAndWealth() { // The x & y axes. var xAxis = d3.svg.axis().orient("bottom").scale(xScale).ticks(12, d3.format(",d")), yAxis = d3.svg.axis().scale(yScale).orient("left"); - + // Create the SVG container and set the origin. var svg = d3.select("#chart").append("svg") .attr("width", width + margin.left + margin.right) .attr("height", height + margin.top + margin.bottom) .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - + // Add the x-axis. svg.append("g") .attr("class", "x axis") @@ -2152,7 +2152,7 @@ function healthAndWealth() { // Add an overlay for the year label. var box = (label.node()).getBBox(); - + var overlay = svg.append("rect") .attr("class", "overlay") .attr("x", box.x) @@ -2669,12 +2669,14 @@ function multiTest() { function testD3Events () { d3.select('svg') .on('click', () => { - var coords = [d3.event.pageX, d3.event.pageY]; - console.log("clicked", d3.event.target, "at " + coords); + let e = d3.event; + var coords = [e.pageX, e.pageY]; + console.log("clicked", e.target, "at " + coords); }) .on('keypress', () => { - if (d3.event.shiftKey) { - console.log('shift + ' + d3.event.which); + let e = d3.event; + if (e.shiftKey) { + console.log('shift + ' + e.which); } }); } @@ -2690,4 +2692,4 @@ function testD3MutlieTimeFormat() { ["%B", function(d) { return d.getMonth(); }], ["%Y", function() { return true; }] ]); -} \ No newline at end of file +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index ef3909e9f..2d1b20c3b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -807,7 +807,7 @@ declare module d3 { interface Transition { transition(): Transition; - + delay(): number; delay(delay: number): Transition; delay(delay: (datum: Datum, index: number, outerIndex: number) => number): Transition; @@ -920,16 +920,33 @@ declare module d3 { export function flush(): void; } - /** - * Interface for any and all d3 events. - */ - interface Event extends KeyboardEvent, MouseEvent { - } + interface BaseEvent { + type: string; + sourceEvent?: Event; + } + + /** + * Define a D3-specific ZoomEvent per https://github.com/mbostock/d3/wiki/Zoom-Behavior#event + */ + interface ZoomEvent extends BaseEvent { + scale: number; + translate: [number, number]; + } + + /** + * Define a D3-specific DragEvent per https://github.com/mbostock/d3/wiki/Drag-Behavior#on + */ + interface DragEvent extends BaseEvent { + x: number; + y: number; + dx: number; + dy: number; + } /** * The current event's value. Use this variable in a handler registered with `selection.on`. */ - export var event: Event; + export var event: Event | BaseEvent; /** * Returns the x and y coordinates of the mouse relative to the provided container element, using d3.event for the mouse's position on the page. From b33f6c6dedba3dd7d251408008f1d0ab995e4fe0 Mon Sep 17 00:00:00 2001 From: David Pfeffer Date: Thu, 10 Sep 2015 14:59:43 -0400 Subject: [PATCH 045/189] Maintains type safety through a safeApply. --- rx-angular/rx.angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rx-angular/rx.angular.d.ts b/rx-angular/rx.angular.d.ts index e2d0ec8c5..2b82e529a 100644 --- a/rx-angular/rx.angular.d.ts +++ b/rx-angular/rx.angular.d.ts @@ -10,7 +10,7 @@ declare module Rx { interface IObservable { - safeApply($scope: ng.IScope, callback: (data: any) => void): Rx.Observable; + safeApply($scope: ng.IScope, callback: (data: T) => void): Rx.Observable; } } From 0b26f2d03de4551ebc3196bf7e3ae8d937f64fff Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 10 Sep 2015 10:50:42 -0700 Subject: [PATCH 046/189] angular2-2.0.0-alpha.37 --- angular2/angular2-2.0.0-alpha.37.d.ts | 12214 ++++++++++++++++++++++++ angular2/angular2-tests.ts | 8 +- angular2/angular2.d.ts | 7000 +++++++++++++- angular2/http-2.0.0-alpha.37.d.ts | 1007 ++ angular2/http.d.ts | 1007 ++ angular2/router-2.0.0-alpha.35.d.ts | 18 +- angular2/router-2.0.0-alpha.36.d.ts | 18 +- angular2/router-2.0.0-alpha.37.d.ts | 738 ++ angular2/router.d.ts | 505 +- 9 files changed, 21911 insertions(+), 604 deletions(-) create mode 100644 angular2/angular2-2.0.0-alpha.37.d.ts create mode 100644 angular2/http-2.0.0-alpha.37.d.ts create mode 100644 angular2/http.d.ts create mode 100644 angular2/router-2.0.0-alpha.37.d.ts diff --git a/angular2/angular2-2.0.0-alpha.37.d.ts b/angular2/angular2-2.0.0-alpha.37.d.ts new file mode 100644 index 000000000..733c9e8ef --- /dev/null +++ b/angular2/angular2-2.0.0-alpha.37.d.ts @@ -0,0 +1,12214 @@ +// Type definitions for Angular v2.0.0-alpha.37 +// Project: http://angular.io/ +// Definitions by: angular team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// *********************************************************** +// This file is generated by the Angular build process. +// Please do not create manual edits or send pull requests +// modifying this file. +// *********************************************************** + +// angular2/angular2 depends transitively on these libraries. +// If you don't have them installed you can install them using TSD +// https://github.com/DefinitelyTyped/tsd + +/// +/// +// angular2/web_worker/worker depends transitively on these libraries. +// If you don't have them installed you can install them using TSD +// https://github.com/DefinitelyTyped/tsd + +/// +/// +// angular2/web_worker/ui depends transitively on these libraries. +// If you don't have them installed you can install them using TSD +// https://github.com/DefinitelyTyped/tsd + +/// +/// + + +interface Map {} +interface StringMap extends Map {} + + +declare module ng { + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: string; + stack: string; + toString(): string; + } + interface InjectableReference {} +} + +declare module ngWorker { + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: string; + stack: string; + toString(): string; + } + interface InjectableReference {} +} + +declare module ngUi { + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: string; + stack: string; + toString(): string; + } + interface InjectableReference {} +} + + + + + +/** + * The `angular2` is the single place to import all of the individual types. + */ +declare module ng { + + /** + * Bootstrapping for Angular applications. + * + * You instantiate an Angular application by explicitly specifying a component to use as the root + * component for your + * application via the `bootstrap()` method. + * + * ## Simple Example + * + * Assuming this `index.html`: + * + * ```html + * + * + * + * loading... + * + * + * ``` + * + * An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike + * Angular 1, Angular 2 + * does not compile/process bindings in `index.html`. This is mainly for security reasons, as well + * as architectural + * changes in Angular 2. This means that `index.html` can safely be processed using server-side + * technologies such as + * bindings. Bindings can thus use double-curly `{{ syntax }}` without collision from Angular 2 + * component double-curly + * `{{ syntax }}`. + * + * We can use this script code: + * + * ``` + * @Component({ + * selector: 'my-app' + * }) + * @View({ + * template: 'Hello {{ name }}!' + * }) + * class MyApp { + * name:string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * + * main() { + * return bootstrap(MyApp); + * } + * ``` + * + * When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, + * Angular performs the + * following tasks: + * + * 1. It uses the component's `selector` property to locate the DOM element which needs to be + * upgraded into + * the angular component. + * 2. It creates a new child injector (from the platform injector). Optionally, you can also + * override the injector configuration for an app by + * invoking `bootstrap` with the `componentInjectableBindings` argument. + * 3. It creates a new `Zone` and connects it to the angular application's change detection domain + * instance. + * 4. It creates a shadow DOM on the selected component's host element and loads the template into + * it. + * 5. It instantiates the specified component. + * 6. Finally, Angular performs change detection to apply the initial data bindings for the + * application. + * + * + * ## Instantiating Multiple Applications on a Single Page + * + * There are two ways to do this. + * + * + * ### Isolated Applications + * + * Angular creates a new application each time that the `bootstrap()` method is invoked. When + * multiple applications + * are created for a page, Angular treats each application as independent within an isolated change + * detection and + * `Zone` domain. If you need to share data between applications, use the strategy described in the + * next + * section, "Applications That Share Change Detection." + * + * + * ### Applications That Share Change Detection + * + * If you need to bootstrap multiple applications that share common data, the applications must + * share a common + * change detection and zone. To do that, create a meta-component that lists the application + * components in its template. + * By only invoking the `bootstrap()` method once, with the meta-component as its argument, you + * ensure that only a + * single change detection zone is created and therefore data can be shared across the applications. + * + * + * ## Platform Injector + * + * When working within a browser window, there are many singleton resources: cookies, title, + * location, and others. + * Angular services that represent these resources must likewise be shared across all Angular + * applications that + * occupy the same browser window. For this reason, Angular creates exactly one global platform + * injector which stores + * all shared services, and each angular application injector has the platform injector as its + * parent. + * + * Each application has its own private injector as well. When there are multiple applications on a + * page, Angular treats + * each application injector's services as private to that application. + * + * + * # API + * - `appComponentType`: The root component which should act as the application. This is a reference + * to a `Type` + * which is annotated with `@Component(...)`. + * - `componentInjectableBindings`: An additional set of bindings that can be added to the app + * injector + * to override default injection behavior. + * - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for + * unhandled exceptions. + * + * Returns a `Promise` of {@link ApplicationRef}. + */ + function bootstrap(appComponentType: /*Type*/ any, componentInjectableBindings?: Array) : Promise ; + + + /** + * Declare reusable UI building blocks for an application. + * + * Each Angular component requires a single `@Component` and at least one `@View` annotation. The + * `@Component` + * annotation specifies when a component is instantiated, and which properties and hostListeners it + * binds to. + * + * When a component is instantiated, Angular + * - creates a shadow DOM for the component. + * - loads the selected template into the shadow DOM. + * - creates all the injectable objects configured with `bindings` and `viewBindings`. + * + * All template expressions and statements are then evaluated against the component instance. + * + * For details on the `@View` annotation, see {@link ViewMetadata}. + * + * ## Example + * + * ``` + * @Component({ + * selector: 'greet' + * }) + * @View({ + * template: 'Hello {{name}}!' + * }) + * class Greet { + * name: string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * ``` + */ + class ComponentMetadata extends DirectiveMetadata { + + + /** + * Defines the used change detection strategy. + * + * When a component is instantiated, Angular creates a change detector, which is responsible for + * propagating the component's bindings. + * + * The `changeDetection` property defines, whether the change detection will be checked every time + * or only when the component tells it to do so. + */ + changeDetection: ChangeDetectionStrategy; + + + /** + * Defines the set of injectable objects that are visible to its view dom children. + * + * ## Simple Example + * + * Here is an example of a class that can be injected: + * + * ``` + * class Greeter { + * greet(name:string) { + * return 'Hello ' + name + '!'; + * } + * } + * + * @Directive({ + * selector: 'needs-greeter' + * }) + * class NeedsGreeter { + * greeter:Greeter; + * + * constructor(greeter:Greeter) { + * this.greeter = greeter; + * } + * } + * + * @Component({ + * selector: 'greet', + * viewBindings: [ + * Greeter + * ] + * }) + * @View({ + * template: ``, + * directives: [NeedsGreeter] + * }) + * class HelloWorld { + * } + * + * ``` + */ + viewBindings: any[]; + } + + + /** + * Directives allow you to attach behavior to elements in the DOM. + * + * {@link DirectiveMetadata}s with an embedded view are called {@link ComponentMetadata}s. + * + * A directive consists of a single directive annotation and a controller class. When the + * directive's `selector` matches + * elements in the DOM, the following steps occur: + * + * 1. For each directive, the `ElementInjector` attempts to resolve the directive's constructor + * arguments. + * 2. Angular instantiates directives for each matched element using `ElementInjector` in a + * depth-first order, + * as declared in the HTML. + * + * ## Understanding How Injection Works + * + * There are three stages of injection resolution. + * - *Pre-existing Injectors*: + * - The terminal {@link Injector} cannot resolve dependencies. It either throws an error or, if + * the dependency was + * specified as `@Optional`, returns `null`. + * - The platform injector resolves browser singleton resources, such as: cookies, title, + * location, and others. + * - *Component Injectors*: Each component instance has its own {@link Injector}, and they follow + * the same parent-child hierarchy + * as the component instances in the DOM. + * - *Element Injectors*: Each component instance has a Shadow DOM. Within the Shadow DOM each + * element has an `ElementInjector` + * which follow the same parent-child hierarchy as the DOM elements themselves. + * + * When a template is instantiated, it also must instantiate the corresponding directives in a + * depth-first order. The + * current `ElementInjector` resolves the constructor dependencies for each directive. + * + * Angular then resolves dependencies as follows, according to the order in which they appear in the + * {@link ViewMetadata}: + * + * 1. Dependencies on the current element + * 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM boundary + * 3. Dependencies on component injectors and their parents until it encounters the root component + * 4. Dependencies on pre-existing injectors + * + * + * The `ElementInjector` can inject other directives, element-specific special objects, or it can + * delegate to the parent + * injector. + * + * To inject other directives, declare the constructor parameter as: + * - `directive:DirectiveType`: a directive on the current element only + * - `@Host() directive:DirectiveType`: any directive that matches the type between the current + * element and the + * Shadow DOM root. + * - `@Query(DirectiveType) query:QueryList`: A live collection of direct child + * directives. + * - `@QueryDescendants(DirectiveType) query:QueryList`: A live collection of any + * child directives. + * + * To inject element-specific special objects, declare the constructor parameter as: + * - `element: ElementRef` to obtain a reference to logical element in the view. + * - `viewContainer: ViewContainerRef` to control child template instantiation, for + * {@link DirectiveMetadata} directives only + * - `bindingPropagation: BindingPropagation` to control change detection in a more granular way. + * + * ## Example + * + * The following example demonstrates how dependency injection resolves constructor arguments in + * practice. + * + * + * Assume this HTML template: + * + * ``` + *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * ``` + * + * With the following `dependency` decorator and `SomeService` injectable class. + * + * ``` + * @Injectable() + * class SomeService { + * } + * + * @Directive({ + * selector: '[dependency]', + * properties: [ + * 'id: dependency' + * ] + * }) + * class Dependency { + * id:string; + * } + * ``` + * + * Let's step through the different ways in which `MyDirective` could be declared... + * + * + * ### No injection + * + * Here the constructor is declared with no arguments, therefore nothing is injected into + * `MyDirective`. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor() { + * } + * } + * ``` + * + * This directive would be instantiated with no dependencies. + * + * + * ### Component-level injection + * + * Directives can inject any injectable instance from the closest component injector or any of its + * parents. + * + * Here, the constructor declares a parameter, `someService`, and injects the `SomeService` type + * from the parent + * component's injector. + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(someService: SomeService) { + * } + * } + * ``` + * + * This directive would be instantiated with a dependency on `SomeService`. + * + * + * ### Injecting a directive from the current element + * + * Directives can inject other directives declared on the current element. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(dependency: Dependency) { + * expect(dependency.id).toEqual(3); + * } + * } + * ``` + * This directive would be instantiated with `Dependency` declared at the same element, in this case + * `dependency="3"`. + * + * ### Injecting a directive from any ancestor elements + * + * Directives can inject other directives declared on any ancestor element (in the current Shadow + * DOM), i.e. on the current element, the + * parent element, or its parents. + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Host() dependency: Dependency) { + * expect(dependency.id).toEqual(2); + * } + * } + * ``` + * + * `@Host` checks the current element, the parent, as well as its parents recursively. If + * `dependency="2"` didn't + * exist on the direct parent, this injection would + * have returned + * `dependency="1"`. + * + * + * ### Injecting a live collection of direct child directives + * + * + * A directive can also query for other child directives. Since parent directives are instantiated + * before child directives, a directive can't simply inject the list of child directives. Instead, + * the directive injects a {@link QueryList}, which updates its contents as children are added, + * removed, or moved by a directive that uses a {@link ViewContainerRef} such as a `ng-for`, an + * `ng-if`, or an `ng-switch`. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Query(Dependency) dependencies:QueryList) { + * } + * } + * ``` + * + * This directive would be instantiated with a {@link QueryList} which contains `Dependency` 4 and + * 6. Here, `Dependency` 5 would not be included, because it is not a direct child. + * + * ### Injecting a live collection of descendant directives + * + * By passing the descendant flag to `@Query` above, we can include the children of the child + * elements. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Query(Dependency, {descendants: true}) dependencies:QueryList) { + * } + * } + * ``` + * + * This directive would be instantiated with a Query which would contain `Dependency` 4, 5 and 6. + * + * ### Optional injection + * + * The normal behavior of directives is to return an error when a specified dependency cannot be + * resolved. If you + * would like to inject `null` on unresolved dependency instead, you can annotate that dependency + * with `@Optional()`. + * This explicitly permits the author of a template to treat some of the surrounding directives as + * optional. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Optional() dependency:Dependency) { + * } + * } + * ``` + * + * This directive would be instantiated with a `Dependency` directive found on the current element. + * If none can be + * found, the injector supplies `null` instead of throwing an error. + * + * ## Example + * + * Here we use a decorator directive to simply define basic tool-tip behavior. + * + * ``` + * @Directive({ + * selector: '[tooltip]', + * properties: [ + * 'text: tooltip' + * ], + * host: { + * '(mouseenter)': 'onMouseEnter()', + * '(mouseleave)': 'onMouseLeave()' + * } + * }) + * class Tooltip{ + * text:string; + * overlay:Overlay; // NOT YET IMPLEMENTED + * overlayManager:OverlayManager; // NOT YET IMPLEMENTED + * + * constructor(overlayManager:OverlayManager) { + * this.overlay = overlay; + * } + * + * onMouseEnter() { + * // exact signature to be determined + * this.overlay = this.overlayManager.open(text, ...); + * } + * + * onMouseLeave() { + * this.overlay.close(); + * this.overlay = null; + * } + * } + * ``` + * In our HTML template, we can then add this behavior to a `
` or any other element with the + * `tooltip` selector, + * like so: + * + * ``` + *
+ * ``` + * + * Directives can also control the instantiation, destruction, and positioning of inline template + * elements: + * + * A directive uses a {@link ViewContainerRef} to instantiate, insert, move, and destroy views at + * runtime. + * The {@link ViewContainerRef} is created as a result of `