@faable/auth-sdk 1.0.3 → 1.0.5

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.
@@ -8,4 +8,33 @@ export declare class FaableAuthApi {
8
8
  getUserMetadata(user_id: string): Promise<{
9
9
  [key: string]: unknown;
10
10
  }>;
11
+ getUser(user_id: any): Promise<{
12
+ id: string;
13
+ name?: string;
14
+ username?: string;
15
+ given_name?: string;
16
+ family_name?: string;
17
+ email?: string;
18
+ email_verified: boolean;
19
+ phone?: string;
20
+ phone_verified: boolean;
21
+ country_iso?: string;
22
+ birth_date?: string;
23
+ locale: string;
24
+ region?: string;
25
+ picture?: string;
26
+ logins_count: number;
27
+ last_ip?: string;
28
+ last_login?: string;
29
+ user_metadata: {
30
+ [key: string]: unknown;
31
+ };
32
+ app_metadata: {
33
+ [key: string]: unknown;
34
+ };
35
+ account: string;
36
+ createdAt: string;
37
+ updatedAt?: string;
38
+ }>;
39
+ isUserMemberOfTeam(user_id: string, team_id: string): Promise<boolean>;
11
40
  }
@@ -32,5 +32,15 @@ class FaableAuthApi {
32
32
  return (await handleError(this.client.get(`/user/${user_id}`)))
33
33
  .user_metadata;
34
34
  }
35
+ async getUser(user_id) {
36
+ return await handleError(this.client.get(`/user/${user_id}`));
37
+ }
38
+ async isUserMemberOfTeam(user_id, team_id) {
39
+ const members_res = await this.client.get(`/team/${team_id}/member/check/${user_id}`, {
40
+ validateStatus: () => true,
41
+ });
42
+ // Check access via status
43
+ return members_res.status == 200;
44
+ }
35
45
  }
36
46
  exports.FaableAuthApi = FaableAuthApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",