Skip to content

Commit

Permalink
Merge pull request #9604 from micalevisk/drop-deprecated-functions
Browse files Browse the repository at this point in the history
refactor(common,core,microservices)!: drop all deprecated methods
  • Loading branch information
kamilmysliwiec authored May 18, 2022
2 parents 34d09c0 + 6d3cab8 commit a4294e4
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 55 deletions.
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

0 comments on commit a4294e4

Please sign in to comment.