@sms/plugin-rpc
Interfaces
RpcCall
Defined in: packages/plugins/rpc/src/methods.ts:31
@sms/plugin-rpc/contract — the definitions other code depends on: the method table, call/result types
and the pure parseCall / runOne / rightsOf helpers. No manifest, no plugin body: depending on this
never drags in the provider (index.ts). The rpc plugin provides no key; it only contributes routes.
Properties
args
args: unknown[];
Defined in: packages/plugins/rpc/src/methods.ts:34
kwargs
kwargs: Record<string, unknown>;
Defined in: packages/plugins/rpc/src/methods.ts:35
method
method: string;
Defined in: packages/plugins/rpc/src/methods.ts:33
model
model: string;
Defined in: packages/plugins/rpc/src/methods.ts:32
RpcEnv
Defined in: packages/plugins/rpc/src/methods.ts:39
@sms/plugin-rpc/contract — the definitions other code depends on: the method table, call/result types
and the pure parseCall / runOne / rightsOf helpers. No manifest, no plugin body: depending on this
never drags in the provider (index.ts). The rpc plugin provides no key; it only contributes routes.
Properties
ctx
ctx: OpContext;
Defined in: packages/plugins/rpc/src/methods.ts:41
kernel
kernel: KernelApi;
Defined in: packages/plugins/rpc/src/methods.ts:42
orm
orm: OrmService;
Defined in: packages/plugins/rpc/src/methods.ts:40
RpcOptions
Defined in: packages/plugins/rpc/src/index.ts:29
Properties
contextOf?
optional contextOf?: (req) =>
| OpContext
| Promise<OpContext>;
Defined in: packages/plugins/rpc/src/index.ts:31
Who is calling. Default: anonymous {} (the ORM guard, if any, decides what that may do).
Parameters
| Parameter | Type |
|---|---|
req | RouteRequest |
Returns
| OpContext
| Promise<OpContext>
prefix?
optional prefix?: string;
Defined in: packages/plugins/rpc/src/index.ts:33
Route prefix. Default /api/rpc.
Type Aliases
Rights
type Rights = Record<Op, boolean>;
Defined in: packages/plugins/rpc/src/rights.ts:10
RpcMethod
type RpcMethod = typeof RPC_METHODS[number];
Defined in: packages/plugins/rpc/src/methods.ts:29
@sms/plugin-rpc/contract — the definitions other code depends on: the method table, call/result types
and the pure parseCall / runOne / rightsOf helpers. No manifest, no plugin body: depending on this
never drags in the provider (index.ts). The rpc plugin provides no key; it only contributes routes.
RpcResult
type RpcResult =
| {
result: unknown;
}
| {
error: {
kind: string;
message: string;
};
};
Defined in: packages/plugins/rpc/src/methods.ts:37
@sms/plugin-rpc/contract — the definitions other code depends on: the method table, call/result types
and the pure parseCall / runOne / rightsOf helpers. No manifest, no plugin body: depending on this
never drags in the provider (index.ts). The rpc plugin provides no key; it only contributes routes.
Variables
RPC_METHODS
const RPC_METHODS: readonly ["search_read", "read", "create", "write", "unlink", "read_group", "onchange", "defaults", "call", "fields", "rights"];
Defined in: packages/plugins/rpc/src/methods.ts:16
@sms/plugin-rpc/contract — the definitions other code depends on: the method table, call/result types
and the pure parseCall / runOne / rightsOf helpers. No manifest, no plugin body: depending on this
never drags in the provider (index.ts). The rpc plugin provides no key; it only contributes routes.
rpcPlugin
const rpcPlugin: SystemPlugin;
Defined in: packages/plugins/rpc/src/index.ts:103
Functions
createRpcPlugin()
function createRpcPlugin(opts?): SystemPlugin;
Defined in: packages/plugins/rpc/src/index.ts:36
Parameters
| Parameter | Type |
|---|---|
opts | RpcOptions |
Returns
groupsOf()
function groupsOf(kernel, ctx): Promise<string[]>;
Defined in: packages/plugins/rpc/src/rights.ts:25
Groups of the caller through rbac, or none when rbac is absent / the caller is anonymous.
Parameters
Returns
Promise<string[]>
parseCall()
function parseCall(body): RpcCall;
Defined in: packages/plugins/rpc/src/methods.ts:50
Parse one raw call.
Parameters
| Parameter | Type |
|---|---|
body | unknown |
Returns
rightsOf()
function rightsOf(o): Promise<Rights>;
Defined in: packages/plugins/rpc/src/rights.ts:14
Parameters
| Parameter | Type |
|---|---|
o | { ctx: OpContext; kernel: KernelApi; model: string; } |
o.ctx | OpContext |
o.kernel | KernelApi |
o.model | string |
Returns
Promise<Rights>
runOne()
function runOne(env, raw): Promise<RpcResult>;
Defined in: packages/plugins/rpc/src/methods.ts:162
Run one call; never throws — every failure is a { error } result so batches keep going.
Parameters
| Parameter | Type |
|---|---|
env | RpcEnv |
raw | unknown |
Returns
Promise<RpcResult>