@frontegg/rest-api 6.0.1-alpha.4 → 7.28.0-alpha.0

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 (218) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +30 -0
  3. package/ContextHolder/index.d.ts +160 -0
  4. package/ContextHolder/index.js +278 -0
  5. package/ContextHolder/package.json +6 -0
  6. package/FetchClient.d.ts +42 -0
  7. package/FetchClient.js +260 -0
  8. package/account-settings/index.d.ts +21 -7
  9. package/account-settings/index.js +25 -6
  10. package/account-settings/interfaces.d.ts +9 -2
  11. package/applications/index.d.ts +51 -0
  12. package/applications/index.js +55 -0
  13. package/applications/interfaces.d.ts +49 -0
  14. package/applications/interfaces.js +5 -0
  15. package/applications/package.json +6 -0
  16. package/audits/index.d.ts +27 -15
  17. package/audits/index.js +29 -16
  18. package/audits/interfaces.d.ts +3 -2
  19. package/auth/constants.d.ts +5 -0
  20. package/auth/constants.js +5 -0
  21. package/auth/enums.d.ts +8 -1
  22. package/auth/enums.js +9 -4
  23. package/auth/index.d.ts +833 -428
  24. package/auth/index.js +768 -385
  25. package/auth/interfaces.d.ts +341 -39
  26. package/auth/interfaces.js +19 -9
  27. package/auth/secutiry-poilicy/index.d.ts +60 -41
  28. package/auth/secutiry-poilicy/index.js +99 -45
  29. package/auth/secutiry-poilicy/interfaces.d.ts +62 -2
  30. package/auth/secutiry-poilicy/interfaces.js +5 -1
  31. package/auth/utils.d.ts +10 -0
  32. package/auth/utils.js +35 -0
  33. package/connectivity/index.d.ts +126 -27
  34. package/connectivity/index.js +120 -114
  35. package/constants.d.ts +115 -0
  36. package/constants.js +122 -5
  37. package/directory/index.d.ts +32 -0
  38. package/directory/index.js +30 -0
  39. package/directory/interfaces.d.ts +30 -0
  40. package/directory/interfaces.js +7 -0
  41. package/directory/package.json +6 -0
  42. package/entitlements/index.d.ts +15 -0
  43. package/entitlements/index.js +20 -0
  44. package/entitlements/interfaces.d.ts +13 -0
  45. package/entitlements/interfaces.js +11 -0
  46. package/entitlements/package.json +6 -0
  47. package/error.js +0 -2
  48. package/feature-flags/index.d.ts +18 -0
  49. package/feature-flags/index.js +44 -0
  50. package/feature-flags/interfaces.d.ts +5 -0
  51. package/feature-flags/interfaces.js +1 -0
  52. package/feature-flags/package.json +6 -0
  53. package/groups/enums.d.ts +9 -0
  54. package/groups/enums.js +11 -0
  55. package/groups/index.d.ts +73 -0
  56. package/groups/index.js +62 -0
  57. package/groups/interfaces.d.ts +64 -0
  58. package/groups/interfaces.js +1 -0
  59. package/groups/package.json +6 -0
  60. package/impersonate/index.d.ts +17 -0
  61. package/impersonate/index.js +23 -0
  62. package/impersonate/interfaces.d.ts +12 -0
  63. package/impersonate/interfaces.js +1 -0
  64. package/impersonate/package.json +6 -0
  65. package/index.d.ts +148 -53
  66. package/index.js +103 -31
  67. package/interfaces.d.ts +82 -1
  68. package/interfaces.js +28 -1
  69. package/jwt.js +19 -20
  70. package/metadata/index.d.ts +68 -5
  71. package/metadata/index.js +53 -23
  72. package/metadata/interfaces.d.ts +10 -2
  73. package/node/BaseApiClient.js +37 -0
  74. package/node/ContextHolder/index.js +286 -0
  75. package/node/FetchClient.js +268 -0
  76. package/node/account-settings/index.js +26 -11
  77. package/node/applications/index.js +62 -0
  78. package/node/applications/interfaces.js +12 -0
  79. package/node/audits/index.js +32 -27
  80. package/node/auth/constants.js +13 -0
  81. package/node/auth/enums.js +11 -5
  82. package/node/auth/index.js +807 -644
  83. package/node/auth/interfaces.js +27 -13
  84. package/node/auth/secutiry-poilicy/index.js +100 -66
  85. package/node/auth/secutiry-poilicy/interfaces.js +8 -1
  86. package/node/auth/utils.js +44 -0
  87. package/node/connectivity/index.js +123 -197
  88. package/node/constants.js +124 -6
  89. package/node/directory/index.js +37 -0
  90. package/node/directory/interfaces.js +14 -0
  91. package/node/entitlements/index.js +27 -0
  92. package/node/entitlements/interfaces.js +18 -0
  93. package/node/error.js +0 -4
  94. package/node/feature-flags/index.js +54 -0
  95. package/node/feature-flags/interfaces.js +5 -0
  96. package/node/groups/enums.js +19 -0
  97. package/node/groups/index.js +70 -0
  98. package/node/groups/interfaces.js +5 -0
  99. package/node/impersonate/index.js +29 -0
  100. package/node/impersonate/interfaces.js +5 -0
  101. package/node/index.js +324 -94
  102. package/node/interfaces.js +34 -1
  103. package/node/jwt.js +19 -25
  104. package/node/metadata/index.js +57 -38
  105. package/node/notifications/index.js +34 -31
  106. package/node/reports/index.js +79 -83
  107. package/node/roles/index.js +55 -60
  108. package/node/roles/interfaces.js +9 -1
  109. package/node/routers.js +52 -6
  110. package/node/security-center/index.js +26 -0
  111. package/node/security-center/interfaces.js +74 -0
  112. package/node/sub-tenants/index.js +82 -29
  113. package/node/sub-tenants/interfaces.js +9 -1
  114. package/node/subscriptions/enums.js +13 -9
  115. package/node/subscriptions/index.js +64 -109
  116. package/node/subscriptions/interfaces.js +0 -2
  117. package/node/subscriptions/invoices.js +20 -21
  118. package/node/subscriptions/managedSubscriptions.js +28 -33
  119. package/node/subscriptions/paymentMethods.js +23 -27
  120. package/node/subscriptions/paymentProviders.js +11 -8
  121. package/node/subscriptions/plans.js +13 -12
  122. package/node/subscriptions/providers/stripe/index.js +22 -27
  123. package/node/subscriptions/subscriptions.js +28 -33
  124. package/node/subscriptions/summaries.js +11 -8
  125. package/node/subscriptions/tenantConfiguration.js +13 -12
  126. package/node/subscriptions/vendorPublicConfigurations.js +17 -0
  127. package/node/teams/index.js +108 -121
  128. package/node/teams/interfaces.js +8 -1
  129. package/node/tenants/index.js +63 -21
  130. package/node/tenants/interfaces.js +18 -1
  131. package/node/user-phone-numbers/index.js +38 -0
  132. package/node/user-phone-numbers/interfaces.js +5 -0
  133. package/node/users/index.js +64 -0
  134. package/node/users/interfaces.js +27 -0
  135. package/node/velo/index.js +75 -0
  136. package/node/velo/interfaces.js +5 -0
  137. package/node/vendor/index.js +16 -8
  138. package/notifications/index.d.ts +22 -16
  139. package/notifications/index.js +33 -22
  140. package/package.json +4 -2
  141. package/reports/index.d.ts +50 -44
  142. package/reports/index.js +77 -68
  143. package/reports/interfaces.d.ts +2 -2
  144. package/roles/index.d.ts +45 -34
  145. package/roles/index.js +52 -41
  146. package/roles/interfaces.d.ts +25 -9
  147. package/roles/interfaces.js +6 -1
  148. package/routers.d.ts +6 -1
  149. package/routers.js +45 -2
  150. package/security-center/index.d.ts +15 -0
  151. package/security-center/index.js +19 -0
  152. package/security-center/interfaces.d.ts +115 -0
  153. package/security-center/interfaces.js +63 -0
  154. package/security-center/package.json +6 -0
  155. package/sub-tenants/index.d.ts +57 -8
  156. package/sub-tenants/index.js +84 -19
  157. package/sub-tenants/interfaces.d.ts +68 -10
  158. package/sub-tenants/interfaces.js +6 -1
  159. package/subscriptions/enums.d.ts +7 -0
  160. package/subscriptions/enums.js +10 -8
  161. package/subscriptions/index.d.ts +55 -9
  162. package/subscriptions/index.js +56 -9
  163. package/subscriptions/interfaces.d.ts +7 -3
  164. package/subscriptions/interfaces.js +1 -1
  165. package/subscriptions/invoices.d.ts +16 -13
  166. package/subscriptions/invoices.js +19 -14
  167. package/subscriptions/managedSubscriptions.d.ts +18 -15
  168. package/subscriptions/managedSubscriptions.js +27 -22
  169. package/subscriptions/paymentMethods.d.ts +16 -13
  170. package/subscriptions/paymentMethods.js +22 -18
  171. package/subscriptions/paymentProviders.d.ts +8 -5
  172. package/subscriptions/paymentProviders.js +9 -4
  173. package/subscriptions/plans.d.ts +11 -8
  174. package/subscriptions/plans.js +11 -6
  175. package/subscriptions/providers/stripe/index.d.ts +24 -21
  176. package/subscriptions/providers/stripe/index.js +21 -16
  177. package/subscriptions/subscriptions.d.ts +24 -21
  178. package/subscriptions/subscriptions.js +27 -22
  179. package/subscriptions/summaries.d.ts +7 -4
  180. package/subscriptions/summaries.js +8 -3
  181. package/subscriptions/tenantConfiguration.d.ts +6 -3
  182. package/subscriptions/tenantConfiguration.js +12 -7
  183. package/subscriptions/vendorPublicConfigurations.d.ts +5 -0
  184. package/subscriptions/vendorPublicConfigurations.js +10 -0
  185. package/teams/index.d.ts +38 -115
  186. package/teams/index.js +105 -79
  187. package/teams/interfaces.d.ts +47 -42
  188. package/teams/interfaces.js +5 -1
  189. package/tenants/index.d.ts +25 -26
  190. package/tenants/index.js +61 -12
  191. package/tenants/interfaces.d.ts +85 -0
  192. package/tenants/interfaces.js +14 -1
  193. package/user-phone-numbers/index.d.ts +32 -0
  194. package/user-phone-numbers/index.js +31 -0
  195. package/user-phone-numbers/interfaces.d.ts +32 -0
  196. package/user-phone-numbers/interfaces.js +1 -0
  197. package/user-phone-numbers/package.json +6 -0
  198. package/users/index.d.ts +24 -0
  199. package/users/index.js +55 -0
  200. package/users/interfaces.d.ts +144 -0
  201. package/users/interfaces.js +18 -0
  202. package/users/package.json +6 -0
  203. package/velo/index.d.ts +46 -0
  204. package/velo/index.js +68 -0
  205. package/velo/interfaces.d.ts +108 -0
  206. package/velo/interfaces.js +1 -0
  207. package/velo/package.json +6 -0
  208. package/vendor/index.d.ts +12 -6
  209. package/vendor/index.js +15 -4
  210. package/ContextHolder.d.ts +0 -29
  211. package/ContextHolder.js +0 -80
  212. package/fetch.d.ts +0 -19
  213. package/fetch.js +0 -203
  214. package/node/ContextHolder.js +0 -90
  215. package/node/fetch.js +0 -234
  216. package/node/subscriptions/providers/index.js +0 -18
  217. package/subscriptions/providers/index.d.ts +0 -1
  218. package/subscriptions/providers/index.js +0 -1
