All files index.ts

100% Statements 16/16
100% Branches 5/5
100% Functions 1/1
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x 1x       1x 1x     1x 5x 2x 2x 2x 2x 2x 1x 1x 2x 4x 4x  
export { createDetector } from '@agentix-e/anomaly-detector-core'
export { TimesfmNodeAdapter } from './adapter.js'
export type { TimesfmConfig } from './adapter.js'
export type * from '@agentix-e/anomaly-detector-core'
 
import { createDetector } from '@agentix-e/anomaly-detector-core'
import { TimesfmNodeAdapter } from './adapter.js'
import type { IAnomalyDetector, DetectorConfig } from '@agentix-e/anomaly-detector-core'
 
export function createNodeDetector(config?: DetectorConfig): IAnomalyDetector {
  if (config?.forecaster?.type === 'timesfm') {
    try {
      const adapter = new TimesfmNodeAdapter(config?.forecaster?.timesfm);
      (config as Record<string, unknown>)._customForecaster = adapter
      return createDetector(config)
    } catch {
      console.warn('TimesFM requested but not installed. Falling back to anofox-forecast.')
    }
  }
  return createDetector(config)
}