refactor(core): unify filesystem search service (#31566)

This commit is contained in:
Dax 2026-06-09 20:38:02 -04:00 committed by GitHub
commit a0409e64d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 962 additions and 2852 deletions

View file

@ -5,10 +5,31 @@ import { Api } from "../api"
import { response } from "../groups/location"
export const FileSystemHandler = HttpApiBuilder.group(Api, "server.fs", (handlers) =>
Effect.succeed(
handlers
.handle("fs.read", (ctx) => response(FileSystem.Service.use((fs) => fs.read(ctx.query))))
.handle("fs.list", (ctx) => response(FileSystem.Service.use((fs) => fs.list(ctx.query))))
.handle("fs.find", (ctx) => response(FileSystem.Service.use((fs) => fs.find(ctx.query)))),
),
Effect.gen(function* () {
return handlers
.handle("fs.read", (ctx) =>
response(
Effect.gen(function* () {
const fs = yield* FileSystem.Service
return yield* fs.read(ctx.query)
}),
),
)
.handle("fs.list", (ctx) =>
response(
Effect.gen(function* () {
const fs = yield* FileSystem.Service
return yield* fs.list(ctx.query)
}),
),
)
.handle("fs.find", (ctx) =>
response(
Effect.gen(function* () {
const fs = yield* FileSystem.Service
return yield* fs.find(ctx.query)
}),
),
)
}),
)