fix(codegen): replace graphql-ws type import with inline shims in orm-realtime template#1102
Open
pyramation wants to merge 1 commit intomainfrom
Open
fix(codegen): replace graphql-ws type import with inline shims in orm-realtime template#1102pyramation wants to merge 1 commit intomainfrom
pyramation wants to merge 1 commit intomainfrom
Conversation
…-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.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
orm-realtime.tscodegen template usedtype WsClient = import('graphql-ws').Clientwhich requiresgraphql-wsto be resolvable at compile time in every generated SDK, even though the actualrequire('graphql-ws')is lazy inside theRealtimeManagerconstructor (only called when subscriptions are used).This caused TypeScript build failures in
constructive-db's SDK packages wheregraphql-wsis 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 runtimerequire('graphql-ws')remains lazy — consumers that never use subscriptions never need the package.Review & Testing Checklist for Human
WsClientinterface matches thegraphql-wsClientAPI forsubscribe()anddispose()— ifgraphql-wsadds methods we use later, the shim needs updatingconstructive-dbshould produce self-containedrealtime.tsfilesNotes
Companion fix already pushed to
constructive-dbPR #1089 (deps-update/20260510-105803branch) to unblock CI there immediately.Link to Devin session: https://app.devin.ai/sessions/37cd48fd674844c8b6fa1be2b7995746
Requested by: @pyramation