@openmrs/esm-framework 4.0.1-pre.224 → 4.0.1-pre.232
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 +8 -8
- package/dist/openmrs-esm-framework.js +1 -1
- package/dist/openmrs-esm-framework.js.map +1 -1
- package/docs/API.md +633 -100
- package/docs/classes/OpenmrsFetchError.md +6 -0
- package/docs/enums/Type.md +9 -9
- package/docs/enums/VisitMode.md +3 -3
- package/docs/enums/VisitStatus.md +2 -2
- package/docs/interfaces/AssignedExtension.md +2 -0
- package/docs/interfaces/BreadcrumbSettings.md +18 -0
- package/docs/interfaces/ComponentDefinition.md +13 -0
- package/docs/interfaces/Config.md +17 -3
- package/docs/interfaces/ConfigObject.md +17 -3
- package/docs/interfaces/ConnectedExtension.md +2 -0
- package/docs/interfaces/DynamicOfflineData.md +15 -0
- package/docs/interfaces/DynamicOfflineDataHandler.md +21 -4
- package/docs/interfaces/DynamicOfflineDataSyncState.md +12 -0
- package/docs/interfaces/ExtensionDefinition.md +25 -0
- package/docs/interfaces/ExtensionSlotBaseProps.md +2 -0
- package/docs/interfaces/ExtensionSlotConfigObject.md +6 -0
- package/docs/interfaces/FHIRRequestObj.md +2 -0
- package/docs/interfaces/FHIRRequestOptions.md +2 -0
- package/docs/interfaces/OfflinePatientArgs.md +2 -0
- package/docs/interfaces/OfflinePatientDataSyncHandler.md +2 -0
- package/docs/interfaces/OfflinePatientDataSyncState.md +2 -0
- package/docs/interfaces/OfflinePatientDataSyncStore.md +2 -0
- package/docs/interfaces/OldExtensionSlotBaseProps.md +2 -0
- package/docs/interfaces/PageDefinition.md +17 -0
- package/docs/interfaces/QueueItemDescriptor.md +5 -0
- package/docs/interfaces/RetryOptions.md +15 -4
- package/docs/interfaces/SpaConfig.md +14 -0
- package/docs/interfaces/SyncItem.md +4 -0
- package/docs/interfaces/SyncProcessOptions.md +2 -0
- package/mock.tsx +7 -4
- package/package.json +13 -13
package/docs/API.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
- [useSession](API.md#usesession)
|
|
31
31
|
- [useVisit](API.md#usevisit)
|
|
32
32
|
- [useVisitTypes](API.md#usevisittypes)
|
|
33
|
-
- [userHasAccess](API.md#userhasaccess
|
|
33
|
+
- [userHasAccess](API.md#userhasaccess)
|
|
34
34
|
|
|
35
35
|
### Breadcrumb Functions
|
|
36
36
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
- [isUrl](API.md#isurl)
|
|
55
55
|
- [isUrlWithTemplateParameters](API.md#isurlwithtemplateparameters)
|
|
56
56
|
- [oneOf](API.md#oneof)
|
|
57
|
-
- [validator](API.md#validator
|
|
57
|
+
- [validator](API.md#validator)
|
|
58
58
|
|
|
59
59
|
### Date and Time Functions
|
|
60
60
|
|
|
@@ -284,10 +284,10 @@ ___
|
|
|
284
284
|
|
|
285
285
|
| Name | Type | Description |
|
|
286
286
|
| :------ | :------ | :------ |
|
|
287
|
-
| `day` | `boolean` |
|
|
288
|
-
| `mode` | [`FormatDateMode`](API.md#formatdatemode) |
|
|
289
|
-
| `time` | `boolean` \| ``"for today"`` |
|
|
290
|
-
| `year` | `boolean` |
|
|
287
|
+
| `day` | `boolean` | Whether to include the day number |
|
|
288
|
+
| `mode` | [`FormatDateMode`](API.md#formatdatemode) | - `standard`: "03 Feb 2022" - `wide`: "03 — Feb — 2022" |
|
|
289
|
+
| `time` | `boolean` \| ``"for today"`` | Whether the time should be included in the output always (`true`), never (`false`), or only when the input date is today (`for today`). |
|
|
290
|
+
| `year` | `boolean` | Whether to include the year |
|
|
291
291
|
|
|
292
292
|
#### Defined in
|
|
293
293
|
|
|
@@ -337,6 +337,11 @@ ___
|
|
|
337
337
|
|
|
338
338
|
Ƭ **OmrsOfflineCachingStrategy**: ``"network-only-or-cache-only"`` \| ``"network-first"``
|
|
339
339
|
|
|
340
|
+
* `cache-or-network`: The default strategy, equal to the absence of this header.
|
|
341
|
+
The SW attempts to resolve the request via the network, but falls back to the cache if required.
|
|
342
|
+
The service worker decides the strategy to be used.
|
|
343
|
+
* `network-first`: See https://developers.google.com/web/tools/workbox/modules/workbox-strategies#network_first_network_falling_back_to_cache.
|
|
344
|
+
|
|
340
345
|
#### Defined in
|
|
341
346
|
|
|
342
347
|
[packages/framework/esm-offline/src/service-worker-http-headers.ts:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-offline/src/service-worker-http-headers.ts#L18)
|
|
@@ -357,13 +362,16 @@ ___
|
|
|
357
362
|
|
|
358
363
|
Ƭ **OmrsOfflineHttpHeaders**: `Object`
|
|
359
364
|
|
|
365
|
+
Defines the keys of the custom headers which can be appended to an HTTP request.
|
|
366
|
+
HTTP requests with these headers are handled in a special way by the SPA's service worker.
|
|
367
|
+
|
|
360
368
|
#### Type declaration
|
|
361
369
|
|
|
362
370
|
| Name | Type | Description |
|
|
363
371
|
| :------ | :------ | :------ |
|
|
364
|
-
| `x-omrs-offline-caching-strategy?` | [`OmrsOfflineCachingStrategy`](API.md#omrsofflinecachingstrategy) |
|
|
365
|
-
| `x-omrs-offline-response-body?` | `string` |
|
|
366
|
-
| `x-omrs-offline-response-status?` | \`${number}\` |
|
|
372
|
+
| `x-omrs-offline-caching-strategy?` | [`OmrsOfflineCachingStrategy`](API.md#omrsofflinecachingstrategy) | Instructs the service worker to use a specific caching strategy for this request. |
|
|
373
|
+
| `x-omrs-offline-response-body?` | `string` | If the client is offline and the request cannot be read from the cache (i.e. if there is no way to receive any kind of data for this request), the service worker will return a response with the body in this header. |
|
|
374
|
+
| `x-omrs-offline-response-status?` | \`${number}\` | If the client is offline and the request cannot be read from the cache (i.e. if there is no way to receive any kind of data for this request), the service worker will return a response with the status code defined in this header. |
|
|
367
375
|
|
|
368
376
|
#### Defined in
|
|
369
377
|
|
|
@@ -570,6 +578,16 @@ ___
|
|
|
570
578
|
|
|
571
579
|
• `Const` **fhir**: `Object`
|
|
572
580
|
|
|
581
|
+
The `fhir` object is replicates the API from [fhir.js](https://github.com/FHIR/fhir.js)
|
|
582
|
+
that can be used to call FHIR-compliant OpenMRS APIs. See
|
|
583
|
+
[the docs for fhir.js](https://github.com/FHIR/fhir.js) for more info
|
|
584
|
+
and example usage.
|
|
585
|
+
|
|
586
|
+
This object should be considered deprecated and may be removed from a future version
|
|
587
|
+
of the framework.
|
|
588
|
+
|
|
589
|
+
**`deprecated`**
|
|
590
|
+
|
|
573
591
|
#### Type declaration
|
|
574
592
|
|
|
575
593
|
| Name | Type |
|
|
@@ -691,6 +709,14 @@ ___
|
|
|
691
709
|
|
|
692
710
|
• `Const` **Extension**: `React.FC`<[`ExtensionProps`](API.md#extensionprops)\>
|
|
693
711
|
|
|
712
|
+
Represents the position in the DOM where each extension within
|
|
713
|
+
an extension slot is rendered.
|
|
714
|
+
|
|
715
|
+
Renders once for each extension attached to that extension slot.
|
|
716
|
+
|
|
717
|
+
Usage of this component *must* have an ancestor `<ExtensionSlot>`,
|
|
718
|
+
and *must* only be used once within that `<ExtensionSlot>`.
|
|
719
|
+
|
|
694
720
|
#### Defined in
|
|
695
721
|
|
|
696
722
|
[packages/framework/esm-react-utils/src/Extension.tsx:36](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/Extension.tsx#L36)
|
|
@@ -765,10 +791,41 @@ ___
|
|
|
765
791
|
|
|
766
792
|
▸ **getCurrentUser**(): `Observable`<[`Session`](interfaces/Session.md)\>
|
|
767
793
|
|
|
794
|
+
The getCurrentUser function returns an observable that produces
|
|
795
|
+
**zero or more values, over time**. It will produce zero values
|
|
796
|
+
by default if the user is not logged in. And it will provide a
|
|
797
|
+
first value when the logged in user is fetched from the server.
|
|
798
|
+
Subsequent values will be produced whenever the user object is
|
|
799
|
+
updated.
|
|
800
|
+
|
|
768
801
|
#### Returns
|
|
769
802
|
|
|
770
803
|
`Observable`<[`Session`](interfaces/Session.md)\>
|
|
771
804
|
|
|
805
|
+
An Observable that produces zero or more values (as
|
|
806
|
+
described above). The values produced will be a user object (if
|
|
807
|
+
`includeAuthStatus` is set to `false`) or an object with a session
|
|
808
|
+
and authenticated property (if `includeAuthStatus` is set to `true`).
|
|
809
|
+
|
|
810
|
+
#### Example
|
|
811
|
+
|
|
812
|
+
```js
|
|
813
|
+
import { getCurrentUser } from '@openmrs/esm-api'
|
|
814
|
+
const subscription = getCurrentUser().subscribe(
|
|
815
|
+
user => console.log(user)
|
|
816
|
+
)
|
|
817
|
+
subscription.unsubscribe()
|
|
818
|
+
getCurrentUser({includeAuthStatus: true}).subscribe(
|
|
819
|
+
data => console.log(data.authenticated)
|
|
820
|
+
)
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
#### Be sure to unsubscribe when your component unmounts
|
|
824
|
+
|
|
825
|
+
Otherwise your code will continue getting updates to the user object
|
|
826
|
+
even after the UI component is gone from the screen. This is a memory
|
|
827
|
+
leak and source of bugs.
|
|
828
|
+
|
|
772
829
|
#### Defined in
|
|
773
830
|
|
|
774
831
|
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:71](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L71)
|
|
@@ -905,6 +962,15 @@ ___
|
|
|
905
962
|
|
|
906
963
|
▸ **makeUrl**(`path`): `string`
|
|
907
964
|
|
|
965
|
+
Append `path` to the OpenMRS SPA base.
|
|
966
|
+
|
|
967
|
+
#### Example
|
|
968
|
+
|
|
969
|
+
```ts
|
|
970
|
+
makeUrl('/foo/bar');
|
|
971
|
+
// => '/openmrs/foo/bar'
|
|
972
|
+
```
|
|
973
|
+
|
|
908
974
|
#### Parameters
|
|
909
975
|
|
|
910
976
|
| Name | Type |
|
|
@@ -925,6 +991,11 @@ ___
|
|
|
925
991
|
|
|
926
992
|
▸ **openmrsFetch**<`T`\>(`path`, `fetchInit?`): `Promise`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
927
993
|
|
|
994
|
+
The openmrsFetch function is a wrapper around the
|
|
995
|
+
[browser's built-in fetch function](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch),
|
|
996
|
+
with extra handling for OpenMRS-specific API behaviors, such as
|
|
997
|
+
request headers, authentication, authorization, and the API urls.
|
|
998
|
+
|
|
928
999
|
#### Type parameters
|
|
929
1000
|
|
|
930
1001
|
| Name | Type |
|
|
@@ -935,13 +1006,48 @@ ___
|
|
|
935
1006
|
|
|
936
1007
|
| Name | Type | Description |
|
|
937
1008
|
| :------ | :------ | :------ |
|
|
938
|
-
| `path` | `string` |
|
|
939
|
-
| `fetchInit` | `FetchConfig` |
|
|
1009
|
+
| `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. |
|
|
1010
|
+
| `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. |
|
|
940
1011
|
|
|
941
1012
|
#### Returns
|
|
942
1013
|
|
|
943
1014
|
`Promise`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
944
1015
|
|
|
1016
|
+
A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
|
1017
|
+
that resolves with a [Response object](https://developer.mozilla.org/en-US/docs/Web/API/Response).
|
|
1018
|
+
Note that the openmrs version of the Response object has already
|
|
1019
|
+
downloaded the HTTP response body as json, and has an additional
|
|
1020
|
+
`data` property with the HTTP response json as a javascript object.
|
|
1021
|
+
|
|
1022
|
+
#### Example
|
|
1023
|
+
```js
|
|
1024
|
+
import { openmrsFetch } from '@openmrs/esm-api'
|
|
1025
|
+
const abortController = new AbortController();
|
|
1026
|
+
openmrsFetch('/ws/rest/v1/session', {signal: abortController.signal})
|
|
1027
|
+
.then(response => {
|
|
1028
|
+
console.log(response.data.authenticated)
|
|
1029
|
+
})
|
|
1030
|
+
.catch(err => {
|
|
1031
|
+
console.error(err.status);
|
|
1032
|
+
})
|
|
1033
|
+
abortController.abort();
|
|
1034
|
+
openmrsFetch('/ws/rest/v1/session', {
|
|
1035
|
+
method: 'POST',
|
|
1036
|
+
body: {
|
|
1037
|
+
username: 'hi',
|
|
1038
|
+
password: 'there',
|
|
1039
|
+
}
|
|
1040
|
+
})
|
|
1041
|
+
```
|
|
1042
|
+
|
|
1043
|
+
#### Cancellation
|
|
1044
|
+
|
|
1045
|
+
To cancel a network request, use an
|
|
1046
|
+
[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort).
|
|
1047
|
+
It is best practice to cancel your network requests when the user
|
|
1048
|
+
navigates away from a page while the request is pending request, to
|
|
1049
|
+
free up memory and network resources and to prevent race conditions.
|
|
1050
|
+
|
|
945
1051
|
#### Defined in
|
|
946
1052
|
|
|
947
1053
|
[packages/framework/esm-api/src/openmrs-fetch.ts:72](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L72)
|
|
@@ -952,6 +1058,11 @@ ___
|
|
|
952
1058
|
|
|
953
1059
|
▸ **openmrsObservableFetch**<`T`\>(`url`, `fetchInit?`): `Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
954
1060
|
|
|
1061
|
+
The openmrsObservableFetch function is a wrapper around openmrsFetch
|
|
1062
|
+
that returns an [Observable](https://rxjs-dev.firebaseapp.com/guide/observable)
|
|
1063
|
+
instead of a promise. It exists in case using an Observable is
|
|
1064
|
+
preferred or more convenient than a promise.
|
|
1065
|
+
|
|
955
1066
|
#### Type parameters
|
|
956
1067
|
|
|
957
1068
|
| Name |
|
|
@@ -962,13 +1073,32 @@ ___
|
|
|
962
1073
|
|
|
963
1074
|
| Name | Type | Description |
|
|
964
1075
|
| :------ | :------ | :------ |
|
|
965
|
-
| `url` | `string` |
|
|
966
|
-
| `fetchInit` | `FetchConfig` |
|
|
1076
|
+
| `url` | `string` | See [openmrsFetch](API.md#openmrsfetch) |
|
|
1077
|
+
| `fetchInit` | `FetchConfig` | See [openmrsFetch](API.md#openmrsfetch) |
|
|
967
1078
|
|
|
968
1079
|
#### Returns
|
|
969
1080
|
|
|
970
1081
|
`Observable`<[`FetchResponse`](interfaces/FetchResponse.md)<`T`\>\>
|
|
971
1082
|
|
|
1083
|
+
An Observable that produces exactly one Response object.
|
|
1084
|
+
The response object is exactly the same as for [openmrsFetch](API.md#openmrsfetch).
|
|
1085
|
+
|
|
1086
|
+
#### Example
|
|
1087
|
+
|
|
1088
|
+
```js
|
|
1089
|
+
import { openmrsObservableFetch } from '@openmrs/esm-api'
|
|
1090
|
+
const subscription = openmrsObservableFetch('/ws/rest/v1/session').subscribe(
|
|
1091
|
+
response => console.log(response.data),
|
|
1092
|
+
err => {throw err},
|
|
1093
|
+
() => console.log('finished')
|
|
1094
|
+
)
|
|
1095
|
+
subscription.unsubscribe()
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
#### Cancellation
|
|
1099
|
+
|
|
1100
|
+
To cancel the network request, simply call `subscription.unsubscribe();`
|
|
1101
|
+
|
|
972
1102
|
#### Defined in
|
|
973
1103
|
|
|
974
1104
|
[packages/framework/esm-api/src/openmrs-fetch.ts:243](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L243)
|
|
@@ -979,10 +1109,22 @@ ___
|
|
|
979
1109
|
|
|
980
1110
|
▸ **refetchCurrentUser**(): `Promise`<`unknown`\>
|
|
981
1111
|
|
|
1112
|
+
The `refetchCurrentUser` function causes a network request to redownload
|
|
1113
|
+
the user. All subscribers to the current user will be notified of the
|
|
1114
|
+
new users once the new version of the user object is downloaded.
|
|
1115
|
+
|
|
982
1116
|
#### Returns
|
|
983
1117
|
|
|
984
1118
|
`Promise`<`unknown`\>
|
|
985
1119
|
|
|
1120
|
+
The same observable as returned by [getCurrentUser](API.md#getcurrentuser).
|
|
1121
|
+
|
|
1122
|
+
#### Example
|
|
1123
|
+
```js
|
|
1124
|
+
import { refetchCurrentUser } from '@openmrs/esm-api'
|
|
1125
|
+
refetchCurrentUser()
|
|
1126
|
+
```
|
|
1127
|
+
|
|
986
1128
|
#### Defined in
|
|
987
1129
|
|
|
988
1130
|
[packages/framework/esm-api/src/shared-api-objects/current-user.ts:163](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/shared-api-objects/current-user.ts#L163)
|
|
@@ -1097,6 +1239,11 @@ ___
|
|
|
1097
1239
|
|
|
1098
1240
|
▸ **useCurrentPatient**(`patientUuid?`): [`boolean`, `NullablePatient`, [`PatientUuid`](API.md#patientuuid), `Error` \| ``null``]
|
|
1099
1241
|
|
|
1242
|
+
This React hook returns the current patient, as specified by the current route. It returns
|
|
1243
|
+
all the information needed to render a loading state, error state, and normal/success state.
|
|
1244
|
+
|
|
1245
|
+
**`deprecated`** Use [usePatient](API.md#usepatient) instead.
|
|
1246
|
+
|
|
1100
1247
|
#### Parameters
|
|
1101
1248
|
|
|
1102
1249
|
| Name | Type |
|
|
@@ -1131,6 +1278,11 @@ ___
|
|
|
1131
1278
|
|
|
1132
1279
|
▸ **usePatient**(`patientUuid?`): `Object`
|
|
1133
1280
|
|
|
1281
|
+
This React hook returns a patient object. If the `patientUuid` is provided
|
|
1282
|
+
as a parameter, then the patient for that UUID is returned. If the parameter
|
|
1283
|
+
is not provided, the patient UUID is obtained from the current route, and
|
|
1284
|
+
a route listener is set up to update the patient whenever the route changes.
|
|
1285
|
+
|
|
1134
1286
|
#### Parameters
|
|
1135
1287
|
|
|
1136
1288
|
| Name | Type |
|
|
@@ -1158,10 +1310,18 @@ ___
|
|
|
1158
1310
|
|
|
1159
1311
|
▸ **useSession**(): [`Session`](interfaces/Session.md)
|
|
1160
1312
|
|
|
1313
|
+
Gets the current user session information. Returns an object with
|
|
1314
|
+
property `authenticated` == `false` if the user is not logged in.
|
|
1315
|
+
|
|
1316
|
+
Uses Suspense. This hook will always either return a Session object
|
|
1317
|
+
or throw for Suspense. It will never return `null`/`undefined`.
|
|
1318
|
+
|
|
1161
1319
|
#### Returns
|
|
1162
1320
|
|
|
1163
1321
|
[`Session`](interfaces/Session.md)
|
|
1164
1322
|
|
|
1323
|
+
Current user session information
|
|
1324
|
+
|
|
1165
1325
|
#### Defined in
|
|
1166
1326
|
|
|
1167
1327
|
[packages/framework/esm-react-utils/src/useSession.tsx:17](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useSession.tsx#L17)
|
|
@@ -1172,16 +1332,22 @@ ___
|
|
|
1172
1332
|
|
|
1173
1333
|
▸ **useVisit**(`patientUuid`): `VisitReturnType`
|
|
1174
1334
|
|
|
1335
|
+
This React hook returns a visit object. If the `patientUuid` is provided
|
|
1336
|
+
as a parameter, then the currentVisit, error and mutate function
|
|
1337
|
+
for that patient visit is returned.
|
|
1338
|
+
|
|
1175
1339
|
#### Parameters
|
|
1176
1340
|
|
|
1177
1341
|
| Name | Type | Description |
|
|
1178
1342
|
| :------ | :------ | :------ |
|
|
1179
|
-
| `patientUuid` | `string` |
|
|
1343
|
+
| `patientUuid` | `string` | Unique patient identifier `string` |
|
|
1180
1344
|
|
|
1181
1345
|
#### Returns
|
|
1182
1346
|
|
|
1183
1347
|
`VisitReturnType`
|
|
1184
1348
|
|
|
1349
|
+
Object {`error` `isValidating`, `currentVisit`, `mutate`}
|
|
1350
|
+
|
|
1185
1351
|
#### Defined in
|
|
1186
1352
|
|
|
1187
1353
|
[packages/framework/esm-react-utils/src/useVisit.ts:29](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useVisit.ts#L29)
|
|
@@ -1328,12 +1494,19 @@ ___
|
|
|
1328
1494
|
|
|
1329
1495
|
▸ **defineConfigSchema**(`moduleName`, `schema`): `void`
|
|
1330
1496
|
|
|
1497
|
+
This defines a configuration schema for a module. The schema tells the
|
|
1498
|
+
configuration system how the module can be configured. It specifies
|
|
1499
|
+
what makes configuration valid or invalid.
|
|
1500
|
+
|
|
1501
|
+
See [Configuration System](http://o3-dev.docs.openmrs.org/#/main/config)
|
|
1502
|
+
for more information about defining a config schema.
|
|
1503
|
+
|
|
1331
1504
|
#### Parameters
|
|
1332
1505
|
|
|
1333
1506
|
| Name | Type | Description |
|
|
1334
1507
|
| :------ | :------ | :------ |
|
|
1335
|
-
| `moduleName` | `string` |
|
|
1336
|
-
| `schema` | [`ConfigSchema`](interfaces/ConfigSchema.md) |
|
|
1508
|
+
| `moduleName` | `string` | Name of the module the schema is being defined for. Generally should be the one in which the `defineConfigSchema` call takes place. |
|
|
1509
|
+
| `schema` | [`ConfigSchema`](interfaces/ConfigSchema.md) | The config schema for the module |
|
|
1337
1510
|
|
|
1338
1511
|
#### Returns
|
|
1339
1512
|
|
|
@@ -1349,12 +1522,23 @@ ___
|
|
|
1349
1522
|
|
|
1350
1523
|
▸ **defineExtensionConfigSchema**(`extensionName`, `schema`): `void`
|
|
1351
1524
|
|
|
1525
|
+
This defines a configuration schema for an extension. When a schema is defined
|
|
1526
|
+
for an extension, that extension will receive the configuration corresponding
|
|
1527
|
+
to that schema, rather than the configuration corresponding to the module
|
|
1528
|
+
in which it is defined.
|
|
1529
|
+
|
|
1530
|
+
The schema tells the configuration system how the module can be configured.
|
|
1531
|
+
It specifies what makes configuration valid or invalid.
|
|
1532
|
+
|
|
1533
|
+
See [Configuration System](http://o3-dev.docs.openmrs.org/#/main/config)
|
|
1534
|
+
for more information about defining a config schema.
|
|
1535
|
+
|
|
1352
1536
|
#### Parameters
|
|
1353
1537
|
|
|
1354
1538
|
| Name | Type | Description |
|
|
1355
1539
|
| :------ | :------ | :------ |
|
|
1356
|
-
| `extensionName` | `string` |
|
|
1357
|
-
| `schema` | [`ConfigSchema`](interfaces/ConfigSchema.md) |
|
|
1540
|
+
| `extensionName` | `string` | Name of the extension the schema is being defined for. Should match the `name` of one of the `extensions` entries being returned by `setupOpenMRS`. |
|
|
1541
|
+
| `schema` | [`ConfigSchema`](interfaces/ConfigSchema.md) | The config schema for the extension |
|
|
1358
1542
|
|
|
1359
1543
|
#### Returns
|
|
1360
1544
|
|
|
@@ -1370,11 +1554,21 @@ ___
|
|
|
1370
1554
|
|
|
1371
1555
|
▸ **getConfig**(`moduleName`): `Promise`<[`Config`](interfaces/Config.md)\>
|
|
1372
1556
|
|
|
1557
|
+
A promise-based way to access the config as soon as it is fully loaded.
|
|
1558
|
+
If it is already loaded, resolves the config in its present state.
|
|
1559
|
+
|
|
1560
|
+
In general you should use the Unistore-based API provided by
|
|
1561
|
+
`getConfigStore`, which allows creating a subscription so that you always
|
|
1562
|
+
have the latest config. If using React, just use `useConfig`.
|
|
1563
|
+
|
|
1564
|
+
This is a useful function if you need to get the config in the course
|
|
1565
|
+
of the execution of a function.
|
|
1566
|
+
|
|
1373
1567
|
#### Parameters
|
|
1374
1568
|
|
|
1375
1569
|
| Name | Type | Description |
|
|
1376
1570
|
| :------ | :------ | :------ |
|
|
1377
|
-
| `moduleName` | `string` |
|
|
1571
|
+
| `moduleName` | `string` | The name of the module for which to look up the config |
|
|
1378
1572
|
|
|
1379
1573
|
#### Returns
|
|
1380
1574
|
|
|
@@ -1411,6 +1605,8 @@ ___
|
|
|
1411
1605
|
|
|
1412
1606
|
▸ **useConfig**(): `Object`
|
|
1413
1607
|
|
|
1608
|
+
Use this React Hook to obtain your module's configuration.
|
|
1609
|
+
|
|
1414
1610
|
#### Returns
|
|
1415
1611
|
|
|
1416
1612
|
`Object`
|
|
@@ -1418,13 +1614,13 @@ ___
|
|
|
1418
1614
|
| Name | Type | Description |
|
|
1419
1615
|
| :------ | :------ | :------ |
|
|
1420
1616
|
| `Display conditions?` | [`DisplayConditionsConfigObject`](interfaces/DisplayConditionsConfigObject.md) | - |
|
|
1421
|
-
| `constructor` | `Function` |
|
|
1422
|
-
| `hasOwnProperty` | (`v`: `PropertyKey`) => `boolean` |
|
|
1423
|
-
| `isPrototypeOf` | (`v`: `Object`) => `boolean` |
|
|
1424
|
-
| `propertyIsEnumerable` | (`v`: `PropertyKey`) => `boolean` |
|
|
1425
|
-
| `toLocaleString` | () => `string` |
|
|
1426
|
-
| `toString` | () => `string` |
|
|
1427
|
-
| `valueOf` | () => `Object` |
|
|
1617
|
+
| `constructor` | `Function` | The initial value of Object.prototype.constructor is the standard built-in Object constructor. |
|
|
1618
|
+
| `hasOwnProperty` | (`v`: `PropertyKey`) => `boolean` | Determines whether an object has a property with the specified name. |
|
|
1619
|
+
| `isPrototypeOf` | (`v`: `Object`) => `boolean` | Determines whether an object exists in another object's prototype chain. |
|
|
1620
|
+
| `propertyIsEnumerable` | (`v`: `PropertyKey`) => `boolean` | Determines whether a specified property is enumerable. |
|
|
1621
|
+
| `toLocaleString` | () => `string` | Returns a date converted to a string using the current locale. |
|
|
1622
|
+
| `toString` | () => `string` | Returns a string representation of an object. |
|
|
1623
|
+
| `valueOf` | () => `Object` | Returns the primitive value of the specified object. |
|
|
1428
1624
|
|
|
1429
1625
|
#### Defined in
|
|
1430
1626
|
|
|
@@ -1438,12 +1634,14 @@ ___
|
|
|
1438
1634
|
|
|
1439
1635
|
▸ **inRange**(`min`, `max`): [`Validator`](API.md#validator)
|
|
1440
1636
|
|
|
1637
|
+
Verifies that the value is between the provided minimum and maximum
|
|
1638
|
+
|
|
1441
1639
|
#### Parameters
|
|
1442
1640
|
|
|
1443
1641
|
| Name | Type | Description |
|
|
1444
1642
|
| :------ | :------ | :------ |
|
|
1445
|
-
| `min` | `number` |
|
|
1446
|
-
| `max` | `number` |
|
|
1643
|
+
| `min` | `number` | Minimum acceptable value |
|
|
1644
|
+
| `max` | `number` | Maximum acceptable value |
|
|
1447
1645
|
|
|
1448
1646
|
#### Returns
|
|
1449
1647
|
|
|
@@ -1459,6 +1657,10 @@ ___
|
|
|
1459
1657
|
|
|
1460
1658
|
▸ **isUrl**(`value`): `string` \| `void`
|
|
1461
1659
|
|
|
1660
|
+
Verifies that a string contains only the default URL template parameters.
|
|
1661
|
+
|
|
1662
|
+
**`category`** Navigation
|
|
1663
|
+
|
|
1462
1664
|
#### Parameters
|
|
1463
1665
|
|
|
1464
1666
|
| Name | Type |
|
|
@@ -1479,11 +1681,16 @@ ___
|
|
|
1479
1681
|
|
|
1480
1682
|
▸ **isUrlWithTemplateParameters**(`allowedTemplateParameters`): [`Validator`](API.md#validator)
|
|
1481
1683
|
|
|
1684
|
+
Verifies that a string contains only the default URL template
|
|
1685
|
+
parameters, plus any specified in `allowedTemplateParameters`.
|
|
1686
|
+
|
|
1687
|
+
**`category`** Navigation
|
|
1688
|
+
|
|
1482
1689
|
#### Parameters
|
|
1483
1690
|
|
|
1484
1691
|
| Name | Type | Description |
|
|
1485
1692
|
| :------ | :------ | :------ |
|
|
1486
|
-
| `allowedTemplateParameters` | `string`[] |
|
|
1693
|
+
| `allowedTemplateParameters` | `string`[] | To be added to `openmrsBase` and `openmrsSpaBase` |
|
|
1487
1694
|
|
|
1488
1695
|
#### Returns
|
|
1489
1696
|
|
|
@@ -1499,11 +1706,13 @@ ___
|
|
|
1499
1706
|
|
|
1500
1707
|
▸ **oneOf**(`allowedValues`): [`Validator`](API.md#validator)
|
|
1501
1708
|
|
|
1709
|
+
Verifies that the value is one of the allowed options.
|
|
1710
|
+
|
|
1502
1711
|
#### Parameters
|
|
1503
1712
|
|
|
1504
1713
|
| Name | Type | Description |
|
|
1505
1714
|
| :------ | :------ | :------ |
|
|
1506
|
-
| `allowedValues` | `any`[] |
|
|
1715
|
+
| `allowedValues` | `any`[] | The list of allowable values |
|
|
1507
1716
|
|
|
1508
1717
|
#### Returns
|
|
1509
1718
|
|
|
@@ -1519,17 +1728,34 @@ ___
|
|
|
1519
1728
|
|
|
1520
1729
|
▸ **validator**(`validationFunction`, `message`): [`Validator`](API.md#validator)
|
|
1521
1730
|
|
|
1731
|
+
Constructs a custom validator.
|
|
1732
|
+
|
|
1733
|
+
### Example
|
|
1734
|
+
|
|
1735
|
+
```typescript
|
|
1736
|
+
{
|
|
1737
|
+
foo: {
|
|
1738
|
+
_default: 0,
|
|
1739
|
+
_validators: [
|
|
1740
|
+
validator(val => val >= 0, "Must not be negative.")
|
|
1741
|
+
]
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
```
|
|
1745
|
+
|
|
1522
1746
|
#### Parameters
|
|
1523
1747
|
|
|
1524
1748
|
| Name | Type | Description |
|
|
1525
1749
|
| :------ | :------ | :------ |
|
|
1526
|
-
| `validationFunction` | [`ValidatorFunction`](API.md#validatorfunction) |
|
|
1527
|
-
| `message` | `string` \| (`value`: `any`) => `string` |
|
|
1750
|
+
| `validationFunction` | [`ValidatorFunction`](API.md#validatorfunction) | Takes the configured value as input. Returns true if it is valid, false otherwise. |
|
|
1751
|
+
| `message` | `string` \| (`value`: `any`) => `string` | A string message that explains why the value is invalid. Can also be a function that takes the value as input and returns a string. |
|
|
1528
1752
|
|
|
1529
1753
|
#### Returns
|
|
1530
1754
|
|
|
1531
1755
|
[`Validator`](API.md#validator)
|
|
1532
1756
|
|
|
1757
|
+
A validator ready for use in a config schema
|
|
1758
|
+
|
|
1533
1759
|
#### Defined in
|
|
1534
1760
|
|
|
1535
1761
|
[packages/framework/esm-config/src/validators/validator.ts:25](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-config/src/validators/validator.ts#L25)
|
|
@@ -1542,6 +1768,23 @@ ___
|
|
|
1542
1768
|
|
|
1543
1769
|
▸ **formatDate**(`date`, `options?`): `string`
|
|
1544
1770
|
|
|
1771
|
+
Formats the input date according to the current locale and the
|
|
1772
|
+
given options.
|
|
1773
|
+
|
|
1774
|
+
Default options:
|
|
1775
|
+
- mode: "standard",
|
|
1776
|
+
- time: "for today",
|
|
1777
|
+
- day: true,
|
|
1778
|
+
- year: true
|
|
1779
|
+
|
|
1780
|
+
If the date is today then "Today" is produced (in the locale language).
|
|
1781
|
+
|
|
1782
|
+
When time is included, it is appended with a comma and a space. This
|
|
1783
|
+
agrees with the output of `Date.prototype.toLocaleString` for *most*
|
|
1784
|
+
locales.
|
|
1785
|
+
|
|
1786
|
+
TODO: Shouldn't throw on null input
|
|
1787
|
+
|
|
1545
1788
|
#### Parameters
|
|
1546
1789
|
|
|
1547
1790
|
| Name | Type |
|
|
@@ -1563,6 +1806,14 @@ ___
|
|
|
1563
1806
|
|
|
1564
1807
|
▸ **formatDatetime**(`date`, `options?`): `string`
|
|
1565
1808
|
|
|
1809
|
+
Formats the input into a string showing the date and time, according
|
|
1810
|
+
to the current locale. The `mode` parameter is as described for
|
|
1811
|
+
`formatDate`.
|
|
1812
|
+
|
|
1813
|
+
This is created by concatenating the results of `formatDate`
|
|
1814
|
+
and `formatTime` with a comma and space. This agrees with the
|
|
1815
|
+
output of `Date.prototype.toLocaleString` for *most* locales.
|
|
1816
|
+
|
|
1566
1817
|
#### Parameters
|
|
1567
1818
|
|
|
1568
1819
|
| Name | Type |
|
|
@@ -1584,6 +1835,9 @@ ___
|
|
|
1584
1835
|
|
|
1585
1836
|
▸ **formatTime**(`date`): `string`
|
|
1586
1837
|
|
|
1838
|
+
Formats the input as a time, according to the current locale.
|
|
1839
|
+
12-hour or 24-hour clock depends on locale.
|
|
1840
|
+
|
|
1587
1841
|
#### Parameters
|
|
1588
1842
|
|
|
1589
1843
|
| Name | Type |
|
|
@@ -1604,6 +1858,9 @@ ___
|
|
|
1604
1858
|
|
|
1605
1859
|
▸ **isOmrsDateStrict**(`omrsPayloadString`): `boolean`
|
|
1606
1860
|
|
|
1861
|
+
This function is STRICT on checking whether a date string is the openmrs format.
|
|
1862
|
+
The format should be YYYY-MM-DDTHH:mm:ss.SSSZZ
|
|
1863
|
+
|
|
1607
1864
|
#### Parameters
|
|
1608
1865
|
|
|
1609
1866
|
| Name | Type |
|
|
@@ -1628,7 +1885,7 @@ ___
|
|
|
1628
1885
|
|
|
1629
1886
|
| Name | Type | Description |
|
|
1630
1887
|
| :------ | :------ | :------ |
|
|
1631
|
-
| `date` | [`DateInput`](API.md#dateinput) |
|
|
1888
|
+
| `date` | [`DateInput`](API.md#dateinput) | Checks if the provided date is today. |
|
|
1632
1889
|
|
|
1633
1890
|
#### Returns
|
|
1634
1891
|
|
|
@@ -1644,6 +1901,9 @@ ___
|
|
|
1644
1901
|
|
|
1645
1902
|
▸ **parseDate**(`dateString`): `Date`
|
|
1646
1903
|
|
|
1904
|
+
Utility function to parse an arbitrary string into a date.
|
|
1905
|
+
Uses `dayjs(dateString)`.
|
|
1906
|
+
|
|
1647
1907
|
#### Parameters
|
|
1648
1908
|
|
|
1649
1909
|
| Name | Type |
|
|
@@ -1664,6 +1924,8 @@ ___
|
|
|
1664
1924
|
|
|
1665
1925
|
▸ **toDateObjectStrict**(`omrsDateString`): `Date` \| ``null``
|
|
1666
1926
|
|
|
1927
|
+
Converts the object to a date object if it is a valid ISO date time string.
|
|
1928
|
+
|
|
1667
1929
|
#### Parameters
|
|
1668
1930
|
|
|
1669
1931
|
| Name | Type |
|
|
@@ -1684,6 +1946,9 @@ ___
|
|
|
1684
1946
|
|
|
1685
1947
|
▸ **toOmrsDateFormat**(`date`, `format?`): `string`
|
|
1686
1948
|
|
|
1949
|
+
**`deprecated`** use `formatDate(date)`
|
|
1950
|
+
Formats the input as a date string. By default the format "YYYY-MMM-DD" is used.
|
|
1951
|
+
|
|
1687
1952
|
#### Parameters
|
|
1688
1953
|
|
|
1689
1954
|
| Name | Type | Default value |
|
|
@@ -1705,6 +1970,9 @@ ___
|
|
|
1705
1970
|
|
|
1706
1971
|
▸ **toOmrsDayDateFormat**(`date`): `string`
|
|
1707
1972
|
|
|
1973
|
+
**`deprecated`** use `formatDate(date, "wide")`
|
|
1974
|
+
Formats the input as a date string using the format "DD - MMM - YYYY".
|
|
1975
|
+
|
|
1708
1976
|
#### Parameters
|
|
1709
1977
|
|
|
1710
1978
|
| Name | Type |
|
|
@@ -1725,6 +1993,8 @@ ___
|
|
|
1725
1993
|
|
|
1726
1994
|
▸ **toOmrsIsoString**(`date`, `toUTC?`): `string`
|
|
1727
1995
|
|
|
1996
|
+
Formats the input as a date time string using the format "YYYY-MM-DDTHH:mm:ss.SSSZZ".
|
|
1997
|
+
|
|
1728
1998
|
#### Parameters
|
|
1729
1999
|
|
|
1730
2000
|
| Name | Type | Default value |
|
|
@@ -1746,6 +2016,9 @@ ___
|
|
|
1746
2016
|
|
|
1747
2017
|
▸ **toOmrsTimeString**(`date`): `string`
|
|
1748
2018
|
|
|
2019
|
+
**`deprecated`** use `formatTime`
|
|
2020
|
+
Formats the input as a time string using the format "HH:mm A".
|
|
2021
|
+
|
|
1749
2022
|
#### Parameters
|
|
1750
2023
|
|
|
1751
2024
|
| Name | Type |
|
|
@@ -1766,6 +2039,9 @@ ___
|
|
|
1766
2039
|
|
|
1767
2040
|
▸ **toOmrsTimeString24**(`date`): `string`
|
|
1768
2041
|
|
|
2042
|
+
**`deprecated`** use `formatTime`
|
|
2043
|
+
Formats the input as a time string using the format "HH:mm".
|
|
2044
|
+
|
|
1769
2045
|
#### Parameters
|
|
1770
2046
|
|
|
1771
2047
|
| Name | Type |
|
|
@@ -1786,6 +2062,9 @@ ___
|
|
|
1786
2062
|
|
|
1787
2063
|
▸ **toOmrsYearlessDateFormat**(`date`): `string`
|
|
1788
2064
|
|
|
2065
|
+
**`deprecated`** use `formatDate(date, "no year")`
|
|
2066
|
+
Formats the input as a date string using the format "DD-MMM".
|
|
2067
|
+
|
|
1789
2068
|
#### Parameters
|
|
1790
2069
|
|
|
1791
2070
|
| Name | Type |
|
|
@@ -1856,12 +2135,25 @@ ___
|
|
|
1856
2135
|
|
|
1857
2136
|
▸ **attach**(`slotName`, `extensionId`): `void`
|
|
1858
2137
|
|
|
2138
|
+
Attach an extension to an extension slot.
|
|
2139
|
+
|
|
2140
|
+
This will cause the extension to be rendered into the specified
|
|
2141
|
+
extension slot, unless it is removed by configuration. Using
|
|
2142
|
+
`attach` is an alternative to specifying the `slot` or `slots`
|
|
2143
|
+
in the extension declaration.
|
|
2144
|
+
|
|
2145
|
+
It is particularly useful when creating a slot into which
|
|
2146
|
+
you want to render an existing extension. This enables you
|
|
2147
|
+
to do so without modifying the extension's declaration, which
|
|
2148
|
+
may be impractical or inappropriate, for example if you are
|
|
2149
|
+
writing a module for a specific implementation.
|
|
2150
|
+
|
|
1859
2151
|
#### Parameters
|
|
1860
2152
|
|
|
1861
2153
|
| Name | Type | Description |
|
|
1862
2154
|
| :------ | :------ | :------ |
|
|
1863
|
-
| `slotName` | `string` |
|
|
1864
|
-
| `extensionId` | `string` |
|
|
2155
|
+
| `slotName` | `string` | a name uniquely identifying the slot |
|
|
2156
|
+
| `extensionId` | `string` | an extension name, with an optional #-suffix to distinguish it from other instances of the same extension attached to the same slot. |
|
|
1865
2157
|
|
|
1866
2158
|
#### Returns
|
|
1867
2159
|
|
|
@@ -1877,6 +2169,8 @@ ___
|
|
|
1877
2169
|
|
|
1878
2170
|
▸ **detach**(`extensionSlotName`, `extensionId`): `void`
|
|
1879
2171
|
|
|
2172
|
+
Avoid using this. Extension attachments should be considered declarative.
|
|
2173
|
+
|
|
1880
2174
|
#### Parameters
|
|
1881
2175
|
|
|
1882
2176
|
| Name | Type |
|
|
@@ -1898,6 +2192,8 @@ ___
|
|
|
1898
2192
|
|
|
1899
2193
|
▸ **detachAll**(`extensionSlotName`): `void`
|
|
1900
2194
|
|
|
2195
|
+
Avoid using this. Extension attachments should be considered declarative.
|
|
2196
|
+
|
|
1901
2197
|
#### Parameters
|
|
1902
2198
|
|
|
1903
2199
|
| Name | Type |
|
|
@@ -1918,16 +2214,20 @@ ___
|
|
|
1918
2214
|
|
|
1919
2215
|
▸ **getAssignedExtensions**(`slotName`): [`AssignedExtension`](interfaces/AssignedExtension.md)[]
|
|
1920
2216
|
|
|
2217
|
+
Gets the list of extensions assigned to a given slot
|
|
2218
|
+
|
|
1921
2219
|
#### Parameters
|
|
1922
2220
|
|
|
1923
2221
|
| Name | Type | Description |
|
|
1924
2222
|
| :------ | :------ | :------ |
|
|
1925
|
-
| `slotName` | `string` |
|
|
2223
|
+
| `slotName` | `string` | The slot to load the assigned extensions for |
|
|
1926
2224
|
|
|
1927
2225
|
#### Returns
|
|
1928
2226
|
|
|
1929
2227
|
[`AssignedExtension`](interfaces/AssignedExtension.md)[]
|
|
1930
2228
|
|
|
2229
|
+
An array of extensions assigned to the named slot
|
|
2230
|
+
|
|
1931
2231
|
#### Defined in
|
|
1932
2232
|
|
|
1933
2233
|
[packages/framework/esm-extensions/src/extensions.ts:359](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L359)
|
|
@@ -1938,17 +2238,22 @@ ___
|
|
|
1938
2238
|
|
|
1939
2239
|
▸ **getConnectedExtensions**(`assignedExtensions`, `online?`): [`ConnectedExtension`](interfaces/ConnectedExtension.md)[]
|
|
1940
2240
|
|
|
2241
|
+
Filters a list of extensions according to whether they support the
|
|
2242
|
+
current connectivity status.
|
|
2243
|
+
|
|
1941
2244
|
#### Parameters
|
|
1942
2245
|
|
|
1943
2246
|
| Name | Type | Default value | Description |
|
|
1944
2247
|
| :------ | :------ | :------ | :------ |
|
|
1945
|
-
| `assignedExtensions` | [`AssignedExtension`](interfaces/AssignedExtension.md)[] | `undefined` |
|
|
1946
|
-
| `online` | ``null`` \| `boolean` | `null` |
|
|
2248
|
+
| `assignedExtensions` | [`AssignedExtension`](interfaces/AssignedExtension.md)[] | `undefined` | The list of extensions to filter. |
|
|
2249
|
+
| `online` | ``null`` \| `boolean` | `null` | Whether the app is currently online. If `null`, uses `navigator.onLine`. |
|
|
1947
2250
|
|
|
1948
2251
|
#### Returns
|
|
1949
2252
|
|
|
1950
2253
|
[`ConnectedExtension`](interfaces/ConnectedExtension.md)[]
|
|
1951
2254
|
|
|
2255
|
+
A list of extensions that should be rendered
|
|
2256
|
+
|
|
1952
2257
|
#### Defined in
|
|
1953
2258
|
|
|
1954
2259
|
[packages/framework/esm-extensions/src/extensions.ts:287](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L287)
|
|
@@ -1959,6 +2264,18 @@ ___
|
|
|
1959
2264
|
|
|
1960
2265
|
▸ **getExtensionNameFromId**(`extensionId`): `string`
|
|
1961
2266
|
|
|
2267
|
+
Given an extension ID, which is a string uniquely identifying
|
|
2268
|
+
an instance of an extension within an extension slot, this
|
|
2269
|
+
returns the extension name.
|
|
2270
|
+
|
|
2271
|
+
**`example`**
|
|
2272
|
+
```js
|
|
2273
|
+
getExtensionNameFromId("foo#bar")
|
|
2274
|
+
--> "foo"
|
|
2275
|
+
getExtensionNameFromId("baz")
|
|
2276
|
+
--> "baz"
|
|
2277
|
+
```
|
|
2278
|
+
|
|
1962
2279
|
#### Parameters
|
|
1963
2280
|
|
|
1964
2281
|
| Name | Type |
|
|
@@ -1979,6 +2296,10 @@ ___
|
|
|
1979
2296
|
|
|
1980
2297
|
▸ **getExtensionStore**(): `Store`<[`ExtensionStore`](interfaces/ExtensionStore.md)\>
|
|
1981
2298
|
|
|
2299
|
+
This returns a [store](https://github.com/developit/unistore#store)
|
|
2300
|
+
that modules can use to get information about the state of the
|
|
2301
|
+
extension system.
|
|
2302
|
+
|
|
1982
2303
|
#### Returns
|
|
1983
2304
|
|
|
1984
2305
|
`Store`<[`ExtensionStore`](interfaces/ExtensionStore.md)\>
|
|
@@ -1993,6 +2314,10 @@ ___
|
|
|
1993
2314
|
|
|
1994
2315
|
▸ **renderExtension**(`domElement`, `extensionSlotName`, `extensionSlotModuleName`, `extensionId`, `renderFunction?`, `additionalProps?`): `Parcel` \| ``null``
|
|
1995
2316
|
|
|
2317
|
+
Mounts into a DOM node (representing an extension slot)
|
|
2318
|
+
a lazy-loaded component from *any* frontend module
|
|
2319
|
+
that registered an extension component for this slot.
|
|
2320
|
+
|
|
1996
2321
|
#### Parameters
|
|
1997
2322
|
|
|
1998
2323
|
| Name | Type |
|
|
@@ -2018,11 +2343,16 @@ ___
|
|
|
2018
2343
|
|
|
2019
2344
|
▸ **useAssignedExtensionIds**(`slotName`): `string`[]
|
|
2020
2345
|
|
|
2346
|
+
Gets the assigned extension ids for a given extension slot name.
|
|
2347
|
+
Does not consider if offline or online.
|
|
2348
|
+
|
|
2349
|
+
**`deprecated`** Use `useAssignedExtensions`
|
|
2350
|
+
|
|
2021
2351
|
#### Parameters
|
|
2022
2352
|
|
|
2023
2353
|
| Name | Type | Description |
|
|
2024
2354
|
| :------ | :------ | :------ |
|
|
2025
|
-
| `slotName` | `string` |
|
|
2355
|
+
| `slotName` | `string` | The name of the slot to get the assigned IDs for. |
|
|
2026
2356
|
|
|
2027
2357
|
#### Returns
|
|
2028
2358
|
|
|
@@ -2038,11 +2368,14 @@ ___
|
|
|
2038
2368
|
|
|
2039
2369
|
▸ **useAssignedExtensions**(`slotName`): [`AssignedExtension`](interfaces/AssignedExtension.md)[]
|
|
2040
2370
|
|
|
2371
|
+
Gets the assigned extensions for a given extension slot name.
|
|
2372
|
+
Does not consider if offline or online.
|
|
2373
|
+
|
|
2041
2374
|
#### Parameters
|
|
2042
2375
|
|
|
2043
2376
|
| Name | Type | Description |
|
|
2044
2377
|
| :------ | :------ | :------ |
|
|
2045
|
-
| `slotName` | `string` |
|
|
2378
|
+
| `slotName` | `string` | The name of the slot to get the assigned extensions for. |
|
|
2046
2379
|
|
|
2047
2380
|
#### Returns
|
|
2048
2381
|
|
|
@@ -2058,11 +2391,14 @@ ___
|
|
|
2058
2391
|
|
|
2059
2392
|
▸ **useConnectedExtensions**(`slotName`): [`ConnectedExtension`](interfaces/ConnectedExtension.md)[]
|
|
2060
2393
|
|
|
2394
|
+
Gets the assigned extension for a given extension slot name.
|
|
2395
|
+
Considers if offline or online.
|
|
2396
|
+
|
|
2061
2397
|
#### Parameters
|
|
2062
2398
|
|
|
2063
2399
|
| Name | Type | Description |
|
|
2064
2400
|
| :------ | :------ | :------ |
|
|
2065
|
-
| `slotName` | `string` |
|
|
2401
|
+
| `slotName` | `string` | The name of the slot to get the assigned extensions for. |
|
|
2066
2402
|
|
|
2067
2403
|
#### Returns
|
|
2068
2404
|
|
|
@@ -2078,6 +2414,8 @@ ___
|
|
|
2078
2414
|
|
|
2079
2415
|
▸ **useExtensionSlotMeta**<`T`\>(`extensionSlotName`): `Object`
|
|
2080
2416
|
|
|
2417
|
+
Extract meta data from all extension for a given extension slot.
|
|
2418
|
+
|
|
2081
2419
|
#### Type parameters
|
|
2082
2420
|
|
|
2083
2421
|
| Name | Type |
|
|
@@ -2086,9 +2424,9 @@ ___
|
|
|
2086
2424
|
|
|
2087
2425
|
#### Parameters
|
|
2088
2426
|
|
|
2089
|
-
| Name | Type |
|
|
2090
|
-
| :------ | :------ |
|
|
2091
|
-
| `extensionSlotName` | `string` |
|
|
2427
|
+
| Name | Type |
|
|
2428
|
+
| :------ | :------ |
|
|
2429
|
+
| `extensionSlotName` | `string` |
|
|
2092
2430
|
|
|
2093
2431
|
#### Returns
|
|
2094
2432
|
|
|
@@ -2152,6 +2490,8 @@ ___
|
|
|
2152
2490
|
|
|
2153
2491
|
▸ **getAsyncExtensionLifecycle**<`T`\>(`lazy`, `options`): () => `Promise`<`ReactAppOrParcel`<`any`\>\>
|
|
2154
2492
|
|
|
2493
|
+
**`deprecated`** Use getAsyncLifecycle instead.
|
|
2494
|
+
|
|
2155
2495
|
#### Type parameters
|
|
2156
2496
|
|
|
2157
2497
|
| Name |
|
|
@@ -2280,6 +2620,8 @@ ___
|
|
|
2280
2620
|
|
|
2281
2621
|
▸ **ConfigurableLink**(`__namedParameters`): `Element`
|
|
2282
2622
|
|
|
2623
|
+
A React link component which calls [navigate](API.md#navigate) when clicked
|
|
2624
|
+
|
|
2283
2625
|
#### Parameters
|
|
2284
2626
|
|
|
2285
2627
|
| Name | Type |
|
|
@@ -2300,12 +2642,23 @@ ___
|
|
|
2300
2642
|
|
|
2301
2643
|
▸ **interpolateString**(`template`, `params`): `string`
|
|
2302
2644
|
|
|
2645
|
+
Interpolates values of `params` into the `template` string.
|
|
2646
|
+
|
|
2647
|
+
Example usage:
|
|
2648
|
+
```js
|
|
2649
|
+
interpolateString("test ${one} ${two} 3", {
|
|
2650
|
+
one: "1",
|
|
2651
|
+
two: "2",
|
|
2652
|
+
}); // will return "test 1 2 3"
|
|
2653
|
+
interpolateString("test ok", { one: "1", two: "2" }) // will return "test ok"
|
|
2654
|
+
```
|
|
2655
|
+
|
|
2303
2656
|
#### Parameters
|
|
2304
2657
|
|
|
2305
2658
|
| Name | Type | Description |
|
|
2306
2659
|
| :------ | :------ | :------ |
|
|
2307
|
-
| `template` | `string` |
|
|
2308
|
-
| `params` | `Object` |
|
|
2660
|
+
| `template` | `string` | With optional params wrapped in `${ }` |
|
|
2661
|
+
| `params` | `Object` | Values to interpolate into the string template |
|
|
2309
2662
|
|
|
2310
2663
|
#### Returns
|
|
2311
2664
|
|
|
@@ -2321,12 +2674,37 @@ ___
|
|
|
2321
2674
|
|
|
2322
2675
|
▸ **interpolateUrl**(`template`, `additionalParams?`): `string`
|
|
2323
2676
|
|
|
2677
|
+
Interpolates a string with openmrsBase and openmrsSpaBase.
|
|
2678
|
+
|
|
2679
|
+
Useful for accepting `${openmrsBase}` or `${openmrsSpaBase}`plus additional template
|
|
2680
|
+
parameters in configurable URLs.
|
|
2681
|
+
|
|
2682
|
+
Example usage:
|
|
2683
|
+
```js
|
|
2684
|
+
interpolateUrl("test ${openmrsBase} ${openmrsSpaBase} ok");
|
|
2685
|
+
// will return "test /openmrs /openmrs/spa ok"
|
|
2686
|
+
|
|
2687
|
+
interpolateUrl("${openmrsSpaBase}/patient/${patientUuid}", {
|
|
2688
|
+
patientUuid: "4fcb7185-c6c9-450f-8828-ccae9436bd82",
|
|
2689
|
+
}); // will return "/openmrs/spa/patient/4fcb7185-c6c9-450f-8828-ccae9436bd82"
|
|
2690
|
+
```
|
|
2691
|
+
|
|
2692
|
+
This can be used in conjunction with the `navigate` function like so
|
|
2693
|
+
```js
|
|
2694
|
+
navigate({
|
|
2695
|
+
to: interpolateUrl(
|
|
2696
|
+
"${openmrsSpaBase}/patient/${patientUuid}",
|
|
2697
|
+
{ patientUuid: patient.uuid }
|
|
2698
|
+
)
|
|
2699
|
+
}); // will navigate to "/openmrs/spa/patient/4fcb7185-c6c9-450f-8828-ccae9436bd82"
|
|
2700
|
+
```
|
|
2701
|
+
|
|
2324
2702
|
#### Parameters
|
|
2325
2703
|
|
|
2326
2704
|
| Name | Type | Description |
|
|
2327
2705
|
| :------ | :------ | :------ |
|
|
2328
|
-
| `template` | `string` |
|
|
2329
|
-
| `additionalParams?` | `Object` |
|
|
2706
|
+
| `template` | `string` | A string to interpolate |
|
|
2707
|
+
| `additionalParams?` | `Object` | Additional values to interpolate into the string template |
|
|
2330
2708
|
|
|
2331
2709
|
#### Returns
|
|
2332
2710
|
|
|
@@ -2342,11 +2720,32 @@ ___
|
|
|
2342
2720
|
|
|
2343
2721
|
▸ **navigate**(`to`): `void`
|
|
2344
2722
|
|
|
2723
|
+
Calls `location.assign` for non-SPA paths and [navigateToUrl](https://single-spa.js.org/docs/api/#navigatetourl) for SPA paths
|
|
2724
|
+
|
|
2725
|
+
#### Example usage:
|
|
2726
|
+
```js
|
|
2727
|
+
@example
|
|
2728
|
+
const config = useConfig();
|
|
2729
|
+
const submitHandler = () => {
|
|
2730
|
+
navigate({ to: config.links.submitSuccess });
|
|
2731
|
+
};
|
|
2732
|
+
```
|
|
2733
|
+
#### Example return values:
|
|
2734
|
+
```js
|
|
2735
|
+
@example
|
|
2736
|
+
navigate({ to: "/some/path" }); // => window.location.assign("/some/path")
|
|
2737
|
+
navigate({ to: "https://single-spa.js.org/" }); // => window.location.assign("https://single-spa.js.org/")
|
|
2738
|
+
navigate({ to: "${openmrsBase}/some/path" }); // => window.location.assign("/openmrs/some/path")
|
|
2739
|
+
navigate({ to: "/openmrs/spa/foo/page" }); // => navigateToUrl("/openmrs/spa/foo/page")
|
|
2740
|
+
navigate({ to: "${openmrsSpaBase}/bar/page" }); // => navigateToUrl("/openmrs/spa/bar/page")
|
|
2741
|
+
navigate({ to: "/${openmrsSpaBase}/baz/page" }) // => navigateToUrl("/openmrs/spa/baz/page")
|
|
2742
|
+
```
|
|
2743
|
+
|
|
2345
2744
|
#### Parameters
|
|
2346
2745
|
|
|
2347
2746
|
| Name | Type | Description |
|
|
2348
2747
|
| :------ | :------ | :------ |
|
|
2349
|
-
| `to` | [`NavigateOptions`](interfaces/NavigateOptions.md) |
|
|
2748
|
+
| `to` | [`NavigateOptions`](interfaces/NavigateOptions.md) | The target path or URL. Supports templating with 'openmrsBase', 'openmrsSpaBase', and any additional template parameters defined in `templateParams`. For example, `${openmrsSpaBase}/home` will resolve to `/openmrs/spa/home` for implementations using the standard OpenMRS and SPA base paths. If `templateParams` contains `{ foo: "bar" }`, then the URL `${openmrsBase}/${foo}` will become `/openmrs/bar`. |
|
|
2350
2749
|
|
|
2351
2750
|
#### Returns
|
|
2352
2751
|
|
|
@@ -2354,7 +2753,7 @@ ___
|
|
|
2354
2753
|
|
|
2355
2754
|
#### Defined in
|
|
2356
2755
|
|
|
2357
|
-
[packages/framework/esm-config/src/navigation/navigate.ts:
|
|
2756
|
+
[packages/framework/esm-config/src/navigation/navigate.ts:46](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-config/src/navigation/navigate.ts#L46)
|
|
2358
2757
|
|
|
2359
2758
|
___
|
|
2360
2759
|
|
|
@@ -2364,11 +2763,14 @@ ___
|
|
|
2364
2763
|
|
|
2365
2764
|
▸ **beginEditSynchronizationItem**(`id`): `Promise`<`void`\>
|
|
2366
2765
|
|
|
2766
|
+
Triggers an edit flow for the given synchronization item.
|
|
2767
|
+
If this is not possible, throws an error.
|
|
2768
|
+
|
|
2367
2769
|
#### Parameters
|
|
2368
2770
|
|
|
2369
2771
|
| Name | Type | Description |
|
|
2370
2772
|
| :------ | :------ | :------ |
|
|
2371
|
-
| `id` | `number` |
|
|
2773
|
+
| `id` | `number` | The ID of the synchronization item to be edited. |
|
|
2372
2774
|
|
|
2373
2775
|
#### Returns
|
|
2374
2776
|
|
|
@@ -2384,11 +2786,14 @@ ___
|
|
|
2384
2786
|
|
|
2385
2787
|
▸ **canBeginEditSynchronizationItemsOfType**(`type`): `boolean`
|
|
2386
2788
|
|
|
2789
|
+
Returns whether editing synchronization items of the given type is supported by the currently
|
|
2790
|
+
registered synchronization handlers.
|
|
2791
|
+
|
|
2387
2792
|
#### Parameters
|
|
2388
2793
|
|
|
2389
2794
|
| Name | Type | Description |
|
|
2390
2795
|
| :------ | :------ | :------ |
|
|
2391
|
-
| `type` | `string` |
|
|
2796
|
+
| `type` | `string` | The identifying type of the synchronization item which should be edited. |
|
|
2392
2797
|
|
|
2393
2798
|
#### Returns
|
|
2394
2799
|
|
|
@@ -2404,11 +2809,13 @@ ___
|
|
|
2404
2809
|
|
|
2405
2810
|
▸ **deleteSynchronizationItem**(`id`): `Promise`<`void`\>
|
|
2406
2811
|
|
|
2812
|
+
Deletes a queued up sync item with the given ID.
|
|
2813
|
+
|
|
2407
2814
|
#### Parameters
|
|
2408
2815
|
|
|
2409
2816
|
| Name | Type | Description |
|
|
2410
2817
|
| :------ | :------ | :------ |
|
|
2411
|
-
| `id` | `number` |
|
|
2818
|
+
| `id` | `number` | The ID of the synchronization item to be deleted. |
|
|
2412
2819
|
|
|
2413
2820
|
#### Returns
|
|
2414
2821
|
|
|
@@ -2424,6 +2831,8 @@ ___
|
|
|
2424
2831
|
|
|
2425
2832
|
▸ **generateOfflineUuid**(): `string`
|
|
2426
2833
|
|
|
2834
|
+
Generates a UUID-like string which is used for uniquely identifying objects while offline.
|
|
2835
|
+
|
|
2427
2836
|
#### Returns
|
|
2428
2837
|
|
|
2429
2838
|
`string`
|
|
@@ -2452,11 +2861,14 @@ ___
|
|
|
2452
2861
|
|
|
2453
2862
|
▸ **getDynamicOfflineDataEntries**(`type?`): `Promise`<[`DynamicOfflineData`](interfaces/DynamicOfflineData.md)[]\>
|
|
2454
2863
|
|
|
2864
|
+
Returns all [DynamicOfflineData](interfaces/DynamicOfflineData.md) entries which registered for the currently logged in user.
|
|
2865
|
+
Optionally returns only entries of a given type.
|
|
2866
|
+
|
|
2455
2867
|
#### Parameters
|
|
2456
2868
|
|
|
2457
2869
|
| Name | Type | Description |
|
|
2458
2870
|
| :------ | :------ | :------ |
|
|
2459
|
-
| `type?` | `string` |
|
|
2871
|
+
| `type?` | `string` | The type of the entries to be returned. If `undefined`, returns all types. |
|
|
2460
2872
|
|
|
2461
2873
|
#### Returns
|
|
2462
2874
|
|
|
@@ -2472,12 +2884,15 @@ ___
|
|
|
2472
2884
|
|
|
2473
2885
|
▸ **getDynamicOfflineDataEntriesFor**(`userId`, `type?`): `Promise`<[`DynamicOfflineData`](interfaces/DynamicOfflineData.md)[]\>
|
|
2474
2886
|
|
|
2887
|
+
Returns all [DynamicOfflineData](interfaces/DynamicOfflineData.md) entries which registered for the given user.
|
|
2888
|
+
Optionally returns only entries of a given type.
|
|
2889
|
+
|
|
2475
2890
|
#### Parameters
|
|
2476
2891
|
|
|
2477
2892
|
| Name | Type | Description |
|
|
2478
2893
|
| :------ | :------ | :------ |
|
|
2479
|
-
| `userId` | `string` |
|
|
2480
|
-
| `type?` | `string` |
|
|
2894
|
+
| `userId` | `string` | The ID of the user whose entries are to be retrieved. |
|
|
2895
|
+
| `type?` | `string` | The type of the entries to be returned. If `undefined`, returns all types. |
|
|
2481
2896
|
|
|
2482
2897
|
#### Returns
|
|
2483
2898
|
|
|
@@ -2493,6 +2908,8 @@ ___
|
|
|
2493
2908
|
|
|
2494
2909
|
▸ **getDynamicOfflineDataHandlers**(): [`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md)[]
|
|
2495
2910
|
|
|
2911
|
+
Returns all handlers which have been setup using the [setupDynamicOfflineDataHandler](API.md#setupdynamicofflinedatahandler) function.
|
|
2912
|
+
|
|
2496
2913
|
#### Returns
|
|
2497
2914
|
|
|
2498
2915
|
[`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md)[]
|
|
@@ -2507,6 +2924,8 @@ ___
|
|
|
2507
2924
|
|
|
2508
2925
|
▸ **getFullSynchronizationItems**<`T`\>(`type?`): `Promise`<[`SyncItem`](interfaces/SyncItem.md)<`T`\>[]\>
|
|
2509
2926
|
|
|
2927
|
+
Returns all currently queued up sync items of the currently signed in user.
|
|
2928
|
+
|
|
2510
2929
|
#### Type parameters
|
|
2511
2930
|
|
|
2512
2931
|
| Name |
|
|
@@ -2517,7 +2936,7 @@ ___
|
|
|
2517
2936
|
|
|
2518
2937
|
| Name | Type | Description |
|
|
2519
2938
|
| :------ | :------ | :------ |
|
|
2520
|
-
| `type?` | `string` |
|
|
2939
|
+
| `type?` | `string` | The identifying type of the synchronization items to be returned. |
|
|
2521
2940
|
|
|
2522
2941
|
#### Returns
|
|
2523
2942
|
|
|
@@ -2533,6 +2952,8 @@ ___
|
|
|
2533
2952
|
|
|
2534
2953
|
▸ **getFullSynchronizationItemsFor**<`T`\>(`userId`, `type?`): `Promise`<[`SyncItem`](interfaces/SyncItem.md)<`T`\>[]\>
|
|
2535
2954
|
|
|
2955
|
+
Returns all currently queued up sync items of a given user.
|
|
2956
|
+
|
|
2536
2957
|
#### Type parameters
|
|
2537
2958
|
|
|
2538
2959
|
| Name |
|
|
@@ -2543,8 +2964,8 @@ ___
|
|
|
2543
2964
|
|
|
2544
2965
|
| Name | Type | Description |
|
|
2545
2966
|
| :------ | :------ | :------ |
|
|
2546
|
-
| `userId` | `string` |
|
|
2547
|
-
| `type?` | `string` |
|
|
2967
|
+
| `userId` | `string` | The ID of the user whose synchronization items should be returned. |
|
|
2968
|
+
| `type?` | `string` | The identifying type of the synchronization items to be returned.. |
|
|
2548
2969
|
|
|
2549
2970
|
#### Returns
|
|
2550
2971
|
|
|
@@ -2560,6 +2981,8 @@ ___
|
|
|
2560
2981
|
|
|
2561
2982
|
▸ **getOfflinePatientDataStore**(): `Store`<[`OfflinePatientDataSyncStore`](interfaces/OfflinePatientDataSyncStore.md)\>
|
|
2562
2983
|
|
|
2984
|
+
**`deprecated`** Will be removed once all modules have been migrated to the new dynamic offline data API.
|
|
2985
|
+
|
|
2563
2986
|
#### Returns
|
|
2564
2987
|
|
|
2565
2988
|
`Store`<[`OfflinePatientDataSyncStore`](interfaces/OfflinePatientDataSyncStore.md)\>
|
|
@@ -2574,6 +2997,8 @@ ___
|
|
|
2574
2997
|
|
|
2575
2998
|
▸ **getSynchronizationItem**<`T`\>(`id`): `Promise`<[`SyncItem`](interfaces/SyncItem.md)<`T`\> \| `undefined`\>
|
|
2576
2999
|
|
|
3000
|
+
Returns a queued sync item with the given ID or `undefined` if no such item exists.
|
|
3001
|
+
|
|
2577
3002
|
#### Type parameters
|
|
2578
3003
|
|
|
2579
3004
|
| Name | Type |
|
|
@@ -2584,7 +3009,7 @@ ___
|
|
|
2584
3009
|
|
|
2585
3010
|
| Name | Type | Description |
|
|
2586
3011
|
| :------ | :------ | :------ |
|
|
2587
|
-
| `id` | `number` |
|
|
3012
|
+
| `id` | `number` | The ID of the requested sync item. |
|
|
2588
3013
|
|
|
2589
3014
|
#### Returns
|
|
2590
3015
|
|
|
@@ -2600,6 +3025,8 @@ ___
|
|
|
2600
3025
|
|
|
2601
3026
|
▸ **getSynchronizationItems**<`T`\>(`type?`): `Promise`<`T`[]\>
|
|
2602
3027
|
|
|
3028
|
+
Returns the content of all currently queued up sync items of the currently signed in user.
|
|
3029
|
+
|
|
2603
3030
|
#### Type parameters
|
|
2604
3031
|
|
|
2605
3032
|
| Name |
|
|
@@ -2610,7 +3037,7 @@ ___
|
|
|
2610
3037
|
|
|
2611
3038
|
| Name | Type | Description |
|
|
2612
3039
|
| :------ | :------ | :------ |
|
|
2613
|
-
| `type?` | `string` |
|
|
3040
|
+
| `type?` | `string` | The identifying type of the synchronization items to be returned. |
|
|
2614
3041
|
|
|
2615
3042
|
#### Returns
|
|
2616
3043
|
|
|
@@ -2626,6 +3053,8 @@ ___
|
|
|
2626
3053
|
|
|
2627
3054
|
▸ **isOfflineUuid**(`uuid`): `boolean`
|
|
2628
3055
|
|
|
3056
|
+
Checks whether the given string has the format of an offline UUID generated by [generateOfflineUuid](API.md#generateofflineuuid)
|
|
3057
|
+
|
|
2629
3058
|
#### Parameters
|
|
2630
3059
|
|
|
2631
3060
|
| Name | Type |
|
|
@@ -2646,16 +3075,20 @@ ___
|
|
|
2646
3075
|
|
|
2647
3076
|
▸ **messageOmrsServiceWorker**(`message`): `Promise`<[`MessageServiceWorkerResult`](interfaces/MessageServiceWorkerResult.md)<`any`\>\>
|
|
2648
3077
|
|
|
3078
|
+
Sends the specified message to the application's service worker.
|
|
3079
|
+
|
|
2649
3080
|
#### Parameters
|
|
2650
3081
|
|
|
2651
3082
|
| Name | Type | Description |
|
|
2652
3083
|
| :------ | :------ | :------ |
|
|
2653
|
-
| `message` | [`KnownOmrsServiceWorkerMessages`](API.md#knownomrsserviceworkermessages) |
|
|
3084
|
+
| `message` | [`KnownOmrsServiceWorkerMessages`](API.md#knownomrsserviceworkermessages) | The message to be sent. |
|
|
2654
3085
|
|
|
2655
3086
|
#### Returns
|
|
2656
3087
|
|
|
2657
3088
|
`Promise`<[`MessageServiceWorkerResult`](interfaces/MessageServiceWorkerResult.md)<`any`\>\>
|
|
2658
3089
|
|
|
3090
|
+
A promise which completes when the message has been successfully processed by the Service Worker.
|
|
3091
|
+
|
|
2659
3092
|
#### Defined in
|
|
2660
3093
|
|
|
2661
3094
|
[packages/framework/esm-offline/src/service-worker-messaging.ts:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-offline/src/service-worker-messaging.ts#L11)
|
|
@@ -2666,12 +3099,15 @@ ___
|
|
|
2666
3099
|
|
|
2667
3100
|
▸ **putDynamicOfflineData**(`type`, `identifier`): `Promise`<`void`\>
|
|
2668
3101
|
|
|
3102
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3103
|
+
should be made available offline for the currently logged in user.
|
|
3104
|
+
|
|
2669
3105
|
#### Parameters
|
|
2670
3106
|
|
|
2671
3107
|
| Name | Type | Description |
|
|
2672
3108
|
| :------ | :------ | :------ |
|
|
2673
|
-
| `type` | `string` |
|
|
2674
|
-
| `identifier` | `string` |
|
|
3109
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3110
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2675
3111
|
|
|
2676
3112
|
#### Returns
|
|
2677
3113
|
|
|
@@ -2687,13 +3123,16 @@ ___
|
|
|
2687
3123
|
|
|
2688
3124
|
▸ **putDynamicOfflineDataFor**(`userId`, `type`, `identifier`): `Promise`<`void`\>
|
|
2689
3125
|
|
|
3126
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3127
|
+
should be made available offline for the user with the given ID.
|
|
3128
|
+
|
|
2690
3129
|
#### Parameters
|
|
2691
3130
|
|
|
2692
3131
|
| Name | Type | Description |
|
|
2693
3132
|
| :------ | :------ | :------ |
|
|
2694
|
-
| `userId` | `string` |
|
|
2695
|
-
| `type` | `string` |
|
|
2696
|
-
| `identifier` | `string` |
|
|
3133
|
+
| `userId` | `string` | The ID of the user for whom the dynamic offline data should be made available. |
|
|
3134
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3135
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2697
3136
|
|
|
2698
3137
|
#### Returns
|
|
2699
3138
|
|
|
@@ -2709,6 +3148,8 @@ ___
|
|
|
2709
3148
|
|
|
2710
3149
|
▸ **queueSynchronizationItem**<`T`\>(`type`, `content`, `descriptor?`): `Promise`<`number`\>
|
|
2711
3150
|
|
|
3151
|
+
Enqueues a new item in the sync queue and associates the item with the currently signed in user.
|
|
3152
|
+
|
|
2712
3153
|
#### Type parameters
|
|
2713
3154
|
|
|
2714
3155
|
| Name |
|
|
@@ -2719,9 +3160,9 @@ ___
|
|
|
2719
3160
|
|
|
2720
3161
|
| Name | Type | Description |
|
|
2721
3162
|
| :------ | :------ | :------ |
|
|
2722
|
-
| `type` | `string` |
|
|
2723
|
-
| `content` | `T` |
|
|
2724
|
-
| `descriptor?` | [`QueueItemDescriptor`](interfaces/QueueItemDescriptor.md) |
|
|
3163
|
+
| `type` | `string` | The identifying type of the synchronization item. |
|
|
3164
|
+
| `content` | `T` | The actual data to be synchronized. |
|
|
3165
|
+
| `descriptor?` | [`QueueItemDescriptor`](interfaces/QueueItemDescriptor.md) | An optional descriptor providing additional metadata about the sync item. |
|
|
2725
3166
|
|
|
2726
3167
|
#### Returns
|
|
2727
3168
|
|
|
@@ -2737,6 +3178,8 @@ ___
|
|
|
2737
3178
|
|
|
2738
3179
|
▸ **registerOfflinePatientHandler**(`identifier`, `handler`): `void`
|
|
2739
3180
|
|
|
3181
|
+
**`deprecated`** Will be removed once all modules have been migrated to the new dynamic offline data API.
|
|
3182
|
+
|
|
2740
3183
|
#### Parameters
|
|
2741
3184
|
|
|
2742
3185
|
| Name | Type |
|
|
@@ -2758,12 +3201,15 @@ ___
|
|
|
2758
3201
|
|
|
2759
3202
|
▸ **removeDynamicOfflineData**(`type`, `identifier`): `Promise`<`void`\>
|
|
2760
3203
|
|
|
3204
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3205
|
+
no longer needs to be available offline for the currently logged in user.
|
|
3206
|
+
|
|
2761
3207
|
#### Parameters
|
|
2762
3208
|
|
|
2763
3209
|
| Name | Type | Description |
|
|
2764
3210
|
| :------ | :------ | :------ |
|
|
2765
|
-
| `type` | `string` |
|
|
2766
|
-
| `identifier` | `string` |
|
|
3211
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3212
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2767
3213
|
|
|
2768
3214
|
#### Returns
|
|
2769
3215
|
|
|
@@ -2779,13 +3225,16 @@ ___
|
|
|
2779
3225
|
|
|
2780
3226
|
▸ **removeDynamicOfflineDataFor**(`userId`, `type`, `identifier`): `Promise`<`void`\>
|
|
2781
3227
|
|
|
3228
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3229
|
+
no longer needs to be available offline for the user with the given ID.
|
|
3230
|
+
|
|
2782
3231
|
#### Parameters
|
|
2783
3232
|
|
|
2784
3233
|
| Name | Type | Description |
|
|
2785
3234
|
| :------ | :------ | :------ |
|
|
2786
|
-
| `userId` | `string` |
|
|
2787
|
-
| `type` | `string` |
|
|
2788
|
-
| `identifier` | `string` |
|
|
3235
|
+
| `userId` | `string` | The ID of the user who doesn't require the specified offline data. |
|
|
3236
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3237
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2789
3238
|
|
|
2790
3239
|
#### Returns
|
|
2791
3240
|
|
|
@@ -2801,11 +3250,14 @@ ___
|
|
|
2801
3250
|
|
|
2802
3251
|
▸ **setupDynamicOfflineDataHandler**(`handler`): `void`
|
|
2803
3252
|
|
|
3253
|
+
Sets up a handler for synchronizing dynamic offline data.
|
|
3254
|
+
See [DynamicOfflineDataHandler](interfaces/DynamicOfflineDataHandler.md) for details.
|
|
3255
|
+
|
|
2804
3256
|
#### Parameters
|
|
2805
3257
|
|
|
2806
3258
|
| Name | Type | Description |
|
|
2807
3259
|
| :------ | :------ | :------ |
|
|
2808
|
-
| `handler` | [`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md) |
|
|
3260
|
+
| `handler` | [`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md) | The handler to be setup. |
|
|
2809
3261
|
|
|
2810
3262
|
#### Returns
|
|
2811
3263
|
|
|
@@ -2821,6 +3273,8 @@ ___
|
|
|
2821
3273
|
|
|
2822
3274
|
▸ **setupOfflineSync**<`T`\>(`type`, `dependsOn`, `process`, `options?`): `void`
|
|
2823
3275
|
|
|
3276
|
+
Registers a new synchronization handler which is able to synchronize data of a specific type.
|
|
3277
|
+
|
|
2824
3278
|
#### Type parameters
|
|
2825
3279
|
|
|
2826
3280
|
| Name |
|
|
@@ -2831,10 +3285,10 @@ ___
|
|
|
2831
3285
|
|
|
2832
3286
|
| Name | Type | Description |
|
|
2833
3287
|
| :------ | :------ | :------ |
|
|
2834
|
-
| `type` | `string` |
|
|
2835
|
-
| `dependsOn` | `string`[] |
|
|
2836
|
-
| `process` | `ProcessSyncItem`<`T`\> |
|
|
2837
|
-
| `options` | `SetupOfflineSyncOptions`<`T`\> |
|
|
3288
|
+
| `type` | `string` | The identifying type of the synchronization items which can be handled by this handler. |
|
|
3289
|
+
| `dependsOn` | `string`[] | An array of other sync item types which must be synchronized before this handler can synchronize its own data. Items of these types are effectively dependencies of the data synchronized by this handler. |
|
|
3290
|
+
| `process` | `ProcessSyncItem`<`T`\> | A function which, when invoked, performs the actual client-server synchronization of the given `item` (which is the actual data to be synchronized). |
|
|
3291
|
+
| `options` | `SetupOfflineSyncOptions`<`T`\> | Additional options which can optionally be provided when setting up a synchronization callback for a specific synchronization item type. |
|
|
2838
3292
|
|
|
2839
3293
|
#### Returns
|
|
2840
3294
|
|
|
@@ -2928,12 +3382,14 @@ ___
|
|
|
2928
3382
|
|
|
2929
3383
|
▸ **syncAllDynamicOfflineData**(`type`, `abortSignal?`): `Promise`<`void`\>
|
|
2930
3384
|
|
|
3385
|
+
Synchronizes all offline data entries of the given [type](interfaces/FetchResponse.md#type) for the currently logged in user.
|
|
3386
|
+
|
|
2931
3387
|
#### Parameters
|
|
2932
3388
|
|
|
2933
3389
|
| Name | Type | Description |
|
|
2934
3390
|
| :------ | :------ | :------ |
|
|
2935
|
-
| `type` | `string` |
|
|
2936
|
-
| `abortSignal?` | `AbortSignal` |
|
|
3391
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3392
|
+
| `abortSignal?` | `AbortSignal` | An {@link AbortSignal} which can be used to cancel the operation. |
|
|
2937
3393
|
|
|
2938
3394
|
#### Returns
|
|
2939
3395
|
|
|
@@ -2949,13 +3405,15 @@ ___
|
|
|
2949
3405
|
|
|
2950
3406
|
▸ **syncDynamicOfflineData**(`type`, `identifier`, `abortSignal?`): `Promise`<`void`\>
|
|
2951
3407
|
|
|
3408
|
+
Synchronizes a single offline data entry of the given [type](interfaces/FetchResponse.md#type) for the currently logged in user.
|
|
3409
|
+
|
|
2952
3410
|
#### Parameters
|
|
2953
3411
|
|
|
2954
3412
|
| Name | Type | Description |
|
|
2955
3413
|
| :------ | :------ | :------ |
|
|
2956
|
-
| `type` | `string` |
|
|
2957
|
-
| `identifier` | `string` |
|
|
2958
|
-
| `abortSignal?` | `AbortSignal` |
|
|
3414
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3415
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3416
|
+
| `abortSignal?` | `AbortSignal` | An {@link AbortSignal} which can be used to cancel the operation. |
|
|
2959
3417
|
|
|
2960
3418
|
#### Returns
|
|
2961
3419
|
|
|
@@ -2971,6 +3429,8 @@ ___
|
|
|
2971
3429
|
|
|
2972
3430
|
▸ **syncOfflinePatientData**(`patientUuid`): `Promise`<`void`\>
|
|
2973
3431
|
|
|
3432
|
+
**`deprecated`** Will be removed once all modules have been migrated to the new dynamic offline data API.
|
|
3433
|
+
|
|
2974
3434
|
#### Parameters
|
|
2975
3435
|
|
|
2976
3436
|
| Name | Type |
|
|
@@ -3007,6 +3467,35 @@ ___
|
|
|
3007
3467
|
|
|
3008
3468
|
▸ **ExtensionSlot**(`__namedParameters`): `Element`
|
|
3009
3469
|
|
|
3470
|
+
An [extension slot](https://o3-dev.docs.openmrs.org/#/main/extensions).
|
|
3471
|
+
A place with a name. Extensions that get connected to that name
|
|
3472
|
+
will be rendered into this.
|
|
3473
|
+
|
|
3474
|
+
**`example`**
|
|
3475
|
+
Passing a react node as children
|
|
3476
|
+
|
|
3477
|
+
```tsx
|
|
3478
|
+
<ExtensionSlot name="Foo">
|
|
3479
|
+
<div style={{ width: 10rem }}>
|
|
3480
|
+
<Extension />
|
|
3481
|
+
</div>
|
|
3482
|
+
</ExtensionSlot>
|
|
3483
|
+
```
|
|
3484
|
+
|
|
3485
|
+
**`example`**
|
|
3486
|
+
Passing a function as children
|
|
3487
|
+
|
|
3488
|
+
```tsx
|
|
3489
|
+
<ExtensionSlot name="Bar">
|
|
3490
|
+
{(extension) => (
|
|
3491
|
+
<h1>{extension.name}</h1>
|
|
3492
|
+
<div style={{ color: extension.meta.color }}>
|
|
3493
|
+
<Extension />
|
|
3494
|
+
</div>
|
|
3495
|
+
)}
|
|
3496
|
+
</ExtensionSlot>
|
|
3497
|
+
```
|
|
3498
|
+
|
|
3010
3499
|
#### Parameters
|
|
3011
3500
|
|
|
3012
3501
|
| Name | Type |
|
|
@@ -3029,6 +3518,8 @@ ___
|
|
|
3029
3518
|
|
|
3030
3519
|
▸ **createGlobalStore**<`TState`\>(`name`, `initialState`): `Store`<`TState`\>
|
|
3031
3520
|
|
|
3521
|
+
Creates a Unistore [store](https://github.com/developit/unistore#store).
|
|
3522
|
+
|
|
3032
3523
|
#### Type parameters
|
|
3033
3524
|
|
|
3034
3525
|
| Name |
|
|
@@ -3039,13 +3530,15 @@ ___
|
|
|
3039
3530
|
|
|
3040
3531
|
| Name | Type | Description |
|
|
3041
3532
|
| :------ | :------ | :------ |
|
|
3042
|
-
| `name` | `string` |
|
|
3043
|
-
| `initialState` | `TState` |
|
|
3533
|
+
| `name` | `string` | A name by which the store can be looked up later. Must be unique across the entire application. |
|
|
3534
|
+
| `initialState` | `TState` | An object which will be the initial state of the store. |
|
|
3044
3535
|
|
|
3045
3536
|
#### Returns
|
|
3046
3537
|
|
|
3047
3538
|
`Store`<`TState`\>
|
|
3048
3539
|
|
|
3540
|
+
The newly created store.
|
|
3541
|
+
|
|
3049
3542
|
#### Defined in
|
|
3050
3543
|
|
|
3051
3544
|
[packages/framework/esm-state/src/state.ts:19](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-state/src/state.ts#L19)
|
|
@@ -3056,6 +3549,8 @@ ___
|
|
|
3056
3549
|
|
|
3057
3550
|
▸ **createUseStore**<`T`\>(`store`): () => `T`(`actions`: [`Actions`](API.md#actions)) => `T` & [`BoundActions`](API.md#boundactions)(`actions?`: [`Actions`](API.md#actions)) => `T` & [`BoundActions`](API.md#boundactions)
|
|
3058
3551
|
|
|
3552
|
+
Avoid this; generally prefer to have clients use `useStore(yourStore)`
|
|
3553
|
+
|
|
3059
3554
|
#### Type parameters
|
|
3060
3555
|
|
|
3061
3556
|
| Name |
|
|
@@ -3116,6 +3611,8 @@ ___
|
|
|
3116
3611
|
|
|
3117
3612
|
`Store`<[`AppState`](interfaces/AppState.md)\>
|
|
3118
3613
|
|
|
3614
|
+
The [store](https://github.com/developit/unistore#store) named `app`.
|
|
3615
|
+
|
|
3119
3616
|
#### Defined in
|
|
3120
3617
|
|
|
3121
3618
|
[packages/framework/esm-state/src/state.ts:86](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-state/src/state.ts#L86)
|
|
@@ -3126,6 +3623,9 @@ ___
|
|
|
3126
3623
|
|
|
3127
3624
|
▸ **getGlobalStore**<`TState`\>(`name`, `fallbackState?`): `Store`<`TState`\>
|
|
3128
3625
|
|
|
3626
|
+
Returns the existing [store](https://github.com/developit/unistore#store) named `name`,
|
|
3627
|
+
or creates a new store named `name` if none exists.
|
|
3628
|
+
|
|
3129
3629
|
#### Type parameters
|
|
3130
3630
|
|
|
3131
3631
|
| Name | Type |
|
|
@@ -3136,13 +3636,15 @@ ___
|
|
|
3136
3636
|
|
|
3137
3637
|
| Name | Type | Description |
|
|
3138
3638
|
| :------ | :------ | :------ |
|
|
3139
|
-
| `name` | `string` |
|
|
3140
|
-
| `fallbackState?` | `TState` |
|
|
3639
|
+
| `name` | `string` | The name of the store to look up. |
|
|
3640
|
+
| `fallbackState?` | `TState` | The initial value of the new store if no store named `name` exists. |
|
|
3141
3641
|
|
|
3142
3642
|
#### Returns
|
|
3143
3643
|
|
|
3144
3644
|
`Store`<`TState`\>
|
|
3145
3645
|
|
|
3646
|
+
The found or newly created store.
|
|
3647
|
+
|
|
3146
3648
|
#### Defined in
|
|
3147
3649
|
|
|
3148
3650
|
[packages/framework/esm-state/src/state.ts:56](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-state/src/state.ts#L56)
|
|
@@ -3352,18 +3854,22 @@ ___
|
|
|
3352
3854
|
|
|
3353
3855
|
▸ **showModal**(`extensionId`, `props?`, `onClose?`): () => `void`
|
|
3354
3856
|
|
|
3857
|
+
Shows the provided extension component in a modal dialog.
|
|
3858
|
+
|
|
3355
3859
|
#### Parameters
|
|
3356
3860
|
|
|
3357
3861
|
| Name | Type | Description |
|
|
3358
3862
|
| :------ | :------ | :------ |
|
|
3359
|
-
| `extensionId` | `string` |
|
|
3360
|
-
| `props` | `Record`<`string`, `any`\> |
|
|
3361
|
-
| `onClose` | () => `void` |
|
|
3863
|
+
| `extensionId` | `string` | The id of the extension to show. |
|
|
3864
|
+
| `props` | `Record`<`string`, `any`\> | The optional props to provide to the extension. |
|
|
3865
|
+
| `onClose` | () => `void` | The optional notification to receive when the modal is closed. |
|
|
3362
3866
|
|
|
3363
3867
|
#### Returns
|
|
3364
3868
|
|
|
3365
3869
|
`fn`
|
|
3366
3870
|
|
|
3871
|
+
The dispose function to force closing the modal dialog.
|
|
3872
|
+
|
|
3367
3873
|
▸ (): `void`
|
|
3368
3874
|
|
|
3369
3875
|
##### Returns
|
|
@@ -3380,11 +3886,13 @@ ___
|
|
|
3380
3886
|
|
|
3381
3887
|
▸ **showNotification**(`notification`): `void`
|
|
3382
3888
|
|
|
3889
|
+
Displays an inline notification in the UI.
|
|
3890
|
+
|
|
3383
3891
|
#### Parameters
|
|
3384
3892
|
|
|
3385
3893
|
| Name | Type | Description |
|
|
3386
3894
|
| :------ | :------ | :------ |
|
|
3387
|
-
| `notification` | [`NotificationDescriptor`](interfaces/NotificationDescriptor.md) |
|
|
3895
|
+
| `notification` | [`NotificationDescriptor`](interfaces/NotificationDescriptor.md) | The description of the notification to display. |
|
|
3388
3896
|
|
|
3389
3897
|
#### Returns
|
|
3390
3898
|
|
|
@@ -3400,11 +3908,13 @@ ___
|
|
|
3400
3908
|
|
|
3401
3909
|
▸ **showToast**(`toast`): `void`
|
|
3402
3910
|
|
|
3911
|
+
Displays a toast notification in the UI.
|
|
3912
|
+
|
|
3403
3913
|
#### Parameters
|
|
3404
3914
|
|
|
3405
3915
|
| Name | Type | Description |
|
|
3406
3916
|
| :------ | :------ | :------ |
|
|
3407
|
-
| `toast` | [`ToastDescriptor`](interfaces/ToastDescriptor.md) |
|
|
3917
|
+
| `toast` | [`ToastDescriptor`](interfaces/ToastDescriptor.md) | The description of the toast to display. |
|
|
3408
3918
|
|
|
3409
3919
|
#### Returns
|
|
3410
3920
|
|
|
@@ -3594,16 +4104,20 @@ ___
|
|
|
3594
4104
|
|
|
3595
4105
|
▸ **age**(`dateString`): `string`
|
|
3596
4106
|
|
|
4107
|
+
Gets a human readable age represention of the provided date string.
|
|
4108
|
+
|
|
3597
4109
|
#### Parameters
|
|
3598
4110
|
|
|
3599
4111
|
| Name | Type | Description |
|
|
3600
4112
|
| :------ | :------ | :------ |
|
|
3601
|
-
| `dateString` | `string` |
|
|
4113
|
+
| `dateString` | `string` | The stringified date. |
|
|
3602
4114
|
|
|
3603
4115
|
#### Returns
|
|
3604
4116
|
|
|
3605
4117
|
`string`
|
|
3606
4118
|
|
|
4119
|
+
A human-readable string version of the age.
|
|
4120
|
+
|
|
3607
4121
|
#### Defined in
|
|
3608
4122
|
|
|
3609
4123
|
[packages/framework/esm-utils/src/age-helpers.tsx:39](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-utils/src/age-helpers.tsx#L39)
|
|
@@ -3614,16 +4128,20 @@ ___
|
|
|
3614
4128
|
|
|
3615
4129
|
▸ **daysIntoYear**(`date`): `number`
|
|
3616
4130
|
|
|
4131
|
+
Gets the number of days in the year of the given date.
|
|
4132
|
+
|
|
3617
4133
|
#### Parameters
|
|
3618
4134
|
|
|
3619
4135
|
| Name | Type | Description |
|
|
3620
4136
|
| :------ | :------ | :------ |
|
|
3621
|
-
| `date` | `Date` |
|
|
4137
|
+
| `date` | `Date` | The date to compute the days within the year. |
|
|
3622
4138
|
|
|
3623
4139
|
#### Returns
|
|
3624
4140
|
|
|
3625
4141
|
`number`
|
|
3626
4142
|
|
|
4143
|
+
The number of days.
|
|
4144
|
+
|
|
3627
4145
|
#### Defined in
|
|
3628
4146
|
|
|
3629
4147
|
[packages/framework/esm-utils/src/age-helpers.tsx:8](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-utils/src/age-helpers.tsx#L8)
|
|
@@ -3634,17 +4152,21 @@ ___
|
|
|
3634
4152
|
|
|
3635
4153
|
▸ **isSameDay**(`firstDate`, `secondDate`): `boolean`
|
|
3636
4154
|
|
|
4155
|
+
Checks if two dates are representing the same day.
|
|
4156
|
+
|
|
3637
4157
|
#### Parameters
|
|
3638
4158
|
|
|
3639
4159
|
| Name | Type | Description |
|
|
3640
4160
|
| :------ | :------ | :------ |
|
|
3641
|
-
| `firstDate` | `Date` |
|
|
3642
|
-
| `secondDate` | `Date` |
|
|
4161
|
+
| `firstDate` | `Date` | The first date. |
|
|
4162
|
+
| `secondDate` | `Date` | The second date. |
|
|
3643
4163
|
|
|
3644
4164
|
#### Returns
|
|
3645
4165
|
|
|
3646
4166
|
`boolean`
|
|
3647
4167
|
|
|
4168
|
+
True if both are located on the same day.
|
|
4169
|
+
|
|
3648
4170
|
#### Defined in
|
|
3649
4171
|
|
|
3650
4172
|
[packages/framework/esm-utils/src/age-helpers.tsx:25](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-utils/src/age-helpers.tsx#L25)
|
|
@@ -3676,6 +4198,15 @@ ___
|
|
|
3676
4198
|
|
|
3677
4199
|
▸ **retry**<`T`\>(`fn`, `options?`): `Promise`<`T`\>
|
|
3678
4200
|
|
|
4201
|
+
Executes the specified function and retries executing on failure with a custom backoff strategy
|
|
4202
|
+
defined by the options.
|
|
4203
|
+
|
|
4204
|
+
If not configured otherwise, this function uses the following default options:
|
|
4205
|
+
* Retries 5 times beyond the initial attempt.
|
|
4206
|
+
* Uses an exponential backoff starting with an initial delay of 1000ms.
|
|
4207
|
+
|
|
4208
|
+
**`throws`** Rethrows the final error of running `fn` when the function stops retrying.
|
|
4209
|
+
|
|
3679
4210
|
#### Type parameters
|
|
3680
4211
|
|
|
3681
4212
|
| Name |
|
|
@@ -3686,13 +4217,15 @@ ___
|
|
|
3686
4217
|
|
|
3687
4218
|
| Name | Type | Description |
|
|
3688
4219
|
| :------ | :------ | :------ |
|
|
3689
|
-
| `fn` | () => `Promise`<`T`\> |
|
|
3690
|
-
| `options` | [`RetryOptions`](interfaces/RetryOptions.md) |
|
|
4220
|
+
| `fn` | () => `Promise`<`T`\> | The function to be executed and retried on failure. |
|
|
4221
|
+
| `options` | [`RetryOptions`](interfaces/RetryOptions.md) | Additional options which configure the retry behavior. |
|
|
3691
4222
|
|
|
3692
4223
|
#### Returns
|
|
3693
4224
|
|
|
3694
4225
|
`Promise`<`T`\>
|
|
3695
4226
|
|
|
4227
|
+
The result of successfully executing `fn`.
|
|
4228
|
+
|
|
3696
4229
|
#### Defined in
|
|
3697
4230
|
|
|
3698
4231
|
[packages/framework/esm-utils/src/retry.ts:40](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-utils/src/retry.ts#L40)
|