Skip to content

0.14.0

Compare
Choose a tag to compare
@oskardudycz oskardudycz released this 05 Aug 07:50
· 256 commits to main since this release

🚀 What's New

  • Exposed custom projection builders and ProjectionDefinition types. It appeared that ProjectionDefinition types were not exposed, which caused issues with setting up custom projections. Added builders to make that easier. Now you can define custom inline projection as:
import { inlineProjection } from '@event-driven-io/emmett-postgresql';

let handledEventsInCustomProjection: ReadEvent<ShoppingCartEvent>[] = [];

const customProjection = inlineProjection<ShoppingCartEvent>({
  name: 'customProjection',
  canHandle: ['ProductItemAdded', 'DiscountApplied'],
  handle: (events, { client, connectionString }) => {
    handledEventsInCustomProjection.push(...events);
  },
});

Important Note: Such projection will be run in the same PostgreSQL transaction, so if it does longer processing, then it'll slow down the transaction commit. Async projections will come after this Pull Request is done.
by @oskardudycz in 96

Full Changelog: 0.13.0...0.14.0