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

Bump all packages to support Nest 8 #342

Merged
merged 33 commits into from
Jan 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6e43b92
feat: bump to Nest 8 major [breaking change]
jeremylvln Dec 8, 2021
f7eb258
style: bump lint packages and fix issues
jeremylvln Dec 8, 2021
18338ae
fix(hasura): decorator declarations
jeremylvln Dec 8, 2021
0cd83cd
test(rabbitmq): fix assertion syntax
jeremylvln Dec 8, 2021
b55f4b7
test(rabbitmq): force exit tests
jeremylvln Dec 8, 2021
5efedaf
fix(#348): assertQueueErrorHandler initial impl
Dec 22, 2021
417f887
fix(#348): pr minor comments
Jan 12, 2022
c6069a8
feat(rabbitmq): add support for multiple channels
danocmx Jan 8, 2022
e9ed06a
fix(rabbitmq): wait for channel to setup before returning from init
danocmx Jan 9, 2022
afe4f84
refactor(rabbitmq): remove unused selectChannel function
danocmx Jan 9, 2022
8a07ef1
test(rabbitmq): add rmq integration test for multiple channels
danocmx Jan 9, 2022
463c91a
feat: tweaks
underfisk Jan 11, 2022
34325b2
docs(rabbitmq): add docs for channel options
danocmx Jan 12, 2022
6326e7f
Merge branch 'master' into feat/nest-8
underfisk Jan 12, 2022
a83bbd4
fix: yarn fixes and small tweaks
underfisk Jan 12, 2022
14bd5bd
chore: cleanup on some unused ci
underfisk Jan 12, 2022
4092c22
feat: rmq context and silent logger
underfisk Jan 12, 2022
319ce18
feat: amqlib types refactoring
underfisk Jan 20, 2022
d7b06f7
Merge branch 'master' into feat/nest-8
underfisk Jan 20, 2022
5f46389
feat: merge cleanup
underfisk Jan 20, 2022
8740036
ci: removed labeller
underfisk Jan 20, 2022
4673039
fix: multiple nestjs packages installed
underfisk Jan 20, 2022
f463ade
fix: enable esModuleInterop
underfisk Jan 20, 2022
f1f74f0
fix: test dependency
underfisk Jan 20, 2022
cb37b6a
fix: removed integration build
underfisk Jan 20, 2022
ebf0f9b
fix: incorrect package name to ignore
underfisk Jan 20, 2022
a620623
chore: nestjs v8.2.6
underfisk Jan 20, 2022
3b18359
Removed azure badge
underfisk Jan 20, 2022
17ba00e
Merge branch 'master' into feat/nest-8
underfisk Jan 21, 2022
ed89c0e
chore: removed azure CI badge
underfisk Jan 20, 2022
6c224b3
Merge branch 'master' into feat/nest-8
WonderPanda Jan 21, 2022
969490a
revert: version bump to packages
jeremylvln Jan 21, 2022
441985d
Merge remote-tracking branch 'origin/master' into feat/nest-8
WonderPanda Jan 23, 2022
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
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'prettier',
'plugin:sonarjs/recommended',
// 'plugin:prettier/recommended'
],
Expand Down
29 changes: 0 additions & 29 deletions .github/labeler.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/labeler.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ npm-debug.log
packages/*/lib
.idea
coverage/
junit.xml
tsconfig.build.tsbuildinfo
tsconfig.build.tsbuildinfo
yarn-error.log
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ A collection of Badass modules and utilities to help you level up your NestJS ap
<p align="center">
</p>


| Package | Description | Version | Changelog |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [`@golevelup/nestjs-common`](./packages/common) | Common types, mixins | [![version](https://img.shields.io/npm/v/@golevelup/nestjs-common.svg)](https://www.npmjs.com/package/@golevelup/nestjs-common) | [changelog](./packages/common/CHANGELOG.md) |
Expand Down
64 changes: 0 additions & 64 deletions azure-pipelines.managed.yml

This file was deleted.

59 changes: 0 additions & 59 deletions azure-pipelines.yml

This file was deleted.

8 changes: 5 additions & 3 deletions integration/rabbitmq/e2e/configuration.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { RabbitMQConfig, RabbitMQModule } from '@golevelup/nestjs-rabbitmq';
import { Test, TestingModule } from '@nestjs/testing';
import * as amqplib from 'amqplib';

const rabbitHost = process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort = process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const rabbitHost =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const uri = `amqp://rabbitmq:rabbitmq@${rabbitHost}:${rabbitPort}`;
const amqplibUri = `${uri}?heartbeat=5`;

Expand All @@ -22,7 +24,7 @@ describe('Module Configuration', () => {

afterEach(async () => {
jest.clearAllMocks();
await app.close();
await app?.close();
});

describe('forRoot', () => {
Expand Down
19 changes: 9 additions & 10 deletions integration/rabbitmq/e2e/execution-context.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SubscribeService {
queue,
})
handleSubscribe(message: object) {
// tslint:disable-next-line:no-console
console.log(`RECEIVED MESSAGE: ${message}`);
}
}
Expand All @@ -42,8 +43,10 @@ describe('Rabbit Subscribe Without Register Handlers', () => {
let app: INestApplication;
let amqpConnection: AmqpConnection;

const rabbitHost = process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort = process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const rabbitHost =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const uri = `amqp://rabbitmq:rabbitmq@${rabbitHost}:${rabbitPort}`;

beforeAll(async () => {
Expand All @@ -70,16 +73,12 @@ describe('Rabbit Subscribe Without Register Handlers', () => {
});

afterAll(async () => {
await app.close();
await app?.close();
});

it('should recognize a rabbit handler execution context and allow for interceptors to be skipped', async (done) => {
it('should recognize a rabbit handler execution context and allow for interceptors to be skipped', async () => {
await amqpConnection.publish(exchange, 'x', `test-message`);
expect.assertions(1);

setTimeout(() => {
expect(interceptorHandler).not.toHaveBeenCalled();
done();
}, 100);
await new Promise((resolve) => setTimeout(resolve, 100));
expect(interceptorHandler).not.toHaveBeenCalled();
});
});
10 changes: 6 additions & 4 deletions integration/rabbitmq/e2e/nack-and-requeue.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { INestApplication, Injectable } from '@nestjs/common';
import { Test } from '@nestjs/testing';

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

const exchange = 'testSubscribeExhange';
const nackRoutingKey = 'nackRoutingKey';
Expand Down Expand Up @@ -50,8 +50,10 @@ describe('Nack and Requeue', () => {
let app: INestApplication;
let amqpConnection: AmqpConnection;

const rabbitHost = process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort = process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const rabbitHost =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const uri = `amqp://rabbitmq:rabbitmq@${rabbitHost}:${rabbitPort}`;

beforeAll(async () => {
Expand Down Expand Up @@ -83,7 +85,7 @@ describe('Nack and Requeue', () => {
});

afterAll(async () => {
await app.close();
await app?.close();
});

it('should nack the message when handler returns a Nack object', async () => {
Expand Down
86 changes: 86 additions & 0 deletions integration/rabbitmq/e2e/rmq-context.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import {
AmqpConnection,
RabbitMQModule,
RabbitSubscribe,
} from '@golevelup/nestjs-rabbitmq';
import { CallHandler, ExecutionContext, NestInterceptor } from '@nestjs/common';
import { INestApplication, Injectable } from '@nestjs/common';
import { Test } from '@nestjs/testing';

const validRmqTypeHandler = jest.fn();

const exchange = 'contextExchange';
const queue = 'contextQueue';

@Injectable()
class TestInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler<any>) {
if ((context.getType() as string) !== 'rmq') {
return next.handle();
}

validRmqTypeHandler('invoked');
return next.handle();
}
}

@Injectable()
class SubscribeService {
@RabbitSubscribe({
exchange,
routingKey: '#',
queue,
})
handleSubscribe(message: object) {
// tslint:disable-next-line:no-console
console.log(`RECEIVED MESSAGE: ${message}`);
}
}

describe('RMQ Context in Global interceptor', () => {
let app: INestApplication;
let amqpConnection: AmqpConnection;

const rabbitHost =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_HOST : 'localhost';
const rabbitPort =
process.env.NODE_ENV === 'ci' ? process.env.RABBITMQ_PORT : '5672';
const uri = `amqp://rabbitmq:rabbitmq@${rabbitHost}:${rabbitPort}`;

beforeAll(async () => {
const moduleFixture = await Test.createTestingModule({
providers: [SubscribeService, TestInterceptor],
imports: [
RabbitMQModule.forRoot(RabbitMQModule, {
exchanges: [
{
name: exchange,
type: 'topic',
},
],
uri,
connectionInitOptions: { wait: true, reject: true, timeout: 3000 },
}),
],
}).compile();

app = moduleFixture.createNestApplication();
amqpConnection = app.get<AmqpConnection>(AmqpConnection);
app.useGlobalInterceptors(new TestInterceptor());
await app.init();
});

afterAll(async () => {
await app.close();
});

it('should recognize as rmq context type and not the default (HTTP)', (done) => {
amqpConnection.publish(exchange, 'x', `test-message`);
expect.assertions(1);

setTimeout(() => {
expect(validRmqTypeHandler).toHaveBeenCalled();
done();
}, 100);
});
});
Loading