@@ -1,41 +1,60 @@
1
- import { ISaveSecurityPolicyMfa, ISaveSecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyLockout, ISecurityPolicyCaptcha, ISecurityPolicyPasswordHistory, ISaveSecurityPolicyPasswordHistory, ISecurityPolicyPasswordConfig, ISecurityPolicy } from './interfaces';
2
- /**
3
- * Get global secure access configuration
4
- */
5
- export declare function getGlobalSecurityPolicy(): Promise<ISecurityPolicy>;
6
- /**
7
- * Get Mfa configuration from security policy
8
- */
9
- export declare function getMfaPolicy(): Promise<ISecurityPolicyMfa>;
10
- /**
11
- * Get Mfa configuration from security policy
12
- */
13
- export declare function getVendorMfaPolicy(): Promise<ISecurityPolicyMfa>;
14
- /**
15
- * Create/Update Mfa configuration from security policy
16
- */
17
- export declare function saveMfaPolicy(body: ISaveSecurityPolicyMfa): Promise<ISecurityPolicyMfa>;
18
- /**
19
- * Get Lockout configuration from security policy
20
- */
21
- export declare function getLockoutPolicy(): Promise<ISecurityPolicyLockout>;
22
- /**
23
- * Create/Update Lockout configuration from security policy
24
- */
25
- export declare function saveLockoutPolicy(body: ISaveSecurityPolicyLockout): Promise<ISecurityPolicyLockout>;
26
- /**
27
- * Get Captcha configuration from security policy
28
- */
29
- export declare function getCaptchaPolicy(): Promise<ISecurityPolicyCaptcha | null>;
30
- /**
31
- * Get Password History configuration from security policy
32
- */
33
- export declare function getPasswordHistoryPolicy(): Promise<ISecurityPolicyPasswordHistory>;
34
- /**
35
- * Create/Update Password History configuration from security policy
36
- */
37
- export declare function savePasswordHistoryPolicy(body: ISaveSecurityPolicyPasswordHistory): Promise<ISecurityPolicyPasswordHistory>;
38
- /**
39
- * load vendor password configuration.
40
- */
41
- export declare function getPasswordConfigPolicy(): Promise<ISecurityPolicyPasswordConfig>;
1
+ import { ISaveSecurityPolicyMfa, ISaveSecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyLockout, ISecurityPolicyCaptcha, ISecurityPolicyPasswordHistory, ISaveSecurityPolicyPasswordHistory, ISecurityPolicyPasswordConfig, ISecurityPolicy, DomainRestriction, DomainRestrictionConfig, CreateDomainRestriction, UpdateDomainRestrictionsConfig, IpRestriction, IPRestrictionsConfig, BulkCreateIpRestriction, CreateIpRestriction, GetIPRestrictionsParams, IPValidResponse } from './interfaces';
2
+ import { FronteggPaginationResult } from '../../interfaces';
3
+ import { BaseApiClient } from '../../BaseApiClient';
4
+ export declare class SecurityPolicyApi extends BaseApiClient {
5
+ constructor(appName: string);
6
+ /** Get global secure access configuration */
7
+ getGlobalSecurityPolicy: () => Promise<ISecurityPolicy>;
8
+ /** Get Mfa configuration from security policy */
9
+ getMfaPolicy: () => Promise<ISecurityPolicyMfa>;
10
+ /** Get Vendor Mfa configuration from security policy */
11
+ getVendorMfaPolicy: () => Promise<ISecurityPolicyMfa>;
12
+ /** Create/Update Mfa configuration from security policy */
13
+ saveMfaPolicy: (body: ISaveSecurityPolicyMfa) => Promise<ISecurityPolicyMfa>;
14
+ /** Get Lockout configuration from security policy */
15
+ getLockoutPolicy: () => Promise<ISecurityPolicyLockout>;
16
+ /** Get Vendor Lockout configuration from security policy */
17
+ getVendorLockoutPolicy: () => Promise<ISecurityPolicyLockout>;
18
+ /** Create/Update Lockout configuration from security policy */
19
+ saveLockoutPolicy: (body: ISaveSecurityPolicyLockout) => Promise<ISecurityPolicyLockout>;
20
+ /** Get Captcha configuration from security policy */
21
+ getCaptchaPolicy: () => Promise<ISecurityPolicyCaptcha | null>;
22
+ /** Get Password History configuration from security policy */
23
+ getPasswordHistoryPolicy: () => Promise<ISecurityPolicyPasswordHistory>;
24
+ /** Get Vendor Password History configuration from security policy */
25
+ getVendorPasswordHistoryPolicy: () => Promise<ISecurityPolicyPasswordHistory>;
26
+ /** Create/Update Password History configuration from security policy */
27
+ savePasswordHistoryPolicy: (body: ISaveSecurityPolicyPasswordHistory) => Promise<ISecurityPolicyPasswordHistory>;
28
+ /** Load vendor password configuration */
29
+ getPasswordConfigPolicy: () => Promise<ISecurityPolicyPasswordConfig>;
30
+ /** Get domain restrictions for tenant */
31
+ getDomainRestrictions: () => Promise<{
32
+ items: DomainRestriction[];
33
+ }>;
34
+ /** Get domain restrictions config for tenant */
35
+ getDomainRestrictionsConfig: () => Promise<DomainRestrictionConfig>;
36
+ /** Create domain restriction for tenant */
37
+ createDomainRestriction: (body: CreateDomainRestriction) => Promise<DomainRestriction>;
38
+ /** Update domain restrictions config for tenant */
39
+ updateDomainRestrictionConfig: (body: UpdateDomainRestrictionsConfig) => Promise<DomainRestrictionConfig>;
40
+ /** Delete domain restriction for tenant by id */
41
+ deleteDomainRestriction: (id: string) => Promise<void>;
42
+ /** Get IP restrictions for tenant */
43
+ getIPRestrictions: (params: GetIPRestrictionsParams) => Promise<FronteggPaginationResult<IpRestriction[]>>;
44
+ /** Get IP restrictions config for tenant */
45
+ getIPRestrictionsConfig: () => Promise<IPRestrictionsConfig>;
46
+ /** Create IP restriction for tenant */
47
+ createIPRestriction: (body: CreateIpRestriction) => Promise<void>;
48
+ /** Create bulk IP restrictions for tenant */
49
+ bulkCreateIPRestriction: (body: BulkCreateIpRestriction) => Promise<void>;
50
+ /** Update IP restrictions config for tenant */
51
+ updateIPRestrictionConfig: (body: IPRestrictionsConfig) => Promise<void>;
52
+ /** Delete IP restriction for tenant by id */
53
+ deleteIPRestriction: (id: string) => Promise<void>;
54
+ /** Test current user IP restriction */
55
+ testCurrentIp: () => Promise<IPValidResponse>;
56
+ /** Test current user IP restriction is in allow list */
57
+ testCurrentIpInAllowList: () => Promise<IPValidResponse>;
58
+ }
59
+ declare const _default: SecurityPolicyApi;
60
+ export default _default;
@@ -1,48 +1,102 @@
1
- import { Get, Patch, Post } from '../../fetch';
2
1
  import { urls } from '../../constants';
