feat(graphql-codegen): realtime subscriptions SDK + e2e harness#1206
Draft
yyyyaaa wants to merge 5 commits into
Draft
feat(graphql-codegen): realtime subscriptions SDK + e2e harness#1206yyyyaaa wants to merge 5 commits into
yyyyaaa wants to merge 5 commits into
Conversation
Surface per-table subscription capabilities from the schema introspector so downstream codegen can decide whether to emit realtime subscription bindings.
Generate a per-table realtime subscription surface alongside the existing ORM and React Query outputs. Adds a RealtimeManager runtime with discriminated ConnectionState, AsyncIterable events(), onConnectionStateChange replay, and a close() lifecycle, plus the generator wiring that emits typed subscribe() methods on each model and the supporting templates.
Add unit coverage for the RealtimeManager runtime contract, a compile-check test for the generated subscription output, and refresh model/client/hook snapshots plus introspection tests to reflect the new subscription metadata.
…bscription SDK Introduce a private package that compiles the generated ORM and React Query realtime output and exercises it against a real PostgreSQL + PostGraphile + graphql-ws stack. Covers subscribe, events() AsyncIterable, unsubscribe, onConnectionStateChange replay, close(), and the React hook lifecycle without mocks so the SDK contract is validated against actual LISTEN/NOTIFY traffic.
Record the new realtime subscription work in the graphql-query and graphql-codegen changelogs, bump their versions, and refresh pnpm-lock to pick up the new e2e harness package.
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
Generate a realtime subscriptions SDK (ORM
subscribe()+events()AsyncIterable + React Query hook) from the GraphQL schema, with aRealtimeManagerruntime that exposes a discriminatedConnectionState,onConnectionStateChangereplay, and aclose()lifecycle. Ship a private e2e harness (graphile-realtime-codegen-e2e) that compiles the generated output and exercises it against real PostgreSQL + PostGraphile + graphql-ws so the SDK contract is validated against actual LISTEN/NOTIFY traffic, not mocks.Commits
feat(graphql-query)— expose subscription metadata from introspection so codegen can decide whether to emit subscription bindings per table.feat(graphql-codegen)— RealtimeManager runtime + generator wiring + templates for the realtime SDK.test(graphql-codegen)— RealtimeManager unit coverage, subscription compile check, and refreshed model/client/hook/introspection snapshots.test(graphile-realtime-codegen-e2e)— new private package that compiles generated ORM + hooks and runs end-to-end against real PG + WS + PostGraphile (no mocks).chore— CHANGELOG entries, version bumps forgraphql-queryandgraphql-codegen, and pnpm-lock refresh.Verification
graphql/codegenunit + snapshot suite passes locally (381 tests, 124 snapshots).graphile/graphile-realtime-codegen-e2e/againstconstructiveio/postgres-plus(3 ORM + 6 React hook / lifecycle / AsyncIterable tests).Test plan
graphql/codegenconstructiveio/postgres-plus:pgpm docker start --image constructiveio/postgres-plus --recreate && eval "$(pgpm env)"pnpm --filter @constructive-io/graphile-realtime-codegen-e2e testsubscribe()typing in a downstream consumer