@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
38 lines • 1.85 kB
TypeScript
import type { LinearAccessor } from '../../accessor/linear.ts';
import { type FileEvent, type JsonValue, type PathSpec } from '../../types.ts';
/**
* Map one Linear webhook delivery onto mount paths.
*
* The consumer owns the receiver and passes the delivery's `type` (the
* `Linear-Event` header) with the JSON body. Nothing here runs a loop. `Issue`
* and `Comment` map; every other entity maps to nothing.
*
* An issue is the directory `teams/<team>/issues/<KEY-N>__<id>` with
* `issue.json` and `comments.jsonl`, both named as `readdir` names them. An
* issue body carries its team, so its path needs no call; a comment names only
* its issue, which is read once through `issue(id)` and remembered. A team the
* mount's `teamIds` leaves out maps to nothing.
*
* A new issue creates both files and a removed one deletes its directory. An
* archived issue leaves the listing as a removed one does, and one restored
* from the archive comes back as new. An issue moved to another team changes
* its key too, so its old place is gone: the old team's `issues` is UNKNOWN. A
* project file lists its team's issues with their keys, titles and states, so
* an issue that is or was in a project and is created, removed, archived,
* moved or changes one of those is UNKNOWN on its team's `projects`. A comment
* created, edited or removed updates its issue's `comments.jsonl`.
*
* Mirrors Python `LinearEventHook` (`core/linear/events.py`).
*/
export declare class LinearEventHook {
private readonly accessor;
private readonly teams;
private readonly issues;
constructor(accessor: LinearAccessor);
private teamDir;
private issueDir;
private issue;
private comment;
toEvents(root: PathSpec, eventType: string, payload: JsonValue): Promise<readonly FileEvent[]>;
}
//# sourceMappingURL=events.d.ts.map