Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(common,core,microservices): drop all deprecated methods #9604

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration/websockets/e2e/ws-gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('WebSocketGateway (WsAdapter)', () => {

it(`should handle message on a different path`, async () => {
app = await createNestApp(WsPathGateway);
await app.listenAsync(3000);
await app.listen(3000);
try {
ws = new WebSocket('ws://localhost:3000/ws-path');
await new Promise((resolve, reject) => {
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('WebSocketGateway (WsAdapter)', () => {
this.retries(10);

app = await createNestApp(ExamplePathGateway, WsPathGateway2);
await app.listenAsync(3000);
await app.listen(3000);

// open websockets delay
await new Promise(resolve => setTimeout(resolve, 1000));
Expand Down
18 changes: 0 additions & 18 deletions packages/common/interfaces/nest-application.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ export interface INestApplication extends INestApplicationContext {
callback?: () => void,
): Promise<any>;

/**
* Starts the application (can be awaited).
* @deprecated use "listen" instead.
*
* @param {number|string} port
* @param {string} [hostname]
* @returns {Promise}
*/
listenAsync(port: number | string, hostname?: string): Promise<any>;

/**
* Returns the url the application is listening at, based on OS and IP version. Returns as an IP value either in IPv6 or IPv4
*
Expand Down Expand Up @@ -138,14 +128,6 @@ export interface INestApplication extends INestApplicationContext {
*/
startAllMicroservices(): Promise<this>;

/**
* Starts all connected microservices and can be awaited.
* @deprecated use "startAllMicroservices" instead.
*
* @returns {Promise}
*/
startAllMicroservicesAsync(): Promise<this>;

/**
* Registers exception filters as global filters (will be used within
* every HTTP route handler)
Expand Down
8 changes: 0 additions & 8 deletions packages/common/interfaces/nest-microservice.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ export interface INestMicroservice extends INestApplicationContext {
*/
listen(): Promise<any>;

/**
* Starts the microservice (can be awaited).
* @deprecated use "listen" instead.
*
* @returns {Promise}
*/
listenAsync(): Promise<any>;

/**
* Register Ws Adapter which will be used inside Gateways.
* Use when you want to override default `socket.io` library.
Expand Down
6 changes: 0 additions & 6 deletions packages/common/utils/shared.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ export const addLeadingSlash = (path?: string): string =>
: path
: '';

/**
* Deprecated. Use the "addLeadingSlash" function instead.
* @deprecated
*/
export const validatePath = addLeadingSlash;

export const normalizePath = (path?: string): string =>
path
? path.startsWith('/')
Expand Down
14 changes: 0 additions & 14 deletions packages/core/nest-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,6 @@ export class NestApplication
return this;
}

public startAllMicroservicesAsync(): Promise<this> {
this.logger.warn(
'DEPRECATED! "startAllMicroservicesAsync" method is deprecated and will be removed in the next major release. Please, use "startAllMicroservices" instead.',
);
return this.startAllMicroservices();
}

public use(...args: [any, any?]): this {
this.httpAdapter.use(...args);
return this;
Expand Down Expand Up @@ -301,13 +294,6 @@ export class NestApplication
});
}

public listenAsync(port: number | string, ...args: any[]): Promise<any> {
this.logger.warn(
'DEPRECATED! "listenAsync" method is deprecated and will be removed in the next major release. Please, use "listen" instead.',
);
return this.listen(port, ...(args as [any]));
}

public async getUrl(): Promise<string> {
return new Promise((resolve, reject) => {
if (!this.isListening) {
Expand Down
7 changes: 0 additions & 7 deletions packages/microservices/nest-microservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,6 @@ export class NestMicroservice
});
}

public async listenAsync(): Promise<any> {
this.logger.warn(
'DEPRECATED! "listenAsync" method is deprecated and will be removed in the next major release. Please, use "listen" instead.',
);
return this.listen();
}

public async close(): Promise<any> {
await this.server.close();
if (this.isTerminated) {
Expand Down