MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / buildPullUrl

Function buildPullUrl

packages/sync/src/pull-engine.ts:30–37  ·  view source on GitHub ↗
(baseUrl: string, remoteSessionId: string, params: FetchParams)

Source from the content-addressed store, hash-verified

28// ==================== Helpers ====================
29
30export function buildPullUrl(baseUrl: string, remoteSessionId: string, params: FetchParams): string {
31 const base = `${baseUrl}/sessions/${remoteSessionId}/messages`
32 const qs: string[] = ['format=chatlab']
33 if (params.since !== undefined && params.since > 0) qs.push(`since=${params.since}`)
34 if (params.offset !== undefined && params.offset > 0) qs.push(`offset=${params.offset}`)
35 if (params.limit !== undefined && params.limit > 0) qs.push(`limit=${params.limit}`)
36 return base + '?' + qs.join('&')
37}
38
39export function deriveLocalSessionId(baseUrl: string, remoteSessionId: string): string {
40 const hash = crypto.createHash('sha256').update(`${baseUrl}\0${remoteSessionId}`).digest('hex').slice(0, 12)

Callers 2

fetchToTempFileMethod · 0.90
fetchToTempFileMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected