@jsonjoy.com/reactive-rpc
Version:
Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.
22 lines • 786 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.get = void 0;
const schema_1 = require("../schema");
const get = ({ t, services }) => (r) => {
const Request = t.Object(t.prop('id', schema_1.BlockIdRef).options({
title: 'Block ID',
description: 'The ID of the block to retrieve.',
}));
const Response = t.Object(t.prop('block', schema_1.BlockRef));
const Func = t.Function(Request, Response).options({
title: 'Read Block',
intro: 'Retrieves a block by ID.',
});
return r.prop('block.get', Func, async ({ id }) => {
const { block } = await services.blocks.get(id);
const response = { block };
return response;
});
};
exports.get = get;
//# sourceMappingURL=get.js.map
;