Skip to content

fix(codegen): replace graphql-ws type import with inline shims in orm-realtime template#1102

Open
pyramation wants to merge 1 commit intomainfrom
feat/realtime-inline-graphql-ws-types
Open

fix(codegen): replace graphql-ws type import with inline shims in orm-realtime template#1102
pyramation wants to merge 1 commit intomainfrom
feat/realtime-inline-graphql-ws-types

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

The orm-realtime.ts codegen template used type WsClient = import('graphql-ws').Client which requires graphql-ws to be resolvable at compile time in every generated SDK, even though the actual require('graphql-ws') is lazy inside the RealtimeManager constructor (only called when subscriptions are used).

This caused TypeScript build failures in constructive-db's SDK packages where graphql-ws is not (and should not be) a dependency.

Fix: Replace the type-level import with minimal inline type shims (WsClient, WsClientOptions, WsSink, WsExecutionResult) that capture exactly the API surface we use. The runtime require('graphql-ws') remains lazy — consumers that never use subscriptions never need the package.

Review & Testing Checklist for Human

  • Verify the inline WsClient interface matches the graphql-ws Client API for subscribe() and dispose() — if graphql-ws adds methods we use later, the shim needs updating
  • After merging, next codegen run in constructive-db should produce self-contained realtime.ts files

Notes

Companion fix already pushed to constructive-db PR #1089 (deps-update/20260510-105803 branch) to unblock CI there immediately.

Link to Devin session: https://app.devin.ai/sessions/37cd48fd674844c8b6fa1be2b7995746
Requested by: @pyramation

…-realtime template

The orm-realtime.ts template used `type WsClient = import('graphql-ws').Client`
which requires graphql-ws to be resolvable at compile time in every SDK
consumer, even though the actual require() is lazy inside the
RealtimeManager constructor.

Replace with minimal inline type definitions (WsClient, WsClientOptions,
WsSink, WsExecutionResult) so generated code compiles without graphql-ws
as a dependency. Consumers that never use subscriptions never need the
package at all.
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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