-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
3,884 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphql-hive/nestjs': patch | ||
--- | ||
|
||
Hive Gateway Driver for NestJS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"deleteOutDir": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
createExampleSetup, | ||
createTenv, | ||
getAvailablePort, | ||
} from '@internal/e2e'; | ||
import { getLocalhost } from '@internal/testing'; | ||
import { fetch } from '@whatwg-node/fetch'; | ||
import { expect, it } from 'vitest'; | ||
|
||
const { spawn } = createTenv(__dirname); | ||
const { supergraph, query, result } = createExampleSetup(__dirname); | ||
|
||
it('executes the query', async () => { | ||
const SUPERGRAPH = await supergraph(); | ||
const PORT = await getAvailablePort(); | ||
const [nest, waitForExit] = await spawn('yarn nest', { | ||
Check failure on line 16 in e2e/nestjs/nestjs.e2e.ts
|
||
args: ['start'], | ||
env: { | ||
SUPERGRAPH, | ||
PORT, | ||
}, | ||
}); | ||
const hostname = await getLocalhost(PORT); | ||
const response = await fetch(`${hostname}:${PORT}/graphql`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
query, | ||
}), | ||
}); | ||
const received = await response.json(); | ||
expect(received).toEqual(result); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "@e2e/nestjs", | ||
"version": "0.0.1", | ||
"private": true, | ||
"scripts": { | ||
"build": "nest build", | ||
"start": "nest start", | ||
"start:debug": "nest start --debug --watch", | ||
"start:dev": "nest start --watch", | ||
"start:prod": "node dist/main" | ||
}, | ||
"dependencies": { | ||
"@graphql-hive/nestjs": "workspace:^", | ||
"@nestjs/apollo": "^13.0.2", | ||
"@nestjs/common": "^11.0.1", | ||
"@nestjs/core": "^11.0.1", | ||
"@nestjs/graphql": "^13.0.2", | ||
"@nestjs/platform-express": "^11.0.1", | ||
"graphql": "^16.10.0", | ||
"reflect-metadata": "^0.2.2", | ||
"rxjs": "^7.8.1" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/cli": "^11.0.0", | ||
"@nestjs/schematics": "^11.0.0", | ||
"@nestjs/testing": "^11.0.1", | ||
"@swc/cli": "^0.6.0", | ||
"@swc/core": "^1.10.7", | ||
"@types/express": "^5.0.0", | ||
"@types/node": "^22.10.7", | ||
"globals": "^15.14.0", | ||
"prettier": "^3.4.2", | ||
"source-map-support": "^0.5.21", | ||
"ts-loader": "^9.5.2", | ||
"ts-node": "^10.9.2", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.7.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { | ||
HiveGatewayDriver, | ||
HiveGatewayDriverConfig, | ||
} from '@graphql-hive/nestjs'; | ||
import { Module } from '@nestjs/common'; | ||
import { GraphQLModule } from '@nestjs/graphql'; | ||
|
||
@Module({ | ||
imports: [ | ||
GraphQLModule.forRoot<HiveGatewayDriverConfig>({ | ||
driver: HiveGatewayDriver, | ||
supergraph: process.env['SUPERGRAPH'] || './supergraph.graphql', | ||
}), | ||
], | ||
}) | ||
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
getHello(): string { | ||
return 'Hello World!'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
await app.listen(process.env['PORT'] ?? 3000); | ||
} | ||
bootstrap().catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"declaration": true, | ||
"removeComments": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"allowSyntheticDefaultImports": true, | ||
"target": "ES2021", | ||
"sourceMap": true, | ||
"outDir": "./dist", | ||
"baseUrl": "./", | ||
"incremental": true, | ||
"skipLibCheck": true, | ||
"strictNullChecks": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitAny": false, | ||
"strictBindCallApply": false, | ||
"noFallthroughCasesInSwitch": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "@graphql-hive/nestjs", | ||
"version": "0.0.0", | ||
"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": "contact@the-guild.dev", | ||
"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": "^11.0.9", | ||
"@nestjs/graphql": "^13.0.2", | ||
"graphql": "^15.9.0 || ^16.9.0" | ||
}, | ||
"dependencies": { | ||
"@graphql-hive/gateway-runtime": "workspace:^", | ||
"@graphql-mesh/types": "^0.103.6", | ||
"@graphql-tools/utils": "^10.8.1", | ||
"tslib": "^2.8.1" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/common": "^11.0.9", | ||
"@nestjs/graphql": "^13.0.2", | ||
"fastify": "^5.2.1", | ||
"graphql": "16.10.0", | ||
"pkgroll": "2.10.0" | ||
}, | ||
"sideEffects": false | ||
} |
Oops, something went wrong.