Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
API Reference

Queries


The @blocklet/server-js library provides a comprehensive set of query methods to fetch data from your Blocklet Server. These methods allow you to retrieve information about blocklets, users, server status, routing configurations, and more. All query methods are asynchronous and return a Promise that resolves with the requested data.

For methods that modify data, see the Mutations section. For a detailed breakdown of all data structures, refer to the Types reference.

Basic Usage#

To make a query, first instantiate the BlockletServerClient. Then, you can call any of the available query methods. Here is a basic example of fetching the server's information:

import BlockletServerClient from '@blocklet/server-js';

const client = new BlockletServerClient();

async function fetchServerInfo() {
try {
const { info } = await client.getNodeInfo();
console.log(`Server Name: ${info.name}`);
console.log(`Version: ${info.version}`);
} catch (error) {
console.error('Failed to fetch server info:', error);
}
}

fetchServerInfo();

Query Categories#

Queries are grouped by their functionality. Select a category below to see detailed references, including parameters, return types, and usage examples for each method.

Complete Query List#

Below is a complete list of all available query methods for quick reference.

Method

Description

getBlocklet

Fetches detailed information about a specific Blocklet.

getBlockletMetaFromUrl

Retrieves Blocklet metadata from a given URL.

getBlockletDiff

Compares local Blocklet files with a remote version.

getBlocklets

Retrieves a list of all installed Blocklets on the server.

getBlockletRuntimeHistory

Fetches historical runtime data (CPU/memory) for a Blocklet.

getBlockletsFromBackup

Lists available Blocklets from a backup source.

getDynamicComponents

Retrieves information about dynamic components.

getNodeInfo

Fetches the current state and configuration of the Blocklet Server itself.

resetNodeStatus

Resets the server's status flags.

getNodeEnv

Gets detailed environment information for the server.

checkNodeVersion

Checks for available updates to the Blocklet Server software.

getDelegationState

Retrieves the current delegation state.

getNodeRuntimeHistory

Fetches historical runtime data for the entire server.

getBlockletMeta

Retrieves metadata for a Blocklet from a specified store.

getNotifications

Fetches a list of notifications for a user or team.

makeAllNotificationsAsRead

Marks all notifications as read for a receiver.

getNotificationSendLog

Retrieves logs of sent notifications.

getReceivers

Gets a list of notification receivers.

getNotificationComponents

Gets components that can send notifications.

resendNotification

Resends a specific notification.

getRoutingSites

Retrieves all configured routing sites.

getRoutingSnapshots

Gets a list of saved routing configuration snapshots.

getSnapshotSites

Retrieves the sites from a specific routing snapshot.

getRoutingProviders

Lists available routing providers (e.g., Nginx).

isDidDomain

Checks if a given domain is a DID-based domain.

getCertificates

Fetches all installed SSL/TLS certificates.

checkDomains

Checks the DNS configuration for a list of domains.

findCertificateByDomain

Finds a specific certificate by its associated domain.

getAccessKeys

Retrieves a list of access keys.

getAccessKey

Fetches details for a single access key.

getWebHooks

Retrieves configured webhooks.

getWebhookSenders

Gets a list of available webhook sender types.

sendTestMessage

Sends a test message to a webhook for verification.

getSession

Retrieves details about the current user session.

getRoles

Retrieves a list of all user roles defined within a specific team or application context.

getRole

Fetches details for a single role.

getPermissions

Retrieves all available permissions.

getInvitations

Gets a list of pending user invitations.

getUsers

Fetches a paginated list of users associated with a specific team or application.

getUser

Fetches details for a single user by DID.

getUserSessions

Retrieves a list of active sessions for a user.

getUserSessionsCount

Counts the number of active sessions for a user.

getUsersCount

Gets the total number of users for a team.

getUsersCountPerRole

Gets user counts grouped by role.

getOwner

Retrieves the owner of the server or a specific application.

getPermissionsByRole

Lists all permissions granted to a specific role.

getPassportIssuances

Retrieves passport issuance configurations.

logoutUser

Logs out a specific user session.

destroySelf

Allows a user to delete their own account.

getUserFollowers

Retrieves a list of users that follow a specified user.

getUserFollowing

Retrieves a list of users that a specified user is following.

getUserFollowStats

Gets follower and following counts for users.

checkFollowing

Checks if a user is following one or more other users.

followUser

Follows a user.

unfollowUser

Unfollows a user.

getTags

Retrieves a list of tags used for organizing users or content.

getAuditLogs

Fetches audit logs for tracking system activities.

getLauncherSession

Retrieves session information from the Blocklet launcher.

getBlockletBackups

Lists all backups for a specific Blocklet.

getBlockletBackupSummary

Provides a summary of backup activity.

getBlockletSpaceGateways

Fetches configured space gateway information for a Blocklet.

getTrafficInsights

Retrieves traffic and analytics data.

getProjects

Lists all publishing projects.

getProject

Fetches details for a single publishing project.

getReleases

Lists all releases for a project.

getRelease

Fetches details for a single release.

getSelectedResources

Retrieves resources selected for a specific release.

getBlockletSecurityRule

Fetches a single security rule for a Blocklet.

getBlockletSecurityRules

Lists all security rules for a Blocklet.

getBlockletResponseHeaderPolicy

Retrieves a response header policy.

getBlockletResponseHeaderPolicies

Lists all response header policies.

getBlockletAccessPolicy

Fetches a single access policy.

getBlockletAccessPolicies

Lists all access policies.

getWebhookEndpoints

Retrieves registered webhook endpoints.

getWebhookEndpoint

Fetches a single webhook endpoint.

getWebhookAttempts

Gets the delivery attempt history for a webhook.

getPassportRoleCounts

Counts passports grouped by role.

getPassportsByRole

Retrieves passports for a specific role.

getPassportLogs

Fetches logs related to passport activity.

getRelatedPassports

Finds passports related to a given passport.

getBlockletBaseInfo

Gets basic information for a Blocklet.

getDomainDNS

Performs a DNS lookup for a domain.

getOAuthClients

Retrieves configured OAuth clients.

createOAuthClient

Creates a new OAuth client.

updateOAuthClient

Updates an existing OAuth client.

deleteOAuthClient

Deletes an OAuth client.

Now that you have an overview of how to fetch data, you can dive into the specific query categories for detailed examples or proceed to the Mutations section to learn how to create, update, and delete data on the server.