Installation
Initialization
registerWorker
Creates and returns a connected SDK instance. The WebSocket connection is established automatically — there is no separateconnect() call.
Signature
Parameters
Example
Methods
registerTrigger
Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs. SignatureParameters
Example
registerFunction
Registers a new function with a local handler or an HTTP invocation config. SignatureParameters
Example
trigger
Invokes a function using a request object. SignatureParameters
Example
registerTriggerType
Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs. SignatureParameters
Example
unregisterTriggerType
Unregisters a trigger type. SignatureParameters
Example
shutdown
Gracefully shutdown the iii, cleaning up all resources. SignatureExample
Subpath Exports
Theiii-sdk package provides additional entry points:
Types
iii-sdk
EnqueueResult · InitOptions · JsonValue · MiddlewareFunctionInput · StreamRequest · StreamResponse · TelemetryOptions
EnqueueResult
Result returned when a function is invoked withTriggerAction.Enqueue.
InitOptions
Configuration options passed to registerWorker.JsonValue
Any JSON value: the TypeScript equivalent of the engine’s arbitrary-JSON wire values (Rustserde_json::Value). Used where the wire contract is
“any JSON”, e.g. per-invocation metadata.
MiddlewareFunctionInput
Input passed to the RBAC middleware function on every function invocation through the RBAC port. The middleware can inspect, modify, or reject the call before it reaches the target function.StreamRequest
Incoming streaming request received by a function registered with a stream trigger.StreamResponse
Response object passed to streaming function handlers. Usestatus() and
headers() to set response metadata, write to stream for streaming
responses, and call close() when done.
TelemetryOptions
Worker labels reported to the engine (language, framework, project).iii-sdk/channel
Channel · ChannelReader · ChannelWriter · StreamChannelRef
Channel
A streaming channel pair for worker-to-worker data transfer. Created via thecreateChannel helper from iii-sdk/helpers.
ChannelReader
Read end of a streaming channel. Provides both a Node.jsReadable stream
for binary data and an onMessage callback for structured text messages.
ChannelWriter
Write end of a streaming channel. Provides both a Node.jsWritable stream
and a sendMessage method for sending structured text messages.
StreamChannelRef
Serializable reference to one end of a streaming channel. Can be included in invocation payloads to pass channel endpoints between workers.iii-sdk/engine
RemoteFunctionHandler
RemoteFunctionHandler
Async function handler for a registered function. Receives the invocation payload and an optional per-invocationmetadata value, and returns the
result.
metadata is arbitrary JSON travelling on a separate channel from the
payload. It is undefined when the caller did not attach any. Existing
single-argument handlers keep working — they ignore the extra argument.
iii-sdk/errors
InvocationError · InvocationErrorInit
InvocationError
InvocationErrorInit
Typed error surfaced when an invocation dispatched over the SDK fails, RBAC rejection (FORBIDDEN), handler-level failure, or a timeout waiting for the engine to respond. Wraps the wireErrorBody shape plus the function_id
that was targeted, so callers get a single error type across all failure
modes and can disambiguate via err.code.
Before this existed, rejection values were plain ErrorBody-shaped objects,
which printed as [object Object] when stringified, leaving developers to
grep through SDK source to figure out what tripped. The class name, code
prefix in the message, and function_id field together make a rejection
self-describing.
iii-sdk/helpers
ChannelDirection · ChannelItem
ChannelDirection
Direction of a streaming channel endpoint. Mirrors the Rust SDK’sChannelDirection enum and matches the literal values used by
StreamChannelRef.direction.
ChannelItem
Discriminated runtime tag for an item observed on a streaming channel. Mirrors the Rust SDK’sChannelItem enum (Text / Binary). Carrier for
factory + type-guard helpers so callers can construct and discriminate
channel items without depending on Rust-specific shape.
iii-sdk/internal
InternalHttpRequest
InternalHttpRequest
iii-sdk/protocol
ErrorBody · MessageType · RegisterFunctionFormat · RegisterFunctionInput · RegisterFunctionMessage · RegisterFunctionOptions · RegisterTriggerInput · RegisterTriggerMessage · RegisterTriggerTypeInput · RegisterTriggerTypeMessage · TriggerRequest
ErrorBody
MessageType
RegisterFunctionFormat
RegisterFunctionInput
RegisterFunctionMessage
RegisterFunctionOptions
RegisterTriggerInput
RegisterTriggerMessage
RegisterTriggerTypeInput
RegisterTriggerTypeMessage
TriggerRequest
Request object passed to IIIClient.trigger.iii-sdk/runtime
FunctionRef · IIIConnectionState · TriggerTypeRef
FunctionRef
Handle returned by IIIClient.registerFunction. Contains the function’sid and an unregister() method.
IIIConnectionState
Connection state for the III WebSocketTriggerTypeRef
Typed handle returned by IIIClient.registerTriggerType. Provides convenience methods to register triggers and functions scoped to this trigger type, so callers don’t need to repeat thetype field.
iii-sdk/state
IState · StateDeleteInput · StateDeleteResult · StateEventData · StateEventType · StateGetInput · StateListInput · StateSetInput · StateSetResult · StateUpdateInput · StateUpdateResult
IState
Interface for state management operations. Available via theiii-sdk/state
subpath export.
StateDeleteInput
Input for deleting a state value.StateDeleteResult
Result of a state delete operation.StateEventData
Payload for state change events.StateEventType
Types of state change events.StateGetInput
Input for retrieving a state value.StateListInput
Input for listing all values in a state scope.StateSetInput
Input for setting a state value.StateSetResult
Result of a state set operation.StateUpdateInput
Input for atomically updating a state value.StateUpdateResult
Result of a state update operation.iii-sdk/stream
IStream
IStream
Interface for custom stream implementations. Passed toIIIClient.createStream
to override the engine’s built-in stream storage.
iii-sdk/trigger
Trigger · TriggerConfig · TriggerHandler
Trigger
Handle returned by IIIClient.registerTrigger. Useunregister() to
remove the trigger from the engine.
TriggerConfig
Configuration passed to a trigger handler when a trigger instance is registered or unregistered.TriggerHandler
Handler interface for custom trigger types. Passed toIIIClient.registerTriggerType.