@openmrs/esm-api 3.1.15-pre.692 → 3.1.15-pre.707
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/README.md +0 -2
- package/package.json +6 -7
- package/docs/API.md +0 -724
- package/docs/classes/OpenmrsFetchError.md +0 -186
- package/docs/enums/VisitMode.md +0 -41
- package/docs/enums/VisitStatus.md +0 -30
- package/docs/interfaces/CurrentPatientOptions.md +0 -27
- package/docs/interfaces/CurrentUserOptions.md +0 -27
- package/docs/interfaces/CurrentUserWithResponseOption.md +0 -29
- package/docs/interfaces/CurrentUserWithoutResponseOption.md +0 -29
- package/docs/interfaces/FHIRCode.md +0 -30
- package/docs/interfaces/FHIRRequestObj.md +0 -41
- package/docs/interfaces/FHIRResource.md +0 -46
- package/docs/interfaces/FetchHeaders.md +0 -7
- package/docs/interfaces/FetchResponse.md +0 -285
- package/docs/interfaces/Location.md +0 -41
- package/docs/interfaces/LoggedInUser.md +0 -133
- package/docs/interfaces/LoggedInUserFetchResponse.md +0 -281
- package/docs/interfaces/NewVisitPayload.md +0 -74
- package/docs/interfaces/OnlyThePatient.md +0 -29
- package/docs/interfaces/OpenmrsResource.md +0 -34
- package/docs/interfaces/PatientWithFullResponse.md +0 -29
- package/docs/interfaces/Person.md +0 -41
- package/docs/interfaces/Privilege.md +0 -41
- package/docs/interfaces/Role.md +0 -41
- package/docs/interfaces/SessionLocation.md +0 -41
- package/docs/interfaces/SessionUser.md +0 -92
- package/docs/interfaces/UnauthenticatedUser.md +0 -52
- package/docs/interfaces/User.md +0 -107
- package/docs/interfaces/Visit.md +0 -111
- package/docs/interfaces/VisitItem.md +0 -52
- package/docs/interfaces/VisitType.md +0 -41
- package/docs/interfaces/WorkspaceItem.md +0 -74
- package/typedoc.json +0 -7
package/docs/API.md
DELETED
|
@@ -1,724 +0,0 @@
|
|
|
1
|
-
[Back to README.md](../README.md)
|
|
2
|
-
|
|
3
|
-
# @openmrs/esm-api
|
|
4
|
-
|
|
5
|
-
## Table of contents
|
|
6
|
-
|
|
7
|
-
### Enumerations
|
|
8
|
-
|
|
9
|
-
- [VisitMode](enums/VisitMode.md)
|
|
10
|
-
- [VisitStatus](enums/VisitStatus.md)
|
|
11
|
-
|
|
12
|
-
### Classes
|
|
13
|
-
|
|
14
|
-
- [OpenmrsFetchError](classes/OpenmrsFetchError.md)
|
|
15
|
-
|
|
16
|
-
### Interfaces
|
|
17
|
-
|
|
18
|
-
- [CurrentPatientOptions](interfaces/CurrentPatientOptions.md)
|
|
19
|
-
- [CurrentUserOptions](interfaces/CurrentUserOptions.md)
|
|
20
|
-
- [CurrentUserWithResponseOption](interfaces/CurrentUserWithResponseOption.md)
|
|
21
|
-
- [CurrentUserWithoutResponseOption](interfaces/CurrentUserWithoutResponseOption.md)
|
|
22
|
-
- [FHIRCode](interfaces/FHIRCode.md)
|
|
23
|
-
- [FHIRRequestObj](interfaces/FHIRRequestObj.md)
|
|
24
|
-
- [FHIRResource](interfaces/FHIRResource.md)
|
|
25
|
-
- [FetchHeaders](interfaces/FetchHeaders.md)
|
|
26
|
-
- [FetchResponse](interfaces/FetchResponse.md)
|
|
27
|
-
- [Location](interfaces/Location.md)
|
|
28
|
-
- [LoggedInUser](interfaces/LoggedInUser.md)
|
|
29
|
-
- [LoggedInUserFetchResponse](interfaces/LoggedInUserFetchResponse.md)
|
|
30
|
-
- [NewVisitPayload](interfaces/NewVisitPayload.md)
|
|
31
|
-
- [OnlyThePatient](interfaces/OnlyThePatient.md)
|
|
32
|
-
- [OpenmrsResource](interfaces/OpenmrsResource.md)
|
|
33
|
-
- [PatientWithFullResponse](interfaces/PatientWithFullResponse.md)
|
|
34
|
-
- [Person](interfaces/Person.md)
|
|
35
|
-
- [Privilege](interfaces/Privilege.md)
|
|
36
|
-
- [Role](interfaces/Role.md)
|
|
37
|
-
- [SessionLocation](interfaces/SessionLocation.md)
|
|
38
|
-
- [SessionUser](interfaces/SessionUser.md)
|
|
39
|
-
- [UnauthenticatedUser](interfaces/UnauthenticatedUser.md)
|
|
40
|
-
- [User](interfaces/User.md)
|
|
41
|
-
- [Visit](interfaces/Visit.md)
|
|
42
|
-
- [VisitItem](interfaces/VisitItem.md)
|
|
43
|
-
- [VisitType](interfaces/VisitType.md)
|
|
44
|
-
- [WorkspaceItem](interfaces/WorkspaceItem.md)
|
|
45
|
-
|
|
46
|
-
### Type aliases
|
|
47
|
-
|
|
48
|
-
- [CurrentPatient](API.md#currentpatient)
|
|
49
|
-
- [LoggedInUserData](API.md#loggedinuserdata)
|
|
50
|
-
- [PatientUuid](API.md#patientuuid)
|
|
51
|
-
- [UpdateVisitPayload](API.md#updatevisitpayload)
|
|
52
|
-
|
|
53
|
-
### API Variables
|
|
54
|
-
|
|
55
|
-
- [fhir](API.md#fhir)
|
|
56
|
-
|
|
57
|
-
### Other Variables
|
|
58
|
-
|
|
59
|
-
- [backendDependencies](API.md#backenddependencies)
|
|
60
|
-
- [fhirBaseUrl](API.md#fhirbaseurl)
|
|
61
|
-
- [getStartedVisit](API.md#getstartedvisit)
|
|
62
|
-
- [sessionEndpoint](API.md#sessionendpoint)
|
|
63
|
-
|
|
64
|
-
### API Functions
|
|
65
|
-
|
|
66
|
-
- [openmrsFetch](API.md#openmrsfetch)
|
|
67
|
-
- [openmrsObservableFetch](API.md#openmrsobservablefetch)
|
|
68
|
-
|
|
69
|
-
### API Object Functions
|
|
70
|
-
|
|
71
|
-
- [fetchCurrentPatient](API.md#fetchcurrentpatient)
|
|
72
|
-
- [getCurrentUser](API.md#getcurrentuser)
|
|
73
|
-
- [refetchCurrentUser](API.md#refetchcurrentuser)
|
|
74
|
-
|
|
75
|
-
### Other Functions
|
|
76
|
-
|
|
77
|
-
- [getLocations](API.md#getlocations)
|
|
78
|
-
- [getLoggedInUser](API.md#getloggedinuser)
|
|
79
|
-
- [getSessionLocation](API.md#getsessionlocation)
|
|
80
|
-
- [getVisitTypes](API.md#getvisittypes)
|
|
81
|
-
- [getVisitsForPatient](API.md#getvisitsforpatient)
|
|
82
|
-
- [makeUrl](API.md#makeurl)
|
|
83
|
-
- [openVisitsNoteWorkspace](API.md#openvisitsnoteworkspace)
|
|
84
|
-
- [saveVisit](API.md#savevisit)
|
|
85
|
-
- [setSessionLocation](API.md#setsessionlocation)
|
|
86
|
-
- [toLocationObject](API.md#tolocationobject)
|
|
87
|
-
- [toVisitTypeObject](API.md#tovisittypeobject)
|
|
88
|
-
- [updateVisit](API.md#updatevisit)
|
|
89
|
-
- [userHasAccess](API.md#userhasaccess)
|
|
90
|
-
|
|
91
|
-
### Workspace Functions
|
|
92
|
-
|
|
93
|
-
- [getNewWorkspaceItem](API.md#getnewworkspaceitem)
|
|
94
|
-
- [newWorkspaceItem](API.md#newworkspaceitem)
|
|
95
|
-
|
|
96
|
-
## Type aliases
|
|
97
|
-
|
|
98
|
-
### CurrentPatient
|
|
99
|
-
|
|
100
|
-
Ƭ **CurrentPatient**: `fhir.Patient` \| [`FetchResponse`](interfaces/FetchResponse.md)<`fhir.Patient`\>
|
|
101
|
-
|
|
102
|
-
#### Defined in
|
|
103
|
-
|
|
104
|
-
[packages/framework/esm-api/src/shared-api-objects/current-patient.ts:4](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-patient.ts#L4)
|
|
105
|
-
|
|
106
|
-
___
|
|
107
|
-
|
|
108
|
-
### LoggedInUserData
|
|
109
|
-
|
|
110
|
-
Ƭ **LoggedInUserData**: [`UnauthenticatedUser`](interfaces/UnauthenticatedUser.md) & { `user?`: [`LoggedInUser`](interfaces/LoggedInUser.md) }
|
|
111
|
-
|
|
112
|
-
#### Defined in
|
|
113
|
-
|
|
114
|
-
[packages/framework/esm-api/src/types/fetch.ts:7](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/types/fetch.ts#L7)
|
|
115
|
-
|
|
116
|
-
___
|
|
117
|
-
|
|
118
|
-
### PatientUuid
|
|
119
|
-
|
|
120
|
-
Ƭ **PatientUuid**: `string` \| ``null``
|
|
121
|
-
|
|
122
|
-
#### Defined in
|
|
123
|
-
|
|
124
|
-
[packages/framework/esm-api/src/shared-api-objects/current-patient.ts:18](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-patient.ts#L18)
|
|
125
|
-
|
|
126
|
-
___
|
|
127
|
-
|
|
128
|
-
### UpdateVisitPayload
|
|
129
|
-
|
|
130
|
-
Ƭ **UpdateVisitPayload**: [`NewVisitPayload`](interfaces/NewVisitPayload.md) & {}
|
|
131
|
-
|
|
132
|
-
#### Defined in
|
|
133
|
-
|
|
134
|
-
[packages/framework/esm-api/src/types/visit-resource.ts:12](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/types/visit-resource.ts#L12)
|
|
135
|
-
|
|
136
|
-
## API Variables
|
|
137
|
-
|
|
138
|
-
### fhir
|
|
139
|
-
|
|
140
|
-
• `Const` **fhir**: `FhirClient`
|
|
141
|
-
|
|
142
|
-
The `fhir` object is [an instance of fhir.js](https://github.com/FHIR/fhir.js)
|
|
143
|
-
that can be used to call FHIR-compliant OpenMRS APIs. See
|
|
144
|
-
[the docs for fhir.js](https://github.com/FHIR/fhir.js) for more info
|
|
145
|
-
and example usage.
|
|
146
|
-
|
|
147
|
-
#### Defined in
|
|
148
|
-
|
|
149
|
-
[packages/framework/esm-api/src/fhir.ts:41](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/fhir.ts#L41)
|
|
150
|
-
|
|
151
|
-
___
|
|
152
|
-
|
|
153
|
-
## Other Variables
|
|
154
|
-
|
|
155
|
-
### backendDependencies
|
|
156
|
-
|
|
157
|
-
• `Const` **backendDependencies**: `Object`
|
|
158
|
-
|
|
159
|
-
#### Type declaration
|
|
160
|
-
|
|
161
|
-
| Name | Type |
|
|
162
|
-
| :------ | :------ |
|
|
163
|
-
| `fhir2` | `string` |
|
|
164
|
-
| `webservices.rest` | `string` |
|
|
165
|
-
|
|
166
|
-
#### Defined in
|
|
167
|
-
|
|
168
|
-
[packages/framework/esm-api/src/openmrs-backend-dependencies.ts:1](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/openmrs-backend-dependencies.ts#L1)
|
|
169
|
-
|
|
170
|
-
___
|
|
171
|
-
|
|
172
|
-
### fhirBaseUrl
|
|
173
|
-
|
|
174
|
-
• `Const` **fhirBaseUrl**: ``"/ws/fhir2/R4"``
|
|
175
|
-
|
|
176
|
-
#### Defined in
|
|
177
|
-
|
|
178
|
-
[packages/framework/esm-api/src/fhir.ts:4](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/fhir.ts#L4)
|
|
179
|
-
|
|
180
|
-
___
|
|
181
|
-
|
|
182
|
-
### getStartedVisit
|
|
183
|
-
|
|
184
|
-
• `Const` **getStartedVisit**: `BehaviorSubject`<``null`` \| [`VisitItem`](interfaces/VisitItem.md)\>
|
|
185
|
-
|
|
186
|
-
#### Defined in
|
|
187
|
-
|
|
188
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:84](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-utils.ts#L84)
|
|
189
|
-
|
|
190
|
-
___
|
|
191
|
-
|
|
192
|
-
### sessionEndpoint
|
|
193
|
-
|
|
194
|
-
• `Const` **sessionEndpoint**: ``"/ws/rest/v1/session"``
|
|
195
|
-
|
|
196
|
-
#### Defined in
|
|
197
|
-
|
|
198
|
-
[packages/framework/esm-api/src/openmrs-fetch.ts:6](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/openmrs-fetch.ts#L6)
|
|
199
|
-
|
|
200
|
-
## API Functions
|
|
201
|
-
|
|
202
|
-
### openmrsFetch
|
|
203
|
-
|
|
204
|
-
▸ **openmrsFetch**<`T`\>(`path`, `fetchInit?`): `Promise`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
205
|
-
|
|
206
|
-
The openmrsFetch function is a wrapper around the
|
|
207
|
-
[browser's built-in fetch function](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch),
|
|
208
|
-
with extra handling for OpenMRS-specific API behaviors, such as
|
|
209
|
-
request headers, authentication, authorization, and the API urls.
|
|
210
|
-
|
|
211
|
-
#### Type parameters
|
|
212
|
-
|
|
213
|
-
| Name | Type |
|
|
214
|
-
| :------ | :------ |
|
|
215
|
-
| `T` | `any` |
|
|
216
|
-
|
|
217
|
-
#### Parameters
|
|
218
|
-
|
|
219
|
-
| Name | Type | Description |
|
|
220
|
-
| :------ | :------ | :------ |
|
|
221
|
-
| `path` | `string` | A string url to make the request to. Note that the openmrs base url (by default `/openmrs`) will be automatically prepended to the URL, so there is no need to include it. |
|
|
222
|
-
| `fetchInit` | `FetchConfig` | A [fetch init object](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax). Note that the `body` property does not need to be `JSON.stringify()`ed because openmrsFetch will do that for you. |
|
|
223
|
-
|
|
224
|
-
#### Returns
|
|
225
|
-
|
|
226
|
-
`Promise`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
227
|
-
|
|
228
|
-
A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
|
229
|
-
that resolves with a [Response object](https://developer.mozilla.org/en-US/docs/Web/API/Response).
|
|
230
|
-
Note that the openmrs version of the Response object has already
|
|
231
|
-
downloaded the HTTP response body as json, and has an additional
|
|
232
|
-
`data` property with the HTTP response json as a javascript object.
|
|
233
|
-
|
|
234
|
-
#### Example
|
|
235
|
-
```js
|
|
236
|
-
import { openmrsFetch } from '@openmrs/esm-api'
|
|
237
|
-
const abortController = new AbortController();
|
|
238
|
-
openmrsFetch('/ws/rest/v1/session', {signal: abortController.signal})
|
|
239
|
-
.then(response => {
|
|
240
|
-
console.log(response.data.authenticated)
|
|
241
|
-
})
|
|
242
|
-
.catch(err => {
|
|
243
|
-
console.error(err.status);
|
|
244
|
-
})
|
|
245
|
-
abortController.abort();
|
|
246
|
-
openmrsFetch('/ws/rest/v1/session', {
|
|
247
|
-
method: 'POST',
|
|
248
|
-
body: {
|
|
249
|
-
username: 'hi',
|
|
250
|
-
password: 'there',
|
|
251
|
-
}
|
|
252
|
-
})
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
#### Cancellation
|
|
256
|
-
|
|
257
|
-
To cancel a network request, use an
|
|
258
|
-
[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort).
|
|
259
|
-
It is best practice to cancel your network requests when the user
|
|
260
|
-
navigates away from a page while the request is pending request, to
|
|
261
|
-
free up memory and network resources and to prevent race conditions.
|
|
262
|
-
|
|
263
|
-
#### Defined in
|
|
264
|
-
|
|
265
|
-
[packages/framework/esm-api/src/openmrs-fetch.ts:61](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/openmrs-fetch.ts#L61)
|
|
266
|
-
|
|
267
|
-
___
|
|
268
|
-
|
|
269
|
-
### openmrsObservableFetch
|
|
270
|
-
|
|
271
|
-
▸ **openmrsObservableFetch**<`T`\>(`url`, `fetchInit?`): `Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
272
|
-
|
|
273
|
-
The openmrsObservableFetch function is a wrapper around openmrsFetch
|
|
274
|
-
that returns an [Observable](https://rxjs-dev.firebaseapp.com/guide/observable)
|
|
275
|
-
instead of a promise. It exists in case using an Observable is
|
|
276
|
-
preferred or more convenient than a promise.
|
|
277
|
-
|
|
278
|
-
#### Type parameters
|
|
279
|
-
|
|
280
|
-
| Name |
|
|
281
|
-
| :------ |
|
|
282
|
-
| `T` |
|
|
283
|
-
|
|
284
|
-
#### Parameters
|
|
285
|
-
|
|
286
|
-
| Name | Type | Description |
|
|
287
|
-
| :------ | :------ | :------ |
|
|
288
|
-
| `url` | `string` | See [openmrsFetch](API.md#openmrsfetch) |
|
|
289
|
-
| `fetchInit` | `FetchConfig` | See [openmrsFetch](API.md#openmrsfetch) |
|
|
290
|
-
|
|
291
|
-
#### Returns
|
|
292
|
-
|
|
293
|
-
`Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
294
|
-
|
|
295
|
-
An Observable that produces exactly one Response object.
|
|
296
|
-
The response object is exactly the same as for [openmrsFetch](API.md#openmrsfetch).
|
|
297
|
-
|
|
298
|
-
#### Example
|
|
299
|
-
|
|
300
|
-
```js
|
|
301
|
-
import { openmrsObservableFetch } from '@openmrs/esm-api'
|
|
302
|
-
const subscription = openmrsObservableFetch('/ws/rest/v1/session').subscribe(
|
|
303
|
-
response => console.log(response.data),
|
|
304
|
-
err => {throw err},
|
|
305
|
-
() => console.log('finished')
|
|
306
|
-
)
|
|
307
|
-
subscription.unsubscribe()
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
#### Cancellation
|
|
311
|
-
|
|
312
|
-
To cancel the network request, simply call `subscription.unsubscribe();`
|
|
313
|
-
|
|
314
|
-
#### Defined in
|
|
315
|
-
|
|
316
|
-
[packages/framework/esm-api/src/openmrs-fetch.ts:232](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/openmrs-fetch.ts#L232)
|
|
317
|
-
|
|
318
|
-
___
|
|
319
|
-
|
|
320
|
-
## API Object Functions
|
|
321
|
-
|
|
322
|
-
### fetchCurrentPatient
|
|
323
|
-
|
|
324
|
-
▸ **fetchCurrentPatient**(`patientUuid`, `contentOverrides?`): `Promise`<`Object`\> \| `Promise`<``null``\>
|
|
325
|
-
|
|
326
|
-
#### Parameters
|
|
327
|
-
|
|
328
|
-
| Name | Type |
|
|
329
|
-
| :------ | :------ |
|
|
330
|
-
| `patientUuid` | [`PatientUuid`](API.md#patientuuid) |
|
|
331
|
-
| `contentOverrides?` | `Partial`<`Parameters`<typeof `fhir.read`\>[``0``]\> |
|
|
332
|
-
|
|
333
|
-
#### Returns
|
|
334
|
-
|
|
335
|
-
`Promise`<`Object`\> \| `Promise`<``null``\>
|
|
336
|
-
|
|
337
|
-
#### Defined in
|
|
338
|
-
|
|
339
|
-
[packages/framework/esm-api/src/shared-api-objects/current-patient.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-patient.ts#L23)
|
|
340
|
-
|
|
341
|
-
___
|
|
342
|
-
|
|
343
|
-
### getCurrentUser
|
|
344
|
-
|
|
345
|
-
▸ **getCurrentUser**(): `Observable`<[`LoggedInUser`](interfaces/LoggedInUser.md)\>
|
|
346
|
-
|
|
347
|
-
The getCurrentUser function returns an observable that produces
|
|
348
|
-
**zero or more values, over time**. It will produce zero values
|
|
349
|
-
by default if the user is not logged in. And it will provide a
|
|
350
|
-
first value when the logged in user is fetched from the server.
|
|
351
|
-
Subsequent values will be produced whenever the user object is
|
|
352
|
-
updated.
|
|
353
|
-
|
|
354
|
-
#### Returns
|
|
355
|
-
|
|
356
|
-
`Observable`<[`LoggedInUser`](interfaces/LoggedInUser.md)\>
|
|
357
|
-
|
|
358
|
-
An Observable that produces zero or more values (as
|
|
359
|
-
described above). The values produced will be a user object (if
|
|
360
|
-
`includeAuthStatus` is set to `false`) or an object with a session
|
|
361
|
-
and authenticated property (if `includeAuthStatus` is set to `true`).
|
|
362
|
-
|
|
363
|
-
#### Example
|
|
364
|
-
|
|
365
|
-
```js
|
|
366
|
-
import { getCurrentUser } from '@openmrs/esm-api'
|
|
367
|
-
const subscription = getCurrentUser().subscribe(
|
|
368
|
-
user => console.log(user)
|
|
369
|
-
)
|
|
370
|
-
subscription.unsubscribe()
|
|
371
|
-
getCurrentUser({includeAuthStatus: true}).subscribe(
|
|
372
|
-
data => console.log(data.authenticated)
|
|
373
|
-
)
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
#### Be sure to unsubscribe when your component unmounts
|
|
377
|
-
|
|
378
|
-
Otherwise your code will continue getting updates to the user object
|
|
379
|
-
even after the UI component is gone from the screen. This is a memory
|
|
380
|
-
leak and source of bugs.
|
|
381
|
-
|
|
382
|
-
#### Defined in
|
|
383
|
-
|
|
384
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:57](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L57)
|
|
385
|
-
|
|
386
|
-
▸ **getCurrentUser**(`opts`): `Observable`<[`UnauthenticatedUser`](interfaces/UnauthenticatedUser.md)\>
|
|
387
|
-
|
|
388
|
-
#### Parameters
|
|
389
|
-
|
|
390
|
-
| Name | Type |
|
|
391
|
-
| :------ | :------ |
|
|
392
|
-
| `opts` | [`CurrentUserWithResponseOption`](interfaces/CurrentUserWithResponseOption.md) |
|
|
393
|
-
|
|
394
|
-
#### Returns
|
|
395
|
-
|
|
396
|
-
`Observable`<[`UnauthenticatedUser`](interfaces/UnauthenticatedUser.md)\>
|
|
397
|
-
|
|
398
|
-
#### Defined in
|
|
399
|
-
|
|
400
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:58](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L58)
|
|
401
|
-
|
|
402
|
-
▸ **getCurrentUser**(`opts`): `Observable`<[`LoggedInUser`](interfaces/LoggedInUser.md)\>
|
|
403
|
-
|
|
404
|
-
#### Parameters
|
|
405
|
-
|
|
406
|
-
| Name | Type |
|
|
407
|
-
| :------ | :------ |
|
|
408
|
-
| `opts` | [`CurrentUserWithoutResponseOption`](interfaces/CurrentUserWithoutResponseOption.md) |
|
|
409
|
-
|
|
410
|
-
#### Returns
|
|
411
|
-
|
|
412
|
-
`Observable`<[`LoggedInUser`](interfaces/LoggedInUser.md)\>
|
|
413
|
-
|
|
414
|
-
#### Defined in
|
|
415
|
-
|
|
416
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:61](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L61)
|
|
417
|
-
|
|
418
|
-
___
|
|
419
|
-
|
|
420
|
-
### refetchCurrentUser
|
|
421
|
-
|
|
422
|
-
▸ **refetchCurrentUser**(): `void`
|
|
423
|
-
|
|
424
|
-
The `refetchCurrentUser` function causes a network request to redownload
|
|
425
|
-
the user. All subscribers to the current user will be notified of the
|
|
426
|
-
new users once the new version of the user object is downloaded.
|
|
427
|
-
|
|
428
|
-
#### Returns
|
|
429
|
-
|
|
430
|
-
`void`
|
|
431
|
-
|
|
432
|
-
The same observable as returned by [getCurrentUser](API.md#getcurrentuser).
|
|
433
|
-
|
|
434
|
-
#### Example
|
|
435
|
-
```js
|
|
436
|
-
import { refetchCurrentUser } from '@openmrs/esm-api'
|
|
437
|
-
refetchCurrentUser()
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
#### Defined in
|
|
441
|
-
|
|
442
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:116](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L116)
|
|
443
|
-
|
|
444
|
-
___
|
|
445
|
-
|
|
446
|
-
## Other Functions
|
|
447
|
-
|
|
448
|
-
### getLocations
|
|
449
|
-
|
|
450
|
-
▸ **getLocations**(): `Observable`<[`Location`](interfaces/Location.md)[]\>
|
|
451
|
-
|
|
452
|
-
#### Returns
|
|
453
|
-
|
|
454
|
-
`Observable`<[`Location`](interfaces/Location.md)[]\>
|
|
455
|
-
|
|
456
|
-
#### Defined in
|
|
457
|
-
|
|
458
|
-
[packages/framework/esm-api/src/shared-api-objects/location.ts:13](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/location.ts#L13)
|
|
459
|
-
|
|
460
|
-
___
|
|
461
|
-
|
|
462
|
-
### getLoggedInUser
|
|
463
|
-
|
|
464
|
-
▸ **getLoggedInUser**(): `Promise`<[`LoggedInUser`](interfaces/LoggedInUser.md)\>
|
|
465
|
-
|
|
466
|
-
#### Returns
|
|
467
|
-
|
|
468
|
-
`Promise`<[`LoggedInUser`](interfaces/LoggedInUser.md)\>
|
|
469
|
-
|
|
470
|
-
#### Defined in
|
|
471
|
-
|
|
472
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:134](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L134)
|
|
473
|
-
|
|
474
|
-
___
|
|
475
|
-
|
|
476
|
-
### getSessionLocation
|
|
477
|
-
|
|
478
|
-
▸ **getSessionLocation**(): `Promise`<`undefined` \| [`SessionLocation`](interfaces/SessionLocation.md)\>
|
|
479
|
-
|
|
480
|
-
#### Returns
|
|
481
|
-
|
|
482
|
-
`Promise`<`undefined` \| [`SessionLocation`](interfaces/SessionLocation.md)\>
|
|
483
|
-
|
|
484
|
-
#### Defined in
|
|
485
|
-
|
|
486
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:143](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L143)
|
|
487
|
-
|
|
488
|
-
___
|
|
489
|
-
|
|
490
|
-
### getVisitTypes
|
|
491
|
-
|
|
492
|
-
▸ **getVisitTypes**(): `Observable`<[`VisitType`](interfaces/VisitType.md)[]\>
|
|
493
|
-
|
|
494
|
-
#### Returns
|
|
495
|
-
|
|
496
|
-
`Observable`<[`VisitType`](interfaces/VisitType.md)[]\>
|
|
497
|
-
|
|
498
|
-
#### Defined in
|
|
499
|
-
|
|
500
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-type.ts:14](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-type.ts#L14)
|
|
501
|
-
|
|
502
|
-
___
|
|
503
|
-
|
|
504
|
-
### getVisitsForPatient
|
|
505
|
-
|
|
506
|
-
▸ **getVisitsForPatient**(`patientUuid`, `abortController`, `v?`): `Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`Object`\>\>
|
|
507
|
-
|
|
508
|
-
#### Parameters
|
|
509
|
-
|
|
510
|
-
| Name | Type |
|
|
511
|
-
| :------ | :------ |
|
|
512
|
-
| `patientUuid` | `string` |
|
|
513
|
-
| `abortController` | `AbortController` |
|
|
514
|
-
| `v?` | `string` |
|
|
515
|
-
|
|
516
|
-
#### Returns
|
|
517
|
-
|
|
518
|
-
`Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`Object`\>\>
|
|
519
|
-
|
|
520
|
-
#### Defined in
|
|
521
|
-
|
|
522
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-utils.ts#L23)
|
|
523
|
-
|
|
524
|
-
___
|
|
525
|
-
|
|
526
|
-
### makeUrl
|
|
527
|
-
|
|
528
|
-
▸ **makeUrl**(`path`): `string`
|
|
529
|
-
|
|
530
|
-
#### Parameters
|
|
531
|
-
|
|
532
|
-
| Name | Type |
|
|
533
|
-
| :------ | :------ |
|
|
534
|
-
| `path` | `string` |
|
|
535
|
-
|
|
536
|
-
#### Returns
|
|
537
|
-
|
|
538
|
-
`string`
|
|
539
|
-
|
|
540
|
-
#### Defined in
|
|
541
|
-
|
|
542
|
-
[packages/framework/esm-api/src/openmrs-fetch.ts:8](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/openmrs-fetch.ts#L8)
|
|
543
|
-
|
|
544
|
-
___
|
|
545
|
-
|
|
546
|
-
### openVisitsNoteWorkspace
|
|
547
|
-
|
|
548
|
-
▸ **openVisitsNoteWorkspace**(`componentName`, `title`): `void`
|
|
549
|
-
|
|
550
|
-
#### Parameters
|
|
551
|
-
|
|
552
|
-
| Name | Type |
|
|
553
|
-
| :------ | :------ |
|
|
554
|
-
| `componentName` | `string` |
|
|
555
|
-
| `title` | `string` |
|
|
556
|
-
|
|
557
|
-
#### Returns
|
|
558
|
-
|
|
559
|
-
`void`
|
|
560
|
-
|
|
561
|
-
#### Defined in
|
|
562
|
-
|
|
563
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:12](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-utils.ts#L12)
|
|
564
|
-
|
|
565
|
-
___
|
|
566
|
-
|
|
567
|
-
### saveVisit
|
|
568
|
-
|
|
569
|
-
▸ **saveVisit**(`payload`, `abortController`): `Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`any`\>\>
|
|
570
|
-
|
|
571
|
-
#### Parameters
|
|
572
|
-
|
|
573
|
-
| Name | Type |
|
|
574
|
-
| :------ | :------ |
|
|
575
|
-
| `payload` | [`NewVisitPayload`](interfaces/NewVisitPayload.md) |
|
|
576
|
-
| `abortController` | `AbortController` |
|
|
577
|
-
|
|
578
|
-
#### Returns
|
|
579
|
-
|
|
580
|
-
`Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`any`\>\>
|
|
581
|
-
|
|
582
|
-
#### Defined in
|
|
583
|
-
|
|
584
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:55](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-utils.ts#L55)
|
|
585
|
-
|
|
586
|
-
___
|
|
587
|
-
|
|
588
|
-
### setSessionLocation
|
|
589
|
-
|
|
590
|
-
▸ **setSessionLocation**(`locationUuid`, `abortController`): `Promise`<`any`\>
|
|
591
|
-
|
|
592
|
-
#### Parameters
|
|
593
|
-
|
|
594
|
-
| Name | Type |
|
|
595
|
-
| :------ | :------ |
|
|
596
|
-
| `locationUuid` | `string` |
|
|
597
|
-
| `abortController` | `AbortController` |
|
|
598
|
-
|
|
599
|
-
#### Returns
|
|
600
|
-
|
|
601
|
-
`Promise`<`any`\>
|
|
602
|
-
|
|
603
|
-
#### Defined in
|
|
604
|
-
|
|
605
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:155](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L155)
|
|
606
|
-
|
|
607
|
-
___
|
|
608
|
-
|
|
609
|
-
### toLocationObject
|
|
610
|
-
|
|
611
|
-
▸ **toLocationObject**(`openmrsRestForm`): [`Location`](interfaces/Location.md)
|
|
612
|
-
|
|
613
|
-
#### Parameters
|
|
614
|
-
|
|
615
|
-
| Name | Type |
|
|
616
|
-
| :------ | :------ |
|
|
617
|
-
| `openmrsRestForm` | `any` |
|
|
618
|
-
|
|
619
|
-
#### Returns
|
|
620
|
-
|
|
621
|
-
[`Location`](interfaces/Location.md)
|
|
622
|
-
|
|
623
|
-
#### Defined in
|
|
624
|
-
|
|
625
|
-
[packages/framework/esm-api/src/shared-api-objects/location.ts:6](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/location.ts#L6)
|
|
626
|
-
|
|
627
|
-
___
|
|
628
|
-
|
|
629
|
-
### toVisitTypeObject
|
|
630
|
-
|
|
631
|
-
▸ **toVisitTypeObject**(`openmrsRestForm`): [`VisitType`](interfaces/VisitType.md)
|
|
632
|
-
|
|
633
|
-
#### Parameters
|
|
634
|
-
|
|
635
|
-
| Name | Type |
|
|
636
|
-
| :------ | :------ |
|
|
637
|
-
| `openmrsRestForm` | `any` |
|
|
638
|
-
|
|
639
|
-
#### Returns
|
|
640
|
-
|
|
641
|
-
[`VisitType`](interfaces/VisitType.md)
|
|
642
|
-
|
|
643
|
-
#### Defined in
|
|
644
|
-
|
|
645
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-type.ts:6](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-type.ts#L6)
|
|
646
|
-
|
|
647
|
-
___
|
|
648
|
-
|
|
649
|
-
### updateVisit
|
|
650
|
-
|
|
651
|
-
▸ **updateVisit**(`uuid`, `payload`, `abortController`): `Observable`<`any`\>
|
|
652
|
-
|
|
653
|
-
#### Parameters
|
|
654
|
-
|
|
655
|
-
| Name | Type |
|
|
656
|
-
| :------ | :------ |
|
|
657
|
-
| `uuid` | `string` |
|
|
658
|
-
| `payload` | [`UpdateVisitPayload`](API.md#updatevisitpayload) |
|
|
659
|
-
| `abortController` | `AbortController` |
|
|
660
|
-
|
|
661
|
-
#### Returns
|
|
662
|
-
|
|
663
|
-
`Observable`<`any`\>
|
|
664
|
-
|
|
665
|
-
#### Defined in
|
|
666
|
-
|
|
667
|
-
[packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:69](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/visit-utils.ts#L69)
|
|
668
|
-
|
|
669
|
-
___
|
|
670
|
-
|
|
671
|
-
### userHasAccess
|
|
672
|
-
|
|
673
|
-
▸ **userHasAccess**(`requiredPrivilege`, `user`): `undefined` \| [`Privilege`](interfaces/Privilege.md)
|
|
674
|
-
|
|
675
|
-
#### Parameters
|
|
676
|
-
|
|
677
|
-
| Name | Type |
|
|
678
|
-
| :------ | :------ |
|
|
679
|
-
| `requiredPrivilege` | `string` |
|
|
680
|
-
| `user` | [`LoggedInUser`](interfaces/LoggedInUser.md) |
|
|
681
|
-
|
|
682
|
-
#### Returns
|
|
683
|
-
|
|
684
|
-
`undefined` \| [`Privilege`](interfaces/Privilege.md)
|
|
685
|
-
|
|
686
|
-
#### Defined in
|
|
687
|
-
|
|
688
|
-
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:130](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L130)
|
|
689
|
-
|
|
690
|
-
___
|
|
691
|
-
|
|
692
|
-
## Workspace Functions
|
|
693
|
-
|
|
694
|
-
### getNewWorkspaceItem
|
|
695
|
-
|
|
696
|
-
▸ **getNewWorkspaceItem**(): `Observable`<[`WorkspaceItem`](interfaces/WorkspaceItem.md)\>
|
|
697
|
-
|
|
698
|
-
#### Returns
|
|
699
|
-
|
|
700
|
-
`Observable`<[`WorkspaceItem`](interfaces/WorkspaceItem.md)\>
|
|
701
|
-
|
|
702
|
-
#### Defined in
|
|
703
|
-
|
|
704
|
-
[packages/framework/esm-api/src/workspace/workspace.resource.tsx:19](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/workspace/workspace.resource.tsx#L19)
|
|
705
|
-
|
|
706
|
-
___
|
|
707
|
-
|
|
708
|
-
### newWorkspaceItem
|
|
709
|
-
|
|
710
|
-
▸ **newWorkspaceItem**(`item`): `void`
|
|
711
|
-
|
|
712
|
-
#### Parameters
|
|
713
|
-
|
|
714
|
-
| Name | Type |
|
|
715
|
-
| :------ | :------ |
|
|
716
|
-
| `item` | [`WorkspaceItem`](interfaces/WorkspaceItem.md) |
|
|
717
|
-
|
|
718
|
-
#### Returns
|
|
719
|
-
|
|
720
|
-
`void`
|
|
721
|
-
|
|
722
|
-
#### Defined in
|
|
723
|
-
|
|
724
|
-
[packages/framework/esm-api/src/workspace/workspace.resource.tsx:10](https://github.com/openmrs/openmrs-esm-core/blob/master/packages/framework/esm-api/src/workspace/workspace.resource.tsx#L10)
|