Skip to content

Commit

Permalink
Merge pull request #13537 from Tony133/chore/add-public-api-annotatio…
Browse files Browse the repository at this point in the history
…n-on-microservices

chore: add public api annotation on microservices
  • Loading branch information
kamilmysliwiec committed May 8, 2024
2 parents 1368881 + 151806b commit c750ec1
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/base-rpc.context.ts
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export class BaseRpcContext<T = unknown[]> {
constructor(protected readonly args: T) {}

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/kafka.context.ts
Expand Up @@ -10,6 +10,9 @@ type KafkaContextArgs = [
producer: Producer,
];

/**
* @publicApi
*/
export class KafkaContext extends BaseRpcContext<KafkaContextArgs> {
constructor(args: KafkaContextArgs) {
super(args);
Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/mqtt.context.ts
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/nats.context.ts
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/redis.context.ts
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/rmq.context.ts
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/ctx-host/tcp.context.ts
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions packages/microservices/record-builders/mqtt.record-builder.ts
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface MqttRecordOptions {
/**
* The QoS
Expand Down Expand Up @@ -26,13 +29,19 @@ export interface MqttRecordOptions {
};
}

/**
* @publicApi
*/
export class MqttRecord<TData = any> {
constructor(
public readonly data: TData,
public options?: MqttRecordOptions,
) {}
}

/**
* @publicApi
*/
export class MqttRecordBuilder<TData> {
private options?: MqttRecordOptions;

Expand Down
6 changes: 6 additions & 0 deletions packages/microservices/record-builders/nats.record-builder.ts
@@ -1,10 +1,16 @@
/**
* @publicApi
*/
export class NatsRecord<TData = any, THeaders = any> {
constructor(
public readonly data: TData,
public readonly headers?: THeaders,
) {}
}

/**
* @publicApi
*/
export class NatsRecordBuilder<TData> {
private headers?: any;

Expand Down
9 changes: 9 additions & 0 deletions packages/microservices/record-builders/rmq.record-builder.ts
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface RmqRecordOptions {
expiration?: string | number;
userId?: string;
Expand All @@ -16,13 +19,19 @@ export interface RmqRecordOptions {
appId?: string;
}

/**
* @publicApi
*/
export class RmqRecord<TData = any> {
constructor(
public readonly data: TData,
public options?: RmqRecordOptions,
) {}
}

/**
* @publicApi
*/
export class RmqRecordBuilder<TData> {
private options?: RmqRecordOptions;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-grpc.ts
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-kafka.ts
Expand Up @@ -36,6 +36,9 @@ import { Server } from './server';

let kafkaPackage: any = {};

/**
* @publicApi
*/
export class ServerKafka extends Server implements CustomTransportStrategy {
public readonly transportId = Transport.KAFKA;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-mqtt.ts
Expand Up @@ -26,6 +26,9 @@ import { Server } from './server';

let mqttPackage: any = {};

/**
* @publicApi
*/
export class ServerMqtt extends Server implements CustomTransportStrategy {
public readonly transportId = Transport.MQTT;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-nats.ts
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-redis.ts
Expand Up @@ -19,6 +19,9 @@ type Redis = any;

let redisPackage = {} as any;

/**
* @publicApi
*/
export class ServerRedis extends Server implements CustomTransportStrategy {
public readonly transportId = Transport.REDIS;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-rmq.ts
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server-tcp.ts
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions packages/microservices/server/server.ts
Expand Up @@ -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);
Expand Down

0 comments on commit c750ec1

Please sign in to comment.