@faable/auth-sdk 1.0.15 → 1.0.16

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,6 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { TeamCreate, UserCreate, UserUpdate } from "./types";
3
- import { FaablePaginator } from "./paginator";
3
+ import { FaablePaginator, Page } from "./paginator";
4
4
  export declare class FaableAuthApi {
5
5
  client: AxiosInstance;
6
6
  paginator: FaablePaginator;
@@ -42,6 +42,34 @@ export declare class FaableAuthApi {
42
42
  createdAt: string;
43
43
  updatedAt?: string;
44
44
  }[]>;
45
+ first: () => Promise<Page<{
46
+ id: string;
47
+ name?: string;
48
+ username?: string;
49
+ given_name?: string;
50
+ family_name?: string;
51
+ email?: string;
52
+ email_verified: boolean;
53
+ phone?: string;
54
+ phone_verified: boolean;
55
+ country_iso?: string;
56
+ birth_date?: string;
57
+ locale: string;
58
+ region?: string;
59
+ picture?: string;
60
+ logins_count: number;
61
+ last_ip?: string;
62
+ last_login?: string;
63
+ user_metadata: {
64
+ [key: string]: unknown;
65
+ };
66
+ app_metadata: {
67
+ [key: string]: unknown;
68
+ };
69
+ account: string;
70
+ createdAt: string;
71
+ updatedAt?: string;
72
+ }>>;
45
73
  };
46
74
  getUser(user_id: any): Promise<{
47
75
  id: string;
@@ -169,6 +197,19 @@ export declare class FaableAuthApi {
169
197
  createdAt: string;
170
198
  updatedAt?: string;
171
199
  }[]>;
200
+ first: () => Promise<Page<{
201
+ id: string;
202
+ name: string;
203
+ slug: string;
204
+ description: string;
205
+ logo_url: string;
206
+ metadata: {
207
+ [key: string]: unknown;
208
+ };
209
+ account: string;
210
+ createdAt: string;
211
+ updatedAt?: string;
212
+ }>>;
172
213
  };
173
214
  listTeamMembers(params: {
174
215
  query?: string;
@@ -185,6 +226,18 @@ export declare class FaableAuthApi {
185
226
  createdAt: string;
186
227
  updatedAt?: string;
187
228
  }[]>;
229
+ first: () => Promise<Page<{
230
+ id: string;
231
+ user: unknown;
232
+ team: unknown;
233
+ roles: unknown[];
234
+ metadata: {
235
+ [key: string]: unknown;
236
+ };
237
+ account: string;
238
+ createdAt: string;
239
+ updatedAt?: string;
240
+ }>>;
188
241
  };
189
242
  isUserMemberOfTeam(user_id: string, team_id: string): Promise<boolean>;
190
243
  }
@@ -1,8 +1,13 @@
1
1
  import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ export interface Page<T> {
3
+ next: string | null;
4
+ results: T[];
5
+ }
2
6
  export declare class FaablePaginator {
3
7
  client: AxiosInstance;
4
8
  constructor(client: AxiosInstance);
5
9
  paginate<T>(req: AxiosRequestConfig): {
6
10
  all: () => Promise<T[]>;
11
+ first: () => Promise<Page<T>>;
7
12
  };
8
13
  }
package/dist/paginator.js CHANGED
@@ -7,9 +7,9 @@ class FaablePaginator {
7
7
  this.client = client;
8
8
  }
9
9
  paginate(req) {
10
- const pages = [];
11
10
  return {
12
11
  all: async () => {
12
+ const pages = [];
13
13
  let res;
14
14
  do {
15
15
  res = await this.client.request({
@@ -20,6 +20,10 @@ class FaablePaginator {
20
20
  } while (res.data.next);
21
21
  return pages.map((page) => page.results).flat();
22
22
  },
23
+ first: async () => {
24
+ const res = await this.client.request(req);
25
+ return res.data;
26
+ },
23
27
  };
24
28
  }
25
29
  }
@@ -550,8 +550,10 @@ export interface paths {
550
550
  };
551
551
  responses: {
552
552
  /** @description Default Response */
553
- 200: {
554
- content: never;
553
+ 201: {
554
+ content: {
555
+ "application/json": components["schemas"]["TeamMember"];
556
+ };
555
557
  };
556
558
  };
557
559
  };
@@ -993,27 +995,6 @@ export interface components {
993
995
  /** @description TeamMember updated date */
994
996
  updatedAt?: string;
995
997
  };
996
- /** @description TeamCreate */
997
- TeamCreate: {
998
- name: string;
999
- description?: string;
1000
- metadata?: {
1001
- [key: string]: unknown;
1002
- };
1003
- };
1004
- /** @description TeamUpdate */
1005
- TeamUpdate: {
1006
- /** @description name */
1007
- name?: string;
1008
- /** @description description */
1009
- description?: string;
1010
- metadata?: {
1011
- [key: string]: unknown;
1012
- };
1013
- };
1014
- TeamMemberCreate: {
1015
- users: string[];
1016
- };
1017
998
  /** @description Team paginated response */
1018
999
  TeamPage: {
1019
1000
  /** @description next cursor */
@@ -1028,6 +1009,17 @@ export interface components {
1028
1009
  /** @description list of results */
1029
1010
  results: components["schemas"]["TeamMember"][];
1030
1011
  };
1012
+ /** @description TeamCreate */
1013
+ TeamCreate: {
1014
+ name: string;
1015
+ description?: string;
1016
+ metadata?: {
1017
+ [key: string]: unknown;
1018
+ };
1019
+ };
1020
+ TeamMemberCreate: {
1021
+ users: string[];
1022
+ };
1031
1023
  /** @description Webhook */
1032
1024
  Webhook: {
1033
1025
  /** @description Webhook ID */
@@ -1135,6 +1127,16 @@ export interface components {
1135
1127
  RoleMemberCreate: {
1136
1128
  users: string[];
1137
1129
  };
1130
+ /** @description TeamUpdate */
1131
+ TeamUpdate: {
1132
+ /** @description name */
1133
+ name?: string;
1134
+ /** @description description */
1135
+ description?: string;
1136
+ metadata?: {
1137
+ [key: string]: unknown;
1138
+ };
1139
+ };
1138
1140
  };
1139
1141
  responses: never;
1140
1142
  parameters: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",