@openmrs/esm-api 3.4.1-pre.122 → 3.4.1-pre.139
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/.turbo/turbo-build.log +14 -13
- package/dist/openmrs-esm-api.js +1 -1
- package/dist/openmrs-esm-api.js.map +1 -1
- package/package.json +6 -7
- package/src/fhir.ts +31 -8
- package/src/openmrs-fetch.ts +2 -7
- package/src/types/fhir.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-api",
|
|
3
|
-
"version": "3.4.1-pre.
|
|
3
|
+
"version": "3.4.1-pre.139",
|
|
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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"fhir
|
|
39
|
+
"@types/fhir": "0.0.31",
|
|
40
40
|
"lodash-es": "^4.17.21"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -44,11 +44,10 @@
|
|
|
44
44
|
"@openmrs/esm-error-handling": "3.x"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@openmrs/esm-config": "^3.4.1-pre.
|
|
48
|
-
"@openmrs/esm-error-handling": "^3.4.1-pre.
|
|
49
|
-
"@openmrs/esm-state": "^3.4.1-pre.
|
|
50
|
-
"@types/fhir": "0.0.31",
|
|
47
|
+
"@openmrs/esm-config": "^3.4.1-pre.139",
|
|
48
|
+
"@openmrs/esm-error-handling": "^3.4.1-pre.139",
|
|
49
|
+
"@openmrs/esm-state": "^3.4.1-pre.139",
|
|
51
50
|
"rxjs": "^6.5.3"
|
|
52
51
|
},
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "59cfc00c57bdc9900cd915b2dfc6676c9c13f318"
|
|
54
53
|
}
|
package/src/fhir.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** @module @category API */
|
|
2
2
|
import { openmrsFetch, FetchHeaders, OpenmrsFetchError } from "./openmrs-fetch";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResourceName } from "./types/fhir";
|
|
4
4
|
|
|
5
5
|
export const fhirBaseUrl = `/ws/fhir2/R4`;
|
|
6
6
|
|
|
7
|
-
const makeFhir = require("fhir.js/src/fhir.js");
|
|
8
7
|
const openmrsFhirAdapter = {
|
|
9
8
|
http(requestObj: FHIRRequestObj) {
|
|
10
9
|
return openmrsFetch(requestObj.url, {
|
|
@@ -23,7 +22,7 @@ const openmrsFhirAdapter = {
|
|
|
23
22
|
return {
|
|
24
23
|
status: err.response.status,
|
|
25
24
|
headers: err.response.headers,
|
|
26
|
-
data: err.responseBody,
|
|
25
|
+
data: err.responseBody as any,
|
|
27
26
|
config: requestObj,
|
|
28
27
|
};
|
|
29
28
|
}
|
|
@@ -32,18 +31,42 @@ const openmrsFhirAdapter = {
|
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
|
-
* The `fhir` object is
|
|
34
|
+
* The `fhir` object is replicates the API from [fhir.js](https://github.com/FHIR/fhir.js)
|
|
36
35
|
* that can be used to call FHIR-compliant OpenMRS APIs. See
|
|
37
36
|
* [the docs for fhir.js](https://github.com/FHIR/fhir.js) for more info
|
|
38
37
|
* and example usage.
|
|
39
38
|
*
|
|
39
|
+
* This object should be considered deprecated and may be removed from a future version
|
|
40
|
+
* of the framework.
|
|
41
|
+
*
|
|
40
42
|
* @category API
|
|
43
|
+
* @deprecated
|
|
41
44
|
*/
|
|
42
|
-
export const fhir
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
45
|
+
export const fhir = {
|
|
46
|
+
read: <T>(
|
|
47
|
+
options: FHIRRequestOptions
|
|
48
|
+
): Promise<{
|
|
49
|
+
status: number;
|
|
50
|
+
headers: Headers;
|
|
51
|
+
data: T;
|
|
52
|
+
config: FHIRRequestObj;
|
|
53
|
+
}> => {
|
|
54
|
+
return openmrsFhirAdapter.http({
|
|
55
|
+
url: `${fhirBaseUrl}/${options.type}/${options.patient}`,
|
|
56
|
+
method: "GET",
|
|
57
|
+
headers: options.headers ?? {},
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @deprecated */
|
|
63
|
+
export interface FHIRRequestOptions {
|
|
64
|
+
type: ResourceName;
|
|
65
|
+
patient: string;
|
|
66
|
+
headers?: FetchHeaders;
|
|
67
|
+
}
|
|
46
68
|
|
|
69
|
+
/** @deprecated */
|
|
47
70
|
export interface FHIRRequestObj {
|
|
48
71
|
url: string;
|
|
49
72
|
method: string;
|
package/src/openmrs-fetch.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/** @module @category API */
|
|
2
2
|
import { Observable } from "rxjs";
|
|
3
3
|
import isPlainObject from "lodash-es/isPlainObject";
|
|
4
|
-
import {
|
|
5
|
-
getConfig,
|
|
6
|
-
interpolateString,
|
|
7
|
-
interpolateUrl,
|
|
8
|
-
navigate,
|
|
9
|
-
} from "@openmrs/esm-config";
|
|
4
|
+
import { getConfig, navigate } from "@openmrs/esm-config";
|
|
10
5
|
import { FetchResponse } from "./types";
|
|
11
6
|
|
|
12
7
|
export const sessionEndpoint = "/ws/rest/v1/session";
|
|
@@ -315,6 +310,6 @@ interface FetchBody {
|
|
|
315
310
|
[key: string]: any;
|
|
316
311
|
}
|
|
317
312
|
|
|
318
|
-
interface FetchResponseJson {
|
|
313
|
+
export interface FetchResponseJson {
|
|
319
314
|
[key: string]: any;
|
|
320
315
|
}
|
package/src/types/fhir.ts
CHANGED