From 30c6fd30ce0ef6b3b97f6da9b512c5badf4bf61d Mon Sep 17 00:00:00 2001 From: Qinfeng Chen Date: Thu, 11 Dec 2014 11:53:26 -0500 Subject: [PATCH 1/3] add custom shape typings --- sigmajs/sigmajs.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sigmajs/sigmajs.d.ts b/sigmajs/sigmajs.d.ts index 7ffe26626..ae2b09816 100644 --- a/sigmajs/sigmajs.d.ts +++ b/sigmajs/sigmajs.d.ts @@ -31,6 +31,10 @@ declare module SigmaJs{ (key: string): string; } + interface CustomShapes { + init(sigma: Sigma): void; + } + interface DragNodes { (sigma: Sigma, renderer: Renderer): DragNodes; } @@ -78,8 +82,10 @@ declare module SigmaJs{ interface Node { color?: string; id: string; + image?: any; label?: string; size?: number; + type?: string; x?: number; y?: number; } @@ -107,6 +113,10 @@ declare module SigmaJs{ type?: string; } + interface ShapeLibrary { + enumerate(): any; + } + interface Sigma { addRenderer(): Renderer; addRenderer(configs: RendererConfigs): Renderer; @@ -253,3 +263,5 @@ declare module SigmaJs{ } declare var sigma: SigmaJs.SigmaFactory; +declare var CustomShapes: SigmaJs.CustomShapes; +declare var ShapeLibrary: SigmaJs.CustomShapes; From 813eb68c6237a633901dd1eb92dbff1dbb81646d Mon Sep 17 00:00:00 2001 From: Adam Babcock Date: Thu, 11 Dec 2014 13:56:47 -0600 Subject: [PATCH 2/3] Add nodemailer module declaration --- nodemailer/nodemailer.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index c95aee99f..a63479e83 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -104,3 +104,8 @@ interface Nodemailer { createTransport(type: string, path: string): Transport; createXOAuthGenerator(options: XOAuthGeneratorOptions): XOAuthGenerator; } + +declare module "nodemailer" { + var nodemailer: Nodemailer; + export = nodemailer; +} From 6205ea3bdc924584ead1179a238f5323479102e4 Mon Sep 17 00:00:00 2001 From: wokim Date: Fri, 12 Dec 2014 18:56:03 +0900 Subject: [PATCH 3/3] Add definitions for amqp-rpc --- amqp-rpc/amqp-rpc-tests.ts | 42 +++++++++++++++++++++++ amqp-rpc/amqp-rpc.d.ts | 68 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 amqp-rpc/amqp-rpc-tests.ts create mode 100644 amqp-rpc/amqp-rpc.d.ts diff --git a/amqp-rpc/amqp-rpc-tests.ts b/amqp-rpc/amqp-rpc-tests.ts new file mode 100644 index 000000000..30d740d3e --- /dev/null +++ b/amqp-rpc/amqp-rpc-tests.ts @@ -0,0 +1,42 @@ +/// +import amqp_rpc = require('amqp-rpc'); +var rpc = amqp_rpc.factory(); + +interface Name { + name?: string; +} + +rpc.on('inc', function (param, cb) { + var prevVal = param; + var nextVal = param + 2; + cb(++param, prevVal, nextVal); +}); + +rpc.on('say.*', function (param, cb, inf) { + var arr = inf.cmd.split('.'); + var name = (param && param.name) ? param.name : 'world'; + cb(arr[1] + ' ' + name + '!'); +}); + +rpc.on('withoutCB', function (param, cb, inf) { + if (cb) { + cb('please run function without cb parameter') + } + else { + console.log('this is function withoutCB'); + } +}); + +rpc.call('inc', 5, function (param1, param2, param3) { + console.log(param1, param2, param3); +}); + +rpc.call('say.Hello', { name: 'John' }, function (msg) { + console.log('results of say.Hello:', msg); //output: Hello John! +}); + +rpc.call('withoutCB', {}, function (msg) { + console.log('withoutCB results:', msg); //output: please run function without cb parameter +}); + +rpc.call('withoutCB', {}); //output message on server side console \ No newline at end of file diff --git a/amqp-rpc/amqp-rpc.d.ts b/amqp-rpc/amqp-rpc.d.ts new file mode 100644 index 000000000..a848fd4c4 --- /dev/null +++ b/amqp-rpc/amqp-rpc.d.ts @@ -0,0 +1,68 @@ +// Type definitions for amqp-rpc v0.0.8 +// Project: https://github.com/demchenkoe/node-amqp-rpc/ +// Definitions by: Wonshik Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "amqp-rpc" { + + export interface Options { + connection?: any; + url?: string; + exchangeInstance?: any; + exchange?: string; + exchange_options?: { + exclusive?: boolean; + autoDelete?: boolean; + }; + ipml_options?: { + defaultExchangeName?: string; + } + conn_options?: any; + } + + export interface CallOptions { + correlationId?: string; + autoDeleteCallback?: any; + } + + export interface HandlerOptions { + queueName?: string; + durable?: boolean; + exclusive?: boolean; + autoDelete?: boolean; + } + + export interface BroadcastOptions { + ttl?: boolean; + onResponse?: any; + context?: any; + onComplete?: any; + } + + export interface CommandInfo { + cmd?: string; + exchange?: string; + contentType?: string; + size?: number; + } + + export interface Callback { + (...args: any[]): void; + } + + export function factory(opt?: Options): amqpRPC; + + export class amqpRPC { + constructor(opt?: Options); + generateQueueName(type: string): string; + disconnect(): void; + call(cmd: string, params: T, cb?: Callback, context?: any, options?: CallOptions): string; + on(cmd: string, cb: (param?: T, cb?: Callback, info?: CommandInfo) => void, context?: any, options?: HandlerOptions): boolean; + off(cmd: string): boolean; + callBroadcast(cmd: string, params: any, options: BroadcastOptions): void; + onBroadcast(cmd: string, cb: (err: any) => void, context: any, options?: any): boolean; + offBroadcast(cmd: string): boolean; + } +} \ No newline at end of file