refactor(server): serve raw filesystem content (#31911)
This commit is contained in:
parent
31b233e9db
commit
31c5454ee6
12 changed files with 67 additions and 93 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue