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

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 (123) hide show
  1. package/BaseApiClient.d.ts +16 -0
  2. package/BaseApiClient.js +39 -0
  3. package/ContextHolder/index.d.ts +108 -27
  4. package/ContextHolder/index.js +155 -50
  5. package/FetchClient.d.ts +42 -0
  6. package/FetchClient.js +308 -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 +817 -768
  14. package/auth/index.js +902 -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 +9 -8
  19. package/connectivity/index.d.ts +126 -27
  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 +154 -108
  32. package/index.js +109 -78
  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 +155 -50
  38. package/node/FetchClient.js +326 -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 +768 -1035
  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 +116 -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 +90 -89
  58. package/node/subscriptions/index.js +69 -107
  59. package/node/subscriptions/invoices.js +25 -17
  60. package/node/subscriptions/managedSubscriptions.js +32 -27
  61. package/node/subscriptions/paymentMethods.js +27 -20
  62. package/node/subscriptions/paymentProviders.js +15 -6
  63. package/node/subscriptions/plans.js +17 -9
  64. package/node/subscriptions/providers/stripe/index.js +26 -21
  65. package/node/subscriptions/subscriptions.js +32 -27
  66. package/node/subscriptions/summaries.js +15 -6
  67. package/node/subscriptions/tenantConfiguration.js +17 -9
  68. package/node/subscriptions/vendorPublicConfigurations.js +15 -6
  69. package/node/teams/index.js +130 -138
  70. package/node/tenants/index.js +65 -60
  71. package/node/user-phone-numbers/index.js +32 -24
  72. package/node/users/index.js +58 -53
  73. package/node/vendor/index.js +17 -6
  74. package/notifications/index.d.ts +22 -16
  75. package/notifications/index.js +33 -22
  76. package/package.json +1 -1
  77. package/reports/index.d.ts +50 -44
  78. package/reports/index.js +75 -62
  79. package/roles/index.d.ts +44 -38
  80. package/roles/index.js +57 -41
  81. package/security-center/index.d.ts +14 -2
  82. package/security-center/index.js +15 -6
  83. package/sub-tenants/index.d.ts +57 -15
  84. package/sub-tenants/index.js +88 -68
  85. package/subscriptions/index.d.ts +56 -11
  86. package/subscriptions/index.js +58 -11
  87. package/subscriptions/invoices.d.ts +16 -13
  88. package/subscriptions/invoices.js +24 -14
  89. package/subscriptions/managedSubscriptions.d.ts +18 -15
  90. package/subscriptions/managedSubscriptions.js +33 -22
  91. package/subscriptions/paymentMethods.d.ts +16 -13
  92. package/subscriptions/paymentMethods.js +26 -17
  93. package/subscriptions/paymentProviders.d.ts +8 -5
  94. package/subscriptions/paymentProviders.js +11 -4
  95. package/subscriptions/plans.d.ts +11 -8
  96. package/subscriptions/plans.js +14 -6
  97. package/subscriptions/providers/stripe/index.d.ts +24 -21
  98. package/subscriptions/providers/stripe/index.js +27 -16
  99. package/subscriptions/subscriptions.d.ts +24 -21
  100. package/subscriptions/subscriptions.js +33 -22
  101. package/subscriptions/summaries.d.ts +7 -4
  102. package/subscriptions/summaries.js +10 -3
  103. package/subscriptions/tenantConfiguration.d.ts +6 -3
  104. package/subscriptions/tenantConfiguration.js +15 -7
  105. package/subscriptions/vendorPublicConfigurations.d.ts +5 -2
  106. package/subscriptions/vendorPublicConfigurations.js +11 -4
  107. package/teams/index.d.ts +35 -131
  108. package/teams/index.js +122 -93
  109. package/tenants/index.d.ts +25 -37
  110. package/tenants/index.js +62 -46
  111. package/tenants/interfaces.d.ts +2 -0
  112. package/user-phone-numbers/index.d.ts +32 -26
  113. package/user-phone-numbers/index.js +32 -19
  114. package/users/index.d.ts +21 -15
  115. package/users/index.js +60 -44
  116. package/vendor/index.d.ts +12 -6
  117. package/vendor/index.js +11 -4
  118. package/fetch.d.ts +0 -24
  119. package/fetch.js +0 -265
  120. package/node/fetch.js +0 -306
  121. package/node/subscriptions/providers/index.js +0 -18
  122. package/subscriptions/providers/index.d.ts +0 -1
  123. package/subscriptions/providers/index.js +0 -1
