@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
@@ -3,32 +3,37 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createStripeCustomer = createStripeCustomer;
7
- exports.createStripePaymentMethodSetupIntentSecret = createStripePaymentMethodSetupIntentSecret;
8
- exports.createSubscription = createSubscription;
9
- exports.getStripeCustomer = getStripeCustomer;
10
- exports.getStripePaymentProviderConfiguration = getStripePaymentProviderConfiguration;
11
-
12
- var _fetch = require("../../../fetch");
6
+ exports.StripeProviderApi = void 0;
13
7
 
14
8
  var _constants = require("../../../constants");
15
9
 
16
- async function createSubscription(request) {
17
- return (0, _fetch.Post)(_constants.urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request);
18
- }
10
+ var _BaseApiClient = require("../../../BaseApiClient");
19
11
 
20
- async function getStripeCustomer(tenantId) {
21
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.paymentProviders.stripe.customers.v1}/${tenantId}`);
22
- }
12
+ class StripeProviderApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(...args) {
14
+ super(...args);
23
15
 
24
- async function createStripeCustomer(request) {
25
- return (0, _fetch.Post)(`${_constants.urls.subscriptions.billing.paymentProviders.stripe.customers.v1}`, request);
26
- }
16
+ this.createSubscription = async request => {
17
+ return this.post(_constants.urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request);
18
+ };
19
+
20
+ this.getStripeCustomer = async tenantId => {
21
+ return this.get(`${_constants.urls.subscriptions.billing.paymentProviders.stripe.customers.v1}/${tenantId}`);
22
+ };
23
+
24
+ this.createStripeCustomer = async request => {
25
+ return this.post(_constants.urls.subscriptions.billing.paymentProviders.stripe.customers.v1, request);
26
+ };
27
+
28
+ this.getStripePaymentProviderConfiguration = async () => {
29
+ return this.get(_constants.urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1);
30
+ };
31
+
32
+ this.createStripePaymentMethodSetupIntentSecret = async request => {
33
+ return this.post(_constants.urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1, request);
34
+ };
35
+ }
27
36
 
28
- async function getStripePaymentProviderConfiguration() {
29
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1}`);
30
37
  }
31
38
 
32
- async function createStripePaymentMethodSetupIntentSecret(request) {
33
- return (0, _fetch.Post)(`${_constants.urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1}`, request);
34
- }
39
+ exports.StripeProviderApi = StripeProviderApi;
@@ -3,38 +3,43 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.cancelSubscription = cancelSubscription;
7
- exports.getSubscription = getSubscription;
8
- exports.getSubscriptions = getSubscriptions;
9
- exports.renewSubscription = renewSubscription;
10
- exports.updateSubscription = updateSubscription;
11
-
12
- var _fetch = require("../fetch");
6
+ exports.SubscriptionApi = void 0;
13
7
 
14
8
  var _constants = require("../constants");
15
9
 
16
- async function getSubscriptions() {
17
- return (0, _fetch.Get)(_constants.urls.subscriptions.billing.subscriptions.v1);
18
- }
10
+ var _BaseApiClient = require("../BaseApiClient");
19
11
 
20
- async function getSubscription(subscriptionId) {
21
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`);
22
- }
12
+ class SubscriptionApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(...args) {
14
+ super(...args);
23
15
 
24
- async function cancelSubscription(subscriptionId) {
25
- return (0, _fetch.Put)(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/cancellations/`, {});
26
- }
16
+ this.getSubscriptions = async () => {
17
+ return this.get(_constants.urls.subscriptions.billing.subscriptions.v1);
18
+ };
19
+
20
+ this.getSubscription = async subscriptionId => {
21
+ return this.get(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`);
22
+ };
23
+
24
+ this.cancelSubscription = async subscriptionId => {
25
+ return this.put(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/cancellations/`, {});
26
+ };
27
+
28
+ this.renewSubscription = async subscriptionId => {
29
+ return this.put(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/renewals/`, {});
30
+ };
31
+
32
+ this.updateSubscription = async (subscriptionId, {
33
+ paymentMethodId,
34
+ planId
35
+ }) => {
36
+ return this.put(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, {
37
+ paymentMethodId,
38
+ planId
39
+ });
40
+ };
41
+ }
27
42
 
28
- async function renewSubscription(subscriptionId) {
29
- return (0, _fetch.Put)(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/renewals/`, {});
30
43
  }
31
44
 
32
- async function updateSubscription(subscriptionId, {
33
- paymentMethodId,
34
- planId
35
- }) {
36
- return (0, _fetch.Put)(`${_constants.urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, {
37
- paymentMethodId,
38
- planId
39
- });
40
- }
45
+ exports.SubscriptionApi = SubscriptionApi;
@@ -3,12 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSubscriptionSummaries = getSubscriptionSummaries;
7
-
8
- var _fetch = require("../fetch");
6
+ exports.SummariesApi = void 0;
9
7
 
10
8
  var _constants = require("../constants");
11
9
 
12
- async function getSubscriptionSummaries(tenantId) {
13
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.summaries.v1}/${tenantId}`);
14
- }
10
+ var _BaseApiClient = require("../BaseApiClient");
11
+
12
+ class SummariesApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(...args) {
14
+ super(...args);
15
+
16
+ this.getSubscriptionSummaries = async tenantId => {
17
+ return this.get(`${_constants.urls.subscriptions.billing.summaries.v1}/${tenantId}`);
18
+ };
19
+ }
20
+
21
+ }
22
+
23
+ exports.SummariesApi = SummariesApi;
@@ -3,17 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createTenantConfiguration = createTenantConfiguration;
7
- exports.getTenantConfiguration = getTenantConfiguration;
8
-
9
- var _fetch = require("../fetch");
6
+ exports.SubscriptionTenantConfigApi = void 0;
10
7
 
11
8
  var _constants = require("../constants");
12
9
 
13
- async function getTenantConfiguration(tenantId) {
14
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.tenantConfiguration.v1}/${tenantId}`);
10
+ var _BaseApiClient = require("../BaseApiClient");
11
+
12
+ class SubscriptionTenantConfigApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(...args) {
14
+ super(...args);
15
+
16
+ this.getTenantConfiguration = async tenantId => {
17
+ return this.get(`${_constants.urls.subscriptions.billing.tenantConfiguration.v1}/${tenantId}`);
18
+ };
19
+
20
+ this.createTenantConfiguration = async request => {
21
+ return this.post(_constants.urls.subscriptions.billing.tenantConfiguration.v1, request);
22
+ };
23
+ }
24
+
15
25
  }
16
26
 
17
- async function createTenantConfiguration(request) {
18
- return (0, _fetch.Post)(`${_constants.urls.subscriptions.billing.tenantConfiguration.v1}`, request);
19
- }
27
+ exports.SubscriptionTenantConfigApi = SubscriptionTenantConfigApi;
@@ -3,12 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getVendorPublicConfigurations = getVendorPublicConfigurations;
7
-
8
- var _fetch = require("../fetch");
6
+ exports.VendorPublicConfigApi = void 0;
9
7
 
10
8
  var _constants = require("../constants");
11
9
 
12
- async function getVendorPublicConfigurations() {
13
- return (0, _fetch.Get)(`${_constants.urls.subscriptions.billing.configurations.vendorPublicConfigurations.v1}`);
14
- }
10
+ var _BaseApiClient = require("../BaseApiClient");
11
+
12
+ class VendorPublicConfigApi extends _BaseApiClient.BaseApiClient {
13
+ constructor(...args) {
14
+ super(...args);
15
+
16
+ this.getVendorPublicConfigurations = async () => {
17
+ return this.get(_constants.urls.subscriptions.billing.configurations.vendorPublicConfigurations.v1);
18
+ };
19
+ }
20
+
21
+ }
22
+
23
+ exports.VendorPublicConfigApi = VendorPublicConfigApi;
@@ -5,146 +5,138 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.addUser = addUser;
9
- exports.changePassword = changePassword;
10
- exports.createInviteUserLink = createInviteUserLink;
11
- exports.deleteInviteUserLink = deleteInviteUserLink;
12
- exports.deleteUser = deleteUser;
13
- exports.getInviteLinkConfiguration = getInviteLinkConfiguration;
14
- exports.getInviteUserLink = getInviteUserLink;
15
- exports.getProfile = getProfile;
16
- exports.getTemporaryUserConfiguration = getTemporaryUserConfiguration;
17
- exports.loadAvailablePermissions = loadAvailablePermissions;
18
- exports.loadAvailableRoles = loadAvailableRoles;
19
- exports.loadStats = loadStats;
20
- exports.loadUsers = loadUsers;
21
- exports.resendActivationLink = resendActivationLink;
22
- exports.resendInvitationLink = resendInvitationLink;
23
- exports.resendInvitationLinkToAllTenants = resendInvitationLinkToAllTenants;
24
- exports.setPermanentUser = setPermanentUser;
25
- exports.updateInviteUserLink = updateInviteUserLink;
26
- exports.updateProfile = updateProfile;
27
- exports.updateProfileImage = updateProfileImage;
28
- exports.updateUser = updateUser;
29
- exports.updateUserExpirationTime = updateUserExpirationTime;
8
+ exports.default = exports.TeamsApi = void 0;
30
9
 
31
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
32
11
 
33
- var _fetch = require("../fetch");
34
-
35
12
  var _constants = require("../constants");
36
13
 
37
- async function getProfile(params) {
38
- return (0, _fetch.Get)(`${_constants.urls.identity.users.v2}/me`, params != null ? params : {
39
- addRoles: true
40
- });
41
- }
42
-
43
- async function updateProfile(body) {
44
- return (0, _fetch.Put)(`${_constants.urls.identity.users.v2}/me`, body);
45
- }
46
-
47
- async function updateProfileImage(body) {
48
- return (0, _fetch.Put)(`${_constants.urls.team.profile.v1}/me/image/v1`, body, {
49
- responseType: 'plain',
50
- contentType: undefined
51
- });
52
- }
53
-
54
- async function changePassword(body) {
55
- return (0, _fetch.Post)(`${_constants.urls.identity.users.v1}/passwords/change`, body);
56
- }
57
-
58
- async function loadUsers(params) {
59
- var _params$sort, _params$sort$0$id, _params$sort2, _params$sort2$, _params$sort3, _params$sort3$;
60
-
61
- const filters = (params.filter || []).reduce((p, n) => (0, _extends2.default)({}, p, {
62
- [n.id]: n.value
63
- }), {});
64
- const sorts = (_params$sort = params.sort) != null && _params$sort.length ? {
65
- sortBy: (_params$sort$0$id = (_params$sort2 = params.sort) == null ? void 0 : (_params$sort2$ = _params$sort2[0]) == null ? void 0 : _params$sort2$.id) != null ? _params$sort$0$id : 'name',
66
- sortDirection: (_params$sort3 = params.sort) != null && (_params$sort3$ = _params$sort3[0]) != null && _params$sort3$.desc ? 'desc' : 'asc'
67
- } : null;
68
- return (0, _fetch.Get)(_constants.urls.team.members.v1, (0, _extends2.default)({
69
- pageOffset: params.pageOffset,
70
- pageSize: params.pageSize
71
- }, filters, sorts));
72
- }
73
-
74
- async function addUser(body) {
75
- return (0, _fetch.Post)(_constants.urls.identity.users.v2, (0, _extends2.default)({}, body, {
76
- provider: 'local'
77
- }));
78
- }
79
-
80
- async function deleteUser(body) {
81
- return (0, _fetch.Delete)(`${_constants.urls.team.members.v1}/${body.userId}`);
82
- }
83
-
84
- async function updateUser(body) {
85
- return (0, _fetch.Put)(_constants.urls.team.members.v1, body);
86
- }
87
-
88
- async function updateUserExpirationTime(body) {
89
- const {
90
- userId,
91
- expirationInSeconds
92
- } = body;
93
- return (0, _fetch.Put)(`${_constants.urls.identity.users.temporary.v1}/${userId}`, {
94
- expirationInSeconds
95
- });
96
- }
97
-
98
- async function setPermanentUser(userId) {
99
- return (0, _fetch.Delete)(`${_constants.urls.identity.users.temporary.v1}/${userId}`);
100
- }
101
-
102
- async function getTemporaryUserConfiguration() {
103
- return (0, _fetch.Get)(_constants.urls.identity.users.temporary.configuration.v1);
104
- }
105
-
106
- async function createInviteUserLink(body) {
107
- return (0, _fetch.Post)(_constants.urls.identity.tenants.invites.user.v1, (0, _extends2.default)({}, body));
108
- }
109
-
110
- async function updateInviteUserLink(body) {
111
- return (0, _fetch.Patch)(_constants.urls.identity.tenants.invites.user.v1, (0, _extends2.default)({}, body));
112
- }
113
-
114
- async function deleteInviteUserLink() {
115
- return (0, _fetch.Delete)(_constants.urls.identity.tenants.invites.user.v1);
116
- }
117
-
118
- async function getInviteUserLink() {
119
- return (0, _fetch.Get)(_constants.urls.identity.tenants.invites.user.v1);
120
- }
121
-
122
- async function getInviteLinkConfiguration() {
123
- return (0, _fetch.Get)(_constants.urls.identity.tenants.invites.configuration.v1);
124
- }
125
-
126
- async function loadAvailableRoles() {
127
- return (0, _fetch.Get)(_constants.urls.team.roles.v1);
128
- }
129
-
130
- async function loadAvailablePermissions() {
131
- return (0, _fetch.Get)(_constants.urls.identity.permissions.v1);
132
- }
133
-
134
- async function loadStats() {
135
- return (0, _fetch.Get)(`${_constants.urls.team.stats.v1}/members`);
136
- }
137
-
138
- async function resendActivationLink(body) {
139
- return (0, _fetch.Post)(`${_constants.urls.team.members.v1}/${body.userId}/resendActivationEmail`, {});
140
- }
141
-
142
- async function resendInvitationLink(body) {
143
- return (0, _fetch.Post)(_constants.urls.identity.users.v2, (0, _extends2.default)({}, body, {
144
- provider: 'local'
145
- }));
146
- }
147
-
148
- async function resendInvitationLinkToAllTenants(body) {
149
- return (0, _fetch.Post)(_constants.urls.identity.users.invitation.resendAll.v1, (0, _extends2.default)({}, body));
150
- }
14
+ var _BaseApiClient = require("../BaseApiClient");
15
+
16
+ class TeamsApi extends _BaseApiClient.BaseApiClient {
17
+ constructor(appName) {
18
+ super(appName);
19
+
20
+ this.getProfile = async params => {
21
+ return this.get(`${_constants.urls.identity.users.v2}/me`, params != null ? params : {
22
+ addRoles: true
23
+ });
24
+ };
25
+
26
+ this.updateProfile = async body => {
27
+ return this.put(`${_constants.urls.identity.users.v2}/me`, body);
28
+ };
29
+
30
+ this.updateProfileImage = async body => {
31
+ return this.put(`${_constants.urls.team.profile.v1}/me/image/v1`, body, {
32
+ responseType: 'plain',
33
+ contentType: undefined
34
+ });
35
+ };
36
+
37
+ this.changePassword = async body => {
38
+ return this.post(`${_constants.urls.identity.users.v1}/passwords/change`, body);
39
+ };
40
+
41
+ this.loadUsers = async params => {
42
+ var _params$sort, _params$sort$0$id, _params$sort2, _params$sort2$, _params$sort3, _params$sort3$;
43
+
44
+ const filters = (params.filter || []).reduce((p, n) => (0, _extends2.default)({}, p, {
45
+ [n.id]: n.value
46
+ }), {});
47
+ const sorts = (_params$sort = params.sort) != null && _params$sort.length ? {
48
+ sortBy: (_params$sort$0$id = (_params$sort2 = params.sort) == null ? void 0 : (_params$sort2$ = _params$sort2[0]) == null ? void 0 : _params$sort2$.id) != null ? _params$sort$0$id : 'name',
49
+ sortDirection: (_params$sort3 = params.sort) != null && (_params$sort3$ = _params$sort3[0]) != null && _params$sort3$.desc ? 'desc' : 'asc'
50
+ } : null;
51
+ return this.get(_constants.urls.team.members.v1, (0, _extends2.default)({
52
+ pageOffset: params.pageOffset,
53
+ pageSize: params.pageSize
54
+ }, filters, sorts));
55
+ };
56
+
57
+ this.addUser = async body => {
58
+ return this.post(_constants.urls.identity.users.v2, (0, _extends2.default)({}, body, {
59
+ provider: 'local'
60
+ }));
61
+ };
62
+
63
+ this.deleteUser = async body => {
64
+ return this.delete(`${_constants.urls.team.members.v1}/${body.userId}`);
65
+ };
66
+
67
+ this.updateUser = async body => {
68
+ return this.put(_constants.urls.team.members.v1, body);
69
+ };
70
+
71
+ this.updateUserExpirationTime = async body => {
72
+ const {
73
+ userId,
74
+ expirationInSeconds
75
+ } = body;
76
+ return this.put(`${_constants.urls.identity.users.temporary.v1}/${userId}`, {
77
+ expirationInSeconds
78
+ });
79
+ };
80
+
81
+ this.setPermanentUser = async userId => {
82
+ return this.delete(`${_constants.urls.identity.users.temporary.v1}/${userId}`);
83
+ };
84
+
85
+ this.getTemporaryUserConfiguration = async () => {
86
+ return this.get(_constants.urls.identity.users.temporary.configuration.v1);
87
+ };
88
+
89
+ this.createInviteUserLink = async body => {
90
+ return this.post(_constants.urls.identity.tenants.invites.user.v1, (0, _extends2.default)({}, body));
91
+ };
92
+
93
+ this.updateInviteUserLink = async body => {
94
+ return this.patch(_constants.urls.identity.tenants.invites.user.v1, (0, _extends2.default)({}, body));
95
+ };
96
+
97
+ this.deleteInviteUserLink = async () => {
98
+ return this.delete(_constants.urls.identity.tenants.invites.user.v1);
99
+ };
100
+
101
+ this.getInviteUserLink = async () => {
102
+ return this.get(_constants.urls.identity.tenants.invites.user.v1);
103
+ };
104
+
105
+ this.getInviteLinkConfiguration = async () => {
106
+ return this.get(_constants.urls.identity.tenants.invites.configuration.v1);
107
+ };
108
+
109
+ this.loadAvailableRoles = async () => {
110
+ return this.get(_constants.urls.team.roles.v1);
111
+ };
112
+
113
+ this.loadAvailablePermissions = async () => {
114
+ return this.get(_constants.urls.identity.permissions.v1);
115
+ };
116
+
117
+ this.loadStats = async () => {
118
+ return this.get(`${_constants.urls.team.stats.v1}/members`);
119
+ };
120
+
121
+ this.resendActivationLink = async body => {
122
+ return this.post(`${_constants.urls.team.members.v1}/${body.userId}/resendActivationEmail`, {});
123
+ };
124
+
125
+ this.resendInvitationLink = async body => {
126
+ return this.post(_constants.urls.identity.users.v2, (0, _extends2.default)({}, body, {
127
+ provider: 'local'
128
+ }));
129
+ };
130
+
131
+ this.resendInvitationLinkToAllTenants = async body => {
132
+ return this.post(_constants.urls.identity.users.invitation.resendAll.v1, (0, _extends2.default)({}, body));
133
+ };
134
+ }
135
+
136
+ }
137
+
138
+ exports.TeamsApi = TeamsApi;
139
+
140
+ var _default = new TeamsApi('default');
141
+
142
+ exports.default = _default;
@@ -5,78 +5,83 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getHierarchyMetadata = getHierarchyMetadata;
9
- exports.getParentTenants = getParentTenants;
10
- exports.getParentTenantsById = getParentTenantsById;
11
- exports.getSubTenants = getSubTenants;
12
- exports.getSubTenantsAsTree = getSubTenantsAsTree;
13
- exports.getTenants = getTenants;
14
- exports.getTenantsUsersCount = getTenantsUsersCount;
15
- exports.searchSubTenants = searchSubTenants;
16
- exports.switchTenant = switchTenant;
8
+ exports.default = exports.TenantsApi = void 0;
17
9
 
18
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
19
11
 
20
- var _fetch = require("../fetch");
21
-
22
12
  var _constants = require("../constants");
23
13
 
24
14
  var _utils = require("../auth/utils");
25
15
 
26
16
  var _ContextHolder = require("../ContextHolder");
27
17
 
28
- async function switchTenant(body) {
29
- if (_ContextHolder.ContextHolder.isSessionPerTenantEnabled()) {
30
- (0, _utils.setTabTenantInSessionStorage)(body.tenantId);
18
+ var _BaseApiClient = require("../BaseApiClient");
19
+
20
+ class TenantsApi extends _BaseApiClient.BaseApiClient {
21
+ constructor(appName) {
22
+ super(appName);
23
+
24
+ this.switchTenant = async body => {
25
+ if (_ContextHolder.ContextHolder.for(this.appName).isSessionPerTenantEnabled()) {
26
+ (0, _utils.setTabTenantInSessionStorage)(body.tenantId);
27
+ }
28
+
29
+ return this.put(`${_constants.urls.identity.users.v1}/tenant`, body);
30
+ };
31
+
32
+ this.getTenants = async () => {
33
+ return this.get(`${_constants.urls.identity.users.v2}/me/tenants`);
34
+ };
35
+
36
+ this.getSubTenants = async options => {
37
+ return this.get(_constants.urls.tenants.hierarchy.v1, undefined, {
38
+ headers: this.extractHeadersFromOptions(options)
39
+ });
40
+ };
41
+
42
+ this.getSubTenantsAsTree = async options => {
43
+ return this.get(_constants.urls.tenants.hierarchy.tree.v1, undefined, {
44
+ headers: this.extractHeadersFromOptions(options)
45
+ });
46
+ };
47
+
48
+ this.getParentTenants = async options => {
49
+ return this.get(_constants.urls.tenants.hierarchy.parents.v1, undefined, {
50
+ headers: this.extractHeadersFromOptions(options)
51
+ });
52
+ };
53
+
54
+ this.getParentTenantsById = async (tenantId, options) => {
55
+ return this.get(`${_constants.urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
56
+ headers: this.extractHeadersFromOptions(options)
57
+ });
58
+ };
59
+
60
+ this.getTenantsUsersCount = async (body, options) => {
61
+ return this.post(`${_constants.urls.identity.tenants.users.v1}/count`, body, {
62
+ headers: this.extractHeadersFromOptions(options)
63
+ });
64
+ };
65
+
66
+ this.searchSubTenants = async (params, options) => {
67
+ return this.get(_constants.urls.tenants.hierarchy.v2, params, {
68
+ headers: this.extractHeadersFromOptions(options)
69
+ });
70
+ };
71
+
72
+ this.getHierarchyMetadata = async (params, options) => {
73
+ return this.get(_constants.urls.tenants.hierarchy.metadata.v2, (0, _extends2.default)({}, params, {
74
+ _tenantIds: params._tenantIds.join(',')
75
+ }), {
76
+ headers: this.extractHeadersFromOptions(options)
77
+ });
78
+ };
31
79
  }
