Architecture

IIFE Build and Registration

  • Built as an IIFE bundle via Vite (see vite.config.lib.ts).

    • Library entry: src/index.ts

    • Format: iife

    • Output file: dist/index.iife.js

    • React is externalized and exposed via globals (React, ReactDOM).

  • During initialization, src/index.ts registers the widget definition with the global Octopus host:

    • It uses makeWidgetDef to create the widget descriptor, then calls O.registerWidget(...).

    • A small IIFE polls globalThis.Octopus to register as soon as the frontend host is available.

This packaging allows octopus-frontend to load the widget bundle directly and auto-register at runtime.

Runtime Data Flow

The widget code typically uses the Octopus Widget SDK and Apollo GraphQL hooks. Generated widgets may include support for:

  • Polling queries at the configured dashboard refresh rate

  • Live streams via GraphQL subscriptions

  • Mutations (optional)

See src/SkaOctopusCoverageWidget.tsx and src/graphql/ops.ts for the actual operations included when scaffolding.