@@ -1,104 +1,60 @@
1
1
  import { ISaveSecurityPolicyMfa, ISaveSecurityPolicyLockout, ISecurityPolicyMfa, ISecurityPolicyLockout, ISecurityPolicyCaptcha, ISecurityPolicyPasswordHistory, ISaveSecurityPolicyPasswordHistory, ISecurityPolicyPasswordConfig, ISecurityPolicy, DomainRestriction, DomainRestrictionConfig, CreateDomainRestriction, UpdateDomainRestrictionsConfig, IpRestriction, IPRestrictionsConfig, BulkCreateIpRestriction, CreateIpRestriction, GetIPRestrictionsParams, IPValidResponse } from './interfaces';
2
2
  import { FronteggPaginationResult } from '../../interfaces';
3
- /**
4
- * Get global secure access configuration
5
- */
6
- export declare function getGlobalSecurityPolicy(): Promise<ISecurityPolicy>;
7
- /**
8
- * Get Mfa configuration from security policy
9
- */
10
- export declare function getMfaPolicy(): Promise<ISecurityPolicyMfa>;
11
- /**
12
- * Get Vendor Mfa configuration from security policy
13
- */
14
- export declare function getVendorMfaPolicy(): Promise<ISecurityPolicyMfa>;
15
- /**
16
- * Create/Update Mfa configuration from security policy
17
- */
18
- export declare function saveMfaPolicy(body: ISaveSecurityPolicyMfa): Promise<ISecurityPolicyMfa>;
19
- /**
20
- * Get Lockout configuration from security policy
21
- */
22
- export declare function getLockoutPolicy(): Promise<ISecurityPolicyLockout>;
23
- /**
24
- * Get Vendor Lockout configuration from security policy
25
- */
26
- export declare function getVendorLockoutPolicy(): Promise<ISecurityPolicyLockout>;
27
- /**
28
- * Create/Update Lockout configuration from security policy
29
- */
30
- export declare function saveLockoutPolicy(body: ISaveSecurityPolicyLockout): Promise<ISecurityPolicyLockout>;
31
- /**
32
- * Get Captcha configuration from security policy
33
- */
34
- export declare function getCaptchaPolicy(): Promise<ISecurityPolicyCaptcha | null>;
35
- /**
36
- * Get Password History configuration from security policy
37
- */
38
- export declare function getPasswordHistoryPolicy(): Promise<ISecurityPolicyPasswordHistory>;
39
- /**
40
- * Get Vendor Password History configuration from security policy
41
- */
42
- export declare function getVendorPasswordHistoryPolicy(): Promise<ISecurityPolicyPasswordHistory>;
43
- /**
44
- * Create/Update Password History configuration from security policy
45
- */
46
- export declare function savePasswordHistoryPolicy(body: ISaveSecurityPolicyPasswordHistory): Promise<ISecurityPolicyPasswordHistory>;
47
- /**
48
- * load vendor password configuration.
49
- */
50
- export declare function getPasswordConfigPolicy(): Promise<ISecurityPolicyPasswordConfig>;
51
- /**
52
- * Get domain restrictions for tenant
53
- */
54
- export declare function getDomainRestrictions(): Promise<{
55
- items: DomainRestriction[];
56
- }>;
57
- /**
58
- * Get domain restrictions config for tenant
59
- */
60
- export declare function getDomainRestrictionsConfig(): Promise<DomainRestrictionConfig>;
61
- /**
62
- * Create domain restriction for tenant
63
- */
64
- export declare function createDomainRestriction(body: CreateDomainRestriction): Promise<DomainRestriction>;
65
- /**
66
- * Update domain restrictions config for tenant
67
- */
68
- export declare function updateDomainRestrictionConfig(body: UpdateDomainRestrictionsConfig): Promise<DomainRestrictionConfig>;
69
- /**
70
- * Delete domain restriction for tenant by id
71
- */
72
- export declare function deleteDomainRestriction(id: string): Promise<void>;
73
- /**
74
- * Get ip restrictions for tenant
75
- */
76
- export declare function getIPRestrictions(params: GetIPRestrictionsParams): Promise<FronteggPaginationResult<IpRestriction[]>>;
77
- /**
78
- * Get ip restrictions config for tenant
79
- */
80
- export declare function getIPRestrictionsConfig(): Promise<IPRestrictionsConfig>;
81
- /**
82
- * Create ip restriction for tenant
83
- */
84
- export declare function createIPRestriction(body: CreateIpRestriction): Promise<void>;
85
- /**
86
- * Create bulk ip restrictions for tenant
87
- */
88
- export declare function bulkCreateIPRestriction(body: BulkCreateIpRestriction): Promise<void>;
89
- /**
90
- * Update ip restrictions config for tenant
91
- */
92
- export declare function updateIPRestrictionConfig(body: IPRestrictionsConfig): Promise<void>;
93
- /**
94
- * Delete ip restriction for tenant by id
95
- */
96
- export declare function deleteIPRestriction(id: string): Promise<void>;
97
- /**
98
- * Test current user ip restriction
99
- */
100
- export declare function testCurrentIp(): Promise<IPValidResponse>;
101
- /**
102
- * Test current user ip restriction is in allow list
103
- */
104
- export declare function testCurrentIpInAllowList(): Promise<IPValidResponse>;
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,93 +1,125 @@
1
- import { Delete, 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 getVendorLockoutPolicy() {
23
- return Get(`${urls.identity.configurations.v1}/lockout-policy/vendor`);
24
- }
25
- export async function saveLockoutPolicy(body) {
26
- if (body.id) {
27
- return Patch(`${urls.identity.configurations.v1}/lockout-policy`, body);
28
- } else {
29
- return Post(`${urls.identity.configurations.v1}/lockout-policy`, body);
30
- }
31
- }
32
- export async function getCaptchaPolicy() {
33
- try {
34
- return await Get(`${urls.identity.configurations.v1}/captcha-policy/public`);
35
- } catch {
36
- return null;
37
- }
38
- }
39
- export async function getPasswordHistoryPolicy() {
40
- return Get(`${urls.identity.configurations.v1}/password-history-policy`);
41
- }
42
- export async function getVendorPasswordHistoryPolicy() {
43
- return Get(`${urls.identity.configurations.v1}/password-history-policy/vendor`);
44
- }
45
- export async function savePasswordHistoryPolicy(body) {
46
- if (body.id) {
47
- return Patch(`${urls.identity.configurations.v1}/password-history-policy`, body);
48
- } else {
49
- 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
+
7
+ this.getGlobalSecurityPolicy = async () => {
8
+ return this.get(urls.identity.configurations.v1);
9
+ };
10
+
11
+ this.getMfaPolicy = async () => {
12
+ return this.get(`${urls.identity.configurations.v1}/mfa-policy`);
13
+ };
14
+
15
+ this.getVendorMfaPolicy = async () => {
16
+ return this.get(`${urls.identity.configurations.v1}/mfa-policy/vendor`);
17
+ };
18
+
19
+ this.saveMfaPolicy = async body => {
20
+ if (body.id) {
21
+ return this.patch(`${urls.identity.configurations.v1}/mfa-policy`, body);
22
+ } else {
23
+ return this.post(`${urls.identity.configurations.v1}/mfa-policy`, body);
24
+ }
25
+ };
26
+
27
+ this.getLockoutPolicy = async () => {
28
+ return this.get(`${urls.identity.configurations.v1}/lockout-policy`);
29
+ };
30
+
31
+ this.getVendorLockoutPolicy = async () => {
32
+ return this.get(`${urls.identity.configurations.v1}/lockout-policy/vendor`);
33
+ };
34
+
35
+ this.saveLockoutPolicy = async body => {
36
+ if (body.id) {
37
+ return this.patch(`${urls.identity.configurations.v1}/lockout-policy`, body);
38
+ } else {
39
+ return this.post(`${urls.identity.configurations.v1}/lockout-policy`, body);
40
+ }
41
+ };
42
+
43
+ this.getCaptchaPolicy = async () => {
44
+ try {
45
+ return await this.get(`${urls.identity.configurations.v1}/captcha-policy/public`);
46
+ } catch {
47
+ return null;
48
+ }
49
+ };
50
+
51
+ this.getPasswordHistoryPolicy = async () => {
52
+ return this.get(`${urls.identity.configurations.v1}/password-history-policy`);
53
+ };
54
+
55
+ this.getVendorPasswordHistoryPolicy = async () => {
56
+ return this.get(`${urls.identity.configurations.v1}/password-history-policy/vendor`);
57
+ };
58
+
59
+ this.savePasswordHistoryPolicy = async body => {
60
+ if (body.id) {
61
+ return this.patch(`${urls.identity.configurations.v1}/password-history-policy`, body);
62
+ } else {
63
+ return this.post(`${urls.identity.configurations.v1}/password-history-policy`, body);
64
+ }
65
+ };
66
+
67
+ this.getPasswordConfigPolicy = async () => {
68
+ return this.get(`${urls.identity.configurations.v1}/password`);
69
+ };
70
+
71
+ this.getDomainRestrictions = async () => {
72
+ return this.get(`${urls.identity.restrictions.emailDomain.v1}`);
73
+ };
74
+
75
+ this.getDomainRestrictionsConfig = async () => {
76
+ return this.get(`${urls.identity.restrictions.emailDomain.v1}/config`);
77
+ };
78
+
79
+ this.createDomainRestriction = async body => {
80
+ return this.post(`${urls.identity.restrictions.emailDomain.v1}`, body);
81
+ };
82
+
83
+ this.updateDomainRestrictionConfig = async body => {
84
+ return this.post(`${urls.identity.restrictions.emailDomain.v1}/config`, body);
85
+ };
86
+
87
+ this.deleteDomainRestriction = async id => {
88
+ return this.delete(`${urls.identity.restrictions.emailDomain.v1}/${id}`);
89
+ };
90
+
91
+ this.getIPRestrictions = async params => {
92
+ return this.get(`${urls.identity.restrictions.ip.v1}`, params);
93
+ };
94
+
95
+ this.getIPRestrictionsConfig = async () => {
96
+ return this.get(`${urls.identity.restrictions.ip.v1}/config`);
97
+ };
98
+
99
+ this.createIPRestriction = async body => {
100
+ return this.post(`${urls.identity.restrictions.ip.v1}`, body);
101
+ };
102
+
103
+ this.bulkCreateIPRestriction = async body => {
104
+ return this.post(`${urls.identity.restrictions.ip.v1}/bulk`, body);
105
+ };
106
+
107
+ this.updateIPRestrictionConfig = async body => {
108
+ return this.post(`${urls.identity.restrictions.ip.v1}/config`, body);
109
+ };
110
+
111
+ this.deleteIPRestriction = async id => {
112
+ return this.delete(`${urls.identity.restrictions.ip.v1}/${id}`);
113
+ };
114
+
115
+ this.testCurrentIp = async () => {
116
+ return this.post(`${urls.identity.restrictions.ip.v1}/verify`);
117
+ };
118
+
119
+ this.testCurrentIpInAllowList = async () => {
120
+ return this.post(`${urls.identity.restrictions.ip.v1}/verify/allow`);
121
+ };
50
122
  }
123
+
51
124
  }
52
- export async function getPasswordConfigPolicy() {
53
- return Get(`${urls.identity.configurations.v1}/password`);
54
- }
55
- export async function getDomainRestrictions() {
56
- return Get(`${urls.identity.restrictions.emailDomain.v1}`);
57
- }
58
- export async function getDomainRestrictionsConfig() {
59
- return Get(`${urls.identity.restrictions.emailDomain.v1}/config`);
60
- }
61
- export async function createDomainRestriction(body) {
62
- return Post(`${urls.identity.restrictions.emailDomain.v1}`, body);
63
- }
64
- export async function updateDomainRestrictionConfig(body) {
65
- return Post(`${urls.identity.restrictions.emailDomain.v1}/config`, body);
66
- }
67
- export async function deleteDomainRestriction(id) {
68
- return Delete(`${urls.identity.restrictions.emailDomain.v1}/${id}`);
69
- }
70
- export async function getIPRestrictions(params) {
71
- return Get(`${urls.identity.restrictions.ip.v1}`, params);
72
- }
73
- export async function getIPRestrictionsConfig() {
74
- return Get(`${urls.identity.restrictions.ip.v1}/config`);
75
- }
76
- export async function createIPRestriction(body) {
77
- return Post(`${urls.identity.restrictions.ip.v1}`, body);
78
- }
79
- export async function bulkCreateIPRestriction(body) {
80
- return Post(`${urls.identity.restrictions.ip.v1}/bulk`, body);
81
- }
82
- export async function updateIPRestrictionConfig(body) {
83
- return Post(`${urls.identity.restrictions.ip.v1}/config`, body);
84
- }
85
- export async function deleteIPRestriction(id) {
86
- return Delete(`${urls.identity.restrictions.ip.v1}/${id}`);
87
- }
88
- export async function testCurrentIp() {
89
- return Post(`${urls.identity.restrictions.ip.v1}/verify`);
90
- }
91
- export async function testCurrentIpInAllowList() {
92
- return Post(`${urls.identity.restrictions.ip.v1}/verify/allow`);
93
- }
125
+ export default new SecurityPolicyApi('default');
package/auth/utils.d.ts CHANGED
@@ -6,5 +6,5 @@ export interface ConditionalAction<T = any> {
6
6
  export declare function executeConditionalPromise({ shouldLoad, action }: ConditionalAction): Promise<any>;
7
7
  export declare function setTabTenantInSessionStorage(tenantId: string): void;
8
8
  export declare function removeTabTenantFromSessionStorage(): void;
9
- export declare function getTabTenantFromSessionStorage(): string | null;
10
- export declare function getCurrentUserTenantsFunction(): () => Promise<GetCurrentUserTenantsResponse>;
9
+ export declare function getTabTenantFromSessionStorage(appName: string): string | null;
10
+ export declare function getCurrentUserTenantsFunction(appName: string): () => Promise<GetCurrentUserTenantsResponse>;
package/auth/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ContextHolder } from '../ContextHolder';
2
2
  import { USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF } from './constants';
3
3
  import { FeatureFlags } from '../feature-flags';
4
- import { getCurrentUserTenantsV1, getCurrentUserTenantsV3 } from '../users';
4
+ import { UsersApi } from '../users';
5
5
  import { FRONTEGG_SEPARATE_TABS_BY_TENANT } from './constants';
6
6
  ;
7
7
  export async function executeConditionalPromise({
@@ -21,19 +21,20 @@ export function setTabTenantInSessionStorage(tenantId) {
21
21
  export function removeTabTenantFromSessionStorage() {
22
22
  sessionStorage.removeItem(FRONTEGG_SEPARATE_TABS_BY_TENANT);
23
23
  }
24
- export function getTabTenantFromSessionStorage() {
25
- if (!ContextHolder.isSessionPerTenantEnabled()) {
24
+ export function getTabTenantFromSessionStorage(appName) {
25
+ if (!ContextHolder.for(appName).isSessionPerTenantEnabled()) {
26
26
  return null;
27
27
  }
28
28
 
29
29
  return sessionStorage.getItem(FRONTEGG_SEPARATE_TABS_BY_TENANT);
30
30
  }
31
- export function getCurrentUserTenantsFunction() {
32
- const [useCurrentUserTenantsV1] = FeatureFlags.getFeatureFlags([USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF], ContextHolder.getAppName() || '');
31
+ export function getCurrentUserTenantsFunction(appName) {
32
+ const usersApi = new UsersApi(appName);
33
+ const [useCurrentUserTenantsV1] = FeatureFlags.getFeatureFlags([USE_CURRENT_USER_TENANTS_V1_ENDPOINT_FF], appName);
33
34
 
34
- if (ContextHolder.isSessionPerTenantEnabled()) {
35
- return getCurrentUserTenantsV1;
35
+ if (ContextHolder.for(appName).isSessionPerTenantEnabled()) {
36
+ return usersApi.getCurrentUserTenantsV1;
36
37
  }
37
38
 
38
- return useCurrentUserTenantsV1 ? getCurrentUserTenantsV1 : getCurrentUserTenantsV3;
39
+ return useCurrentUserTenantsV1 ? usersApi.getCurrentUserTenantsV1 : usersApi.getCurrentUserTenantsV3;
39
40
  }
@@ -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;