Types & Enums
@kalamdb/client exports the app-facing runtime enums and rich TypeScript types.
Runtime enums
Auth types
ClientOptions (construction)
createClient({ ... }) accepts a ClientOptions object. Common fields:
url: string— server base URLauthProvider: () => Promise<AuthCredentials>— required auth source for the high-level clientauthProviderMaxAttempts?: number— retry attempts for transient auth-provider failuresauthProviderInitialBackoffMs?: number— initial auth-provider retry backoffauthProviderMaxBackoffMs?: number— max auth-provider retry backoffwsLazyConnect?: boolean— defaulttrue; defer the WebSocket until the first subscription/live callpingIntervalMs?: number— default5000; application-level keepalive intervaldisableCompression?: boolean— dev-only debugging (?compress=false)wasmUrl?: string | BufferSource— override WASM loadingonConnect?,onDisconnect?,onError?,onReceive?,onSend?— connection lifecycle callbackslogLevel?,logListener?— SDK logging controls
There is no high-level auth or autoConnect option on createClient(...).
createConsumerClient({ ... }) from @kalamdb/consumer accepts the same base options plus consumerWasmUrl?: string | BufferSource for worker-only WASM resolution.
Query response model
Prefer named_rows when present. Helper methods queryOne()/queryAll() wrap those rows as RowData, while queryRows() wraps them as FILE-aware KalamRow<T> values.
Subscription and consumer types
ServerMessageSubscriptionOptionsSubscriptionCallback
The topic worker types moved into @kalamdb/consumer:
ConsumeRequestConsumeResponseConsumeMessageConsumeContextConsumerHandleAckResponse
ServerMessage from generated declarations includes:
- auth events (
auth_success,auth_error) - subscription events (
subscription_ack,initial_data_batch,change,error)
UserId branded type
types.ts defines a branded UserId:
Use this in service pipelines when you want stricter domain typing.
KalamDataType
KalamDataType mirrors the server’s canonical column type enum and schema
metadata. The SDK supports both scalar and parameterized variants:
| KalamDB type | TypeScript metadata value | Query row wire value |
|---|---|---|
BOOLEAN | 'Boolean' | boolean |
INT | 'Int' | number |
SMALLINT | 'SmallInt' | number |
BIGINT | 'BigInt' | string for Int64 precision |
DOUBLE | 'Double' | number |
FLOAT | 'Float' | number |
TEXT | 'Text' | string |
TIMESTAMP | 'Timestamp' | numeric timestamp or ISO string |
DATE | 'Date' | Date32 day offset or ISO date |
DATETIME | 'DateTime' | numeric timestamp or ISO string |
TIME | 'Time' | microseconds since midnight or time string |
JSON | 'Json' | JSON value |
BYTES | 'Bytes' | byte-number array |
EMBEDDING(n) | { Embedding: n } | number array |
UUID | 'Uuid' | UUID string |
DECIMAL(p,s) | { Decimal: { precision, scale } } | exact decimal string |
FILE | 'File' | FILE reference JSON |
Use KalamCellValue accessors for row reads and @kalamdb/orm for Drizzle
column generation from this metadata.
Row helper methods
Use client helpers instead of manual parsing:
KalamCellValue & RowData
Every cell in a RowData row is wrapped in a KalamCellValue — a typed
accessor class that mirrors the Rust KalamCellValue newtype.
See Cell Values (KalamCellValue) for the full API including all accessor methods and FILE column support.
Type-only imports
Prefer import type for large type sets in app code: