@aisahub/vibe-analytics
v0.1.0
Published
TypeScript client library for Vibe Analytics BI Bot API - Natural language to chart generation
Readme
@aisahub/vibe-analytics
TypeScript client library for Vibe Analytics BI Bot API - Natural language to chart generation.
Installation
npm install @aisahub/vibe-analyticsPeer Dependencies
Install the adapters you need:
# For Sequelize support
npm install sequelize
# For Prisma support
npm install @prisma/client
# For TypeORM support
npm install typeorm
# For Firebase streaming (optional)
npm install firebase-adminQuick Start
import {
ChartManager,
SequelizeAdapter,
SequelizeSchemaProvider,
FirebaseStreamingProvider
} from '@aisahub/vibe-analytics';
// Initialize adapters
const storage = new SequelizeAdapter(models.ChartRequest, sequelize);
const schemaProvider = new SequelizeSchemaProvider(db);
// Optional: Firebase for real-time updates
const streaming = new FirebaseStreamingProvider({
credentials: {
projectId: process.env.FIREBASE_CHARTS_PROJECT_ID!,
privateKey: Buffer.from(process.env.FIREBASE_CHARTS_PRIVATE_KEY_BASE64!, 'base64').toString('utf8'),
privateKeyId: process.env.FIREBASE_CHARTS_PRIVATE_KEY_ID!,
clientEmail: process.env.FIREBASE_CHARTS_CLIENT_EMAIL!,
clientId: process.env.FIREBASE_CHARTS_CLIENT_ID!,
clientX509CertUrl: process.env.FIREBASE_CHARTS_CLIENT_X509_CERT_URL!,
},
databaseURL: process.env.FIREBASE_CHARTS_URL!,
});
// Create the chart manager
const chartManager = new ChartManager({
apiUrl: process.env.BI_BOT_API_URL!,
apiKey: process.env.BI_BOT_SECRET_KEY!,
storage,
schemaProvider,
streaming, // optional
});
// Create a chart from natural language
const chart = await chartManager.createChart('Show sales by region');
// Get all charts
const charts = await chartManager.getAllCharts();
// Refresh all charts with fresh data
const result = await chartManager.refreshAllCharts();
console.log(`Refreshed ${result.successfulCharts}/${result.totalCharts} charts`);
// Refresh a single chart
const updatedChart = await chartManager.refreshChart(chartId);
// Delete a chart
await chartManager.deleteChart(chartId);Features
- ✅ TypeScript Support: Full type definitions for autocomplete and type safety
- ✅ Multiple ORMs: Built-in support for Sequelize, Prisma, and TypeORM
- ✅ Real-time Updates: Optional Firebase streaming for chart refresh progress
- ✅ Retry Logic: Exponential backoff with jitter for resilient API calls
- ✅ Concurrency Control: Batch processing with configurable concurrency
- ✅ Framework Agnostic: Works with Express, Fastify, or standalone
- ✅ Extensible: Easy to create custom storage and schema adapters
Documentation
Project Status
🎉 Beta Ready - v0.1.0 (75% Complete)
This library is ready for beta testing! The following components are complete:
- [x] Project structure and configuration
- [x] TypeScript type definitions
- [x] Error classes
- [x] Core utilities (retry, concurrency, validators)
- [x] BiBotClient (API client)
- [x] Storage adapters (Sequelize, Prisma, TypeORM, InMemory)
- [x] Schema providers (Sequelize, Prisma, TypeORM, Manual)
- [x] Streaming providers (Firebase, NoOp)
- [x] ChartProcessor (chart refresh orchestration)
- [x] ChartManager (high-level API)
- [x] Examples (Express + Sequelize, Custom Storage, Standalone)
- [x] Documentation (API, Migration Guide, Adapter Guide)
- [ ] Tests (in progress)
- [ ] Publishing (pending)
Ready to use! Check out the examples to get started.
Development
# Install dependencies
npm install
# Build the library
npm run build
# Run tests
npm test
# Run tests with coverage
npm test:coverage
# Lint code
npm run lint
# Build and watch for changes
npm run build:watchLicense
MIT
Support
For issues and questions, please open an issue on GitHub.
