@frontegg/rest-api 3.0.1 → 3.0.4

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 (69) hide show
  1. package/ContextHolder.js +67 -101
  2. package/account-settings/index.js +4 -43
  3. package/audits/index.js +16 -69
  4. package/auth/enums.js +2 -2
  5. package/auth/index.d.ts +4 -0
  6. package/auth/index.js +354 -2044
  7. package/auth/interfaces.js +1 -1
  8. package/auth/secutiry-poilicy/index.js +45 -254
  9. package/connectivity/index.js +79 -73
  10. package/constants.js +1 -1
  11. package/error.js +9 -33
  12. package/fetch.js +165 -519
  13. package/index.js +26 -26
  14. package/jwt.js +19 -45
  15. package/metadata/index.js +19 -159
  16. package/node/ContextHolder.js +68 -104
  17. package/node/account-settings/index.js +4 -46
  18. package/node/audits/index.js +15 -68
  19. package/node/auth/enums.js +2 -2
  20. package/node/auth/index.js +487 -2099
  21. package/node/auth/interfaces.js +2 -2
  22. package/node/auth/secutiry-poilicy/index.js +36 -240
  23. package/node/connectivity/index.js +78 -71
  24. package/node/constants.js +1 -1
  25. package/node/error.js +9 -38
  26. package/node/fetch.js +166 -521
  27. package/node/index.js +47 -49
  28. package/node/jwt.js +19 -51
  29. package/node/metadata/index.js +19 -163
  30. package/node/notifications/index.js +18 -94
  31. package/node/reports/index.js +62 -171
  32. package/node/roles/index.js +34 -172
  33. package/node/routers.js +2 -2
  34. package/node/sub-tenants/index.js +12 -126
  35. package/node/subscriptions/enums.js +4 -4
  36. package/node/subscriptions/index.js +10 -10
  37. package/node/subscriptions/interfaces.js +1 -1
  38. package/node/subscriptions/invoices.js +10 -70
  39. package/node/subscriptions/managedSubscriptions.js +16 -111
  40. package/node/subscriptions/paymentMethods.js +15 -69
  41. package/node/subscriptions/paymentProviders.js +2 -26
  42. package/node/subscriptions/plans.js +4 -46
  43. package/node/subscriptions/providers/index.js +1 -1
  44. package/node/subscriptions/providers/stripe/index.js +10 -106
  45. package/node/subscriptions/subscriptions.js +16 -111
  46. package/node/subscriptions/summaries.js +2 -26
  47. package/node/subscriptions/tenantConfiguration.js +4 -46
  48. package/node/teams/index.js +57 -406
  49. package/node/tenants/index.js +8 -86
  50. package/node/vendor/index.js +2 -26
  51. package/notifications/index.js +18 -93
  52. package/package.json +1 -1
  53. package/reports/index.js +65 -175
  54. package/roles/index.js +34 -175
  55. package/routers.js +2 -2
  56. package/sub-tenants/index.js +12 -127
  57. package/subscriptions/enums.js +4 -4
  58. package/subscriptions/invoices.js +12 -70
  59. package/subscriptions/managedSubscriptions.js +20 -115
  60. package/subscriptions/paymentMethods.js +16 -70
  61. package/subscriptions/paymentProviders.js +2 -22
  62. package/subscriptions/plans.js +4 -43
  63. package/subscriptions/providers/stripe/index.js +10 -106
  64. package/subscriptions/subscriptions.js +20 -115
  65. package/subscriptions/summaries.js +2 -22
  66. package/subscriptions/tenantConfiguration.js +4 -43
  67. package/teams/index.js +56 -420
  68. package/tenants/index.js +8 -85
  69. package/vendor/index.js +2 -23
@@ -1,113 +1,17 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get, Post } from "../../../fetch";
4
2
  import { urls } from "../../../constants";
