Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/cli",
"description": "A command line interface for programmatic operations across Transcend.",
"version": "8.38.0",
"version": "8.39.0",
"homepage": "https://github.com/transcend-io/cli",
"repository": {
"type": "git",
Expand Down
19 changes: 13 additions & 6 deletions src/lib/graphql/fetchAllRequestIdentifierMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface RequestIdentifierMetadata {
isVerifiedAtLeastOnce: boolean;
}

const PAGE_SIZE = 50;
const PAGE_SIZE = 2000;

/**
* Fetch all request identifier metadata for a particular request
Expand Down Expand Up @@ -41,31 +41,38 @@ export async function fetchAllRequestIdentifierMetadata(
const resolvedRequestIds =
requestIds ?? (requestId ? [requestId] : undefined);
const requestIdentifiers: RequestIdentifierMetadata[] = [];
let offset = 0;
let cursor: string | undefined;

// Paginate
let shouldContinue = false;
do {
const {
requestIdentifiers: { nodes },
requestIdentifiers: { nodes, pageInfo },
} = await makeGraphQLRequest<{
/** Request Identifiers */
requestIdentifiers: {
/** List */
nodes: RequestIdentifierMetadata[];
/** Pagination info */
pageInfo: {
/** Cursor for the last item */
endCursor: string | null;
/** Whether more pages exist */
hasNextPage: boolean;
};
};
}>(client, REQUEST_IDENTIFIERS, {
first: PAGE_SIZE,
offset,
after: cursor,
requestIds: resolvedRequestIds,
updatedAtBefore: updatedAtBefore
? updatedAtBefore.toISOString()
: undefined,
updatedAtAfter: updatedAtAfter ? updatedAtAfter.toISOString() : undefined,
});
requestIdentifiers.push(...nodes);
offset += PAGE_SIZE;
shouldContinue = nodes.length === PAGE_SIZE;
cursor = pageInfo.endCursor ?? undefined;
shouldContinue = pageInfo.hasNextPage;
} while (shouldContinue);

return requestIdentifiers;
Expand Down
24 changes: 16 additions & 8 deletions src/lib/graphql/fetchAllRequestIdentifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ const RequestIdentifier = t.type({
/** Type override */
export type RequestIdentifier = t.TypeOf<typeof RequestIdentifier>;

const PAGE_SIZE = 50;
const PAGE_SIZE = 100;

const PageInfo = t.type({
endCursor: t.union([t.string, t.null]),
hasNextPage: t.boolean,
});

export const RequestIdentifiersResponse = t.type({
identifiers: t.array(RequestIdentifier),
pageInfo: PageInfo,
});

/**
Expand All @@ -45,11 +51,11 @@ export async function fetchAllRequestIdentifiers(
requestId,
}: {
/** ID of request to filter on */
requestId: string;
},
requestId?: string;
} = {},
): Promise<RequestIdentifier[]> {
const requestIdentifiers: RequestIdentifier[] = [];
let offset = 0;
let cursor: string | undefined;
let shouldContinue = false;

// determine sombra version
Expand Down Expand Up @@ -81,10 +87,12 @@ export async function fetchAllRequestIdentifiers(
.post<{
/** Decrypted identifiers */
identifiers: RequestIdentifier[];
/** Pagination info */
pageInfo: { endCursor: string | null; hasNextPage: boolean };
}>('v1/request-identifiers', {
json: {
first: PAGE_SIZE,
offset,
after: cursor,
requestId,
},
})
Expand All @@ -97,15 +105,15 @@ export async function fetchAllRequestIdentifiers(
);
}

const { identifiers: nodes } = decodeCodec(
const { identifiers: nodes, pageInfo } = decodeCodec(
RequestIdentifiersResponse,
response,
);

requestIdentifiers.push(...nodes);

offset += PAGE_SIZE;
shouldContinue = nodes.length === PAGE_SIZE;
cursor = pageInfo.endCursor ?? undefined;
Comment thread
iamtheluckyest marked this conversation as resolved.
Outdated
shouldContinue = pageInfo.hasNextPage;
} while (shouldContinue);

return requestIdentifiers;
Expand Down
12 changes: 8 additions & 4 deletions src/lib/graphql/gqls/RequestIdentifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ export const REMOVE_REQUEST_IDENTIFIERS = gql`
export const REQUEST_IDENTIFIERS = gql`
query TranscendCliRequestIdentifiers(
$first: Int!
$offset: Int!
$after: String
$requestIds: [ID!]
$updatedAtBefore: Date
$updatedAtAfter: Date
) {
requestIdentifiers(
input: {
requestIds: $requestIds
input: { requestIds: $requestIds }
filterBy: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this even working before with those values in input? 😅

updatedAtBefore: $updatedAtBefore
updatedAtAfter: $updatedAtAfter
}
first: $first
offset: $offset
after: $after
useMaster: false
orderBy: [
{ field: createdAt, direction: ASC }
Expand All @@ -40,6 +40,10 @@ export const REQUEST_IDENTIFIERS = gql`
isVerifiedAtLeastOnce
}
totalCount
pageInfo {
endCursor
hasNextPage
}
}
}
`;
Loading