MCPcopy Index your code
hub / github.com/Noumena-Network/code / buildHistoricalSessionEventsUrl

Function buildHistoricalSessionEventsUrl

src/cli/remoteIO.ts:45–61  ·  view source on GitHub ↗
(
  streamUrl: URL,
  sessionId: string | undefined,
)

Source from the content-addressed store, hash-verified

43}
44
45export function buildHistoricalSessionEventsUrl(
46 streamUrl: URL,
47 sessionId: string | undefined,
48): string | null {
49 if (!sessionId) {
50 return null
51 }
52 if (!/^\/v1\/session_ingress\/ws\/[^/]+$/.test(streamUrl.pathname)) {
53 return null
54 }
55 const eventsUrl = new URL(streamUrl.href)
56 eventsUrl.protocol = eventsUrl.protocol === 'wss:' ? 'https:' : 'http:'
57 eventsUrl.pathname = `/v1/sessions/${sessionId}/events`
58 eventsUrl.search = ''
59 eventsUrl.hash = ''
60 return eventsUrl.toString()
61}
62
63function isReplayableHistoricalSessionEvent(
64 event: unknown,

Callers 3

remoteIO.test.tsFile · 0.85
constructorMethod · 0.85

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected