@frontegg/rest-api 3.1.76-alpha.9502349697 → 3.1.76-alpha.9762981322

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 (122) hide show
  1. package/ContextHolder/index.d.ts +30 -108
  2. package/ContextHolder/index.js +57 -153
  3. package/account-settings/index.d.ts +7 -19
  4. package/account-settings/index.js +13 -23
  5. package/applications/index.d.ts +44 -49
  6. package/applications/index.js +37 -51
  7. package/audits/index.d.ts +15 -27
  8. package/audits/index.js +17 -27
  9. package/auth/index.d.ts +768 -817
  10. package/auth/index.js +721 -902
  11. package/auth/secutiry-poilicy/index.d.ts +102 -58
  12. package/auth/secutiry-poilicy/index.js +90 -122
  13. package/auth/utils.d.ts +2 -2
  14. package/auth/utils.js +8 -9
  15. package/connectivity/index.d.ts +27 -126
  16. package/connectivity/index.js +114 -147
  17. package/directory/index.d.ts +22 -31
  18. package/directory/index.js +15 -27
  19. package/entitlements/index.d.ts +8 -14
  20. package/entitlements/index.js +4 -12
  21. package/feature-flags/index.d.ts +2 -8
  22. package/feature-flags/index.js +8 -16
  23. package/fetch.d.ts +24 -0
  24. package/fetch.js +265 -0
  25. package/groups/index.d.ts +49 -73
  26. package/groups/index.js +45 -64
  27. package/impersonate/index.d.ts +6 -15
  28. package/impersonate/index.js +5 -13
  29. package/index.d.ts +108 -154
  30. package/index.js +78 -109
  31. package/interfaces.d.ts +0 -10
  32. package/metadata/index.d.ts +7 -67
  33. package/metadata/index.js +32 -52
  34. package/node/ContextHolder/index.js +57 -153
  35. package/node/account-settings/index.js +16 -27
  36. package/node/applications/index.js +44 -51
  37. package/node/audits/index.js +20 -31
  38. package/node/auth/index.js +1035 -768
  39. package/node/auth/secutiry-poilicy/index.js +136 -125
  40. package/node/auth/utils.js +7 -9
  41. package/node/connectivity/index.js +187 -148
  42. package/node/directory/index.js +20 -29
  43. package/node/entitlements/index.js +5 -18
  44. package/node/feature-flags/index.js +9 -21
  45. package/node/fetch.js +306 -0
  46. package/node/groups/index.js +63 -65
  47. package/node/impersonate/index.js +5 -18
  48. package/node/index.js +71 -116
  49. package/node/metadata/index.js +52 -61
  50. package/node/notifications/index.js +27 -37
  51. package/node/reports/index.js +70 -78
  52. package/node/roles/index.js +51 -56
  53. package/node/security-center/index.js +9 -21
  54. package/node/sub-tenants/index.js +89 -90
  55. package/node/subscriptions/index.js +107 -69
  56. package/node/subscriptions/invoices.js +17 -25
  57. package/node/subscriptions/managedSubscriptions.js +27 -32
  58. package/node/subscriptions/paymentMethods.js +20 -27
  59. package/node/subscriptions/paymentProviders.js +6 -15
  60. package/node/subscriptions/plans.js +9 -17
  61. package/node/subscriptions/providers/index.js +18 -0
  62. package/node/subscriptions/providers/stripe/index.js +21 -26
  63. package/node/subscriptions/subscriptions.js +27 -32
  64. package/node/subscriptions/summaries.js +6 -15
  65. package/node/subscriptions/tenantConfiguration.js +9 -17
  66. package/node/subscriptions/vendorPublicConfigurations.js +6 -15
  67. package/node/teams/index.js +138 -130
  68. package/node/tenants/index.js +60 -65
  69. package/node/user-phone-numbers/index.js +24 -32
  70. package/node/users/index.js +53 -58
  71. package/node/vendor/index.js +6 -17
  72. package/notifications/index.d.ts +16 -22
  73. package/notifications/index.js +22 -33
  74. package/package.json +1 -1
  75. package/reports/index.d.ts +44 -50
  76. package/reports/index.js +62 -75
  77. package/roles/index.d.ts +38 -44
  78. package/roles/index.js +41 -57
  79. package/security-center/index.d.ts +2 -14
  80. package/security-center/index.js +6 -15
  81. package/sub-tenants/index.d.ts +15 -57
  82. package/sub-tenants/index.js +68 -88
  83. package/subscriptions/index.d.ts +11 -56
  84. package/subscriptions/index.js +11 -58
  85. package/subscriptions/invoices.d.ts +13 -16
  86. package/subscriptions/invoices.js +14 -24
  87. package/subscriptions/managedSubscriptions.d.ts +15 -18
  88. package/subscriptions/managedSubscriptions.js +22 -33
  89. package/subscriptions/paymentMethods.d.ts +13 -16
  90. package/subscriptions/paymentMethods.js +17 -26
  91. package/subscriptions/paymentProviders.d.ts +5 -8
  92. package/subscriptions/paymentProviders.js +4 -11
  93. package/subscriptions/plans.d.ts +8 -11
  94. package/subscriptions/plans.js +6 -14
  95. package/subscriptions/providers/index.d.ts +1 -0
  96. package/subscriptions/providers/index.js +1 -0
  97. package/subscriptions/providers/stripe/index.d.ts +21 -24
  98. package/subscriptions/providers/stripe/index.js +16 -27
  99. package/subscriptions/subscriptions.d.ts +21 -24
  100. package/subscriptions/subscriptions.js +22 -33
  101. package/subscriptions/summaries.d.ts +4 -7
  102. package/subscriptions/summaries.js +3 -10
  103. package/subscriptions/tenantConfiguration.d.ts +3 -6
  104. package/subscriptions/tenantConfiguration.js +7 -15
  105. package/subscriptions/vendorPublicConfigurations.d.ts +2 -5
  106. package/subscriptions/vendorPublicConfigurations.js +4 -11
  107. package/teams/index.d.ts +131 -35
  108. package/teams/index.js +93 -122
  109. package/tenants/index.d.ts +37 -25
  110. package/tenants/index.js +46 -62
  111. package/user-phone-numbers/index.d.ts +26 -32
  112. package/user-phone-numbers/index.js +19 -32
  113. package/users/index.d.ts +15 -21
  114. package/users/index.js +44 -60
  115. package/vendor/index.d.ts +6 -12
  116. package/vendor/index.js +4 -11
  117. package/BaseApiClient.d.ts +0 -16
  118. package/BaseApiClient.js +0 -39
  119. package/FetchClient.d.ts +0 -42
  120. package/FetchClient.js +0 -308
  121. package/node/BaseApiClient.js +0 -49
  122. package/node/FetchClient.js +0 -326
