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

    Interface Datasource

    Operations for working with contacts.

    interface Datasource {
        getByIds: (
            ids: [string, ...string[]],
        ) => AsyncGenerator<Contact.v1.Contact, null>;
        getByType: (type: string) => AsyncGenerator<Contact.v1.Contact, null>;
        getByUuid: (uuid: string) => Promise<Nullable<Contact.v1.Contact>>;
        getByUuidWithLineage: (
            uuid: string,
        ) => Promise<Nullable<ContactWithLineage>>;
        getPageByIds: (
            ids: [string, ...string[]],
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ) => Promise<Page<Contact.v1.Contact>>;
        getPageByType: (
            type: string,
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ) => Promise<Page<Contact.v1.Contact>>;
        getSummaries: (ids: string[]) => AsyncGenerator<ContactSummary, null>;
        getSummariesPage: (
            ids: string[],
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ) => Promise<Page<ContactSummary>>;
        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

    getByIds: (
        ids: [string, ...string[]],
    ) => AsyncGenerator<Contact.v1.Contact, null>

    Returns a generator for fetching all contacts with the given ids.

    Type Declaration

      • (ids: [string, ...string[]]): AsyncGenerator<Contact.v1.Contact, null>
      • Parameters

        • ids: [string, ...string[]]

          the ids of the contacts to return

        Returns AsyncGenerator<Contact.v1.Contact, null>

        a generator for fetching all contacts with the given ids

    InvalidArgumentError if no ids are provided

    getByType: (type: string) => AsyncGenerator<Contact.v1.Contact, null>

    Returns a generator for fetching all contacts of the given type.

    Type Declaration

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

        • type: string

          the type of contacts to return

        Returns AsyncGenerator<Contact.v1.Contact, null>

        a generator for fetching all contacts of the given type

    InvalidArgumentError if no type is provided or if the type is invalid for a contact

    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

    getPageByIds: (
        ids: [string, ...string[]],
        cursor?: Nullable<string>,
        limit?: number | `${number}`,
    ) => Promise<Page<Contact.v1.Contact>>

    Returns a page of contacts for the given ids.

    Type Declaration

      • (
            ids: [string, ...string[]],
            cursor?: Nullable<string>,
            limit?: number | `${number}`,
        ): Promise<Page<Contact.v1.Contact>>
      • Parameters

        • ids: [string, ...string[]]

          the ids of the contacts to return

        • 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 contacts to return. Default is 100.

        Returns Promise<Page<Contact.v1.Contact>>

        a page of contacts for the provided ids

    InvalidArgumentError if no ids are provided

    InvalidArgumentError if the provided limit is <= 0

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

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

    Returns a page of contacts for the given type.

    Type Declaration

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

        • type: string

          the type of contacts to return

        • 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 contacts to return. Default is 100.

        Returns Promise<Page<Contact.v1.Contact>>

        a page of contacts for the provided type

    InvalidArgumentError if no type is provided 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

    getSummaries: (ids: string[]) => AsyncGenerator<ContactSummary, null>

    Returns a generator for fetching summary records for the given contact identifiers.

    Type Declaration

      • (ids: string[]): AsyncGenerator<ContactSummary, null>
      • Parameters

        • ids: string[]

          the identifiers of the contacts to summarise

        Returns AsyncGenerator<ContactSummary, null>

        a generator for fetching all the matching contact summaries. Identifiers that do not identify an existing contact are silently omitted from the result.

    InvalidArgumentError if ids is not an array of non-empty strings

    getSummariesPage: (
        ids: string[],
        cursor?: Nullable<string>,
        limit?: number | `${number}`,
    ) => Promise<Page<ContactSummary>>

    Returns a paged array of summary records for the given contact identifiers.

    Type Declaration

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

        • ids: string[]

          the identifiers of the contacts to summarise

        • 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 summaries to return. Default is 100.

        Returns Promise<Page<ContactSummary>>

        a page of contact summaries. Identifiers that do not identify an existing contact are silently omitted from the result.

    InvalidArgumentError if ids is not an array of non-empty strings

    InvalidArgumentError if the provided limit value is <=0

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

    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