@jsonjoy.com/reactive-rpc
Version:
Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.
26 lines • 990 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.del = void 0;
const del = ({ t, services }) => (r) => {
const Request = t.Object(t.prop('id', t.Ref('BlockId')).options({
title: 'Block ID',
description: 'The ID of the block to delete.',
}));
const Response = t.Object(t.prop('success', t.bool).options({
title: 'Success',
description: 'Indicates whether the block was deleted successfully. Returns `false` if the block does not exist.',
}));
const Func = t.Function(Request, Response).options({
title: 'Delete Block',
intro: 'Deletes a block by ID.',
description: 'Deletes a block by ID. It will not rise an error if the block does not exist.',
});
return r.prop('block.del', Func, async ({ id }) => {
const success = await services.blocks.remove(id);
return {
success,
};
});
};
exports.del = del;
//# sourceMappingURL=del.js.map
;