/** * OpenMDM Database Schema Definition * * This schema defines the structure for MDM data storage. * Database adapters implement this schema for their specific ORM/database. * * Tables: * - mdm_devices: Enrolled devices and their state * - mdm_policies: Device policies and configurations * - mdm_applications: Registered applications for deployment * - mdm_commands: Command queue for device operations * - mdm_events: Event log for device activities * - mdm_groups: Device grouping for bulk operations * - mdm_device_groups: Many-to-many device-group relationships * - mdm_push_tokens: FCM/MQTT push notification tokens * - mdm_app_deployments: App-to-policy/group deployment mappings * - mdm_app_versions: App version history for rollback support * - mdm_rollbacks: Rollback operation history and status * - mdm_webhook_endpoints: Outbound webhook configuration * - mdm_webhook_deliveries: Webhook delivery history * - mdm_tenants: Multi-tenant organization isolation * - mdm_roles: RBAC role definitions * - mdm_users: User accounts for authorization * - mdm_user_roles: User-role mapping * - mdm_audit_logs: Compliance and audit trail * - mdm_scheduled_tasks: Scheduled task definitions * - mdm_task_executions: Task execution history * - mdm_message_queue: Persistent push message queue * - mdm_plugin_storage: Plugin state persistence */ type ColumnType = 'string' | 'text' | 'integer' | 'bigint' | 'boolean' | 'datetime' | 'json' | 'enum'; interface ColumnDefinition { type: ColumnType; nullable?: boolean; primaryKey?: boolean; unique?: boolean; default?: unknown; enumValues?: string[]; references?: { table: string; column: string; onDelete?: 'cascade' | 'set null' | 'restrict'; }; } interface IndexDefinition { columns: string[]; unique?: boolean; name?: string; } interface TableDefinition { columns: Record; indexes?: IndexDefinition[]; } interface SchemaDefinition { tables: Record; } declare const mdmSchema: SchemaDefinition; /** * Get all table names from the schema */ declare function getTableNames(): string[]; /** * Get column names for a table */ declare function getColumnNames(tableName: string): string[]; /** * Get the primary key column for a table */ declare function getPrimaryKey(tableName: string): string | null; /** * Convert snake_case column name to camelCase */ declare function snakeToCamel(str: string): string; /** * Convert camelCase to snake_case */ declare function camelToSnake(str: string): string; /** * Transform object keys from snake_case to camelCase */ declare function transformToCamelCase>(obj: T): Record; /** * Transform object keys from camelCase to snake_case */ declare function transformToSnakeCase>(obj: T): Record; export { type ColumnDefinition, type ColumnType, type IndexDefinition, type SchemaDefinition, type TableDefinition, camelToSnake, getColumnNames, getPrimaryKey, getTableNames, mdmSchema, snakeToCamel, transformToCamelCase, transformToSnakeCase };