5
- export function createSubscription(_x) {
6
- return _createSubscription.apply(this, arguments);
3
+ export async function createSubscription(request) {
4
+ return Post(urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request);
7
5
  }
8
-
9
- function _createSubscription() {
10
- _createSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(request) {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Post(urls.subscriptions.billing.paymentProviders.stripe.subscriptions.v1, request));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _createSubscription.apply(this, arguments);
6
+ export async function getStripeCustomer(tenantId) {
7
+ return Get(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}/${tenantId}`);
25
8
  }
26
-
27
- export function getStripeCustomer(_x2) {
28
- return _getStripeCustomer.apply(this, arguments);
9
+ export async function createStripeCustomer(request) {
10
+ return Post(`${urls.subscriptions.billing.paymentProviders.stripe.customers.v1}`, request);
29
11
  }
30
-
31
- function _getStripeCustomer() {
32
- _getStripeCustomer = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(tenantId) {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Get("".concat(urls.subscriptions.billing.paymentProviders.stripe.customers.v1, "/").concat(tenantId)));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _getStripeCustomer.apply(this, arguments);
12
+ export async function getStripePaymentProviderConfiguration() {
13
+ return Get(`${urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1}`);
47
14
  }
48
-
49
- export function createStripeCustomer(_x3) {
50
- return _createStripeCustomer.apply(this, arguments);
51
- }
52
-
53
- function _createStripeCustomer() {
54
- _createStripeCustomer = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(request) {
55
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
56
- while (1) {
57
- switch (_context3.prev = _context3.next) {
58
- case 0:
59
- return _context3.abrupt("return", Post("".concat(urls.subscriptions.billing.paymentProviders.stripe.customers.v1), request));
60
-
61
- case 1:
62
- case "end":
63
- return _context3.stop();
64
- }
65
- }
66
- }, _callee3);
67
- }));
68
- return _createStripeCustomer.apply(this, arguments);
69
- }
70
-
71
- export function getStripePaymentProviderConfiguration() {
72
- return _getStripePaymentProviderConfiguration.apply(this, arguments);
73
- }
74
-
75
- function _getStripePaymentProviderConfiguration() {
76
- _getStripePaymentProviderConfiguration = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4() {
77
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
78
- while (1) {
79
- switch (_context4.prev = _context4.next) {
80
- case 0:
81
- return _context4.abrupt("return", Get("".concat(urls.subscriptions.billing.paymentProviders.stripe.publicConfigurations.v1)));
82
-
83
- case 1:
84
- case "end":
85
- return _context4.stop();
86
- }
87
- }
88
- }, _callee4);
89
- }));
90
- return _getStripePaymentProviderConfiguration.apply(this, arguments);
91
- }
92
-
93
- export function createStripePaymentMethodSetupIntentSecret(_x4) {
94
- return _createStripePaymentMethodSetupIntentSecret.apply(this, arguments);
95
- }
96
-
97
- function _createStripePaymentMethodSetupIntentSecret() {
98
- _createStripePaymentMethodSetupIntentSecret = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(request) {
99
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
100
- while (1) {
101
- switch (_context5.prev = _context5.next) {
102
- case 0:
103
- return _context5.abrupt("return", Post("".concat(urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1), request));
104
-
105
- case 1:
106
- case "end":
107
- return _context5.stop();
108
- }
109
- }
110
- }, _callee5);
111
- }));
112
- return _createStripePaymentMethodSetupIntentSecret.apply(this, arguments);
15
+ export async function createStripePaymentMethodSetupIntentSecret(request) {
16
+ return Post(`${urls.subscriptions.billing.paymentProviders.stripe.setupIntents.v1}`, request);
113
17
  }
@@ -1,118 +1,23 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get, Put } from "../fetch";
4
2
  import { urls } from "../constants";
5
- export function getSubscriptions() {
6
- return _getSubscriptions.apply(this, arguments);
7
- }
8
-
9
- function _getSubscriptions() {
10
- _getSubscriptions = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get(urls.subscriptions.billing.subscriptions.v1));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getSubscriptions.apply(this, arguments);
25
- }
26
-
27
- export function getSubscription(_x) {
28
- return _getSubscription.apply(this, arguments);
29
- }
30
-
31
- function _getSubscription() {
32
- _getSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(subscriptionId) {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Get("".concat(urls.subscriptions.billing.subscriptions.v1, "/").concat(subscriptionId)));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _getSubscription.apply(this, arguments);
47
- }
48
-
49
- export function cancelSubscription(_x2) {
50
- return _cancelSubscription.apply(this, arguments);
51
- }
52
-
53
- function _cancelSubscription() {
54
- _cancelSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(subscriptionId) {
55
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
56
- while (1) {
57
- switch (_context3.prev = _context3.next) {
58
- case 0:
59
- return _context3.abrupt("return", Put("".concat(urls.subscriptions.billing.subscriptions.v1, "/").concat(subscriptionId, "/cancellations/"), {}));
60
-
61
- case 1:
62
- case "end":
63
- return _context3.stop();
64
- }
65
- }
66
- }, _callee3);
67
- }));
68
- return _cancelSubscription.apply(this, arguments);
69
- }
70
-
71
- export function renewSubscription(_x3) {
72
- return _renewSubscription.apply(this, arguments);
73
- }
74
-
75
- function _renewSubscription() {
76
- _renewSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(subscriptionId) {
77
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
78
- while (1) {
79
- switch (_context4.prev = _context4.next) {
80
- case 0:
81
- return _context4.abrupt("return", Put("".concat(urls.subscriptions.billing.subscriptions.v1, "/").concat(subscriptionId, "/renewals/"), {}));
82
-
83
- case 1:
84
- case "end":
85
- return _context4.stop();
86
- }
87
- }
88
- }, _callee4);
89
- }));
90
- return _renewSubscription.apply(this, arguments);
91
- }
92
-
93
- export function updateSubscription(_x4, _x5) {
94
- return _updateSubscription.apply(this, arguments);
95
- }
96
-
97
- function _updateSubscription() {
98
- _updateSubscription = _asyncToGenerator(_regeneratorRuntime.mark(function _callee5(subscriptionId, _ref) {
99
- var paymentMethodId, planId;
100
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
101
- while (1) {
102
- switch (_context5.prev = _context5.next) {
103
- case 0:
104
- paymentMethodId = _ref.paymentMethodId, planId = _ref.planId;
105
- return _context5.abrupt("return", Put("".concat(urls.subscriptions.billing.subscriptions.v1, "/").concat(subscriptionId), {
106
- paymentMethodId: paymentMethodId,
107
- planId: planId
108
- }));
109
-
110
- case 2:
111
- case "end":
112
- return _context5.stop();
113
- }
114
- }
115
- }, _callee5);
116
- }));
117
- return _updateSubscription.apply(this, arguments);
3
+ export async function getSubscriptions() {
4
+ return Get(urls.subscriptions.billing.subscriptions.v1);
5
+ }
6
+ export async function getSubscription(subscriptionId) {
7
+ return Get(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`);
8
+ }
9
+ export async function cancelSubscription(subscriptionId) {
10
+ return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/cancellations/`, {});
11
+ }
12
+ export async function renewSubscription(subscriptionId) {
13
+ return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}/renewals/`, {});
14
+ }
15
+ export async function updateSubscription(subscriptionId, {
16
+ paymentMethodId,
17
+ planId
18
+ }) {
19
+ return Put(`${urls.subscriptions.billing.subscriptions.v1}/${subscriptionId}`, {
20
+ paymentMethodId,
21
+ planId
22
+ });
118
23
  }
