Skip to content

Add InversifyApolloProvider#27

Merged
notaphplover merged 4 commits intomasterfrom
feat/add-inversify-apollo-provider
Dec 26, 2025
Merged

Add InversifyApolloProvider#27
notaphplover merged 4 commits intomasterfrom
feat/add-inversify-apollo-provider

Conversation

@notaphplover
Copy link
Member

@notaphplover notaphplover commented Dec 26, 2025

Added

  • Added InversifyApolloProvider.
  • Added inversifyApolloProviderServiceIdentifier.

Changed

  • Updated ApoloServerContainerModule to bind inversifyApolloProviderServiceIdentifier.

Summary by CodeRabbit

  • New Features

    • Added an Inversify-backed Apollo provider and its public service identifier to the public API.
  • Public API

    • Widened typing of an existing Apollo server service identifier for broader compatibility.
    • Exported the new provider type and identifier from the package root.
  • Chores

    • Broadened npmignore rules across packages to exclude additional spec file variants from published packages.

✏️ Tip: You can customize this high-level summary in your review settings.

@notaphplover notaphplover self-assigned this Dec 26, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 26, 2025

🦋 Changeset detected

Latest commit: f272177

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@inversifyjs/apollo-core Minor
@inversifyjs/apollo-express Patch
@inversifyjs/apollo-subscription-ws Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

Adds a new Inversify-backed provider (interface, implementation, and DI symbol), registers it as a singleton in the Apollo container module with updated tests, widens the ApolloServer service identifier generic, updates the apollo-core export barrel, and consolidates .npmignore patterns across several packages.

Changes

Cohort / File(s) Summary
DI - Interface & Service Identifier
packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts, packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
New InversifyApolloProvider type (readonly apolloServer: ApolloServer<any>, httpServer: http.Server) and exported inversifyApolloProviderServiceIdentifier symbol (ServiceIdentifier<InversifyApolloProvider>).
DI - Implementation
packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
New InversifyApolloProviderImplementation injectable class implementing InversifyApolloProvider; constructor injects apolloServerServiceIdentifier and httpServerServiceIdentifier, exposing readonly properties.
Container Module & Tests
packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts, packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
Module registers singleton binding inversifyApolloProviderServiceIdentifier -> InversifyApolloProviderImplementation; tests updated to expect an additional bind(...).to(...) call and adjusted invocation counts.
Service Identifier Generic
packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts
apolloServerServiceIdentifier type widened from ServiceIdentifier<ApolloServer> to ServiceIdentifier<ApolloServer<any>> (eslint-disable comment added for any).
Public API Barrel
packages/apollo-core/src/index.ts
Added exports: value inversifyApolloProviderServiceIdentifier and type InversifyApolloProvider.
NPM Packaging (.npmignore)
packages/apollo-core/.npmignore, packages/apollo-express/.npmignore, packages/apollo-subscription-ws/.npmignore, packages/codegen/.npmignore
Replaced two specific lib spec patterns with consolidated {lib,src}/**/*.spec.{d.ts,d.ts.map,js,js.map} to broaden ignored spec file coverage during packaging.
Express module tests (fluent bind API)
packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
Test mocks extended with to() fluent binding stub; expectations updated to account for an extra bind/to step and increased call counts.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant Container as Inversify Container
  participant Module as ApolloServerContainerModule
  participant ProviderImpl as InversifyApolloProviderImplementation
  participant Apollo as ApolloServer
  participant HTTP as http.Server

  Note over Module,Container: Module load registers bindings
  Module->>Container: bind(apolloServerServiceIdentifier).to(...).inSingletonScope()
  Module->>Container: bind(httpServerServiceIdentifier).to(...).inSingletonScope()
  Module->>Container: bind(inversifyApolloProviderServiceIdentifier).to(ProviderImpl).inSingletonScope()

  Note over Client,Container: Resolution at runtime
  Client->>Container: get(inversifyApolloProviderServiceIdentifier)
  Container->>ProviderImpl: instantiate (injects)
  ProviderImpl->>Container: resolve(apolloServerServiceIdentifier) -> Apollo
  ProviderImpl->>Container: resolve(httpServerServiceIdentifier) -> HTTP
  ProviderImpl->>Client: return { apolloServer: Apollo, httpServer: HTTP }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 I hopped into the DI burrow bright,
