import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration'; /** * Capture the current personal shortcut revision for an explicit later change. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param layoutId - Explicitly selected layout within the account. * @param signal - Caller-owned cancellation signal. * @returns The snapshot whose revision must remain attached to the reviewed change. */ export async function prepareFavouriteChange( client: Client, accountId: string, layoutId: string, signal: AbortSignal, ) { return client.layoutFavourites.get(accountId, layoutId, { signal, timeoutMs: 15_000 }); } /** * Submit one confirmed shortcut addition without rebasing or automatic retry. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param layoutId - Explicitly selected layout within the account. * @param opened - Record retained from the review that authorised this change. * @param target - Shortcut target explicitly selected by the person. * @param requestId - New identity created once for this explicit user intent. * @param signal - Caller-owned cancellation signal. * @returns A receipt for this request; retain its identity if delivery becomes uncertain. */ export async function addReviewedFavourite( client: Client, accountId: string, layoutId: string, opened: Awaited>, target: Extract[2], { operation: 'add' }>['target'], requestId: string, signal: AbortSignal, ) { return client.layoutFavourites.change(accountId, layoutId, { requestId, reviewedRevision: opened.revision, operation: 'add', target, }, { signal, timeoutMs: 15_000 }); }