UNPKG

@mindmakr/gs-websdk

Version:

Web SDK for Guru SaaS System - Complete JavaScript/TypeScript SDK for building applications with dynamic schema management

420 lines (419 loc) 11.8 kB
/** * Guru SaaS Web SDK * * A comprehensive JavaScript/TypeScript SDK for building applications * with the Guru SaaS dynamic schema management system. * * @example * ```typescript * import { GuruSaaS } from '@mindmakr/gs-websdk'; * * const client = new GuruSaaS({ * baseUrl: 'https://api.yourdomain.com', * debug: true * }); * * // Authenticate * await client.auth.login('user@example.com', 'password'); * * // Create a schema template * const template = await client.schema.createSchemaTemplate({ * name: 'User Profile', * code: 'user_profile', * category: 'user_management', * schema_definition: { * type: 'object', * properties: { * name: { type: 'string', title: 'Full Name' }, * email: { type: 'string', format: 'email', title: 'Email' } * } * } * }); * * // Generate AI-powered schema * const aiSchema = await client.ai.generateSchema({ * businessDescription: 'Customer registration form for e-commerce', * formType: 'registration' * }); * ``` */ import { GuruSaaSClient } from './core/client'; import { AuthService } from './services/auth'; import { SchemaService } from './services/schema'; import { AIService } from './services/ai'; import { NotificationService } from './services/notification'; import { SDKConfig } from './types'; /** * Main SDK class that provides access to all Guru SaaS services */ export declare class GuruSaaS extends GuruSaaSClient { /** * Authentication and authorization service * Provides user management, roles, permissions, and tenant management */ readonly auth: AuthService; /** * Schema management service * Provides dynamic schema templates, instances, categories, and translations */ readonly schema: SchemaService; /** * AI enhancement service * Provides AI-powered schema generation and field enhancement */ readonly ai: AIService; /** * Notification service * Provides email and notification management */ readonly notification: NotificationService; constructor(config?: SDKConfig); /** * Get SDK version */ static getVersion(): string; /** * Create a new SDK instance with configuration */ static create(config?: SDKConfig): GuruSaaS; } export default GuruSaaS; export * from './types'; export { GuruSaaSClient } from './core/client'; export { AuthService } from './services/auth'; export { SchemaService, UsageStats, SchemaVersion, VirtualHierarchyNode } from './services/schema'; export { AIService, AIContextAnalysisResponse, AIContextAnalysisRequest, Conversation, ConversationMessage, ConversationResponse, AISchemaGenerationResponse, AISchemaGenerationRequest, AIFieldNameResponse, AIFieldNameRequest, AIFieldTypeResponse, AIFieldTypeRequest, AIValidationResponse, AIValidationRequest, AIValidationSuggestion, FunctionCall } from './services/ai'; export { NotificationService, EmailNotification } from './services/notification'; export { AnalyzeContextRequest, AnalyzeContextResponse, SuggestFieldNameRequest, SuggestFieldNameResponse, SuggestValidationRequest, SuggestValidationResponse, SuggestFieldTypeRequest, SuggestFieldTypeResponse, SuggestFieldsRequest, SuggestFieldsResponse, ExecuteFunctionRequest, ExecuteFunctionResponse } from './types'; export * from './utils/schema-helpers'; export * from './utils/form-helpers'; export { validateField, validateSchema, createValidationRules, formatValidationErrors, ValidationResult, ValidationError, ValidationWarning } from './utils/validation-helpers'; /** * Quick start example schemas and templates */ export declare const examples: { schemas: { userProfile: { type: string; title: string; properties: { firstName: { type: string; title: string; minLength: number; maxLength: number; }; lastName: { type: string; title: string; minLength: number; maxLength: number; }; email: { type: string; format: string; title: string; }; phone: { type: string; format: string; title: string; }; dateOfBirth: { type: string; format: string; title: string; }; avatar: { type: string; format: string; title: string; }; }; required: string[]; }; contactForm: { type: string; title: string; properties: { name: { type: string; title: string; minLength: number; maxLength: number; }; email: { type: string; format: string; title: string; }; subject: { type: string; title: string; enum: string[]; enumNames: string[]; }; message: { type: string; format: string; title: string; minLength: number; maxLength: number; }; priority: { type: string; title: string; enum: string[]; enumNames: string[]; default: string; }; }; required: string[]; }; productListing: { type: string; title: string; properties: { name: { type: string; title: string; minLength: number; maxLength: number; }; description: { type: string; format: string; title: string; }; price: { type: string; title: string; minimum: number; format: string; }; category: { type: string; title: string; enum: string[]; enumNames: string[]; }; images: { type: string; title: string; items: { type: string; format: string; }; minItems: number; maxItems: number; }; specifications: { type: string; title: string; properties: { weight: { type: string; title: string; minimum: number; }; dimensions: { type: string; title: string; pattern: string; }; color: { type: string; format: string; title: string; }; }; }; inStock: { type: string; title: string; default: boolean; }; stockQuantity: { type: string; title: string; minimum: number; }; }; required: string[]; }; }; templates: { userRegistration: { name: string; code: string; category: string; description: string; }; feedbackForm: { name: string; code: string; category: string; description: string; }; jobApplication: { name: string; code: string; category: string; description: string; }; }; }; /** * Common field types and their configurations */ export declare const fieldTypes: { text: { type: string; jsonType: string; category: string; }; textarea: { type: string; format: string; jsonType: string; category: string; }; email: { type: string; format: string; jsonType: string; category: string; }; phone: { type: string; format: string; jsonType: string; category: string; }; url: { type: string; format: string; jsonType: string; category: string; }; password: { type: string; format: string; jsonType: string; category: string; }; number: { type: string; jsonType: string; category: string; }; integer: { type: string; jsonType: string; category: string; }; boolean: { type: string; jsonType: string; category: string; }; date: { type: string; format: string; jsonType: string; category: string; }; datetime: { type: string; format: string; jsonType: string; category: string; }; time: { type: string; format: string; jsonType: string; category: string; }; select: { type: string; enum: never[]; jsonType: string; category: string; }; multiselect: { type: string; items: { type: string; enum: never[]; }; uniqueItems: boolean; jsonType: string; category: string; }; radio: { type: string; enum: never[]; 'ui:widget': string; jsonType: string; category: string; }; checkbox: { type: string; items: { type: string; enum: never[]; }; uniqueItems: boolean; 'ui:widget': string; jsonType: string; category: string; }; file: { type: string; format: string; 'ui:widget': string; jsonType: string; category: string; }; image: { type: string; format: string; 'ui:widget': string; jsonType: string; category: string; }; video: { type: string; format: string; 'ui:widget': string; jsonType: string; category: string; }; audio: { type: string; format: string; 'ui:widget': string; jsonType: string; category: string; }; color: { type: string; format: string; jsonType: string; category: string; }; richtext: { type: string; format: string; 'ui:widget': string; jsonType: string; category: string; }; reference: { type: string; format: string; jsonType: string; category: string; }; };