All files / core/blong-realm/adapter/semlog blongDigestGetRequestSend.ts

100% Statements 19/19
66.66% Branches 2/3
100% Functions 1/1
100% Lines 19/19

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 201x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 1x 1x 1x 1x 1x 1x  
import {handler} from '@feasibleone/blong';
 
/**
 * The request the port makes for `blong.digest.get`: the change stream since a point in
 * time.
 *
 * A parameter the caller left out is not sent at all, so the service answers from the
 * point it keeps rather than from one spelled `since=undefined`. See
 * `blongFlowFindRequestSend.ts` for why this is a conversion and not a handler.
 */
export default handler(
    () =>
        function blongDigestGetRequestSend(params: {since?: string; limit?: number}) {
            const search = new URLSearchParams();
            if (params.since) search.set('since', params.since);
            if (params.limit !== undefined) search.set('limit', String(params.limit));
            return {method: 'GET', path: '/digest', query: search.toString(), responseType: 'json'};
        },
);