Releases: Adrinalin4ik/Nestjs-Graphql-Tools
Releases · Adrinalin4ik/Nestjs-Graphql-Tools
Version 0.9.0
- Fixed enums for custom filters
- Added simple automated tests
- Fixed errors related to sqlite3
Migration guide
- All custom filters should be decorated with
@InputType()
Version 0.8.3
- Fix vulnurabilities
Version 0.8.2
- Upgrade deps
- Vulns fixes
Version 0.8.1
Federation support
Basic support of federation already in place. Just add to your method with @ResolveReference()
one more decorator @GraphqlLoader()
Example
This examples is the reference to official example https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first. Clone https://github.com/nestjs/nest/tree/master/sample/31-graphql-federation-code-first (download specific directory with https://download-directory.github.io/ or with chrome extention https://chrome.google.com/webstore/detail/gitzip-for-github/ffabmkklhbepgcgfonabamgnfafbdlkn)
- Annotate method resolveReference of
users-application/src/users/users.resolver.ts
// users-application/src/users/users.resolver.ts
@ResolveReference()
@GraphqlLoader()
async resolveReference(
@Loader() loader: LoaderData<User, number>,
) {
const ids = loader.ids;
const users = this.usersService.findByIds(ids);
return loader.helpers.mapManyToOneRelation(users, loader.ids, 'id')
}
- Add method findByIds to
users-application/src/users/users.service.ts
// users-application/src/users/users.service.ts
@Injectable()
export class UsersService {
private users: User[] = [
{ id: 1, name: 'John Doe' },
{ id: 2, name: 'Richard Roe' },
];
findByIds(idsList: number[]): User[] {
return this.users.filter((user) => idsList.some(id => Number(id) === user.id));
}
}
-
Install dependencies of 3 projects : npm ci in gateway, posts-application, users-application.
-
Run all projects in order :
cd users-application && npm run start
cd posts-application && npm run start
cd gateway && npm run start
-
Go to localhost:3001/graphql and send graphql request to gateway
{
posts {
id
title
authorId
user {
id
name
}
}
}
Version 0.8.0
- Updated deps
- @GraphqlFilter and @GraphqlSorting method decorators are no longer required and marked as deprecated. These decorators will be removed soon.
- @filter decorator now has it's own type FilterArgs. It should be used insted of Brackets in all the cases.
- Fixed problem related to global pipes like ValidationPipe. This problem happened because pipe created dummy model based on types provided for the @filter decorator (it was typeorm Brakets). Please use FilterArgs type insted of Brackets to avoid this bug.
Version 0.7.21
- Vulnurabilities fixes
- Upgraded all the dev deps to be the latest
- Npm replaced with yarn
Version 0.7.20
- Bump deps
Version 0.7.(18 - 19)
- Vulnurability fixes
Version 0.7.17
- Added ability to override decorators' values. This might be useful for unit tests.
Version 0.7.16
- Removed the necessity of having the second argument in the FilterField decorator.
- Typeform bumped.