Skip to content

feat(adapter-linear): extract canonical Linear GraphQL queries + filter builders + response types#26

Merged
khaliqgant merged 3 commits intomainfrom
feat/linear-queries-module
Apr 26, 2026
Merged

feat(adapter-linear): extract canonical Linear GraphQL queries + filter builders + response types#26
khaliqgant merged 3 commits intomainfrom
feat/linear-queries-module

Conversation

@kjgbot
Copy link
Copy Markdown
Contributor

@kjgbot kjgbot commented Apr 26, 2026

Summary

First of three extract PRs for relayfile-adapters#24. Adds a canonical Linear GraphQL queries + filter builders + response types module under .

Bump: @relayfile/adapter-linear minor → 0.2.0.

What changed

  • New packages/linear/src/queries.ts with 10 canonical query strings, 5 reusable field-selection constants, 2 filter builders, and 4 response type definitions.
  • Re-exported from packages/linear/src/index.ts.
  • Tests in packages/linear/src/queries.test.ts covering snapshot, filter builder behaviour, and edge cases.

Sources

Live verification

Every query in this PR was POSTed through the real Nango proxy using sage NANGO_SECRET_KEY, with the connection ID dynamically discovered via nango.listConnections(). All queries returned non-error responses with the expected top-level shape. This catches schema drift at extract time.

Follow-up PRs

After this PR merges and @relayfile/adapter-linear@0.2.0 republishes:

  • cloud refactor: import shared queries, drop local copies in route.ts + apifallback
  • sage refactor: same for nango-integrations/linear-sage/syncs/*

Validation

  • npm test --workspace @relayfile/adapter-linear green
  • tsc -p packages/linear/tsconfig.json --noEmit clean
  • Live Nango proxy verification passed for all queries
  • Self-reviewed against cloud + sage consumers (UNION of fields)
  • Peer-reviewed by Claude Opus

🤖 Generated with Claude Code

RelayFile Adapters Bot and others added 3 commits April 26, 2026 19:41
…er builders + response types

Tracks relayfile-adapters#24 — one canonical home for Linear API knowledge
so cloud route.ts, cloud apifallback, and sage nango-integrations syncs
all consume the same queries instead of holding ~10 duplicate copies.

New exports under @relayfile/adapter-linear:
  - LINEAR_LIST_ISSUES_QUERY, LINEAR_SEARCH_ISSUES_QUERY, LINEAR_GET_ISSUE_QUERY
  - LINEAR_LIST_PROJECTS_QUERY, LINEAR_LIST_COMMENTS_QUERY
  - LINEAR_LIST_TEAMS_QUERY, LINEAR_LIST_USERS_QUERY
  - LINEAR_LIST_MILESTONES_QUERY, LINEAR_LIST_ROADMAPS_QUERY
  - LINEAR_FETCH_ACTIVE_ISSUES_QUERY (the sage incremental sync filter)
  - Field-selection constants: LINEAR_ISSUE_FIELDS, _PROJECT_FIELDS, _COMMENT_FIELDS, _TEAM_FIELDS, _USER_FIELDS
  - buildLinearIssueFilter() + buildLinearProjectFilter() (loose params → typed Linear filter shape)
  - Response types: LinearIssueNode, LinearProjectNode, LinearCommentNode, LinearGraphqlResponse<T>

Field selections are the UNION of what cloud + sage consumers read. Validated
against:
  1. Nango integration-templates for Linear (canonical baseline)
  2. sage nango-integrations/linear-sage/syncs/*.ts (production-proven)
  3. cloud packages/web/app/api/v1/linear/query/route.ts + apifallback (consumers)

Live verification:
  Every query was POSTed through the real Nango proxy using sage NANGO_SECRET_KEY,
  with connection IDs dynamically discovered via nango.listConnections(). All queries
  returned non-error responses with the expected shape. Catches schema drift at
  extract time so we never publish a query that 422s in production.

Version: minor bump (additive — new exports, no breaking changes).

Follow-up PRs (tracked in relayfile-adapters#24):
  - cloud refactor: import from @relayfile/adapter-linear, drop local copies
  - sage refactor: same for nango-integrations/linear-sage/syncs/*

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit 550e0aa into main Apr 26, 2026
1 check passed
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.

2 participants