Mutations
Mutations are GraphQL operations used to create, update, or delete data on the Blocklet Server. The @blocklet/server-js library provides a set of convenient methods that wrap these mutations, making it easy to perform write operations from your application.
This section provides an overview of the available mutation categories. For detailed information on specific methods, including parameters and return types, please refer to the individual sub-sections. If you need to fetch data without modifying it, see the Queries section.
All mutation methods follow a similar pattern: they accept an object with an input property that corresponds to the required GraphQL input type.
Calling a Mutation
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
async function updateNodeName() {
try {
const { info } = await client.updateNodeInfo({
input: {
name: 'My Awesome Node',
description: 'This is my newly updated node.'
}
});
console.log('Node updated successfully:', info.name);
} catch (error) {
console.error('Failed to update node info:', error);
}
}
updateNodeName();Mutation Categories#
Mutations are grouped by functionality to help you find the methods you need more easily.
Next Steps#
After exploring the mutations, you might want to understand the data structures they return. Check out the Types section for a complete reference of all data models.