import { SingleNodeClient } from "../clients/singleNodeClient" ; import type { IClient } from "../models/IClient" ; import type { IMessage } from "../models/IMessage" ; param client param messageId returns export async function reattach ( client , messageId ) { const localClient = typeof client === "string" ? new SingleNodeClient ( client ) : client ; const message = await localClient . message ( messageId ) ; if ( ! message ) { throw new Error ( "The message does not exist." ) ; } const reattachMessage = { payload : message . payload } ; const reattachedMessageId = await localClient . messageSubmit ( reattachMessage ) ; return { message , messageId : reattachedMessageId } ; }