MCPcopy Index your code
hub / github.com/codeaashu/claude-code / fetchPage

Function fetchPage

src/assistant/sessionHistory.ts:45–67  ·  view source on GitHub ↗
(
  ctx: HistoryAuthCtx,
  params: Record<string, string | number | boolean>,
  label: string,
)

Source from the content-addressed store, hash-verified

43}
44
45async function fetchPage(
46 ctx: HistoryAuthCtx,
47 params: Record<string, string | number | boolean>,
48 label: string,
49): Promise<HistoryPage | null> {
50 const resp = await axios
51 .get<SessionEventsResponse>(ctx.baseUrl, {
52 headers: ctx.headers,
53 params,
54 timeout: 15000,
55 validateStatus: () => true,
56 })
57 .catch(() => null)
58 if (!resp || resp.status !== 200) {
59 logForDebugging(`[${label}] HTTP ${resp?.status ?? 'error'}`)
60 return null
61 }
62 return {
63 events: Array.isArray(resp.data.data) ? resp.data.data : [],
64 firstId: resp.data.first_id,
65 hasMore: resp.data.has_more,
66 }
67}
68
69/**
70 * Newest page: last `limit` events, chronological, via anchor_to_latest.

Callers 2

fetchLatestEventsFunction · 0.85
fetchOlderEventsFunction · 0.85

Calls 1

logForDebuggingFunction · 0.85

Tested by

no test coverage detected