@frontegg/rest-api 3.1.73 → 3.1.74-alpha.9436511986

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.
Files changed (125) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +39 -0
  3. package/ContextHolder/index.d.ts +81 -24
  4. package/ContextHolder/index.js +55 -43
  5. package/FetchClient.d.ts +35 -0
  6. package/FetchClient.js +286 -0
  7. package/account-settings/index.d.ts +19 -7
  8. package/account-settings/index.js +23 -13
  9. package/applications/index.d.ts +49 -44
  10. package/applications/index.js +51 -37
  11. package/audits/index.d.ts +27 -15
  12. package/audits/index.js +27 -17
  13. package/auth/index.d.ts +764 -768
  14. package/auth/index.js +875 -721
  15. package/auth/secutiry-poilicy/index.d.ts +58 -102
  16. package/auth/secutiry-poilicy/index.js +122 -90
  17. package/auth/utils.d.ts +2 -2
  18. package/auth/utils.js +10 -9
  19. package/connectivity/index.d.ts +125 -26
  20. package/connectivity/index.js +147 -114
  21. package/directory/index.d.ts +31 -22
  22. package/directory/index.js +27 -15
  23. package/entitlements/index.d.ts +14 -8
  24. package/entitlements/index.js +12 -4
  25. package/feature-flags/index.d.ts +8 -2
  26. package/feature-flags/index.js +16 -8
  27. package/groups/index.d.ts +73 -49
  28. package/groups/index.js +64 -45
  29. package/impersonate/index.d.ts +15 -6
  30. package/impersonate/index.js +13 -5
  31. package/index.d.ts +174 -108
  32. package/index.js +108 -79
  33. package/interfaces.d.ts +10 -0
  34. package/metadata/index.d.ts +67 -7
  35. package/metadata/index.js +52 -32
  36. package/node/BaseApiClient.js +49 -0
  37. package/node/ContextHolder/index.js +59 -44
  38. package/node/FetchClient.js +311 -0
  39. package/node/account-settings/index.js +27 -16
  40. package/node/applications/index.js +51 -44
  41. package/node/audits/index.js +31 -20
  42. package/node/auth/index.js +746 -1036
  43. package/node/auth/secutiry-poilicy/index.js +125 -136
  44. package/node/auth/utils.js +9 -7
  45. package/node/connectivity/index.js +148 -187
  46. package/node/directory/index.js +29 -20
  47. package/node/entitlements/index.js +18 -5
  48. package/node/feature-flags/index.js +21 -9
  49. package/node/groups/index.js +65 -63
  50. package/node/impersonate/index.js +18 -5
  51. package/node/index.js +127 -71
  52. package/node/metadata/index.js +61 -52
  53. package/node/notifications/index.js +37 -27
  54. package/node/reports/index.js +78 -70
  55. package/node/roles/index.js +56 -51
  56. package/node/security-center/index.js +21 -9
  57. package/node/sub-tenants/index.js +83 -73
  58. package/node/sub-tenants/interfaces.js +10 -1
  59. package/node/subscriptions/index.js +79 -107
  60. package/node/subscriptions/invoices.js +25 -17
  61. package/node/subscriptions/managedSubscriptions.js +32 -27
  62. package/node/subscriptions/paymentMethods.js +27 -20
  63. package/node/subscriptions/paymentProviders.js +15 -6
  64. package/node/subscriptions/plans.js +17 -9
  65. package/node/subscriptions/providers/stripe/index.js +26 -21
  66. package/node/subscriptions/subscriptions.js +32 -27
  67. package/node/subscriptions/summaries.js +15 -6
  68. package/node/subscriptions/tenantConfiguration.js +17 -9
  69. package/node/subscriptions/vendorPublicConfigurations.js +15 -6
  70. package/node/teams/index.js +130 -138
  71. package/node/tenants/index.js +65 -60
  72. package/node/user-phone-numbers/index.js +32 -24
  73. package/node/users/index.js +58 -53
  74. package/node/vendor/index.js +17 -6
  75. package/notifications/index.d.ts +22 -16
  76. package/notifications/index.js +33 -22
  77. package/package.json +1 -1
  78. package/reports/index.d.ts +50 -44
  79. package/reports/index.js +75 -62
  80. package/roles/index.d.ts +44 -38
  81. package/roles/index.js +57 -41
  82. package/security-center/index.d.ts +14 -2
  83. package/security-center/index.js +15 -6
  84. package/sub-tenants/index.d.ts +57 -14
  85. package/sub-tenants/index.js +88 -61
  86. package/sub-tenants/interfaces.d.ts +8 -0
  87. package/sub-tenants/interfaces.js +7 -1
  88. package/subscriptions/index.d.ts +56 -11
  89. package/subscriptions/index.js +68 -11
  90. package/subscriptions/invoices.d.ts +16 -13
  91. package/subscriptions/invoices.js +24 -14
  92. package/subscriptions/managedSubscriptions.d.ts +18 -15
  93. package/subscriptions/managedSubscriptions.js +33 -22
  94. package/subscriptions/paymentMethods.d.ts +16 -13
  95. package/subscriptions/paymentMethods.js +26 -17
  96. package/subscriptions/paymentProviders.d.ts +8 -5
  97. package/subscriptions/paymentProviders.js +11 -4
  98. package/subscriptions/plans.d.ts +11 -8
  99. package/subscriptions/plans.js +14 -6
  100. package/subscriptions/providers/stripe/index.d.ts +24 -21
  101. package/subscriptions/providers/stripe/index.js +27 -16
  102. package/subscriptions/subscriptions.d.ts +24 -21
  103. package/subscriptions/subscriptions.js +33 -22
  104. package/subscriptions/summaries.d.ts +7 -4
  105. package/subscriptions/summaries.js +10 -3
  106. package/subscriptions/tenantConfiguration.d.ts +6 -3
  107. package/subscriptions/tenantConfiguration.js +15 -7
  108. package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
  109. package/subscriptions/vendorPublicConfigurations.js +11 -4
  110. package/teams/index.d.ts +35 -131
  111. package/teams/index.js +122 -93
  112. package/tenants/index.d.ts +25 -37
  113. package/tenants/index.js +63 -47
  114. package/user-phone-numbers/index.d.ts +32 -26
  115. package/user-phone-numbers/index.js +32 -19
  116. package/users/index.d.ts +21 -15
  117. package/users/index.js +60 -44
  118. package/vendor/index.d.ts +12 -6
  119. package/vendor/index.js +11 -4
  120. package/fetch.d.ts +0 -24
  121. package/fetch.js +0 -265
  122. package/node/fetch.js +0 -306
  123. package/node/subscriptions/providers/index.js +0 -18
  124. package/subscriptions/providers/index.d.ts +0 -1
  125. package/subscriptions/providers/index.js +0 -1
