@openmrs/esm-framework 4.0.1-pre.220 → 4.0.1-pre.226
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 +2 -2
- package/docs/API.md +628 -99
- 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/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,28 @@ ___
|
|
|
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
|
+
const config = useConfig();
|
|
2728
|
+
const submitHandler = () => {
|
|
2729
|
+
navigate({ to: config.links.submitSuccess });
|
|
2730
|
+
};
|
|
2731
|
+
```
|
|
2732
|
+
Example return values:
|
|
2733
|
+
navigate({ to: "/some/path" }); => window.location.assign("/some/path")
|
|
2734
|
+
navigate({ to: "https://single-spa.js.org/" }); => window.location.assign("https://single-spa.js.org/")
|
|
2735
|
+
navigate({ to: "${openmrsBase}/some/path" }); => window.location.assign("/openmrs/some/path")
|
|
2736
|
+
navigate({ to: "/openmrs/spa/foo/page" }); => navigateToUrl("/openmrs/spa/foo/page")
|
|
2737
|
+
navigate({ to: "${openmrsSpaBase}/bar/page" }); => navigateToUrl("/openmrs/spa/bar/page")
|
|
2738
|
+
navigate({ to: "/${openmrsSpaBase}/baz/page" }) => navigateToUrl("/openmrs/spa/baz/page")
|
|
2739
|
+
|
|
2345
2740
|
#### Parameters
|
|
2346
2741
|
|
|
2347
2742
|
| Name | Type | Description |
|
|
2348
2743
|
| :------ | :------ | :------ |
|
|
2349
|
-
| `to` | [`NavigateOptions`](interfaces/NavigateOptions.md) |
|
|
2744
|
+
| `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
2745
|
|
|
2351
2746
|
#### Returns
|
|
2352
2747
|
|
|
@@ -2364,11 +2759,14 @@ ___
|
|
|
2364
2759
|
|
|
2365
2760
|
▸ **beginEditSynchronizationItem**(`id`): `Promise`<`void`\>
|
|
2366
2761
|
|
|
2762
|
+
Triggers an edit flow for the given synchronization item.
|
|
2763
|
+
If this is not possible, throws an error.
|
|
2764
|
+
|
|
2367
2765
|
#### Parameters
|
|
2368
2766
|
|
|
2369
2767
|
| Name | Type | Description |
|
|
2370
2768
|
| :------ | :------ | :------ |
|
|
2371
|
-
| `id` | `number` |
|
|
2769
|
+
| `id` | `number` | The ID of the synchronization item to be edited. |
|
|
2372
2770
|
|
|
2373
2771
|
#### Returns
|
|
2374
2772
|
|
|
@@ -2384,11 +2782,14 @@ ___
|
|
|
2384
2782
|
|
|
2385
2783
|
▸ **canBeginEditSynchronizationItemsOfType**(`type`): `boolean`
|
|
2386
2784
|
|
|
2785
|
+
Returns whether editing synchronization items of the given type is supported by the currently
|
|
2786
|
+
registered synchronization handlers.
|
|
2787
|
+
|
|
2387
2788
|
#### Parameters
|
|
2388
2789
|
|
|
2389
2790
|
| Name | Type | Description |
|
|
2390
2791
|
| :------ | :------ | :------ |
|
|
2391
|
-
| `type` | `string` |
|
|
2792
|
+
| `type` | `string` | The identifying type of the synchronization item which should be edited. |
|
|
2392
2793
|
|
|
2393
2794
|
#### Returns
|
|
2394
2795
|
|
|
@@ -2404,11 +2805,13 @@ ___
|
|
|
2404
2805
|
|
|
2405
2806
|
▸ **deleteSynchronizationItem**(`id`): `Promise`<`void`\>
|
|
2406
2807
|
|
|
2808
|
+
Deletes a queued up sync item with the given ID.
|
|
2809
|
+
|
|
2407
2810
|
#### Parameters
|
|
2408
2811
|
|
|
2409
2812
|
| Name | Type | Description |
|
|
2410
2813
|
| :------ | :------ | :------ |
|
|
2411
|
-
| `id` | `number` |
|
|
2814
|
+
| `id` | `number` | The ID of the synchronization item to be deleted. |
|
|
2412
2815
|
|
|
2413
2816
|
#### Returns
|
|
2414
2817
|
|
|
@@ -2424,6 +2827,8 @@ ___
|
|
|
2424
2827
|
|
|
2425
2828
|
▸ **generateOfflineUuid**(): `string`
|
|
2426
2829
|
|
|
2830
|
+
Generates a UUID-like string which is used for uniquely identifying objects while offline.
|
|
2831
|
+
|
|
2427
2832
|
#### Returns
|
|
2428
2833
|
|
|
2429
2834
|
`string`
|
|
@@ -2452,11 +2857,14 @@ ___
|
|
|
2452
2857
|
|
|
2453
2858
|
▸ **getDynamicOfflineDataEntries**(`type?`): `Promise`<[`DynamicOfflineData`](interfaces/DynamicOfflineData.md)[]\>
|
|
2454
2859
|
|
|
2860
|
+
Returns all [DynamicOfflineData](interfaces/DynamicOfflineData.md) entries which registered for the currently logged in user.
|
|
2861
|
+
Optionally returns only entries of a given type.
|
|
2862
|
+
|
|
2455
2863
|
#### Parameters
|
|
2456
2864
|
|
|
2457
2865
|
| Name | Type | Description |
|
|
2458
2866
|
| :------ | :------ | :------ |
|
|
2459
|
-
| `type?` | `string` |
|
|
2867
|
+
| `type?` | `string` | The type of the entries to be returned. If `undefined`, returns all types. |
|
|
2460
2868
|
|
|
2461
2869
|
#### Returns
|
|
2462
2870
|
|
|
@@ -2472,12 +2880,15 @@ ___
|
|
|
2472
2880
|
|
|
2473
2881
|
▸ **getDynamicOfflineDataEntriesFor**(`userId`, `type?`): `Promise`<[`DynamicOfflineData`](interfaces/DynamicOfflineData.md)[]\>
|
|
2474
2882
|
|
|
2883
|
+
Returns all [DynamicOfflineData](interfaces/DynamicOfflineData.md) entries which registered for the given user.
|
|
2884
|
+
Optionally returns only entries of a given type.
|
|
2885
|
+
|
|
2475
2886
|
#### Parameters
|
|
2476
2887
|
|
|
2477
2888
|
| Name | Type | Description |
|
|
2478
2889
|
| :------ | :------ | :------ |
|
|
2479
|
-
| `userId` | `string` |
|
|
2480
|
-
| `type?` | `string` |
|
|
2890
|
+
| `userId` | `string` | The ID of the user whose entries are to be retrieved. |
|
|
2891
|
+
| `type?` | `string` | The type of the entries to be returned. If `undefined`, returns all types. |
|
|
2481
2892
|
|
|
2482
2893
|
#### Returns
|
|
2483
2894
|
|
|
@@ -2493,6 +2904,8 @@ ___
|
|
|
2493
2904
|
|
|
2494
2905
|
▸ **getDynamicOfflineDataHandlers**(): [`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md)[]
|
|
2495
2906
|
|
|
2907
|
+
Returns all handlers which have been setup using the [setupDynamicOfflineDataHandler](API.md#setupdynamicofflinedatahandler) function.
|
|
2908
|
+
|
|
2496
2909
|
#### Returns
|
|
2497
2910
|
|
|
2498
2911
|
[`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md)[]
|
|
@@ -2507,6 +2920,8 @@ ___
|
|
|
2507
2920
|
|
|
2508
2921
|
▸ **getFullSynchronizationItems**<`T`\>(`type?`): `Promise`<[`SyncItem`](interfaces/SyncItem.md)<`T`\>[]\>
|
|
2509
2922
|
|
|
2923
|
+
Returns all currently queued up sync items of the currently signed in user.
|
|
2924
|
+
|
|
2510
2925
|
#### Type parameters
|
|
2511
2926
|
|
|
2512
2927
|
| Name |
|
|
@@ -2517,7 +2932,7 @@ ___
|
|
|
2517
2932
|
|
|
2518
2933
|
| Name | Type | Description |
|
|
2519
2934
|
| :------ | :------ | :------ |
|
|
2520
|
-
| `type?` | `string` |
|
|
2935
|
+
| `type?` | `string` | The identifying type of the synchronization items to be returned. |
|
|
2521
2936
|
|
|
2522
2937
|
#### Returns
|
|
2523
2938
|
|
|
@@ -2533,6 +2948,8 @@ ___
|
|
|
2533
2948
|
|
|
2534
2949
|
▸ **getFullSynchronizationItemsFor**<`T`\>(`userId`, `type?`): `Promise`<[`SyncItem`](interfaces/SyncItem.md)<`T`\>[]\>
|
|
2535
2950
|
|
|
2951
|
+
Returns all currently queued up sync items of a given user.
|
|
2952
|
+
|
|
2536
2953
|
#### Type parameters
|
|
2537
2954
|
|
|
2538
2955
|
| Name |
|
|
@@ -2543,8 +2960,8 @@ ___
|
|
|
2543
2960
|
|
|
2544
2961
|
| Name | Type | Description |
|
|
2545
2962
|
| :------ | :------ | :------ |
|
|
2546
|
-
| `userId` | `string` |
|
|
2547
|
-
| `type?` | `string` |
|
|
2963
|
+
| `userId` | `string` | The ID of the user whose synchronization items should be returned. |
|
|
2964
|
+
| `type?` | `string` | The identifying type of the synchronization items to be returned.. |
|
|
2548
2965
|
|
|
2549
2966
|
#### Returns
|
|
2550
2967
|
|
|
@@ -2560,6 +2977,8 @@ ___
|
|
|
2560
2977
|
|
|
2561
2978
|
▸ **getOfflinePatientDataStore**(): `Store`<[`OfflinePatientDataSyncStore`](interfaces/OfflinePatientDataSyncStore.md)\>
|
|
2562
2979
|
|
|
2980
|
+
**`deprecated`** Will be removed once all modules have been migrated to the new dynamic offline data API.
|
|
2981
|
+
|
|
2563
2982
|
#### Returns
|
|
2564
2983
|
|
|
2565
2984
|
`Store`<[`OfflinePatientDataSyncStore`](interfaces/OfflinePatientDataSyncStore.md)\>
|
|
@@ -2574,6 +2993,8 @@ ___
|
|
|
2574
2993
|
|
|
2575
2994
|
▸ **getSynchronizationItem**<`T`\>(`id`): `Promise`<[`SyncItem`](interfaces/SyncItem.md)<`T`\> \| `undefined`\>
|
|
2576
2995
|
|
|
2996
|
+
Returns a queued sync item with the given ID or `undefined` if no such item exists.
|
|
2997
|
+
|
|
2577
2998
|
#### Type parameters
|
|
2578
2999
|
|
|
2579
3000
|
| Name | Type |
|
|
@@ -2584,7 +3005,7 @@ ___
|
|
|
2584
3005
|
|
|
2585
3006
|
| Name | Type | Description |
|
|
2586
3007
|
| :------ | :------ | :------ |
|
|
2587
|
-
| `id` | `number` |
|
|
3008
|
+
| `id` | `number` | The ID of the requested sync item. |
|
|
2588
3009
|
|
|
2589
3010
|
#### Returns
|
|
2590
3011
|
|
|
@@ -2600,6 +3021,8 @@ ___
|
|
|
2600
3021
|
|
|
2601
3022
|
▸ **getSynchronizationItems**<`T`\>(`type?`): `Promise`<`T`[]\>
|
|
2602
3023
|
|
|
3024
|
+
Returns the content of all currently queued up sync items of the currently signed in user.
|
|
3025
|
+
|
|
2603
3026
|
#### Type parameters
|
|
2604
3027
|
|
|
2605
3028
|
| Name |
|
|
@@ -2610,7 +3033,7 @@ ___
|
|
|
2610
3033
|
|
|
2611
3034
|
| Name | Type | Description |
|
|
2612
3035
|
| :------ | :------ | :------ |
|
|
2613
|
-
| `type?` | `string` |
|
|
3036
|
+
| `type?` | `string` | The identifying type of the synchronization items to be returned. |
|
|
2614
3037
|
|
|
2615
3038
|
#### Returns
|
|
2616
3039
|
|
|
@@ -2626,6 +3049,8 @@ ___
|
|
|
2626
3049
|
|
|
2627
3050
|
▸ **isOfflineUuid**(`uuid`): `boolean`
|
|
2628
3051
|
|
|
3052
|
+
Checks whether the given string has the format of an offline UUID generated by [generateOfflineUuid](API.md#generateofflineuuid)
|
|
3053
|
+
|
|
2629
3054
|
#### Parameters
|
|
2630
3055
|
|
|
2631
3056
|
| Name | Type |
|
|
@@ -2646,16 +3071,20 @@ ___
|
|
|
2646
3071
|
|
|
2647
3072
|
▸ **messageOmrsServiceWorker**(`message`): `Promise`<[`MessageServiceWorkerResult`](interfaces/MessageServiceWorkerResult.md)<`any`\>\>
|
|
2648
3073
|
|
|
3074
|
+
Sends the specified message to the application's service worker.
|
|
3075
|
+
|
|
2649
3076
|
#### Parameters
|
|
2650
3077
|
|
|
2651
3078
|
| Name | Type | Description |
|
|
2652
3079
|
| :------ | :------ | :------ |
|
|
2653
|
-
| `message` | [`KnownOmrsServiceWorkerMessages`](API.md#knownomrsserviceworkermessages) |
|
|
3080
|
+
| `message` | [`KnownOmrsServiceWorkerMessages`](API.md#knownomrsserviceworkermessages) | The message to be sent. |
|
|
2654
3081
|
|
|
2655
3082
|
#### Returns
|
|
2656
3083
|
|
|
2657
3084
|
`Promise`<[`MessageServiceWorkerResult`](interfaces/MessageServiceWorkerResult.md)<`any`\>\>
|
|
2658
3085
|
|
|
3086
|
+
A promise which completes when the message has been successfully processed by the Service Worker.
|
|
3087
|
+
|
|
2659
3088
|
#### Defined in
|
|
2660
3089
|
|
|
2661
3090
|
[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 +3095,15 @@ ___
|
|
|
2666
3095
|
|
|
2667
3096
|
▸ **putDynamicOfflineData**(`type`, `identifier`): `Promise`<`void`\>
|
|
2668
3097
|
|
|
3098
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3099
|
+
should be made available offline for the currently logged in user.
|
|
3100
|
+
|
|
2669
3101
|
#### Parameters
|
|
2670
3102
|
|
|
2671
3103
|
| Name | Type | Description |
|
|
2672
3104
|
| :------ | :------ | :------ |
|
|
2673
|
-
| `type` | `string` |
|
|
2674
|
-
| `identifier` | `string` |
|
|
3105
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3106
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2675
3107
|
|
|
2676
3108
|
#### Returns
|
|
2677
3109
|
|
|
@@ -2687,13 +3119,16 @@ ___
|
|
|
2687
3119
|
|
|
2688
3120
|
▸ **putDynamicOfflineDataFor**(`userId`, `type`, `identifier`): `Promise`<`void`\>
|
|
2689
3121
|
|
|
3122
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3123
|
+
should be made available offline for the user with the given ID.
|
|
3124
|
+
|
|
2690
3125
|
#### Parameters
|
|
2691
3126
|
|
|
2692
3127
|
| Name | Type | Description |
|
|
2693
3128
|
| :------ | :------ | :------ |
|
|
2694
|
-
| `userId` | `string` |
|
|
2695
|
-
| `type` | `string` |
|
|
2696
|
-
| `identifier` | `string` |
|
|
3129
|
+
| `userId` | `string` | The ID of the user for whom the dynamic offline data should be made available. |
|
|
3130
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3131
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2697
3132
|
|
|
2698
3133
|
#### Returns
|
|
2699
3134
|
|
|
@@ -2709,6 +3144,8 @@ ___
|
|
|
2709
3144
|
|
|
2710
3145
|
▸ **queueSynchronizationItem**<`T`\>(`type`, `content`, `descriptor?`): `Promise`<`number`\>
|
|
2711
3146
|
|
|
3147
|
+
Enqueues a new item in the sync queue and associates the item with the currently signed in user.
|
|
3148
|
+
|
|
2712
3149
|
#### Type parameters
|
|
2713
3150
|
|
|
2714
3151
|
| Name |
|
|
@@ -2719,9 +3156,9 @@ ___
|
|
|
2719
3156
|
|
|
2720
3157
|
| Name | Type | Description |
|
|
2721
3158
|
| :------ | :------ | :------ |
|
|
2722
|
-
| `type` | `string` |
|
|
2723
|
-
| `content` | `T` |
|
|
2724
|
-
| `descriptor?` | [`QueueItemDescriptor`](interfaces/QueueItemDescriptor.md) |
|
|
3159
|
+
| `type` | `string` | The identifying type of the synchronization item. |
|
|
3160
|
+
| `content` | `T` | The actual data to be synchronized. |
|
|
3161
|
+
| `descriptor?` | [`QueueItemDescriptor`](interfaces/QueueItemDescriptor.md) | An optional descriptor providing additional metadata about the sync item. |
|
|
2725
3162
|
|
|
2726
3163
|
#### Returns
|
|
2727
3164
|
|
|
@@ -2737,6 +3174,8 @@ ___
|
|
|
2737
3174
|
|
|
2738
3175
|
▸ **registerOfflinePatientHandler**(`identifier`, `handler`): `void`
|
|
2739
3176
|
|
|
3177
|
+
**`deprecated`** Will be removed once all modules have been migrated to the new dynamic offline data API.
|
|
3178
|
+
|
|
2740
3179
|
#### Parameters
|
|
2741
3180
|
|
|
2742
3181
|
| Name | Type |
|
|
@@ -2758,12 +3197,15 @@ ___
|
|
|
2758
3197
|
|
|
2759
3198
|
▸ **removeDynamicOfflineData**(`type`, `identifier`): `Promise`<`void`\>
|
|
2760
3199
|
|
|
3200
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3201
|
+
no longer needs to be available offline for the currently logged in user.
|
|
3202
|
+
|
|
2761
3203
|
#### Parameters
|
|
2762
3204
|
|
|
2763
3205
|
| Name | Type | Description |
|
|
2764
3206
|
| :------ | :------ | :------ |
|
|
2765
|
-
| `type` | `string` |
|
|
2766
|
-
| `identifier` | `string` |
|
|
3207
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3208
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2767
3209
|
|
|
2768
3210
|
#### Returns
|
|
2769
3211
|
|
|
@@ -2779,13 +3221,16 @@ ___
|
|
|
2779
3221
|
|
|
2780
3222
|
▸ **removeDynamicOfflineDataFor**(`userId`, `type`, `identifier`): `Promise`<`void`\>
|
|
2781
3223
|
|
|
3224
|
+
Declares that dynamic offline data of the given [type](interfaces/FetchResponse.md#type) with the given [identifier](interfaces/FHIRResource.md#identifier)
|
|
3225
|
+
no longer needs to be available offline for the user with the given ID.
|
|
3226
|
+
|
|
2782
3227
|
#### Parameters
|
|
2783
3228
|
|
|
2784
3229
|
| Name | Type | Description |
|
|
2785
3230
|
| :------ | :------ | :------ |
|
|
2786
|
-
| `userId` | `string` |
|
|
2787
|
-
| `type` | `string` |
|
|
2788
|
-
| `identifier` | `string` |
|
|
3231
|
+
| `userId` | `string` | The ID of the user who doesn't require the specified offline data. |
|
|
3232
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3233
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
2789
3234
|
|
|
2790
3235
|
#### Returns
|
|
2791
3236
|
|
|
@@ -2801,11 +3246,14 @@ ___
|
|
|
2801
3246
|
|
|
2802
3247
|
▸ **setupDynamicOfflineDataHandler**(`handler`): `void`
|
|
2803
3248
|
|
|
3249
|
+
Sets up a handler for synchronizing dynamic offline data.
|
|
3250
|
+
See [DynamicOfflineDataHandler](interfaces/DynamicOfflineDataHandler.md) for details.
|
|
3251
|
+
|
|
2804
3252
|
#### Parameters
|
|
2805
3253
|
|
|
2806
3254
|
| Name | Type | Description |
|
|
2807
3255
|
| :------ | :------ | :------ |
|
|
2808
|
-
| `handler` | [`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md) |
|
|
3256
|
+
| `handler` | [`DynamicOfflineDataHandler`](interfaces/DynamicOfflineDataHandler.md) | The handler to be setup. |
|
|
2809
3257
|
|
|
2810
3258
|
#### Returns
|
|
2811
3259
|
|
|
@@ -2821,6 +3269,8 @@ ___
|
|
|
2821
3269
|
|
|
2822
3270
|
▸ **setupOfflineSync**<`T`\>(`type`, `dependsOn`, `process`, `options?`): `void`
|
|
2823
3271
|
|
|
3272
|
+
Registers a new synchronization handler which is able to synchronize data of a specific type.
|
|
3273
|
+
|
|
2824
3274
|
#### Type parameters
|
|
2825
3275
|
|
|
2826
3276
|
| Name |
|
|
@@ -2831,10 +3281,10 @@ ___
|
|
|
2831
3281
|
|
|
2832
3282
|
| Name | Type | Description |
|
|
2833
3283
|
| :------ | :------ | :------ |
|
|
2834
|
-
| `type` | `string` |
|
|
2835
|
-
| `dependsOn` | `string`[] |
|
|
2836
|
-
| `process` | `ProcessSyncItem`<`T`\> |
|
|
2837
|
-
| `options` | `SetupOfflineSyncOptions`<`T`\> |
|
|
3284
|
+
| `type` | `string` | The identifying type of the synchronization items which can be handled by this handler. |
|
|
3285
|
+
| `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. |
|
|
3286
|
+
| `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). |
|
|
3287
|
+
| `options` | `SetupOfflineSyncOptions`<`T`\> | Additional options which can optionally be provided when setting up a synchronization callback for a specific synchronization item type. |
|
|
2838
3288
|
|
|
2839
3289
|
#### Returns
|
|
2840
3290
|
|
|
@@ -2928,12 +3378,14 @@ ___
|
|
|
2928
3378
|
|
|
2929
3379
|
▸ **syncAllDynamicOfflineData**(`type`, `abortSignal?`): `Promise`<`void`\>
|
|
2930
3380
|
|
|
3381
|
+
Synchronizes all offline data entries of the given [type](interfaces/FetchResponse.md#type) for the currently logged in user.
|
|
3382
|
+
|
|
2931
3383
|
#### Parameters
|
|
2932
3384
|
|
|
2933
3385
|
| Name | Type | Description |
|
|
2934
3386
|
| :------ | :------ | :------ |
|
|
2935
|
-
| `type` | `string` |
|
|
2936
|
-
| `abortSignal?` | `AbortSignal` |
|
|
3387
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3388
|
+
| `abortSignal?` | `AbortSignal` | An {@link AbortSignal} which can be used to cancel the operation. |
|
|
2937
3389
|
|
|
2938
3390
|
#### Returns
|
|
2939
3391
|
|
|
@@ -2949,13 +3401,15 @@ ___
|
|
|
2949
3401
|
|
|
2950
3402
|
▸ **syncDynamicOfflineData**(`type`, `identifier`, `abortSignal?`): `Promise`<`void`\>
|
|
2951
3403
|
|
|
3404
|
+
Synchronizes a single offline data entry of the given [type](interfaces/FetchResponse.md#type) for the currently logged in user.
|
|
3405
|
+
|
|
2952
3406
|
#### Parameters
|
|
2953
3407
|
|
|
2954
3408
|
| Name | Type | Description |
|
|
2955
3409
|
| :------ | :------ | :------ |
|
|
2956
|
-
| `type` | `string` |
|
|
2957
|
-
| `identifier` | `string` |
|
|
2958
|
-
| `abortSignal?` | `AbortSignal` |
|
|
3410
|
+
| `type` | `string` | The type of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3411
|
+
| `identifier` | `string` | The identifier of the offline data. See [DynamicOfflineData](interfaces/DynamicOfflineData.md) for details. |
|
|
3412
|
+
| `abortSignal?` | `AbortSignal` | An {@link AbortSignal} which can be used to cancel the operation. |
|
|
2959
3413
|
|
|
2960
3414
|
#### Returns
|
|
2961
3415
|
|
|
@@ -2971,6 +3425,8 @@ ___
|
|
|
2971
3425
|
|
|
2972
3426
|
▸ **syncOfflinePatientData**(`patientUuid`): `Promise`<`void`\>
|
|
2973
3427
|
|
|
3428
|
+
**`deprecated`** Will be removed once all modules have been migrated to the new dynamic offline data API.
|
|
3429
|
+
|
|
2974
3430
|
#### Parameters
|
|
2975
3431
|
|
|
2976
3432
|
| Name | Type |
|
|
@@ -3007,6 +3463,35 @@ ___
|
|
|
3007
3463
|
|
|
3008
3464
|
▸ **ExtensionSlot**(`__namedParameters`): `Element`
|
|
3009
3465
|
|
|
3466
|
+
An [extension slot](https://o3-dev.docs.openmrs.org/#/main/extensions).
|
|
3467
|
+
A place with a name. Extensions that get connected to that name
|
|
3468
|
+
will be rendered into this.
|
|
3469
|
+
|
|
3470
|
+
**`example`**
|
|
3471
|
+
Passing a react node as children
|
|
3472
|
+
|
|
3473
|
+
```tsx
|
|
3474
|
+
<ExtensionSlot name="Foo">
|
|
3475
|
+
<div style={{ width: 10rem }}>
|
|
3476
|
+
<Extension />
|
|
3477
|
+
</div>
|
|
3478
|
+
</ExtensionSlot>
|
|
3479
|
+
```
|
|
3480
|
+
|
|
3481
|
+
**`example`**
|
|
3482
|
+
Passing a function as children
|
|
3483
|
+
|
|
3484
|
+
```tsx
|
|
3485
|
+
<ExtensionSlot name="Bar">
|
|
3486
|
+
{(extension) => (
|
|
3487
|
+
<h1>{extension.name}</h1>
|
|
3488
|
+
<div style={{ color: extension.meta.color }}>
|
|
3489
|
+
<Extension />
|
|
3490
|
+
</div>
|
|
3491
|
+
)}
|
|
3492
|
+
</ExtensionSlot>
|
|
3493
|
+
```
|
|
3494
|
+
|
|
3010
3495
|
#### Parameters
|
|
3011
3496
|
|
|
3012
3497
|
| Name | Type |
|
|
@@ -3029,6 +3514,8 @@ ___
|
|
|
3029
3514
|
|
|
3030
3515
|
▸ **createGlobalStore**<`TState`\>(`name`, `initialState`): `Store`<`TState`\>
|
|
3031
3516
|
|
|
3517
|
+
Creates a Unistore [store](https://github.com/developit/unistore#store).
|
|
3518
|
+
|
|
3032
3519
|
#### Type parameters
|
|
3033
3520
|
|
|
3034
3521
|
| Name |
|
|
@@ -3039,13 +3526,15 @@ ___
|
|
|
3039
3526
|
|
|
3040
3527
|
| Name | Type | Description |
|
|
3041
3528
|
| :------ | :------ | :------ |
|
|
3042
|
-
| `name` | `string` |
|
|
3043
|
-
| `initialState` | `TState` |
|
|
3529
|
+
| `name` | `string` | A name by which the store can be looked up later. Must be unique across the entire application. |
|
|
3530
|
+
| `initialState` | `TState` | An object which will be the initial state of the store. |
|
|
3044
3531
|
|
|
3045
3532
|
#### Returns
|
|
3046
3533
|
|
|
3047
3534
|
`Store`<`TState`\>
|
|
3048
3535
|
|
|
3536
|
+
The newly created store.
|
|
3537
|
+
|
|
3049
3538
|
#### Defined in
|
|
3050
3539
|
|
|
3051
3540
|
[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 +3545,8 @@ ___
|
|
|
3056
3545
|
|
|
3057
3546
|
▸ **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
3547
|
|
|
3548
|
+
Avoid this; generally prefer to have clients use `useStore(yourStore)`
|
|
3549
|
+
|
|
3059
3550
|
#### Type parameters
|
|
3060
3551
|
|
|
3061
3552
|
| Name |
|
|
@@ -3116,6 +3607,8 @@ ___
|
|
|
3116
3607
|
|
|
3117
3608
|
`Store`<[`AppState`](interfaces/AppState.md)\>
|
|
3118
3609
|
|
|
3610
|
+
The [store](https://github.com/developit/unistore#store) named `app`.
|
|
3611
|
+
|
|
3119
3612
|
#### Defined in
|
|
3120
3613
|
|
|
3121
3614
|
[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 +3619,9 @@ ___
|
|
|
3126
3619
|
|
|
3127
3620
|
▸ **getGlobalStore**<`TState`\>(`name`, `fallbackState?`): `Store`<`TState`\>
|
|
3128
3621
|
|
|
3622
|
+
Returns the existing [store](https://github.com/developit/unistore#store) named `name`,
|
|
3623
|
+
or creates a new store named `name` if none exists.
|
|
3624
|
+
|
|
3129
3625
|
#### Type parameters
|
|
3130
3626
|
|
|
3131
3627
|
| Name | Type |
|
|
@@ -3136,13 +3632,15 @@ ___
|
|
|
3136
3632
|
|
|
3137
3633
|
| Name | Type | Description |
|
|
3138
3634
|
| :------ | :------ | :------ |
|
|
3139
|
-
| `name` | `string` |
|
|
3140
|
-
| `fallbackState?` | `TState` |
|
|
3635
|
+
| `name` | `string` | The name of the store to look up. |
|
|
3636
|
+
| `fallbackState?` | `TState` | The initial value of the new store if no store named `name` exists. |
|
|
3141
3637
|
|
|
3142
3638
|
#### Returns
|
|
3143
3639
|
|
|
3144
3640
|
`Store`<`TState`\>
|
|
3145
3641
|
|
|
3642
|
+
The found or newly created store.
|
|
3643
|
+
|
|
3146
3644
|
#### Defined in
|
|
3147
3645
|
|
|
3148
3646
|
[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 +3850,22 @@ ___
|
|
|
3352
3850
|
|
|
3353
3851
|
▸ **showModal**(`extensionId`, `props?`, `onClose?`): () => `void`
|
|
3354
3852
|
|
|
3853
|
+
Shows the provided extension component in a modal dialog.
|
|
3854
|
+
|
|
3355
3855
|
#### Parameters
|
|
3356
3856
|
|
|
3357
3857
|
| Name | Type | Description |
|
|
3358
3858
|
| :------ | :------ | :------ |
|
|
3359
|
-
| `extensionId` | `string` |
|
|
3360
|
-
| `props` | `Record`<`string`, `any`\> |
|
|
3361
|
-
| `onClose` | () => `void` |
|
|
3859
|
+
| `extensionId` | `string` | The id of the extension to show. |
|
|
3860
|
+
| `props` | `Record`<`string`, `any`\> | The optional props to provide to the extension. |
|
|
3861
|
+
| `onClose` | () => `void` | The optional notification to receive when the modal is closed. |
|
|
3362
3862
|
|
|
3363
3863
|
#### Returns
|
|
3364
3864
|
|
|
3365
3865
|
`fn`
|
|
3366
3866
|
|
|
3867
|
+
The dispose function to force closing the modal dialog.
|
|
3868
|
+
|
|
3367
3869
|
▸ (): `void`
|
|
3368
3870
|
|
|
3369
3871
|
##### Returns
|
|
@@ -3380,11 +3882,13 @@ ___
|
|
|
3380
3882
|
|
|
3381
3883
|
▸ **showNotification**(`notification`): `void`
|
|
3382
3884
|
|
|
3885
|
+
Displays an inline notification in the UI.
|
|
3886
|
+
|
|
3383
3887
|
#### Parameters
|
|
3384
3888
|
|
|
3385
3889
|
| Name | Type | Description |
|
|
3386
3890
|
| :------ | :------ | :------ |
|
|
3387
|
-
| `notification` | [`NotificationDescriptor`](interfaces/NotificationDescriptor.md) |
|
|
3891
|
+
| `notification` | [`NotificationDescriptor`](interfaces/NotificationDescriptor.md) | The description of the notification to display. |
|
|
3388
3892
|
|
|
3389
3893
|
#### Returns
|
|
3390
3894
|
|
|
@@ -3400,11 +3904,13 @@ ___
|
|
|
3400
3904
|
|
|
3401
3905
|
▸ **showToast**(`toast`): `void`
|
|
3402
3906
|
|
|
3907
|
+
Displays a toast notification in the UI.
|
|
3908
|
+
|
|
3403
3909
|
#### Parameters
|
|
3404
3910
|
|
|
3405
3911
|
| Name | Type | Description |
|
|
3406
3912
|
| :------ | :------ | :------ |
|
|
3407
|
-
| `toast` | [`ToastDescriptor`](interfaces/ToastDescriptor.md) |
|
|
3913
|
+
| `toast` | [`ToastDescriptor`](interfaces/ToastDescriptor.md) | The description of the toast to display. |
|
|
3408
3914
|
|
|
3409
3915
|
#### Returns
|
|
3410
3916
|
|
|
@@ -3594,16 +4100,20 @@ ___
|
|
|
3594
4100
|
|
|
3595
4101
|
▸ **age**(`dateString`): `string`
|
|
3596
4102
|
|
|
4103
|
+
Gets a human readable age represention of the provided date string.
|
|
4104
|
+
|
|
3597
4105
|
#### Parameters
|
|
3598
4106
|
|
|
3599
4107
|
| Name | Type | Description |
|
|
3600
4108
|
| :------ | :------ | :------ |
|
|
3601
|
-
| `dateString` | `string` |
|
|
4109
|
+
| `dateString` | `string` | The stringified date. |
|
|
3602
4110
|
|
|
3603
4111
|
#### Returns
|
|
3604
4112
|
|
|
3605
4113
|
`string`
|
|
3606
4114
|
|
|
4115
|
+
A human-readable string version of the age.
|
|
4116
|
+
|
|
3607
4117
|
#### Defined in
|
|
3608
4118
|
|
|
3609
4119
|
[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 +4124,20 @@ ___
|
|
|
3614
4124
|
|
|
3615
4125
|
▸ **daysIntoYear**(`date`): `number`
|
|
3616
4126
|
|
|
4127
|
+
Gets the number of days in the year of the given date.
|
|
4128
|
+
|
|
3617
4129
|
#### Parameters
|
|
3618
4130
|
|
|
3619
4131
|
| Name | Type | Description |
|
|
3620
4132
|
| :------ | :------ | :------ |
|
|
3621
|
-
| `date` | `Date` |
|
|
4133
|
+
| `date` | `Date` | The date to compute the days within the year. |
|
|
3622
4134
|
|
|
3623
4135
|
#### Returns
|
|
3624
4136
|
|
|
3625
4137
|
`number`
|
|
3626
4138
|
|
|
4139
|
+
The number of days.
|
|
4140
|
+
|
|
3627
4141
|
#### Defined in
|
|
3628
4142
|
|
|
3629
4143
|
[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 +4148,21 @@ ___
|
|
|
3634
4148
|
|
|
3635
4149
|
▸ **isSameDay**(`firstDate`, `secondDate`): `boolean`
|
|
3636
4150
|
|
|
4151
|
+
Checks if two dates are representing the same day.
|
|
4152
|
+
|
|
3637
4153
|
#### Parameters
|
|
3638
4154
|
|
|
3639
4155
|
| Name | Type | Description |
|
|
3640
4156
|
| :------ | :------ | :------ |
|
|
3641
|
-
| `firstDate` | `Date` |
|
|
3642
|
-
| `secondDate` | `Date` |
|
|
4157
|
+
| `firstDate` | `Date` | The first date. |
|
|
4158
|
+
| `secondDate` | `Date` | The second date. |
|
|
3643
4159
|
|
|
3644
4160
|
#### Returns
|
|
3645
4161
|
|
|
3646
4162
|
`boolean`
|
|
3647
4163
|
|
|
4164
|
+
True if both are located on the same day.
|
|
4165
|
+
|
|
3648
4166
|
#### Defined in
|
|
3649
4167
|
|
|
3650
4168
|
[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 +4194,15 @@ ___
|
|
|
3676
4194
|
|
|
3677
4195
|
▸ **retry**<`T`\>(`fn`, `options?`): `Promise`<`T`\>
|
|
3678
4196
|
|
|
4197
|
+
Executes the specified function and retries executing on failure with a custom backoff strategy
|
|
4198
|
+
defined by the options.
|
|
4199
|
+
|
|
4200
|
+
If not configured otherwise, this function uses the following default options:
|
|
4201
|
+
* Retries 5 times beyond the initial attempt.
|
|
4202
|
+
* Uses an exponential backoff starting with an initial delay of 1000ms.
|
|
4203
|
+
|
|
4204
|
+
**`throws`** Rethrows the final error of running `fn` when the function stops retrying.
|
|
4205
|
+
|
|
3679
4206
|
#### Type parameters
|
|
3680
4207
|
|
|
3681
4208
|
| Name |
|
|
@@ -3686,13 +4213,15 @@ ___
|
|
|
3686
4213
|
|
|
3687
4214
|
| Name | Type | Description |
|
|
3688
4215
|
| :------ | :------ | :------ |
|
|
3689
|
-
| `fn` | () => `Promise`<`T`\> |
|
|
3690
|
-
| `options` | [`RetryOptions`](interfaces/RetryOptions.md) |
|
|
4216
|
+
| `fn` | () => `Promise`<`T`\> | The function to be executed and retried on failure. |
|
|
4217
|
+
| `options` | [`RetryOptions`](interfaces/RetryOptions.md) | Additional options which configure the retry behavior. |
|
|
3691
4218
|
|
|
3692
4219
|
#### Returns
|
|
3693
4220
|
|
|
3694
4221
|
`Promise`<`T`\>
|
|
3695
4222
|
|
|
4223
|
+
The result of successfully executing `fn`.
|
|
4224
|
+
|
|
3696
4225
|
#### Defined in
|
|
3697
4226
|
|
|
3698
4227
|
[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)
|