-
Notifications
You must be signed in to change notification settings - Fork 28
Hive Gateway Driver for NestJS #667
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
Changes from all commits
c171ca1
0f9c19f
d9f411e
706d7ef
3cc93ab
059b4a4
fd85e2b
f8f32a0
bbd9dda
05aab33
bf661cb
3266d69
429a8ce
d737d3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@graphql-hive/gateway': patch | ||
| --- | ||
|
|
||
| dependencies updates: | ||
|
|
||
| - Updated dependency [`@graphql-mesh/cache-localforage@^0.104.0` ↗︎](https://www.npmjs.com/package/@graphql-mesh/cache-localforage/v/0.104.0) (from `^0.103.19`, in `dependencies`) | ||
| - Updated dependency [`@graphql-mesh/cache-upstash-redis@^0.0.6` ↗︎](https://www.npmjs.com/package/@graphql-mesh/cache-upstash-redis/v/0.0.6) (from `^0.0.5`, in `dependencies`) | ||
| - Updated dependency [`@graphql-mesh/plugin-mock@^0.104.0` ↗︎](https://www.npmjs.com/package/@graphql-mesh/plugin-mock/v/0.104.0) (from `^0.103.19`, in `dependencies`) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@graphql-hive/nestjs': major | ||
| --- | ||
|
|
||
| Hive Gateway Driver for NestJS; | ||
|
|
||
| [Learn more in the docs](https://the-guild.dev/graphql/hive/docs/gateway/deployment/node-frameworks/nestjs) | ||
|
Comment on lines
+5
to
+7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Enhance Description for Hive Gateway Driver |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@graphql-hive/gateway': minor | ||
| --- | ||
|
|
||
| Expose internal methods `getCacheInstanceFromConfig` and `getBuiltinPluginsFromConfig` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { createExampleSetup, createTenv } from '@internal/e2e'; | ||
| import { getLocalhost } from '@internal/testing'; | ||
| import { fetch } from '@whatwg-node/fetch'; | ||
| import { expect, it } from 'vitest'; | ||
|
|
||
| const { service } = createTenv(__dirname); | ||
| const { supergraph, query, result } = createExampleSetup(__dirname); | ||
|
|
||
| it.todo('executes the query', async () => { | ||
| const supergraphPath = await supergraph(); | ||
| const { port } = await service('nestjs', { | ||
| args: [`--supergraph=${supergraphPath}`], | ||
| }); | ||
| const hostname = await getLocalhost(port); | ||
| const response = await fetch(`${hostname}:${port}/graphql`, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| body: JSON.stringify({ | ||
| query, | ||
| }), | ||
| }); | ||
| if (!response.ok) { | ||
| throw new Error(`HTTP error: ${response.status}: ${await response.text()}`); | ||
| } | ||
| const received = await response.json(); | ||
| expect(received).toEqual(result); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "@e2e/nestjs", | ||
| "version": "0.0.1", | ||
| "private": true, | ||
| "dependencies": { | ||
| "@graphql-hive/nestjs": "workspace:^", | ||
| "@nestjs/common": "^11.0.10", | ||
| "@nestjs/core": "^11.0.10", | ||
| "@nestjs/graphql": "^13.0.3", | ||
| "@nestjs/platform-express": "^11.0.10", | ||
| "graphql": "^16.10.0", | ||
| "reflect-metadata": "^0.2.2", | ||
| "rxjs": "^7.8.1" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { | ||
| HiveGatewayDriver, | ||
| HiveGatewayDriverConfig, | ||
| } from '@graphql-hive/nestjs'; | ||
| import { Opts } from '@internal/testing'; | ||
| import { Module } from '@nestjs/common'; | ||
| import { GraphQLModule } from '@nestjs/graphql'; | ||
|
|
||
| const opts = Opts(process.argv); | ||
| const supergraph = opts.get('supergraph', true); | ||
|
|
||
| @Module({ | ||
| imports: [ | ||
| GraphQLModule.forRoot<HiveGatewayDriverConfig>({ | ||
| driver: HiveGatewayDriver, | ||
| supergraph, | ||
| }), | ||
| ], | ||
| }) | ||
| export class AppModule {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { Opts } from '@internal/testing'; | ||
| import { NestFactory } from '@nestjs/core'; | ||
| import { AppModule } from './app.module'; | ||
|
|
||
| const opts = Opts(process.argv); | ||
| const port = opts.getServicePort('nestjs', true); | ||
|
|
||
| async function main() { | ||
| const app = await NestFactory.create(AppModule); | ||
| await app.listen(port); | ||
| } | ||
|
|
||
| main().catch((err) => { | ||
| console.error(err); | ||
| process.exit(1); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,7 @@ export { | |
| type HTTPTransportOptions, | ||
| default as HTTPTransport, | ||
| } from '@graphql-mesh/transport-http'; | ||
| export { | ||
| getCacheInstanceFromConfig, | ||
| getBuiltinPluginsFromConfig, | ||
| } from './config'; | ||
|
Comment on lines
+29
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Verify the impact of exposing internal APIs. The newly exported functions are marked as internal APIs with potential breaking changes. Ensure that consumers of these APIs are aware of the stability implications. Consider one of the following approaches:
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| { | ||
| "name": "@graphql-hive/nestjs", | ||
| "version": "0.0.0", | ||
ardatan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "type": "module", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/graphql-hive/gateway.git", | ||
| "directory": "packages/nestjs" | ||
| }, | ||
| "homepage": "https://the-guild.dev/graphql/hive/docs/gateway", | ||
| "author": { | ||
| "email": "[email protected]", | ||
| "name": "The Guild", | ||
| "url": "https://the-guild.dev" | ||
| }, | ||
| "license": "MIT", | ||
| "engines": { | ||
| "node": ">=18.0.0" | ||
| }, | ||
| "main": "./dist/index.js", | ||
| "exports": { | ||
| ".": { | ||
| "require": { | ||
| "types": "./dist/index.d.cts", | ||
| "default": "./dist/index.cjs" | ||
| }, | ||
| "import": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "types": "./dist/index.d.ts", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "scripts": { | ||
| "build": "pkgroll --clean-dist", | ||
| "prepack": "yarn build" | ||
| }, | ||
| "peerDependencies": { | ||
| "@nestjs/common": "^10 || ^11", | ||
| "@nestjs/graphql": "^12 || ^13", | ||
| "graphql": "^15.9.0 || ^16.9.0" | ||
| }, | ||
| "dependencies": { | ||
| "@graphql-hive/gateway": "workspace:^", | ||
| "@graphql-mesh/types": "^0.103.18", | ||
| "@graphql-tools/utils": "^10.8.1", | ||
| "@whatwg-node/promise-helpers": "^1.0.0", | ||
| "tslib": "^2.8.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@nestjs/common": "11.0.10", | ||
| "@nestjs/core": "11.0.10", | ||
| "@nestjs/graphql": "13.0.3", | ||
| "@nestjs/testing": "11.0.11", | ||
| "@types/supertest": "6.0.2", | ||
| "fastify": "5.2.1", | ||
| "graphql": "^16.9.0", | ||
| "pkgroll": "2.10.0", | ||
| "reflect-metadata": "0.2.2", | ||
| "rxjs": "7.8.1", | ||
| "supertest": "7.0.0" | ||
| }, | ||
| "sideEffects": false | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Document Dependency Updates
The updated dependency versions (with links to the npm packages) are clearly listed, which is very helpful. For additional clarity, consider including a short rationale for these updates to assist downstream consumers in understanding the context of these changes.