3
- export async function getGlobalSecurityPolicy() {
4
- return Get(urls.identity.configurations.v1);
5
- }
6
- export async function getMfaPolicy() {
7
- return Get(`${urls.identity.configurations.v1}/mfa-policy`);
8
- }
9
- export async function getVendorMfaPolicy() {
10
- return Get(`${urls.identity.configurations.v1}/mfa-policy/vendor`);
11
- }
12
- export async function saveMfaPolicy(body) {
13
- if (body.id) {
14
- return Patch(`${urls.identity.configurations.v1}/mfa-policy`, body);
15
- } else {
16
- return Post(`${urls.identity.configurations.v1}/mfa-policy`, body);
17
- }
18
- }
19
- export async function getLockoutPolicy() {
20
- return Get(`${urls.identity.configurations.v1}/lockout-policy`);
21
- }
22
- export async function saveLockoutPolicy(body) {
23
- if (body.id) {
24
- return Patch(`${urls.identity.configurations.v1}/lockout-policy`, body);
25
- } else {
26
- return Post(`${urls.identity.configurations.v1}/lockout-policy`, body);
27
- }
28
- }
29
- export async function getCaptchaPolicy() {
30
- try {
31
- return await Get(`${urls.identity.configurations.v1}/captcha-policy/public`);
32
- } catch {
33
- return null;
34
- }
35
- }
36
- export async function getPasswordHistoryPolicy() {
37
- return Get(`${urls.identity.configurations.v1}/password-history-policy`);
38
- }
39
- export async function savePasswordHistoryPolicy(body) {
40
- if (body.id) {
41
- return Patch(`${urls.identity.configurations.v1}/password-history-policy`, body);
42
- } else {
43
- return Post(`${urls.identity.configurations.v1}/password-history-policy`, body);
2
+ import { BaseApiClient } from '../../BaseApiClient';
3
+ export class SecurityPolicyApi extends BaseApiClient {
4
+ constructor(appName) {
5
+ super(appName);
6
+ this.getGlobalSecurityPolicy = async () => {
7
+ return this.get(urls.identity.configurations.v1);
8
+ };
9
+ this.getMfaPolicy = async () => {
10
+ return this.get(`${urls.identity.configurations.v1}/mfa-policy`);
11
+ };
12
+ this.getVendorMfaPolicy = async () => {
13
+ return this.get(`${urls.identity.configurations.v1}/mfa-policy/vendor`);
14
+ };
15
+ this.saveMfaPolicy = async body => {
16
+ if (body.id) {
17
+ return this.patch(`${urls.identity.configurations.v1}/mfa-policy`, body);
18
+ } else {
19
+ return this.post(`${urls.identity.configurations.v1}/mfa-policy`, body);
20
+ }
21
+ };
22
+ this.getLockoutPolicy = async () => {
23
+ return this.get(`${urls.identity.configurations.v1}/lockout-policy`);
24
+ };
25
+ this.getVendorLockoutPolicy = async () => {
26
+ return this.get(`${urls.identity.configurations.v1}/lockout-policy/vendor`);
27
+ };
28
+ this.saveLockoutPolicy = async body => {
29
+ if (body.id) {
30
+ return this.patch(`${urls.identity.configurations.v1}/lockout-policy`, body);
31
+ } else {
32
+ return this.post(`${urls.identity.configurations.v1}/lockout-policy`, body);
33
+ }
34
+ };
35
+ this.getCaptchaPolicy = async () => {
36
+ try {
37
+ return await this.get(`${urls.identity.configurations.v1}/captcha-policy/public`);
38
+ } catch {
39
+ return null;
40
+ }
41
+ };
42
+ this.getPasswordHistoryPolicy = async () => {
43
+ return this.get(`${urls.identity.configurations.v1}/password-history-policy`);
44
+ };
45
+ this.getVendorPasswordHistoryPolicy = async () => {
46
+ return this.get(`${urls.identity.configurations.v1}/password-history-policy/vendor`);
47
+ };
48
+ this.savePasswordHistoryPolicy = async body => {
49
+ if (body.id) {
50
+ return this.patch(`${urls.identity.configurations.v1}/password-history-policy`, body);
51
+ } else {
52
+ return this.post(`${urls.identity.configurations.v1}/password-history-policy`, body);
53
+ }
54
+ };
55
+ this.getPasswordConfigPolicy = async () => {
56
+ return this.get(`${urls.identity.configurations.v1}/password`);
57
+ };
58
+ this.getDomainRestrictions = async () => {
59
+ return this.get(`${urls.identity.restrictions.emailDomain.v1}`);
60
+ };
61
+ this.getDomainRestrictionsConfig = async () => {
62
+ return this.get(`${urls.identity.restrictions.emailDomain.v1}/config`);
63
+ };
64
+ this.createDomainRestriction = async body => {
65
+ return this.post(`${urls.identity.restrictions.emailDomain.v1}`, body);
66
+ };
67
+ this.updateDomainRestrictionConfig = async body => {
68
+ return this.post(`${urls.identity.restrictions.emailDomain.v1}/config`, body);
69
+ };
70
+ this.deleteDomainRestriction = async id => {
71
+ return this.delete(`${urls.identity.restrictions.emailDomain.v1}/${id}`);
72
+ };
73
+ this.getIPRestrictions = async params => {
74
+ return this.get(`${urls.identity.restrictions.ip.v1}`, params);
75
+ };
76
+ this.getIPRestrictionsConfig = async () => {
77
+ return this.get(`${urls.identity.restrictions.ip.v1}/config`);
78
+ };
79
+ this.createIPRestriction = async body => {
80
+ return this.post(`${urls.identity.restrictions.ip.v1}`, body);
81
+ };
82
+ this.bulkCreateIPRestriction = async body => {
83
+ return this.post(`${urls.identity.restrictions.ip.v1}/bulk`, body);
84
+ };
85
+ this.updateIPRestrictionConfig = async body => {
86
+ return this.post(`${urls.identity.restrictions.ip.v1}/config`, body);
87
+ };
88
+ this.deleteIPRestriction = async id => {
89
+ return this.delete(`${urls.identity.restrictions.ip.v1}/${id}`);
90
+ };
91
+ this.testCurrentIp = async () => {
92
+ return this.post(`${urls.identity.restrictions.ip.v1}/verify`);
93
+ };
94
+ this.testCurrentIpInAllowList = async () => {
95
+ return this.post(`${urls.identity.restrictions.ip.v1}/verify/allow`);
96
+ };
44
97
  }
98
+
99
+ /** Get global secure access configuration */
45
100
  }
46
- export async function getPasswordConfigPolicy() {
47
- return Get(`${urls.identity.configurations.v1}/password`);
48
- }
101
+
102
+ export default new SecurityPolicyApi('default');
@@ -1,4 +1,4 @@
1
- export declare type EnforceMFAType = 'DontForce' | 'Force' | 'ForceExceptSAML';
1
+ export type EnforceMFAType = 'DontForce' | 'Force' | 'ForceExceptSAML';
2
2
  export interface ISecurityPolicy {
3
3
  id: string;
4
4
  enforceMFAType?: EnforceMFAType;
@@ -67,4 +67,64 @@ export interface TestConfig {
67
67
  minPhraseLength: number;
68
68
  minOptionalTestsToPass: number;
69
69
  }
70
- export declare type ISecurityPolicyPasswordConfig = Partial<TestConfig>;
70
+ export type ISecurityPolicyPasswordConfig = Partial<TestConfig>;
71
+ export declare enum RestrictionType {
72
+ ALLOW = "ALLOW",
73
+ BLOCK = "BLOCK"
74
+ }
75
+ export interface UpdateDomainRestrictionsConfig {
76
+ active: boolean;
77
+ blockPublicDomains?: boolean;
78
+ type?: RestrictionType;
79
+ }
80
+ export interface CreateDomainRestriction {
81
+ domain: string;
82
+ type: RestrictionType;
83
+ }
84
+ export interface DomainRestriction {
85
+ id: string;
86
+ domain: string;
87
+ type: RestrictionType;
88
+ }
89
+ export interface DomainRestrictionConfig {
90
+ active: boolean;
91
+ listType: RestrictionType;
92
+ blockPublicDomains: boolean;
93
+ }
94
+ export interface IPRestrictionsConfig {
95
+ isActive: boolean;
96
+ strategy?: RestrictionType;
97
+ }
98
+ export interface GetIPRestrictionsParams {
99
+ _offset: number;
100
+ _limit: number;
101
+ _filter: string;
102
+ }
103
+ export interface IPValidResponse {
104
+ valid: boolean;
105
+ }
106
+ export interface CreateIpRestriction {
107
+ ip: string;
108
+ strategy?: RestrictionType;
109
+ isActive?: boolean;
110
+ description?: string;
111
+ }
112
+ export interface UpdateIpRestriction {
113
+ id: string;
114
+ ip: string;
115
+ strategy: RestrictionType;
116
+ isActive?: boolean;
117
+ description?: string;
118
+ }
119
+ export interface BulkCreateIpRestriction {
120
+ ips: CreateIpRestriction[];
121
+ }
122
+ export interface IpRestriction {
123
+ id: string;
124
+ ip: string;
125
+ strategy: RestrictionType;
126
+ isActive: boolean;
127
+ description?: string;
128
+ createdAt: Date;
129
+ updatedAt: Date;
130
+ }
@@ -1 +1,5 @@
1
- export {};
1
+ export let RestrictionType;
2
+ (function (RestrictionType) {
3
+ RestrictionType["ALLOW"] = "ALLOW";
4
+ RestrictionType["BLOCK"] = "BLOCK";
5
+ })(RestrictionType || (RestrictionType = {}));
@@ -0,0 +1,10 @@
1
+ import { GetCurrentUserTenantsResponse } from '../users/interfaces';
2
+ export interface ConditionalAction<T = any> {
3
+ action: () => Promise<T>;
4
+ shouldLoad: boolean;
5
+ }
6
+ export declare function executeConditionalPromise({ shouldLoad, action }: ConditionalAction): Promise<any>;
7
+ export declare function setTabTenantInSessionStorage(tenantId: string): void;
8
+ export declare function removeTabTenantFromSessionStorage(): void;
9
+ export declare function getTabTenantFromSessionStorage(appName: string): string | null;
10
+ export declare function getCurrentUserTenantsFunction(appName: string): () => Promise<GetCurrentUserTenantsResponse>;
package/auth/utils.js ADDED
@@ -0,0 +1,35 @@
1
+ import { ContextHolder } from '../ContextHolder';
2
+ import { USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF } from './constants';
3
+ import { FeatureFlags } from '../feature-flags';
4
+ import { UsersApi } from '../users';
5
+ import { FRONTEGG_SEPARATE_TABS_BY_TENANT } from './constants';
6
+ export async function executeConditionalPromise({
7
+ shouldLoad,
8
+ action
9
+ }) {
10
+ if (!shouldLoad) return;
11
+ return await action();
12
+ }
13
+ export function setTabTenantInSessionStorage(tenantId) {
14
+ if (!tenantId) {
15
+ return;
16
+ }
17
+ sessionStorage.setItem(FRONTEGG_SEPARATE_TABS_BY_TENANT, tenantId);
18
+ }
19
+ export function removeTabTenantFromSessionStorage() {
20
+ sessionStorage.removeItem(FRONTEGG_SEPARATE_TABS_BY_TENANT);
21
+ }
22
+ export function getTabTenantFromSessionStorage(appName) {
23
+ if (!ContextHolder.for(appName).isSessionPerTenantEnabled()) {
24
+ return null;
25
+ }
26
+ return sessionStorage.getItem(FRONTEGG_SEPARATE_TABS_BY_TENANT);
27
+ }
28
+ export function getCurrentUserTenantsFunction(appName) {
29
+ const usersApi = new UsersApi(appName);
30
+ const [useCurrentUserTenantsV1] = FeatureFlags.getFeatureFlags([USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF], appName);
31
+ if (ContextHolder.for(appName).isSessionPerTenantEnabled()) {
32
+ return usersApi.getCurrentUserTenantsV1;
33
+ }
34
+ return useCurrentUserTenantsV1 ? usersApi.getCurrentUserTenantsV1 : usersApi.getCurrentUserTenantsV3;
35
+ }
@@ -1,27 +1,126 @@
1
- import { IWebhookTest, IWebhooksSaveData, ISlackSubscription, IEmailSMSConfigResponse, IEmailSMSSubscriptionResponse } from './interfaces';
2
- export declare const getSlackConfiguration: () => Promise<any>;
3
- export declare const getSlackScope: () => Promise<any>;
4
- export declare const getSlackChannels: () => Promise<any>;
5
- export declare const postSlackConfiguration: (data: ISlackSubscription) => Promise<any>;
6
- export declare const deleteSlackConfiguration: (data: Required<ISlackSubscription>) => Promise<any>;
7
- export declare const postSlackCode: (code: string) => Promise<any>;
8
- export declare const getEmailConfiguration: () => Promise<IEmailSMSConfigResponse[]>;
9
- export declare const postEmailConfiguration: ({ eventKey, ...data }: IEmailSMSConfigResponse) => Promise<null>;
10
- export declare const patchEmailConfiguration: ({ eventKey, enabled, }: Pick<IEmailSMSConfigResponse, 'eventKey' | 'enabled'>) => Promise<null>;
11
- export declare const deleteEmailSubscriptions: (eventKey: string, subscriptionId: string) => Promise<null>;
12
- export declare const putEmailSubscriptions: (subscriptionId: string, eventKey: string, data: IEmailSMSSubscriptionResponse) => Promise<null>;
13
- export declare const deleteEmailConfiguration: (eventKey: string) => Promise<null>;
14
- export declare const getSMSConfiguration: () => Promise<IEmailSMSConfigResponse[]>;
15
- export declare const postSMSConfiguration: ({ eventKey, ...data }: IEmailSMSConfigResponse) => Promise<any>;
16
- export declare const patchSMSConfiguration: ({ eventKey, enabled, }: Pick<IEmailSMSConfigResponse, 'eventKey' | 'enabled'>) => Promise<null>;
17
- export declare const deleteSMSSubscriptions: (eventKey: string, subscriptionId: string) => Promise<null>;
18
- export declare const putSMSSubscriptions: (subscriptionId: string, eventKey: string, data: IEmailSMSSubscriptionResponse) => Promise<null>;
19
- export declare const deleteSMSConfiguration: (eventKey: string) => Promise<null>;
20
- export declare const getWebhooksConfigurations: () => Promise<any>;
21
- export declare const postWebhooksConfiguration: (data: IWebhooksSaveData) => Promise<any>;
22
- export declare const deleteWebhooksConfiguration: (id: string) => Promise<null>;
23
- export declare const getWebhookLog: (id: string, offset?: number, limit?: number) => Promise<any>;
24
- export declare const postWebhookTest: (data: IWebhookTest) => Promise<any>;
25
- export declare const postWebhookRetry: (id: string) => Promise<any>;
26
- export declare const getCategories: () => Promise<any>;
27
- export declare const getChannelMaps: (channels: string) => Promise<any>;
1
+ import { IWebhookTest, IWebhooksSaveData, ISlackSubscription, IEmailSMSConfigResponse, IEmailSMSSubscriptionResponse, ISlackChannel, ISlackConfigurations, IWebhookLog, ICategory, IChannelsMap } from './interfaces';
2
+ import { BaseApiClient } from '../BaseApiClient';
3
+ export declare class ConnectivityApi extends BaseApiClient {
4
+ constructor(appName: string);
5
+ /** Get Slack configuration */
6
+ getSlackConfiguration: () => Promise<ISlackConfigurations>;
7
+ /** Get Slack scope */
8
+ getSlackScope: () => Promise<unknown>;
9
+ /** Get Slack channels */
10
+ getSlackChannels: () => Promise<ISlackChannel[] | undefined>;
11
+ /**
12
+ * Post Slack configuration
13
+ * @param data Slack subscription data
14
+ */
15
+ postSlackConfiguration: (data: ISlackSubscription) => Promise<any>;
16
+ /**
17
+ * Delete Slack configuration
18
+ * @param data Required Slack subscription data
19
+ */
20
+ deleteSlackConfiguration: (data: Required<ISlackSubscription>) => Promise<unknown>;
21
+ /**
22
+ * Post Slack code
23
+ * @param code Slack authorization code
24
+ */
25
+ postSlackCode: (code: string) => Promise<unknown>;
26
+ /** Get email configuration */
27
+ getEmailConfiguration: () => Promise<IEmailSMSConfigResponse[]>;
28
+ /**
29
+ * Post email configuration
30
+ * @param data Email configuration data
31
+ */
32
+ postEmailConfiguration: ({ eventKey, ...data }: IEmailSMSConfigResponse) => Promise<null>;
33
+ /**
34
+ * Patch email configuration
35
+ * @param enabled Email configuration enabled status
36
+ * @param eventKey Email event key
37
+ */
38
+ patchEmailConfiguration: ({ eventKey, enabled, }: Pick<IEmailSMSConfigResponse, "eventKey" | "enabled">) => Promise<null>;
39
+ /**
40
+ * Delete email subscriptions
41
+ * @param eventKey Email event key
42
+ * @param subscriptionId Email subscription ID
43
+ */
44
+ deleteEmailSubscriptions: (eventKey: string, subscriptionId: string) => Promise<null>;
45
+ /**
46
+ * Put email subscriptions
47
+ * @param subscriptionId Email subscription ID
48
+ * @param eventKey Email event key
49
+ * @param data Email subscription data
50
+ */
51
+ putEmailSubscriptions: (subscriptionId: string, eventKey: string, data: IEmailSMSSubscriptionResponse) => Promise<null>;
52
+ /**
53
+ * Delete email configuration
54
+ * @param eventKey Email event key
55
+ */
56
+ deleteEmailConfiguration: (eventKey: string) => Promise<null>;
57
+ /** Get SMS configuration */
58
+ getSMSConfiguration: () => Promise<IEmailSMSConfigResponse[]>;
59
+ /**
60
+ * Post SMS configuration
61
+ * @param data SMS configuration data
62
+ */
63
+ postSMSConfiguration: ({ eventKey, ...data }: IEmailSMSConfigResponse) => Promise<unknown>;
64
+ /**
65
+ * Patch SMS configuration
66
+ * @param enabled SMS configuration enabled status
67
+ * @param eventKey SMS event key
68
+ */
69
+ patchSMSConfiguration: ({ eventKey, enabled, }: Pick<IEmailSMSConfigResponse, "eventKey" | "enabled">) => Promise<null>;
70
+ /**
71
+ * Delete SMS subscriptions
72
+ * @param eventKey SMS event key
73
+ * @param subscriptionId SMS subscription ID
74
+ */
75
+ deleteSMSSubscriptions: (eventKey: string, subscriptionId: string) => Promise<null>;
76
+ /**
77
+ * Put SMS subscriptions
78
+ * @param subscriptionId SMS subscription ID
79
+ * @param eventKey SMS event key
80
+ * @param data SMS subscription data
81
+ */
82
+ putSMSSubscriptions: (subscriptionId: string, eventKey: string, data: IEmailSMSSubscriptionResponse) => Promise<null>;
83
+ /**
84
+ * Delete SMS configuration
85
+ * @param eventKey SMS event key
86
+ */
87
+ deleteSMSConfiguration: (eventKey: string) => Promise<null>;
88
+ /** Get webhooks configurations */
89
+ getWebhooksConfigurations: () => Promise<unknown>;
90
+ /**
91
+ * Post webhooks configuration
92
+ * @param data Webhooks save data
93
+ */
94
+ postWebhooksConfiguration: (data: IWebhooksSaveData) => Promise<unknown>;
95
+ /**
96
+ * Delete webhooks configuration
97
+ * @param id Webhook ID
98
+ */
99
+ deleteWebhooksConfiguration: (id: string) => Promise<null>;
100
+ /**
101
+ * Get webhook log
102
+ * @param id Webhook ID
103
+ * @param offset Pagination offset
104
+ * @param limit Pagination limit
105
+ */
106
+ getWebhookLog: (id: string, offset?: number, limit?: number) => Promise<unknown>;
107
+ /**
108
+ * Post webhook test
109
+ * @param data Webhook test data
110
+ */
111
+ postWebhookTest: (data: IWebhookTest) => Promise<IWebhookLog>;
112
+ /**
113
+ * Post webhook retry
114
+ * @param id Webhook log ID
115
+ */
116
+ postWebhookRetry: (id: string) => Promise<IWebhookLog>;
117
+ /** Get event categories */
118
+ getCategories: () => Promise<ICategory[]>;
119
+ /**
120
+ * Get channel maps
121
+ * @param channels Channel names
122
+ */
123
+ getChannelMaps: (channels: string) => Promise<IChannelsMap[]>;
124
+ }
125
+ declare const _default: ConnectivityApi;
126
+ export default _default;