dt-common-device
Version:
A secure and robust device management library for IoT applications
44 lines (43 loc) • 1.49 kB
TypeScript
export declare class AuditService {
private readonly logger;
/**
* Execute a dynamic query on the audit events table
* @param query - SQL query string to execute on the events table
* @returns Query result as JSON
*
* @example
* // Query all events
* const result = await auditService.query("SELECT * FROM events LIMIT 10");
*
* @example
* // Query with JSON extraction
* const result = await auditService.query(
* "SELECT * FROM events WHERE JSONExtractString(properties, 'status', 'liveStatus') = 'ONLINE' LIMIT 10"
* );
*
* @example
* // Query by event type
* const result = await auditService.query("SELECT * FROM events WHERE event = 'device.status.online' LIMIT 10");
*/
query(query: string): Promise<any>;
}
/**
* Convenience function to query audit data
* @param query - SQL query string to execute on the events table
* @returns Query result as JSON
*
* @example
* // Query all events
* const result = await queryAudit("SELECT * FROM events LIMIT 10");
*
* @example
* // Query with JSON extraction
* const result = await queryAudit(
* "SELECT * FROM events WHERE JSONExtractString(properties, 'status', 'liveStatus') = 'ONLINE' LIMIT 10"
* );
*
* @example
* // Query by event type
* const result = await queryAudit("SELECT * FROM events WHERE event = 'device.status.online' LIMIT 10");
*/
export declare function queryAudit(query: string): Promise<any>;