import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration'; /** * Read definitions for a deliberate function-order editing session. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param locomotiveId - Explicitly selected locomotive. * @param signal - Caller-owned cancellation signal. * @returns Current definitions and revisions to retain during review. */ export async function readFunctionOrder( client: Client, accountId: string, locomotiveId: string, signal: AbortSignal, ) { return client.locomotiveFunctions.list(accountId, locomotiveId, { signal, timeoutMs: 15_000 }); } /** * Save the explicitly reviewed order with each original revision. * @param client - Configured client; the caller owns current authority. * @param accountId - Authorised account for this workflow. * @param locomotiveId - Explicitly selected locomotive. * @param functions - Ordered function identities and their reviewed revisions. * @returns Saved definitions; arranging them does not activate a locomotive function. */ export async function saveReviewedFunctionOrder( client: Client, accountId: string, locomotiveId: string, functions: Parameters[2]['functions'], ) { return client.locomotiveFunctions.arrange(accountId, locomotiveId, { functions }); }