debug: log events signed through the API

This commit is contained in:
Alex Gleason 2024-01-01 17:02:09 -06:00
parent 1a15c21626
commit 1620668d5a
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 4 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import { type AppContext } from '@/app.ts';
import { Conf } from '@/config.ts';
import {
type Context,
Debug,
type Event,
EventTemplate,
Filter,
@ -15,6 +16,8 @@ import { signAdminEvent, signEvent } from '@/sign.ts';
import { nostrNow } from '@/utils.ts';
import { eventsDB } from '@/db/events.ts';
const debug = Debug('ditto:api');
/** EventTemplate with defaults. */
type EventStub<K extends number = number> = TypeFest.SetOptional<EventTemplate<K>, 'content' | 'created_at' | 'tags'>;
@ -79,6 +82,7 @@ async function createAdminEvent<K extends number>(t: EventStub<K>, c: AppContext
/** Push the event through the pipeline, rethrowing any RelayError. */
async function publishEvent<K extends number>(event: Event<K>, c: AppContext): Promise<Event<K>> {
debug('EVENT', event);
try {
await pipeline.handleEvent(event);
} catch (e) {