Skip to content

PURISTA API


PURISTA API / @purista/dapr-sdk

@purista/dapr-sdk

SDK and helpers for running PURISTA services with Dapr.

The package provides:

  • DaprEventBridge for command invocation, subscriptions, and events through the Dapr sidecar
  • DaprClient for sidecar HTTP calls
  • DaprConfigStore, DaprSecretStore, and DaprStateStore adapters
typescript
import { serve } from '@hono/node-server'
import { DaprConfigStore, DaprEventBridge, DaprSecretStore, DaprStateStore } from '@purista/dapr-sdk'
import { initLogger } from '@purista/core'

const logger = initLogger()

const eventBridge = new DaprEventBridge({
	logger,
	serve,
})

const secretStore = new DaprSecretStore({ logger, secretStoreName: 'local-secret-store' })
const stateStore = new DaprStateStore({ logger, stateStoreName: 'local-state-store' })
const configStore = new DaprConfigStore({ logger, configStoreName: 'local-config-store' })

await eventBridge.start()

The default Dapr sidecar endpoint is http://127.0.0.1:3500. Override it with DAPR_HOST, DAPR_HTTP_PORT, or the clientConfig option.

Visit purista.dev

SDK and helper to run PURISTA services with Dapr.

This package provides the Dapr event bridge and adapters for secret, state and config stores provided by Dapr.

Here is a compact example of wiring a PURISTA service to the Dapr sidecar.

Example

typescript
import { DaprConfigStore, DaprEventBridge, DaprSecretStore, DaprStateStore } from '@purista/dapr-sdk'
const eventBridge = new DaprEventBridge({
   spanProcessor,
   logger,
   serve,
 })

const secretStore = new DaprSecretStore({ logger, secretStoreName: 'local-secret-store' })
const stateStore = new DaprStateStore({ logger, stateStoreName: 'local-state-store' })
const configStore = new DaprConfigStore({ logger, configStoreName: 'local-config-store' })

// start the services ...

await eventBridge.start()

Enumerations

Classes

Type Aliases

Variables

Functions

Event bridge