@inoovum/eventstore-sdk
v1.0.8
Published
inoovum® Event Store SDK
Readme
@inoovum/eventstore-sdk
A TypeScript SDK for working with inoovum® EventStore
Installation
Using npm:
npm install @inoovum/eventstore-sdkUsing yarn:
yarn add @inoovum/eventstore-sdkUsage
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: '[email protected]'
}
},
{
subject: '/customer',
type: 'added',
data: {
firstName: 'Alfred',
lastName: 'Pennyworth',
emailAddress: '[email protected]'
}
},
{
subject: '/customer/fed2902d-0135-460d-8605-263a06308448',
type: 'personalDataChanged',
data: {
firstName: 'Angus',
lastName: 'MacGyer',
emailAddress: '[email protected]'
}
}
]);
// Use the EventStore status methods
await eventStore.audit();
await eventStore.ping();
License
MIT
Author
E-Mail: [email protected] URL: http://www.inoovum.io
