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 | 4x 4x 4x 93x 93x 93x 93x 93x 3x 3x 3x | import type {ResolveType} from '@jsonjoy.com/json-type';
import {BlockIdRef} from '../schema';
import type {RouteDeps, Router, RouterBase} from '../../types';
export const view =
({t, services}: RouteDeps) =>
<R extends RouterBase>(r: Router<R>) => {
const Request = t.Object(
t.Key('id', BlockIdRef).options({
title: 'Block ID',
description: 'The ID of the block to retrieve.',
}),
);
const Response = t.Object(t.Key('view', t.any));
const Func = t.Function(Request, Response).options({
title: 'Read View',
intro: 'Retrieves the latest view of a block.',
description: 'This method retrieves the latest materialized view of a block by ID.',
});
return r.add('block.view', Func, async ({id}) => {
const view = await services.blocks.view(id);
const response: ResolveType<typeof Response> = {
view,
};
return response;
});
};
|