npm.io
0.6.0 • Published 1 week ago

@radiantailabs/hubble-extension-sdk

Licence
Apache-2.0
Version
0.6.0
Deps
0
Size
28 kB
Vulns
0
Weekly
0

Hubble dashboard extension SDK

Framework-neutral TypeScript contracts for creating Hubble dashboard extensions.

import {
  defineExtension,
  projectNavigationItem,
} from "@radiantailabs/hubble-extension-sdk";

export default defineExtension({
  id: "example-extension",
  routes: [
    {
      id: "analytics",
      path: "/analytics",
      mount: ({ target }) => {
        target.textContent = "Analytics";
        return () => target.replaceChildren();
      },
    },
  ],
  slots: [
    projectNavigationItem({
      id: "analytics-navigation",
      route: "analytics",
      label: "Analytics",
      icon: "presentationchart",
    }),
  ],
});

The host owns routing, navigation layout, and contribution cleanup. Extensions mount into host-provided elements and use DashboardHost for authenticated requests and navigation. host.http.baseUrl is the absolute, deployment-aware application URL, and host.http.fetch is a standard fetch-compatible transport with Hubble's session and login handling. Generated API clients can use both values directly.

Tests can import createTestDashboardHost from @radiantailabs/hubble-extension-sdk/testing to override the host services exercised by the contribution.

Development

bun install
bun run check
bun run test
bun run build

See the package changelog for notable changes.