Minimalistic event store implementation
type SomeEvent<T> = { type: string; data: T; }; const streamName = "shoppingcart-1234"; const db = PicoEventStoreImpl("/tmp/databases/my-app"); const streamCreateResult = db.createStream<SomeEvent>(streamName); streamCreateResult.caseOf({ Right: console.log, Left: console.error, }); const cartCreatedEvent: SomeEvent<string> = { type: "CartCreated", data: "1234", }; const appendResult = db.appendToStream<SomeEvent<string>>( streamName, cartCreatedEvent, ); appendResult.caseOf({ Right: console.log, Left: console.error, });
npm run test
Add Package
deno add jsr:@tjercus/pico-event-store
Import symbol
import * as pico_event_store from "@tjercus/pico-event-store";
---- OR ----
Import directly with a jsr specifier
import * as pico_event_store from "jsr:@tjercus/pico-event-store";
Add Package
npx jsr add @tjercus/pico-event-store
Import symbol
import * as pico_event_store from "@tjercus/pico-event-store";
Add Package
yarn dlx jsr add @tjercus/pico-event-store
Import symbol
import * as pico_event_store from "@tjercus/pico-event-store";
Add Package
pnpm dlx jsr add @tjercus/pico-event-store
Import symbol
import * as pico_event_store from "@tjercus/pico-event-store";
Add Package
bunx jsr add @tjercus/pico-event-store
Import symbol
import * as pico_event_store from "@tjercus/pico-event-store";