MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / getPaginatedServer

Function getPaginatedServer

packages/backend/src/bitbucket.ts:442–465  ·  view source on GitHub ↗
(
    path: ServerGetRequestPath,
    get: (url: ServerGetRequestPath, start?: number) => Promise<ServerPaginatedResponse<T>>
)

Source from the content-addressed store, hash-verified

440}
441
442const getPaginatedServer = async <T>(
443 path: ServerGetRequestPath,
444 get: (url: ServerGetRequestPath, start?: number) => Promise<ServerPaginatedResponse<T>>
445): Promise<T[]> => {
446 const results: T[] = [];
447 let nextStart: number | undefined;
448
449 while (true) {
450 const response = await get(path, nextStart);
451
452 if (!response.values || response.values.length === 0) {
453 break;
454 }
455
456 results.push(...response.values);
457
458 if (response.isLastPage) {
459 break;
460 }
461
462 nextStart = response.nextPageStart;
463 }
464 return results;
465}
466
467async function serverGetReposForWorkspace(client: BitbucketClient, workspaces: string[]): Promise<{repos: ServerRepository[], warnings: string[]}> {
468 const warnings = workspaces.map(workspace => `Workspaces are not supported in Bitbucket Server: ${workspace}`);

Callers 3

fetchFnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected