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.
Node & Blocklet Management
Mutations for managing the lifecycle (install, start, stop, delete), configuration, and settings of the node and individual blocklets.
User & Access Management
Methods for creating, updating, and deleting users, roles, permissions, and access keys. Also includes session and passport management.
Networking & Services
Operations for configuring routing rules, managing domain aliases, issuing and updating SSL certificates, and setting up webhooks.
Data & Operations
Mutations for performing operational tasks such as creating and restoring blocklet backups.
Publishing & Projects
Manage the entire publishing workflow, including creating projects, drafting releases, connecting to stores, and publishing blocklets.
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.