fix(session): add typed message lookup wrappers (#27269)
This commit is contained in:
@@ -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>()
|
||||
|
||||
Reference in New Issue
Block a user