@adhityan/gc-nats
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -12,27 +12,15 @@ import { NatsConnectionConfigs } from './types'; | ||
}>(natsConnectionConfigs: NatsConnectionConfigs, channel: string, messageReceived: (message: X) => Promise<void>, messageValidation?: (message: X) => Promise<boolean>): Promise<void>; | ||
declare type CLASS1<X> = { | ||
new (...args: any[]): { | ||
messageReceived(message: X): Promise<void>; | ||
messageValidation?(message: X): Promise<boolean>; | ||
[name: string]: any; | ||
}; | ||
}; | ||
declare type TYPE1<X> = (constructor: CLASS1<X>) => { | ||
new (...args: any[]): { | ||
[name: string]: any; | ||
}; | ||
}; | ||
declare type CLASS2<X> = { | ||
new (...args: any[]): { | ||
channel: string; | ||
messageReceived(message: X): Promise<void>; | ||
messageValidation?(message: X): Promise<boolean>; | ||
[name: string]: any; | ||
}; | ||
}; | ||
declare type TYPE2<X> = (constructor: CLASS2<X>) => { | ||
new (...args: any[]): { | ||
[name: string]: any; | ||
}; | ||
}; | ||
interface CLASS1<X> { | ||
new (...args: any[]): CLASS1<X>; | ||
messageReceived(message: X): Promise<void>; | ||
messageValidation?(message: X): Promise<boolean>; | ||
} | ||
declare type TYPE1<X> = (constructor: CLASS1<X>) => CLASS1<X>; | ||
interface CLASS2<X> { | ||
new (...args: any[]): CLASS2<X>; | ||
channel: string; | ||
messageReceived(message: X): Promise<void>; | ||
messageValidation?(message: X): Promise<boolean>; | ||
} | ||
declare type TYPE2<X> = (constructor: CLASS2<X>) => CLASS2<X>; | ||
/** | ||
@@ -39,0 +27,0 @@ * Worker factory |
@@ -28,2 +28,3 @@ "use strict"; | ||
exports.startWorker = startWorker; | ||
; | ||
function Worker(natsConnectionConfigs, channel) { | ||
@@ -30,0 +31,0 @@ return function (constructor) { |
{ | ||
"name": "@adhityan/gc-nats", | ||
"description": "Typescript Node.js client for NATS streaming server", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -20,47 +20,21 @@ import { NatsConnectionConfigs } from './types'; | ||
type CLASS1<X> = { | ||
new(...args: any[]) : { | ||
messageReceived(message: X): Promise<void>, | ||
messageValidation?(message: X): Promise<boolean> | ||
[name: string]: any | ||
} | ||
interface CLASS1<X> { | ||
new(...args: any[]): CLASS1<X> | ||
messageReceived(message: X): Promise<void>, | ||
messageValidation?(message: X): Promise<boolean> | ||
} | ||
type TYPE1<X> = (constructor: CLASS1<X> ) => { | ||
new(...args: any[]) : { | ||
[name: string]: any | ||
} | ||
}; | ||
type TYPE1<X> = (constructor: CLASS1<X> ) => CLASS1<X>; | ||
type CLASS2<X> = { | ||
new(...args: any[]) : { | ||
channel: string; | ||
messageReceived(message: X): Promise<void>, | ||
messageValidation?(message: X): Promise<boolean> | ||
[name: string]: any | ||
} | ||
}; | ||
interface CLASS2<X> { | ||
new(...args: any[]) : CLASS2<X> | ||
type TYPE2<X> = (constructor: CLASS2<X>) => { | ||
new(...args: any[]) : { | ||
[name: string]: any | ||
} | ||
channel: string; | ||
messageReceived(message: X): Promise<void>, | ||
messageValidation?(message: X): Promise<boolean> | ||
}; | ||
type CLASS3<X> = { | ||
new(...args: any[]) : { | ||
channel?: string; | ||
messageReceived(message: X): Promise<void>, | ||
messageValidation?(message: X): Promise<boolean> | ||
[name: string]: any | ||
} | ||
}; | ||
type TYPE2<X> = (constructor: CLASS2<X>) => CLASS2<X>; | ||
type TYPE3<X> = (constructor: CLASS3<X>) => { | ||
new(...args: any[]) : { | ||
[name: string]: any | ||
} | ||
}; | ||
/** | ||
@@ -82,4 +56,4 @@ * Worker factory | ||
export function Worker <X extends { [key: string]: any }> (natsConnectionConfigs: NatsConnectionConfigs, channel?: string) : TYPE3<X> { | ||
return function (constructor: CLASS3<X>) { | ||
export function Worker <X extends { [key: string]: any }> (natsConnectionConfigs: NatsConnectionConfigs, channel?: string) : any { | ||
return function<T extends { new(...args: any[]): any }> (constructor: T) { | ||
const reference = class extends constructor { | ||
@@ -86,0 +60,0 @@ constructor(...args: any[]) { |
Sorry, the diff of this file is not supported yet
35954
647