debug: log events signed through the API
This commit is contained in:
parent
1a15c21626
commit
1620668d5a
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue