Files
upstream-yaak/apps/yaak-client/lib/rpc.ts
upstream-mirror 906fb231cc
Some checks failed
Lint and Test / Lint/Test (push) Has been cancelled
Generate Sponsors README / deploy (push) Has been skipped
snapshot of https://github.com/mountain-loop/yaak.git (main, 2026-09-23; blobs > 131072B omitted)
2026-09-23 17:39:41 +05:00

20 lines
818 B
TypeScript

import type { RpcPayload } from "@yaakapp-internal/platform";
import { platform } from "@yaakapp-internal/platform";
import type { RpcSchema } from "@yaakapp-internal/rpc-schema";
/**
* Every backend command the app can call: the generated wire schema, one field
* per `RpcRouter` registration on the Rust side. A typo'd or unregistered
* command name is a compile error. Host plugin commands (license, fonts,
* mac-window) don't appear here — each lives behind its own package's facade.
*
* `RpcSchema` also carries each command's request and response payload types;
* adopting them at call sites is an incremental follow-up.
*/
type AppCmd = keyof RpcSchema;
/** Call a backend command. */
export function rpc<T>(cmd: AppCmd, payload?: RpcPayload): Promise<T> {
return platform.rpc<T>(cmd, payload);
}