@@ -1,25 +1,5 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get } from '../fetch';
4
2
  import { urls } from '../constants';
5
- export function getSubscriptionSummaries(_x) {
6
- return _getSubscriptionSummaries.apply(this, arguments);
7
- }
8
-
9
- function _getSubscriptionSummaries() {
10
- _getSubscriptionSummaries = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tenantId) {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get("".concat(urls.subscriptions.billing.summaries.v1, "/").concat(tenantId)));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getSubscriptionSummaries.apply(this, arguments);
3
+ export async function getSubscriptionSummaries(tenantId) {
4
+ return Get(`${urls.subscriptions.billing.summaries.v1}/${tenantId}`);
25
5
  }
@@ -1,47 +1,8 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
3
1
  import { Get, Post } from "../fetch";
4
2
  import { urls } from "../constants";
5
- export function getTenantConfiguration(_x) {
6
- return _getTenantConfiguration.apply(this, arguments);
3
+ export async function getTenantConfiguration(tenantId) {
4
+ return Get(`${urls.subscriptions.billing.tenantConfiguration.v1}/${tenantId}`);
7
5
  }
8
-
9
- function _getTenantConfiguration() {
10
- _getTenantConfiguration = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tenantId) {
11
- return _regeneratorRuntime.wrap(function _callee$(_context) {
12
- while (1) {
13
- switch (_context.prev = _context.next) {
14
- case 0:
15
- return _context.abrupt("return", Get("".concat(urls.subscriptions.billing.tenantConfiguration.v1, "/").concat(tenantId)));
16
-
17
- case 1:
18
- case "end":
19
- return _context.stop();
20
- }
21
- }
22
- }, _callee);
23
- }));
24
- return _getTenantConfiguration.apply(this, arguments);
25
- }
26
-
27
- export function createTenantConfiguration(_x2) {
28
- return _createTenantConfiguration.apply(this, arguments);
29
- }
30
-
31
- function _createTenantConfiguration() {
32
- _createTenantConfiguration = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(request) {
33
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
34
- while (1) {
35
- switch (_context2.prev = _context2.next) {
36
- case 0:
37
- return _context2.abrupt("return", Post("".concat(urls.subscriptions.billing.tenantConfiguration.v1), request));
38
-
39
- case 1:
40
- case "end":
41
- return _context2.stop();
42
- }
43
- }
44
- }, _callee2);
45
- }));
46
- return _createTenantConfiguration.apply(this, arguments);
6
+ export async function createTenantConfiguration(request) {
7
+ return Post(`${urls.subscriptions.billing.tenantConfiguration.v1}`, request);
47
8
  }