@schemeless/event-store-react-native
Version:
React Native compatible build of the [`@schemeless/event-store`](../event-store) runtime. It mirrors the Node.js implementation but swaps the internal queue implementation to [`react-native-better-queue`](https://github.com/YahyaASadiq/react-native-better
10 lines (8 loc) • 413 B
text/typescript
import type { CreatedEvent, EventFlow } from '@schemeless/event-store-types';
import { logEvent } from '../util/logEvent';
export const preApply = async (eventFlow: EventFlow<any>, event: CreatedEvent<any>): Promise<CreatedEvent<any>> => {
logEvent(event, '🪁️', 'PreApply');
if (!eventFlow.preApply) return event;
const remakeEvent = await eventFlow.preApply(event);
return remakeEvent || event;
};