Skip to content

Commit

Permalink
Merge pull request #11034 from Tony133/chore/mark-facing-apis-public-…
Browse files Browse the repository at this point in the history
…testing

chore(testing, websockets): mark facing apis public
  • Loading branch information
kamilmysliwiec committed Feb 6, 2023
2 parents 6b39aaa + 216ce4c commit 97e9c18
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface OverrideByFactoryOptions {
factory: (...args: any[]) => any;
inject?: any[];
Expand Down
3 changes: 3 additions & 0 deletions packages/testing/interfaces/override-by.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { TestingModuleBuilder } from '../testing-module.builder';
import { OverrideByFactoryOptions } from './override-by-factory-options.interface';

/**
* @publicApi
*/
export interface OverrideBy {
useValue: (value: any) => TestingModuleBuilder;
useFactory: (options: OverrideByFactoryOptions) => TestingModuleBuilder;
Expand Down
3 changes: 3 additions & 0 deletions packages/testing/services/testing-logger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { ConsoleLogger } from '@nestjs/common';

/**
* @publicApi
*/
export class TestingLogger extends ConsoleLogger {
constructor() {
super('Testing');
Expand Down
3 changes: 3 additions & 0 deletions packages/testing/testing-injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
import { Module } from '@nestjs/core/injector/module';
import { MockFactory } from './interfaces';

/**
* @publicApi
*/
export class TestingInjector extends Injector {
protected mocker?: MockFactory;
protected container: NestContainer;
Expand Down
3 changes: 3 additions & 0 deletions packages/testing/testing-module.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { TestingInjector } from './testing-injector';
import { TestingInstanceLoader } from './testing-instance-loader';
import { TestingModule } from './testing-module';

/**
* @publicApi
*/
export class TestingModuleBuilder {
private readonly applicationConfig = new ApplicationConfig();
private readonly container = new NestContainer(this.applicationConfig);
Expand Down
3 changes: 3 additions & 0 deletions packages/testing/testing-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { NestContainer } from '@nestjs/core/injector/container';
import { Module } from '@nestjs/core/injector/module';
import { GraphInspector } from '@nestjs/core/inspector/graph-inspector';

/**
* @publicApi
*/
export class TestingModule extends NestApplicationContext {
protected readonly graphInspector: GraphInspector;

Expand Down
3 changes: 3 additions & 0 deletions packages/websockets/context/exception-filters-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { BaseExceptionFilterContext } from '@nestjs/core/exceptions/base-excepti
import { NestContainer } from '@nestjs/core/injector/container';
import { WsExceptionsHandler } from '../exceptions/ws-exceptions-handler';

/**
* @publicApi
*/
export class ExceptionFiltersContext extends BaseExceptionFilterContext {
constructor(container: NestContainer) {
super(container);
Expand Down
3 changes: 3 additions & 0 deletions packages/websockets/decorators/connected-socket.decorator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { WsParamtype } from '../enums/ws-paramtype.enum';
import { createWsParamDecorator } from '../utils/param.utils';

/**
* @publicApi
*/
export const ConnectedSocket: () => ParameterDecorator = createWsParamDecorator(
WsParamtype.SOCKET,
);
2 changes: 2 additions & 0 deletions packages/websockets/decorators/gateway-server.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { GATEWAY_SERVER_METADATA } from '../constants';

/**
* Attaches native Web Socket Server to a given property.
*
* @publicApi
*/
export const WebSocketServer = (): PropertyDecorator => {
return (target: object, propertyKey: string | symbol) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/websockets/decorators/socket-gateway.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { GatewayMetadata } from '../interfaces';
/**
* Decorator that marks a class as a Nest gateway that enables real-time, bidirectional
* and event-based communication between the browser and the server.
*
* @publicApi
*/
export function WebSocketGateway(port?: number): ClassDecorator;
export function WebSocketGateway<
Expand Down
2 changes: 2 additions & 0 deletions packages/websockets/decorators/subscribe-message.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { MESSAGE_MAPPING_METADATA, MESSAGE_METADATA } from '../constants';

/**
* Subscribes to messages that fulfils chosen pattern.
*
* @publicApi
*/
export const SubscribeMessage = <T = string>(message: T): MethodDecorator => {
return (
Expand Down
3 changes: 3 additions & 0 deletions packages/websockets/exceptions/base-ws-exception-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { isObject } from '@nestjs/common/utils/shared.utils';
import { MESSAGES } from '@nestjs/core/constants';
import { WsException } from '../errors/ws-exception';

/**
* @publicApi
*/
export class BaseWsExceptionFilter<TError = any>
implements WsExceptionFilter<TError>
{
Expand Down
3 changes: 3 additions & 0 deletions packages/websockets/exceptions/ws-exceptions-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { InvalidExceptionFilterException } from '@nestjs/core/errors/exceptions/
import { WsException } from '../errors/ws-exception';
import { BaseWsExceptionFilter } from './base-ws-exception-filter';

/**
* @publicApi
*/
export class WsExceptionsHandler extends BaseWsExceptionFilter {
private filters: ExceptionFilterMetadata[] = [];

Expand Down
2 changes: 2 additions & 0 deletions packages/websockets/interfaces/gateway-metadata.interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/**
* @external https://github.com/socketio/socket.io/blob/master/lib/index.ts
*
* @publicApi
*/

import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface OnGatewayConnection<T = any> {
handleConnection(client: T, ...args: any[]): any;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface OnGatewayDisconnect<T = any> {
handleDisconnect(client: T): any;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface OnGatewayInit<T = any> {
afterInit(server: T): any;
}
3 changes: 3 additions & 0 deletions packages/websockets/interfaces/nest-gateway.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface NestGateway {
afterInit?: (server: any) => void;
handleConnection?: (...args: any[]) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ReplaySubject, Subject } from 'rxjs';

/**
* @publicApi
*/
export interface ServerAndEventStreamsHost<T = any> {
server: T;
init: ReplaySubject<T>;
Expand Down
3 changes: 3 additions & 0 deletions packages/websockets/interfaces/web-socket-server.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface WebSocketServerOptions {
port: number;
namespace: string;
Expand Down
3 changes: 3 additions & 0 deletions packages/websockets/interfaces/ws-response.interface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export interface WsResponse<T = any> {
event: string;
data: T;
Expand Down

0 comments on commit 97e9c18

Please sign in to comment.