Skip to content

Commit 5c6e0c0

Browse files
Merge remote-tracking branch 'upstream/master' into feature/graphql-plugin
2 parents 8c27c3d + c370f4b commit 5c6e0c0

File tree

87 files changed

+4651
-3701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+4651
-3701
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx commitlint -c --config .commitlintrc.json -E --edit $1

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

CHANGELOG.md

Lines changed: 0 additions & 345 deletions
This file was deleted.

lerna.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "10.0.2",
5+
"version": "10.0.16",
66
"npmClient": "yarn",
77
"useWorkspaces": true,
88
"changelog": {
9-
"ignoreCommitters": [
10-
"allcontributors"
11-
],
129
"labels": {
13-
"enhancement": ":rocket: New Feature",
14-
"core": ":earth_asia: Core",
15-
"bug": ":bug: Bug Fix"
10+
"feature": "Features",
11+
"bug": "Bug fixes",
12+
"enhancement": "Enhancements",
13+
"dependencies": "Dependencies"
1614
}
1715
}
1816
}

package.json

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,52 @@
1919
"prepublish:next": "yarn build",
2020
"publish:next": "lerna publish --dist-tag next",
2121
"test:e2e": "lerna run test:e2e --parallel",
22-
"test:e2e:dev": "lerna run test:e2e:dev --parallel"
22+
"test:e2e:dev": "lerna run test:e2e:dev --parallel",
23+
"prepare": "husky install"
2324
},
2425
"resolutions": {
2526
"graphql": "15.8.0"
2627
},
2728
"devDependencies": {
28-
"@commitlint/cli": "16.1.0",
29-
"@commitlint/config-angular": "16.0.0",
29+
"@commitlint/cli": "17.0.3",
30+
"@commitlint/config-angular": "17.0.3",
3031
"@types/graphql": "14.5.0",
31-
"@types/jest": "27.4.0",
32+
"@types/jest": "28.1.4",
3233
"@types/node": "17.0.0",
3334
"@types/node-fetch": "3.0.3",
3435
"@types/normalize-path": "3.0.0",
35-
"@types/ws": "8.2.2",
36-
"@typescript-eslint/eslint-plugin": "5.11.0",
37-
"@typescript-eslint/parser": "5.11.0",
36+
"@types/ws": "8.5.3",
37+
"@typescript-eslint/eslint-plugin": "5.30.4",
38+
"@typescript-eslint/parser": "5.30.4",
3839
"class-transformer": "0.5.1",
3940
"class-validator": "0.13.2",
40-
"eslint": "8.8.0",
41-
"eslint-config-prettier": "8.3.0",
42-
"eslint-plugin-import": "2.25.4",
43-
"eslint-plugin-prettier": "4.0.0",
41+
"eslint": "8.19.0",
42+
"eslint-config-prettier": "8.5.0",
43+
"eslint-plugin-import": "2.26.0",
44+
"eslint-plugin-prettier": "4.2.1",
4445
"graphql": "15.8.0",
4546
"graphql-subscriptions": "2.0.0",
46-
"husky": "7.0.4",
47-
"jest": "27.5.1",
48-
"lerna": "4.0.0",
47+
"husky": "8.0.1",
48+
"jest": "28.1.2",
49+
"lerna": "5.1.6",
4950
"lerna-changelog": "2.2.0",
50-
"lint-staged": "12.3.3",
51-
"prettier": "2.5.1",
51+
"lint-staged": "13.0.3",
52+
"prettier": "2.7.1",
5253
"reflect-metadata": "0.1.13",
53-
"release-it": "14.12.4",
54+
"release-it": "15.1.1",
5455
"rimraf": "3.0.2",
55-
"rxjs": "7.5.4",
56-
"supertest": "6.2.2",
57-
"ts-jest": "27.1.3",
58-
"ts-node": "10.5.0",
59-
"typescript": "4.5.5"
56+
"rxjs": "7.5.5",
57+
"supertest": "6.2.4",
58+
"ts-jest": "28.0.5",
59+
"ts-node": "10.8.2",
60+
"typescript": "4.7.4"
6061
},
6162
"changelog": {
6263
"labels": {
63-
"type: feature :tada:": "Features",
64-
"type: bug :sob:": "Bug fixes",
65-
"type: enhancement :wolf:": "Enhancements",
66-
"type: docs :page_facing_up:": "Docs",
64+
"feature": "Features",
65+
"bug": "Bug fixes",
66+
"enhancement": "Enhancements",
67+
"docs": "Docs",
6768
"dependencies": "Dependencies"
6869
}
6970
},
@@ -73,12 +74,6 @@
7374
"eslint --fix"
7475
]
7576
},
76-
"husky": {
77-
"hooks": {
78-
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS",
79-
"pre-commit": "lint-staged"
80-
}
81-
},
8277
"repository": {
8378
"type": "git",
8479
"url": "https://github.com/nestjs/graphql"

packages/apollo/CHANGELOG.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/apollo/lib/drivers/apollo-gateway.driver.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
import { Injectable } from '@nestjs/common';
22
import { loadPackage } from '@nestjs/common/utils/load-package.util';
3+
import { ModulesContainer } from '@nestjs/core';
4+
import { extend } from '@nestjs/graphql';
35
import { ApolloGatewayDriverConfig } from '../interfaces';
6+
import { PluginsExplorerService } from '../services/plugins-explorer.service';
47
import { ApolloBaseDriver } from './apollo-base.driver';
58

69
@Injectable()
710
export class ApolloGatewayDriver extends ApolloBaseDriver<ApolloGatewayDriverConfig> {
11+
private readonly pluginsExplorerService: PluginsExplorerService;
12+
13+
constructor(modulesContainer: ModulesContainer) {
14+
super();
15+
this.pluginsExplorerService = new PluginsExplorerService(modulesContainer);
16+
}
17+
818
public async start(options: ApolloGatewayDriverConfig): Promise<void> {
19+
options.server.plugins = extend(
20+
options.server.plugins || [],
21+
this.pluginsExplorerService.explore(options),
22+
);
23+
924
const { ApolloGateway } = loadPackage(
1025
'@apollo/gateway',
1126
'ApolloGateway',

packages/apollo/package.json

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nestjs/apollo",
3-
"version": "10.0.2",
3+
"version": "10.0.16",
44
"description": "Nest - modern, fast, powerful node.js web framework (@apollo)",
55
"author": "Kamil Mysliwiec",
66
"license": "MIT",
@@ -22,27 +22,30 @@
2222
"url": "https://github.com/nestjs/graphql/issues"
2323
},
2424
"devDependencies": {
25-
"@apollo/gateway": "0.48.1",
26-
"@nestjs/common": "8.2.6",
27-
"@nestjs/core": "8.2.6",
28-
"@nestjs/platform-express": "8.2.6",
29-
"@nestjs/platform-fastify": "8.2.6",
30-
"@nestjs/testing": "8.2.6",
25+
"@apollo/gateway": "0.51.0",
26+
"@nestjs/common": "8.4.7",
27+
"@nestjs/core": "8.4.7",
28+
"@nestjs/platform-express": "8.4.7",
29+
"@nestjs/platform-fastify": "8.4.7",
30+
"@nestjs/testing": "8.4.7",
3131
"apollo-cache-inmemory": "1.6.6",
3232
"apollo-client": "2.6.10",
3333
"apollo-link-ws": "1.0.20",
34-
"apollo-server-core": "3.6.3",
35-
"apollo-server-express": "3.6.3",
36-
"apollo-server-fastify": "3.6.3"
34+
"apollo-server-core": "3.9.0",
35+
"apollo-server-express": "3.9.0",
36+
"apollo-server-fastify": "3.9.0",
37+
"apollo-server-plugin-response-cache": "3.6.1"
3738
},
3839
"dependencies": {
3940
"iterall": "1.3.0",
40-
"lodash.omit": "4.5.0"
41+
"lodash.omit": "4.5.0",
42+
"tslib": "2.4.0"
4143
},
4244
"peerDependencies": {
43-
"@apollo/gateway": "^0.44.1 || ^0.46.0 || ^0.48.0",
45+
"@apollo/gateway": "^0.44.1 || ^0.46.0 || ^0.48.0 || ^0.49.0 || ^0.50.0 || ^2.0.0",
4446
"@nestjs/common": "^8.2.3",
4547
"@nestjs/core": "^8.2.3",
48+
"@nestjs/graphql": "^10.0.0",
4649
"apollo-server-core": "^3.5.0",
4750
"apollo-server-express": "^3.5.0",
4851
"apollo-server-fastify": "^3.5.0"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import {
2+
DirectiveLocation,
3+
GraphQLBoolean,
4+
GraphQLDirective,
5+
GraphQLEnumType,
6+
GraphQLInt,
7+
} from 'graphql';
8+
import responseCachePlugin from 'apollo-server-plugin-response-cache';
9+
import { ApolloServerPluginInlineTraceDisabled } from 'apollo-server-core';
10+
import { Module } from '@nestjs/common';
11+
import { GraphQLModule } from '@nestjs/graphql';
12+
import { ApolloFederationDriverConfig } from '../../lib';
13+
import { ApolloFederationDriver } from '../../lib/drivers';
14+
import { PostModule } from './post/post.module';
15+
import { RecipeModule } from './recipe/recipe.module';
16+
import { User } from './user/user.entity';
17+
import { UserModule } from './user/user.module';
18+
19+
@Module({
20+
imports: [
21+
UserModule,
22+
PostModule,
23+
RecipeModule,
24+
GraphQLModule.forRoot<ApolloFederationDriverConfig>({
25+
driver: ApolloFederationDriver,
26+
debug: false,
27+
autoSchemaFile: true,
28+
buildSchemaOptions: {
29+
orphanedTypes: [User],
30+
directives: [
31+
new GraphQLDirective({
32+
name: 'cacheControl',
33+
locations: [
34+
DirectiveLocation.FIELD_DEFINITION,
35+
DirectiveLocation.OBJECT,
36+
DirectiveLocation.INTERFACE,
37+
DirectiveLocation.UNION,
38+
],
39+
args: {
40+
maxAge: { type: GraphQLInt },
41+
scope: {
42+
type: new GraphQLEnumType({
43+
name: 'CacheControlScope',
44+
values: {
45+
PUBLIC: {},
46+
PRIVATE: {},
47+
},
48+
}),
49+
},
50+
inheritMaxAge: { type: GraphQLBoolean },
51+
},
52+
}),
53+
],
54+
},
55+
plugins: [responseCachePlugin(), ApolloServerPluginInlineTraceDisabled()],
56+
}),
57+
],
58+
})
59+
export class CachingApplicationModule {}

0 commit comments

Comments
 (0)