Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

646 B
Raw Blame
import type { CC1ConfigValidationRejectedPayload } from '@inkeep/open-knowledge-core/schemas/cc1';

type Listener = (event: CC1ConfigValidationRejectedPayload) => void;

const listeners = new Set<Listener>();

export function emitConfigValidationRejected(event: CC1ConfigValidationRejectedPayload): void {
  for (const listener of listeners) {
    try {
      listener(event);
    } catch (e) {
      console.warn('[config-validation-events] listener threw:', e);
    }
  }
}

export function subscribeToConfigValidationRejected(listener: Listener): () => void {
  listeners.add(listener);
  return () => {
    listeners.delete(listener);
  };
}