Documentation
    Preparing search index...

    Interface SourceOperationsInterface

    Source-document operations used by the API.

    interface SourceOperationsInterface {
        compiledRule(name: string): CompiledRule | undefined;
        process(
            ref: string,
            rule: string,
            options?: IndexOptions,
        ): Promise<
            {
                chunks?: number;
                error?: {
                    code: | "type_collision"
                    | "interpolation_error"
                    | "extraction_error"
                    | "embedding_error"
                    | "upsert_error"
                    | "match_failed"
                    | "rule_missing"
                    | "no_content"
                    | "source_unavailable"
                    | "unsupported_content_type"
                    | "invalid_reference"
                    | "unknown_source"
                    | "invalid_id"
                    | "queue_stopped";
                    details?: unknown;
                    message: string;
                };
                matched_rules?: string[];
                source: string;
                status: "indexed"
                | "unchanged"
                | "deleted"
                | "failed";
            },
        >;
        render(ref: string, rule: string): Promise<SourceRenderOutcome>;
        storedRule(ref: string): Promise<string | null>;
        updateMetadata(
            ref: string,
            metadata: Record<string, unknown>,
        ): Promise<Record<string, unknown> | null>;
        validate(
            ref: string,
            rule: string,
        ):
            | {
                code: | "rule_missing"
                | "invalid_reference"
                | "unknown_source"
                | "invalid_id"
                | "queue_stopped";
                message: string;
            }
            | undefined;
    }
    Index
    • Process a reference with its designated rule (see processSourceDocument); force re-embeds unchanged content.

      Parameters

      Returns Promise<
          {
              chunks?: number;
              error?: {
                  code: | "type_collision"
                  | "interpolation_error"
                  | "extraction_error"
                  | "embedding_error"
                  | "upsert_error"
                  | "match_failed"
                  | "rule_missing"
                  | "no_content"
                  | "source_unavailable"
                  | "unsupported_content_type"
                  | "invalid_reference"
                  | "unknown_source"
                  | "invalid_id"
                  | "queue_stopped";
                  details?: unknown;
                  message: string;
              };
              matched_rules?: string[];
              source: string;
              status: "indexed"
              | "unchanged"
              | "deleted"
              | "failed";
          },
      >

    • Synchronously validate a notification; undefined when acceptable.

      Parameters

      • ref: string
      • rule: string

      Returns
          | {
              code: | "rule_missing"
              | "invalid_reference"
              | "unknown_source"
              | "invalid_id"
              | "queue_stopped";
              message: string;
          }
          | undefined

      • {
            code:
                | "rule_missing"
                | "invalid_reference"
                | "unknown_source"
                | "invalid_id"
                | "queue_stopped";
            message: string;
        }
        • code:
              | "rule_missing"
              | "invalid_reference"
              | "unknown_source"
              | "invalid_id"
              | "queue_stopped"

          Rejection code.

        • message: string

          Human-readable error message.

      • undefined