This repository has been archived by the owner on Apr 4, 2020. It is now read-only.
forked from moleculerjs/moleculer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
709 lines (597 loc) · 20.5 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
import Bluebird from "bluebird";
declare namespace Moleculer {
type GenericObject = { [name: string]: any };
interface Logger {
fatal?: (...args: any[]) => void;
error: (...args: any[]) => void;
warn: (...args: any[]) => void;
info: (...args: any[]) => void;
debug?: (...args: any[]) => void;
trace?: (...args: any[]) => void;
}
class LoggerInstance {
fatal(...args: any[]): void;
error(...args: any[]): void;
warn(...args: any[]): void;
info(...args: any[]): void;
debug(...args: any[]): void;
trace(...args: any[]): void;
}
type ActionHandler<T = any> = ((ctx: Context) => Bluebird<T> | T) & ThisType<Service>;
type ActionParamSchema = { [key: string]: any };
type ActionParamTypes = "boolean" | "number" | "string" | "object" | "array" | ActionParamSchema;
type ActionParams = { [key: string]: ActionParamTypes };
type MetricsOptions = { params?: "boolean" | "array" | "function", meta?: "boolean" | "array" | "function" };
interface Action {
name: string;
params?: ActionParams;
service?: Service;
cache?: boolean;
handler: ActionHandler;
metrics?: MetricsOptions;
[key: string]: any;
}
type Actions = { [key: string]: Action | ActionHandler; };
class Context<P = GenericObject, M = GenericObject> {
constructor(broker: ServiceBroker, action: Action);
id: string;
broker: ServiceBroker;
action: Action;
nodeID?: string;
parentID?: string;
metrics: boolean;
level?: number;
timeout: number;
retryCount: number;
params: P;
meta: M;
requestID?: string;
callerNodeID?: string;
duration: number;
cachedResult: boolean;
generateID(): string;
setParams(newParams: P, cloning?: boolean): void;
call<T = any, P extends GenericObject = GenericObject>(actionName: string, params?: P, opts?: GenericObject): Bluebird<T>;
emit(eventName: string, data: any, groups: Array<string>): void;
emit(eventName: string, data: any, groups: string): void;
emit(eventName: string, data: any): void;
broadcast(eventName: string, data: any, groups: Array<string>): void;
broadcast(eventName: string, data: any, groups: string): void;
broadcast(eventName: string, data: any): void;
static create(broker: ServiceBroker, action: Action, nodeID: string, params: GenericObject, opts: GenericObject): Context;
static create(broker: ServiceBroker, action: Action, nodeID: string, opts: GenericObject): Context;
static create(broker: ServiceBroker, action: Action, opts: GenericObject): Context;
static createFromPayload(broker: ServiceBroker, payload: GenericObject): Context;
}
interface ServiceSettingSchema {
$noVersionPrefix?: boolean;
$noServiceNamePrefix?: boolean;
[name: string]: any;
}
type ServiceEventHandler = ((payload: any, sender: string, eventName: string) => void) & ThisType<Service>;
type ServiceLocalEventHandler = ((node: GenericObject) => void) & ThisType<Service>;
interface ServiceEvent {
name: string;
group?: string;
handler: ServiceEventHandler | ServiceLocalEventHandler;
}
type ServiceEvents = { [key: string]: ServiceEventHandler | ServiceLocalEventHandler };
type ServiceMethods = { [key: string]: ((...args: any[]) => any) } & ThisType<Service>;
type Middleware = (handler: ActionHandler, action: Action) => any;
interface ServiceSchema {
name: string;
version?: string | number;
settings?: ServiceSettingSchema;
dependencies?: string | GenericObject | Array<string> | Array<GenericObject>;
metadata?: GenericObject;
actions?: Actions;
mixins?: Array<ServiceSchema>;
methods?: ServiceMethods;
events?: ServiceEvents;
created?: () => void;
started?: () => Bluebird<void>;
stopped?: () => Bluebird<void>;
[name: string]: any;
}
class Service implements ServiceSchema {
constructor(broker: ServiceBroker, schema?: ServiceSchema);
protected parseServiceSchema(schema: ServiceSchema): void;
name: string;
version?: string | number;
settings: ServiceSettingSchema;
metadata: GenericObject;
dependencies: string | GenericObject | Array<string> | Array<GenericObject>;
schema: ServiceSchema;
broker: ServiceBroker;
logger: LoggerInstance;
actions?: Actions;
mixins?: Array<ServiceSchema>;
methods?: ServiceMethods;
Promise: typeof Bluebird;
waitForServices(serviceNames: string | Array<string>, timeout?: number, interval?: number): Bluebird<void>;
events?: ServiceEvents;
created: () => void;
started: () => Bluebird<void>;
stopped: () => Bluebird<void>;
[name: string]: any;
}
interface BrokerCircuitBreakerOptions {
enabled?: boolean;
maxFailures?: number;
halfOpenTime?: number;
failureOnTimeout?: boolean;
failureOnReject?: boolean;
}
interface BrokerRegistryOptions {
strategy?: Function | string;
strategyOptions?: GenericObject;
preferLocal?: boolean;
}
interface BrokerTransitOptions {
maxQueueSize?: number;
}
interface BrokerOptions {
namespace?: string;
nodeID?: string;
logger?: Logger | boolean;
logLevel?: string;
logFormatter?: Function | string;
transporter?: Transporter | string | GenericObject;
requestTimeout?: number;
requestRetry?: number;
maxCallLevel?: number;
heartbeatInterval?: number;
heartbeatTimeout?: number;
disableBalancer?: boolean;
transit?: BrokerTransitOptions;
registry?: BrokerRegistryOptions;
circuitBreaker?: BrokerCircuitBreakerOptions;
cacher?: Cacher | string | GenericObject;
serializer?: Serializer | string | GenericObject;
validation?: boolean;
validator?: Validator;
metrics?: boolean;
metricsRate?: number;
statistics?: boolean;
internalServices?: boolean;
hotReload?: boolean;
ServiceFactory?: Service;
ContextFactory?: Context;
middlewares?: Array<Middleware>;
created?: (broker: ServiceBroker) => void;
started?: (broker: ServiceBroker) => void;
stopped?: (broker: ServiceBroker) => void;
}
interface NodeHealthStatus {
cpu: {
load1: number;
load5: number;
load15: number;
cores: number;
utilization: number;
};
mem: {
free: number;
total: number;
percent: number;
};
os: {
uptime: number;
type: string;
release: string;
hostname: string;
arch: string;
platform: string;
user: string;
};
process: {
pid: NodeJS.Process["pid"];
memory: NodeJS.MemoryUsage;
uptime: number;
argv: string[];
};
client: {
type: string;
version: string;
langVersion: NodeJS.Process["version"];
};
net: {
ip: string[];
};
transit: {
stat: GenericObject;
} | null,
time: {
now: number;
iso: string;
utc: string;
};
}
type FallbackResponse = string | number | GenericObject;
type FallbackResponseHandler = (ctx: Context, err: Errors.MoleculerError) => Bluebird<any>;
interface CallOptions {
timeout?: number;
retryCount?: number;
fallbackResponse?: FallbackResponse | Array<FallbackResponse> | FallbackResponseHandler;
nodeID?: string;
meta?: GenericObject;
}
type CallDefinition<P extends GenericObject = GenericObject> = {
action: string;
params: P;
};
class ServiceBroker {
constructor(options?: BrokerOptions);
Promise: typeof Bluebird;
namespace: string;
nodeID: string;
logger: LoggerInstance;
cacher?: Cacher;
serializer?: Serializer;
validator?: Validator;
transit: GenericObject;
start(): Bluebird<void>;
stop(): Bluebird<void>;
repl(): void;
getLogger(module: string, service?: string, version?: number | string): LoggerInstance;
fatal(message: string, err?: Error, needExit?: boolean): void;
loadServices(folder?: string, fileMask?: string): number;
loadService(filePath: string): Service;
watchService(service: Service): void;
hotReloadService(service: Service): Service;
createService(schema: ServiceSchema): Service;
destroyService(service: Service): Bluebird<void>;
getLocalService(serviceName: string, version?: string | number): Service;
waitForServices(serviceNames: string | Array<string>, timeout?: number, interval?: number, logger?: LoggerInstance): Bluebird<void>;
use(...mws: Array<Function>): void;
findNextActionEndpoint(actionName: string, opts?: GenericObject): string;
/**
* Call an action (local or global)
*
* @param {any} actionName name of action
* @param {any} params params of action
* @param {any} opts options of call (optional)
* @returns
*
* @memberof ServiceBroker
*/
call<T = any, P extends GenericObject = GenericObject>(actionName: string, params?: P, opts?: CallOptions): Bluebird<T>;
/**
* Multiple action calls.
*
* @param {Array<CallDefinition> | { [name: string]: CallDefinition }} def Calling definitions.
* @returns {Bluebird<Array<GenericObject>|GenericObject>}
* | (broker: ServiceBroker): Service)
* @example
* Call `mcall` with an array:
* ```js
* broker.mcall([
* { action: "posts.find", params: { limit: 5, offset: 0 } },
* { action: "users.find", params: { limit: 5, sort: "username" }, opts: { timeout: 500 } }
* ]).then(results => {
* let posts = results[0];
* let users = results[1];
* })
* ```
*
* @example
* Call `mcall` with an Object:
* ```js
* broker.mcall({
* posts: { action: "posts.find", params: { limit: 5, offset: 0 } },
* users: { action: "users.find", params: { limit: 5, sort: "username" }, opts: { timeout: 500 } }
* }).then(results => {
* let posts = results.posts;
* let users = results.users;
* })
* ```
* @throws MoleculerError - If the `def` is not an `Array` and not an `Object`.
*
* @memberof ServiceBroker
*/
mcall<T = any>(def: Array<CallDefinition> | { [name: string]: CallDefinition }): Bluebird<Array<T> | T>;
/**
* Emit an event (global & local)
*
* @param {any} eventName
* @param {any} payload
* @returns
*
* @memberof ServiceBroker
*/
emit(eventName: string, payload?: any, groups?: string | Array<string>): void;
/**
* Emit an event for all local & remote services
*
* @param {string} eventName
* @param {any} payload
* @param {Array<string>?} groups
* @returns
*
* @memberof ServiceBroker
*/
broadcast(eventName: string, payload?: any, groups?: string | Array<string>): void
/**
* Emit an event for all local services
*
* @param {string} eventName
* @param {any} payload
* @param {Array<string>?} groups
* @returns
*
* @memberof ServiceBroker
*/
broadcastLocal(eventName: string, payload?: any, groups?: string | Array<string>): void;
sendPing(nodeID?: string): Bluebird<void>;
getHealthStatus(): NodeHealthStatus;
getLocalNodeInfo(force?: boolean): {
ipList: string[];
hostname: string;
client: any;
config: any;
port: any;
services: Array<any>;
};
MOLECULER_VERSION: string;
PROTOCOL_VERSION: string;
[name: string]: any;
static MOLECULER_VERSION: string;
static PROTOCOL_VERSION: string;
static defaultOptions: BrokerOptions;
}
class Packet {
constructor(type: string, target: string, payload?: any);
}
namespace Packets {
type PROTOCOL_VERSION = "3";
type PACKET_UNKNOWN = "???";
type PACKET_EVENT = "EVENT";
type PACKET_REQUEST = "REQ";
type PACKET_RESPONSE = "RES";
type PACKET_DISCOVER = "DISCOVER";
type PACKET_INFO = "INFO";
type PACKET_DISCONNECT = "DISCONNECT";
type PACKET_HEARTBEAT = "HEARTBEAT";
type PACKET_PING = "PING";
type PACKET_PONG = "PONG";
type PACKET_GOSSIP_REQ = "GOSSIP_REQ";
type PACKET_GOSSIP_RES = "GOSSIP_RES";
type PACKET_GOSSIP_HELLO = "GOSSIP_HELLO";
const PROTOCOL_VERSION: PROTOCOL_VERSION;
const PACKET_UNKNOWN: PACKET_UNKNOWN;
const PACKET_EVENT: PACKET_EVENT;
const PACKET_REQUEST: PACKET_REQUEST;
const PACKET_RESPONSE: PACKET_RESPONSE;
const PACKET_DISCOVER: PACKET_DISCOVER;
const PACKET_INFO: PACKET_INFO;
const PACKET_DISCONNECT: PACKET_DISCONNECT;
const PACKET_HEARTBEAT: PACKET_HEARTBEAT;
const PACKET_PING: PACKET_PING;
const PACKET_PONG: PACKET_PONG;
const PACKET_GOSSIP_REQ: PACKET_GOSSIP_REQ;
const PACKET_GOSSIP_RES: PACKET_GOSSIP_RES;
const PACKET_GOSSIP_HELLO: PACKET_GOSSIP_HELLO;
interface PacketPayload {
ver: PROTOCOL_VERSION;
sender: string | null;
}
interface Packet {
type: PACKET_UNKNOWN | PACKET_EVENT | PACKET_DISCONNECT | PACKET_DISCOVER |
PACKET_INFO | PACKET_HEARTBEAT | PACKET_REQUEST | PACKET_PING | PACKET_PONG | PACKET_RESPONSE | PACKET_GOSSIP_REQ | PACKET_GOSSIP_RES | PACKET_GOSSIP_HELLO;
target?: string;
payload: PacketPayload
}
}
class Transporter {
constructor(opts?: GenericObject);
init(broker: ServiceBroker, messageHandler: (cmd: string, msg: string) => void): void;
connect(): Bluebird<any>;
disconnect(): Bluebird<any>;
getTopicName(cmd: string, nodeID?: string): string;
makeSubscriptions(topics: Array<GenericObject>): Bluebird<void>;
makeBalancedSubscriptions(): Bluebird<void>;
subscribe(cmd: string, nodeID?: string): Bluebird<void>;
subscribeBalancedRequest(action: string): Bluebird<void>;
subscribeBalancedEvent(event: string, group: string): Bluebird<void>;
unsubscribeFromBalancedCommands(): Bluebird<void>;
incomingMessage(cmd: string, msg: Buffer): Bluebird<void>;
prepublish(packet: Packet): Bluebird<void>;
publish(packet: Packet): Bluebird<void>;
publishBalancedEvent(packet: Packet, group: string): Bluebird<void>;
publishBalancedRequest(packet: Packet): Bluebird<void>;
serialize(packet: Packet): Buffer;
deserialize(type: string, data: Buffer): Packet;
}
class Cacher {
constructor(opts?: GenericObject);
init(broker: ServiceBroker): void;
close(): Bluebird<any>;
get(key: string): Bluebird<null | GenericObject>;
set(key: string, data: any): Bluebird<any>;
del(key: string): Bluebird<any>;
clean(match?: string): Bluebird<any>;
}
class Serializer {
constructor();
init(broker: ServiceBroker): void;
serialize(obj: GenericObject, type: string): string | Buffer;
deserialize(str: Buffer | string, type: string): string;
}
class Validator {
constructor();
init(broker: ServiceBroker): void;
compile(schema: GenericObject): Function;
validate(params: GenericObject, schema: GenericObject): boolean;
}
class LoggerHelper {
static extend(logger: LoggerInstance): LoggerInstance;
static createDefaultLogger(baseLogger: LoggerInstance, bindings: GenericObject, logLevel?: string, logFormatter?: Function): LoggerInstance;
static createDefaultLogger(bindings: GenericObject, logLevel?: string, logFormatter?: Function): LoggerInstance;
}
abstract class BaseStrategy {
init(broker: ServiceBroker): void;
select(list: any[]): any;
}
class RoundRobinStrategy extends BaseStrategy {
}
class RandomStrategy extends BaseStrategy {
}
class CpuUsageStrategy extends BaseStrategy {
}
namespace Transporters {
type MessageHandler = ((cmd: string, msg: any) => Bluebird<void>) & ThisType<Base>;
type AfterConnectHandler = ((wasReconnect?: boolean) => Bluebird<void>) & ThisType<Base>;
class Base {
constructor(opts?: GenericObject);
public init(transit: Transit, messageHandler: MessageHandler, afterConnect: AfterConnectHandler): void;
public init(transit: Transit, messageHandler: MessageHandler): void;
public connect(): Bluebird<any>;
public onConnected(wasReconnect?: boolean): Bluebird<void>;
public disconnect(): Bluebird<void>;
public getTopicName(cmd: string, nodeID?: string): string;
public makeSubscriptions(topics: Array<GenericObject>): Bluebird<void>;
public subscribe(cmd: string, nodeID: string): Bluebird<void>;
public subscribeBalancedRequest(action: string): Bluebird<void>;
public subscribeBalancedEvent(event: string, group: string): Bluebird<void>;
public unsubscribeFromBalancedCommands(): Bluebird<void>;
protected incomingMessage(cmd: string, msg: Buffer): Bluebird<void>;
public publish(packet: Packet): Bluebird<void>;
public publishBalancedEvent(packet: Packet, group: string): Bluebird<void>;
public publishBalancedRequest(packet: Packet): Bluebird<void>;
public prepublish(packet: Packet): Bluebird<void>;
public serialize(packet: Packet): Buffer;
public deserialize(type: string, data: Buffer): Packet;
protected opts: GenericObject;
protected connected: boolean;
protected hasBuiltInBalancer: boolean;
protected transit: Transit;
protected broker: ServiceBroker;
protected nodeID: string;
protected logger: Logger;
protected prefix: string;
protected messageHandler: MessageHandler;
protected afterConnect?: AfterConnectHandler;
}
class Fake extends Base { }
class NATS extends Base { }
class MQTT extends Base { }
class Redis extends Base { }
class AMQP extends Base { }
class Kafka extends Base { }
class STAN extends Base { }
class TCP extends Base { }
}
const Cachers: {
Memory: Cacher,
Redis: Cacher
};
const Serializers: {
JSON: Serializer,
Avro: Serializer,
MsgPack: Serializer,
ProtoBuf: Serializer
};
namespace Errors {
class MoleculerError extends Error {
public code: number;
public type: string;
public data: any;
public retryable: boolean;
constructor(message: string, code: number, type: string, data: any);
constructor(message: string, code: number, type: string);
constructor(message: string, code: number);
constructor(message: string);
}
class MoleculerRetryableError extends MoleculerError { }
class MoleculerServerError extends MoleculerRetryableError { }
class MoleculerClientError extends MoleculerError { }
class ServiceNotFoundError extends MoleculerRetryableError {
constructor(action: string, nodeID: string);
constructor(action: string);
}
class ServiceNotAvailable extends MoleculerRetryableError {
constructor(action: string, nodeID: string);
constructor(action: string);
}
class RequestTimeoutError extends MoleculerRetryableError {
constructor(action: string, nodeID: string);
}
class RequestSkippedError extends MoleculerError {
constructor(action: string, nodeID: string);
}
class RequestRejected extends MoleculerRetryableError {
constructor(action: string, nodeID: string);
}
class QueueIsFull extends MoleculerRetryableError {
constructor(action: string, nodeID: string, size: number, limit: number);
}
class ValidationError extends MoleculerClientError {
constructor(message: string, type: string, data: GenericObject);
constructor(message: string, type: string);
constructor(message: string);
}
class MaxCallLevelError extends MoleculerError {
constructor(nodeID: string, level: number);
}
class ServiceSchemaError extends MoleculerError {
constructor(message: string);
}
class ProtocolVersionMismatchError extends MoleculerError {
constructor(nodeID: string, actual: string, received: string);
}
class InvalidPacketData extends MoleculerError {
constructor(type: string, packet: Packet);
}
}
namespace Strategies {
abstract class BaseStrategy {
init(broker: ServiceBroker): void;
select(list: any[]): any;
}
class RoundRobinStrategy extends BaseStrategy {
}
class RandomStrategy extends BaseStrategy {
}
class CpuUsageStrategy extends BaseStrategy {
}
}
interface TransitRequest {
action: string;
nodeID: string;
ctx: Context;
resolve: (value: any) => void;
reject: (reason: any) => void;
}
interface Transit {
afterConnect(wasReconnect: boolean): Bluebird<void>;
connect(): Bluebird<void>;
disconnect(): Bluebird<void>;
sendDisconnectPacket(): Bluebird<void>;
makeSubscriptions(): Bluebird<Array<void>>;
messageHandler(cmd: string, msg: GenericObject): boolean | Bluebird<void> | undefined;
request(ctx: Context): Bluebird<void>;
sendBroadcastEvent(nodeID: string, eventName: string, data: GenericObject, nodeGroups: GenericObject): void;
sendBalancedEvent(eventName: string, data: GenericObject, nodeGroups: GenericObject): void;
sendEventToGroups(eventName: string, data: GenericObject, groups: Array<string>): void;
sendEventToGroups(eventName: string, data: GenericObject): void;
removePendingRequest(id: string): void;
removePendingRequestByNodeID(nodeID: string): void;
sendResponse(nodeID: string, id: string, data: GenericObject, err: Error): Bluebird<void>;
sendResponse(nodeID: string, id: string, data: GenericObject): Bluebird<void>;
discoverNodes(): Bluebird<void>;
discoverNode(nodeID: string): Bluebird<void>;
sendNodeInfo(nodeID: string): Bluebird<void | Array<void>>;
sendPing(nodeID: string): Bluebird<void>;
sendPong(payload: GenericObject): Bluebird<void>;
processPong(payload: GenericObject): void;
sendHeartbeat(localNode: NodeHealthStatus): Bluebird<void>;
subscribe(topic: string, nodeID: string): Bluebird<void>;
publish(packet: Packet): Bluebird<void>;
pendingRequests: Map<string, TransitRequest>
nodeID: string;
}
const CIRCUIT_CLOSE: string;
const CIRCUIT_HALF_OPEN: string;
const CIRCUIT_OPEN: string;
}
export = Moleculer;