1.0.8 • Published 5 months ago
@inoovum/eventstore-sdk v1.0.8
@inoovum/eventstore-sdk
A TypeScript SDK for working with inoovum® EventStore
Installation
Using npm:
npm install @inoovum/eventstore-sdk
Using yarn:
yarn add @inoovum/eventstore-sdk
Usage
The following envvars are required
EVENTSTORE_AUTH_TOKEN=cb4ff473-f3f8-4db3-b1da-6226d834860b
EVENTSTORE_API_URL="https://eventstore.domain.tld"
EVENTSTORE_API_VERSION="v1"
import { EventStore } from '@inoovum/eventstore-sdk';
// Initialize the EventStore
const eventStore = new EventStore();
// Use the EventStore methods
await eventStore.streamEvents('/customer');
await eventStore.commitEvents([
{
subject: '/customer',
type: 'added',
data: {
firstName: 'Bruce',
lastName: 'Wayne',
emailAddress: 'bruce.wayne@enterprise.wayne'
}
},
{
subject: '/customer',
type: 'added',
data: {
firstName: 'Alfred',
lastName: 'Pennyworth',
emailAddress: 'alfred.pennyworth@enterprise.wayne'
}
},
{
subject: '/customer/fed2902d-0135-460d-8605-263a06308448',
type: 'personalDataChanged',
data: {
firstName: 'Angus',
lastName: 'MacGyer',
emailAddress: 'angus.macgyer@phoenix.foundation'
}
}
]);
// Use the EventStore status methods
await eventStore.audit();
await eventStore.ping();
License
MIT
Author
E-Mail: support@inoovum.io URL: http://www.inoovum.io