Skip to main content

Installation

Initialization

registerWorker

Creates and returns a connected SDK instance. The WebSocket connection is established automatically — there is no separate connect() call. Signature

Parameters

Example

Methods

registerTrigger

Registers a new trigger. A trigger is a way to invoke a function when a certain event occurs. Signature

Parameters

Example

registerFunction

Registers a new function with a local handler or an HTTP invocation config. Signature

Parameters

Example

trigger

Invokes a function using a request object. Signature

Parameters

Example

registerTriggerType

Registers a new trigger type. A trigger type is a way to invoke a function when a certain event occurs. Signature

Parameters

Example

unregisterTriggerType

Unregisters a trigger type. Signature

Parameters

Example

addConnectionStateListener

Subscribe to connection-state transitions. The handler is fired immediately with the current state, then on every transition. Multiple listeners are supported. Returns an unsubscribe function. Signature

Parameters

Example

shutdown

Gracefully shutdown the iii, cleaning up all resources. Signature

Example

Subpath Exports

The iii-browser-sdk package provides additional entry points:

Types

iii-browser-sdk

ApiRequest · ApiResponse · AuthInput · AuthResult · Channel · ChannelReader · ChannelWriter · EnqueueResult · FunctionRef · IIIConnectionState · InitOptions · MessageType · MiddlewareFunctionInput · OnFunctionRegistrationInput · OnFunctionRegistrationResult · OnTriggerRegistrationInput · OnTriggerRegistrationResult · OnTriggerTypeRegistrationInput · OnTriggerTypeRegistrationResult · RegisterFunctionInput · RegisterFunctionMessage · RegisterFunctionOptions · RegisterTriggerInput · RegisterTriggerMessage · RegisterTriggerTypeInput · RegisterTriggerTypeMessage · RemoteFunctionHandler · StreamChannelRef · Trigger · TriggerConfig · TriggerHandler · TriggerRequest · TriggerTypeRef

ApiRequest

Incoming HTTP request received by a function registered with an HTTP trigger.

ApiResponse

Structured API response returned from HTTP function handlers.

AuthInput

Input passed to the RBAC auth function during WebSocket upgrade. Contains the HTTP headers, query parameters, and client IP from the connecting worker’s upgrade request.

AuthResult

Return value from the RBAC auth function. Controls which functions the authenticated worker can invoke and what context is forwarded to the middleware.

Channel

A streaming channel pair for worker-to-worker data transfer. Created via the createChannel helper from iii-browser-sdk/helpers.

ChannelReader

Read end of a streaming channel. Uses native browser WebSocket.

ChannelWriter

Write end of a streaming channel. Uses native browser WebSocket.

EnqueueResult

Result returned when a function is invoked with TriggerAction.Enqueue.

FunctionRef

Handle returned by ISdk.registerFunction. Contains the function’s id and an unregister() method.

IIIConnectionState

Connection state for the III WebSocket

InitOptions

Configuration options passed to registerWorker.

MessageType

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.

OnFunctionRegistrationInput

Input passed to the on_function_registration_function_id hook when a worker attempts to register a function through the RBAC port. Return an OnFunctionRegistrationResult with the (possibly mapped) fields, or throw to deny the registration.

OnFunctionRegistrationResult

Result returned from the on_function_registration_function_id hook. All fields are optional — omitted fields keep the original value from the registration request.

OnTriggerRegistrationInput

Input passed to the on_trigger_registration_function_id hook when a worker attempts to register a trigger through the RBAC port. Return an OnTriggerRegistrationResult with the (possibly mapped) fields, or throw to deny the registration.

OnTriggerRegistrationResult

Result returned from the on_trigger_registration_function_id hook. All fields are optional — omitted fields keep the original value from the registration request.

OnTriggerTypeRegistrationInput

Input passed to the on_trigger_type_registration_function_id hook when a worker attempts to register a new trigger type through the RBAC port. Return an OnTriggerTypeRegistrationResult with the (possibly mapped) fields, or throw to deny the registration.

OnTriggerTypeRegistrationResult

Result returned from the on_trigger_type_registration_function_id hook. All fields are optional — omitted fields keep the original value from the registration request.

RegisterFunctionInput

RegisterFunctionMessage

RegisterFunctionOptions

RegisterTriggerInput

