fix(session): add typed message lookup wrappers (#27269)

This commit is contained in:
Shoubhit Dash
2026-05-13 13:04:07 +05:30
committed by GitHub
parent e9a29e4908
commit fed043a1ad
3 changed files with 49 additions and 10 deletions

View File

@@ -956,6 +956,17 @@ export function page(input: { sessionID: SessionID; limit: number; before?: stri
}
}
export const pageEffect = Effect.fn("MessageV2.pageEffect")(function* (input: {
sessionID: SessionID
limit: number
before?: string
}) {
return yield* Effect.try({
try: () => page(input),
catch: (error) => error,
}).pipe(Effect.catch((error) => (NotFoundError.isInstance(error) ? Effect.fail(error) : Effect.die(error))))
})
export function* stream(sessionID: SessionID) {
const size = 50
let before: string | undefined
@@ -1000,6 +1011,16 @@ export function get(input: { sessionID: SessionID; messageID: MessageID }): With
}
}
export const getEffect = Effect.fn("MessageV2.getEffect")(function* (input: {
sessionID: SessionID
messageID: MessageID
}) {
return yield* Effect.try({
try: () => get(input),
catch: (error) => error,
}).pipe(Effect.catch((error) => (NotFoundError.isInstance(error) ? Effect.fail(error) : Effect.die(error))))
})
export function filterCompacted(msgs: Iterable<WithParts>) {
const result = [] as WithParts[]
const completed = new Set<string>()