Skip to content
API reference

app-method-runtime

Import
import * as api from "@fungi.computer/puffball/app-method-runtime";
Kind Export Description
type alias AppMethodCallContext Trusted attribution delivered separately from App method arguments.
constant appApiReservedMethodNames Reserved JavaScript, RPC and lifecycle names are never App method names.
constant appMethodCallerSchema Sole grammar for the Hub-minted Computer pin and actor attribution.
function parseAppMethodCallContext() Decode the trusted Hub attribution through the sole runtime-neutral grammar.
function isAppApiMethodName() Shared domain grammar for generated RPC method names.

AppMethodCallContexttype alias

Section titled “AppMethodCallContext”
Signature
type AppMethodCallContext = z.output<typeof appMethodCallerSchema>;

Trusted attribution delivered separately from App method arguments.

appApiReservedMethodNamesconstant

Section titled “appApiReservedMethodNames”
Signature
const appApiReservedMethodNames: Readonly<{
intrinsic: readonly [
"constructor",
"toString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
];
rpc: readonly ["then", "dup", "connect", "id", "name"];
instance: readonly ["ctx", "env"];
lifecycle: readonly [
"fetch",
"alarm",
"queue",
"scheduled",
"tail",
"trace",
"email",
"test",
"tailStream",
"webSocketMessage",
"webSocketClose",
"webSocketError",
];
}>;

Reserved JavaScript, RPC and lifecycle names are never App method names.


appMethodCallerSchemaconstant

Section titled “appMethodCallerSchema”
Signature
const appMethodCallerSchema: ZodMiniObject<
{
computerId: ZodMiniNullable<ZodMiniString<string>>;
actor: ZodMiniDiscriminatedUnion<
[
ZodMiniObject<
{
kind: ZodMiniLiteral<"member">;
memberId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"agent">;
agentId: ZodMiniString<string>;
},
$strip
>,
ZodMiniObject<
{
kind: ZodMiniLiteral<"team-key">;
keyId: ZodMiniString<string>;
},
$strip
>,
],
"kind"
>;
},
$strip
>;

Sole grammar for the Hub-minted Computer pin and actor attribution.

parseAppMethodCallContext()function

Section titled “parseAppMethodCallContext()”
Signature
function parseAppMethodCallContext(value, rejectUnknownKeys?): object;

Decode the trusted Hub attribution through the sole runtime-neutral grammar.

Parameter Type Default value
value unknown undefined
rejectUnknownKeys boolean false

object

Name Type
computerId string | null
actor | { kind: "member"; memberId: string; } | { kind: "agent"; agentId: string; } | { kind: "team-key"; keyId: string; }

isAppApiMethodName()function

Section titled “isAppApiMethodName()”
Signature
function isAppApiMethodName(name): boolean;

Shared domain grammar for generated RPC method names.

Parameter Type
name string

boolean