Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

executeRpc

función

Ejecuta un procedimiento RPC con sus guardas y validaciones y devuelve su salida validada. Es la pieza de bajo nivel de dispatchRpc. El orden es: Origin (desde 1.8, en toda llamada salvo con origin: "none"), Origin y CSRF de la sesión, rateLimit, auth, authorize, input, locals, handler y output.

ts
import { executeRpc } from "@meekojs/meeko/server";

Source code src/server/rpc/runtime.ts:31

Firma #

ts
function executeRpc<I extends Schema, O extends Schema, S, L = undefined>(definition: RpcDefinition<I, O, S, L>, rawInput: unknown, context: RequestContext<S>, sessions: SessionManager): Promise<Output<O>>

Type parameters #

I extends Schema
O extends Schema
S
L = undefined

Parameters #

definition RpcDefinition<I, O, S, L>

Procedimiento declarado con defineRpc.

rawInput unknown

Entrada sin validar.

context RequestContext<S>

Contexto de la petición.

sessions SessionManager

Gestor de sesiones, para Origin y CSRF.

Returns #

Promise<Output<O>>

La salida validada.

Throws #

ApiError

Con INVALID_ORIGIN, RATE_LIMITED, UNAUTHENTICATED, FORBIDDEN, INVALID_INPUT, INVALID_RATE_LIMIT, INVALID_OUTPUT o los de locals y del handler.

Example #

ts
import { executeRpc } from "@meekojs/meeko/server";
import getUser from "./server/rpc/users/get.js";

const user = await executeRpc(getUser, { id: "123" }, context, sessions);

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/server/rpc/runtime.ts