@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-api",
3
- "version": "3.2.0",
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.0",
48
- "@openmrs/esm-error-handling": "^3.2.0",
49
- "@openmrs/esm-state": "^3.2.0",
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": "9c4a04089e29ff99321d6fef72294f402deb0f7b"
53
+ "gitHead": "2d2457c75087b97cd8959d6a4dc854e3f6b8f6f5"
54
54
  }
package/src/fhir.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @module
3
+ * @category API
4
+ */
1
5
  import { openmrsFetch, FetchHeaders, OpenmrsFetchError } from "./openmrs-fetch";
2
6
  import type { FhirClient } from "./types/fhir";
3
7
 
package/src/index.ts CHANGED
@@ -10,4 +10,3 @@ export * from "./shared-api-objects/visit-type";
10
10
  export * from "./shared-api-objects/location";
11
11
 
12
12
  export * from "./openmrs-backend-dependencies";
13
- export * from "./workspace/workspace.resource";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @module
3
+ * @category API
4
+ */
5
+
1
6
  import { Observable } from "rxjs";
2
7
  import isPlainObject from "lodash-es/isPlainObject";
3
8
  import { getConfig, navigate } from "@openmrs/esm-config";
@@ -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,3 +1,8 @@
1
+ /**
2
+ * @module
3
+ * @category API
4
+ */
5
+
1
6
  import { Observable } from "rxjs";
2
7
  import { map, take } from "rxjs/operators";
3
8
  import { openmrsObservableFetch } from "../openmrs-fetch";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @module
3
+ * @category API
4
+ */
5
+
1
6
  import { Observable } from "rxjs";
2
7
  import { map, take } from "rxjs/operators";
3
8
  import { openmrsObservableFetch } from "../openmrs-fetch";
@@ -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 function openVisitsNoteWorkspace(componentName: string, title: string) {
13
- newWorkspaceItem({
14
- component: componentName,
15
- name: title,
16
- props: {},
17
- inProgress: false,
18
- validations: (workspaceTabs: Array<any>) =>
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
- }