Skip to content

feat(page): 'page property' with auto-pagination (fixes silent >25-item truncation)#46

Merged
4ier merged 1 commit into
mainfrom
feat/page-property
Apr 30, 2026
Merged

feat(page): 'page property' with auto-pagination (fixes silent >25-item truncation)#46
4ier merged 1 commit into
mainfrom
feat/page-property

Conversation

@4ier
Copy link
Copy Markdown
Owner

@4ier 4ier commented Apr 30, 2026

Closes #38. Wraps GET /v1/pages/:id/properties/:id and walks cursors until complete.

  • page property <page-id> <property-id> — positional form.
  • page property <page-id> --name "References" — resolves id by name.
  • --page-size tunes underlying batch size.

Handles both list (paginated) and property_item (single value) response shapes.

Unit tests via httptest for 3-page cursor walk; integration smoke against a real DB for --name resolution + error paths.

… / 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.
@4ier 4ier merged commit cd7512d into main Apr 30, 2026
3 of 4 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.

page property: fix silent truncation of relation / rollup values (>25 items)

1 participant