@faable/auth-sdk 1.3.3 → 1.3.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.
@@ -3,7 +3,7 @@ import { ApiParams, FaableApi } from "@faable/sdk-base";
3
3
  type FaableAuthApiParams = {
4
4
  team_id?: string;
5
5
  account_id?: string;
6
- api_host?: string;
6
+ domain?: string;
7
7
  } & ApiParams;
8
8
  export declare class FaableAuthApi extends FaableApi {
9
9
  constructor(params?: FaableAuthApiParams);
@@ -342,9 +342,12 @@ export declare class FaableAuthApi extends FaableApi {
342
342
  id: string;
343
343
  connection_name: string;
344
344
  connection_type: string;
345
- authorize_url?: string | null | undefined;
345
+ authorize_url: string;
346
+ token_url: string;
347
+ userinfo_url: string;
346
348
  client_id: string;
347
349
  client_secret: string;
350
+ response_type: string;
348
351
  scope: string[];
349
352
  authorize_params: {
350
353
  [key: string]: string;
@@ -360,9 +363,12 @@ export declare class FaableAuthApi extends FaableApi {
360
363
  id: string;
361
364
  connection_name: string;
362
365
  connection_type: string;
363
- authorize_url?: string | null | undefined;
366
+ authorize_url: string;
367
+ token_url: string;
368
+ userinfo_url: string;
364
369
  client_id: string;
365
370
  client_secret: string;
371
+ response_type: string;
366
372
  scope: string[];
367
373
  authorize_params: {
368
374
  [key: string]: string;
@@ -381,9 +387,12 @@ export declare class FaableAuthApi extends FaableApi {
381
387
  id: string;
382
388
  connection_name: string;
383
389
  connection_type: string;
384
- authorize_url?: string | null | undefined;
390
+ authorize_url: string;
391
+ token_url: string;
392
+ userinfo_url: string;
385
393
  client_id: string;
386
394
  client_secret: string;
395
+ response_type: string;
387
396
  scope: string[];
388
397
  authorize_params: {
389
398
  [key: string]: string;
@@ -400,9 +409,12 @@ export declare class FaableAuthApi extends FaableApi {
400
409
  id: string;
401
410
  connection_name: string;
402
411
  connection_type: string;
403
- authorize_url?: string | null | undefined;
412
+ authorize_url: string;
413
+ token_url: string;
414
+ userinfo_url: string;
404
415
  client_id: string;
405
416
  client_secret: string;
417
+ response_type: string;
406
418
  scope: string[];
407
419
  authorize_params: {
408
420
  [key: string]: string;
@@ -414,7 +426,9 @@ export declare class FaableAuthApi extends FaableApi {
414
426
  createdAt: string;
415
427
  updatedAt?: string | undefined;
416
428
  }>;
417
- listClients(): {
429
+ listClients(params?: {
430
+ client_id?: string;
431
+ }): {
418
432
  all: () => Promise<{
419
433
  id: string;
420
434
  name: string;
@@ -483,9 +497,12 @@ export declare class FaableAuthApi extends FaableApi {
483
497
  id: string;
484
498
  connection_name: string;
485
499
  connection_type: string;
486
- authorize_url?: string | null | undefined;
500
+ authorize_url: string;
501
+ token_url: string;
502
+ userinfo_url: string;
487
503
  client_id: string;
488
504
  client_secret: string;
505
+ response_type: string;
489
506
  scope: string[];
490
507
  authorize_params: {
491
508
  [key: string]: string;
@@ -1,8 +1,13 @@
1
+ import { getDomain } from "./helpers.js";
1
2
  import { FaableApi } from "@faable/sdk-base";
2
3
  export class FaableAuthApi extends FaableApi {
3
4
  constructor(params) {
5
+ let baseURL = "https://faable.auth.faable.link";
6
+ if (params?.domain) {
7
+ baseURL = getDomain(params.domain);
8
+ }
4
9
  super({
5
- baseURL: params?.api_host || "https://faable.auth.faable.link",
10
+ baseURL,
6
11
  ...params,
7
12
  fetcher: {
8
13
  ...params?.fetcher,
@@ -68,8 +73,8 @@ export class FaableAuthApi extends FaableApi {
68
73
  getConection(connection_id) {
69
74
  return this.fetcher.get(`/connection/${connection_id}`);
70
75
  }
71
- listClients() {
72
- return this.paginator({ url: "/client" });
76
+ listClients(params) {
77
+ return this.paginator({ url: "/client", params });
73
78
  }
74
79
  getClient(client_id) {
75
80
  return this.fetcher.get(`/client/${client_id}`);
@@ -0,0 +1 @@
1
+ export declare const getDomain: (domain: string) => string;
@@ -0,0 +1,7 @@
1
+ export const getDomain = (domain) => {
2
+ if (!/^(https|http)?:\/\//.test(domain)) {
3
+ const protocol = "https";
4
+ return `${protocol}//${domain}`;
5
+ }
6
+ return domain;
7
+ };
@@ -1452,9 +1452,19 @@ export interface components {
1452
1452
  id: string;
1453
1453
  connection_name: string;
1454
1454
  connection_type: string;
1455
- authorize_url?: string | null;
1455
+ /** @default null */
1456
+ authorize_url: string;
1457
+ /** @default null */
1458
+ token_url: string;
1459
+ /** @default null */
1460
+ userinfo_url: string;
1461
+ /** @default null */
1456
1462
  client_id: string;
1463
+ /** @default null */
1457
1464
  client_secret: string;
1465
+ /** @default null */
1466
+ response_type: string;
1467
+ /** @default [] */
1458
1468
  scope: string[];
1459
1469
  /**
1460
1470
  * @description Authorize params
@@ -2022,6 +2032,9 @@ export interface components {
2022
2032
  UsernamepasswordLoginBody: {
2023
2033
  username: string;
2024
2034
  password: string;
2035
+ /** @description An opaque value the applications adds to the initial request that the authorization server includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks. */
2036
+ state?: string;
2037
+ response_type?: string;
2025
2038
  client_id: string;
2026
2039
  /** @description Deprecated. Use connection_id */
2027
2040
  connection?: string;
@@ -2030,8 +2043,6 @@ export interface components {
2030
2043
  scope?: string;
2031
2044
  /** @description The URL to which Faable will redirect the browser after authorization has been granted by the user. */
2032
2045
  redirect_uri?: string;
2033
- /** @description An opaque value the applications adds to the initial request that the authorization server includes when redirecting the back to the application. This value must be used by the application to prevent CSRF attacks. */
2034
- state?: string;
2035
2046
  prompt?: string;
2036
2047
  };
2037
2048
  LoginCallbackBody: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/auth-sdk",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "author": "Marc Pomar <marc@faable.com>",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",