Files
yaak-mountain-loop/crates-proxy/yaak-proxy-lib/bindings/gen_rpc.ts
T
2026-11-06 09:53:56 -07:00

441 lines
13 KiB
TypeScript
Generated

// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Flow, FlowBody, FlowMessage, GrpcSchema, ModelPayload } from "./gen_models";
export type ActionInvocation = { "scope": "global", action: GlobalAction, };
export type ActionMetadata = { label: string, defaultHotkey: string | null, };
export type AddGrpcSchemaRequest = {
/**
* `api.example.com`, `localhost:50051`, `*.example.com` or `*`.
*/
hostPattern: string,
/**
* `.proto` files, and directories they import from.
*/
protoPaths: Array<string>, };
export type AppIconRequest = {
/**
* A flow's `clientPath`.
*/
path: string, };
export type CaStatus = {
/**
* macOS trusts this app's CA, so HTTPS flows can be decrypted.
*/
trusted: boolean,
/**
* A certificate named "Yaak Proxy CA" is in a keychain: this one, or an older one.
*/
installed: boolean, certPath: string, };
export type CaStatusRequest = Record<string, never>;
export type CaTrustRequest = Record<string, never>;
export type ClearFlowsRequest = Record<string, never>;
/**
* The app behind a client connection.
*/
export type ClientApp = { pid: number,
/**
* The app's name ("Google Chrome"), or the executable's for a process outside an app ("curl").
*/
name: string,
/**
* The outermost `.app` bundle's CFBundleIdentifier, if any.
*/
bundleId: string | null,
/**
* The outermost `.app` bundle's path, or the executable's path when there is no bundle.
*/
path: string, };
export type DecodeGrpcMessageRequest = { flowId: string, seq: number, };
/**
* A captured gRPC message as JSON.
*/
export type DecodedGrpcMessage = {
/**
* Pretty JSON: the message's fields by name with a schema; without one, an array of its
* fields as `{ field, wireType, value }`, a length-delimited one with its guesses (`string`,
* `message`, `bytes` in base64).
*/
json: string,
/**
* The message type decoded with: `package.HelloReply`. None when schemaless.
*/
messageType: string | null,
/**
* The schema decoded with. None when schemaless.
*/
schema: GrpcSchema | null,
/**
* Why it decoded schemaless, or what to know about the decode.
*/
note: string | null, };
export type DropReason = "hop_by_hop" | "set_by_sending" | "body_decoded";
export type DroppedHeader = { name: string, value: string, reason: DropReason, };
export type ExportHarRequest = {
/**
* The file to write.
*/
path: string,
/**
* These flows, or else every flow the filter covers.
*/
ids?: Array<string>, filter?: FlowFilter, };
export type FilterBodyRequest = { flowId: string, which: FlowBody,
/**
* JSONPath, or XPath for an XML or HTML body.
*/
expression: string,
/**
* The language the viewer detected from the body. Without it, the Content-Type decides.
*/
language?: FilterLanguage, };
export type FilterBodyResponse = { content: string, error: string | null, };
export type FilterLanguage = "jsonpath" | "xpath";
/**
* Which flows a listing or a HAR export covers. Every field narrows it; none is all of them.
*/
export type FlowFilter = {
/**
* Search terms, any case, each of which must match the URL (host, path or query), the
* method, the status (`404`, `40`, `4xx`) or the content type: `stripe post 4xx`.
*/
q?: string,
/**
* Part of the host, any case: `stripe` matches `api.stripe.com`.
*/
host?: string,
/**
* Only flows under one of these hosts or paths, as the app's sidebar names them:
* `api.stripe.com` or `api.stripe.com/v1/charges`, with any port after the host.
*/
under?: Array<string>,
/**
* Only flows from one of these apps, by bundle id, or by path for a process outside an
* app bundle.
*/
app?: Array<string>,
/**
* The method, any case.
*/
method?: string,
/**
* A status (`404`), a class of them (`4xx`), or `error` for flows that failed, gRPC calls
* that ended with a status other than OK among them.
*/
status?: string,
/**
* At most this many flows, the newest.
*/
limit?: number,
/**
* Only flows recorded after the flow with this id, for following new traffic. Flows are
* recorded when they end, so a slow one that started earlier still comes through.
*/
after?: string,
/**
* Only flows older than the flow with this id, by start and then id, for paging back
* through older traffic.
*/
before?: string, };
export type FlowsClearedPayload = Record<string, never>;
export type FolderSummary = { id: string, name: string,
/**
* The folder this one is in, if any.
*/
folderId: string | null, };
export type FormatBodyRequest = { text: string, };
export type GetFlowBodyRequest = { flowId: string, which: FlowBody, };
export type GetFlowBodyResponse = {
/**
* The body decoded with its Content-Encoding, at most the capture limit of it, in base64.
* When it fails to decode, the bytes as they were on the wire instead.
*/
data: string,
/**
* The body is incomplete: cut on the wire, or decoded past the capture limit.
*/
truncated: boolean,
/**
* Bytes stored for the body, as they were on the wire.
*/
storedSize: number,
/**
* Why the body failed to decode, in which case `data` is as it was on the wire.
*/
decodeError?: string, };
export type GetMessagePayloadRequest = { flowId: string, seq: number, };
export type GetMessagePayloadResponse = {
/**
* The payload as stored (unmasked, inflated, decompressed), in base64.
*/
data: string,
/**
* It is cut at the capture limit.
*/
truncated: boolean, };
export type GetProxyStateRequest = Record<string, never>;
export type GetProxyStateResponse = { state: ProxyState,
/**
* The port the engine is bound to, while it runs.
*/
port: number | null,
/**
* The port the engine starts on.
*/
configuredPort: number,
/**
* Flows are stored. Paused, traffic still passes through, unrecorded.
*/
recording: boolean,
/**
* The system proxy turns on as the engine starts.
*/
systemProxyAtLaunch: boolean,
/**
* The HTTP versions offered to clients.
*/
httpVersion: HttpVersion,
/**
* Why the engine last failed to start, until it starts.
*/
startError: string | null,
/**
* Another process that owns the engine, such as the CLI daemon. While one does, this app
* cannot start its own, and new flows reach it only through the database.
*/
otherOwner: OtherOwner | null, };
export type GlobalAction = "recording_toggle" | "flows_clear";
export type HelperRegisterRequest = Record<string, never>;
export type HelperState = "unavailable" | "not_registered" | "requires_approval" | "enabled" | "not_found";
export type HelperUnregisterRequest = Record<string, never>;
/**
* The HTTP versions offered to clients in intercepted HTTPS. Upstream, the engine speaks
* whichever the server picks either way.
*/
export type HttpVersion = "auto" | "http1Only";
export type ListActionsRequest = Record<string, never>;
export type ListActionsResponse = { actions: Array<[ActionInvocation, ActionMetadata]>, };
export type ListFlowsResponse = {
/**
* Newest first.
*/
flows: Array<Flow>,
/**
* Flows in the database, whatever the filter.
*/
total: number,
/**
* Flows the filter covers, whatever the limit, when it narrows to fewer than all of them.
*/
matching: number | null, };
export type ListGrpcSchemasRequest = Record<string, never>;
export type ListMessagesRequest = { flowId: string,
/**
* Only messages after this `seq`, for following a stream as it grows.
*/
afterSeq?: number,
/**
* At most this many, the first after `afterSeq`.
*/
limit?: number, };
export type ListMessagesResponse = {
/**
* In order, by `seq`.
*/
messages: Array<FlowMessage>,
/**
* Messages the flow has in all.
*/
total: number, };
export type ListWorkspacesRequest = Record<string, never>;
export type ListWorkspacesResponse = {
/**
* Yaak has run on this machine. Without it there is nothing to save into.
*/
yaakFound: boolean, workspaces: Array<WorkspaceSummary>, };
/**
* A message of a streaming flow was recorded.
*/
export type MessagePayload = { message: FlowMessage, };
export type OtherOwner = { owner: Owner, pid: number, startedAt: string,
/**
* The engine's port while it runs.
*/
proxyPort: number | null, };
/**
* The process that runs the engine.
*/
export type Owner = "app" | "cli";
export type PreviewSaveRequest = { flowId: string, };
export type ProxySetting = { enabled: boolean, server: string, port: number, };
export type ProxyState = "running" | "stopped";
export type ProxyStatePayload = { state: ProxyState, };
export type ReflectGrpcHostRequest = {
/**
* `host` or `host:port`, over TLS on 443 unless a port is given, or either after
* `http://` to ask without TLS.
*/
host: string, };
export type RemoveGrpcSchemaRequest = { id: string, };
export type RpcEventSchema = { flows_cleared: FlowsClearedPayload, message_write: MessagePayload, model_write: ModelPayload, proxy_state_changed: ProxyStatePayload, };
export type RpcSchema = { execute_action: [ActionInvocation, boolean], format_body: [FormatBodyRequest, string], get_message_payload: [GetMessagePayloadRequest, GetMessagePayloadResponse], list_actions: [ListActionsRequest, ListActionsResponse], list_flows: [FlowFilter, ListFlowsResponse], list_grpc_schemas: [ListGrpcSchemasRequest, Array<GrpcSchema>], list_messages: [ListMessagesRequest, ListMessagesResponse], remove_grpc_schema: [RemoveGrpcSchemaRequest, boolean], set_recording: [SetRecordingRequest, boolean], set_system_proxy_at_launch: [SetSystemProxyAtLaunchRequest, boolean], set_http_version: [SetHttpVersionRequest, HttpVersion], add_grpc_schema: [AddGrpcSchemaRequest, GrpcSchema], app_icon: [AppIconRequest, string | null], ca_status: [CaStatusRequest, CaStatus], ca_trust: [CaTrustRequest, CaStatus], clear_flows: [ClearFlowsRequest, number], decode_grpc_message: [DecodeGrpcMessageRequest, DecodedGrpcMessage], export_har: [ExportHarRequest, number], filter_body: [FilterBodyRequest, FilterBodyResponse], get_flow_body: [GetFlowBodyRequest, GetFlowBodyResponse], get_proxy_state: [GetProxyStateRequest, GetProxyStateResponse], helper_register: [HelperRegisterRequest, SystemProxyStatus], helper_unregister: [HelperUnregisterRequest, SystemProxyStatus], list_workspaces: [ListWorkspacesRequest, ListWorkspacesResponse], preview_save: [PreviewSaveRequest, SavePreview], reflect_grpc_host: [ReflectGrpcHostRequest, GrpcSchema], save_flow: [SaveFlowToYaakRequest, SavedFlow], save_flow_body: [SaveFlowBodyRequest, SaveFlowBodyResponse], system_proxy_set: [SystemProxySetRequest, SystemProxyStatus], system_proxy_status: [SystemProxyStatusRequest, SystemProxyStatus], take_over: [TakeOverRequest, boolean], };
export type SaveFlowBodyRequest = { flowId: string, which: FlowBody,
/**
* The file to write.
*/
path: string, };
export type SaveFlowBodyResponse = {
/**
* Bytes written.
*/
size: number,
/**
* What was written is incomplete, as `GetFlowBodyResponse.truncated` is.
*/
truncated: boolean,
/**
* The body failed to decode, so the file has it as it was on the wire.
*/
raw: boolean, };
export type SaveFlowToYaakRequest = { flowId: string, workspaceId: string, folderId?: string,
/**
* None or blank leaves the request unnamed, and Yaak shows its URL.
*/
name?: string, };
/**
* What saving a flow as a Yaak request writes, for the save dialog.
*/
export type SavePreview = { method: string, url: string,
/**
* The URL as saved, its query split out into parameters, which Yaak shows for an unnamed
* request.
*/
requestUrl: string,
/**
* The saved body type, which Yaak shows for an unnamed GraphQL request with no URL.
*/
bodyType: string | null,
/**
* Headers Yaak sets itself or that only meant something to the proxy.
*/
droppedHeaders: Array<DroppedHeader>,
/**
* Headers saved as captured, Authorization among them.
*/
keptHeaders: number,
/**
* The body as it is saved: "JSON", "form URL-encoded with 7 fields". None without a body.
*/
body: string | null,
/**
* What does not carry over exactly, one sentence each.
*/
warnings: Array<string>,
/**
* An Authorization header is saved in plain text.
*/
authorization: boolean, };
export type SavedFlow = { requestId: string, name: string, };
export type ServiceProxy = {
/**
* The network service, as System Settings names it: "Wi-Fi", "USB 10/100/1000 LAN".
*/
name: string,
/**
* What stays the same when the service is renamed: its device ("en0"), or its hardware
* port when it has none. Absent when `networksetup` lists neither.
*/
id?: string, http: ProxySetting, https: ProxySetting, };
export type SetHttpVersionRequest = { httpVersion: HttpVersion, };
export type SetRecordingRequest = { enabled: boolean, };
export type SetSystemProxyAtLaunchRequest = { enabled: boolean, };
/**
* How a change gets administrator rights.
*/
export type SystemProxyBackend = "helper" | "admin_prompt" | "sudo";
export type SystemProxySetRequest = { enabled: boolean, };
export type SystemProxyStatus = {
/**
* Every enabled network service sends HTTP and HTTPS to `127.0.0.1:<port>`.
*/
enabled: boolean,
/**
* The port checked against.
*/
port: number, services: Array<ServiceProxy>, backend: SystemProxyBackend,
/**
* The privileged helper's registration, which decides the backend.
*/
helper: HelperState,
/**
* This platform has a system proxy the app can set.
*/
supported: boolean, };
export type SystemProxyStatusRequest = Record<string, never>;
export type TakeOverRequest = Record<string, never>;
export type WorkspaceSummary = { id: string, name: string, folders: Array<FolderSummary>, };