mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
chore: add public api annotation on microservices
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class BaseRpcContext<T = unknown[]> {
|
||||
constructor(protected readonly args: T) {}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ type KafkaContextArgs = [
|
||||
producer: Producer,
|
||||
];
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class KafkaContext extends BaseRpcContext<KafkaContextArgs> {
|
||||
constructor(args: KafkaContextArgs) {
|
||||
super(args);
|
||||
|
||||
@@ -2,6 +2,9 @@ import { BaseRpcContext } from './base-rpc.context';
|
||||
|
||||
type MqttContextArgs = [string, Record<string, any>];
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class MqttContext extends BaseRpcContext<MqttContextArgs> {
|
||||
constructor(args: MqttContextArgs) {
|
||||
super(args);
|
||||
|
||||
@@ -2,6 +2,9 @@ import { BaseRpcContext } from './base-rpc.context';
|
||||
|
||||
type NatsContextArgs = [string, any];
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class NatsContext extends BaseRpcContext<NatsContextArgs> {
|
||||
constructor(args: NatsContextArgs) {
|
||||
super(args);
|
||||
|
||||
@@ -2,6 +2,9 @@ import { BaseRpcContext } from './base-rpc.context';
|
||||
|
||||
type RedisContextArgs = [string];
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class RedisContext extends BaseRpcContext<RedisContextArgs> {
|
||||
constructor(args: RedisContextArgs) {
|
||||
super(args);
|
||||
|
||||
@@ -2,6 +2,9 @@ import { BaseRpcContext } from './base-rpc.context';
|
||||
|
||||
type RmqContextArgs = [Record<string, any>, any, string];
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class RmqContext extends BaseRpcContext<RmqContextArgs> {
|
||||
constructor(args: RmqContextArgs) {
|
||||
super(args);
|
||||
|
||||
@@ -3,6 +3,9 @@ import { BaseRpcContext } from './base-rpc.context';
|
||||
|
||||
type TcpContextArgs = [TcpSocket, string];
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class TcpContext extends BaseRpcContext<TcpContextArgs> {
|
||||
constructor(args: TcpContextArgs) {
|
||||
super(args);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface MqttRecordOptions {
|
||||
/**
|
||||
* The QoS
|
||||
@@ -26,6 +29,9 @@ export interface MqttRecordOptions {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class MqttRecord<TData = any> {
|
||||
constructor(
|
||||
public readonly data: TData,
|
||||
@@ -33,6 +39,9 @@ export class MqttRecord<TData = any> {
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class MqttRecordBuilder<TData> {
|
||||
private options?: MqttRecordOptions;
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class NatsRecord<TData = any, THeaders = any> {
|
||||
constructor(
|
||||
public readonly data: TData,
|
||||
@@ -5,6 +8,9 @@ export class NatsRecord<TData = any, THeaders = any> {
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class NatsRecordBuilder<TData> {
|
||||
private headers?: any;
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface RmqRecordOptions {
|
||||
expiration?: string | number;
|
||||
userId?: string;
|
||||
@@ -16,6 +19,9 @@ export interface RmqRecordOptions {
|
||||
appId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class RmqRecord<TData = any> {
|
||||
constructor(
|
||||
public readonly data: TData,
|
||||
@@ -23,6 +29,9 @@ export class RmqRecord<TData = any> {
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class RmqRecordBuilder<TData> {
|
||||
private options?: RmqRecordOptions;
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ interface GrpcCall<TRequest = any, TMetadata = any> {
|
||||
emit: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerGrpc extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.GRPC;
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ import { Server } from './server';
|
||||
|
||||
let kafkaPackage: any = {};
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerKafka extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.KAFKA;
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ import { Server } from './server';
|
||||
|
||||
let mqttPackage: any = {};
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerMqtt extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.MQTT;
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@ import { Server } from './server';
|
||||
|
||||
let natsPackage = {} as any;
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerNats extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.NATS;
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@ type Redis = any;
|
||||
|
||||
let redisPackage = {} as any;
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerRedis extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.REDIS;
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ let rmqPackage: any = {};
|
||||
|
||||
const INFINITE_CONNECTION_ATTEMPTS = -1;
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerRMQ extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.RMQ;
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ import {
|
||||
import { TcpOptions } from '../interfaces/microservice-configuration.interface';
|
||||
import { Server } from './server';
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class ServerTCP extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.TCP;
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ import { ConsumerSerializer } from '../interfaces/serializer.interface';
|
||||
import { IdentitySerializer } from '../serializers/identity.serializer';
|
||||
import { transformPatternToRoute } from '../utils';
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export abstract class Server {
|
||||
protected readonly messageHandlers = new Map<string, MessageHandler>();
|
||||
protected readonly logger: LoggerService = new Logger(Server.name);
|
||||
|
||||
Reference in New Issue
Block a user