feat(types): add pagination params and paginated response helpers - #204
Merged
Merged
Conversation
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).
|
@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! 🚀 |
Contributor
Author
|
@K1NGD4VID please review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements shared pagination contracts in
@astroid/typesfor issue #111.PaginationParams— optionalpage,cursor,limit,orderrequest 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 withnextCursor,page,limit,total,hasMorealongside the existingcursor.pagination.test.ts) — structuralexpectTypeOfassertions and compile checks coveringPaginationParams,PaginatedResponse<T>,Paginated<T>,PaginationMeta,CursorPaginationParams,CursorPaginated<T>, andResponseMeta.While rebasing onto
upstream/mainI found main's@astroid/typesdid not compile (tests could not even run). This PR also makes the package green:common.ts: dropped a duplicatedApiError/ApiErrorCodeblock (duplicateexportbroke the whole module).analytics.ts: removed the shadowingPaginatedResponsealias, fixedTimeSeriesMetricPoint→TimeSeriesPoint, and boundAnalyticsListParamsto the existingAnalyticsQueryParams.budget.ts: added the missingPaginationParamsimport,BudgetPeriodnow imported fromenums, restored theBudgetAllocationStateunion.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.Note
pnpm build/pnpm typecheckacross the whole workspace still fails inpackages/core(missing exports inhttp-types.ts) andpackages/analytics/packages/agent/packages/budgetonmain, independent of this change.Closes #111