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

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 (122) hide show
  1. package/ContextHolder/index.d.ts +30 -108
  2. package/ContextHolder/index.js +57 -153
  3. package/account-settings/index.d.ts +7 -19
  4. package/account-settings/index.js +13 -23
  5. package/applications/index.d.ts +44 -49
  6. package/applications/index.js +37 -51
  7. package/audits/index.d.ts +15 -27
  8. package/audits/index.js +17 -27
  9. package/auth/index.d.ts +768 -817
  10. package/auth/index.js +721 -902
  11. package/auth/secutiry-poilicy/index.d.ts +102 -58
  12. package/auth/secutiry-poilicy/index.js +90 -122
  13. package/auth/utils.d.ts +2 -2
  14. package/auth/utils.js +8 -9
  15. package/connectivity/index.d.ts +27 -126
  16. package/connectivity/index.js +114 -147
  17. package/directory/index.d.ts +22 -31
  18. package/directory/index.js +15 -27
  19. package/entitlements/index.d.ts +8 -14
  20. package/entitlements/index.js +4 -12
  21. package/feature-flags/index.d.ts +2 -8
  22. package/feature-flags/index.js +8 -16
  23. package/fetch.d.ts +24 -0
  24. package/fetch.js +265 -0
  25. package/groups/index.d.ts +49 -73
  26. package/groups/index.js +45 -64
  27. package/impersonate/index.d.ts +6 -15
  28. package/impersonate/index.js +5 -13
  29. package/index.d.ts +108 -154
  30. package/index.js +78 -109
  31. package/interfaces.d.ts +0 -10
  32. package/metadata/index.d.ts +7 -67
  33. package/metadata/index.js +32 -52
  34. package/node/ContextHolder/index.js +57 -153
  35. package/node/account-settings/index.js +16 -27
  36. package/node/applications/index.js +44 -51
  37. package/node/audits/index.js +20 -31
  38. package/node/auth/index.js +1035 -768
  39. package/node/auth/secutiry-poilicy/index.js +136 -125
  40. package/node/auth/utils.js +7 -9
  41. package/node/connectivity/index.js +187 -148
  42. package/node/directory/index.js +20 -29
  43. package/node/entitlements/index.js +5 -18
  44. package/node/feature-flags/index.js +9 -21
  45. package/node/fetch.js +306 -0
  46. package/node/groups/index.js +63 -65
  47. package/node/impersonate/index.js +5 -18
  48. package/node/index.js +71 -116
  49. package/node/metadata/index.js +52 -61
  50. package/node/notifications/index.js +27 -37
  51. package/node/reports/index.js +70 -78
  52. package/node/roles/index.js +51 -56
  53. package/node/security-center/index.js +9 -21
  54. package/node/sub-tenants/index.js +89 -90
  55. package/node/subscriptions/index.js +107 -69
  56. package/node/subscriptions/invoices.js +17 -25
  57. package/node/subscriptions/managedSubscriptions.js +27 -32
  58. package/node/subscriptions/paymentMethods.js +20 -27
  59. package/node/subscriptions/paymentProviders.js +6 -15
  60. package/node/subscriptions/plans.js +9 -17
  61. package/node/subscriptions/providers/index.js +18 -0
  62. package/node/subscriptions/providers/stripe/index.js +21 -26
  63. package/node/subscriptions/subscriptions.js +27 -32
  64. package/node/subscriptions/summaries.js +6 -15
  65. package/node/subscriptions/tenantConfiguration.js +9 -17
  66. package/node/subscriptions/vendorPublicConfigurations.js +6 -15
  67. package/node/teams/index.js +138 -130
  68. package/node/tenants/index.js +60 -65
  69. package/node/user-phone-numbers/index.js +24 -32
  70. package/node/users/index.js +53 -58
  71. package/node/vendor/index.js +6 -17
  72. package/notifications/index.d.ts +16 -22
  73. package/notifications/index.js +22 -33
  74. package/package.json +1 -1
  75. package/reports/index.d.ts +44 -50
  76. package/reports/index.js +62 -75
  77. package/roles/index.d.ts +38 -44
  78. package/roles/index.js +41 -57
  79. package/security-center/index.d.ts +2 -14
  80. package/security-center/index.js +6 -15
  81. package/sub-tenants/index.d.ts +15 -57
  82. package/sub-tenants/index.js +68 -88
  83. package/subscriptions/index.d.ts +11 -56
  84. package/subscriptions/index.js +11 -58
  85. package/subscriptions/invoices.d.ts +13 -16
  86. package/subscriptions/invoices.js +14 -24
  87. package/subscriptions/managedSubscriptions.d.ts +15 -18
  88. package/subscriptions/managedSubscriptions.js +22 -33
  89. package/subscriptions/paymentMethods.d.ts +13 -16
  90. package/subscriptions/paymentMethods.js +17 -26
  91. package/subscriptions/paymentProviders.d.ts +5 -8
  92. package/subscriptions/paymentProviders.js +4 -11
  93. package/subscriptions/plans.d.ts +8 -11
  94. package/subscriptions/plans.js +6 -14
  95. package/subscriptions/providers/index.d.ts +1 -0
  96. package/subscriptions/providers/index.js +1 -0
  97. package/subscriptions/providers/stripe/index.d.ts +21 -24
  98. package/subscriptions/providers/stripe/index.js +16 -27
  99. package/subscriptions/subscriptions.d.ts +21 -24
  100. package/subscriptions/subscriptions.js +22 -33
  101. package/subscriptions/summaries.d.ts +4 -7
  102. package/subscriptions/summaries.js +3 -10
  103. package/subscriptions/tenantConfiguration.d.ts +3 -6
  104. package/subscriptions/tenantConfiguration.js +7 -15
  105. package/subscriptions/vendorPublicConfigurations.d.ts +2 -5
  106. package/subscriptions/vendorPublicConfigurations.js +4 -11
  107. package/teams/index.d.ts +131 -35
  108. package/teams/index.js +93 -122
  109. package/tenants/index.d.ts +37 -25
  110. package/tenants/index.js +46 -62
  111. package/user-phone-numbers/index.d.ts +26 -32
  112. package/user-phone-numbers/index.js +19 -32
  113. package/users/index.d.ts +15 -21
  114. package/users/index.js +44 -60
  115. package/vendor/index.d.ts +6 -12
  116. package/vendor/index.js +4 -11
  117. package/BaseApiClient.d.ts +0 -16
  118. package/BaseApiClient.js +0 -39
  119. package/FetchClient.d.ts +0 -42
  120. package/FetchClient.js +0 -308
  121. package/node/BaseApiClient.js +0 -49
  122. package/node/FetchClient.js +0 -326
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.1.76-alpha.9502349697
1
+ /** @license Frontegg v3.1.76-alpha.9762981322
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", {
10
10
  });
11
11
  var _exportNames = {
12
12
  api: true,
13
- createApiClient: true,
14
13
  AuthStrategyEnum: true,
15
14
  MachineToMachineAuthStrategy: true,
16
15
  SocialLoginProviders: true,
@@ -19,20 +18,19 @@ var _exportNames = {
19
18
  removeTabTenantFromSessionStorage: true,
20
19
  getCurrentUserTenantsFunction: true,
21
20
  FRONTEGG_SEPARATE_TABS_BY_TENANT: true,
21
+ fetch: true,
22
22
  ISubscriptionCancellationPolicy: true,
23
23
  ISubscriptionStatus: true,
24
24
  PaymentMethodType: true,
25
25
  ProviderType: true,
26
26
  FronteggApiError: true,
27
- fetch: true,
28
- FetchClient: true,
29
27
  ContextHolder: true,
30
28
  FronteggContext: true
31
29
  };
32
30
  Object.defineProperty(exports, "AuthStrategyEnum", {
33
31
  enumerable: true,
34
32
  get: function () {
35
- return _auth.AuthStrategyEnum;
33
+ return auth.AuthStrategyEnum;
36
34
  }
37
35
  });
38
36
  Object.defineProperty(exports, "ContextHolder", {
@@ -44,13 +42,7 @@ Object.defineProperty(exports, "ContextHolder", {
44
42
  Object.defineProperty(exports, "FRONTEGG_SEPARATE_TABS_BY_TENANT", {
45
43
  enumerable: true,
46
44
  get: function () {
47
- return _auth.FRONTEGG_SEPARATE_TABS_BY_TENANT;
48
- }
49
- });
50
- Object.defineProperty(exports, "FetchClient", {
51
- enumerable: true,
52
- get: function () {
53
- return _FetchClient.FetchClient;
45
+ return auth.FRONTEGG_SEPARATE_TABS_BY_TENANT;
54
46
  }
55
47
  });
56
48
  Object.defineProperty(exports, "FronteggApiError", {
@@ -68,122 +60,116 @@ Object.defineProperty(exports, "FronteggContext", {
68
60
  Object.defineProperty(exports, "ISubscriptionCancellationPolicy", {
69
61
  enumerable: true,
70
62
  get: function () {
71
- return _subscriptions.ISubscriptionCancellationPolicy;
63
+ return subscriptions.ISubscriptionCancellationPolicy;
72
64
  }
73
65
  });
74
66
  Object.defineProperty(exports, "ISubscriptionStatus", {
75
67
  enumerable: true,
76
68
  get: function () {
77
- return _subscriptions.ISubscriptionStatus;
69
+ return subscriptions.ISubscriptionStatus;
78
70
  }
79
71
  });
80
72
  Object.defineProperty(exports, "MachineToMachineAuthStrategy", {
81
73
  enumerable: true,
82
74
  get: function () {
83
- return _auth.MachineToMachineAuthStrategy;
75
+ return auth.MachineToMachineAuthStrategy;
84
76
  }
85
77
  });
86
78
  Object.defineProperty(exports, "PaymentMethodType", {
87
79
  enumerable: true,
88
80
  get: function () {
89
- return _subscriptions.PaymentMethodType;
81
+ return subscriptions.PaymentMethodType;
90
82
  }
91
83
  });
92
84
  Object.defineProperty(exports, "ProviderType", {
93
85
  enumerable: true,
94
86
  get: function () {
95
- return _subscriptions.ProviderType;
87
+ return subscriptions.ProviderType;
96
88
  }
97
89
  });
98
90
  Object.defineProperty(exports, "SocialLoginProviders", {
99
91
  enumerable: true,
100
92
  get: function () {
101
- return _auth.SocialLoginProviders;
102
- }
103
- });
104
- exports.default = exports.createApiClient = exports.api = void 0;
105
- Object.defineProperty(exports, "fetch", {
106
- enumerable: true,
107
- get: function () {
108
- return _FetchClient.default;
93
+ return auth.SocialLoginProviders;
109
94
  }
110
95
  });
96
+ exports.fetch = exports.default = exports.api = void 0;
111
97
  Object.defineProperty(exports, "getCurrentUserTenantsFunction", {
112
98
  enumerable: true,
113
99
  get: function () {
114
- return _auth.getCurrentUserTenantsFunction;
100
+ return auth.getCurrentUserTenantsFunction;
115
101
  }
116
102
  });
117
103
  Object.defineProperty(exports, "getTabTenantFromSessionStorage", {
118
104
  enumerable: true,
119
105
  get: function () {
120
- return _auth.getTabTenantFromSessionStorage;
106
+ return auth.getTabTenantFromSessionStorage;
121
107
  }
122
108
  });
123
109
  Object.defineProperty(exports, "removeTabTenantFromSessionStorage", {
124
110
  enumerable: true,
125
111
  get: function () {
126
- return _auth.removeTabTenantFromSessionStorage;
112
+ return auth.removeTabTenantFromSessionStorage;
127
113
  }
128
114
  });
129
115
  Object.defineProperty(exports, "setTabTenantInSessionStorage", {
130
116
  enumerable: true,
131
117
  get: function () {
132
- return _auth.setTabTenantInSessionStorage;
118
+ return auth.setTabTenantInSessionStorage;
133
119
  }
134
120
  });
135
121
 
136
- var _auth = _interopRequireWildcard(require("./auth"));
122
+ var auth = _interopRequireWildcard(require("./auth"));
137
123
 
138
- var _subscriptions = _interopRequireWildcard(require("./subscriptions"));
124
+ var teams = _interopRequireWildcard(require("./teams"));
139
125
 
140
- var _error = require("./error");
126
+ var metadata = _interopRequireWildcard(require("./metadata"));
141
127
 
142
- var _FetchClient = _interopRequireWildcard(require("./FetchClient"));
128
+ var reports = _interopRequireWildcard(require("./reports"));
143
129
 
144
- var _ContextHolder = require("./ContextHolder");
130
+ var notifications = _interopRequireWildcard(require("./notifications"));
145
131
 
146
- var _secutiryPoilicy = _interopRequireWildcard(require("./auth/secutiry-poilicy"));
132
+ var audits = _interopRequireWildcard(require("./audits"));
147
133
 
148
- var _users = _interopRequireWildcard(require("./users"));
134
+ var fetch = _interopRequireWildcard(require("./fetch"));
149
135
 
150
- var _teams = _interopRequireWildcard(require("./teams"));
136
+ exports.fetch = fetch;
151
137
 
152
- var _metadata = _interopRequireWildcard(require("./metadata"));
138
+ var connectivity = _interopRequireWildcard(require("./connectivity"));
153
139
 
154
- var _reports = _interopRequireWildcard(require("./reports"));
140
+ var tenants = _interopRequireWildcard(require("./tenants"));
155
141
 
156
- var _connectivity = _interopRequireWildcard(require("./connectivity"));
142
+ var accountSettings = _interopRequireWildcard(require("./account-settings"));
157
143
 
158
- var _notifications = _interopRequireWildcard(require("./notifications"));
144
+ var roles = _interopRequireWildcard(require("./roles"));
159
145
 
160
- var _audits = _interopRequireWildcard(require("./audits"));
146
+ var subscriptions = _interopRequireWildcard(require("./subscriptions"));
161
147
 
162
- var _tenants = _interopRequireWildcard(require("./tenants"));
148
+ var applications = _interopRequireWildcard(require("./applications"));
163
149
 
164
- var _accountSettings = _interopRequireWildcard(require("./account-settings"));
150
+ var _error = require("./error");
165
151
 
166
- var _roles = _interopRequireWildcard(require("./roles"));
152
+ var vendor = _interopRequireWildcard(require("./vendor"));
167
153
 
168
- var _vendor = _interopRequireWildcard(require("./vendor"));
154
+ var subTenants = _interopRequireWildcard(require("./sub-tenants"));
169
155
 
170
- var _subTenants = _interopRequireWildcard(require("./sub-tenants"));
156
+ var featureFlags = _interopRequireWildcard(require("./feature-flags"));
171
157
 
172
- var _featureFlags = _interopRequireWildcard(require("./feature-flags"));
158
+ var directory = _interopRequireWildcard(require("./directory"));
173
159
 
174
- var _directory = _interopRequireWildcard(require("./directory"));
160
+ var impersonate = _interopRequireWildcard(require("./impersonate"));
175
161
 
176
- var _impersonate = _interopRequireWildcard(require("./impersonate"));
162
+ var groups = _interopRequireWildcard(require("./groups"));
177
163
 
178
- var _groups = _interopRequireWildcard(require("./groups"));
164
+ var users = _interopRequireWildcard(require("./users"));
179
165
 
180
- var _entitlements = _interopRequireWildcard(require("./entitlements"));
166
+ var entitlements = _interopRequireWildcard(require("./entitlements"));
181
167
 
182
- var _securityCenter = _interopRequireWildcard(require("./security-center"));
168
+ var securityCenter = _interopRequireWildcard(require("./security-center"));
183
169
 
184
- var _userPhoneNumbers = _interopRequireWildcard(require("./user-phone-numbers"));
170
+ var userPhoneNumbers = _interopRequireWildcard(require("./user-phone-numbers"));
185
171
 
186
- var _applications = _interopRequireWildcard(require("./applications"));
172
+ var _ContextHolder = require("./ContextHolder");
187
173
 
188
174
  var _interfaces = require("./interfaces");
189
175
 
@@ -568,73 +554,42 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
568
554
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
569
555
 
570
556
  const api = {
571
- auth: _auth.default,
572
- securityPolicy: _secutiryPoilicy.default,
573
- teams: _teams.default,
574
- metadata: _metadata.default,
575
- reports: _reports.default,
576
- connectivity: _connectivity.default,
577
- notifications: _notifications.default,
578
- audits: _audits.default,
579
- tenants: _tenants.default,
580
- accountSettings: _accountSettings.default,
581
- roles: _roles.default,
582
- subscriptions: _subscriptions.default,
583
- vendor: _vendor.default,
584
- subTenants: _subTenants.default,
585
- featureFlags: _featureFlags.default,
586
- directory: _directory.default,
587
- impersonate: _impersonate.default,
588
- groups: _groups.default,
589
- users: _users.default,
590
- entitlements: _entitlements.default,
591
- securityCenter: _securityCenter.default,
592
- userPhoneNumbers: _userPhoneNumbers.default,
593
- applications: _applications.default
557
+ auth,
558
+ teams,
559
+ metadata,
560
+ reports,
561
+ connectivity,
562
+ notifications,
563
+ audits,
564
+ tenants,
565
+ accountSettings,
566
+ roles,
567
+ subscriptions,
568
+ vendor,
569
+ subTenants,
570
+ featureFlags,
571
+ directory,
572
+ impersonate,
573
+ groups,
574
+ users,
575
+ entitlements,
576
+ securityCenter,
577
+ userPhoneNumbers,
578
+ applications
594
579
  };
595
580
  exports.api = api;
596
-
597
- const createApiClient = appName => ({
598
- auth: new _auth.AuthenticationApi(appName),
599
- securityPolicy: new _secutiryPoilicy.SecurityPolicyApi(appName),
600
- teams: new _teams.TeamsApi(appName),
601
- metadata: new _metadata.MetadataApi(appName),
602
- reports: new _reports.ReportsApi(appName),
603
- connectivity: new _connectivity.ConnectivityApi(appName),
604
- notifications: new _notifications.NotificationsApi(appName),
605
- audits: new _audits.AuditsApi(appName),
606
- tenants: new _tenants.TenantsApi(appName),
607
- accountSettings: new _accountSettings.AccountSettingsApi(appName),
608
- roles: new _roles.RolesApi(appName),
609
- subscriptions: new _subscriptions.SubscriptionsApi(appName),
610
- vendor: new _vendor.VendorApi(appName),
611
- subTenants: new _subTenants.SubTenantsApi(appName),
612
- featureFlags: new _featureFlags.FeatureFlagsApi(appName),
613
- directory: new _directory.DirectoryApi(appName),
614
- impersonate: new _impersonate.ImpersonateApi(appName),
615
- groups: new _groups.GroupsApi(appName),
616
- users: new _users.UsersApi(appName),
617
- entitlements: new _entitlements.EntitlementsApi(appName),
618
- securityCenter: new _securityCenter.SecurityCenterApi(appName),
619
- userPhoneNumbers: new _userPhoneNumbers.PhoneNumbersApi(appName),
620
- applications: new _applications.ApplicationsApi(appName)
621
- });
622
-
623
- exports.createApiClient = createApiClient;
624
581
  var _default = {
625
- fetch: _FetchClient.default,
626
- FetchClient: _FetchClient.FetchClient,
582
+ fetch,
627
583
  ContextHolder: _ContextHolder.ContextHolder,
628
584
  FronteggContext: _ContextHolder.FronteggContext,
629
585
  api,
630
- createApiClient,
631
586
  FronteggApiError: _error.FronteggApiError,
632
- AuthStrategyEnum: _auth.AuthStrategyEnum,
633
- MachineToMachineAuthStrategy: _auth.MachineToMachineAuthStrategy,
634
- SocialLoginProviders: _auth.SocialLoginProviders,
635
- ISubscriptionCancellationPolicy: _subscriptions.ISubscriptionCancellationPolicy,
636
- ISubscriptionStatus: _subscriptions.ISubscriptionStatus,
637
- PaymentMethodType: _subscriptions.PaymentMethodType,
638
- ProviderType: _subscriptions.ProviderType
587
+ AuthStrategyEnum: auth.AuthStrategyEnum,
588
+ MachineToMachineAuthStrategy: auth.MachineToMachineAuthStrategy,
589
+ SocialLoginProviders: auth.SocialLoginProviders,
590
+ ISubscriptionCancellationPolicy: subscriptions.ISubscriptionCancellationPolicy,
591
+ ISubscriptionStatus: subscriptions.ISubscriptionStatus,
592
+ PaymentMethodType: subscriptions.PaymentMethodType,
593
+ ProviderType: subscriptions.ProviderType
639
594
  };
640
595
  exports.default = _default;
@@ -3,69 +3,60 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.MetadataApi = void 0;
7
-
8
- var _BaseApiClient = require("../BaseApiClient");
9
-
10
- class MetadataApi extends _BaseApiClient.BaseApiClient {
11
- constructor(appName) {
12
- super(appName);
13
-
14
- this.getMetadata = async body => {
15
- var _data$rows, _data$rows2;
16
-
17
- const data = await this.get('/metadata', body);
18
- if (data != null && (_data$rows = data.rows) != null && _data$rows[0]) return data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0];
19
- throw new Error(`metadata not found: ${body.entityName}`);
20
- };
21
-
22
- this.getAdminBoxMetadata = async () => {
23
- return this.get('/metadata/admin-box');
24
- };
25
-
26
- this.updateAdminBoxMetadata = async body => {
27
- return this.post('/metadata/admin-box', body);
28
- };
29
-
30
- this.getIpMetadata = async ip => {
31
- const data = await this.get(`/metadata/ip/${ip}`);
32
- if (data) return data;
33
- throw new Error(`ip metadata not found`);
34
- };
35
-
36
- this.getCurrentUserIpMetadata = async () => {
37
- const data = await this.get(`/metadata/ipme`);
38
- if (data) return data;
39
- throw new Error(`ip metadata not found`);
40
- };
41
-
42
- this.getNotificationsMetadata = async () => {
43
- return this.getMetadata({
44
- entityName: 'notifications'
45
- });
46
- };
47
-
48
- this.getSamlMetadata = async () => {
49
- return this.getMetadata({
50
- entityName: 'saml'
51
- });
52
- };
53
-
54
- this.getAuditsMetadata = async () => {
55
- return this.getMetadata({
56
- entityName: 'audits'
57
- });
58
- };
59
-
60
- this.getIpAdressMetadata = async ip => {
61
- return this.getIpMetadata(ip);
62
- };
63
- }
6
+ exports.getAdminBoxMetadata = getAdminBoxMetadata;
7
+ exports.getAuditsMetadata = void 0;
8
+ exports.getCurrentUserIpMetadata = getCurrentUserIpMetadata;
9
+ exports.getSamlMetadata = exports.getNotificationsMetadata = exports.getIpAdressMetadata = void 0;
10
+ exports.updateAdminBoxMetadata = updateAdminBoxMetadata;
64
11
 
12
+ var _fetch = require("../fetch");
13
+
14
+ async function getMetadata(body) {
15
+ var _data$rows, _data$rows2;
16
+
17
+ const data = await (0, _fetch.Get)('/metadata', body);
18
+ if (data != null && (_data$rows = data.rows) != null && _data$rows[0]) return data == null ? void 0 : (_data$rows2 = data.rows) == null ? void 0 : _data$rows2[0];
19
+ throw new Error(`metadata not found: ${body.entityName}`);
20
+ }
21
+
22
+ async function getAdminBoxMetadata() {
23
+ return (0, _fetch.Get)('/metadata/admin-box');
24
+ }
25
+
26
+ async function updateAdminBoxMetadata(body) {
27
+ return (0, _fetch.Post)('/metadata/admin-box', body);
28
+ }
29
+
30
+ async function getIpMetadata(ip) {
31
+ const data = await (0, _fetch.Get)(`/metadata/ip/${ip}`);
32
+ if (data) return data;
33
+ throw new Error(`ip metadata not found`);
34
+ }
35
+
36
+ async function getCurrentUserIpMetadata() {
37
+ const data = await (0, _fetch.Get)(`/metadata/ipme`);
38
+ if (data) return data;
39
+ throw new Error(`ip metadata not found`);
65
40
  }
66
41
 
67
- exports.MetadataApi = MetadataApi;
42
+ const getNotificationsMetadata = async () => getMetadata({
43
+ entityName: 'notifications'
44
+ });
45
+
46
+ exports.getNotificationsMetadata = getNotificationsMetadata;
47
+
48
+ const getSamlMetadata = async () => getMetadata({
49
+ entityName: 'saml'
50
+ });
51
+
52
+ exports.getSamlMetadata = getSamlMetadata;
53
+
54
+ const getAuditsMetadata = async () => getMetadata({
55
+ entityName: 'audits'
56
+ });
57
+
58
+ exports.getAuditsMetadata = getAuditsMetadata;
68
59
 
69
- var _default = new MetadataApi('default');
60
+ const getIpAdressMetadata = async ip => getIpMetadata(ip);
70
61
 
71
- exports.default = _default;
62
+ exports.getIpAdressMetadata = getIpAdressMetadata;
@@ -3,47 +3,37 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.NotificationsApi = void 0;
6
+ exports.getNotifications = getNotifications;
7
+ exports.markAllAsRead = markAllAsRead;
8
+ exports.updateNotificationIsPinned = updateNotificationIsPinned;
9
+ exports.updateNotificationStatus = updateNotificationStatus;
7
10
 
8
- var _constants = require("../constants");
9
-
10
- var _BaseApiClient = require("../BaseApiClient");
11
-
12
- class NotificationsApi extends _BaseApiClient.BaseApiClient {
13
- constructor(appName) {
14
- super(appName);
15
-
16
- this.getNotifications = async params => {
17
- return this.get(_constants.urls.notifications.v1, {
18
- params
19
- });
20
- };
21
-
22
- this.updateNotificationStatus = async params => {
23
- return this.put(`${_constants.urls.notifications.v1}/status`, {
24
- params
25
- });
26
- };
11
+ var _fetch = require("../fetch");
27
12
 
28
- this.updateNotificationIsPinned = async params => {
29
- const {
30
- notificationId,
31
- pinStatus
32
- } = params;
33
- return this.put(`${_constants.urls.notifications.v1}/${pinStatus}`, {
34
- notificationId
35
- });
36
- };
37
-
38
- this.markAllAsRead = async () => {
39
- return this.post(`${_constants.urls.notifications.v1}/status/mark-all-read`);
40
- };
41
- }
13
+ var _constants = require("../constants");
42
14
 
15
+ async function getNotifications(params) {
16
+ return (0, _fetch.Get)(_constants.urls.notifications.v1, {
17
+ params
18
+ });
43
19
  }
44
20
 
45
- exports.NotificationsApi = NotificationsApi;
21
+ async function updateNotificationStatus(params) {
22
+ return (0, _fetch.Put)(`${_constants.urls.notifications.v1}/status`, {
23
+ params
24
+ });
25
+ }
46
26
 
47
- var _default = new NotificationsApi('default');
27
+ async function updateNotificationIsPinned(params) {
28
+ const {
29
+ notificationId,
30
+ pinStatus
31
+ } = params;
32
+ return (0, _fetch.Put)(`${_constants.urls.notifications.v1}/${pinStatus}`, {
33
+ notificationId
34
+ });
35
+ }
48
36
 
49
- exports.default = _default;
37
+ async function markAllAsRead() {
38
+ return (0, _fetch.Post)(`${_constants.urls.notifications.v1}/status/mark-all-read`);
39
+ }
@@ -5,100 +5,92 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = exports.ReportsApi = void 0;
8
+ exports.downloadReport = downloadReport;
9
+ exports.getReport = getReport;
10
+ exports.getReports = getReports;
11
+ exports.renderReport = renderReport;
12
+ exports.scheduleReport = scheduleReport;
13
+ exports.sendReport = sendReport;
9
14
 
10
15
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
16
 
12
17
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
18
 
14
- var _constants = require("../constants");
19
+ var _fetch = require("../fetch");
15
20
 
16
- var _BaseApiClient = require("../BaseApiClient");
21
+ var _constants = require("../constants");
17
22
 
18
23
  const _excluded = ["dataFilters"],
19
24
  _excluded2 = ["templateId", "dataFilters"],
20
25
  _excluded3 = ["dataFilters"];
21
26
 
22
- class ReportsApi extends _BaseApiClient.BaseApiClient {
23
- constructor(appName) {
24
- super(appName);
25
-
26
- this.getReports = async body => {
27
- return this.get(`${_constants.urls.reports.service.v2}/tenant-reports`, body);
28
- };
29
-
30
- this.getReport = async body => {
31
- return this.get(`${_constants.urls.reports.service.v2}/${body.id}/tenant-reports`);
32
- };
33
-
34
- this.renderReport = async _ref => {
35
- let {
36
- dataFilters
37
- } = _ref,
38
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
39
- const html = await this.get(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
40
- dataFilters: btoa(JSON.stringify(dataFilters || {})),
41
- responseType: 'html'
42
- }), {
43
- responseType: 'plain'
44
- });
45
- return {
46
- html
47
- };
48
- };
49
-
50
- this.scheduleReport = async _ref2 => {
51
- let {
52
- templateId,
53
- dataFilters
54
- } = _ref2,
55
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
56
- return this.post(`${_constants.urls.reports.service.v2}/${templateId}/tenant-reports`, (0, _extends2.default)({}, body, {
57
- dataFilters: btoa(JSON.stringify(dataFilters || {}))
58
- }));
59
- };
27
+ async function getReports(body) {
28
+ return (0, _fetch.Get)(`${_constants.urls.reports.service.v2}/tenant-reports`, body);
29
+ }
60
30
 
61
- this.downloadReport = async _ref3 => {
62
- let {
63
- dataFilters
64
- } = _ref3,
65
- body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
66
- const blob = await this.get(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
67
- dataFilters: btoa(JSON.stringify(dataFilters || {}))
68
- }), {
69
- responseType: 'blob'
70
- });
71
- let contentType = 'text/html';
72
- let contentExt = 'html';
31
+ async function getReport(body) {
32
+ return (0, _fetch.Get)(`${_constants.urls.reports.service.v2}/${body.id}/tenant-reports`);
33
+ }
73
34
 
74
- if (body.responseType === 'pdf') {
75
- contentType = 'application/pdf';
76
- contentExt = 'pdf';
77
- } else if (body.responseType === 'image') {
78
- contentType = 'image/jpeg';
79
- contentExt = 'jpg';
80
- }
35
+ async function renderReport(_ref) {
36
+ let {
37
+ dataFilters
38
+ } = _ref,
39
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
40
+ const html = await (0, _fetch.Get)(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
41
+ dataFilters: btoa(JSON.stringify(dataFilters || {})),
42
+ responseType: 'html'
43
+ }), {
44
+ responseType: 'plain'
45
+ });
46
+ return {
47
+ html
48
+ };
49
+ }
81
50
 
82
- const newBlob = new Blob([blob], {
83
- type: contentType
84
- });
85
- const fileURL = URL.createObjectURL(newBlob);
86
- const tempLink = document.createElement('a');
87
- tempLink.href = fileURL;
88
- tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
89
- tempLink.click();
90
- setTimeout(tempLink.remove.bind(tempLink));
91
- };
51
+ async function scheduleReport(_ref2) {
52
+ let {
53
+ templateId,
54
+ dataFilters
55
+ } = _ref2,
56
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
57
+ return (0, _fetch.Post)(`${_constants.urls.reports.service.v2}/${templateId}/tenant-reports`, (0, _extends2.default)({}, body, {
58
+ dataFilters: btoa(JSON.stringify(dataFilters || {}))
59
+ }));
60
+ }
92
61
 
93
- this.sendReport = async body => {
94
- return this.post(`${_constants.urls.reports.trigger.v1}/tenant-reports`, body);
95
- };
62
+ async function downloadReport(_ref3) {
63
+ let {
64
+ dataFilters
65
+ } = _ref3,
66
+ body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
67
+ const blob = await (0, _fetch.Get)(`${_constants.urls.reports.trigger.v1}/preview-report`, (0, _extends2.default)({}, body, {
68
+ dataFilters: btoa(JSON.stringify(dataFilters || {}))
69
+ }), {
70
+ responseType: 'blob'
71
+ });
72
+ let contentType = 'text/html';
73
+ let contentExt = 'html';
74
+
75
+ if (body.responseType === 'pdf') {
76
+ contentType = 'application/pdf';
77
+ contentExt = 'pdf';
78
+ } else if (body.responseType === 'image') {
79
+ contentType = 'image/jpeg';
80
+ contentExt = 'jpg';
96
81
  }
97
82
 
83
+ const newBlob = new Blob([blob], {
84
+ type: contentType
85
+ });
86
+ const fileURL = URL.createObjectURL(newBlob);
87
+ const tempLink = document.createElement('a');
88
+ tempLink.href = fileURL;
89
+ tempLink.setAttribute('download', `report_${body.name || ''}.${contentExt}`);
90
+ tempLink.click();
91
+ setTimeout(tempLink.remove.bind(tempLink));
98
92
  }
99
93
 
100
- exports.ReportsApi = ReportsApi;
101
-
102
- var _default = new ReportsApi('default');
103
-
104
- exports.default = _default;
94
+ async function sendReport(body) {
95
+ return (0, _fetch.Post)(`${_constants.urls.reports.trigger.v1}/tenant-reports`, body);
96
+ }