@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
58 lines • 2.55 kB
TypeScript
import type { JsonValue } from '../../../types.ts';
/**
* UTC day directory for a Slack timestamp, or null for one that names no day.
*
* Bucketing is UTC because `dateRange` in `readdir` is, so a 6pm PDT message
* belongs to the *next* day's directory. Reading the consumer's local clock
* here would name a directory the mount does not serve, and a notify on a path
* that does not exist is silent.
*/
export declare function dayOf(ts: unknown): string | null;
/**
* Channel and ts a reaction or pin event points at.
*
* Both wrap the thing they happened to in an `item` rather than naming it at
* the top level, and both spell the id `channel` inside it where `file_shared`
* spells it `channel_id` outside.
*/
export declare function itemChannel(payload: JsonValue): [string | null, string | null];
/**
* The message object an event is about.
*
* An edit and a deletion both describe another message rather than themselves,
* and nest it under a different key.
*/
export declare function subject(payload: JsonValue): JsonValue;
/**
* The ts of the message an event is about.
*
* Not always the event's own `ts`: an edit and a deletion both arrive stamped
* now while naming a message from any earlier day, so taking the top-level ts
* would refresh today's directory and leave the day that actually changed
* stale.
*/
export declare function messageTs(payload: JsonValue): string | null;
/** Whether a thread reply was also sent to the channel. */
export declare function isBroadcast(payload: JsonValue): boolean;
/**
* Timestamps whose day directories a message event makes stale.
*
* Usually just the message's own, but a thread reply is the case that breaks
* that: `chat.jsonl` renders `conversations.history`, which returns parents
* only, so a reply is in no day file at all. What changed is the *parent's*
* row, whose `reply_count` and `latest_reply` the same listing carries, in the
* parent's day. A reply to a week-old thread therefore refreshes a week-old
* directory and leaves today's alone.
*
* A broadcast reply is the exception to the exception: Slack puts it in the
* channel history too, so both days change.
*/
export declare function affectedTs(payload: JsonValue): readonly string[];
/**
* The conversation id a listing event names.
*
* Slack spells it two ways for the same family: `channel_deleted` sends the
* bare id, `channel_rename` sends the whole channel object.
*/
export declare function channelIdOf(payload: JsonValue): string | null;
//# sourceMappingURL=payload.d.ts.map