Plugin SDK

plugin sdk

Resources

Read plugin data with runtime-managed refresh.

Define a resource with defineResource({ id, input?, query, refresh? }), then register it with registry.resource(resource). query(input, context) receives validated input and the plugin context. The default refresh policy is manual; use poll("5s") for data that should refresh while watched.

import { defineResource, poll } from "@northgraindata/dsui-plugin-sdk";

const clock = defineResource({
  id: "clock",
  query: () => ({ timestamp: new Date().toISOString() }),
  refresh: poll("5s"),
});

Read declared resources through the page render function’s resource reader. Keep reads in resources, mutations in actions, and scheduled work that must run without an open page in jobs.

The Health plugin shows host-backed service resources.