1.0.3 โข Published 4 months ago
@mindmakr/gs-websdk v1.0.3
Guru SaaS Web SDK
A comprehensive TypeScript SDK for the Guru SaaS platform, providing seamless integration with authentication, schema management, AI services, and notifications.
โจ Features
- ๐ Complete Authentication - User management, RBAC, permissions
- ๐ Dynamic Schemas - Create and manage flexible data structures
- ๐ค AI-Powered - Schema generation and field enhancement
- ๐ง Notifications - Email templates and delivery tracking
- ๐ Type-Safe - Full TypeScript support with comprehensive types
- โก Production Ready - 100% test coverage with real backend validation
- ๐ ๏ธ Developer Friendly - Intuitive API with excellent documentation
๐ Quick Start
Installation
npm install @mindmakr/gs-websdk
Basic Usage
import { GuruSaaS } from '@mindmakr/gs-websdk';
// Production: Single base URL (with reverse proxy)
const client = new GuruSaaS({
baseUrl: 'https://your-api-domain.com',
debug: true
});
// OR Development: Individual service URLs
const devClient = new GuruSaaS({
authUrl: 'http://localhost:4000', // Auth Service
globalDataUrl: 'http://localhost:5010', // Global Data Service
aiServiceUrl: 'http://localhost:4001', // AI Service
notificationUrl: 'http://localhost:5020', // Notification Service
debug: true
});
// Login
const { user, tokens } = await client.login('user@example.com', 'password');
console.log(`Welcome ${user.name}!`);
// Use services
const users = await client.auth.getUsers({ page: 1, limit: 10 });
const templates = await client.schema.getSchemaTemplates({ is_active: true });
const healthStatus = await client.ai.getHealthStatus();
๐๏ธ Core Services
๐ Authentication Service
// User management
const users = await client.auth.getUsers();
const user = await client.auth.createUser({
email: 'new@example.com',
password: 'secure123',
name: 'New User'
});
// Role-based access control
const roles = await client.auth.getRoles();
await client.auth.addRoleToUser(user.id, roleId);
๐ Schema Service
// Create schema template
const template = await client.schema.createSchemaTemplate({
name: 'Customer Profile',
code: 'customer_profile',
schema_definition: {
type: 'object',
properties: {
firstName: { type: 'string', title: 'First Name' },
email: { type: 'string', format: 'email', title: 'Email' }
}
}
});
๐ค AI Service
// Get AI field suggestions
const suggestions = await client.ai.getFieldNameSuggestions({
context: 'customer management',
existing_fields: ['firstName', 'lastName']
});
๐ง Notification Service
// Send email
const result = await client.notification.sendEmail({
to: 'user@example.com',
subject: 'Welcome!',
html: '<h1>Welcome to our platform!</h1>'
});
๐ Documentation
For Frontend Developers
- Developer Guide - Complete development guide
- Examples - React, Vue.js, and vanilla JS examples
- API Reference - Complete API documentation
For DevOps Teams
- DevOps Guide - Build, test, and publish to npm
Reference Materials
- Documentation Structure - Guide to all documentation
- Schema Guide - Working with dynamic schemas
- Field Properties Guide - Field configuration
๐งช Testing
# Run all tests
npm test
# Run integration tests (requires backend services)
npm run test:integration
# Generate coverage report
npm run test:coverage
Test Results: โ 65/65 tests passing (100% success rate)
๐ฆ NPM Publishing & Usage
Installation
# Install from npm
npm install @mindmakr/gs-websdk
# Or with yarn
yarn add @mindmakr/gs-websdk
# Or with pnpm
pnpm add @mindmakr/gs-websdk
CDN Usage
<script src="https://unpkg.com/@mindmakr/gs-websdk@latest/dist/index.js"></script>
Publishing (DevOps)
For build and release instructions, see our DevOps Guide.
Quick Release:
# Patch release (1.0.0 -> 1.0.1)
npm run release:patch
# Minor release (1.0.0 -> 1.1.0)
npm run release:minor
# Major release (1.0.0 -> 2.0.0)
npm run release:major
๐ค Contributing
We welcome contributions! Please see our Developer Guide for details.
๐ License
MIT License - see LICENSE file for details.
๐ Support
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and community support
Ready to get started? Install the SDK and check out our Developer Guide! ๐