DeltaBase
API reference for DeltaBase
Class: DeltaBase
Section titled “Class: DeltaBase”DeltaBase client for interacting with the Delta-Base platform.
This is the main entry point for the SDK that provides access to:
- Management operations (create/delete event stores)
- Event store operations (append/read events)
- Event bus functionality (subscriptions and real-time updates)
Example
Section titled “Example”// Initialize the clientconst client = new DeltaBase({ apiKey: "your-api-key"});
// Access various functionalityconst management = client.getManagement();const eventStore = client.getEventStore("my-store");const eventBus = client.getEventBus("my-store");
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DeltaBase(
config
):DeltaBase
Creates a new DeltaBase client instance.
Parameters
Section titled “Parameters”config
Section titled “config”Configuration options for connecting to the Delta-Base platform
Returns
Section titled “Returns”DeltaBase
Throws
Section titled “Throws”If apiKey is not provided in the configuration
Example
Section titled “Example”// Create with default URL (localhost development)const client = new DeltaBase({ apiKey: "your-api-key" });
// Create with custom URL (production)const prodClient = new DeltaBase({ baseUrl: "https://api.delta-base.com", apiKey: "your-api-key"});
Methods
Section titled “Methods”getEventBus()
Section titled “getEventBus()”getEventBus(
eventStoreId
):EventBus
Get an EventBus client for a specific event store
Parameters
Section titled “Parameters”eventStoreId
Section titled “eventStoreId”string
The ID of the event store to manage subscriptions for
Returns
Section titled “Returns”An EventBus client instance configured for the specified event store
Example
Section titled “Example”const eventBus = client.getEventBus("my-event-store");const subscription = await eventBus.createSubscription({ name: "user-events", eventFilter: "user.*"});
getEventStore()
Section titled “getEventStore()”getEventStore(
eventStoreId
):EventStore
Get an EventStore client for a specific event store
Parameters
Section titled “Parameters”eventStoreId
Section titled “eventStoreId”string
The ID of the event store to connect to
Returns
Section titled “Returns”An EventStore client instance configured for the specified event store
Example
Section titled “Example”const eventStore = client.getEventStore("my-event-store");await eventStore.appendToStream("user-123", [ { type: "UserCreated", data: { userId: "123", name: "John" } }]);
getManagement()
Section titled “getManagement()”getManagement():
ManagementClient
Get a ManagementClient for managing event stores
Returns
Section titled “Returns”A ManagementClient instance for creating and managing event stores
Example
Section titled “Example”const management = client.getManagement();const eventStore = await management.createEventStore({ name: "my-event-store"});