RegisterTriggerMessage

RegisterTriggerTypeInput

RegisterTriggerTypeMessage

RemoteFunctionHandler

Async function handler for a registered function. Receives the invocation payload and returns the result.

StreamChannelRef

Serializable reference to one end of a streaming channel. Can be included in invocation payloads to pass channel endpoints between workers.

Trigger

Handle returned by ISdk.registerTrigger. Use unregister() 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 to ISdk.registerTriggerType.

TriggerRequest

Request object passed to ISdk.trigger.

TriggerTypeRef

Typed handle returned by ISdk.registerTriggerType. Provides convenience methods to register triggers and functions scoped to this trigger type, so callers don’t need to repeat the type field.

iii-browser-sdk/state

DeleteResult · IState · StateDeleteInput · StateDeleteResult · StateEventData · StateEventType · StateGetInput · StateListInput · StateSetInput · StateSetResult · StateUpdateInput · StateUpdateResult

DeleteResult

Result of a state delete operation.

IState

Interface for state management operations. Available via the iii-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-browser-sdk/stream

IStream · MergePath · StreamAuthInput · StreamAuthResult · StreamChangeEvent · StreamContext · StreamDeleteInput · StreamGetInput · StreamJoinLeaveEvent · StreamJoinLeaveTriggerConfig · StreamJoinResult · StreamListGroupsInput · StreamListInput · StreamSetInput · StreamSetResult · StreamTriggerConfig · StreamUpdateInput · StreamUpdateResult · UpdateAppend · UpdateDecrement · UpdateIncrement · UpdateMerge · UpdateOp · UpdateOpError · UpdateRemove · UpdateSet

IStream

Interface for custom stream implementations. Passed to ISdk.createStream to override the engine’s built-in stream storage.

MergePath

Path target for a UpdateMerge op. Accepts:
  • a single string (legacy / first-level field)
  • an array of literal segments (nested path; each element is one literal key, dots are NOT interpreted as separators)
Omit path, pass "", or pass [] to target the root value.

StreamAuthInput

Input for stream authentication.

StreamAuthResult

Result of stream authentication.

StreamChangeEvent

Handler input for stream triggers, fired when an item changes via stream::set, stream::update, or stream::delete.

StreamContext

Context type extracted from StreamAuthResult.

StreamDeleteInput

Input for deleting a stream item.

StreamGetInput

Input for retrieving a single stream item.

StreamJoinLeaveEvent

Event payload for stream join/leave events.

StreamJoinLeaveTriggerConfig

Trigger config for stream:join and stream:leave triggers.

StreamJoinResult

Result of a stream join request.

StreamListGroupsInput

Input for listing all groups in a stream.

StreamListInput

Input for listing all items in a stream group.

StreamSetInput

Input for setting a stream item.

StreamSetResult

Result of a stream set operation.

StreamTriggerConfig

Trigger config for stream triggers. Filters which item changes fire the handler.

StreamUpdateInput

Input for atomically updating a stream item.

StreamUpdateResult

Result of a stream update operation.

UpdateAppend

Append an element to an array, concatenate a string, or push a new value at a nested path. The target is the root (when path is omitted, empty, or []), a single first-level key (when path is a non-empty string), or an arbitrary nested location (when path is an array of literal segments). See MergePath. Engine semantics: missing/null intermediates along a nested path are auto-created; missing leaves on a nested path always become arrays (no string-concat tier); existing object/scalar leaves return append.type_mismatch. Each path segment is a literal key, ["a.b"] targets a single key named "a.b", not a → b.

UpdateDecrement

Decrement a numeric field by a given amount.

UpdateIncrement

Increment a numeric field by a given amount.

UpdateMerge

Shallow-merge an object into the target. The target is the root (when path is omitted/empty) or an arbitrary nested location specified by an array of literal segments. See MergePath. Validation: invalid paths/values (depth > 32, segment > 256 bytes, value depth > 16, > 1024 top-level keys, or any __proto__/constructor/prototype segment or top-level key) are rejected with a structured error in the response’s errors array.

UpdateOp

Union of all atomic update operations supported by streams.

UpdateOpError

Per-op error returned by state::update / stream::update.

UpdateRemove

Remove a field at the given path.

UpdateSet

Set a field at the given path to a value.