@orion-js/echoes 4.3.2 → 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/LICENSE +21 -0
- package/dist/config.d.ts +3 -0
- package/dist/echo/deserialize.d.ts +1 -0
- package/dist/echo/index.d.ts +9 -0
- 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.d.ts +7 -145
- package/dist/index.js +440 -163
- package/dist/index.js.map +1 -1
- package/dist/publish/index.d.ts +5 -0
- package/dist/publish/serialize.d.ts +1 -0
- package/dist/request/getPassword.d.ts +1 -0
- package/dist/request/getSignature.d.ts +1 -0
- package/dist/request/getURL.d.ts +1 -0
- package/dist/request/index.d.ts +2 -0
- package/dist/request/makeRequest.d.ts +2 -0
- package/dist/requestsHandler/checkSignature.d.ts +1 -0
- package/dist/requestsHandler/getEcho.d.ts +1 -0
- package/dist/requestsHandler/index.d.ts +3 -0
- package/dist/service/index.d.ts +10 -0
- package/dist/startService/KafkaManager.d.ts +29 -0
- package/dist/startService/index.d.ts +3 -0
- package/dist/types.d.ts +198 -0
- package/package.json +24 -16
- package/dist/index.d.cts +0 -145
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Orionjs Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (serializedJavascript: string): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SchemaFieldType } from '@orion-js/schema';
|
|
2
|
+
import { EchoConfig, EchoEventConfig, EchoRequestConfig, EchoType } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use createEchoRequest and createEchoEvent instead
|
|
5
|
+
*/
|
|
6
|
+
declare const echo: <TParamsSchema extends SchemaFieldType, TReturnsSchema extends SchemaFieldType, TEchoType extends 'event' | 'request'>(options: EchoConfig<TParamsSchema, TReturnsSchema, TEchoType>) => EchoType<TParamsSchema, TReturnsSchema, TEchoType>;
|
|
7
|
+
export declare function createEchoRequest<TParamsSchema extends SchemaFieldType, TReturnsSchema extends SchemaFieldType>(options: EchoRequestConfig<TParamsSchema, TReturnsSchema>): EchoType<TParamsSchema, TReturnsSchema, 'request'>;
|
|
8
|
+
export declare function createEchoEvent<TParamsSchema extends SchemaFieldType, TReturnsSchema extends SchemaFieldType>(options: EchoEventConfig<TParamsSchema, TReturnsSchema>): EchoType<TParamsSchema, TReturnsSchema, 'event'>;
|
|
9
|
+
export { echo };
|
|
@@ -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;
|