import type { ESPCDFGroup } from "../entities/ESPCDFGroup"; import type { ESPCDFNode } from "../entities/ESPCDFNode"; /** Options for `addNodesToGroup`. */ export interface ESPCDFAttachNodesOptions { /** * `true` when `nodes` is the group's full fetch result. Snapshot nodes the * group lists but `nodes` lacks are then deleted. Leave unset for a partial * add, such as one newly provisioned node. */ complete?: boolean; } export interface GroupStoreCallbacks { setGroupsList(groups: ESPCDFGroup[]): void; setCurrentHomeId(id: string | null): void; /** Add a single group to the store (e.g. after createHome) */ addGroup(group: ESPCDFGroup): void; /** Add nodes to a group; CDF updates group.nodeDetails and nodeStore. See {@link ESPCDFAttachNodesOptions}. */ addNodesToGroup(groupId: string, nodes: ESPCDFNode[], options?: ESPCDFAttachNodesOptions): void; /** Handle node update events */ onNodeUpdate?: (update: Record) => void; /** `true` while the home tree in the store is synced and nothing has marked it stale. */ isTreeSynced?: () => boolean; /** Records that a full home sync finished. */ markTreeSynced?: () => void; /** The currently selected home, if any. */ getCurrentHome?: () => ESPCDFGroup | null; /** A node already held by the store, if any. */ getNodeById?: (nodeId: string) => ESPCDFNode | undefined; /** Saves the home tree to disk after a successful full sync (fire-and-forget). */ persistSnapshot?: () => void; }