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

    Function getDatasource

    • Returns the source for CHT data.

      Parameters

      Returns {
          v1: {
              contact: {
                  getByUuid: (uuid: string) => Promise<Nullable<Contact.v1.Contact>>;
                  getByUuidWithLineage: (
                      uuid: string,
                  ) => Promise<Nullable<ContactWithLineage>>;
                  getUuidsByFreetext: (
                      freetext: string,
                  ) => AsyncGenerator<string, null, any>;
                  getUuidsByType: (type: string) => AsyncGenerator<string, null, any>;
                  getUuidsByTypeFreetext: (
                      freetext: string,
                      type: string,
                  ) => AsyncGenerator<string, null, any>;
                  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>>;
              };
              hasAnyPermission: (
                  permissionsGroupList: string[][],
                  userRoles: string[],
                  chtPermissionsSettings: object,
              ) => boolean;
              hasPermissions: (
                  permissions: string | string[],
                  userRoles: string[],
                  chtPermissionsSettings: object,
              ) => boolean;
              person: {
                  getByType: (
                      personType: string,
                  ) => AsyncGenerator<Person.v1.Person, null, any>;
                  getByUuid: (uuid: string) => Promise<Nullable<Person.v1.Person>>;
                  getByUuidWithLineage: (
                      uuid: string,
                  ) => Promise<Nullable<PersonWithLineage>>;
                  getPageByType: (
                      personType: string,
                      cursor?: Nullable<string>,
                      limit?: number | `${number}`,
                  ) => Promise<Page<Person.v1.Person>>;
              };
              place: {
                  getByType: (
                      placeType: string,
                  ) => AsyncGenerator<Place.v1.Place, null, any>;
                  getByUuid: (uuid: string) => Promise<Nullable<Place.v1.Place>>;
                  getByUuidWithLineage: (
                      uuid: string,
                  ) => Promise<Nullable<PlaceWithLineage>>;
                  getPageByType: (
                      placeType: string,
                      cursor?: Nullable<string>,
                      limit?: number | `${number}`,
                  ) => Promise<Page<Place.v1.Place>>;
              };
              report: {
                  getByUuid: (uuid: string) => Promise<Nullable<Report.v1.Report>>;
                  getByUuidWithLineage: (
                      uuid: string,
                  ) => Promise<Nullable<ReportWithLineage>>;
                  getUuidsByFreetext: (
                      qualifier: string,
                  ) => AsyncGenerator<string, null, any>;
                  getUuidsPageByFreetext: (
                      qualifier: string,
                      cursor?: Nullable<string>,
                      limit?: number | `${number}`,
                  ) => Promise<Page<string>>;
              };
          };
      }

      the CHT datasource API

      Error if the provided context is invalid