@medic/cht-datasource
    Preparing search index...

    Interface Datasource

    Operations for working with contacts.

    interface Datasource {
        getByUuid: (uuid: string) => Promise<Nullable<Contact.v1.Contact>>;
        getByUuidWithLineage: (
            uuid: string,
        ) => Promise<Nullable<ContactWithLineage>>;
        getUuidsByFreetext: (freetext: string) => AsyncGenerator<string, null>;
        getUuidsByType: (type: string) => AsyncGenerator<string, null>;
        getUuidsByTypeFreetext: (
            freetext: string,
            type: string,
        ) => AsyncGenerator<string, null>;
        getUuidsPageByFreetext: (
            freetext: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ) => Promise<Page<string>>;
        getUuidsPageByType: (
            type: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ) => Promise<Page<string>>;
        getUuidsPageByTypeFreetext: (
            freetext: string,
            type: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ) => Promise<Page<string>>;
    }
    Index

    Properties

    getByUuid: (uuid: string) => Promise<Nullable<Contact.v1.Contact>>

    Returns a contact by their UUID.

    Type Declaration

    InvalidArgumentError if no UUID is provided

    getByUuidWithLineage: (uuid: string) => Promise<Nullable<ContactWithLineage>>

    Returns a contact by their UUID along with the contact's parent lineage.

    Type Declaration

    InvalidArgumentError if no UUID is provided

    getUuidsByFreetext: (freetext: string) => AsyncGenerator<string, null>

    Returns a generator for fetching all the contact identifiers for given freetext.

    Type Declaration

      • (freetext: string): AsyncGenerator<string, null>
      • Parameters

        • freetext: string

          the search keyword(s)

        Returns AsyncGenerator<string, null>

        a generator for fetching all the contact identifiers matching the given freetext.

    InvalidArgumentError if freetextis not provided

    InvalidArgumentError if the freetext is empty or invalid

    getUuidsByType: (type: string) => AsyncGenerator<string, null>

    Returns a generator for fetching all the contact identifiers for given type.

    Type Declaration

      • (type: string): AsyncGenerator<string, null>
      • Parameters

        • type: string

          the type of contact identifiers to return

        Returns AsyncGenerator<string, null>

        a generator for fetching all the contact identifiers matching the given type.

    InvalidArgumentError if type is not provided

    InvalidArgumentError if the type is invalid for a contact

    getUuidsByTypeFreetext: (
        freetext: string,
        type: string,
    ) => AsyncGenerator<string, null>

    Returns a generator for fetching all the contact identifiers for given freetext and type.

    Type Declaration

      • (freetext: string, type: string): AsyncGenerator<string, null>
      • Parameters

        • freetext: string

          the search keyword(s)

        • type: string

          the type of contact identifiers to return

        Returns AsyncGenerator<string, null>

        a generator for fetching all the contact identifiers matching the given freetext and type.

    InvalidArgumentError if either freetext or type is not provided

    InvalidArgumentError if the freetext is empty or if the type is invalid for a contact

    getUuidsPageByFreetext: (
        freetext: string,
        cursor?: Nullable<string>,
        limit?: number | `${number}`,
    ) => Promise<Page<string>>

    Returns an array of contact identifiers for the provided page specifications and freetext.

    Type Declaration

      • (
            freetext: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ): Promise<Page<string>>
      • Parameters

        • freetext: string

          the search keyword(s)

        • Optionalcursor: Nullable<string>

          the token identifying which page to retrieve. A null value indicates the first page should be returned. Subsequent pages can be retrieved by providing the cursor returned with the previous page.

        • Optionallimit: number | `${number}`

          the maximum number of identifiers to return. Default is 10000.

        Returns Promise<Page<string>>

        a page of contact identifiers for the provided specifications

    InvalidArgumentError if freetext is not provided

    InvalidArgumentError if the freetext is less than 3 characters long or if it contains white-space

    InvalidArgumentError if the provided limit is <= 0

    InvalidArgumentError if the provided cursor is not a valid page token or null

    getUuidsPageByType: (
        type: string,
        cursor?: Nullable<string>,
        limit?: number | `${number}`,
    ) => Promise<Page<string>>

    Returns an array of contact identifiers for the provided page specifications and type.

    Type Declaration

      • (
            type: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ): Promise<Page<string>>
      • Parameters

        • type: string

          the type of contact to search for

        • Optionalcursor: Nullable<string>

          the token identifying which page to retrieve. A null value indicates the first page should be returned. Subsequent pages can be retrieved by providing the cursor returned with the previous page.

        • Optionallimit: number | `${number}`

          the maximum number of identifiers to return. Default is 10000.

        Returns Promise<Page<string>>

        a page of contact identifiers for the provided specifications

    InvalidArgumentError if type is not provided

    InvalidArgumentError if the type is invalid for a contact

    InvalidArgumentError if the provided limit is <= 0

    InvalidArgumentError if the provided cursor is not a valid page token or null

    getUuidsPageByTypeFreetext: (
        freetext: string,
        type: string,
        cursor?: Nullable<string>,
        limit?: number | `${number}`,
    ) => Promise<Page<string>>

    Returns an array of contact identifiers for the provided page specifications, freetext and type.

    Type Declaration

      • (
            freetext: string,
            type: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ): Promise<Page<string>>
      • Parameters

        • freetext: string

          the search keyword(s)

        • type: string

          the type of contact to search for

        • Optionalcursor: Nullable<string>

          the token identifying which page to retrieve. A null value indicates the first page should be returned. Subsequent pages can be retrieved by providing the cursor returned with the previous page.

        • Optionallimit: number | `${number}`

          the maximum number of identifiers to return. Default is 10000.

        Returns Promise<Page<string>>

        a page of contact identifiers for the provided specifications

    InvalidArgumentError if either freetext or type is not provided

    InvalidArgumentError if the freetext is empty or if the type is invalid for a contact

    InvalidArgumentError if the provided limit is <= 0

    InvalidArgumentError if the provided cursor is not a valid page token or null