diff --git a/src/handlers/events-query.ts b/src/handlers/events-query.ts index 2b8485758..c011edb3b 100644 --- a/src/handlers/events-query.ts +++ b/src/handlers/events-query.ts @@ -32,10 +32,8 @@ export class EventsQueryHandler implements MethodHandler { return messageReplyFromError(e, 401); } - // if no filter is present in the the `EventsQuery` descriptor, we pass an empty array of filters to the `queryEvents` method - // this will return all events in the event log for the given tenant beyond the cursor provided. - // if no cursor is provided, it will return all events - const eventFilters = message.descriptor.filters ? Events.convertFilters(message.descriptor.filters) : []; + // an empty array of filters means no filtering and all events are returned + const eventFilters = Events.convertFilters(message.descriptor.filters); const { events, cursor } = await this.eventLog.queryEvents(tenant, eventFilters, message.descriptor.cursor); return { diff --git a/src/interfaces/events-query.ts b/src/interfaces/events-query.ts index b29a76d35..1df3f7cc5 100644 --- a/src/interfaces/events-query.ts +++ b/src/interfaces/events-query.ts @@ -23,7 +23,7 @@ export class EventsQuery extends AbstractMessage{ Message.validateJsonSchema(message); await Message.validateSignatureStructure(message.authorization.signature, message.descriptor); - for (const filter of message.descriptor.filters || []) { + for (const filter of message.descriptor.filters) { if ('protocol' in filter && filter.protocol !== undefined) { validateProtocolUrlNormalized(filter.protocol); }