@@ -0,0 +1,16 @@
1
+ import { FetchClient } from './FetchClient';
2
+ import { RequestOptions, UserJwtOptions } from './interfaces';
3
+ export declare class BaseApiClient {
4
+ protected appName: string;
5
+ protected fetchClient: FetchClient;
6
+ protected constructor(appName: string);
7
+ protected get: <T>(url: string, params?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<T>;
8
+ protected post: <T>(url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<T>;
9
+ protected patch: <T>(url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<T>;
10
+ protected put: <T>(url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<T>;
11
+ protected delete: <T>(url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<T>;
12
+ protected postDownload: <T>(url: string, body?: any, params?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<T>;
13
+ protected extractHeadersFromOptions: (options?: UserJwtOptions) => {
14
+ Authorization?: string;
15
+ };
16
+ }
@@ -0,0 +1,39 @@
1
+ import { FetchClient } from './FetchClient';
2
+ export class BaseApiClient {
3
+ constructor(appName) {
4
+ this.appName = void 0;
5
+ this.fetchClient = void 0;
6
+
7
+ this.get = async (url, params, opts) => {
8
+ return this.fetchClient.get(url, params, opts);
9
+ };
10
+
11
+ this.post = async (url, body, opts) => {
12
+ return this.fetchClient.post(url, body, opts);
13
+ };
14
+
15
+ this.patch = async (url, body, opts) => {
16
+ return this.fetchClient.patch(url, body, opts);
17
+ };
18
+
19
+ this.put = async (url, body, opts) => {
20
+ return this.fetchClient.put(url, body, opts);
21
+ };
22
+
23
+ this.delete = async (url, body, opts) => {
24
+ return this.fetchClient.delete(url, body, opts);
25
+ };
26
+
27
+ this.postDownload = async (url, body, params, opts) => {
28
+ return this.fetchClient.postDownload(url, body, params, opts);
29
+ };
30
+
31
+ this.extractHeadersFromOptions = (options = {}) => {
32
+ return this.fetchClient.extractHeadersFromOptions(options);
33
+ };
34
+
35
+ this.appName = appName;
36
+ this.fetchClient = new FetchClient(appName);
37
+ }
38
+
39
+ }
@@ -1,5 +1,5 @@
1
1
  import { SessionContext, ContextOptions, RedirectOptions, RequestSource } from '../interfaces';
2
- import { IUserProfile } from "../users/interfaces";
2
+ import { IUserProfile } from '../users/interfaces';
3
3
  /**
4
4
  * Entitlements config from frontegg provider
5
5
  */
@@ -7,7 +7,7 @@ export interface EntitlementsOptions {
7
7
  enabled?: boolean;
8
8
  }
9
9
  export declare class ContextHolder {
10
- private static instance;
10
+ private static _apps;
11
11
  private context;
12
12
  private accessToken;
13
13
  private user;
@@ -18,45 +18,90 @@ export declare class ContextHolder {
18
18
  private appName;
19
19
  private sessionContext?;
20
20
  private constructor();
21
- static getInstance(): ContextHolder;
22
- static setContext(context: ContextOptions): void;
23
- static setAccessToken(accessToken: string | null): void;
24
- static setUser(user: IUserProfile | null): void;
25
- static setRequestSource(requestSource: RequestSource | null): void;
26
- static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void): void;
27
- static setLogout(logout: (callback?: () => void) => void, logoutUrl: string): void;
21
+ static getInstance(appName?: string): ContextHolder;
22
+ /**
23
+ * @deprecated - use getFronteggContext(appName).setContext instead
24
+ */
25
+ static setContext(context: ContextOptions, appName?: string): void;
26
+ /**
27
+ * @deprecated - use getFronteggContext(appName).setAccessToken instead
28
+ */
29
+ static setAccessToken(accessToken: string | null, appName?: string): void;
30
+ /**
31
+ * @deprecated - use getFronteggContext(appName).setUser instead
32
+ */
33
+ static setUser(user: IUserProfile | null, appName?: string): void;
34
+ /**
35
+ * @deprecated - use getFronteggContext(appName).setRequestSource instead
36
+ */
37
+ static setRequestSource(requestSource: RequestSource | null, appName?: string): void;
38
+ /**
39
+ * @deprecated - use getFronteggContext(appName).setOnRedirectTo instead
40
+ */
41
+ static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void, appName?: string): void;
42
+ /**
43
+ * @deprecated - use getFronteggContext(appName).setLogout instead
44
+ */
45
+ static setLogout(logout: (callback?: () => void) => void, logoutUrl: string, appName?: string): void;
28
46
  /**
29
47
  * App name should also be set for entitlements
48
+ * @deprecated - use getFronteggContext(appName).setEntitlementsOptions instead
30
49
  * @param entitlementsOptions frontegg options entitlements config
50
+ * @param appName - app name
31
51
  */
32
- static setEntitlementsOptions(entitlementsOptions: EntitlementsOptions): void;
52
+ static setEntitlementsOptions(entitlementsOptions: EntitlementsOptions, appName?: string): void;
33
53
  /**
54
+ * @deprecated - use getFronteggContext(appName).setSessionContext instead
34
55
  * @param sessionContext frontegg options SessionContext config
56
+ * @param appName - app name
57
+ */
58
+ static setSessionContext(sessionContext: SessionContext, appName?: string): void;
59
+ /**
60
+ * @deprecated - use getFronteggContext(appName).setAppName instead
61
+ */
62
+ static setAppName(appName: string): void;
63
+ static getContext(appName?: string): ContextOptions;
64
+ /**
65
+ * @deprecated - use getFronteggContext(appName) instead
66
+ */
67
+ static getAccessToken(appName?: string): string | null;
68
+ /**
69
+ * @deprecated - use getFronteggContext(appName).requestSource instead
70
+ */
71
+ static getRequestSource(appName?: string): RequestSource | null;
72
+ /**
73
+ * @deprecated - use getFronteggContext(appName).getUser instead
74
+ */
75
+ static getUser(appName?: string): IUserProfile | null;
76
+ /**
77
+ * @deprecated - use getFronteggContext(appName).onRedirectTo instead
35
78
  */
36
- static setSessionContext(sessionContext: SessionContext): void;
79
+ static onRedirectTo(path: string, opts?: RedirectOptions, appName?: string): void;
37
80
  /**
38
- * @param appName for feature flags e.g.
81
+ * @deprecated - use getFronteggContext(appName)/logout instead
39
82
  */
40
- static setAppName(appName: string | null): void;
41
- static getContext(): ContextOptions;
42
- static getAccessToken(): string | null;
43
- static getRequestSource(): RequestSource | null;
44
- static getUser(): IUserProfile | null;
45
- static onRedirectTo(path: string, opts?: RedirectOptions): void;
46
- static logout(callback?: () => void): void;
83
+ static logout(callback?: () => void, appName?: string): void;
47
84
  /**
85
+ * @deprecated - use getFronteggContext(appName).shouldLoadEntitlements instead
48
86
  * @returns shouldLoadEntitlements. Default to false.
49
87
  */
50
- static shouldLoadEntitlements(): boolean;
88
+ static shouldLoadEntitlements(appName?: string): boolean;
51
89
  /**
52
- * @returns isSessionPerTenantEnabled. Default to false.
53
- */
54
- static isSessionPerTenantEnabled(): boolean;
90
+ * @deprecated - use getFronteggContext(appName).isSessionPerTenantEnabled instead
91
+ * @returns isSessionPerTenantEnabled. Default to false.
92
+ */
93
+ static isSessionPerTenantEnabled(appName?: string): boolean;
55
94
  /**
95
+ * @deprecated - use getFronteggContext(appName).getAppName instead
56
96
  * @returns app name value
57
97
  */
58
- static getAppName(): string | null;
98
+ static getAppName(appName?: string): string | null;
59
99
  }
100
+ /**
101
+ * Frontegg context to be used in the application
102
+ *
103
+ * @deprecated use getFronteggContext instead
104
+ */
60
105
  export declare const FronteggContext: {
61
106
  getContext: () => ContextOptions;
62
107
  getAccessToken: () => string | null;
@@ -64,3 +109,15 @@ export declare const FronteggContext: {
64
109
  onRedirectTo: (path: string, opts: RedirectOptions) => void;
65
110
  logout: (callback?: (() => void) | undefined) => void;
66
111
  };
112
+ export declare const getFronteggContext: (appName?: string) => {
113
+ getContext: () => ContextOptions;
114
+ getAccessToken: () => string | null;
115
+ getUser: () => IUserProfile | null;
116
+ onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void;
117
+ logout: (callback?: (() => void) | undefined) => void;
118
+ getRequestSource: () => RequestSource | null;
119
+ setAccessToken: (accessToken: string | null) => void;
120
+ setUser: (user: IUserProfile | null) => void;
121
+ isSessionPerTenantEnabled: () => boolean;
122
+ shouldLoadEntitlements: () => boolean;
123
+ };
@@ -14,109 +14,121 @@ export class ContextHolder {
14
14
  this.sessionContext = void 0;
15
15
  }
16
16
 
17
- static getInstance() {
18
- if (!ContextHolder.instance) {
19
- ContextHolder.instance = new ContextHolder();
17
+ static getInstance(appName = 'default') {
18
+ if (ContextHolder._apps[appName]) {
19
+ return ContextHolder._apps[appName];
20
20
  }
21
21
 
22
- return ContextHolder.instance;
22
+ ContextHolder._apps[appName] = new ContextHolder();
23
+ return ContextHolder._apps[appName];
23
24
  }
24
25
 
25
- static setContext(context) {
26
- ContextHolder.getInstance().context = context;
26
+ static setContext(context, appName = 'default') {
27
+ ContextHolder.getInstance(appName).context = context;
27
28
  }
28
29
 
29
- static setAccessToken(accessToken) {
30
- ContextHolder.getInstance().accessToken = accessToken;
30
+ static setAccessToken(accessToken, appName = 'default') {
31
+ ContextHolder.getInstance(appName).accessToken = accessToken;
31
32
  }
32
33
 
33
- static setUser(user) {
34
- ContextHolder.getInstance().user = user;
34
+ static setUser(user, appName = 'default') {
35
+ ContextHolder.getInstance(appName).user = user;
35
36
  }
36
37
 
37
- static setRequestSource(requestSource) {
38
- ContextHolder.getInstance().requestSource = requestSource;
38
+ static setRequestSource(requestSource, appName = 'default') {
39
+ ContextHolder.getInstance(appName).requestSource = requestSource;
39
40
  }
40
41
 
41
- static setOnRedirectTo(onRedirectTo) {
42
- ContextHolder.getInstance().onRedirectTo = onRedirectTo;
42
+ static setOnRedirectTo(onRedirectTo, appName = 'default') {
43
+ ContextHolder.getInstance(appName).onRedirectTo = onRedirectTo;
43
44
  }
44
45
 
45
- static setLogout(logout, logoutUrl) {
46
- ContextHolder.getInstance().logout = callback => {
46
+ static setLogout(logout, logoutUrl, appName = 'default') {
47
+ ContextHolder.getInstance(appName).logout = callback => {
47
48
  if (!callback) {
48
- ContextHolder.onRedirectTo(logoutUrl);
49
+ ContextHolder.onRedirectTo(logoutUrl, undefined, appName);
49
50
  } else {
50
51
  logout(callback);
51
52
  }
52
53
  };
53
54
  }
54
55
 
55
- static setEntitlementsOptions(entitlementsOptions) {
56
- ContextHolder.getInstance().entitlementsOptions = entitlementsOptions;
56
+ static setEntitlementsOptions(entitlementsOptions, appName = 'default') {
57
+ ContextHolder.getInstance(appName).entitlementsOptions = entitlementsOptions;
57
58
  }
58
59
 
59
- static setSessionContext(sessionContext) {
60
- const instance = ContextHolder.getInstance();
61
- instance.sessionContext = sessionContext;
60
+ static setSessionContext(sessionContext, appName = 'default') {
61
+ ContextHolder.getInstance(appName).sessionContext = sessionContext;
62
62
  }
63
63
 
64
64
  static setAppName(appName) {
65
- ContextHolder.getInstance().appName = appName;
65
+ ContextHolder.getInstance(appName).appName = appName;
66
66
  }
67
67
 
68
- static getContext() {
68
+ static getContext(appName = 'default') {
69
69
  var _ContextHolder$getIns;
70
70
 
71
- return (_ContextHolder$getIns = ContextHolder.getInstance().context) != null ? _ContextHolder$getIns : {
71
+ return (_ContextHolder$getIns = ContextHolder.getInstance(appName).context) != null ? _ContextHolder$getIns : {
72
72
  baseUrl: window.location.href,
73
73
  tokenResolver: () => 'my-authentication-token',
74
74
  logLevel: 'error'
75
75
  };
76
76
  }
77
77
 
78
- static getAccessToken() {
79
- return ContextHolder.getInstance().accessToken;
78
+ static getAccessToken(appName = 'default') {
79
+ return ContextHolder.getInstance(appName).accessToken;
80
80
  }
81
81
 
82
- static getRequestSource() {
83
- return ContextHolder.getInstance().requestSource;
82
+ static getRequestSource(appName = 'default') {
83
+ return ContextHolder.getInstance(appName).requestSource;
84
84
  }
85
85
 
86
- static getUser() {
87
- return ContextHolder.getInstance().user;
86
+ static getUser(appName = 'default') {
87
+ return ContextHolder.getInstance(appName).user;
88
88
  }
89
89
 
90
- static onRedirectTo(path, opts) {
91
- return ContextHolder.getInstance().onRedirectTo(path, opts);
90
+ static onRedirectTo(path, opts, appName = 'default') {
91
+ return ContextHolder.getInstance(appName).onRedirectTo(path, opts);
92
92
  }
93
93
 
94
- static logout(callback) {
95
- return ContextHolder.getInstance().logout(callback);
94
+ static logout(callback, appName = 'default') {
95
+ return ContextHolder.getInstance(appName).logout(callback);
96
96
  }
97
97
 
98
- static shouldLoadEntitlements() {
98
+ static shouldLoadEntitlements(appName = 'default') {
99
99
  var _ContextHolder$getIns2;
100
100
 
101
- return ((_ContextHolder$getIns2 = ContextHolder.getInstance().entitlementsOptions) == null ? void 0 : _ContextHolder$getIns2.enabled) || false;
101
+ return ((_ContextHolder$getIns2 = ContextHolder.getInstance(appName).entitlementsOptions) == null ? void 0 : _ContextHolder$getIns2.enabled) || false;
102
102
  }
103
103
 
104
- static isSessionPerTenantEnabled() {
104
+ static isSessionPerTenantEnabled(appName = 'default') {
105
105
  var _ContextHolder$getIns3;
106
106
 
107
- return ((_ContextHolder$getIns3 = ContextHolder.getInstance().sessionContext) == null ? void 0 : _ContextHolder$getIns3.enableSessionPerTenant) || false;
107
+ return ((_ContextHolder$getIns3 = ContextHolder.getInstance(appName).sessionContext) == null ? void 0 : _ContextHolder$getIns3.enableSessionPerTenant) || false;
108
108
  }
109
109
 
110
- static getAppName() {
111
- return ContextHolder.getInstance().appName;
110
+ static getAppName(appName = 'default') {
111
+ return ContextHolder.getInstance(appName).appName;
112
112
  }
113
113
 
114
114
  }
115
- ContextHolder.instance = void 0;
115
+ ContextHolder._apps = void 0;
116
116
  export const FronteggContext = {
117
117
  getContext: () => ContextHolder.getContext(),
118
118
  getAccessToken: () => ContextHolder.getAccessToken(),
119
119
  getUser: () => ContextHolder.getUser(),
120
120
  onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts),
121
121
  logout: callback => ContextHolder.logout(callback)
122
- };
122
+ };
123
+ export const getFronteggContext = (appName = 'default') => ({
124
+ getContext: () => ContextHolder.getContext(appName),
125
+ getAccessToken: () => ContextHolder.getAccessToken(appName),
126
+ getUser: () => ContextHolder.getUser(appName),
127
+ onRedirectTo: (path, opts) => ContextHolder.onRedirectTo(path, opts, appName),
128
+ logout: callback => ContextHolder.logout(callback, appName),
129
+ getRequestSource: () => ContextHolder.getRequestSource(appName),
130
+ setAccessToken: accessToken => ContextHolder.setAccessToken(accessToken, appName),
131
+ setUser: user => ContextHolder.setUser(user, appName),
132
+ isSessionPerTenantEnabled: () => ContextHolder.isSessionPerTenantEnabled(appName),
133
+ shouldLoadEntitlements: () => ContextHolder.shouldLoadEntitlements(appName)
134
+ });
@@ -0,0 +1,35 @@
1
+ import { ContextOptions, RequestOptions, UserJwtOptions } from './interfaces';
2
+ /**
3
+ * FetchClient is a class that wrap around the fetch API to make requests.
4
+ * It is used by the BaseApiClient to make requests to the server
5
+ */
6
+ export declare class FetchClient {
7
+ private appName;
8
+ constructor(appName: string);
9
+ private getFronteggContext;
10
+ private prepareUrl;
11
+ private buildQueryParams;
12
+ private getAdditionalQueryParams;
13
+ private getAdditionalHeaders;
14
+ private buildRequestHeaders;
15
+ sendRequest: (opts: RequestOptions) => Promise<any>;
16
+ get: (url: string, params?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
17
+ post: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
18
+ patch: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
19
+ put: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
20
+ delete: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
21
+ postDownload: (url: string, body?: any, params?: any, opts?: any) => Promise<any>;
22
+ extractHeadersFromOptions: (options?: UserJwtOptions) => {
23
+ Authorization?: string;
24
+ };
25
+ }
26
+ export declare function getBaseUrl(context: ContextOptions, url: string, withFronteggPrefix?: boolean): string;
27
+ export declare function getMetadataHeaders(context: ContextOptions): Record<string, string>;
28
+ export declare function getScopedTenant(): string | null;
29
+ declare const _default: FetchClient;
30
+ /**
31
+ * import FetchClient and use it to make requests to the server for specific application
32
+ * @param appName - the application name to make requests for
33
+ * @deprecated - use FetchClient directly
34
+ */
35
+ export default _default;