(
sessionId: string,
req: FsListManyRequest,
)
| 226 | } |
| 227 | |
| 228 | async listMany( |
| 229 | sessionId: string, |
| 230 | req: FsListManyRequest, |
| 231 | ): Promise<FsListManyResponse> { |
| 232 | |
| 233 | await this.sessions.get(sessionId); |
| 234 | |
| 235 | const results: Record<string, FsEntry[]> = {}; |
| 236 | const partialErrors: Record<string, { code: number; msg: string }> = {}; |
| 237 | const truncatedPaths: string[] = []; |
| 238 | |
| 239 | await Promise.all( |
| 240 | req.paths.map(async (p) => { |
| 241 | try { |
| 242 | const sub = await this.list(sessionId, { |
| 243 | path: p, |
| 244 | depth: req.depth, |
| 245 | limit: req.limit, |
| 246 | show_hidden: req.show_hidden, |
| 247 | follow_gitignore: req.follow_gitignore, |
| 248 | exclude_globs: req.exclude_globs, |
| 249 | sort: req.sort, |
| 250 | include_git_status: req.include_git_status, |
| 251 | }); |
| 252 | results[p] = sub.items; |
| 253 | if (sub.truncated) truncatedPaths.push(p); |
| 254 | } catch (err) { |
| 255 | |
| 256 | if (err instanceof FsPathEscapesError) throw err; |
| 257 | if (err instanceof SessionNotFoundError) throw err; |
| 258 | partialErrors[p] = mapToWireError(err); |
| 259 | } |
| 260 | }), |
| 261 | ); |
| 262 | |
| 263 | const out: FsListManyResponse = { results }; |
| 264 | if (truncatedPaths.length > 0) out.truncated_paths = truncatedPaths; |
| 265 | if (Object.keys(partialErrors).length > 0) out.partial_errors = partialErrors; |
| 266 | return out; |
| 267 | } |
| 268 | |
| 269 | async stat(sessionId: string, req: FsStatRequest): Promise<FsEntry> { |
| 270 | const session = await this.sessions.get(sessionId); |
nothing calls this directly
no test coverage detected