Skip to content

Commit

Permalink
feat: getSnapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Sep 18, 2024
1 parent 9f3e259 commit e3c9472
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/snapshot/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,12 @@ export async function getSnapshotStorage(mq: MoquerieInstance) {
storage = await storagePromise
return storage
}

export async function getSnapshot(mq: MoquerieInstance, id: string): Promise<DatabaseSnapshot> {
const storage = await getSnapshotStorage(mq)
const snapshot = await storage.findById(id)
if (!snapshot) {
throw new Error(`Snapshot not found: ${id}`)
}
return snapshot
}

0 comments on commit e3c9472

Please sign in to comment.