* List all document IDs in storage.
()
| 291 | * List all document IDs in storage. |
| 292 | */ |
| 293 | async function handleList(): Promise<string[]> { |
| 294 | try { |
| 295 | const files = await fs.readdir(getYjsStorageDir()) |
| 296 | |
| 297 | // Filter out temp files and convert back to document IDs |
| 298 | return files |
| 299 | .filter((f) => !f.includes(".tmp.")) |
| 300 | .map((f) => unsanitizeId(f)) |
| 301 | } catch (error) { |
| 302 | if ((error as NodeJS.ErrnoException).code === "ENOENT") { |
| 303 | return [] |
| 304 | } |
| 305 | throw error |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | export async function listYjsDocuments(): Promise<string[]> { |
| 310 | return handleList() |
no test coverage detected