Skip to content

feat(relay)!: make pagination ORM-independent - #2202

Merged
9renpoto merged 1 commit into
mainfrom
codex/relay-orm-independent
Nov 27, 2026
Merged

9renpoto merged 1 commit into
mainfrom
codex/relay-orm-independent

Conversation

@9renpoto

Copy link
Copy Markdown
Member

Summary

  • Make nestjs-graphql-relay pagination ORM-independent. The page loader receives an offset and limit and returns the page rows and total match count.
  • Move the example to node:sqlite and remove TypeORM, the SQLite npm add-on, and the test-time rebuild step.
  • Keep the existing GraphQL connection shape and offset cursor encoding. The example opens the same SQLite file and reads the existing recipes table.

Breaking change and migration

findAndPaginate(condition, args, repository) becomes findAndPaginate(args, loadPage). TypeORM applications can move their existing findAndCount call into the loader and declare their ORM dependencies directly. The package README includes a migration example.

This change targets the next major release. The scheduled version bump is minor, so the release needs to use the manual major bump. The workspace and example now require Node.js 22.13 or later.

Addresses #2201 by removing the TypeORM dependency.

Validation

  • Workspace build, type checks, and all 29 tests on Node.js 26.
  • Six focused tests on Node.js 22.13.0, including the GraphQL queries and reading a SQLite file with the previous schema.
  • Packed package smoke test in a separate installation without TypeORM or the SQLite npm add-on.
日本語

nestjs-graphql-relay は、ページの行と総件数を取得する関数を受け取り、Relay connection を組み立てます。旧 API の利用者はリポジトリのクエリをその関数へ移してください。README に TypeORM からの移行例があります。

サンプルは node:sqlite へ移行し、既存形式の DB ファイルを引き続き読み込みます。開発とサンプルの最低対応版は Node.js 22.13 です。公開 API の変更は次のメジャーリリース向けです。

Node.js 26 でビルド、型チェック、全 29 テスト、Node.js 22.13.0 で関連 6 テストが通過しました。ORM を含まない環境で npm パッケージからの動作も確認しました。

Move database access into the page loader and use the built-in SQLite module in the example.

BREAKING CHANGE: Pass connection arguments and a page loader to findAndPaginate. The example and workspace require Node.js 22.13 or newer.
@9renpoto 9renpoto added the Type: Breaking Change Includes breaking changes label Nov 27, 2026
@9renpoto 9renpoto self-assigned this Nov 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T02:43:19.063815Z 0fa4a02 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (8d0b896) #2202 (a5e015d) +/-
Coverage 96.6% 97.0% +0.3%
Test Execution Time 1s 2s +1s
Details
  |                     | main (8d0b896) | #2202 (a5e015d) |  +/-  |
  |---------------------|----------------|-----------------|-------|
+ | Coverage            |          96.6% |           97.0% | +0.3% |
  |   Files             |             22 |              22 |     0 |
  |   Lines             |            603 |             600 |    -3 |
- |   Covered           |            583 |             582 |    -1 |
- | Test Execution Time |             1s |              2s |   +1s |

Code coverage of files in pull request scope (97.8% → 100.0%, patch 100.0%)

Files Coverage +/- Patch Coverage Status
packages/nestjs-graphql-relay/src/index.ts 100.0% +2.1% 100.0% modified

Reported by octocov

@9renpoto
9renpoto merged commit 24e93f3 into main Nov 27, 2026
11 checks passed
@9renpoto
9renpoto deleted the codex/relay-orm-independent branch November 27, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Breaking Change Includes breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant