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