Call Typed KalamDB Functions
Generate a client from your KalamDB schema to call server routines with typed inputs and results. The generated descriptor carries the routine identity and ABI information; avoid hand-building it.
Generate a KalamDB routine client
Put the routine in your project’s schema, apply it with CLI migrations, then regenerate:
The TypeScript and Dart generators route function calls through invokeRoutine on /v1/functions/{schema}/{name}. Regenerate clients whenever a routine’s contract changes. Build and deploy project TypeScript bodies with the function workflow.
Choose an encoding
The HTTP endpoint supports JSON and the shared KDOM binary frame. Use generated APIs for binary values and select a format explicitly when you depend on it. In TypeScript, invokeRoutine(descriptor, input, { format: 'json' }) chooses JSON; { format: 'binary' } chooses KDOM. The descriptor comes from generated code.
Binary encoding preserves typed routine values through the server and supported SDK codecs. It is not MessagePack. Server and generated-client ABI versions must agree; older SDKs are rejected rather than silently adapted.
Use SQL when a generated client is unnecessary
With an authenticated TypeScript client:
Functions return values through SELECT; procedures use CALL and may expose OUT / INOUT arguments. Authentication and execute grants apply to both SQL and direct HTTP invocation. The host builds actor, source and transaction context; callers must not supply ctx.
Next: Function permissions and runtime. Reference: HTTP API.