mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
24 lines
567 B
TypeScript
24 lines
567 B
TypeScript
import type { Snapshot, Workspace } from '@prisma/client';
|
|
|
|
import { Flatten, Payload } from './types';
|
|
|
|
interface EventDefinitions {
|
|
workspace: {
|
|
deleted: Payload<Workspace['id']>;
|
|
};
|
|
|
|
snapshot: {
|
|
updated: Payload<
|
|
Pick<Snapshot, 'id' | 'workspaceId'> & {
|
|
previous: Pick<Snapshot, 'blob' | 'state' | 'updatedAt'>;
|
|
}
|
|
>;
|
|
deleted: Payload<Pick<Snapshot, 'id' | 'workspaceId'>>;
|
|
};
|
|
}
|
|
|
|
export type EventKV = Flatten<EventDefinitions>;
|
|
|
|
export type Event = keyof EventKV;
|
|
export type EventPayload<E extends Event> = EventKV[E];
|