Skip to content

Commit e44ef8a

Browse files
designcodeclaude
andauthored
fix(iam): return paginationToken from listPolicies (#206)
The AWS-standard ListPolicies response nests IsTruncated and Marker inside ListPoliciesResult, but they were read from the top level, so the next-page token was always undefined — callers could never page past the first result set. Read them from ListPoliciesResult, gated on IsTruncated, matching the existing listPoliciesForAccessKey handling. Assisted-by: Claude Opus 4.8 via Claude Code Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent bb29d3a commit e44ef8a

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tigrisdata/iam": patch
3+
---
4+
5+
Fix `listPolicies` never returning a `paginationToken`. The `IsTruncated` and `Marker` fields are nested inside `ListPoliciesResult` in the API response, but were being read from the top level, so the next-page token was always `undefined`.

packages/iam/src/lib/policy/list.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export type ListPoliciesResponse = {
1515
};
1616

1717
type ListPoliciesApiResponse = {
18-
IsTruncated: boolean;
19-
Marker?: string;
2018
ListPoliciesResult: {
19+
IsTruncated: boolean;
20+
Marker?: string;
2121
Policies: Array<{
2222
Arn: string;
2323
AttachmentCount: number;
@@ -75,8 +75,9 @@ export async function listPolicies(
7575

7676
return {
7777
data: {
78-
paginationToken:
79-
response.data.Marker !== '' ? response.data.Marker : undefined,
78+
paginationToken: response.data.ListPoliciesResult?.IsTruncated
79+
? response.data.ListPoliciesResult.Marker || undefined
80+
: undefined,
8081
policies:
8182
response.data.ListPoliciesResult?.Policies?.map((policy) => ({
8283
attachmentCount: policy.AttachmentCount,

0 commit comments

Comments
 (0)