The official core package for building Apache Superset extensions and integrations. This package provides essential building blocks including shared UI components, utility functions, APIs, and type definitions for both the host application and extensions.
npm install @apache-superset/core
The package is organized into logical namespaces, each providing specific functionality:
authentication
- User authentication and authorization APIscommands
- Command registration and execution systemcontributions
- UI contribution points and customization APIscore
- Fundamental types, utilities, and lifecycle managementenvironment
- Environment detection and configuration APIsextensions
- Extension management and metadata APIssqlLab
- SQL Lab integration and event handlingimport { core, commands, sqlLab, authentication, } from '@apache-superset/core'; export function activate(context: core.ExtensionContext) { // Register a command to save current query const commandDisposable = commands.registerCommand( 'my_extension.save_query', async () => { const currentTab = sqlLab.getCurrentTab(); if (currentTab?.editor.content) { const token = await authentication.getCSRFToken(); // Use token for secure API calls console.log('Saving query with CSRF token:', token); } }, ); // Listen for query execution events const eventDisposable = sqlLab.onDidQueryRun(editor => { console.log('Query executed:', editor.content.substring(0, 50) + '...'); }); // Register a simple view const viewDisposable = core.registerViewProvider( 'my_extension.panel', () => ( <div> <h3>My Extension</h3> <button onClick={() => commands.executeCommand('my_extension.save_query')}> Save Query </button> </div> ) ); // Cleanup registration context.subscriptions.push(commandDisposable, eventDisposable, viewDisposable); } export function deactivate() { // Cleanup handled automatically via disposables }
We welcome contributions! Please see the Contributing Guide for details.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Note: This package is currently in release candidate status. APIs may change before the 1.0.0 release. Please check the changelog for breaking changes between versions.