(ownerWorkspaceId: string)
| 210 | } |
| 211 | |
| 212 | async listPending(ownerWorkspaceId: string): Promise<BashMonitorWakeRecord[]> { |
| 213 | const dir = this.dir(ownerWorkspaceId); |
| 214 | let entries: string[]; |
| 215 | try { |
| 216 | entries = await fsPromises.readdir(dir); |
| 217 | } catch (error) { |
| 218 | if (isErrnoWithCode(error, "ENOENT")) return []; |
| 219 | throw error; |
| 220 | } |
| 221 | const records: BashMonitorWakeRecord[] = []; |
| 222 | for (const entry of entries) { |
| 223 | if (!entry.endsWith(".json")) continue; |
| 224 | const raw = await fsPromises.readFile(path.join(dir, entry), "utf-8").catch(() => null); |
| 225 | if (raw == null) continue; |
| 226 | const parsed = this.parse(raw); |
| 227 | if (parsed?.status === "pending") records.push(parsed); |
| 228 | } |
| 229 | records.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id)); |
| 230 | return records; |
| 231 | } |
| 232 | |
| 233 | async listPendingOwnerWorkspaceIds(): Promise<string[]> { |
| 234 | let entries: Dirent[]; |
no test coverage detected