-
Notifications
You must be signed in to change notification settings - Fork 10
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
Hive Gateway Driver for NestJS #667
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR introduces several enhancements and new features. A changeset entry has been added to update the patch version for Changes
Sequence Diagram(s)sequenceDiagram
participant Dev
participant AppModule
participant HiveGatewayDriver
participant LoggerAdapter
participant Server
Dev->>AppModule: Initiate main()
AppModule->>HiveGatewayDriver: Start gateway runtime
HiveGatewayDriver->>LoggerAdapter: Forward logging messages
HiveGatewayDriver->>Server: Register HTTP adapters & subscriptions
Server-->>AppModule: Server is ready
sequenceDiagram
participant TestRunner
participant Tenv
participant Localhost
participant NestServer
TestRunner->>Tenv: createTenv() to initialize environment
Tenv->>Localhost: Allocate dynamic port / get host info
TestRunner->>NestServer: Send POST GraphQL query with headers
NestServer-->>TestRunner: Return JSON response matching expected result
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
🧰 Additional context used📓 Path-based instructions (3)`e2e/**`: This directory includes end-to-end tests for the g...
`**`: For all PRs, we would like to verify that a Linear iss...
`packages/**`: In this directory we keep all packages releva...
🧠 Learnings (1)e2e/nestjs/package.json (1)
⏰ Context from checks skipped due to timeout of 90000ms (34)
🔇 Additional comments (10)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 11
🔭 Outside diff range comments (2)
packages/nestjs/src/index.ts (2)
1-319
: 🧹 Nitpick (assertive)Ensure a corresponding changeset is present for this new feature, and link a Linear issue.
Since this is a new feature in the
@graphql-hive/nestjs
package, it should include a changeset with a minor semver bump (rather than patch). Additionally, we do not see any mention of a "GW-*" Linear issue in the PR description. Please link the relevant Linear ticket or create one if none exists.Would you like me to open a follow-up issue or provide a script to confirm the presence of a “GW-*” reference in the PR description?
🧰 Tools
🪛 Biome (1.9.4)
[error] 48-50: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
[error] 28-28: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
[error] 243-243: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.(lint/style/useNumberNamespace)
🪛 GitHub Check: Types
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
1-319
: 🧹 Nitpick (assertive)Consider adding documentation in the
console
project.Because a new feature is introduced, it’s typically required to add or update relevant documentation in the
graphql-hive/console
repository. This ensures end users understand how to configure and use the Hive Gateway Driver for NestJS.Shall I open a new issue in
graphql-hive/console
to track adding documentation for the Hive Gateway Driver for NestJS?🧰 Tools
🪛 Biome (1.9.4)
[error] 48-50: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
[error] 28-28: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
[error] 243-243: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.(lint/style/useNumberNamespace)
🪛 GitHub Check: Types
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (12)
.changeset/sixty-camels-design.md
(1 hunks)e2e/nestjs/nest-cli.json
(1 hunks)e2e/nestjs/nestjs.e2e.ts
(1 hunks)e2e/nestjs/package.json
(1 hunks)e2e/nestjs/src/app.module.ts
(1 hunks)e2e/nestjs/src/app.service.ts
(1 hunks)e2e/nestjs/src/main.ts
(1 hunks)e2e/nestjs/tsconfig.build.json
(1 hunks)e2e/nestjs/tsconfig.json
(1 hunks)packages/nestjs/package.json
(1 hunks)packages/nestjs/src/index.ts
(1 hunks)tsconfig.json
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...
e2e/**
: This directory includes end-to-end tests for the gateway.
Theexamples
directory is generated based on the code in this directory.
e2e/nestjs/tsconfig.build.json
e2e/nestjs/nest-cli.json
e2e/nestjs/package.json
e2e/nestjs/src/app.service.ts
e2e/nestjs/src/main.ts
e2e/nestjs/tsconfig.json
e2e/nestjs/src/app.module.ts
e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...
**
: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding
console
project.
Use the global knowledge feature to search for PRs ingraphql-hive/console
repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.
e2e/nestjs/tsconfig.build.json
e2e/nestjs/nest-cli.json
e2e/nestjs/package.json
e2e/nestjs/src/app.service.ts
e2e/nestjs/src/main.ts
tsconfig.json
e2e/nestjs/tsconfig.json
e2e/nestjs/src/app.module.ts
e2e/nestjs/nestjs.e2e.ts
packages/nestjs/src/index.ts
packages/nestjs/package.json
`packages/**`: In this directory we keep all packages releva...
packages/**
: In this directory we keep all packages relevant to the gateway.In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using
yarn changeset
with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mentionminor
semver change. When a bug is fixed,patch
needs to be used. Themajor
bump is used for a PR that has breaking changes.
packages/nestjs/src/index.ts
packages/nestjs/package.json
🪛 GitHub Check: Types
e2e/nestjs/nestjs.e2e.ts
[failure] 16-16:
'nest' is declared but its value is never read.
[failure] 16-16:
'waitForExit' is declared but its value is never read.
packages/nestjs/src/index.ts
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
🪛 Biome (1.9.4)
packages/nestjs/src/index.ts
[error] 48-50: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
[error] 28-28: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
[error] 243-243: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.
(lint/style/useNumberNamespace)
⏰ Context from checks skipped due to timeout of 90000ms (27)
- GitHub Check: E2E / Bun Docker on Ubuntu
- GitHub Check: E2E / Bun on Ubuntu
- GitHub Check: E2E / Node Binary on Windows
- GitHub Check: E2E / Node Binary on Ubuntu
- GitHub Check: E2E / Node Docker on Ubuntu
- GitHub Check: Leaks / Node v23
- GitHub Check: E2E / Node 23 on Ubuntu
- GitHub Check: Leaks / Node v22
- GitHub Check: Leaks / Node v20
- GitHub Check: E2E / Node 22 on Ubuntu
- GitHub Check: Leaks / Node v18
- GitHub Check: E2E / Node 20 on Ubuntu
- GitHub Check: Benchmark / bun / 1000 items
- GitHub Check: Unit / Bun
- GitHub Check: Benchmark / bun / 100 items
- GitHub Check: E2E / Node 18 on Ubuntu
- GitHub Check: Build
- GitHub Check: Unit / Node v23
- GitHub Check: Benchmark / bun / 10 items
- GitHub Check: Bundle
- GitHub Check: Unit / Node v22
- GitHub Check: Benchmark / node / 1000 items
- GitHub Check: Benchmark / node / 100 items
- GitHub Check: Unit / Node v20
- GitHub Check: Benchmark / node / 10 items
- GitHub Check: Unit / Node v18
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
e2e/nestjs/src/app.service.ts (1)
3-8
: Implementation looks good.The
getHello
method is straightforward and relies on NestJS dependency injection. Consider adding a unit test for this service or expanding the content to reflect real-world usage in an example if needed.e2e/nestjs/src/main.ts (1)
4-11
: Bootstrap logic is clear and standard.This entry point follows NestJS conventions. No issues found with the error handling approach, although you could optionally log more contextual errors (e.g., environment details) if needed.
e2e/nestjs/src/app.module.ts (1)
11-13
:❓ Verification inconclusive
Consider validating the supergraph path.
The supergraph path is loaded from an environment variable with a fallback, but there's no validation to ensure the file exists. Consider adding validation during module initialization.
🏁 Script executed:
#!/bin/bash # Check if the default supergraph file exists in the e2e/nestjs directory fd -t f "supergraph.graphql" "e2e/nestjs"Length of output: 39
Action Required: Validate the Supergraph File Existence During Module Initialization
The current code sets the supergraph path from an environment variable or falls back to the relative path (
'./supergraph.graphql'
), but there’s no runtime check to confirm that the file exists. Automated verification usingfd
in thee2e/nestjs
directory didn’t return any results, so please manually verify whether the file exists in the expected location. If it is missing, adding a file existence check (for example, using Node’sfs.existsSync
during module initialization) would help avoid runtime errors.
- Ensure that if
process.env['SUPERGRAPH']
is not provided, the module checks that./supergraph.graphql
exists.- If the file is not found, consider logging an error message or throwing an exception during startup.
e2e/nestjs/tsconfig.build.json (1)
1-4
: LGTM!The TypeScript build configuration follows best practices by extending the base config and properly excluding test files and build artifacts.
e2e/nestjs/nest-cli.json (1)
1-8
: LGTM! Standard NestJS CLI configuration.The configuration follows NestJS best practices with proper schema validation and compiler options.
packages/nestjs/package.json (1)
2-4
: Update version from 0.0.0 before release.The version 0.0.0 indicates the package is not ready for release. Update to an appropriate version (e.g., 0.1.0 for initial release).
tsconfig.json (1)
63-66
: LGTM! Path mappings are correctly configured.The new path mapping for
@graphql-hive/nestjs
and reformatted mapping for@graphql-hive/logger-winston
are properly configured.
packages/nestjs/src/index.ts
Outdated
const strs: string[] = []; | ||
args = args | ||
.flatMap((arg) => (typeof arg === 'function' ? arg() : arg)) | ||
.flat(Infinity); |
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)
Use Number.POSITIVE_INFINITY
instead of the global Infinity
.
For consistency and clarity in modern JavaScript/TypeScript, prefer Number.POSITIVE_INFINITY
.
-.flat(Infinity);
+.flat(Number.POSITIVE_INFINITY);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
.flat(Infinity); | |
.flat(Number.POSITIVE_INFINITY); |
🧰 Tools
🪛 Biome (1.9.4)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.
(lint/style/useNumberNamespace)
bf73461
to
ca8c777
Compare
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.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (12)
.changeset/sixty-camels-design.md
(1 hunks)e2e/nestjs/nest-cli.json
(1 hunks)e2e/nestjs/nestjs.e2e.ts
(1 hunks)e2e/nestjs/package.json
(1 hunks)e2e/nestjs/src/app.module.ts
(1 hunks)e2e/nestjs/src/app.service.ts
(1 hunks)e2e/nestjs/src/main.ts
(1 hunks)e2e/nestjs/tsconfig.build.json
(1 hunks)e2e/nestjs/tsconfig.json
(1 hunks)packages/nestjs/package.json
(1 hunks)packages/nestjs/src/index.ts
(1 hunks)tsconfig.json
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...
e2e/**
: This directory includes end-to-end tests for the gateway.
Theexamples
directory is generated based on the code in this directory.
e2e/nestjs/tsconfig.build.json
e2e/nestjs/nest-cli.json
e2e/nestjs/src/app.service.ts
e2e/nestjs/tsconfig.json
e2e/nestjs/src/app.module.ts
e2e/nestjs/package.json
e2e/nestjs/nestjs.e2e.ts
e2e/nestjs/src/main.ts
`**`: For all PRs, we would like to verify that a Linear iss...
**
: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding
console
project.
Use the global knowledge feature to search for PRs ingraphql-hive/console
repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.
e2e/nestjs/tsconfig.build.json
e2e/nestjs/nest-cli.json
e2e/nestjs/src/app.service.ts
e2e/nestjs/tsconfig.json
e2e/nestjs/src/app.module.ts
e2e/nestjs/package.json
tsconfig.json
e2e/nestjs/nestjs.e2e.ts
packages/nestjs/src/index.ts
packages/nestjs/package.json
e2e/nestjs/src/main.ts
`packages/**`: In this directory we keep all packages releva...
packages/**
: In this directory we keep all packages relevant to the gateway.In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using
yarn changeset
with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mentionminor
semver change. When a bug is fixed,patch
needs to be used. Themajor
bump is used for a PR that has breaking changes.
packages/nestjs/src/index.ts
packages/nestjs/package.json
🪛 GitHub Check: Types
e2e/nestjs/nestjs.e2e.ts
[failure] 16-16:
'nest' is declared but its value is never read.
[failure] 16-16:
'waitForExit' is declared but its value is never read.
packages/nestjs/src/index.ts
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
🪛 Biome (1.9.4)
packages/nestjs/src/index.ts
[error] 48-50: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
[error] 28-28: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
[error] 243-243: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.
(lint/style/useNumberNamespace)
⏰ Context from checks skipped due to timeout of 90000ms (27)
- GitHub Check: E2E / Bun Docker on Ubuntu
- GitHub Check: E2E / Bun on Ubuntu
- GitHub Check: E2E / Node Binary on Windows
- GitHub Check: E2E / Node Binary on Ubuntu
- GitHub Check: Unit / Node v23
- GitHub Check: E2E / Node Docker on Ubuntu
- GitHub Check: Unit / Node v22
- GitHub Check: E2E / Node 23 on Ubuntu
- GitHub Check: Leaks / Node v23
- GitHub Check: Unit / Node v20
- GitHub Check: E2E / Node 22 on Ubuntu
- GitHub Check: Benchmark / bun / 1000 items
- GitHub Check: Leaks / Node v22
- GitHub Check: Benchmark / bun / 100 items
- GitHub Check: E2E / Node 20 on Ubuntu
- GitHub Check: Bundle
- GitHub Check: E2E / Node 18 on Ubuntu
- GitHub Check: Benchmark / bun / 10 items
- GitHub Check: Unit / Node v18
- GitHub Check: Benchmark / node / 1000 items
- GitHub Check: Build
- GitHub Check: Leaks / Node v20
- GitHub Check: Benchmark / node / 100 items
- GitHub Check: Unit / Bun
- GitHub Check: Benchmark / node / 10 items
- GitHub Check: Leaks / Node v18
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (16)
packages/nestjs/src/index.ts (7)
1-319
: Ensure a corresponding changeset file for the new package code.Since this file is part of
packages/
, a changeset file is required to describe the new functionality and determine the correct version bump (likely aminor
bump). Please create one withyarn changeset
if not already present in this PR.🧰 Tools
🪛 Biome (1.9.4)
[error] 48-50: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
[error] 28-28: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
[error] 243-243: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.(lint/style/useNumberNamespace)
🪛 GitHub Check: Types
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
28-28
: Avoid using '{}' as a type.This is the same feedback provided previously. Replace
'{}'
withRecord<string, unknown>
or a more precise shape to avoid inadvertently allowing all non-nullish values.🧰 Tools
🪛 Biome (1.9.4)
[error] 28-28: Don't use '{}' as a type.
Prefer explicitly define the object shape. '{}' means "any non-nullable value".
(lint/complexity/noBannedTypes)
48-50
: Remove the unnecessary constructor.This constructor calls
super()
but otherwise doesn't add any logic. It can be safely removed for cleaner code.🧰 Tools
🪛 Biome (1.9.4)
[error] 48-50: This constructor is unnecessary.
Unsafe fix: Remove the unnecessary constructor.
(lint/complexity/noUselessConstructor)
52-195
: Implementation of thestart
method looks well-structured.The method properly sets up additional type definitions and resolvers, initializes context plugins, handles multiple ways of configuring subscriptions, and gracefully integrates with Express or Fastify. Good job!
🧰 Tools
🪛 GitHub Check: Types
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
85-85
: Fix the type ofoptions.debug
.Coercing
options.debug
to a boolean (e.g.,!!options.debug
) or defaulting it tofalse
will avoid type errors where a strictly boolean parameter is expected.🧰 Tools
🪛 GitHub Check: Types
[failure] 85-85:
Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
243-243
: Avoid reassigning a function parameter.Use a local variable instead of reassigning
args
to improve clarity and ensure the original reference remains intact.🧰 Tools
🪛 Biome (1.9.4)
[error] 243-243: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
245-245
: Use Number.POSITIVE_INFINITY instead of Infinity.ES2015 encourages using
Number.POSITIVE_INFINITY
for consistency across the codebase.🧰 Tools
🪛 Biome (1.9.4)
[error] 245-245: Use Number.POSITIVE_INFINITY instead of the equivalent global.
ES2015 moved some globals into the Number namespace for consistency.
Safe fix: Use Number.POSITIVE_INFINITY instead.(lint/style/useNumberNamespace)
e2e/nestjs/nestjs.e2e.ts (2)
16-22
: Add cleanup after test completion.The test spawns a NestJS server but doesn't clean it up after the test. Consider using the
waitForExit
function in anafterAll
orafterEach
block to ensure proper cleanup.🧰 Tools
🪛 GitHub Check: Types
[failure] 16-16:
'nest' is declared but its value is never read.
[failure] 16-16:
'waitForExit' is declared but its value is never read.
16-16
: Address unused variables from destructuring.The
nest
variable is declared but never used. Consider removing it if not needed.🧰 Tools
🪛 GitHub Check: Types
[failure] 16-16:
'nest' is declared but its value is never read.
[failure] 16-16:
'waitForExit' is declared but its value is never read..changeset/sixty-camels-design.md (1)
5-5
: Enhance the changeset description.The current description is too brief. Consider adding more details about:
- What the NestJS driver does
- Key features or capabilities
- Any breaking changes or important notes
e2e/nestjs/tsconfig.build.json (1)
1-4
: LGTM!The TypeScript build configuration follows best practices by:
- Extending the base configuration
- Properly excluding test files and build artifacts
e2e/nestjs/nest-cli.json (1)
1-8
: LGTM!The NestJS CLI configuration follows best practices with proper schema validation and compiler options.
e2e/nestjs/tsconfig.json (1)
17-19
: Consider enabling strict TypeScript checks.Disabled strict checks could allow type-related bugs to slip through. Consider enabling them for better type safety.
e2e/nestjs/package.json (1)
13-21
: Consider pinning dependency versions for stability.Using caret ranges for critical dependencies could lead to unexpected behavior in CI.
packages/nestjs/package.json (1)
1-61
: Missing changeset file for package changes.According to coding guidelines, a changeset file created using
yarn changeset
is required for package changes.tsconfig.json (1)
63-66
: LGTM!The path mappings follow the existing pattern and are correctly configured.
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-hive/gateway |
1.10.3-alpha-b49673d6fafd3ac008e225ad198155c7cfb8f8fc |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/nestjs |
0.0.1-alpha-b49673d6fafd3ac008e225ad198155c7cfb8f8fc |
npm ↗︎ unpkg ↗︎ |
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.
Actionable comments posted: 3
🔭 Outside diff range comments (1)
e2e/nestjs/src/main.ts (1)
1-19
: 🧹 Nitpick (assertive)Graceful shutdown and port usage are well-handled.
You might also consider handlingSIGINT
in addition toSIGTERM
if you want consistent local termination handling. Otherwise, this approach appears solid.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (9)
.changeset/sixty-camels-design.md
(1 hunks)e2e/nestjs/.gitignore
(1 hunks)e2e/nestjs/nestjs.e2e.ts
(1 hunks)e2e/nestjs/package.json
(1 hunks)e2e/nestjs/src/main.ts
(1 hunks)e2e/nestjs/tsconfig.json
(1 hunks)packages/nestjs/package.json
(1 hunks)packages/nestjs/src/index.ts
(1 hunks)tsconfig.json
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`e2e/**`: This directory includes end-to-end tests for the g...
e2e/**
: This directory includes end-to-end tests for the gateway.
Theexamples
directory is generated based on the code in this directory.
e2e/nestjs/package.json
e2e/nestjs/src/main.ts
e2e/nestjs/tsconfig.json
e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...
**
: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding
console
project.
Use the global knowledge feature to search for PRs ingraphql-hive/console
repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.
e2e/nestjs/package.json
e2e/nestjs/src/main.ts
e2e/nestjs/tsconfig.json
tsconfig.json
e2e/nestjs/nestjs.e2e.ts
packages/nestjs/src/index.ts
packages/nestjs/package.json
`packages/**`: In this directory we keep all packages releva...
packages/**
: In this directory we keep all packages relevant to the gateway.In most cases, when changes are made to the source code / dependencies in these directories, we also require to have a corresponding changeset file, created using
yarn changeset
with a full description on the changes with an example.
Also, when new features are added the packages, the changeset file should mentionminor
semver change. When a bug is fixed,patch
needs to be used. Themajor
bump is used for a PR that has breaking changes.
packages/nestjs/src/index.ts
packages/nestjs/package.json
🧠 Learnings (1)
e2e/nestjs/package.json (1)
Learnt from: ardatan
PR: graphql-hive/gateway#667
File: e2e/nestjs/package.json:13-21
Timestamp: 2025-02-14T13:52:33.387Z
Learning: In example and e2e test projects within the repository, using caret ranges (^) for dependencies is preferred to demonstrate compatibility across different versions.
⏰ Context from checks skipped due to timeout of 90000ms (31)
- GitHub Check: Examples / Inspect head commit
- GitHub Check: Binary built on macos-14
- GitHub Check: Bun Docker image
- GitHub Check: Binary built on macos-13
- GitHub Check: Node Docker image
- GitHub Check: Binary built on ubuntu-latest
- GitHub Check: E2E / Bun Docker on Ubuntu
- GitHub Check: E2E / Bun on Ubuntu
- GitHub Check: Unit / Bun
- GitHub Check: E2E / Node Binary on Windows
- GitHub Check: E2E / Node Binary on Ubuntu
- GitHub Check: E2E / Node Docker on Ubuntu
- GitHub Check: E2E / Node 23 on Ubuntu
- GitHub Check: E2E / Node 22 on Ubuntu
- GitHub Check: Unit / Node v23
- GitHub Check: Leaks / Node v23
- GitHub Check: E2E / Node 20 on Ubuntu
- GitHub Check: Unit / Node v22
- GitHub Check: Leaks / Node v22
- GitHub Check: Benchmark / bun / 1000 items
- GitHub Check: Benchmark / bun / 100 items
- GitHub Check: Benchmark / bun / 10 items
- GitHub Check: E2E / Node 18 on Ubuntu
- GitHub Check: Benchmark / node / 1000 items
- GitHub Check: Build
- GitHub Check: Leaks / Node v20
- GitHub Check: Benchmark / node / 100 items
- GitHub Check: Bundle
- GitHub Check: Benchmark / node / 10 items
- GitHub Check: Leaks / Node v18
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
packages/nestjs/src/index.ts (6)
1-27
: Overall imports look good.
No immediate concerns with the imports or type references. Everything appears consistent with NestJS and the Hive Gateway runtime packages.
42-45
: File is inpackages/**
: verify presence of a changeset.
This file introduces a new driver in thepackages/nestjs
directory. Please confirm that a.changeset
file describing these changes has been added, as per the repository guidelines.
194-197
: Graceful stopping logic looks appropriate.
This ensures subscription services and the gateway runtime are properly disposed of. Nicely done.
199-225
: Express & Fastify registration are straightforward.
The routing logic for Express and Fastify is correct. The approach to pass the request/response intohandleNodeRequestAndResponse
is well-structured.
228-315
: Logger adapter is well-implemented.
Your approach to flatten arguments and differentiate between string vs. object outputs is a clear pattern for structured logging.
317-323
: Helper function for truthy checks is well thought out.
This utility method covers common truthy variants effectively.e2e/nestjs/nestjs.e2e.ts (1)
13-35
: Add cleanup after test completion.
This test spawns a NestJS process but does not shut it down after the test, potentially leaving behind a running server. Consider using a teardown hook or waiting for exit.afterAll(async () => { - // ... + // Ensure server is closed after test completion: + await waitForExit(); });e2e/nestjs/.gitignore (1)
1-1
: LGTM!Appropriate configuration to ignore build artifacts.
.changeset/sixty-camels-design.md (1)
5-7
: Enhance the changeset description.The current description is too brief. Consider adding more details about:
- What the NestJS driver does
- Key features or capabilities
- Any breaking changes or important notes
e2e/nestjs/tsconfig.json (1)
1-21
: LGTM!The TypeScript configuration follows best practices with strict type checking enabled and appropriate settings for a NestJS application.
e2e/nestjs/package.json (1)
13-20
: LGTM!Dependencies use caret ranges, which is appropriate for example projects to demonstrate compatibility across versions.
packages/nestjs/package.json (1)
1-64
: Action Required: Missing Documentation for NestJS DriverThe verification script did not return any open PRs for documentation related to the NestJS driver in the graphql-hive/console repository. This confirms that no corresponding documentation PR is currently present.
#!/bin/bash # Search for documentation PR in graphql-hive/console repository gh search prs --repo graphql-hive/console --state open --json title,url \ --jq '.[] | select(.title | contains("NestJS") or contains("Nest.js") or contains("nest"))'tsconfig.json (3)
63-66
: LGTM!The path mappings are correctly configured:
- Reformatted
@graphql-hive/logger-winston
for consistency- Added new
@graphql-hive/nestjs
mapping following the established pattern
87-89
: LGTM!The exclude patterns are appropriate:
- Added trailing comma for better maintainability
- Excluded build artifacts (dist) and local/temporary files (ignored-hidden)
1-91
:❓ Verification inconclusive
Documentation needed for the NestJS driver feature.
The PR description mentions that documentation is missing. Since this is a new feature (NestJS driver), documentation should be added to help users understand and implement it correctly.
Let's check if there's a documentation PR in the console repository:
Please create a follow-up issue to add documentation for the NestJS driver feature in the console repository.
🏁 Script executed:
#!/bin/bash # Search for PRs in graphql-hive/console repository that might contain NestJS documentation gh search prs --repo graphql-hive/console "nestjs in:title,body" --state all --json title,urlLength of output: 3412
Documentation missing for NestJS driver feature – please add it.
The PR description indicates that documentation is absent. Our initial attempt to locate any existing NestJS-related documentation in the console repository was inconclusive due to an invalid search parameter (using
--state all
). It’s likely that no documentation has been added yet. Please verify manually if any NestJS documentation exists in the console repo and, if not, create a follow-up issue to add the necessary documentation for the NestJS driver feature.
🚀 Snapshot Release (Bun Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared
|
🚀 Snapshot Release (Node Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
e2e/nestjs/nestjs.e2e.ts
(1 hunks)e2e/nestjs/package.json
(1 hunks)e2e/nestjs/services/nestjs/app.module.ts
(1 hunks)e2e/nestjs/services/nestjs/index.ts
(1 hunks)internal/e2e/src/tenv.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`e2e/**`: This directory includes end-to-end tests for the g...
e2e/**
: This directory includes end-to-end tests for the gateway.
Theexamples
directory is generated based on the code in this directory.
e2e/nestjs/package.json
e2e/nestjs/services/nestjs/index.ts
e2e/nestjs/services/nestjs/app.module.ts
e2e/nestjs/nestjs.e2e.ts
`**`: For all PRs, we would like to verify that a Linear iss...
**
: For all PRs, we would like to verify that a Linear issue is linked. Check if there's a mention for "GW-*" in the PR description, and the us know when it's missing.In most cases, when a PR adds a new functionality, we would like to make sure it has documentation in the corresponding
console
project.
Use the global knowledge feature to search for PRs ingraphql-hive/console
repository that adds documentation. Suggest to create a follow up issue to add the missing documentation.
e2e/nestjs/package.json
e2e/nestjs/services/nestjs/index.ts
e2e/nestjs/services/nestjs/app.module.ts
internal/e2e/src/tenv.ts
e2e/nestjs/nestjs.e2e.ts
🧠 Learnings (1)
e2e/nestjs/package.json (1)
Learnt from: ardatan
PR: graphql-hive/gateway#667
File: e2e/nestjs/package.json:13-21
Timestamp: 2025-02-14T13:52:33.387Z
Learning: In example and e2e test projects within the repository, using caret ranges (^) for dependencies is preferred to demonstrate compatibility across different versions.
⏰ Context from checks skipped due to timeout of 90000ms (33)
- GitHub Check: Examples / Inspect head commit
- GitHub Check: Binary built on ubuntu-24.04-arm
- GitHub Check: Binary built on macos-14
- GitHub Check: Binary built on macos-13
- GitHub Check: Bun Docker image
- GitHub Check: Binary built on ubuntu-latest
- GitHub Check: Node Docker image
- GitHub Check: E2E / Bun Docker on Ubuntu
- GitHub Check: E2E / Bun on Ubuntu
- GitHub Check: E2E / Node Binary on Windows
- GitHub Check: Unit / Bun
- GitHub Check: E2E / Node Binary on Ubuntu
- GitHub Check: Leaks / Node v23
- GitHub Check: E2E / Node Docker on Ubuntu
- GitHub Check: Unit / Node v23
- GitHub Check: E2E / Node 23 on Ubuntu
- GitHub Check: Leaks / Node v22
- GitHub Check: Unit / Node v22
- GitHub Check: E2E / Node 22 on Ubuntu
- GitHub Check: Benchmark / bun / 1000 items
- GitHub Check: Unit / Node v18
- GitHub Check: Benchmark / bun / 100 items
- GitHub Check: Leaks / Node v20
- GitHub Check: Benchmark / bun / 10 items
- GitHub Check: E2E / Node 20 on Ubuntu
- GitHub Check: Benchmark / node / 1000 items
- GitHub Check: Leaks / Node v18
- GitHub Check: Bundle
- GitHub Check: Benchmark / node / 100 items
- GitHub Check: Build
- GitHub Check: E2E / Node 18 on Ubuntu
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Benchmark / node / 10 items
🔇 Additional comments (8)
e2e/nestjs/services/nestjs/app.module.ts (1)
1-20
: LGTM!The module configuration is well-structured and correctly integrates the HiveGatewayDriver with NestJS. The supergraph configuration is properly handled using the Opts utility.
e2e/nestjs/services/nestjs/index.ts (1)
1-22
: LGTM!The bootstrap implementation is robust with proper error handling and graceful shutdown support.
e2e/nestjs/nestjs.e2e.ts (2)
9-26
: LGTM!The test implementation is well-structured and correctly validates the GraphQL functionality.
19-22
: Add cleanup and address unused variables.
- Add cleanup after test completion to ensure proper resource management.
- The
nest
variable is declared but never used.Apply this diff to fix the issues:
bootstrap().catch((e) => { console.error(e); process.exit(1); }); + +afterEach(async () => { + await waitForExit(); +});And:
-const [nest, waitForExit] = await spawn('yarn nest', { +const [, waitForExit] = await spawn('yarn nest', {internal/e2e/src/tenv.ts (1)
687-707
: LGTM!The environment variable handling is correctly implemented in both service and container methods.
e2e/nestjs/package.json (3)
1-4
: LGTM!The package metadata is well-structured with appropriate name, version, and private flag for an e2e test package.
5-13
: LGTM! Versioning strategy aligns with project preferences.The use of caret ranges for dependencies is appropriate here as this is an e2e test project meant to demonstrate compatibility across versions.
14-31
: LGTM! Development dependencies are well configured.The devDependencies include all necessary tools for building, testing, and development with appropriate versions.
7bef7e4
to
3f41d58
Compare
Docs are missing...
Completes GW-133