@faable/auth-sdk 1.0.15 → 1.0.17

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,65 @@ 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
+ }>>;
73
+ pass: (params?: {
74
+ cursor?: string;
75
+ pageSize?: string;
76
+ }) => Promise<Page<{
77
+ id: string;
78
+ name?: string;
79
+ username?: string;
80
+ given_name?: string;
81
+ family_name?: string;
82
+ email?: string;
83
+ email_verified: boolean;
84
+ phone?: string;
85
+ phone_verified: boolean;
86
+ country_iso?: string;
87
+ birth_date?: string;
88
+ locale: string;
89
+ region?: string;
90
+ picture?: string;
91
+ logins_count: number;
92
+ last_ip?: string;
93
+ last_login?: string;
94
+ user_metadata: {
95
+ [key: string]: unknown;
96
+ };
97
+ app_metadata: {
98
+ [key: string]: unknown;
99
+ };
100
+ account: string;
101
+ createdAt: string;
102
+ updatedAt?: string;
103
+ }>>;
45
104
  };
46
105
  getUser(user_id: any): Promise<{
47
106
  id: string;
@@ -169,6 +228,35 @@ export declare class FaableAuthApi {
169
228
  createdAt: string;
170
229
  updatedAt?: string;
171
230
  }[]>;
231
+ first: () => Promise<Page<{
232
+ id: string;
233
+ name: string;
234
+ slug: string;
235
+ description: string;
236
+ logo_url: string;
237
+ metadata: {
238
+ [key: string]: unknown;
239
+ };
240
+ account: string;
241
+ createdAt: string;
242
+ updatedAt?: string;
243
+ }>>;
244
+ pass: (params?: {
245
+ cursor?: string;
246
+ pageSize?: string;
247
+ }) => Promise<Page<{
248
+ id: string;
249
+ name: string;
250
+ slug: string;
251
+ description: string;
252
+ logo_url: string;
253
+ metadata: {
254
+ [key: string]: unknown;
255
+ };
256
+ account: string;
257
+ createdAt: string;
258
+ updatedAt?: string;
259
+ }>>;
172
260
  };
173
261
  listTeamMembers(params: {
174
262
  query?: string;
@@ -185,6 +273,33 @@ export declare class FaableAuthApi {
185
273
  createdAt: string;
186
274
  updatedAt?: string;
187
275
  }[]>;
276
+ first: () => Promise<Page<{
277
+ id: string;
278
+ user: unknown;
279
+ team: unknown;
280
+ roles: unknown[];
281
+ metadata: {
282
+ [key: string]: unknown;
283
+ };
284
+ account: string;
285
+ createdAt: string;
286
+ updatedAt?: string;
287
+ }>>;
288
+ pass: (params?: {
289
+ cursor?: string;
290
+ pageSize?: string;
291
+ }) => Promise<Page<{
292
+ id: string;
293
+ user: unknown;
294
+ team: unknown;
295
+ roles: unknown[];
296
+ metadata: {
297
+ [key: string]: unknown;
298
+ };
299
+ account: string;
300
+ createdAt: string;
301
+ updatedAt?: string;
302
+ }>>;
188
303
  };
189
304
  isUserMemberOfTeam(user_id: string, team_id: string): Promise<boolean>;
190
305
  }
@@ -1,8 +1,17 @@
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>>;
12
+ pass: (params?: {
13
+ cursor?: string;
14
+ pageSize?: string;
15
+ }) => Promise<Page<T>>;
7
16
  };
8
17
  }
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,20 @@ 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
+ },
27
+ pass: async (params = {}) => {
28
+ const res = await this.client.request({
29
+ ...req,
30
+ params: {
31
+ ...req.params,
32
+ ...params,
33
+ },
34
+ });
35
+ return res.data;
36
+ },
23
37
  };
24
38
  }
25
39
  }
@@ -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.17",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",