Skip to Content
🚀 KalamDB v0.3.0-alpha2 is out — Learn more
SDK & ClientTypes & Enums

Types & Enums

kalam-link exports both runtime enums and rich TypeScript types.

Runtime enums

import { MessageType, ChangeType } from 'kalam-link';
enum MessageType { SubscriptionAck = 'subscription_ack', InitialDataBatch = 'initial_data_batch', Change = 'change', Error = 'error', } enum ChangeType { Insert = 'insert', Update = 'update', Delete = 'delete', }

Auth types

type AuthCredentials = | { type: 'basic'; username: string; password: string } | { type: 'jwt'; token: string } | { type: 'none' };

Query response model

interface QueryResponse { status: 'success' | 'error'; results: QueryResult[]; took?: number; error?: ErrorDetail; } interface QueryResult { schema: SchemaField[]; rows?: unknown[][]; row_count: number; message?: string; }

Subscription and consumer types

  • ServerMessage
  • SubscriptionOptions
  • SubscriptionCallback
  • ConsumeRequest
  • ConsumeResponse
  • ConsumeMessage
  • ConsumeContext
  • ConsumerHandle
  • AckResponse

Username branded type

types.ts defines a branded Username:

type Username = string & { readonly __brand: unique symbol }; function Username(value: string): Username;

Use this in consumer pipelines when you want stricter domain typing.

Row parsing helper

import { parseRows } from 'kalam-link'; interface UserRow { id: string; name: string } const rows = parseRows<UserRow>(response);

Type-only imports

Prefer import type for large type sets in app code:

import type { QueryResponse, ServerMessage, ConsumeRequest } from 'kalam-link';
Last updated on