All files / realm/blong-commander/orchestrator/commander nodeAction.ts

47.61% Statements 10/21
100% Branches 1/1
0% Functions 0/1
47.61% Lines 10/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x 1x 1x 1x 1x 1x 1x 1x 1x                       1x  
import {handler} from '@feasibleone/blong';
 
/**
 * commanderNodeAction — generic node actions available to commander clients.
 * Extended in later phases (copy path, open in tab, refresh, execute…).
 */
export default handler(
    () =>
        async function commanderNodeAction(
            params: {action?: string},
            _$meta: Record<string, unknown>,
        ) {
            const available = [
                {name: 'copyPath', title: 'Copy path'},
                {name: 'open', title: 'Open'},
                {name: 'refresh', title: 'Refresh'},
            ];
            if (!params.action) return {items: available};
            return available.find(action => action.name === params.action) ?? {error: 'Unknown action'};
        },
);