Documentation
    Preparing search index...

    Retrieves source documents by callback. Injected into later pipeline stages (resolver, notify queue, reindex) so tests can substitute it.

    interface SourceRetriever {
        resolve(
            reference: string,
        ): { id: string; name: string; ref: string; url: string };
        retrieve(
            reference: string,
        ): Promise<
            | { body: Record<string, unknown>; kind: "document" }
            | { kind: "gone" }
            | {
                code: "source_unavailable" | "unsupported_content_type";
                kind: "error";
                message: string;
            },
        >;
    }

    Implemented by

    Index
    • Validate a reference and build its URL without making a request.

      Parameters

      • reference: string

      Returns { id: string; name: string; ref: string; url: string }

      • id: string

        Opaque document id.

      • name: string

        Source name.

      • ref: string

        The full reference string.

      • url: string

        Callback URL built from sources.<name>.url.

    • Retrieve a document. Rejects with SourceReferenceError (and sends nothing) for an invalid reference; otherwise never rejects.

      Parameters

      • reference: string

      Returns Promise<
          | { body: Record<string, unknown>; kind: "document" }
          | { kind: "gone" }
          | {
              code: "source_unavailable" | "unsupported_content_type";
              kind: "error";
              message: string;
          },
      >