Tied server and socket with bindings tight.
A symbol, a class, now all in sync —
Apollo and HTTP, a tidy link. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add InversifyApolloProvider' accurately summarizes the main change in the pull request, which introduces the InversifyApolloProvider interface and related exports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-inversify-apollo-provider

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
packages/apollo-subscription-ws/.npmignore (1)

6-6: Consider removing redundant src/ pattern from spec exclusion.

Line 8 already excludes the entire src/ directory, making the src/**/*.spec.* portion of this pattern redundant. You can simplify to just lib/**/*.spec.{d.ts,d.ts.map,js,js.map} unless the intent is explicit clarity.

packages/apollo-express/.npmignore (1)

6-6: Consider removing redundant src/ pattern from spec exclusion.

Line 8 already excludes the entire src/ directory, making the src/**/*.spec.* portion redundant. Simplify to lib/**/*.spec.{d.ts,d.ts.map,js,js.map} for clarity.

packages/apollo-core/.npmignore (1)

6-6: Consider removing redundant src/ pattern from spec exclusion.

Line 8 already excludes the entire src/ directory, making the src/**/*.spec.* portion redundant. Simplify to lib/**/*.spec.{d.ts,d.ts.map,js,js.map}.

packages/codegen/.npmignore (1)

6-6: Consider removing redundant src/ pattern from spec exclusion.

Line 8 already excludes the entire src/ directory, making the src/**/*.spec.* portion redundant. Simplify to lib/**/*.spec.{d.ts,d.ts.map,js,js.map}.

packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts (1)

5-10: Consider adding JSDoc documentation.

The interface is well-structured with appropriate readonly properties. Adding JSDoc comments would help consumers understand the purpose and usage of this provider interface.

🔎 Suggested documentation
+/**
+ * Provides access to initialized Apollo Server and HTTP Server instances.
+ * This interface is implemented by dependency injection to wire together
+ * the Apollo GraphQL server with its underlying HTTP transport.
+ */
 export interface InversifyApolloProvider {
   // eslint-disable-next-line @typescript-eslint/no-explicit-any
   readonly apolloServer: ApolloServer<any>;

   readonly httpServer: http.Server;
 }
packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts (1)

12-17: Consider adjusting ESLint disable comment placement.

The class implementation correctly uses Inversify decorators and parameter properties. However, the ESLint disable comment on line 13 would be more conventionally placed directly before the type it applies to on line 14.

🔎 Suggested placement
   constructor(
-    @inject(apolloServerServiceIdentifier) // eslint-disable-next-line @typescript-eslint/no-explicit-any
-    public readonly apolloServer: ApolloServer<any>,
+    @inject(apolloServerServiceIdentifier)
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
+    public readonly apolloServer: ApolloServer<any>,
     @inject(httpServerServiceIdentifier)
     public readonly httpServer: http.Server,
   ) {}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3644555 and 98473b2.

📒 Files selected for processing (12)
  • .changeset/open-otters-listen.md
  • packages/apollo-core/.npmignore
  • packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts
  • packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts
  • packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts
  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
  • packages/apollo-core/src/index.ts
  • packages/apollo-express/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/codegen/.npmignore
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use strict mode enabled for TypeScript across all packages

Files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts
  • packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts
  • packages/apollo-core/src/index.ts
  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
**/*.{ts,tsx,js,jsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier with shared configuration from @inversifyjs/foundation-prettier-config

Files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts
  • packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts
  • packages/apollo-core/src/index.ts
  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESLint with shared configuration from @inversifyjs/foundation-eslint-config

Files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts
  • packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts
  • packages/apollo-core/src/index.ts
  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts
  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
**/*.{spec,int.spec,spec-d}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{spec,int.spec,spec-d}.ts: Use Vitest for unit and integration testing with extensive test coverage
Mock external modules using vitest.fn() and vitest.mock() in tests

