Skip to content

Commit

Permalink
v0.11.3. Update msb.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
galkin committed Oct 3, 2016
1 parent 10c8920 commit b2322ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 deletions msb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ declare namespace msb {
payloadMessages: Message[];
responseChannel: rawConsumer;

on(event: string, listener: Function): this;
on(event: 'payload', listener: (payload: MessagePayload, message?: Message) => void): this;
on(event: 'ack', listener: (payload: MessageAck, message?: Message) => void): this;
on(event: 'end', listener: () => void): this;

isAwaitingAcks: () => boolean;
isAwaitingResponses: () => boolean;
listenForResponses: (topic: string, shouldAcceptMessageFn?: (message: Message) => boolean) => this;
Expand All @@ -104,12 +109,15 @@ declare namespace msb {
interface Requester extends Collector {
(config?: CollectorConfig, originalMessage?: Message): this;

on(event: string, listener: Function): this;
on(event: 'error', listener: (error: Error) => void): this;

meta: MessageMeta;
message: Message;
originalMessage: Message;
requestChannelTimeoutMs: number;

publish(payload?: MessagePayload, cb?: (err?: Error, payload?: MessagePayload) => void): this;
publish(payload?: MessagePayload): this;
}

interface Responder {
Expand All @@ -122,13 +130,17 @@ declare namespace msb {
originalMessage: Message;
responseChannelTimeoutMs: number;

sendAck: (timeoutMs?: number, responsesRemaining?: number, cb?: () => void) => void;
send: (payload: MessagePayload, cb?: ()=>void) => void;
sendAck: (timeoutMs?: number, responsesRemaining?: number, cb?: errorCallback) => void;
send: (payload: MessagePayload, cb?: errorCallback) => void;
createEmitter: (config: ResponderConfig,
channelManager?: channelManager) => ResponderEventEmitter;
createServer: (config: ResponderConfig) => ResponderServer;
}

interface errorCallback {
(err?: Error): void;
}

interface request {
(options: string | {
namespace: string;
Expand All @@ -137,7 +149,7 @@ declare namespace msb {
channelManager?: channelManager;
originalMessage?: Message;
responseSchema?: JsonSchema;
}, payload: MessagePayload, cb?: (err?: Error, payload?: MessagePayload)=>void): Requester;
}, payload: MessagePayload, cb?: (err?: Error, payload?: MessagePayload, message?: Message)=>void): Requester;
}

interface validateWithSchema {
Expand Down Expand Up @@ -211,7 +223,7 @@ declare namespace msb {

interface rawProducer {
channel: (topic: string) => {
publish: (payload: MessagePayload, cb?: () => void) => void;
publish: (payload: MessagePayload, cb?: errorCallback) => void;
close: () => void;
};
}
Expand Down Expand Up @@ -279,7 +291,10 @@ declare namespace msb {
responseChannelTimeoutMs?: number;
}

interface ResponderEventEmitter {
interface ResponderEventEmitter extends EventEmitter {
on(event: string, listener: Function): this;
on(event: 'responder', listener: (responder: Responder) => void): this;

end: () => void;
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msb",
"version": "0.11.2",
"version": "0.11.3",
"description": "A framework to simplify the implementation of an event-bus oriented microservices architecture",
"license": "MIT",
"main": "index.js",
Expand Down

0 comments on commit b2322ee

Please sign in to comment.