Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ updates:
prefix: chore
prefix-development: chore

- package-ecosystem: docker
directory: "/test/docker"
schedule:
interval: weekly
open-pull-requests-limit: 10
assignees:
- thenativeweb/internal_dev
labels:
- Dependencies
commit-message:
prefix: chore

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ EventSourcingDB enables you to build and operate event-driven applications with

For more information on EventSourcingDB, see its [official documentation](https://docs.eventsourcingdb.io/).

This client SDK includes support for [Testcontainers](https://testcontainers.com/) to spin up EventSourcingDB instances in integration tests. For details, see [Using Testcontainers](#using-testcontainers).

## Getting Started

Import the `Client` class and create an instance by providing the URL of your EventSourcingDB instance and the API token to use:
Expand Down Expand Up @@ -356,3 +358,52 @@ for await (const eventType of client.readEventTypes()) {
// reading to end.
controller.abort();
```

### Using Testcontainers

Import the `EventSourcingDbContainer` class, create an instance, call the `start` function to run a test container, get a client, run your test code, and finally call the `stop` function to stop the test container:

```typescript
import { EventSourcingDbContainer } from 'eventsourcingdb';

const container = new EventSourcingDbContainer();
await container.start();

const client = container.getClient();

// ...

await container.stop();
```

To check if the test container is running, call the `isRunning` function:

```typescript
const isRunning = container.isRunning();
```

#### Configuring the Container Instance

By default, `EventSourcingDbContainer` uses the `latest` tag of the official EventSourcingDB Docker image. To change that, call the `withImageTag` function:

```typescript
const container = new EventSourcingDbContainer()
.withImageTag('1.0.0');
```

Similarly, you can configure the port to use and the API token. Call the `withPort` or the `withApiToken` function respectively:

```typescript
const container = new EventSourcingDbContainer()
.withPort(4000)
.withApiToken('secret');
```

#### Configuring the Client Manually

In case you need to set up the client yourself, use the following functions to get details on the container:

- `getHost()` returns the host name.
- `getMappedPort()` returns the port.
- `getBaseUrl()` returns the full URL of the container.
- `getApiToken()` returns the API token.
Loading