@faable/auth-sdk 1.2.0 → 1.3.1

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,7 +1,9 @@
1
1
  import { TeamCreate, UserCreate, UserUpdate } from "./types/types.js";
2
2
  import { ApiParams, FaableApi } from "@faable/sdk-base";
3
3
  type FaableAuthApiParams = {
4
- team: string;
4
+ team_id?: string;
5
+ account_id?: string;
6
+ api_host?: string;
5
7
  } & ApiParams;
6
8
  export declare class FaableAuthApi extends FaableApi {
7
9
  constructor(params?: FaableAuthApiParams);
@@ -335,5 +337,165 @@ export declare class FaableAuthApi extends FaableApi {
335
337
  }>>;
336
338
  };
337
339
  isUserMemberOfTeam(user_id: string, team_id: string): Promise<boolean>;
340
+ listConections(): {
341
+ all: () => Promise<{
342
+ id: string;
343
+ connection_name: string;
344
+ connection_type: string;
345
+ authorize_url?: string | null | undefined;
346
+ client_id: string;
347
+ client_secret: string;
348
+ scope: string[];
349
+ authorize_params: {
350
+ [key: string]: string;
351
+ };
352
+ account: string;
353
+ metadata: {
354
+ [key: string]: unknown;
355
+ };
356
+ createdAt: string;
357
+ updatedAt?: string | undefined;
358
+ }[]>;
359
+ first: () => Promise<import("@faable/sdk-base/dist/helpers/paginator.js").Page<{
360
+ id: string;
361
+ connection_name: string;
362
+ connection_type: string;
363
+ authorize_url?: string | null | undefined;
364
+ client_id: string;
365
+ client_secret: string;
366
+ scope: string[];
367
+ authorize_params: {
368
+ [key: string]: string;
369
+ };
370
+ account: string;
371
+ metadata: {
372
+ [key: string]: unknown;
373
+ };
374
+ createdAt: string;
375
+ updatedAt?: string | undefined;
376
+ }>>;
377
+ pass: (params?: {
378
+ cursor?: string | undefined;
379
+ pageSize?: string | undefined;
380
+ } | undefined) => Promise<import("@faable/sdk-base/dist/helpers/paginator.js").Page<{
381
+ id: string;
382
+ connection_name: string;
383
+ connection_type: string;
384
+ authorize_url?: string | null | undefined;
385
+ client_id: string;
386
+ client_secret: string;
387
+ scope: string[];
388
+ authorize_params: {
389
+ [key: string]: string;
390
+ };
391
+ account: string;
392
+ metadata: {
393
+ [key: string]: unknown;
394
+ };
395
+ createdAt: string;
396
+ updatedAt?: string | undefined;
397
+ }>>;
398
+ };
399
+ getConection(connection_id: string): Promise<{
400
+ id: string;
401
+ connection_name: string;
402
+ connection_type: string;
403
+ authorize_url?: string | null | undefined;
404
+ client_id: string;
405
+ client_secret: string;
406
+ scope: string[];
407
+ authorize_params: {
408
+ [key: string]: string;
409
+ };
410
+ account: string;
411
+ metadata: {
412
+ [key: string]: unknown;
413
+ };
414
+ createdAt: string;
415
+ updatedAt?: string | undefined;
416
+ }>;
417
+ listClients(): {
418
+ all: () => Promise<{
419
+ id: string;
420
+ name: string;
421
+ description: string;
422
+ client_id: string;
423
+ client_secret: string;
424
+ callbacks: string[];
425
+ logout_urls: string[];
426
+ refresh_token: {
427
+ expiration_mode: "expire" | "not-expire";
428
+ infinite_token_lifetime: boolean;
429
+ token_lifetime: number;
430
+ };
431
+ account: string;
432
+ metadata: {
433
+ [key: string]: unknown;
434
+ };
435
+ createdAt: string;
436
+ updatedAt?: string | undefined;
437
+ }[]>;
438
+ first: () => Promise<import("@faable/sdk-base/dist/helpers/paginator.js").Page<{
439
+ id: string;
440
+ name: string;
441
+ description: string;
442
+ client_id: string;
443
+ client_secret: string;
444
+ callbacks: string[];
445
+ logout_urls: string[];
446
+ refresh_token: {
447
+ expiration_mode: "expire" | "not-expire";
448
+ infinite_token_lifetime: boolean;
449
+ token_lifetime: number;
450
+ };
451
+ account: string;
452
+ metadata: {
453
+ [key: string]: unknown;
454
+ };
455
+ createdAt: string;
456
+ updatedAt?: string | undefined;
457
+ }>>;
458
+ pass: (params?: {
459
+ cursor?: string | undefined;
460
+ pageSize?: string | undefined;
461
+ } | undefined) => Promise<import("@faable/sdk-base/dist/helpers/paginator.js").Page<{
462
+ id: string;
463
+ name: string;
464
+ description: string;
465
+ client_id: string;
466
+ client_secret: string;
467
+ callbacks: string[];
468
+ logout_urls: string[];
469
+ refresh_token: {
470
+ expiration_mode: "expire" | "not-expire";
471
+ infinite_token_lifetime: boolean;
472
+ token_lifetime: number;
473
+ };
474
+ account: string;
475
+ metadata: {
476
+ [key: string]: unknown;
477
+ };
478
+ createdAt: string;
479
+ updatedAt?: string | undefined;
480
+ }>>;
481
+ };
482
+ getClient(client_id: string): Promise<{
483
+ id: string;
484
+ connection_name: string;
485
+ connection_type: string;
486
+ authorize_url?: string | null | undefined;
487
+ client_id: string;
488
+ client_secret: string;
489
+ scope: string[];
490
+ authorize_params: {
491
+ [key: string]: string;
492
+ };
493
+ account: string;
494
+ metadata: {
495
+ [key: string]: unknown;
496
+ };
497
+ createdAt: string;
498
+ updatedAt?: string | undefined;
499
+ }>;
338
500
  }