Files:

  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

Name unit tests with *.spec.ts file extension

Files:

  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
**/*.{spec,int.spec}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{spec,int.spec}.ts: Organize test describe blocks in four-layer structure: Class → Method → Input → Flow scopes
Use descriptive test names with 'when called, and [condition]' pattern

Files:

  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
🧠 Learnings (11)
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{spec,int.spec,spec-d}.ts : Mock external modules using vitest.fn() and vitest.mock() in tests

Applied to files:

  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{spec,int.spec,spec-d}.ts : Use Vitest for unit and integration testing with extensive test coverage

Applied to files:

  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{spec,int.spec}.ts : Organize test describe blocks in four-layer structure: Class → Method → Input → Flow scopes

Applied to files:

  • packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts
  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-19T19:51:35.306Z
Learnt from: notaphplover
Repo: inversify/graphql PR: 6
File: packages/codegen/tsconfig.json:1-10
Timestamp: 2025-12-19T19:51:35.306Z
Learning: In the inversifyjs/graphql-codegen package (packages/codegen/), both tsconfig.json and tsconfig.esm.json exist intentionally, even though they may appear identical. This is part of the planned build strategy.

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.spec-d.ts : Name type tests with *.spec-d.ts file extension for TypeScript type checking tests

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.spec.ts : Name unit tests with *.spec.ts file extension

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.int.spec.ts : Name integration tests with *.int.spec.ts file extension

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/tsconfig*.json : Configure TypeScript with multiple tsconfig files for different output formats (ESM and CommonJS)

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use ESLint with shared configuration from inversifyjs/foundation-eslint-config

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{ts,tsx} : Use strict mode enabled for TypeScript across all packages

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{ts,tsx,js,jsx,json,md} : Use Prettier with shared configuration from inversifyjs/foundation-prettier-config

Applied to files:

  • packages/codegen/.npmignore
  • packages/apollo-subscription-ws/.npmignore
  • packages/apollo-express/.npmignore
  • packages/apollo-core/.npmignore
🧬 Code graph analysis (5)
packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts (1)
packages/apollo-core/src/index.ts (1)
  • InversifyApolloProvider (11-11)
packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts (1)
packages/apollo-core/src/index.ts (1)
  • apolloServerServiceIdentifier (6-6)
packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts (3)
packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts (1)
  • InversifyApolloProvider (5-10)
packages/apollo-core/src/index.ts (2)
  • InversifyApolloProvider (11-11)
  • apolloServerServiceIdentifier (6-6)
packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts (1)
  • apolloServerServiceIdentifier (4-7)
packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts (2)
packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts (1)
  • inversifyApolloProviderServiceIdentifier (5-6)
packages/apollo-core/src/index.ts (1)
  • inversifyApolloProviderServiceIdentifier (8-8)
packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts (2)
packages/apollo-core/src/index.ts (2)
  • inversifyApolloProviderServiceIdentifier (8-8)
  • InversifyApolloProvider (11-11)
packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts (1)
  • InversifyApolloProvider (5-10)
🔇 Additional comments (11)
.changeset/open-otters-listen.md (1)

1-6: LGTM!

The changeset correctly documents the additions and the minor version bump is appropriate for these new public exports.

packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.ts (2)

12-13: LGTM!

The imports are correctly formatted with proper relative paths and .js extensions.


59-62: LGTM!

The binding follows the correct pattern for class-based DI and appropriately uses singleton scope for the provider.

packages/apollo-core/src/index.ts (1)

8-11: LGTM!

The exports are correctly structured with value export for the service identifier and type-only export for the interface. The blank line separation improves readability.

packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts (1)

5-6: LGTM!

The service identifier follows the established pattern and correctly uses Symbol.for() with appropriate typing.

packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts (1)

4-7: LGTM!

The type widening to ApolloServer<any> is appropriate and necessary for compatibility with the new InversifyApolloProvider interface. The use of any for Apollo's context type is pragmatic given that the context type is user-defined.

packages/apollo-core/src/apollo/modules/ApolloServerContainerModule.spec.ts (5)

19-19: LGTM!

The import is correctly added with proper file extension.


41-50: LGTM!

The mock setup correctly extends the fluent syntax mock to include the to method with mockReturnThis() for proper method chaining.


70-79: LGTM!

The test correctly verifies that the new inversifyApolloProviderServiceIdentifier binding is registered, with the bind call count properly updated from 2 to 3.


105-110: LGTM!

The new test case properly verifies that bind.to() is called once with a function (the InversifyApolloProviderImplementation class constructor), following the established test patterns.

Based on learnings, the test structure follows the recommended four-layer organization and uses Vitest correctly.


112-119: LGTM!

The singleton scope call count is correctly updated from 2 to 3 to reflect the additional binding.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts (1)

12-17: LGTM!

The constructor correctly implements dependency injection using Inversify's @inject decorators. The use of public readonly parameter shorthand is idiomatic TypeScript, and the implementation properly matches the InversifyApolloProvider interface.

💡 Optional: Consider repositioning the ESLint disable comment

The ESLint disable comment on line 13 is functional but appears after the decorator on the same line. A more conventional placement would be on its own line:

   constructor(
+    // eslint-disable-next-line @typescript-eslint/no-explicit-any
     @inject(apolloServerServiceIdentifier)
-    // eslint-disable-next-line @typescript-eslint/no-explicit-any
     public readonly apolloServer: ApolloServer<any>,
     @inject(httpServerServiceIdentifier)
     public readonly httpServer: http.Server,
   ) {}

This improves readability by separating concerns, though the current format works correctly.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98473b2 and 5dfe875.

📒 Files selected for processing (2)
  • packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/apollo-core/src/apollo/models/inversifyApolloProviderServiceIdentifier.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use strict mode enabled for TypeScript across all packages

Files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
**/*.{ts,tsx,js,jsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier with shared configuration from @inversifyjs/foundation-prettier-config

Files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESLint with shared configuration from @inversifyjs/foundation-eslint-config

Files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
🧠 Learnings (1)
📚 Learning: 2025-12-19T19:51:35.306Z
Learnt from: notaphplover
Repo: inversify/graphql PR: 6
File: packages/codegen/tsconfig.json:1-10
Timestamp: 2025-12-19T19:51:35.306Z
Learning: In the inversifyjs/graphql-codegen package (packages/codegen/), both tsconfig.json and tsconfig.esm.json exist intentionally, even though they may appear identical. This is part of the planned build strategy.

Applied to files:

  • packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts
🧬 Code graph analysis (1)
packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts (3)
packages/apollo-core/src/index.ts (2)
  • InversifyApolloProvider (11-11)
  • apolloServerServiceIdentifier (6-6)
packages/apollo-core/src/apollo/modules/InversifyApolloProvider.ts (1)
  • InversifyApolloProvider (5-10)
packages/apollo-core/src/apollo/models/apolloServerServiceIdentifier.ts (1)
  • apolloServerServiceIdentifier (4-7)
🔇 Additional comments (2)
packages/apollo-core/src/apollo/modules/InversifyApolloProviderImplementation.ts (2)

6-8: Previous critical issue resolved.

The .js extensions are now correctly included in all relative imports, ensuring proper ESM module resolution. This addresses the previous critical review comment.


10-11: LGTM!

The class declaration correctly uses the @injectable() decorator and implements the InversifyApolloProvider interface, following standard Inversify DI patterns.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts (2)

153-160: Consider verifying all toResolvedValue() calls.

The change from nth-call assertions to direct toHaveBeenCalledWith checks improves test resilience. However, the test verifies only 2 out of 4 toResolvedValue() calls. If the other 2 calls are also critical bindings, consider adding explicit assertions for them.

If all 4 calls should be verified, consider adding assertions for the remaining calls:

// Existing assertions
expect(bindToFluentSyntaxMock.toResolvedValue).toHaveBeenCalledWith(
  expect.any(Function),
  [httpApplicationServiceIdentifier],
);
expect(bindToFluentSyntaxMock.toResolvedValue).toHaveBeenCalledWith(
  expect.any(Function),
  [httpServerServiceIdentifier],
);

// Add assertions for the other 2 calls if they're significant
// For example, if one is for the new InversifyApolloProvider:
expect(bindToFluentSyntaxMock.toResolvedValue).toHaveBeenCalledWith(
  expect.any(Function),
  [/* appropriate service identifier */],
);

77-77: Optional: Consider more formal test naming.

The test name 'when called load()' works but could be slightly more formal. Per coding guidelines, consider: 'when called, and load() is invoked' or simply 'when load() is called'.

As per coding guidelines, use the 'when called, and [condition]' pattern more formally:

-    describe('when called load()', () => {
+    describe('when load() is called', () => {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5dfe875 and f272177.

📒 Files selected for processing (1)
  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use strict mode enabled for TypeScript across all packages

Files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
**/*.{spec,int.spec,spec-d}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{spec,int.spec,spec-d}.ts: Use Vitest for unit and integration testing with extensive test coverage
Mock external modules using vitest.fn() and vitest.mock() in tests

Files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (AGENTS.md)

Name unit tests with *.spec.ts file extension

Files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
**/*.{spec,int.spec}.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{spec,int.spec}.ts: Organize test describe blocks in four-layer structure: Class → Method → Input → Flow scopes
Use descriptive test names with 'when called, and [condition]' pattern

Files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
**/*.{ts,tsx,js,jsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier with shared configuration from @inversifyjs/foundation-prettier-config

Files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use ESLint with shared configuration from @inversifyjs/foundation-eslint-config

Files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
🧠 Learnings (3)
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{spec,int.spec,spec-d}.ts : Mock external modules using vitest.fn() and vitest.mock() in tests

Applied to files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{spec,int.spec,spec-d}.ts : Use Vitest for unit and integration testing with extensive test coverage

Applied to files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
📚 Learning: 2025-12-24T10:31:07.649Z
Learnt from: CR
Repo: inversify/graphql PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-24T10:31:07.649Z
Learning: Applies to **/*.{spec,int.spec}.ts : Organize test describe blocks in four-layer structure: Class → Method → Input → Flow scopes

Applied to files:

  • packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts
🧬 Code graph analysis (1)
packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts (1)
packages/apollo-core/src/apollo/models/apolloServerPluginsServiceIdentifier.ts (1)
  • apolloServerPluginsServiceIdentifier (4-7)
🔇 Additional comments (3)
packages/apollo-express/src/apollo/modules/ApolloExpressServerContainerModule.spec.ts (3)

80-80: LGTM: Mock extended to support .to() binding.

The addition of the to mock property correctly extends the fluent binding interface to support the .to() method, which is part of Inversify's binding API. The mockReturnThis() implementation is appropriate for fluent chaining.

Also applies to: 97-97


179-179: LGTM: Singleton scope count updated correctly.

The increase from 5 to 6 inSingletonScope() calls correctly reflects the additional singleton binding in the container module.


124-144: The test is correct; inversifyApolloProviderServiceIdentifier is bound in the parent class, not in this module.

The inversifyApolloProviderServiceIdentifier binding is defined in the parent class ApolloServerContainerModule (in packages/apollo-core), not in ApolloExpressServerContainerModule. The parent class test verifies this binding explicitly. The child class test correctly expects 8 total bind() calls (3 from parent + 5 from this module) and properly verifies all 5 bindings specific to this module at positions 4–8. No additional assertions are needed.

Likely an incorrect or invalid review comment.

@notaphplover notaphplover merged commit 1290083 into master Dec 26, 2025
7 checks passed
@notaphplover notaphplover deleted the feat/add-inversify-apollo-provider branch December 26, 2025 12:02
@coderabbitai coderabbitai bot mentioned this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant