@frontegg/rest-api 3.0.1 → 3.0.2

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 (68) hide show
  1. package/ContextHolder.js +64 -100
  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.js +352 -2045
  6. package/auth/interfaces.js +1 -1
  7. package/auth/secutiry-poilicy/index.js +45 -254
  8. package/connectivity/index.js +79 -73
  9. package/constants.js +1 -1
  10. package/error.js +9 -33
  11. package/fetch.js +159 -519
  12. package/index.js +26 -26
  13. package/jwt.js +19 -45
  14. package/metadata/index.js +18 -160
  15. package/node/ContextHolder.js +68 -104
  16. package/node/account-settings/index.js +4 -46
  17. package/node/audits/index.js +15 -68
  18. package/node/auth/enums.js +2 -2
  19. package/node/auth/index.js +481 -2099
  20. package/node/auth/interfaces.js +2 -2
  21. package/node/auth/secutiry-poilicy/index.js +36 -240
  22. package/node/connectivity/index.js +78 -71
  23. package/node/constants.js +1 -1
  24. package/node/error.js +9 -38
  25. package/node/fetch.js +166 -521
  26. package/node/index.js +47 -49
  27. package/node/jwt.js +19 -51
  28. package/node/metadata/index.js +19 -163
  29. package/node/notifications/index.js +18 -94
  30. package/node/reports/index.js +62 -171
  31. package/node/roles/index.js +34 -172
  32. package/node/routers.js +2 -2
  33. package/node/sub-tenants/index.js +12 -126
  34. package/node/subscriptions/enums.js +4 -4
  35. package/node/subscriptions/index.js +10 -10
  36. package/node/subscriptions/interfaces.js +1 -1
  37. package/node/subscriptions/invoices.js +10 -70
  38. package/node/subscriptions/managedSubscriptions.js +16 -111
  39. package/node/subscriptions/paymentMethods.js +15 -69
  40. package/node/subscriptions/paymentProviders.js +2 -26
  41. package/node/subscriptions/plans.js +4 -46
  42. package/node/subscriptions/providers/index.js +1 -1
  43. package/node/subscriptions/providers/stripe/index.js +10 -106
  44. package/node/subscriptions/subscriptions.js +16 -111
  45. package/node/subscriptions/summaries.js +2 -26
  46. package/node/subscriptions/tenantConfiguration.js +4 -46
  47. package/node/teams/index.js +57 -406
  48. package/node/tenants/index.js +8 -86
  49. package/node/vendor/index.js +2 -26
  50. package/notifications/index.js +18 -93
  51. package/package.json +1 -1
  52. package/reports/index.js +65 -175
  53. package/roles/index.js +34 -175
  54. package/routers.js +2 -2
  55. package/sub-tenants/index.js +12 -127
  56. package/subscriptions/enums.js +4 -4
  57. package/subscriptions/invoices.js +12 -70
  58. package/subscriptions/managedSubscriptions.js +20 -115
  59. package/subscriptions/paymentMethods.js +16 -70
  60. package/subscriptions/paymentProviders.js +2 -22
  61. package/subscriptions/plans.js +4 -43
  62. package/subscriptions/providers/stripe/index.js +10 -106
  63. package/subscriptions/subscriptions.js +20 -115
  64. package/subscriptions/summaries.js +2 -22
  65. package/subscriptions/tenantConfiguration.js +4 -43
  66. package/teams/index.js +55 -421
  67. package/tenants/index.js +8 -85
  68. 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
  }