@openmrs/esm-api 10.0.1-pre.5136 → 10.0.1-pre.5147

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.
@@ -1,3 +1,3 @@
1
- [0] Successfully compiled: 14 files with swc (86.59ms)
1
+ [0] Successfully compiled: 14 files with swc (110.69ms)
2
2
  [0] swc --strip-leading-paths src -d dist exited with code 0
3
3
  [1] tsc --project tsconfig.build.json exited with code 0
@@ -1 +1 @@
1
- {"version":3,"file":"current-user.d.ts","sourceRoot":"","sources":["../src/current-user.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAiB,MAAM,SAAS,CAAC;AAEtG,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,YAAY,0CAGvB,CAAC;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,iBAAS,cAAc,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/C;;;;;GAKG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,IAAI,CAAA;CAAE,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;AAChF;;;;;GAKG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,KAAK,CAAA;CAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AAuBtF,OAAO,EAAE,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;IAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;CAAE,WAa3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,0BAmB9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,yCAOjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,CAW7G;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE;IACd,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,EACD,eAAe,CAAC,EAAE,eAAe,GAChC,OAAO,CAAC,YAAY,CAAC,CAcvB"}
@@ -78,6 +78,10 @@ function isValidLocale(locale) {
78
78
  * @param data The session object containing locale information.
79
79
  */ export function setUserLanguage(data) {
80
80
  let locale = data.locale ?? data.user?.userProperties?.defaultLocale;
81
+ // Only underscores are converted here, deliberately, rather than reusing `toLanguageTag`. i18next
82
+ // reads this value back off `document.lang` and uses it as the translation bundle key, and those
83
+ // bundles are named with the POSIX form (`uz@Latn.json`), so converting `@` would send the loader
84
+ // after a bundle that does not exist.
81
85
  if (locale && locale.includes('_')) {
82
86
  locale = locale.replaceAll('_', '-');
83
87
  }
package/mock-jest.ts CHANGED
@@ -20,3 +20,4 @@ export const refetchCurrentUser = jest.fn();
20
20
  export const setUserLanguage = jest.fn();
21
21
  export const setUserProperties = jest.fn();
22
22
  export const userHasAccess = jest.fn();
23
+ export { OpenmrsFetchError } from './src/openmrs-fetch';
package/mock.ts CHANGED
@@ -21,3 +21,4 @@ export const refetchCurrentUser = vi.fn();
21
21
  export const setUserLanguage = vi.fn();
22
22
  export const setUserProperties = vi.fn();
23
23
  export const userHasAccess = vi.fn();
24
+ export { OpenmrsFetchError } from './src/openmrs-fetch';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-api",
3
- "version": "10.0.1-pre.5136",
3
+ "version": "10.0.1-pre.5147",
4
4
  "license": "MPL-2.0",
5
5
  "description": "The javascript module for interacting with the OpenMRS API",
6
6
  "type": "module",
@@ -56,16 +56,16 @@
56
56
  "lodash-es": "^4.17.21"
57
57
  },
58
58
  "peerDependencies": {
59
- "@openmrs/esm-config": "^10.0.1-pre.5136",
60
- "@openmrs/esm-error-handling": "^10.0.1-pre.5136",
61
- "@openmrs/esm-globals": "^10.0.1-pre.5136",
62
- "@openmrs/esm-navigation": "^10.0.1-pre.5136"
59
+ "@openmrs/esm-config": "^10.0.1-pre.5147",
60
+ "@openmrs/esm-error-handling": "^10.0.1-pre.5147",
61
+ "@openmrs/esm-globals": "^10.0.1-pre.5147",
62
+ "@openmrs/esm-navigation": "^10.0.1-pre.5147"
63
63
  },
64
64
  "devDependencies": {
65
- "@openmrs/esm-config": "10.0.1-pre.5136",
66
- "@openmrs/esm-error-handling": "10.0.1-pre.5136",
67
- "@openmrs/esm-globals": "10.0.1-pre.5136",
68
- "@openmrs/esm-navigation": "10.0.1-pre.5136",
65
+ "@openmrs/esm-config": "10.0.1-pre.5147",
66
+ "@openmrs/esm-error-handling": "10.0.1-pre.5147",
67
+ "@openmrs/esm-globals": "10.0.1-pre.5147",
68
+ "@openmrs/esm-navigation": "10.0.1-pre.5147",
69
69
  "@swc/cli": "0.8.1",
70
70
  "@swc/core": "1.15.21",
71
71
  "@vitest/coverage-v8": "^4.1.2",
@@ -157,6 +157,10 @@ function isValidLocale(locale: unknown): locale is string {
157
157
  export function setUserLanguage(data: Session) {
158
158
  let locale = data.locale ?? data.user?.userProperties?.defaultLocale;
159
159
 
160
+ // Only underscores are converted here, deliberately, rather than reusing `toLanguageTag`. i18next
161
+ // reads this value back off `document.lang` and uses it as the translation bundle key, and those
162
+ // bundles are named with the POSIX form (`uz@Latn.json`), so converting `@` would send the loader
163
+ // after a bundle that does not exist.
160
164
  if (locale && locale.includes('_')) {
161
165
  locale = locale.replaceAll('_', '-');
162
166
  }