All files / realm/blong-commander/browser/orchestrator/portal portalConfigGet.ts

0% Statements 0/40
0% Branches 0/1
0% Functions 0/1
0% Lines 0/40

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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
import {handler} from '@feasibleone/blong';

/**
 * `portalConfigGet` — portal config fallback for the model-less commander
 * browser. App.tsx calls `handler.portalConfigGet({}, {})` unconditionally
 * after login; a model aggregator normally provides it (merging model menus
 * with the `ui.portal.portal` config slice), but commander has no models.
 *
 * This group (`commander.portal`) is imported by the portal orchestrator via
 * the `/.portal$/` pattern — the same mechanism that exposes `ui.portal`
 * methods (e.g. `portalDropdownList`) as bare handler names — so
 * `handler.portalConfigGet` resolves here.
 *
 * NOTE: the `ui.portal.portal` config slice does NOT reach this group's
 * handler `config` (config plumbing only applies to the portal orchestrator
 * itself), so the commander menu is provided as a guaranteed default here.
 */
export default handler(
    ({config}) =>
        async function portalConfigGet(): Promise<Record<string, unknown>> {
            const portal = (config as {portal?: {title?: string; menu?: unknown[]}}).portal ?? {};
            return {
                name: 'blong-commander',
                title: 'Blong Commander',
                ...portal,
                menu: portal.menu ?? [
                    {
                        title: 'Explore',
                        items: [
                            {
                                title: 'Commander',
                                method: 'commander.browse',
                                icon: 'pi pi-sitemap',
                            },
                        ],
                    },
                ],
            };
        },
);