feat(page): 'page property' with auto-pagination (fixes silent >25-item truncation)#46
Merged
Conversation
… / rich_text Closes #38. Fixes silent truncation of property values with >25 items. Problem: 'notion page view' and 'notion page props' both call GET /v1/pages/:id, which returns every property in a single response but truncates values at 25 items. A relation pointing to 40 pages silently loses 15. Fix: New 'page property' subcommand wraps GET /v1/pages/:id/properties/:id and walks next_cursor until has_more is false, merging results[] into a single response. Interface: notion page property <page-id> <property-id> notion page property <page-id> --name "References" # resolve id by name notion page property <page-id> <property-id> --page-size 50 Implementation: - fetchPagePropertyAllPages handles both paginated ('list' object) and non-paginated ('property_item' object) response shapes. - findPropertyIDByName scans page.properties map for --name lookups; error message includes the list of available names. - renderPageProperty prints a human-friendly summary; summarizePropertyItem covers relation / rich_text / title / people / number types with a JSON fallback for anything else. Tests: - TestFetchPagePropertyAllPages_FollowsCursors spins up a 3-page httptest server and asserts all 4 items are merged with has_more=false. - Passthrough test for 'property_item' (non-paginated) shape. - findPropertyIDByName: found / missing / malformed page. Smoke-tested against a real database: --name resolves correctly, positional property-id works, 'title' non-paginated path returns the expected single item, and both conflict / not-found errors fire cleanly.
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.
Closes #38. Wraps
GET /v1/pages/:id/properties/:idand walks cursors until complete.page property <page-id> <property-id>— positional form.page property <page-id> --name "References"— resolves id by name.--page-sizetunes underlying batch size.Handles both
list(paginated) andproperty_item(single value) response shapes.Unit tests via httptest for 3-page cursor walk; integration smoke against a real DB for
--nameresolution + error paths.