refactor(server): serve raw filesystem content (#31911)

This commit is contained in:
Dax 2026-06-11 11:20:11 -04:00 committed by GitHub
commit 31c5454ee6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 67 additions and 93 deletions

View file

@ -1,8 +1,5 @@
export * from "./gen/types.gen.js"
export type {
FileSystemContent as LocationFileSystemContent,
FileSystemEntry as LocationFileSystemEntry,
} from "./gen/types.gen.js"
export type { FileSystemEntry as LocationFileSystemEntry } from "./gen/types.gen.js"
import { createClient } from "./gen/client/client.gen.js"
import { type Config } from "./gen/client/types.gen.js"

View file

@ -5964,31 +5964,20 @@ export class Fs extends HeyApiClient {
/**
* Read file
*
* Read one file relative to the requested location.
* Serve one file relative to the requested location.
*/
public read<ThrowOnError extends boolean = false>(
parameters: {
parameters?: {
location?: {
directory?: string
workspace?: string
}
path: string
},
options?: Options<never, ThrowOnError>,
) {
const params = buildClientParams(
[parameters],
[
{
args: [
{ in: "query", key: "location" },
{ in: "query", key: "path" },
],
},
],
)
const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "location" }] }])
return (options?.client ?? this.client).get<V2FsReadResponses, V2FsReadErrors, ThrowOnError>({
url: "/api/fs/read",
url: "/api/fs/read/*",
...options,
...params,
})

View file

@ -4186,14 +4186,6 @@ export type PermissionSavedInfo = {
resource: string
}
export type FileSystemContent = {
uri: string
name?: string
content: string
encoding: "utf8" | "base64"
mime: string
}
export type FileSystemEntry = {
path: string
type: "file" | "directory"
@ -10554,14 +10546,13 @@ export type V2SessionPermissionReplyResponse =
export type V2FsReadData = {
body?: never
path?: never
query: {
query?: {
location?: {
directory?: string
workspace?: string
}
path: string
}
url: "/api/fs/read"
url: "/api/fs/read/*"
}
export type V2FsReadErrors = {
@ -10581,10 +10572,7 @@ export type V2FsReadResponses = {
/**
* Success
*/
200: {
location: LocationInfo
data: FileSystemContent
}
200: Blob | File
}
export type V2FsReadResponse = V2FsReadResponses[keyof V2FsReadResponses]