harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
36 lines (35 loc) • 1.23 kB
TypeScript
/**
* Component Status System
*
* A simple, clean API for tracking component health across Harper's distributed architecture.
*
* @example Basic usage:
* ```typescript
* import { statusForComponent, STATUS } from './components/status/index.ts';
*
* // Report component status
* statusForComponent('my-service').healthy('Service initialized');
* statusForComponent('database').error('Connection timeout', error);
* statusForComponent('cache').warning('High memory usage');
*
* // Get component status
* const status = statusForComponent('my-service').get();
* ```
*
* @example Lifecycle usage (for component loader):
* ```typescript
* import { lifecycle } from './components/status/index.ts';
*
* lifecycle.loading('my-component');
* // ... load component ...
* lifecycle.loaded('my-component', 'Successfully initialized');
* // or
* lifecycle.failed('my-component', error);
* ```
*/
export { statusForComponent, // Main API for reporting status
lifecycle, // Component loader lifecycle hooks
reset, // Reset all statuses (testing)
STATUS, } from './api.ts';
export type { ComponentStatusLevel, AggregatedComponentStatus, ComponentStatus } from './api.ts';
export * as internal from './internal.ts';