refactor(core): simplify location filesystem (#31545)
This commit is contained in:
parent
0777cf1ccf
commit
132ef57272
73 changed files with 1048 additions and 1416 deletions
|
|
@ -1,8 +1,7 @@
|
|||
export * from "./gen/types.gen.js"
|
||||
export type {
|
||||
FileSystemBinaryContent as LocationFileSystemBinaryContent,
|
||||
FileSystemContent as LocationFileSystemContent,
|
||||
FileSystemEntry as LocationFileSystemEntry,
|
||||
FileSystemTextContent as LocationFileSystemTextContent,
|
||||
} from "./gen/types.gen.js"
|
||||
|
||||
import { createClient } from "./gen/client/client.gen.js"
|
||||
|
|
|
|||
|
|
@ -266,6 +266,8 @@ import type {
|
|||
V2CommandListResponses,
|
||||
V2EventSubscribeErrors,
|
||||
V2EventSubscribeResponses,
|
||||
V2FsFindErrors,
|
||||
V2FsFindResponses,
|
||||
V2FsListErrors,
|
||||
V2FsListResponses,
|
||||
V2FsReadErrors,
|
||||
|
|
@ -5601,6 +5603,43 @@ export class Fs extends HeyApiClient {
|
|||
...params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Find files
|
||||
*
|
||||
* Find recursively ranked filesystem entries relative to the requested location.
|
||||
*/
|
||||
public find<ThrowOnError extends boolean = false>(
|
||||
parameters: {
|
||||
location?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
query: string
|
||||
type?: "file" | "directory"
|
||||
limit?: string
|
||||
},
|
||||
options?: Options<never, ThrowOnError>,
|
||||
) {
|
||||
const params = buildClientParams(
|
||||
[parameters],
|
||||
[
|
||||
{
|
||||
args: [
|
||||
{ in: "query", key: "location" },
|
||||
{ in: "query", key: "query" },
|
||||
{ in: "query", key: "type" },
|
||||
{ in: "query", key: "limit" },
|
||||
],
|
||||
},
|
||||
],
|
||||
)
|
||||
return (options?.client ?? this.client).get<V2FsFindResponses, V2FsFindErrors, ThrowOnError>({
|
||||
url: "/api/fs/find",
|
||||
...options,
|
||||
...params,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export class Command2 extends HeyApiClient {
|
||||
|
|
|
|||
|
|
@ -2985,19 +2985,7 @@ export type ToolTextContent = {
|
|||
|
||||
export type ToolFileContent = {
|
||||
type: "file"
|
||||
source:
|
||||
| {
|
||||
type: "data"
|
||||
data: string
|
||||
}
|
||||
| {
|
||||
type: "url"
|
||||
url: string
|
||||
}
|
||||
| {
|
||||
type: "file"
|
||||
uri: string
|
||||
}
|
||||
uri: string
|
||||
mime: string
|
||||
name?: string
|
||||
}
|
||||
|
|
@ -4131,16 +4119,11 @@ export type PermissionSavedInfo = {
|
|||
resource: string
|
||||
}
|
||||
|
||||
export type FileSystemTextContent = {
|
||||
type: "text"
|
||||
export type FileSystemContent = {
|
||||
uri: string
|
||||
name?: string
|
||||
content: string
|
||||
mime: string
|
||||
}
|
||||
|
||||
export type FileSystemBinaryContent = {
|
||||
type: "binary"
|
||||
content: string
|
||||
encoding: "base64"
|
||||
encoding: "utf8" | "base64"
|
||||
mime: string
|
||||
}
|
||||
|
||||
|
|
@ -10095,7 +10078,7 @@ export type V2FsReadResponses = {
|
|||
*/
|
||||
200: {
|
||||
location: LocationInfo
|
||||
data: FileSystemTextContent | FileSystemBinaryContent
|
||||
data: FileSystemContent
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10139,6 +10122,46 @@ export type V2FsListResponses = {
|
|||
|
||||
export type V2FsListResponse = V2FsListResponses[keyof V2FsListResponses]
|
||||
|
||||
export type V2FsFindData = {
|
||||
body?: never
|
||||
path?: never
|
||||
query: {
|
||||
location?: {
|
||||
directory?: string
|
||||
workspace?: string
|
||||
}
|
||||
query: string
|
||||
type?: "file" | "directory"
|
||||
limit?: string
|
||||
}
|
||||
url: "/api/fs/find"
|
||||
}
|
||||
|
||||
export type V2FsFindErrors = {
|
||||
/**
|
||||
* InvalidRequestError
|
||||
*/
|
||||
400: InvalidRequestError
|
||||
/**
|
||||
* UnauthorizedError
|
||||
*/
|
||||
401: UnauthorizedError
|
||||
}
|
||||
|
||||
export type V2FsFindError = V2FsFindErrors[keyof V2FsFindErrors]
|
||||
|
||||
export type V2FsFindResponses = {
|
||||
/**
|
||||
* Success
|
||||
*/
|
||||
200: {
|
||||
location: LocationInfo
|
||||
data: Array<FileSystemEntry>
|
||||
}
|
||||
}
|
||||
|
||||
export type V2FsFindResponse = V2FsFindResponses[keyof V2FsFindResponses]
|
||||
|
||||
export type V2CommandListData = {
|
||||
body?: never
|
||||
path?: never
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue