@openmrs/esm-api 6.3.1-pre.3106 → 6.3.1-pre.3119

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: 13 files with swc (61.33ms)
1
+ [0] Successfully compiled: 13 files with swc (94.78ms)
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
@@ -19,7 +19,7 @@ export declare const sessionStore: import("zustand").StoreApi<SessionStore>;
19
19
  * Subsequent values will be produced whenever the user object is
20
20
  * updated.
21
21
  *
22
- * @param options An object with `includeAuthStatus` boolean
22
+ * @param opts An object with `includeAuthStatus` boolean
23
23
  * property that defaults to `false`. When `includeAuthStatus` is set
24
24
  * to `true`, the entire response object from the API will be provided.
25
25
  * When `includeAuthStatus` is set to `false`, only the `user` property
@@ -126,7 +126,9 @@ export function getLoggedInUser() {
126
126
  if (state.loaded && state.session.user) {
127
127
  user = state.session.user;
128
128
  res(state.session.user);
129
- unsubscribe && unsubscribe();
129
+ if (unsubscribe) {
130
+ unsubscribe();
131
+ }
130
132
  }
131
133
  };
132
134
  handler(sessionStore.getState());
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
3
3
  import type { FetchResponse } from './types';
4
4
  export declare const restBaseUrl = "/ws/rest/v1";
5
5
  export declare const fhirBaseUrl = "/ws/fhir2/R4";
6
- export declare const sessionEndpoint: string;
6
+ export declare const sessionEndpoint = "/ws/rest/v1/session";
7
7
  /**
8
8
  * Append `path` to the OpenMRS SPA base.
9
9
  *
@@ -1 +1,2 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
1
2
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-api",
3
- "version": "6.3.1-pre.3106",
3
+ "version": "6.3.1-pre.3119",
4
4
  "license": "MPL-2.0",
5
5
  "description": "The javascript module for interacting with the OpenMRS API",
6
6
  "type": "module",
@@ -61,10 +61,10 @@
61
61
  "@openmrs/esm-navigation": "6.x"
62
62
  },
63
63
  "devDependencies": {
64
- "@openmrs/esm-config": "6.3.1-pre.3106",
65
- "@openmrs/esm-error-handling": "6.3.1-pre.3106",
66
- "@openmrs/esm-globals": "6.3.1-pre.3106",
67
- "@openmrs/esm-navigation": "6.3.1-pre.3106",
64
+ "@openmrs/esm-config": "6.3.1-pre.3119",
65
+ "@openmrs/esm-error-handling": "6.3.1-pre.3119",
66
+ "@openmrs/esm-globals": "6.3.1-pre.3119",
67
+ "@openmrs/esm-navigation": "6.3.1-pre.3119",
68
68
  "@swc/cli": "^0.7.7",
69
69
  "@swc/core": "^1.11.29",
70
70
  "concurrently": "^9.1.2",
@@ -33,7 +33,7 @@ let lastFetchTimeMillis = 0;
33
33
  * Subsequent values will be produced whenever the user object is
34
34
  * updated.
35
35
  *
36
- * @param options An object with `includeAuthStatus` boolean
36
+ * @param opts An object with `includeAuthStatus` boolean
37
37
  * property that defaults to `false`. When `includeAuthStatus` is set
38
38
  * to `true`, the entire response object from the API will be provided.
39
39
  * When `includeAuthStatus` is set to `false`, only the `user` property
@@ -199,14 +199,17 @@ export function userHasAccess(
199
199
  }
200
200
 
201
201
  export function getLoggedInUser() {
202
- let user;
203
- let unsubscribe;
202
+ let user: LoggedInUser;
203
+ let unsubscribe: () => void;
204
204
  return new Promise<LoggedInUser>((res) => {
205
205
  const handler = (state: SessionStore) => {
206
206
  if (state.loaded && state.session.user) {
207
207
  user = state.session.user;
208
208
  res(state.session.user);
209
- unsubscribe && unsubscribe();
209
+
210
+ if (unsubscribe) {
211
+ unsubscribe();
212
+ }
210
213
  }
211
214
  };
212
215
  handler(sessionStore.getState());
@@ -64,6 +64,7 @@ export interface Role {
64
64
  links: Array<any>;
65
65
  }
66
66
 
67
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
67
68
  export interface User extends OpenmrsResource {
68
69
  // TODO: add more attributes
69
70
  }