# @purista/dapr-sdk API

SDK and helper to run PURISTA services with Dapr.

---
Canonical: /handbook/api/modules/_purista_dapr-sdk/
Format: Markdown for agents
---

SDK and helper to run PURISTA services with Dapr.

Package: `@purista/dapr-sdk`

## Signature

```typescript
@purista/dapr-sdk
```

## Examples

```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()
```

## Members

### Enumerations

- `enum DaprPubSubStatusEnum` — Status values returned to Dapr Pub/Sub callbacks.

### Classes

- `class DaprClient` — HTTP client for Dapr sidecar APIs used by the Dapr event bridge.
- `class DaprConfigStore` — Config store adapter backed by Dapr configuration components.
- `class DaprSecretStore` — Secret store adapter backed by a Dapr secret component.
- `class DaprStateStore` — State store adapter backed by a Dapr state component.

### Type Aliases

- `type BulkSubscribeConfig = void` — BulkSubscribeConfig defines the configuration for a bulk subscription
- `type BulkSubscribeOptions = void` — BulkSubscribeOptions enlists the options for bulk subscribe
- `type BulkSubscribeResponse = void` — BulkSubscribeResponse is the response for a bulk subscribe request
- `type BulkSubscribeResponseEntry = void` — BulkSubscribeResponseEntry is the response entry for a bulk subscribe request
- `type DaprClientConfig = void` — Configuration for clients that call the local Dapr sidecar.
- `type DaprConfigStoreConfig = void` — Configuration for DaprConfigStore.
- `type DaprEventBridgeConfig = Prettify<HttpEventBridgeConfig & { clientConfig: DaprClientConfig }>` — Configuration for DaprEventBridge.
- `type DaprPubSubRouteType = void` — Rule-based Dapr Pub/Sub route configuration.
- `type DaprPubSubRuleType = void` — DaprPubSubRuleType defines a rule set
- `type DaprPubSubType = void` — DaprPubSubType is the Type used by the Dapr API to interface with its PubSub component
- `type DaprSecretStoreConfig = void` — Configuration for DaprSecretStore.
- `type DaprStateStoreConfig = void` — Configuration for DaprStateStore.
- `type KeyValueType = object` — Dapr metadata key-value map.
- `type PubSubBulkPublishApiResponse = void` — Response from a bulk publish API request.
- `type PubSubBulkPublishApiResponseStatus = void` — Failed entry reported by Dapr's bulk publish API response.
- `type PubSubBulkPublishEntry = void` — PubSubBulkPublishEntry defines an entry in a bulk publish request.
- `type PubSubBulkPublishMessage = PubSubBulkPublishMessageExplicit | object | string` — PubSubBulkPublishMessage is a message in a bulk publish request.
- `type PubSubBulkPublishMessageExplicit = void` — Explicit Dapr bulk publish message with per-entry metadata.
- `type PubSubBulkPublishResponse = void` — PubSubBulkPublishResponse defines the response from a bulk publish request.
- `type PubSubBulkPublishResponseFailedEntry = void` — Failed entry collected while preparing or sending a bulk publish request.
- `type PubSubPublishOptions = void` — Options forwarded to Dapr Pub/Sub publish operations.
- `type PubSubPublishResponseType = void` — PubSubPublishResponseType defines the response from a publish.
- `type PubSubSubscriptionOptionsType = void` — PubSubSubscriptionOptionsType defines the options we can pass while subscribing
- `type PubSubSubscriptionsType = object` — This defines the entire object containing pubsubNames
- `type PubSubSubscriptionTopicRoutesType = object` — This defines the routes object
- `type PubSubSubscriptionTopicRouteType = void` — This defines the routeName object
- `type PubSubSubscriptionTopicType = void` — This defines the topicName object
- `type PubSubSubscriptionType = object` — This defines the pubsubName object
- `type TypeDaprPubSubCallback = (data: unknown, headers: Record<string, string>) => Promise<unknown | undefined>` — Callback invoked for Dapr Pub/Sub message delivery.

### Variables

- `const configRoute: RouterFunction` — Dapr actor configuration endpoint.
- `const DAPR_API_VERSION: "v1.0"` — Default Dapr HTTP API version used by sidecar requests.
- `const DEFAULT_DAPR_HOST: "http://127.0.0.1"` — Default HTTP host of a local Dapr sidecar.
- `const DEFAULT_DAPR_PORT: "3500"` — Default HTTP port of a local Dapr sidecar.
- `const puristaVersion: "3.0.1"` — The PURISTA package version embedded in the published runtime build.

### Functions

- `getDefaultClientConfig(): { appPrefix: string; daprApiToken: undefined; daprApiVersion: string; daprHost: string; daprPort: string; isKeepAlive: boolean; ... }`
- `getDefaultConfig(): { apiPrefix: string; clientConfig: { appPrefix: string; daprApiToken: undefined; daprApiVersion: string; daprHost: string; daprPort: string; isKeepAlive: boolean; ... }; commandPayloadAsCloudEvent: boolean; enableRestApiExpose: boolean; name: string; pathPrefix: string; ... }`

### Event bridge

- `class DaprEventBridge` — Event bridge that connects PURISTA services to the local Dapr sidecar.
