1
0
Fork 0
polaris-task-force/src/utils/event-log/routine.ts
Z8MB1E 707c5f6c81 feat(event-log): hide routine tick events behind a toggle
Add a client-safe ROUTINE_EVENT_TYPES list (game:tick, economy:tick, market:auto-generate) and hide those types on /events behind an off-by-default Routine ticks switch. The dashboard always excludes them so real events fill the recent list.

Tick bins now skip no-op emissions: game tick requires shipment, construction, or production activity; market tick requires an expiry or generation; economy tick requires processed items or errors. Historical events stay in the database and remain visible via the toggle or the admin panel.
2026-10-19 20:03:51 -04:00

28 lines
833 B
TypeScript

/**
* Routine background events.
*
* These are emitted by the tick bins (game, economy, market) on a schedule and
* are diagnostic noise for members. UI surfaces hide them by default and offer
* a toggle to reveal them; the admin panel always sees everything.
*
* Keep this module client-safe: no Payload imports.
*/
import type { Where } from "payload";
import { EventTypes } from "./eventTypes";
export const ROUTINE_EVENT_TYPES: readonly string[] = [
EventTypes.GameTick,
EventTypes.EconomyTick,
EventTypes.MarketAutoGenerate,
];
export function isRoutineEventType(type: string): boolean {
return ROUTINE_EVENT_TYPES.includes(type);
}
/** Payload `where` fragment that excludes routine events. */
export function excludeRoutineEventsWhere(): Where {
return { type: { not_in: [...ROUTINE_EVENT_TYPES] } };
}