Skip to content

feat(indexer): document GraphQLIndexer.query return contract and add generic return typing (closes #599) - #682

Open
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:feat/issue-599-document-graphqlindexer-query-return-contract
Open

feat(indexer): document GraphQLIndexer.query return contract and add generic return typing (closes #599)#682
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:feat/issue-599-document-graphqlindexer-query-return-contract

Conversation

@Ranjeet2063

Copy link
Copy Markdown

Summary

Documents the unwrapped data return contract of GraphQLIndexer.query() and equips the method with strongly-typed generic return support query<T = unknown>(): Promise<T> (closes #599).

Changes

  • src/indexer.ts:
    • Updated query method signature to async query<T = unknown>(options: GraphQLQueryOptions): Promise<T> and cast return payload to T.
    • Added comprehensive JSDoc detailing the unwrapped return contract (body.data vs { data, errors } envelope) and usage examples with TypeScript interfaces.
  • docs/api.md:
    • Documented ### query<T = unknown>(options) → Promise<T> with a prominent note clarifying the unwrapped body.data payload and generic typing.
  • src/tests/graphql-indexer-query-return-contract.test.ts:
    • Added 4 unit tests verifying unwrapped payload delivery, generic type parameter propagation, null payload handling, ConduitError on GraphQL error responses, and APQ hash miss retry unwrapping.

Verification

  • 16/16 unit tests passing across indexer test suites.
  • Clean TypeScript compilation (tsc --noEmit).
  • Zero ESLint errors.
  • Successful ESM and CJS production Rollup builds.

Copilot AI lite review requested due to automatic review settings September 5, 2026 22:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Document GraphQLIndexer.query() return contract (unwrapped data)

2 participants