fix(export-to-csv): paginate org user fetch for organization owners#150
Draft
cs-raj wants to merge 3 commits into
Draft
fix(export-to-csv): paginate org user fetch for organization owners#150cs-raj wants to merge 3 commits into
cs-raj wants to merge 3 commits into
Conversation
harshitha-cstk
previously approved these changes
May 18, 2026
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
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.
Summary
Fixes incomplete user exports in
cm:export-to-csvwhen the logged-in user is the organization owner.getInvitations()with no pagination params, so the API returned only the default page (~10 users).getUsers()helper, which paginatesgetInvitations()withskipandlimituntil all users are fetched.Problem
getOrgUsers()inapi-client.tshad two code paths:getInvitations()call — no paginationgetUsers()loop withskip/limitBoth roles hit the same Management API endpoint; only the owner branch skipped pagination. This caused CSV exports to include a partial user list for owners while admins saw the full list (e.g. 66 vs 10 users).
Solution
getInvitations()branch.getUsers()usingconfig.limit(100).Changes
packages/contentstack-export-to-csv/src/utils/api-client.ts— unifygetOrgUsersfetch logicpackages/contentstack-export-to-csv/test/unit/utils/api-client.test.ts— add pagination and access-control testspackages/contentstack-export-to-csv/package.json— version bump to2.0.0-beta.8Test plan
pnpm test:unitincontentstack-export-to-csv(91 tests passing)csdx cm:export-to-csv --action users --org <org-uid>as owner on an org with 10+ users