UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

55 lines • 2.58 kB
import type { TrelloAccessor } from '../../accessor/trello.ts'; import { type FileEvent, type JsonValue, type PathSpec } from '../../types.ts'; /** * Map one Trello webhook delivery onto mount paths. * * The consumer owns the callback URL and passes the action's `type` with the * whole delivery body (`action` and `model`). Nothing here runs a loop. * * Every directory is `<name>__<id>`, and an action names the board, list and * card it touched with both, so a path is built from the action alone; only * the workspace a board sits in is read, once per board, from the delivery's * board `model` or `/boards/<id>`. A board outside the mount's `workspaceId` * or `boardIds` maps to nothing. * * A card is the directory `.../lists/<list>/cards/<card>` with `card.json` and * `comments.jsonl`. A card made or moved in creates both, and one deleted, * archived or moved to another board deletes its directory; a deleted card * names no name, so where the hook saw it last is used, and a card it never * saw makes its list's `cards` UNKNOWN. An action on a card that does not name * its list (a label or a member added) reads the card and its list once, and * one Trello no longer has makes the board UNKNOWN. A card renamed or moved * to another list moves both files. A comment updates `comments.jsonl`, and a * change to what `card.json` renders (its fields, labels or members) updates * that. * * A list or a board renamed moves everything below it, which no action lists, * so the old and new directory are UNKNOWN, and the cards the hook remembers * below it move with it; one archived is deleted, and one restored is UNKNOWN. * A board moved out of the mount's workspace is deleted where it was. Any * other change to a list or a board updates its `list.json` or `board.json`. A * label or a board member added, changed or removed is UNKNOWN on `labels` or * `members`, since the file names come from what changed. * * Mirrors Python `TrelloEventHook` (`core/trello/events.py`). */ export declare class TrelloEventHook { private readonly accessor; private readonly workspaces; private readonly orgs; private readonly cards; constructor(accessor: TrelloAccessor); private workspaceDir; private org; private boardDir; private cardDir; private located; private files; private updateCard; private card; private list; private board; private left; toEvents(root: PathSpec, eventType: string, payload: JsonValue): Promise<readonly FileEvent[]>; } //# sourceMappingURL=events.d.ts.map