Skip to content

Function: matchesFilter()

Makaio Framework


Makaio Framework / bus-core / matchesFilter

matchesFilter(payload, filter): boolean

Defined in: ../../../packages/bus-core/src/utils/payload-filter.ts:105

Check if a payload matches all filter conditions.

All conditions are ANDed together - all must match for the filter to pass.

unknown

Message payload to check

PayloadFilter

Filter specification with field paths and operators

boolean

true if payload matches all filter conditions

const payload = {
agentId: 'agent-123',
raw: { msg: { type: 'session_configured' } },
status: 'active',
};
// All conditions must match
matchesFilter(payload, {
agentId: 'agent-123',
'raw.msg.type': 'session_configured',
}); // true
// With operators
matchesFilter(payload, {
status: { $in: ['active', 'pending'] },
}); // true
matchesFilter(payload, {
error: { $exists: false },
}); // true (no error field)