@@ -2,152 +2,119 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  const _excluded = ["eventKey"],
3
3
  _excluded2 = ["eventKey"];
4
4
  import { urls } from '../constants';
5
- import { BaseApiClient } from '../BaseApiClient';
6
- export class ConnectivityApi extends BaseApiClient {
7
- constructor(appName) {
8
- super(appName);
9
-
10
- this.getSlackConfiguration = () => {
11
- return this.get(`${urls.integrations.configurations.v1}/slack`);
12
- };
13
-
14
- this.getSlackScope = () => {
15
- return this.get(`${urls.integrations.configurations.v1}/slack/applications`);
16
- };
17
-
18
- this.getSlackChannels = () => {
19
- return this.get(`${urls.integrations.configurations.v1}/slack/channels`);
20
- };
21
-
22
- this.postSlackConfiguration = data => {
23
- if (data.id) {
24
- return this.patch(`${urls.integrations.configurations.v1}/slack/subscription/${data.id}`, data);
25
- }
26
-
27
- return this.post(`${urls.integrations.configurations.v1}/slack/subscriptions`, data);
28
- };
29
-
30
- this.deleteSlackConfiguration = data => {
31
- return this.delete(`${urls.integrations.configurations.v1}/slack/subscriptions/${data.id}`);
32
- };
33
-
34
- this.postSlackCode = code => {
35
- return this.post(`${urls.integrations.configurations.v1}/slack/applications/registrations`, {
36
- code
37
- });
38
- };
39
-
40
- this.getEmailConfiguration = () => {
41
- return this.get(`${urls.integrations.configurations.v1}/emails`);
42
- };
43
-
44
- this.postEmailConfiguration = _ref => {
45
- let {
46
- eventKey
47
- } = _ref,
48
- data = _objectWithoutPropertiesLoose(_ref, _excluded);
49
-
50
- return this.post(`${urls.integrations.configurations.v1}/emails/${eventKey}`, data);
51
- };
52
-
53
- this.patchEmailConfiguration = ({
54
- eventKey,
55
- enabled
56
- }) => {
57
- return this.patch(`${urls.integrations.configurations.v1}/emails/${eventKey}`, {
58
- enabled
59
- });
60
- };
61
-
62
- this.deleteEmailSubscriptions = (eventKey, subscriptionId) => {
63
- return this.delete(`${urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
64
- };
65
-
66
- this.putEmailSubscriptions = (subscriptionId, eventKey, data) => {
67
- return this.put(`${urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
68
- };
69
-
70
- this.deleteEmailConfiguration = eventKey => {
71
- return this.delete(`${urls.integrations.configurations.v1}/emails/${eventKey}`);
72
- };
73
-
74
- this.getSMSConfiguration = () => {
75
- return this.get(`${urls.integrations.configurations.v2}/sms`);
76
- };
77
-
78
- this.postSMSConfiguration = _ref2 => {
79
- let {
80
- eventKey
81
- } = _ref2,
82
- data = _objectWithoutPropertiesLoose(_ref2, _excluded2);
83
-
84
- return this.post(`${urls.integrations.configurations.v2}/sms/${eventKey}`, data);
85
- };
86
-
87
- this.patchSMSConfiguration = ({
88
- eventKey,
89
- enabled
90
- }) => {
91
- return this.patch(`${urls.integrations.configurations.v2}/sms/${eventKey}`, {
92
- enabled
93
- });
94
- };
95
-
96
- this.deleteSMSSubscriptions = (eventKey, subscriptionId) => {
97
- return this.delete(`${urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
98
- };
99
-
100
- this.putSMSSubscriptions = (subscriptionId, eventKey, data) => {
101
- return this.put(`${urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
102
- };
103
-
104
- this.deleteSMSConfiguration = eventKey => {
105
- return this.delete(`${urls.integrations.configurations.v2}/sms/${eventKey}`);
106
- };
107
-
108
- this.getWebhooksConfigurations = () => {
109
- return this.get(urls.webhooks.v1);
110
- };
111
-
112
- this.postWebhooksConfiguration = data => {
113
- if (data._id) {
114
- return this.patch(`${urls.webhooks.v1}/${data._id}`, data);
115
- } else {
116
- return this.post(`${urls.webhooks.v1}/custom`, data);
117
- }
118
- };
119
-
120
- this.deleteWebhooksConfiguration = id => {
121
- return this.delete(`${urls.webhooks.v1}/${id}`);
122
- };
123
-
124
- this.getWebhookLog = (id, offset = 0, limit = 10) => {
125
- const query = new URLSearchParams({
126
- id,
127
- offset: `${offset}`,
128
- limit: `${limit}`
129
- });
130
- return this.get(`${urls.webhooks.v1}/logs/?${query.toString()}`);
131
- };
132
-
133
- this.postWebhookTest = data => {
134
- return this.post(`${urls.webhooks.v1}/test`, data);
135
- };
136
-
137
- this.postWebhookRetry = id => {
138
- return this.post(`${urls.webhooks.v1}/logs/${id}/retries`);
139
- };
140
-
141
- this.getCategories = () => {
142
- return this.get(`${urls.events.configurations.v1}/categories`);
143
- };
144
-
145
- this.getChannelMaps = channels => {
146
- return this.get(urls.events.configurations.v1, {
147
- channels
148
- });
149
- };
5
+ import { Get, Patch, Post, Delete, Put } from '../fetch';
6
+ export const getSlackConfiguration = () => {
7
+ return Get(`${urls.integrations.configurations.v1}/slack`);
8
+ };
9
+ export const getSlackScope = () => {
10
+ return Get(`${urls.integrations.configurations.v1}/slack/applications`);
11
+ };
12
+ export const getSlackChannels = () => {
13
+ return Get(`${urls.integrations.configurations.v1}/slack/channels`);
14
+ };
15
+ export const postSlackConfiguration = data => {
16
+ if (data.id) {
17
+ return Patch(`${urls.integrations.configurations.v1}/slack/subscription/${data.id}`, data);
150
18
  }
151
19
 
152
- }
153
- export default new ConnectivityApi('default');
20
+ return Post(`${urls.integrations.configurations.v1}/slack/subscriptions`, data);
21
+ };
22
+ export const deleteSlackConfiguration = data => {
23
+ return Delete(`${urls.integrations.configurations.v1}/slack/subscriptions/${data.id}`);
24
+ };
25
+ export const postSlackCode = code => {
26
+ return Post(`${urls.integrations.configurations.v1}/slack/applications/registrations`, {
27
+ code
28
+ });
29
+ };
30
+ export const getEmailConfiguration = () => {
31
+ return Get(`${urls.integrations.configurations.v1}/emails`);
32
+ };
33
+ export const postEmailConfiguration = _ref => {
34
+ let {
35
+ eventKey
36
+ } = _ref,
37
+ data = _objectWithoutPropertiesLoose(_ref, _excluded);
38
+
39
+ return Post(`${urls.integrations.configurations.v1}/emails/${eventKey}`, data);
40
+ };
41
+ export const patchEmailConfiguration = ({
42
+ eventKey,
43
+ enabled
44
+ }) => {
45
+ return Patch(`${urls.integrations.configurations.v1}/emails/${eventKey}`, {
46
+ enabled
47
+ });
48
+ };
49
+ export const deleteEmailSubscriptions = (eventKey, subscriptionId) => {
50
+ return Delete(`${urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`);
51
+ };
52
+ export const putEmailSubscriptions = (subscriptionId, eventKey, data) => {
53
+ return Put(`${urls.integrations.configurations.v1}/emails/${eventKey}/subscriptions/${subscriptionId}`, data);
54
+ };
55
+ export const deleteEmailConfiguration = eventKey => {
56
+ return Delete(`${urls.integrations.configurations.v1}/emails/${eventKey}`);
57
+ };
58
+ export const getSMSConfiguration = () => {
59
+ return Get(`${urls.integrations.configurations.v2}/sms`);
60
+ };
61
+ export const postSMSConfiguration = _ref2 => {
62
+ let {
63
+ eventKey
64
+ } = _ref2,
65
+ data = _objectWithoutPropertiesLoose(_ref2, _excluded2);
66
+
67
+ return Post(`${urls.integrations.configurations.v2}/sms/${eventKey}`, data);
68
+ };
69
+ export const patchSMSConfiguration = ({
70
+ eventKey,
71
+ enabled
72
+ }) => {
73
+ return Patch(`${urls.integrations.configurations.v2}/sms/${eventKey}`, {
74
+ enabled
75
+ });
76
+ };
77
+ export const deleteSMSSubscriptions = (eventKey, subscriptionId) => {
78
+ return Delete(`${urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`);
79
+ };
80
+ export const putSMSSubscriptions = (subscriptionId, eventKey, data) => {
81
+ return Put(`${urls.integrations.configurations.v2}/sms/${eventKey}/subscriptions/${subscriptionId}`, data);
82
+ };
83
+ export const deleteSMSConfiguration = eventKey => {
84
+ return Delete(`${urls.integrations.configurations.v2}/sms/${eventKey}`);
85
+ };
86
+ export const getWebhooksConfigurations = () => {
87
+ return Get(urls.webhooks.v1);
88
+ };
89
+ export const postWebhooksConfiguration = data => {
90
+ if (data._id) {
91
+ return Patch(`${urls.webhooks.v1}/${data._id}`, data);
92
+ } else {
93
+ return Post(`${urls.webhooks.v1}/custom`, data);
94
+ }
95
+ };
96
+ export const deleteWebhooksConfiguration = id => {
97
+ return Delete(`${urls.webhooks.v1}/${id}`);
98
+ };
99
+ export const getWebhookLog = (id, offset = 0, limit = 10) => {
100
+ const query = new URLSearchParams({
101
+ id,
102
+ offset: `${offset}`,
103
+ limit: `${limit}`
104
+ });
105
+ return Get(`${urls.webhooks.v1}/logs/?${query.toString()}`);
106
+ };
107
+ export const postWebhookTest = data => {
108
+ return Post(`${urls.webhooks.v1}/test`, data);
109
+ };
110
+ export const postWebhookRetry = id => {
111
+ return Post(`${urls.webhooks.v1}/logs/${id}/retries`);
112
+ };
113
+ export const getCategories = () => {
114
+ return Get(`${urls.events.configurations.v1}/categories`);
115
+ };
116
+ export const getChannelMaps = channels => {
117
+ return Get(urls.events.configurations.v1, {
118
+ channels
119
+ });
120
+ };
@@ -1,32 +1,23 @@
1
1
  import { Scim2ConnectionConfigResponse, Scim2CountResponse, Scim2CreateConnectionConfigRequest, Scim2CreateConnectionConfigResponse, Scim2PatchConnectionConfigRequest } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class DirectoryApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Returns all SCIM2 configurations
7
- *
8
- * ``authorized user``
9
- */
10
- getConfigs: () => Promise<Scim2ConnectionConfigResponse[]>;
11
- /**
12
- * Update SCIM2 configuration
13
- *
14
- * ``authorized user``
15
- */
16
- updateConfiguration: (id: string, body: Scim2PatchConnectionConfigRequest) => Promise<void>;
17
- /**
18
- * Create SCIM2 configuration
19
- *
20
- * ``authorized user``
21
- */
22
- createConfiguration: (body: Scim2CreateConnectionConfigRequest) => Promise<Scim2CreateConnectionConfigResponse>;
23
- /**
24
- * Delete SCIM2 configuration
25
- *
26
- * ``authorized user``
27
- */
28
- deleteConfiguration: (id: string) => Promise<void>;
29
- countConfigurationUsers: (id: string) => Promise<Scim2CountResponse>;
30
- }
31
- declare const _default: DirectoryApi;
32
- export default _default;
2
+ /**
3
+ * returns all scim2 configurations
4
+ *
5
+ * ``authorized user``
6
+ */
7
+ export declare function getConfigs(): Promise<Scim2ConnectionConfigResponse[]>;
8
+ /**
9
+ * update scim2 configuration
10
+ * ``authorized user``
11
+ */
12
+ export declare function updateConfiguration(id: string, body: Scim2PatchConnectionConfigRequest): Promise<void>;
13
+ /**
14
+ * create scim2 configuration
15
+ * ``authorized user``
16
+ */
17
+ export declare function createConfiguration(body: Scim2CreateConnectionConfigRequest): Promise<Scim2CreateConnectionConfigResponse>;
18
+ /**
19
+ * delete scim2 configuration
20
+ * ``authorized user``
21
+ */
22
+ export declare function deleteConfiguration(id: string): Promise<void>;
23
+ export declare function countConfigurationUsers(id: string): Promise<Scim2CountResponse>;
@@ -1,29 +1,17 @@
1
1
  import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class DirectoryApi extends BaseApiClient {
4
- constructor(appName) {
5
- super(appName);
6
-
7
- this.getConfigs = async () => {
8
- return this.get(`${urls.directory.v1}`);
9
- };
10
-
11
- this.updateConfiguration = async (id, body) => {
12
- return this.patch(`${urls.directory.v1}/${id}`, body);
13
- };
14
-
15
- this.createConfiguration = async body => {
16
- return this.post(`${urls.directory.v1}`, body);
17
- };
18
-
19
- this.deleteConfiguration = async id => {
20
- return this.delete(`${urls.directory.v1}/${id}`);
21
- };
22
-
23
- this.countConfigurationUsers = async id => {
24
- return this.get(`${urls.directory.temp}/${id}/Users/count`);
25
- };
26
- }
27
-
2
+ import { Delete, Get, Patch, Post } from '../fetch';
3
+ export async function getConfigs() {
4
+ return Get(`${urls.directory.v1}`);
28
5
  }
29
- export default new DirectoryApi('default');
6
+ export async function updateConfiguration(id, body) {
7
+ return Patch(`${urls.directory.v1}/${id}`, body);
8
+ }
9
+ export async function createConfiguration(body) {
10
+ return Post(`${urls.directory.v1}`, body);
11
+ }
12
+ export async function deleteConfiguration(id) {
13
+ return Delete(`${urls.directory.v1}/${id}`);
14
+ }
15
+ export async function countConfigurationUsers(id) {
16
+ return Get(`${urls.directory.temp}/${id}/Users/count`);
17
+ }
@@ -1,15 +1,9 @@
1
1
  import { UserEntitlementsContext as UserEntitlementsResponseV2 } from "@frontegg/entitlements-javascript-commons";
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export declare class EntitlementsApi extends BaseApiClient {
4
- constructor(appName: string);
5
- /**
6
- * Load user entitlements data v2.
7
- * Including all user permissions and features data.
8
- * Now the final isEntitled response is not part of it, but includes the data needed to calculate it.
9
- *
10
- * `authorized user`
11
- */
12
- loadEntitlementsV2: () => Promise<UserEntitlementsResponseV2>;
13
- }
14
- declare const _default: EntitlementsApi;
15
- export default _default;
2
+ /**
3
+ * Load user entitlements data v2.
4
+ * Including all user permissions and features data.
5
+ * Now the final isEntitled response is not part of it, but includes the data needed to calculate it.
6
+ *
7
+ * ``authorized user``
8
+ */
9
+ export declare function loadEntitlementsV2(): Promise<UserEntitlementsResponseV2>;
@@ -1,13 +1,5 @@
1
1
  import { urls } from '../constants';
2
- import { BaseApiClient } from '../BaseApiClient';
3
- export class EntitlementsApi extends BaseApiClient {
4
- constructor(appName) {
5
- super(appName);
6
-
7
- this.loadEntitlementsV2 = async () => {
8
- return this.get(urls.entitlements.v2);
9
- };
10
- }
11
-
12
- }
13
- export default new EntitlementsApi('default');
2
+ import { Get } from '../fetch';
3
+ export async function loadEntitlementsV2() {
4
+ return Get(urls.entitlements.v2);
5
+ }
@@ -1,5 +1,4 @@
1
- import { IFeatureFlagsAttributes } from './interfaces';
2
- import { BaseApiClient } from '../BaseApiClient';
1
+ import { IFeatureFlagsAttributes } from "./interfaces";
3
2
  export declare class FeatureFlags {
4
3
  private _flags;
5
4
  private static _instances;
@@ -10,9 +9,4 @@ export declare class FeatureFlags {
10
9
  get flags(): IFeatureFlagsAttributes;
11
10
  set(featureFlags?: IFeatureFlagsAttributes): void;
12
11
  }
13
- export declare class FeatureFlagsApi extends BaseApiClient {
14
- constructor(appName: string);
15
- loadFeatureFlags: () => Promise<IFeatureFlagsAttributes>;
16
- }
17
- declare const _default: FeatureFlagsApi;
18
- export default _default;
12
+ export declare function loadFeatureFlags(): Promise<IFeatureFlagsAttributes>;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { urls } from '../constants';
3
- import { BaseApiClient } from '../BaseApiClient';
2
+ import { urls } from "../constants";
3
+ import { Get } from "../fetch";
4
4
  const defaultFeatureFlags = {
5
5
  flags: {}
6
6
  };
@@ -12,11 +12,11 @@ export class FeatureFlags {
12
12
  this._flags = (_defaultFeatureFlags$ = defaultFeatureFlags.flags) != null ? _defaultFeatureFlags$ : {};
13
13
  }
14
14
 
15
- static getInstance(name = 'default') {
15
+ static getInstance(name = "default") {
16
16
  return this._instances[name];
17
17
  }
18
18
 
19
- static set(featureFlags, name = 'default') {
19
+ static set(featureFlags, name = "default") {
20
20
  const featureFlagsInstance = new FeatureFlags();
21
21
  featureFlagsInstance.set(featureFlags);
22
22
  FeatureFlags._instances[name] = featureFlagsInstance;
@@ -25,7 +25,7 @@ export class FeatureFlags {
25
25
 
26
26
  static getFeatureFlags(flags, name) {
27
27
  const featureFlagsInstance = this.getInstance(name);
28
- return flags.map(flag => (featureFlagsInstance == null ? void 0 : featureFlagsInstance._flags[flag]) === 'on');
28
+ return flags.map(flag => (featureFlagsInstance == null ? void 0 : featureFlagsInstance._flags[flag]) === "on");
29
29
  }
30
30
 
31
31
  get flags() {
@@ -42,14 +42,6 @@ export class FeatureFlags {
42
42
 
43
43
  }
44
44
  FeatureFlags._instances = {};
45
- export class FeatureFlagsApi extends BaseApiClient {
46
- constructor(appName) {
47
- super(appName);
48
-
49
- this.loadFeatureFlags = async () => {
50
- return this.get(urls.featureFlags.v1);
51
- };
52
- }
53
-
54
- }
55
- export default new FeatureFlagsApi('default');
45
+ export async function loadFeatureFlags() {
46
+ return Get(urls.featureFlags.v1);
47
+ }
package/fetch.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import { ContextOptions, UserJwtOptions } from './interfaces';
2
+ interface RequestOptions {
3
+ url: string;
4
+ method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
5
+ body?: any;
6
+ params?: any;
7
+ contentType?: string;
8
+ responseType?: 'json' | 'plain' | 'blob';
9
+ headers?: Record<string, string>;
10
+ credentials?: RequestCredentials;
11
+ }
12
+ export declare function getBaseUrl(context: ContextOptions, url: string, withFronteggPrefix?: boolean): string;
13
+ export declare function getMetadataHeaders(context: ContextOptions): Record<string, string>;
14
+ export declare function getScopedTenant(): string | null;
15
+ export declare const Get: (url: string, params?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
16
+ export declare const Post: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
17
+ export declare const Patch: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
18
+ export declare const Put: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
19
+ export declare const Delete: (url: string, body?: any, opts?: Pick<RequestOptions, "body" | "params" | "contentType" | "responseType" | "headers" | "credentials"> | undefined) => Promise<any>;
20
+ export declare const PostDownload: (url: string, body?: any, params?: any, opts?: any) => Promise<any>;
21
+ export declare const extractHeadersFromOptions: (options?: UserJwtOptions) => {
22
+ Authorization?: string;
23
+ };
24
+ export {};