All files / demo/blong-cli/text/orchestrator text.ts

100% Statements 37/37
100% Branches 2/2
100% Functions 0/0
100% Lines 37/37

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 386x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x  
import {orchestrator} from '@feasibleone/blong';
 
/**
 * The `text` namespace.
 *
 * `orchestrator.dispatch` turns a `text.<object>.<predicate>` call into a lookup
 * in the handler group beside this file, and `namespace` is the id the port is
 * registered under — the same port a running gateway would route to, and the one
 * the CLI resolves a method against. That is the whole reason a command can
 * dispatch without an HTTP server: the handler table is already in the process.
 */
/**
 * The generic loosens the activation config: the `cli` block adds a `logLevel`
 * the `default` block does not carry, so without it the per-intent blocks would
 * have to be structurally identical.
 */
export default orchestrator<Record<string, unknown>>(() => ({
    extends: 'orchestrator.dispatch',
    activation: {
        default: {
            namespace: 'text',
            imports: [/\.text$/],
            logLevel: 'info',
        },
        /**
         * The one line a command-driven realm still declares for itself.
         *
         * The framework's `cli` intent quietens its *own* components and the
         * generated-directory announcements, but a component's log level is part
         * of its activation and the framework does not know component names, so
         * it cannot default this. Without it the dispatch events
         * (`adapter.start`, `adapter.ready`, `adapter.stop`) are written straight
         * to fd 1 and land in the middle of the command's result.
         */
        cli: {logLevel: 'warn'},
    },
}));