@intellegens/cornerstone-client 0.0.36 → 0.0.37

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.
@@ -14,5 +14,5 @@ export type ReadSelectedSearchDefinitionDto = {
14
14
  /**
15
15
  * Nested search definitions for complex queries.
16
16
  */
17
- nestedSearchCriteria?: ReadSelectedSearchPropertyDefinitionDto[];
17
+ nestedSearchCriteria?: ReadSelectedSearchDefinitionDto[];
18
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intellegens/cornerstone-client",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -22,10 +22,10 @@ export declare class AuthService<TKey, TUser extends UserDto<TKey> = UserDto<TKe
22
22
  /**
23
23
  * Checks if user is authenticated and retrieves the current user's details if they are
24
24
  *
25
- * @return {Promise<TUser>} Currently logged in user's details
25
+ * @return {Promise<UserInfoDto<TKey, TUser>>} Currently logged in user's details
26
26
  * @throws {Error} Error if fetch fails
27
27
  */
28
- whoAmI(): Promise<ApiSuccessResponse<TUser | undefined, EmptyMetadata>>;
28
+ whoAmI(): Promise<ApiSuccessResponse<UserInfoDto<TKey, TUser> | undefined, EmptyMetadata>>;
29
29
  /**
30
30
  * Authenticates a user using their username and password, and retrieves user's details
31
31
  *
@@ -24,7 +24,7 @@ export class AuthService {
24
24
  /**
25
25
  * Checks if user is authenticated and retrieves the current user's details if they are
26
26
  *
27
- * @return {Promise<TUser>} Currently logged in user's details
27
+ * @return {Promise<UserInfoDto<TKey, TUser>>} Currently logged in user's details
28
28
  * @throws {Error} Error if fetch fails
29
29
  */
30
30
  async whoAmI() {
@@ -42,8 +42,8 @@ export class AuthService {
42
42
  const { success, result, metadata, error } = (await res.json());
43
43
  if (!success)
44
44
  throw new Error(error.message);
45
- this.user = result;
46
- return { result: this.user, metadata };
45
+ this.user = result.user;
46
+ return { result: { user: this.user, accessTokenExpiry: result.accessTokenExpiry }, metadata };
47
47
  }
48
48
  catch (err) {
49
49
  // TODO: Extract error from well-formed response
@@ -73,7 +73,7 @@ export class AuthService {
73
73
  const { result, metadata } = await this.whoAmI();
74
74
  if (result === undefined)
75
75
  throw undefined;
76
- this.user = result;
76
+ this.user = result.user;
77
77
  return { result: this.user, metadata };
78
78
  }
79
79
  catch (err) {