@orion-js/echoes 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/echo/index.d.ts +1 -1
- package/dist/events/EventBus.d.ts +22 -0
- package/dist/events/EventTransport.d.ts +17 -0
- package/dist/events/PulseManager.d.ts +14 -0
- package/dist/events/createEventBus.d.ts +10 -0
- package/dist/index.cjs +443 -166
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +440 -163
- package/dist/index.js.map +1 -1
- package/dist/publish/index.d.ts +1 -1
- package/dist/startService/KafkaManager.d.ts +25 -19
- package/dist/types.d.ts +85 -1
- package/package.json +11 -2
package/dist/echo/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EchoType, EchoConfig, EchoRequestConfig, EchoEventConfig } from '../types';
|
|
2
1
|
import { SchemaFieldType } from '@orion-js/schema';
|
|
2
|
+
import { EchoConfig, EchoEventConfig, EchoRequestConfig, EchoType } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @deprecated Use createEchoRequest and createEchoEvent instead
|
|
5
5
|
*/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EchoesEventTransportName, EchoesMap, PublishOptions } from '../types';
|
|
2
|
+
import type { EventTransport } from './EventTransport';
|
|
3
|
+
export interface EventBusOptions {
|
|
4
|
+
echoes: EchoesMap;
|
|
5
|
+
transports: Partial<Record<EchoesEventTransportName, EventTransport>>;
|
|
6
|
+
consumeFrom: EchoesEventTransportName[];
|
|
7
|
+
publishTo?: EchoesEventTransportName;
|
|
8
|
+
}
|
|
9
|
+
export default class EventBus {
|
|
10
|
+
private readonly echoes;
|
|
11
|
+
private readonly transports;
|
|
12
|
+
private readonly consumeFrom;
|
|
13
|
+
private readonly publishTo?;
|
|
14
|
+
private readonly startedTransports;
|
|
15
|
+
private started;
|
|
16
|
+
private closed;
|
|
17
|
+
constructor(options: EventBusOptions);
|
|
18
|
+
start(): Promise<void>;
|
|
19
|
+
publish<TParams = any>(options: PublishOptions<TParams>): Promise<any>;
|
|
20
|
+
close(): Promise<void>;
|
|
21
|
+
private handleEvent;
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EchoesEventTransportName, EchoesReceivedEvent, PublishOptions } from '../types';
|
|
2
|
+
export interface EventSubscriptionDefinition {
|
|
3
|
+
topic: string;
|
|
4
|
+
attemptsBeforeDeadLetter?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface EventTransportStartOptions {
|
|
7
|
+
consume: boolean;
|
|
8
|
+
publish: boolean;
|
|
9
|
+
subscriptions: EventSubscriptionDefinition[];
|
|
10
|
+
onEvent(event: EchoesReceivedEvent): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface EventTransport {
|
|
13
|
+
readonly name: EchoesEventTransportName;
|
|
14
|
+
start(options: EventTransportStartOptions): Promise<void>;
|
|
15
|
+
publish<TParams = any>(options: PublishOptions<TParams>): Promise<any>;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EchoesEventPayload, EchoesPulseEventsConfig, PublishOptions } from '../types';
|
|
2
|
+
import type { EventTransport, EventTransportStartOptions } from './EventTransport';
|
|
3
|
+
export default class PulseManager implements EventTransport {
|
|
4
|
+
readonly name: 'pulse';
|
|
5
|
+
private readonly options;
|
|
6
|
+
private pulse?;
|
|
7
|
+
private subscriptions;
|
|
8
|
+
constructor(options: EchoesPulseEventsConfig);
|
|
9
|
+
start(options: EventTransportStartOptions): Promise<void>;
|
|
10
|
+
publish<TParams = any>(options: PublishOptions<TParams>): Promise<import("@orion-js/pulse").PulsePublishedEvent<string, EchoesEventPayload<any>>>;
|
|
11
|
+
close(): Promise<void>;
|
|
12
|
+
private getSubscribeOptions;
|
|
13
|
+
private createReceivedEvent;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EchoesEventTransportName, EchoesKafkaEventsConfig, EchoesOptions, EchoesPulseEventsConfig } from '../types';
|
|
2
|
+
import EventBus from './EventBus';
|
|
3
|
+
export interface ResolvedEventsConfig {
|
|
4
|
+
kafka?: EchoesKafkaEventsConfig;
|
|
5
|
+
pulse?: EchoesPulseEventsConfig;
|
|
6
|
+
consumeFrom: EchoesEventTransportName[];
|
|
7
|
+
publishTo?: EchoesEventTransportName;
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveEventsConfig(options: EchoesOptions): ResolvedEventsConfig | undefined;
|
|
10
|
+
export default function createEventBus(options: EchoesOptions): EventBus;
|