@openmrs/esm-api 3.2.0 → 3.2.1-pre.1010
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.
- package/dist/openmrs-esm-api.js +1 -1
- package/dist/openmrs-esm-api.js.map +1 -1
- package/package.json +5 -5
- package/src/fhir.ts +4 -0
- package/src/index.ts +0 -1
- package/src/openmrs-fetch.ts +5 -0
- package/src/shared-api-objects/current-patient.ts +5 -3
- package/src/shared-api-objects/current-user.ts +5 -4
- package/src/shared-api-objects/location.ts +5 -0
- package/src/shared-api-objects/visit-type.ts +5 -0
- package/src/shared-api-objects/visit-utils.ts +13 -19
- package/src/workspace/workspace.resource.tsx +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-api",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1-pre.1010",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The javascript module for interacting with the OpenMRS API",
|
|
6
6
|
"browser": "dist/openmrs-esm-api.js",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@openmrs/esm-error-handling": "3.x"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@openmrs/esm-config": "^3.2.
|
|
48
|
-
"@openmrs/esm-error-handling": "^3.2.
|
|
49
|
-
"@openmrs/esm-state": "^3.2.
|
|
47
|
+
"@openmrs/esm-config": "^3.2.1-pre.1010",
|
|
48
|
+
"@openmrs/esm-error-handling": "^3.2.1-pre.1010",
|
|
49
|
+
"@openmrs/esm-state": "^3.2.1-pre.1010",
|
|
50
50
|
"@types/fhir": "0.0.31",
|
|
51
51
|
"rxjs": "^6.5.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "2d2457c75087b97cd8959d6a4dc854e3f6b8f6f5"
|
|
54
54
|
}
|
package/src/fhir.ts
CHANGED
package/src/index.ts
CHANGED
package/src/openmrs-fetch.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @category API
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import { fhir } from "../fhir";
|
|
2
7
|
import { FetchResponse } from "../types";
|
|
3
8
|
|
|
@@ -17,9 +22,6 @@ export interface OnlyThePatient extends CurrentPatientOptions {
|
|
|
17
22
|
|
|
18
23
|
export type PatientUuid = string | null;
|
|
19
24
|
|
|
20
|
-
/**
|
|
21
|
-
* @category API Object
|
|
22
|
-
*/
|
|
23
25
|
export function fetchCurrentPatient(
|
|
24
26
|
patientUuid: PatientUuid,
|
|
25
27
|
contentOverrides?: Partial<Parameters<typeof fhir.read>[0]>
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @category API
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import { Observable, ReplaySubject } from "rxjs";
|
|
2
7
|
import { filter, map, tap, mergeAll } from "rxjs/operators";
|
|
3
8
|
import { openmrsFetch, sessionEndpoint } from "../openmrs-fetch";
|
|
@@ -51,8 +56,6 @@ let lastFetchTimeMillis = 0;
|
|
|
51
56
|
* Otherwise your code will continue getting updates to the user object
|
|
52
57
|
* even after the UI component is gone from the screen. This is a memory
|
|
53
58
|
* leak and source of bugs.
|
|
54
|
-
*
|
|
55
|
-
* @category API Object
|
|
56
59
|
*/
|
|
57
60
|
function getCurrentUser(): Observable<LoggedInUser>;
|
|
58
61
|
function getCurrentUser(
|
|
@@ -110,8 +113,6 @@ export { getCurrentUser };
|
|
|
110
113
|
* import { refetchCurrentUser } from '@openmrs/esm-api'
|
|
111
114
|
* refetchCurrentUser()
|
|
112
115
|
* ```
|
|
113
|
-
*
|
|
114
|
-
* @category API Object
|
|
115
116
|
*/
|
|
116
117
|
export function refetchCurrentUser() {
|
|
117
118
|
lastFetchTimeMillis = Date.now();
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
* @category API
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import { Observable, BehaviorSubject } from "rxjs";
|
|
2
7
|
import { take, map } from "rxjs/operators";
|
|
3
8
|
import { openmrsObservableFetch } from "../openmrs-fetch";
|
|
4
|
-
import { newWorkspaceItem } from "../workspace/workspace.resource";
|
|
5
9
|
import {
|
|
6
10
|
FetchResponse,
|
|
7
11
|
NewVisitPayload,
|
|
@@ -9,30 +13,20 @@ import {
|
|
|
9
13
|
Visit,
|
|
10
14
|
} from "../types";
|
|
11
15
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
workspaceTabs.findIndex((tab) => tab.component === componentName),
|
|
20
|
-
});
|
|
21
|
-
}
|
|
16
|
+
export const defaultVisitCustomRepresentation =
|
|
17
|
+
"custom:(uuid,encounters:(uuid,encounterDatetime," +
|
|
18
|
+
"form:(uuid,name),location:ref," +
|
|
19
|
+
"encounterType:ref,encounterProviders:(uuid,display," +
|
|
20
|
+
"provider:(uuid,display))),patient:(uuid,uuid)," +
|
|
21
|
+
"visitType:(uuid,name,display),attributes:(uuid,display,value),location:(uuid,name,display),startDatetime," +
|
|
22
|
+
"stopDatetime)";
|
|
22
23
|
|
|
23
24
|
export function getVisitsForPatient(
|
|
24
25
|
patientUuid: string,
|
|
25
26
|
abortController: AbortController,
|
|
26
27
|
v?: string
|
|
27
28
|
): Observable<FetchResponse<{ results: Array<Visit> }>> {
|
|
28
|
-
const custom =
|
|
29
|
-
v ||
|
|
30
|
-
"custom:(uuid,encounters:(uuid,encounterDatetime," +
|
|
31
|
-
"form:(uuid,name),location:ref," +
|
|
32
|
-
"encounterType:ref,encounterProviders:(uuid,display," +
|
|
33
|
-
"provider:(uuid,display))),patient:(uuid,uuid)," +
|
|
34
|
-
"visitType:(uuid,name,display),attributes:(uuid,display,value),location:(uuid,name,display),startDatetime," +
|
|
35
|
-
"stopDatetime)";
|
|
29
|
+
const custom = v ?? defaultVisitCustomRepresentation;
|
|
36
30
|
|
|
37
31
|
return openmrsObservableFetch(
|
|
38
32
|
`/ws/rest/v1/visit?patient=${patientUuid}&v=${custom}`,
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Subject, Observable } from "rxjs";
|
|
2
|
-
|
|
3
|
-
const workspaceItem = new Subject<WorkspaceItem>();
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param item
|
|
8
|
-
* @category Workspace
|
|
9
|
-
*/
|
|
10
|
-
export function newWorkspaceItem(item: WorkspaceItem) {
|
|
11
|
-
workspaceItem.next(item);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @returns
|
|
17
|
-
* @category Workspace
|
|
18
|
-
*/
|
|
19
|
-
export function getNewWorkspaceItem(): Observable<WorkspaceItem> {
|
|
20
|
-
return workspaceItem.asObservable();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface WorkspaceItem {
|
|
24
|
-
component: any;
|
|
25
|
-
name: string;
|
|
26
|
-
props: any;
|
|
27
|
-
validations?: Function;
|
|
28
|
-
inProgress: boolean;
|
|
29
|
-
componentClosed?: Function;
|
|
30
|
-
}
|