@ampath/esm-reports-app 1.0.0-next.103 → 1.0.0-next.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,12 @@
1
1
  import { openmrsFetch } from '@openmrs/esm-framework';
2
2
  import { buildEtlUrl } from '../utils/get-base-url';
3
- import { PAGE_SIZE, toPatientListPage, pageParams, type PatientListParams } from './patient-list-page';
3
+ import {
4
+ PAGE_SIZE,
5
+ toPatientListPage,
6
+ pageParams,
7
+ type PatientListPage,
8
+ type PatientListParams,
9
+ } from './patient-list-page';
4
10
 
5
11
  interface Moh710Params {
6
12
  locationUuids: string;
@@ -84,7 +90,7 @@ export async function getMoh413PatientList(params: PatientListParams): Promise<a
84
90
  }
85
91
  }
86
92
 
87
- export async function getMoh511Register(params: PatientListParams): Promise<any> {
93
+ export async function getMoh511Register(params: PatientListParams): Promise<PatientListPage> {
88
94
  const url = await buildEtlUrl('moh-511-register', {
89
95
  locationUuids: params.locationUuids || '',
90
96
  startDate: params.startDate || '',
@@ -104,7 +110,7 @@ export async function getMoh511Register(params: PatientListParams): Promise<any>
104
110
  }
105
111
 
106
112
  const data = await response.json();
107
- return data;
113
+ return toPatientListPage(data?.data, params.startIndex ?? 0, params.limit ?? PAGE_SIZE);
108
114
  } catch (error: any) {
109
115
  throw new Error(`An error occurred while fetching the MOH-511 Register: ${error.message}`);
110
116
  }