Skip to content

feat(types): add pagination params and paginated response helpers - #204

Merged
K1NGD4VID merged 1 commit into
ASTROIDX556:mainfrom
charlesejemai-cyber:issue111noastroid
Sep 2, 2026
Merged

feat(types): add pagination params and paginated response helpers#204
K1NGD4VID merged 1 commit into
ASTROIDX556:mainfrom
charlesejemai-cyber:issue111noastroid

Conversation

@charlesejemai-cyber

Copy link
Copy Markdown
Contributor

What

Implements shared pagination contracts in @astroid/types for issue #111.

  • PaginationParams — optional page, cursor, limit, order request parameters (offset- and cursor-based).
  • PaginatedResponse<T> — generic response envelope (data: T[], meta?: ResponseMeta), now the canonical export (previously shadowed by an analytics alias, which made the package export ambiguous and broke consumers like @astroid/agent / @astroid/budget).
  • ResponseMeta — documented and enriched with nextCursor, page, limit, total, hasMore alongside the existing cursor.
  • Unit tests (pagination.test.ts) — structural expectTypeOf assertions and compile checks covering PaginationParams, PaginatedResponse<T>, Paginated<T>, PaginationMeta, CursorPaginationParams, CursorPaginated<T>, and ResponseMeta.

While rebasing onto upstream/main I found main's @astroid/types did not compile (tests could not even run). This PR also makes the package green:

  • common.ts: dropped a duplicated ApiError / ApiErrorCode block (duplicate export broke the whole module).
  • analytics.ts: removed the shadowing PaginatedResponse alias, fixed TimeSeriesMetricPointTimeSeriesPoint, and bound AnalyticsListParams to the existing AnalyticsQueryParams.
  • budget.ts: added the missing PaginationParams import, BudgetPeriod now imported from enums, restored the BudgetAllocationState union.

Validation

  • pnpm --filter @astroid/types test → 63 tests pass (12 new pagination tests).
  • pnpm --filter @astroid/types typecheck → clean.
  • pnpm --filter @astroid/types build → ESM/CJS/DTS success.
  • Prettier + ESLint clean on all touched files.

Note

pnpm build / pnpm typecheck across the whole workspace still fails in packages/core (missing exports in http-types.ts) and packages/analytics/packages/agent/packages/budget on main, independent of this change.

Closes #111

Implement the shared pagination contracts for @astroid/types (Closes ASTROIDX556#111):
PaginationParams and PaginatedResponse<T>, plus cursor- and offset-based
metadata (nextCursor, page, limit, total, hasMore) on ResponseMeta.

- common.ts: add PaginationParams; document and enrich ResponseMeta fields;
  remove duplicated ApiError/ApiErrorCode block that broke compilation.
- analytics.ts: drop the shadowing PaginatedResponse alias so the canonical
  type is exported unambiguously; fix TimeSeriesMetricPoint typo; bind
  AnalyticsListParams to AnalyticsQueryParams.
- budget.ts: import PaginationParams and BudgetPeriod from enums; restore
  BudgetAllocationState definition.
- tests: structural type assertions and compile checks for all pagination
  types (PaginationParams, PaginatedResponse, Paginated, PaginationMeta,
  CursorPaginationParams, CursorPaginated, ResponseMeta).
@drips-wave

drips-wave Bot commented Sep 2, 2026

Copy link
Copy Markdown

@charlesejemai-cyber Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@charlesejemai-cyber

Copy link
Copy Markdown
Contributor Author

@K1NGD4VID please review

@K1NGD4VID
K1NGD4VID merged commit 1d06cd9 into ASTROIDX556:main Sep 2, 2026
2 of 3 checks 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.

Implement pagination response helpers and parameters in @astroid/types

2 participants