createCanvasStorage

Assembles an environment's storage surface from its declaration and the host's backends, seeding the session state when the slot is empty.

@internote/canvas-sdkFunction
On this page
import { createCanvasStorage } from '@internote/canvas-sdk';

What the headless host calls when it mounts an environment. A custom host building contexts of its own calls it the same way.

#Signature

<S = unknown>(
    declaration: CanvasStorageDeclaration | undefined,
    session: EnvironmentSessionState<S>,
    db?: KeyValueStorage,
): CanvasStorage<S>

#Parameters

declaration
The definition's storage field, or undefined for the session tier alone.
session
The environment's slot in the host's session store.
db
The host's durable store. Handed on only when the declaration asks for session+db.

Declared in packages/canvas-sdk/src/storage/index.ts:94.

Last updated