339
501
  export {};
@@ -2,13 +2,16 @@ import { FaableApi } from "@faable/sdk-base";
2
2
  export class FaableAuthApi extends FaableApi {
3
3
  constructor(params) {
4
4
  super({
5
+ baseURL: params?.api_host || "https://faable.auth.faable.link",
5
6
  ...params,
6
- baseURL: "https://faable.auth.faable.link",
7
7
  fetcher: {
8
8
  ...params?.fetcher,
9
9
  headers: {
10
10
  ...params?.fetcher?.headers,
11
- "x-faable-team": params?.team,
11
+ ...(params?.team_id && { "x-faable-team": params.team_id }),
12
+ ...(params?.account_id && {
13
+ "x-faableauth-account": params.account_id,
14
+ }),
12
15
  },
13
16
  },
14
17
  });
@@ -59,4 +62,16 @@ export class FaableAuthApi extends FaableApi {
59
62
  isUserMemberOfTeam(user_id, team_id) {
60
63
  return this.fetcher.check(`/team/${team_id}/member/check/${user_id}`);
61
64
  }
65
+ listConections() {
66
+ return this.paginator({ url: "/connection" });
67
+ }
68
+ getConection(connection_id) {
69
+ return this.fetcher.get(`/connection/${connection_id}`);
70
+ }
71
+ listClients() {
72
+ return this.paginator({ url: "/client" });
73
+ }
74
+ getClient(client_id) {
75
+ return this.fetcher.get(`/client/${client_id}`);
76
+ }
62
77
  }
@@ -115,6 +115,18 @@ export interface paths {
115
115
  };
116
116
  };
117
117
  };
118
+ /**
119
+ * Delete an Account
120
+ * @description Delete an Account
121
+ */
122
+ delete: {
123
+ parameters: {
124
+ path: {
125
+ account_id: string;
126
+ };
127
+ };
128
+ responses: {};
129
+ };
118
130
  };
119
131
  "/account/host/{host}": {
120
132
  /**
@@ -6,3 +6,5 @@ export type Team = components["schemas"]["Team"];
6
6
  export type TeamMember = components["schemas"]["TeamMember"];
7
7
  export type TeamCreate = components["schemas"]["TeamCreate"];
8
8
  export type AuthAccount = components["schemas"]["AuthAccount"];
9
+ export type Connection = components["schemas"]["Connection"];
10
+ export type Client = components["schemas"]["Client"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",