32
80
 
33
- return (0, _fetch.Put)(`${_constants.urls.identity.users.v1}/tenant`, body);
34
- }
35
-
36
- async function getTenants() {
37
- return (0, _fetch.Get)(`${_constants.urls.identity.users.v2}/me/tenants`);
38
81
  }
39
82
 
40
- async function getSubTenants(options) {
41
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.v1, undefined, {
42
- headers: (0, _fetch.extractHeadersFromOptions)(options)
43
- });
44
- }
83
+ exports.TenantsApi = TenantsApi;
45
84
 
46
- async function getSubTenantsAsTree(options) {
47
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.tree.v1, undefined, {
48
- headers: (0, _fetch.extractHeadersFromOptions)(options)
49
- });
50
- }
51
-
52
- async function getParentTenants(options) {
53
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.parents.v1, undefined, {
54
- headers: (0, _fetch.extractHeadersFromOptions)(options)
55
- });
56
- }
57
-
58
- async function getParentTenantsById(tenantId, options) {
59
- return (0, _fetch.Get)(`${_constants.urls.tenants.hierarchy.parents.v1}/${tenantId}`, undefined, {
60
- headers: (0, _fetch.extractHeadersFromOptions)(options)
61
- });
62
- }
63
-
64
- async function getTenantsUsersCount(body, options) {
65
- return (0, _fetch.Post)(`${_constants.urls.identity.tenants.users.v1}/count`, body, {
66
- headers: (0, _fetch.extractHeadersFromOptions)(options)
67
- });
68
- }
69
-
70
- async function searchSubTenants(params, options) {
71
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.v2, params, {
72
- headers: (0, _fetch.extractHeadersFromOptions)(options)
73
- });
74
- }
85
+ var _default = new TenantsApi('default');
75
86
 
76
- async function getHierarchyMetadata(params, options) {
77
- return (0, _fetch.Get)(_constants.urls.tenants.hierarchy.metadata.v2, (0, _extends2.default)({}, params, {
78
- _tenantIds: params._tenantIds.join(',')
79
- }), {
80
- headers: (0, _fetch.extractHeadersFromOptions)(options)
81
- });
82
- }
87
+ exports.default = _default;