Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Change PaginatorHttp.values to a generator #1217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

neet
Copy link
Owner

@neet neet commented Oct 14, 2024

No description provided.

Copy link

size-limit report 📦

Path Size
./dist/index.js 6.26 KB (-1.01% 🔽)

@neet neet requested a review from Copilot March 26, 2025 03:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the PaginatorHttp implementation by replacing its promise‐like pagination API (using next, return, and throw) with an async generator interface using values(). In addition, the associated tests and the main paginator interface have been updated to reflect these changes.

  • Refactored PaginatorHttp to yield items via an async generator (values()) instead of returning promises.
  • Removed legacy methods such as next, return, throw, and clone from both implementation and tests.
  • Updated tests in both the action adapter and REST search spec to use the new generator-based API.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/adapters/action/paginator-http.ts Updated to use an async generator for pagination and removed legacy methods
src/adapters/action/paginator-http.spec.ts Adjusted tests to call values() and removed tests for deprecated methods
tests/rest/v2/search.spec.ts Updated to iterate using values() from the search list response
src/mastodon/paginator.ts Modified the interface to extend AsyncIterable and removed legacy promise methods

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.

1 participant