@frontegg/rest-api 2.10.90 → 3.0.1

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 (457) hide show
  1. package/{dist/ContextHolder.d.ts → ContextHolder.d.ts} +0 -0
  2. package/ContextHolder.js +114 -0
  3. package/{dist/account-settings → account-settings}/index.d.ts +0 -0
  4. package/account-settings/index.js +47 -0
  5. package/{dist/account-settings → account-settings}/interfaces.d.ts +0 -0
  6. package/account-settings/interfaces.js +1 -0
  7. package/account-settings/package.json +6 -0
  8. package/{dist/audits → audits}/index.d.ts +0 -0
  9. package/audits/index.js +74 -0
  10. package/{dist/audits → audits}/interfaces.d.ts +0 -0
  11. package/audits/interfaces.js +1 -0
  12. package/audits/package.json +6 -0
  13. package/{dist/auth → auth}/enums.d.ts +0 -0
  14. package/auth/enums.js +18 -0
  15. package/{dist/auth → auth}/index.d.ts +0 -0
  16. package/auth/index.js +2102 -0
  17. package/{dist/auth → auth}/interfaces.d.ts +0 -0
  18. package/auth/interfaces.js +16 -0
  19. package/auth/package.json +6 -0
  20. package/{dist/auth → auth}/secutiry-poilicy/index.d.ts +0 -0
  21. package/auth/secutiry-poilicy/index.js +257 -0
  22. package/{dist/auth → auth}/secutiry-poilicy/interfaces.d.ts +0 -0
  23. package/auth/secutiry-poilicy/interfaces.js +1 -0
  24. package/{dist/connectivity → connectivity}/index.d.ts +0 -0
  25. package/connectivity/index.js +114 -0
  26. package/{dist/connectivity → connectivity}/interfaces.d.ts +0 -0
  27. package/connectivity/interfaces.js +1 -0
  28. package/connectivity/package.json +6 -0
  29. package/{dist/constants.d.ts → constants.d.ts} +0 -0
  30. package/{src/constants.ts → constants.js} +13 -13
  31. package/{dist/error.d.ts → error.d.ts} +0 -0
  32. package/error.js +36 -0
  33. package/fetch.d.ts +19 -0
  34. package/fetch.js +557 -0
  35. package/{dist/es2015/index.d.ts → index.d.ts} +0 -0
  36. package/{dist/es2015/index.js → index.js} +32 -28
  37. package/{dist/es2015/interfaces.d.ts → interfaces.d.ts} +0 -0
  38. package/interfaces.js +1 -0
  39. package/{dist/es2015/jwt.d.ts → jwt.d.ts} +0 -0
  40. package/jwt.js +105 -0
  41. package/{dist/es2015/metadata → metadata}/index.d.ts +0 -0
  42. package/metadata/index.js +166 -0
  43. package/{dist/es2015/metadata → metadata}/interfaces.d.ts +0 -0
  44. package/metadata/interfaces.js +1 -0
  45. package/metadata/package.json +6 -0
  46. package/node/ContextHolder.js +126 -0
  47. package/node/account-settings/index.js +61 -0
  48. package/node/account-settings/interfaces.js +5 -0
  49. package/node/audits/index.js +90 -0
  50. package/node/audits/interfaces.js +5 -0
  51. package/node/auth/enums.js +26 -0
  52. package/node/auth/index.js +2327 -0
  53. package/node/auth/interfaces.js +39 -0
  54. package/node/auth/secutiry-poilicy/index.js +279 -0
  55. package/node/auth/secutiry-poilicy/interfaces.js +5 -0
  56. package/node/connectivity/index.js +201 -0
  57. package/node/connectivity/interfaces.js +5 -0
  58. package/node/constants.js +177 -0
  59. package/node/error.js +50 -0
  60. package/node/fetch.js +589 -0
  61. package/node/index.js +359 -0
  62. package/node/interfaces.js +5 -0
  63. package/node/jwt.js +125 -0
  64. package/node/metadata/index.js +188 -0
  65. package/node/metadata/interfaces.js +5 -0
  66. package/node/notifications/index.js +115 -0
  67. package/node/notifications/interfaces.js +5 -0
  68. package/node/reports/index.js +205 -0
  69. package/node/reports/interfaces.js +5 -0
  70. package/node/roles/index.js +209 -0
  71. package/node/roles/interfaces.js +5 -0
  72. package/node/routers.js +13 -0
  73. package/node/sub-tenants/index.js +153 -0
  74. package/node/sub-tenants/interfaces.js +5 -0
  75. package/node/subscriptions/enums.js +39 -0
  76. package/node/subscriptions/index.js +135 -0
  77. package/node/subscriptions/interfaces.js +18 -0
  78. package/node/subscriptions/invoices.js +88 -0
  79. package/node/subscriptions/managedSubscriptions.js +135 -0
  80. package/node/subscriptions/paymentMethods.js +91 -0
  81. package/node/subscriptions/paymentProviders.js +38 -0
  82. package/node/subscriptions/plans.js +61 -0
  83. package/node/subscriptions/providers/index.js +18 -0
  84. package/node/subscriptions/providers/stripe/index.js +130 -0
  85. package/node/subscriptions/providers/stripe/interfaces.js +5 -0
  86. package/node/subscriptions/subscriptions.js +135 -0
  87. package/node/subscriptions/summaries.js +38 -0
  88. package/node/subscriptions/tenantConfiguration.js +61 -0
  89. package/node/teams/index.js +478 -0
  90. package/node/teams/interfaces.js +5 -0
  91. package/node/tenants/index.js +107 -0
  92. package/node/tenants/interfaces.js +5 -0
  93. package/node/vendor/index.js +40 -0
  94. package/node/vendor/interfaces.js +5 -0
  95. package/{dist/es2015/notifications → notifications}/index.d.ts +0 -0
  96. package/notifications/index.js +99 -0
  97. package/{dist/es2015/notifications → notifications}/interfaces.d.ts +0 -0
  98. package/notifications/interfaces.js +1 -0
  99. package/notifications/package.json +6 -0
  100. package/package.json +9 -32
  101. package/{dist/es2015/reports → reports}/index.d.ts +0 -0
  102. package/reports/index.js +185 -0
  103. package/{dist/es2015/reports → reports}/interfaces.d.ts +0 -0
  104. package/reports/interfaces.js +1 -0
  105. package/reports/package.json +6 -0
  106. package/{dist/es2015/roles → roles}/index.d.ts +0 -0
  107. package/roles/index.js +188 -0
  108. package/{dist/es2015/roles → roles}/interfaces.d.ts +0 -0
  109. package/roles/interfaces.js +1 -0
  110. package/roles/package.json +6 -0
  111. package/{dist/es2015/routers.d.ts → routers.d.ts} +0 -0
  112. package/routers.js +3 -0
  113. package/{dist/es2015/sub-tenants → sub-tenants}/index.d.ts +0 -0
  114. package/sub-tenants/index.js +135 -0
  115. package/{dist/es2015/sub-tenants → sub-tenants}/interfaces.d.ts +0 -0
  116. package/sub-tenants/interfaces.js +1 -0
  117. package/sub-tenants/package.json +6 -0
  118. package/{dist/es2015/subscriptions → subscriptions}/enums.d.ts +0 -0
  119. package/subscriptions/enums.js +29 -0
  120. package/{dist/es2015/subscriptions → subscriptions}/index.d.ts +0 -0
  121. package/{dist/subscriptions/index.d.ts → subscriptions/index.js} +1 -1
  122. package/{dist/es2015/subscriptions → subscriptions}/interfaces.d.ts +0 -0
  123. package/{dist/es2015/subscriptions → subscriptions}/interfaces.js +1 -1
  124. package/{dist/es2015/subscriptions → subscriptions}/invoices.d.ts +0 -0
  125. package/subscriptions/invoices.js +73 -0
  126. package/{dist/es2015/subscriptions → subscriptions}/managedSubscriptions.d.ts +0 -0
  127. package/subscriptions/managedSubscriptions.js +118 -0
  128. package/subscriptions/package.json +6 -0
  129. package/{dist/es2015/subscriptions → subscriptions}/paymentMethods.d.ts +0 -0
  130. package/subscriptions/paymentMethods.js +75 -0
  131. package/{dist/es2015/subscriptions → subscriptions}/paymentProviders.d.ts +0 -0
  132. package/subscriptions/paymentProviders.js +25 -0
  133. package/{dist/es2015/subscriptions → subscriptions}/plans.d.ts +0 -0
  134. package/subscriptions/plans.js +47 -0
  135. package/{dist/es2015/subscriptions → subscriptions}/providers/index.d.ts +0 -0
  136. package/subscriptions/providers/index.js +1 -0
  137. package/{dist/es2015/subscriptions → subscriptions}/providers/stripe/index.d.ts +0 -0
  138. package/subscriptions/providers/stripe/index.js +113 -0
  139. package/{dist/es2015/subscriptions → subscriptions}/providers/stripe/interfaces.d.ts +0 -0
  140. package/subscriptions/providers/stripe/interfaces.js +1 -0
  141. package/{dist/es2015/subscriptions → subscriptions}/subscriptions.d.ts +0 -0
  142. package/subscriptions/subscriptions.js +118 -0
  143. package/{dist/es2015/subscriptions → subscriptions}/summaries.d.ts +0 -0
  144. package/subscriptions/summaries.js +25 -0
  145. package/{dist/es2015/subscriptions → subscriptions}/tenantConfiguration.d.ts +0 -0
  146. package/subscriptions/tenantConfiguration.js +47 -0
  147. package/{dist/es2015/teams → teams}/index.d.ts +0 -0
  148. package/teams/index.js +445 -0
  149. package/{dist/es2015/teams → teams}/interfaces.d.ts +0 -0
  150. package/teams/interfaces.js +1 -0
  151. package/teams/package.json +6 -0
  152. package/{dist/es2015/tenants → tenants}/index.d.ts +0 -0
  153. package/tenants/index.js +91 -0
  154. package/{dist/es2015/tenants → tenants}/interfaces.d.ts +0 -0
  155. package/tenants/interfaces.js +1 -0
  156. package/tenants/package.json +6 -0
  157. package/{dist/es2015/vendor → vendor}/index.d.ts +0 -0
  158. package/vendor/index.js +27 -0
  159. package/{dist/es2015/vendor → vendor}/interfaces.d.ts +0 -0
  160. package/vendor/interfaces.js +1 -0
  161. package/vendor/package.json +6 -0
  162. package/CHANGELOG.md +0 -211
  163. package/README.md +0 -139
  164. package/SECURITY.md +0 -13
  165. package/dist/ContextHolder.js +0 -69
  166. package/dist/ContextHolder.js.map +0 -1
  167. package/dist/account-settings/index.js +0 -33
  168. package/dist/account-settings/index.js.map +0 -1
  169. package/dist/account-settings/interfaces.js +0 -3
  170. package/dist/account-settings/interfaces.js.map +0 -1
  171. package/dist/audits/index.js +0 -59
  172. package/dist/audits/index.js.map +0 -1
  173. package/dist/audits/interfaces.js +0 -3
  174. package/dist/audits/interfaces.js.map +0 -1
  175. package/dist/auth/enums.js +0 -19
  176. package/dist/auth/enums.js.map +0 -1
  177. package/dist/auth/index.js +0 -1042
  178. package/dist/auth/index.js.map +0 -1
  179. package/dist/auth/interfaces.js +0 -29
  180. package/dist/auth/interfaces.js.map +0 -1
  181. package/dist/auth/secutiry-poilicy/index.js +0 -134
  182. package/dist/auth/secutiry-poilicy/index.js.map +0 -1
  183. package/dist/auth/secutiry-poilicy/interfaces.js +0 -3
  184. package/dist/auth/secutiry-poilicy/interfaces.js.map +0 -1
  185. package/dist/connectivity/index.js +0 -158
  186. package/dist/connectivity/index.js.map +0 -1
  187. package/dist/connectivity/interfaces.js +0 -3
  188. package/dist/connectivity/interfaces.js.map +0 -1
  189. package/dist/constants.js +0 -174
  190. package/dist/constants.js.map +0 -1
  191. package/dist/error.js +0 -14
  192. package/dist/error.js.map +0 -1
  193. package/dist/es2015/ContextHolder.d.ts +0 -29
  194. package/dist/es2015/ContextHolder.js +0 -65
  195. package/dist/es2015/ContextHolder.js.map +0 -1
  196. package/dist/es2015/account-settings/index.d.ts +0 -7
  197. package/dist/es2015/account-settings/index.js +0 -28
  198. package/dist/es2015/account-settings/index.js.map +0 -1
  199. package/dist/es2015/account-settings/interfaces.d.ts +0 -9
  200. package/dist/es2015/account-settings/interfaces.js +0 -2
  201. package/dist/es2015/account-settings/interfaces.js.map +0 -1
  202. package/dist/es2015/audits/index.d.ts +0 -16
  203. package/dist/es2015/audits/index.js +0 -53
  204. package/dist/es2015/audits/index.js.map +0 -1
  205. package/dist/es2015/audits/interfaces.d.ts +0 -61
  206. package/dist/es2015/audits/interfaces.js +0 -2
  207. package/dist/es2015/audits/interfaces.js.map +0 -1
  208. package/dist/es2015/auth/enums.d.ts +0 -13
  209. package/dist/es2015/auth/enums.js +0 -16
  210. package/dist/es2015/auth/enums.js.map +0 -1
  211. package/dist/es2015/auth/index.d.ts +0 -447
  212. package/dist/es2015/auth/index.js +0 -943
  213. package/dist/es2015/auth/index.js.map +0 -1
  214. package/dist/es2015/auth/interfaces.d.ts +0 -430
  215. package/dist/es2015/auth/interfaces.js +0 -16
  216. package/dist/es2015/auth/interfaces.js.map +0 -1
  217. package/dist/es2015/auth/secutiry-poilicy/index.d.ts +0 -41
  218. package/dist/es2015/auth/secutiry-poilicy/index.js +0 -121
  219. package/dist/es2015/auth/secutiry-poilicy/index.js.map +0 -1
  220. package/dist/es2015/auth/secutiry-poilicy/interfaces.d.ts +0 -70
  221. package/dist/es2015/auth/secutiry-poilicy/interfaces.js +0 -2
  222. package/dist/es2015/auth/secutiry-poilicy/interfaces.js.map +0 -1
  223. package/dist/es2015/connectivity/index.d.ts +0 -27
  224. package/dist/es2015/connectivity/index.js +0 -129
  225. package/dist/es2015/connectivity/index.js.map +0 -1
  226. package/dist/es2015/connectivity/interfaces.d.ts +0 -95
  227. package/dist/es2015/connectivity/interfaces.js +0 -2
  228. package/dist/es2015/connectivity/interfaces.js.map +0 -1
  229. package/dist/es2015/constants.d.ts +0 -170
  230. package/dist/es2015/constants.js +0 -171
  231. package/dist/es2015/constants.js.map +0 -1
  232. package/dist/es2015/error.d.ts +0 -5
  233. package/dist/es2015/error.js +0 -10
  234. package/dist/es2015/error.js.map +0 -1
  235. package/dist/es2015/fetch.d.ts +0 -19
  236. package/dist/es2015/fetch.js +0 -177
  237. package/dist/es2015/fetch.js.map +0 -1
  238. package/dist/es2015/index.js.map +0 -1
  239. package/dist/es2015/interfaces.js +0 -2
  240. package/dist/es2015/interfaces.js.map +0 -1
  241. package/dist/es2015/jwt.js +0 -83
  242. package/dist/es2015/jwt.js.map +0 -1
  243. package/dist/es2015/metadata/index.js +0 -32
  244. package/dist/es2015/metadata/index.js.map +0 -1
  245. package/dist/es2015/metadata/interfaces.js +0 -2
  246. package/dist/es2015/metadata/interfaces.js.map +0 -1
  247. package/dist/es2015/notifications/index.js +0 -49
  248. package/dist/es2015/notifications/index.js.map +0 -1
  249. package/dist/es2015/notifications/interfaces.js +0 -2
  250. package/dist/es2015/notifications/interfaces.js.map +0 -1
  251. package/dist/es2015/reports/index.js +0 -118
  252. package/dist/es2015/reports/index.js.map +0 -1
  253. package/dist/es2015/reports/interfaces.js +0 -2
  254. package/dist/es2015/reports/interfaces.js.map +0 -1
  255. package/dist/es2015/roles/index.js +0 -99
  256. package/dist/es2015/roles/index.js.map +0 -1
  257. package/dist/es2015/roles/interfaces.js +0 -2
  258. package/dist/es2015/roles/interfaces.js.map +0 -1
  259. package/dist/es2015/routers.js +0 -17
  260. package/dist/es2015/routers.js.map +0 -1
  261. package/dist/es2015/sub-tenants/index.js +0 -42
  262. package/dist/es2015/sub-tenants/index.js.map +0 -1
  263. package/dist/es2015/sub-tenants/interfaces.js +0 -2
  264. package/dist/es2015/sub-tenants/interfaces.js.map +0 -1
  265. package/dist/es2015/subscriptions/enums.js +0 -23
  266. package/dist/es2015/subscriptions/enums.js.map +0 -1
  267. package/dist/es2015/subscriptions/index.js +0 -11
  268. package/dist/es2015/subscriptions/index.js.map +0 -1
  269. package/dist/es2015/subscriptions/interfaces.js.map +0 -1
  270. package/dist/es2015/subscriptions/invoices.js +0 -43
  271. package/dist/es2015/subscriptions/invoices.js.map +0 -1
  272. package/dist/es2015/subscriptions/managedSubscriptions.js +0 -51
  273. package/dist/es2015/subscriptions/managedSubscriptions.js.map +0 -1
  274. package/dist/es2015/subscriptions/paymentMethods.js +0 -55
  275. package/dist/es2015/subscriptions/paymentMethods.js.map +0 -1
  276. package/dist/es2015/subscriptions/paymentProviders.js +0 -21
  277. package/dist/es2015/subscriptions/paymentProviders.js.map +0 -1
  278. package/dist/es2015/subscriptions/plans.js +0 -30
  279. package/dist/es2015/subscriptions/plans.js.map +0 -1
  280. package/dist/es2015/subscriptions/providers/index.js +0 -2
  281. package/dist/es2015/subscriptions/providers/index.js.map +0 -1
  282. package/dist/es2015/subscriptions/providers/stripe/index.js +0 -57
  283. package/dist/es2015/subscriptions/providers/stripe/index.js.map +0 -1
  284. package/dist/es2015/subscriptions/providers/stripe/interfaces.js +0 -2
  285. package/dist/es2015/subscriptions/providers/stripe/interfaces.js.map +0 -1
  286. package/dist/es2015/subscriptions/subscriptions.js +0 -57
  287. package/dist/es2015/subscriptions/subscriptions.js.map +0 -1
  288. package/dist/es2015/subscriptions/summaries.js +0 -21
  289. package/dist/es2015/subscriptions/summaries.js.map +0 -1
  290. package/dist/es2015/subscriptions/tenantConfiguration.js +0 -24
  291. package/dist/es2015/subscriptions/tenantConfiguration.js.map +0 -1
  292. package/dist/es2015/teams/index.js +0 -228
  293. package/dist/es2015/teams/index.js.map +0 -1
  294. package/dist/es2015/teams/interfaces.js +0 -2
  295. package/dist/es2015/teams/interfaces.js.map +0 -1
  296. package/dist/es2015/tenants/index.js +0 -57
  297. package/dist/es2015/tenants/index.js.map +0 -1
  298. package/dist/es2015/tenants/interfaces.js +0 -2
  299. package/dist/es2015/tenants/interfaces.js.map +0 -1
  300. package/dist/es2015/vendor/index.js +0 -23
  301. package/dist/es2015/vendor/index.js.map +0 -1
  302. package/dist/es2015/vendor/interfaces.js +0 -2
  303. package/dist/es2015/vendor/interfaces.js.map +0 -1
  304. package/dist/fetch.d.ts +0 -19
  305. package/dist/fetch.js +0 -187
  306. package/dist/fetch.js.map +0 -1
  307. package/dist/index.d.ts +0 -83
  308. package/dist/index.js +0 -98
  309. package/dist/index.js.map +0 -1
  310. package/dist/interfaces.d.ts +0 -40
  311. package/dist/interfaces.js +0 -3
  312. package/dist/interfaces.js.map +0 -1
  313. package/dist/jwt.d.ts +0 -13
  314. package/dist/jwt.js +0 -89
  315. package/dist/jwt.js.map +0 -1
  316. package/dist/metadata/index.d.ts +0 -5
  317. package/dist/metadata/index.js +0 -39
  318. package/dist/metadata/index.js.map +0 -1
  319. package/dist/metadata/interfaces.d.ts +0 -46
  320. package/dist/metadata/interfaces.js +0 -3
  321. package/dist/metadata/interfaces.js.map +0 -1
  322. package/dist/notifications/index.d.ts +0 -17
  323. package/dist/notifications/index.js +0 -56
  324. package/dist/notifications/index.js.map +0 -1
  325. package/dist/notifications/interfaces.d.ts +0 -40
  326. package/dist/notifications/interfaces.js +0 -3
  327. package/dist/notifications/interfaces.js.map +0 -1
  328. package/dist/reports/index.d.ts +0 -45
  329. package/dist/reports/index.js +0 -127
  330. package/dist/reports/index.js.map +0 -1
  331. package/dist/reports/interfaces.d.ts +0 -146
  332. package/dist/reports/interfaces.js +0 -3
  333. package/dist/reports/interfaces.js.map +0 -1
  334. package/dist/roles/index.d.ts +0 -34
  335. package/dist/roles/index.js +0 -110
  336. package/dist/roles/index.js.map +0 -1
  337. package/dist/roles/interfaces.d.ts +0 -58
  338. package/dist/roles/interfaces.js +0 -3
  339. package/dist/roles/interfaces.js.map +0 -1
  340. package/dist/routers.d.ts +0 -2
  341. package/dist/routers.js +0 -20
  342. package/dist/routers.js.map +0 -1
  343. package/dist/sub-tenants/index.d.ts +0 -8
  344. package/dist/sub-tenants/index.js +0 -51
  345. package/dist/sub-tenants/index.js.map +0 -1
  346. package/dist/sub-tenants/interfaces.d.ts +0 -87
  347. package/dist/sub-tenants/interfaces.js +0 -3
  348. package/dist/sub-tenants/interfaces.js.map +0 -1
  349. package/dist/subscriptions/enums.d.ts +0 -18
  350. package/dist/subscriptions/enums.js +0 -26
  351. package/dist/subscriptions/enums.js.map +0 -1
  352. package/dist/subscriptions/index.js +0 -23
  353. package/dist/subscriptions/index.js.map +0 -1
  354. package/dist/subscriptions/interfaces.d.ts +0 -117
  355. package/dist/subscriptions/interfaces.js +0 -14
  356. package/dist/subscriptions/interfaces.js.map +0 -1
  357. package/dist/subscriptions/invoices.d.ts +0 -13
  358. package/dist/subscriptions/invoices.js +0 -49
  359. package/dist/subscriptions/invoices.js.map +0 -1
  360. package/dist/subscriptions/managedSubscriptions.d.ts +0 -15
  361. package/dist/subscriptions/managedSubscriptions.js +0 -59
  362. package/dist/subscriptions/managedSubscriptions.js.map +0 -1
  363. package/dist/subscriptions/paymentMethods.d.ts +0 -13
  364. package/dist/subscriptions/paymentMethods.js +0 -61
  365. package/dist/subscriptions/paymentMethods.js.map +0 -1
  366. package/dist/subscriptions/paymentProviders.d.ts +0 -5
  367. package/dist/subscriptions/paymentProviders.js +0 -25
  368. package/dist/subscriptions/paymentProviders.js.map +0 -1
  369. package/dist/subscriptions/plans.d.ts +0 -9
  370. package/dist/subscriptions/plans.js +0 -35
  371. package/dist/subscriptions/plans.js.map +0 -1
  372. package/dist/subscriptions/providers/index.d.ts +0 -1
  373. package/dist/subscriptions/providers/index.js +0 -14
  374. package/dist/subscriptions/providers/index.js.map +0 -1
  375. package/dist/subscriptions/providers/stripe/index.d.ts +0 -21
  376. package/dist/subscriptions/providers/stripe/index.js +0 -65
  377. package/dist/subscriptions/providers/stripe/index.js.map +0 -1
  378. package/dist/subscriptions/providers/stripe/interfaces.d.ts +0 -32
  379. package/dist/subscriptions/providers/stripe/interfaces.js +0 -3
  380. package/dist/subscriptions/providers/stripe/interfaces.js.map +0 -1
  381. package/dist/subscriptions/subscriptions.d.ts +0 -21
  382. package/dist/subscriptions/subscriptions.js +0 -65
  383. package/dist/subscriptions/subscriptions.js.map +0 -1
  384. package/dist/subscriptions/summaries.d.ts +0 -5
  385. package/dist/subscriptions/summaries.js +0 -25
  386. package/dist/subscriptions/summaries.js.map +0 -1
  387. package/dist/subscriptions/tenantConfiguration.d.ts +0 -3
  388. package/dist/subscriptions/tenantConfiguration.js +0 -29
  389. package/dist/subscriptions/tenantConfiguration.js.map +0 -1
  390. package/dist/teams/index.d.ts +0 -116
  391. package/dist/teams/index.js +0 -250
  392. package/dist/teams/index.js.map +0 -1
  393. package/dist/teams/interfaces.d.ts +0 -136
  394. package/dist/teams/interfaces.js +0 -3
  395. package/dist/teams/interfaces.js.map +0 -1
  396. package/dist/tenants/index.d.ts +0 -26
  397. package/dist/tenants/index.js +0 -64
  398. package/dist/tenants/index.js.map +0 -1
  399. package/dist/tenants/interfaces.d.ts +0 -30
  400. package/dist/tenants/interfaces.js +0 -3
  401. package/dist/tenants/interfaces.js.map +0 -1
  402. package/dist/umd/index.js +0 -2891
  403. package/dist/vendor/index.d.ts +0 -6
  404. package/dist/vendor/index.js +0 -27
  405. package/dist/vendor/index.js.map +0 -1
  406. package/dist/vendor/interfaces.d.ts +0 -6
  407. package/dist/vendor/interfaces.js +0 -3
  408. package/dist/vendor/interfaces.js.map +0 -1
  409. package/src/ContextHolder.ts +0 -81
  410. package/src/account-settings/index.ts +0 -18
  411. package/src/account-settings/interfaces.ts +0 -10
  412. package/src/audits/index.ts +0 -35
  413. package/src/audits/interfaces.ts +0 -70
  414. package/src/auth/enums.ts +0 -17
  415. package/src/auth/index.ts +0 -935
  416. package/src/auth/interfaces.ts +0 -488
  417. package/src/auth/secutiry-poilicy/index.ts +0 -109
  418. package/src/auth/secutiry-poilicy/interfaces.ts +0 -81
  419. package/src/connectivity/index.ts +0 -160
  420. package/src/connectivity/interfaces.ts +0 -106
  421. package/src/error.ts +0 -13
  422. package/src/fetch.ts +0 -220
  423. package/src/index.ts +0 -86
  424. package/src/interfaces.ts +0 -47
  425. package/src/jwt.ts +0 -92
  426. package/src/metadata/index.ts +0 -24
  427. package/src/metadata/interfaces.ts +0 -51
  428. package/src/notifications/index.ts +0 -40
  429. package/src/notifications/interfaces.ts +0 -45
  430. package/src/reports/index.ts +0 -116
  431. package/src/reports/interfaces.ts +0 -167
  432. package/src/roles/index.ts +0 -80
  433. package/src/roles/interfaces.ts +0 -64
  434. package/src/routers.ts +0 -18
  435. package/src/sub-tenants/index.ts +0 -49
  436. package/src/sub-tenants/interfaces.ts +0 -100
  437. package/src/subscriptions/enums.ts +0 -22
  438. package/src/subscriptions/index.ts +0 -10
  439. package/src/subscriptions/interfaces.ts +0 -144
  440. package/src/subscriptions/invoices.ts +0 -42
  441. package/src/subscriptions/managedSubscriptions.ts +0 -53
  442. package/src/subscriptions/paymentMethods.ts +0 -47
  443. package/src/subscriptions/paymentProviders.ts +0 -13
  444. package/src/subscriptions/plans.ts +0 -19
  445. package/src/subscriptions/providers/index.ts +0 -1
  446. package/src/subscriptions/providers/stripe/index.ts +0 -56
  447. package/src/subscriptions/providers/stripe/interfaces.ts +0 -39
  448. package/src/subscriptions/subscriptions.ts +0 -63
  449. package/src/subscriptions/summaries.ts +0 -11
  450. package/src/subscriptions/tenantConfiguration.ts +0 -23
  451. package/src/teams/index.ts +0 -224
  452. package/src/teams/interfaces.ts +0 -163
  453. package/src/tenants/index.ts +0 -46
  454. package/src/tenants/interfaces.ts +0 -33
  455. package/src/vendor/index.ts +0 -12
  456. package/src/vendor/interfaces.ts +0 -6
  457. package/yarn-error.log +0 -518
package/src/auth/index.ts DELETED
@@ -1,935 +0,0 @@
1
- import {getTenants} from "../tenants";
2
-
3
- export * from './secutiry-poilicy';
4
- export * from './enums';
5
-
6
- import {urls,} from '../constants';
7
- import {ContextHolder} from '../ContextHolder';
8
- import {Delete, Get, Patch, Post, Put} from '../fetch';
9
- import {jwtDecode} from '../jwt';
10
- import {ISamlRolesGroup} from '../teams/interfaces';
11
- import {
12
- IAcceptInvitation,
13
- IActivateAccount,
14
- IAllowedToRememberMfaDevice,
15
- ICreateSamlGroup,
16
- IDeleteApiToken,
17
- IDisableMfa,
18
- IEnrollMfaResponse,
19
- IForgotPassword,
20
- IGetActivateAccountStrategy,
21
- IGetActivateAccountStrategyResponse,
22
- IGetUserById,
23
- IGetUserPasswordConfig,
24
- ILogin,
25
- ILoginResponse,
26
- ILoginViaSocialLogin,
27
- ILoginViaSocialLoginResponse,
28
- ILoginWithMfa,
29
- IOidcPostLogin,
30
- IOidcConfiguration,
31
- IPostLogin,
32
- IPreLogin,
33
- IRecoverMFAToken,
34
- IResendActivationEmail,
35
- IResetPassword,
36
- ISamlConfiguration,
37
- ISamlVendorConfigResponse,
38
- ISignUpResponse,
39
- ISignUpUser,
40
- ISocialLoginProviderConfiguration,
41
- ITenantApiTokensData,
42
- IUpdateSamlConfiguration,
43
- IUpdateSamlGroup,
44
- IUpdateSamlRoles,
45
- IUpdateSamlVendorMetadata,
46
- IUpdateTenantApiTokensData,
47
- IUpdateUserApiTokensData,
48
- IUserApiTokensData,
49
- IUserIdResponse,
50
- IVendorConfig,
51
- IVerifyMfa,
52
- IVerifyMfaResponse,
53
- TestConfig,
54
- ISSOPublicConfiguration,
55
- IPreLoginWithIdpTypeResponse,
56
- IPasswordlessPreLogin,
57
- IPasswordlessPostLogin,
58
- ICreateSSODomain,
59
- IVerifyInviteToken,
60
- ISSODomain,
61
- ISSOConfigurationDefaultRoles,
62
- ISSOConfiguration,
63
- IUpdateSSOConfiguration,
64
- IOidcPostLoginV2,
65
- IExchangeOAuthTokens, IOAuthTokenResponse, ISocialLoginProviderConfigurationV2, ILoginResponseV2, IResetPhoneNumber, IVerifyResetPhoneNumber, IChangePhoneNumber, IVerifyResetPhoneNumberResponse, IResetPhoneNumberResponse, IWebAuthnPreLogin, IWebAuthnPostLogin, IVerifyNewWebAuthnDevice, IWebAuthnPreLoginResponse, ICreateNewDeviceSessionResponse, IAuthStrategiesConfig, ISessionResponse, IChangePhoneNumberWithVerification, IChangePhoneNumberWithVerificationResponse, IVerifyChangePhoneNumber, ISessionConfigurations
66
- } from './interfaces';
67
-
68
- /*****************************************
69
- * Authentication
70
- *****************************************/
71
-
72
- export async function generateLoginResponse(loginResponse: ILoginResponse): Promise<ILoginResponse> {
73
- if (!loginResponse.accessToken) {
74
- return loginResponse;
75
- }
76
- ContextHolder.setAccessToken(loginResponse.accessToken);
77
- const me = await Get(`${urls.identity.users.v2}/me`);
78
- const decodedContent: any = loginResponse.accessToken ? jwtDecode(loginResponse.accessToken) : {};
79
- const user = {
80
- ...loginResponse,
81
- ...decodedContent,
82
- ...me,
83
- };
84
- ContextHolder.setUser(user);
85
- return user;
86
- }
87
-
88
- export async function generateLoginResponseV2(loginResponse: ILoginResponse): Promise<ILoginResponseV2> {
89
- if (!loginResponse.accessToken) {
90
- return {user: loginResponse};
91
- }
92
- ContextHolder.setAccessToken(loginResponse.accessToken);
93
- const [me, tenants] = await Promise.all([Get(`${urls.identity.users.v2}/me`), getTenants()]);
94
- const decodedContent: any = loginResponse.accessToken ? jwtDecode(loginResponse.accessToken) : {};
95
- const user = {
96
- ...loginResponse,
97
- ...decodedContent,
98
- ...me,
99
- };
100
- ContextHolder.setUser(user);
101
- return {user, tenants};
102
- }
103
-
104
- export async function generateLoginResponseFromOAuthResponse(oauthResponse: IOAuthTokenResponse): Promise<ILoginResponse> {
105
- ContextHolder.setAccessToken(oauthResponse.id_token);
106
- const me = await Get(`${urls.identity.users.v2}/me`);
107
- const decodedContent: any = oauthResponse.id_token ? jwtDecode(oauthResponse.id_token) : {};
108
- const user = {
109
- mfaRequired: false,
110
- accessToken: oauthResponse.id_token,
111
- refreshToken: oauthResponse.refresh_token,
112
- ...decodedContent,
113
- ...me,
114
- };
115
- ContextHolder.setUser(user);
116
- return user;
117
- }
118
-
119
- /**
120
- * Check if requested email address has sso configuration
121
- * If true, this function will return the sso address to navigate to
122
- * else, return null
123
- */
124
- export async function preLogin(body: IPreLogin): Promise<string | null> {
125
- console.debug('preLogin()', body);
126
- try {
127
- const {address} = await Post(`${urls.identity.auth.v1}/user/saml/prelogin`, body);
128
- return address;
129
- } catch {
130
- return null;
131
- }
132
- }
133
-
134
-
135
- /**
136
- * Check if requested email address has sso configuration
137
- * If true, this function will return the sso address and IdpType to navigate to
138
- */
139
- export async function preLoginWithIdpType(body: IPreLogin): Promise<IPreLoginWithIdpTypeResponse | null> {
140
- console.debug('preLoginWithIdpType()', body);
141
- return Post(`${urls.identity.auth.v1}/user/saml/prelogin`, body);
142
- }
143
-
144
- /**
145
- * After calling preLogin and navigated to SSO url, the IDP will redirect you to the ACS Url
146
- * Which configured in the SSO configuraation
147
- * else, return null
148
- */
149
- export async function postLogin(body: IPostLogin): Promise<ILoginResponse> {
150
- console.debug('postLogin()');
151
- const data = await Post(`${urls.identity.auth.v1}/user/saml/postlogin`, body);
152
- return generateLoginResponse(data);
153
- }
154
-
155
- /**
156
- * After calling preLogin and navigated to SSO url, the IDP will redirect you to the redirect url
157
- * with code and state
158
- */
159
- export async function oidcPostLogin(body: IOidcPostLogin): Promise<ILoginResponse> {
160
- console.debug('oidcPostLogin()');
161
- const data = await Post(`${urls.identity.auth.v1}/user/oidc/postlogin`, body);
162
- return generateLoginResponse(data);
163
- }
164
-
165
- /**
166
- * login with username and password.
167
- * if the user has two factor authentication
168
- * the server will return mfaToken with mfaRequired: true,
169
- * and then ``loginWithMfa`` should be called with the mfaToken and and generated code
170
- * else, the server will accessToken and refreshToken.
171
- * the refresh should be used to renew your access token by calling ``refreshToken``
172
- *
173
- * @throw exception if login failed
174
- */
175
- export async function login(body: ILogin): Promise<ILoginResponse> {
176
- console.debug('login()');
177
- const data = await Post(`${urls.identity.auth.v1}/user`, body);
178
- return generateLoginResponse(data);
179
- }
180
-
181
- /**
182
- * after login succeeded with mfaRequired token response, this function should be called
183
- * with the mfaToken and the generated code from your authenticator app.
184
- *
185
- * @throw exception if generated code or mfaToken are incorrect
186
- */
187
- export async function loginWithMfa(body: ILoginWithMfa): Promise<ILoginResponse> {
188
- console.debug('loginWithMfa()');
189
- const data = await Post(`${urls.identity.auth.v1}/user/mfa/verify`, body);
190
- return generateLoginResponse(data);
191
- }
192
-
193
- /**
194
- * activating account should be called after registering new user of deactivate account
195
- * ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested.
196
- *
197
- * @throws exception if activation failed
198
- */
199
- export async function activateAccount(body: IActivateAccount): Promise<void> {
200
- console.debug('activateAccount()');
201
- return Post(`${urls.identity.users.v1}/activate`, body);
202
- }
203
-
204
- /**
205
- * get account activation configuration.
206
- */
207
- export async function getActivateAccountStrategy(
208
- params: IGetActivateAccountStrategy
209
- ): Promise<IGetActivateAccountStrategyResponse> {
210
- console.debug('getActivateAccountStrategy()');
211
- return Get(`${urls.identity.users.v1}/activate/strategy`, params);
212
- }
213
-
214
- /**
215
- * resend activation email should be called after a failed user activation.
216
- * ``resend activation email`` should contain the user email.
217
- *
218
- * @throws exception if resend failed
219
- */
220
- export async function resendActivationEmail(body: IResendActivationEmail): Promise<void> {
221
- console.debug('resendActivationEmail()');
222
- return Post(`${urls.identity.users.v1}/activate/reset`, body);
223
- }
224
-
225
- /**
226
- * activating account should be called after registering new user of deactivate account
227
- * ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested.
228
- *
229
- * @throws exception if activation failed
230
- */
231
- export async function acceptInvitation(body: IAcceptInvitation): Promise<void> {
232
- console.debug('acceptInvitation()');
233
- return Post(`${urls.identity.users.v1}/invitation/accept`, body);
234
- }
235
-
236
- /**
237
- * refresh token called as authenticated use, access and refresh tokens resolved by the cookies.
238
- * the server will return ILoginResponse with new access Token and refresh token and store it in the browser cookies.
239
- */
240
- export async function refreshToken(): Promise<ILoginResponse> {
241
- console.debug('refreshToken()');
242
- const data = await Post(`${urls.identity.auth.v1}/user/token/refresh`);
243
- return generateLoginResponse(data);
244
- }
245
-
246
- /**
247
- * refresh token called as authenticated use, access and refresh tokens resolved by the cookies.
248
- * the server will return ILoginResponseV2 with new access Token and refresh token and store it in the browser cookies, as well as the tenants.
249
- */
250
- export async function refreshTokenV2(): Promise<ILoginResponseV2> {
251
- console.debug('refreshTokenV2()');
252
- const data = await Post(`${urls.identity.auth.v1}/user/token/refresh`);
253
- return generateLoginResponseV2(data);
254
- }
255
-
256
- /**
257
- * logout from server, invalidate access and refresh token, remove it from cookies.
258
- */
259
- export async function logout(): Promise<void> {
260
- console.debug('logout()');
261
- return Post(`${urls.identity.auth.v1}/logout`);
262
- }
263
-
264
- /**
265
- * calling forgot password request will send email with link to reset user's password.
266
- *
267
- * @throws exception if the user not found
268
- */
269
- export async function forgotPassword(body: IForgotPassword): Promise<void> {
270
- console.debug('forgotPassword()', body);
271
- return Post(`${urls.identity.users.v1}/passwords/reset`, body);
272
- }
273
-
274
- /**
275
- * reset password should be called after forget password request.
276
- * userId, new password and the token has been sent to the user email.
277
- *
278
- * @throws exception if the user not found, password validation failed or invalid token.
279
- */
280
- export async function resetPassword(body: IResetPassword): Promise<void> {
281
- console.debug('resetPassword()');
282
- return Post(`${urls.identity.users.v1}/passwords/reset/verify`, body);
283
- }
284
-
285
- /**
286
- * load password configuration for user.
287
- */
288
- export async function loadPasswordConfig(params?: IGetUserPasswordConfig): Promise<Partial<TestConfig> | null> {
289
- console.debug('loadPasswordConfig()');
290
- return Get(`${urls.identity.users.v1}/passwords/config`, params);
291
- }
292
-
293
- /**
294
- * recover Multi-Factor authentication by providing the recoveryCode
295
- * that has been received when activated it
296
- *
297
- * @throws exception if recovery code is not valid
298
- */
299
- export async function recoverMfaToken(body: IRecoverMFAToken): Promise<void> {
300
- console.debug('recoverMfaToken()', body);
301
- return Post(`${urls.identity.auth.v1}/user/mfa/recover`, body);
302
- }
303
-
304
- /**
305
- * Multi-Factor Settings
306
- */
307
-
308
- /**
309
- * enroll Multi-Factor Auth Code to use in 3rd party apps like Google Authenticator.
310
- * the server returns qrCode as png image in base64 format
311
- *
312
- * @throws exception if the user already have mfa-enabled
313
- * ``authorized user``
314
- */
315
- export async function enrollMfa(): Promise<IEnrollMfaResponse> {
316
- console.debug('enrollMfa()');
317
- return Post(`${urls.identity.users.v1}/mfa/enroll`);
318
- }
319
-
320
- /**
321
- * after enrolling MFA QR code, verify function should be called
322
- * with the generated code in the Authenticator App
323
- *
324
- * @return recoveryCode to use to disable mfa if your device is lost, this code won't show it again.
325
- * @throws exception if the generated token is invalid
326
- * ``authorized user``
327
- */
328
- export async function verifyMfa(body: IVerifyMfa): Promise<IVerifyMfaResponse> {
329
- console.debug('verifyMfa()', body);
330
- return Post(`${urls.identity.users.v1}/mfa/enroll/verify`, body);
331
- }
332
-
333
- /**
334
- * disable MFA by either passing the recoveryCode or the generated code from the Authenticator App.
335
- *
336
- * @throws exception if the generated token or the recoveryCode are incorrect.
337
- * * ``authorized user``
338
- */
339
- export async function disableMfa(body: IDisableMfa): Promise<void> {
340
- console.debug('disableMfa()', body);
341
- return Post(`${urls.identity.users.v1}/mfa/disable`, body);
342
- }
343
-
344
- /**
345
- * SSO Configurations
346
- */
347
-
348
- /**
349
- * Retrieve SAML configurations from server by logged in user (tenantId, vendorId)
350
- *
351
- * @return {enabled: false} if no saml configuration found. else ISamlConfiguration
352
- * * ``authorized user``
353
- */
354
- export async function getSamlConfiguration(): Promise<ISamlConfiguration> {
355
- console.debug('getSamlConfiguration()');
356
- return Get(`${urls.team.sso.v1}/saml/configurations`);
357
- }
358
-
359
- /**
360
- * Update SAML configuration by logged in user (tenantId, vendorId)
361
- * * ``authorized user``
362
- */
363
- export async function updateSamlConfiguration(body: IUpdateSamlConfiguration): Promise<ISamlConfiguration> {
364
- console.debug('updateSamlConfiguration()', body);
365
- return Post(`${urls.team.sso.v1}/saml/configurations`, body);
366
- }
367
-
368
- /**
369
- * Retrieve 'Vendor' Saml config from server by logged in user (tenantId, vendorId)
370
- *
371
- * @throws exception 'ACS url information not found' if no saml vendor configuration found.
372
- * * ``authorized user``
373
- */
374
- export async function getSamlVendorConfiguration(): Promise<ISamlVendorConfigResponse> {
375
- console.debug('getSamlVendorConfiguration()');
376
- return Get(`${urls.team.sso.v1}/saml/configurations/vendor-config`);
377
- }
378
-
379
- /**
380
- * Update Vendor Saml metadata by logged in user (tenantId, vendorId)
381
- *
382
- * @return {enabled: false} if no saml configuration found. else ISamlConfiguration
383
- * * ``authorized user``
384
- */
385
- export async function updateSamlVendorMetadata(body: IUpdateSamlVendorMetadata): Promise<ISamlConfiguration> {
386
- console.debug('updateSamlVendorMetadata()', body);
387
- return Put(`${urls.team.sso.v1}/saml/configurations/metadata`, body);
388
- }
389
-
390
- /**
391
- * Validate Saml configuration's domain by logged in user (tenantId, vendorId)
392
- *
393
- * @return {enabled: false} if no saml configuration found. else ISamlConfiguration
394
- * * ``authorized user``
395
- */
396
- export async function validateSamlDomain(): Promise<ISamlConfiguration> {
397
- console.debug('validateSamlDomain()');
398
- return Put(`${urls.team.sso.v1}/saml/validations/domain`);
399
- }
400
-
401
- /**
402
- * Get Saml roles for authorization
403
- * @return array of role IDs
404
- */
405
- export async function getSamlRoles(): Promise<string[]> {
406
- console.debug('getSamlRoles()');
407
- return Get(`${urls.team.sso.v1}/saml/configurations/roles/default`);
408
- }
409
-
410
- /**
411
- * Get Saml roles groups
412
- * @return array of groups and assigend role IDs
413
- */
414
- export async function getSamlRolesGroups(): Promise<ISamlRolesGroup[]> {
415
- console.debug('getSamlRoles()');
416
- return Get(`${urls.team.sso.v2}/saml/configurations/groups`);
417
- }
418
-
419
- /**
420
- * Update Saml roles for authorization
421
- */
422
- export async function updateSamlRoles({roleIds}: IUpdateSamlRoles): Promise<void> {
423
- console.debug('updateSamlRoles()');
424
- return Post(`${urls.team.sso.v1}/saml/configurations/roles/default`, {roleIds});
425
- }
426
-
427
- /**
428
- * Create Saml group roles for authorization
429
- */
430
- export async function createSamlGroup({roleIds, group}: ICreateSamlGroup): Promise<void> {
431
- console.debug('createSamlGroup()');
432
- return Post(`${urls.team.sso.v2}/saml/configurations/groups`, {group, roleIds});
433
- }
434
-
435
- /**
436
- * Update Saml group roles for authorization
437
- */
438
- export async function updateSamlGroup({roleIds, group, id}: IUpdateSamlGroup): Promise<void> {
439
- console.debug('updateSamlGroup()');
440
- return Patch(`${urls.team.sso.v2}/saml/configurations/groups/${id}`, {group, roleIds});
441
- }
442
-
443
- /**
444
- * Delete Saml group
445
- */
446
- export async function deleteSamlGroup({id}: { id: string }): Promise<void> {
447
- console.debug('deleteSamlGroup()');
448
- return Delete(`${urls.team.sso.v2}/saml/configurations/groups/${id}`);
449
- }
450
-
451
- /**
452
- * Retrieve OIDC configurations from server by logged in user (vendorId)
453
- *
454
- * @return {active: true} if no oidc configuration found. else IOidcConfiguration
455
- * * ``authorized user``
456
- */
457
- export async function getOidcConfiguration(): Promise<IOidcConfiguration> {
458
- console.debug('getOidcConfiguration()');
459
- return Get(`${urls.team.sso.v1}/oidc/configurations`);
460
- }
461
-
462
- /**
463
- * Check if one or more saml/oidc configuration are active
464
- *
465
- ** @return {isActive: true/false}
466
- */
467
- export async function getSSOPublicConfiguration(): Promise<ISSOPublicConfiguration> {
468
- console.debug('getSSOPublicConfiguration()');
469
- return Get(`${urls.team.sso.v2}/configurations/public`);
470
- }
471
-
472
-
473
- /**
474
- * Get social logins providers configurations for vendor
475
- * @return array of providers configurations
476
- */
477
- export async function getSocialLoginProviders(): Promise<ISocialLoginProviderConfiguration[]> {
478
- console.debug('getSocialLoginProviders()');
479
- return Get(urls.identity.sso.v1);
480
- }
481
-
482
- /**
483
- * Get social logins providers configurations V2 supports dev credentials as well
484
- * @return array of providers configurations
485
- */
486
- export async function getSocialLoginProvidersV2(): Promise<ISocialLoginProviderConfigurationV2[]> {
487
- console.debug('getSocialLoginProvidersV2()');
488
- return Get(urls.identity.sso.v2);
489
- }
490
-
491
- /**
492
- * Login using social login
493
- * @return cookie with refresh token
494
- */
495
- export async function loginViaSocialLogin({
496
- provider,
497
- code,
498
- redirectUri,
499
- codeVerifier,
500
- metadata,
501
- invitationToken,
502
- state,
503
- }: ILoginViaSocialLogin): Promise<ILoginViaSocialLoginResponse> {
504
- console.debug('loginViaSocialLogin()');
505
- const params: {
506
- code: string;
507
- redirectUri?: string;
508
- code_verifier?: string;
509
- state?: string;
510
- } = {code};
511
- if (redirectUri) {
512
- params.redirectUri = redirectUri;
513
- }
514
- if (codeVerifier) {
515
- params.code_verifier = codeVerifier;
516
- }
517
- if(state) {
518
- params.state = state
519
- }
520
-
521
- return Post(`${urls.identity.auth.v1}/user/sso/${provider}/postlogin`, {metadata, invitationToken}, {params});
522
- }
523
-
524
- /**
525
- * Get vendor secure access configuration
526
- */
527
- export async function getVendorConfig(): Promise<IVendorConfig> {
528
- console.debug('getVendorConfig()');
529
- return Get(`${urls.identity.configurations.v1}/public`);
530
- }
531
-
532
- /**
533
- * Sign up new user
534
- * create new user with a new tenant
535
- */
536
- export async function signUpUser(body: ISignUpUser): Promise<ISignUpResponse> {
537
- console.debug('signUpUser()', body);
538
- const {shouldActivate, authResponse, userId, tenantId} = await Post(`${urls.identity.users.v1}/signUp`, body);
539
- const loginResponse =
540
- !shouldActivate && authResponse ? await generateLoginResponse(authResponse as ILoginResponse) : undefined;
541
- return {shouldActivate, user: loginResponse, userId, tenantId};
542
- }
543
-
544
- /**
545
- * Get all current user active sessions
546
- */
547
- export async function getCurrentUserSessions(): Promise<ISessionResponse[]> {
548
- console.debug('getCurrentUserSessions');
549
- const sessions = await Get(urls.identity.users.sessions.currentUser.v1);
550
- return sessions;
551
- }
552
-
553
- /**
554
- * Get session configurations
555
- */
556
- export async function getSessionConfigurations(): Promise<ISessionConfigurations> {
557
- console.debug('getSessionConfigurations');
558
- const sessionsConfigurations = await Get(urls.identity.users.sessions.configurations.v1);
559
- return sessionsConfigurations;
560
- }
561
-
562
-
563
- /**
564
- * Create or update session configurations
565
- */
566
- export async function createOrUpdateSessionConfigrations(body: ISessionConfigurations): Promise<void> {
567
- console.debug('createOrUpdateSessionConfigrations');
568
- await Post(urls.identity.users.sessions.configurations.v1, body);
569
- }
570
-
571
-
572
- /**
573
- * Delete user session
574
- */
575
- export async function deleteSessionForUser(id: string): Promise<void> {
576
- console.debug('deleteSessionForUser', id);
577
- await Delete(`${urls.identity.users.sessions.currentUser.v1}/${id}`);
578
- }
579
-
580
- /**
581
- * Delete all user sessions
582
- */
583
- export async function deleteAllSessionsForUser(): Promise<void> {
584
- console.debug('deleteAllSessionsForUser');
585
- await Delete(`${urls.identity.users.sessions.currentUser.v1}/all`);
586
- }
587
-
588
-
589
- /**
590
- * Api tokens Configurations
591
- */
592
-
593
- /**
594
- * Get user api tokens data
595
- */
596
- export async function getUserApiTokensData(): Promise<IUserApiTokensData[]> {
597
- console.debug('getUserApiTokensData()');
598
- return Get(urls.identity.users.apiTokens.v1);
599
- }
600
-
601
- /**
602
- * Get tenant api tokens data
603
- */
604
- export async function getTenantApiTokensData(): Promise<ITenantApiTokensData[]> {
605
- console.debug('geTenantApiTokensData()');
606
- return Get(urls.identity.tenants.apiTokens.v1);
607
- }
608
-
609
- /**
610
- * Update User Api Tokens
611
- */
612
-
613
- export async function updateUserApiTokensData(body: IUpdateUserApiTokensData): Promise<IUserApiTokensData> {
614
- console.debug('updateUserApiTokensData()', body);
615
- return Post(urls.identity.users.apiTokens.v1, body);
616
- }
617
-
618
- /**
619
- * Update Tenant Api Tokens
620
- */
621
- export async function updateTenantApiTokensData(body: IUpdateTenantApiTokensData): Promise<ITenantApiTokensData> {
622
- console.debug('updateTenantApiTokensData()', body);
623
- return Post(urls.identity.tenants.apiTokens.v2, body);
624
- }
625
-
626
- /**
627
- * Delete Tenant Api Token
628
- */
629
- export async function deleteTenantApiToken({tokenId}: IDeleteApiToken): Promise<void> {
630
- console.debug('deleteTenantApiToken()', tokenId);
631
- return Delete(`${urls.identity.tenants.apiTokens.v1}/${tokenId}`);
632
- }
633
-
634
- /**
635
- * Delete Tenant Api Token
636
- */
637
- export async function deleteUserApiToken({tokenId}: IDeleteApiToken): Promise<void> {
638
- console.debug('deleteUserApiToken()', tokenId);
639
- return Delete(`${urls.identity.users.apiTokens.v1}/${tokenId}`);
640
- }
641
-
642
- /**
643
- * Get Tenant Api Token Creator User
644
- */
645
-
646
- export async function getUserById({userId}: IGetUserById): Promise<IUserIdResponse> {
647
- console.debug('getUserById()');
648
- return Get(`${urls.identity.users.v1}/${userId}`);
649
- }
650
-
651
- /**
652
- * Checks if remember MFA device is enabled for user.
653
- */
654
- export async function checkIfAllowToRememberMfaDevice(mfaToken: string): Promise<IAllowedToRememberMfaDevice> {
655
- console.debug('checkIfAllowToRememberMfaDevice()');
656
- return Get(`${urls.identity.configurations.v1}/mfa-policy/allow-remember-device`, {mfaToken});
657
- }
658
-
659
- /**
660
- * Passwordless prelogin authentication
661
- */
662
- export async function passwordlessPreLogin({ type, ...body }: IPasswordlessPreLogin): Promise<void> {
663
- console.debug('passwordlessPrelogin()');
664
- return Post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/prelogin`, body);
665
- }
666
-
667
- export async function passwordlessPostLogin({ type, ...body }: IPasswordlessPostLogin): Promise<ILoginResponse> {
668
- console.debug('passwordlessPostLogin()');
669
- return Post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body);
670
- }
671
-
672
- /**
673
- * Check if tenant invitation token is valid
674
- * @param token - invitation token
675
- * @returns tenant name
676
- */
677
- export async function verifyInviteToken({ token }: IVerifyInviteToken): Promise<string> {
678
- console.debug('verifyInviteToken()');
679
- return Post(urls.identity.tenants.invites.verify.v1, { token });
680
- }
681
- /**
682
- * SSO Configurations V1
683
- */
684
-
685
- /**
686
- * Retrieve SSO configurations from server by logged in user (tenantId, vendorId)
687
- *
688
- * @return ISSOConfiguration[]
689
- * * ``authorized user``
690
- */
691
- export async function getSSOConfigurations(): Promise<ISSOConfiguration[]> {
692
- console.debug('getSSOConfigurations()');
693
- return Get(`${urls.team.sso.v1}/configurations`);
694
- }
695
-
696
- /**
697
- * Create SSO configuration by logged in user (tenantId, vendorId)
698
- *
699
- * @returns ISSOConfiguration
700
- * * ``authorized user``
701
- */
702
- export async function createSSOConfiguration(body: IUpdateSSOConfiguration): Promise<ISSOConfiguration> {
703
- console.debug('createSSOConfiguration()', body);
704
- return Post(`${urls.team.sso.v1}/configurations`, body);
705
- }
706
-
707
- /**
708
- * Update SSO configuration by logged in user (tenantId, vendorId)
709
- *
710
- * @returns ISSOConfiguration
711
- * * ``authorized user``
712
- */
713
- export async function updateSSOConfiguration(ssoConfigId: string, body: IUpdateSSOConfiguration): Promise<ISSOConfiguration> {
714
- console.debug('updateSSOConfiguration()', { body, ssoConfigId });
715
- return Patch(`${urls.team.sso.v1}/configurations/${ssoConfigId}`, body);
716
- }
717
-
718
- /**
719
- * Delete SSO configuration by logged in user (tenantId, vendorId)
720
- * * ``authorized user``
721
- */
722
- export async function deleteSSOConfiguration(ssoConfigId: string): Promise<void> {
723
- console.debug('deleteSSOConfiguration()', { ssoConfigId });
724
- return Delete(`${urls.team.sso.v1}/configurations/${ssoConfigId}`);
725
- }
726
-
727
- /**
728
- * Create SSO configuration by metadata by logged in user (tenantId, vendorId)
729
- *
730
- * @returns ISSOConfiguration
731
- * * ``authorized user``
732
- */
733
- export async function createSSOConfigurationByMetadata(body: IUpdateSamlVendorMetadata): Promise<ISSOConfiguration> {
734
- console.debug('createSSOConfigurationByMetadata()', body);
735
- return Post(`${urls.team.sso.v1}/configurations/metadata`, body);
736
- }
737
-
738
- /**
739
- * Update SSO configuration by metadata by logged in user (tenantId, vendorId)
740
- *
741
- * @returns ISSOConfiguration
742
- * * ``authorized user``
743
- */
744
- export async function updateSSOConfigurationByMetadata(ssoConfigId: string, body: IUpdateSamlVendorMetadata): Promise<ISSOConfiguration> {
745
- console.debug('updateSSOConfigurationByMetadata()', { body, ssoConfigId });
746
- return Put(`${urls.team.sso.v1}/configurations/${ssoConfigId}/metadata`, body);
747
- }
748
-
749
- /**
750
- * Create SSO configuration domain by logged in user (tenantId, vendorId)
751
- *
752
- * @returns ISSODomain
753
- * * ``authorized user``
754
- */
755
- export async function createSSODomain(ssoConfigId: string, body: ICreateSSODomain): Promise<ISSODomain> {
756
- console.debug('createSSODomain()', { body, ssoConfigId });
757
- return Post(`${urls.team.sso.v1}/configurations/${ssoConfigId}/domains`, body);
758
- }
759
-
760
- /**
761
- * Create SSO configuration domain by logged in user (tenantId, vendorId)
762
- * * ``authorized user``
763
- */
764
- export async function deleteSSODomain(ssoConfigId: string, domainId: string): Promise<void> {
765
- console.debug('deleteSSODomain()', { domainId, ssoConfigId });
766
- return Delete(`${urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}`);
767
- }
768
-
769
- /**
770
- * Validate SSO configuration domain by logged in user (tenantId, vendorId)
771
- * * ``authorized user``
772
- */
773
- export async function validateSSODomain(ssoConfigId: string, domainId: string): Promise<void> {
774
- console.debug('validateSSODomain()', { domainId, ssoConfigId });
775
- return Put(`${urls.team.sso.v1}/configurations/${ssoConfigId}/domains/${domainId}/validate`);
776
- }
777
-
778
- /**
779
- * Get SSO configuration default roles by logged in user (tenantId, vendorId)
780
- * * ``authorized user``
781
- */
782
- export async function getSSODefaultRoles(ssoConfigId: string): Promise<ISSOConfigurationDefaultRoles> {
783
- console.debug('getSSODefaultRoles()', { ssoConfigId });
784
- return Get(`${urls.team.sso.v1}/configurations/${ssoConfigId}/roles`);
785
- }
786
-
787
- /**
788
- * Create SSO configuration default roles by logged in user (tenantId, vendorId)
789
- * * ``authorized user``
790
- */
791
- export async function setSSODefaultRoles(ssoConfigId: string, body: IUpdateSamlRoles): Promise<void> {
792
- console.debug('setSSODefaultRoles()', { body, ssoConfigId });
793
- return Put(`${urls.team.sso.v1}/configurations/${ssoConfigId}/roles`, body);
794
- }
795
-
796
- /**
797
- * Create SSO configuration group roles for authorization
798
- */
799
- export async function createSSOGroup(ssoConfigId: string, body: ICreateSamlGroup): Promise<void> {
800
- console.debug('createSSOGroup()', { body, ssoConfigId });
801
- return Post(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups`, body);
802
- }
803
-
804
- /**
805
- * Update SSO configuration group roles for authorization
806
- */
807
- export async function updateSSOGroup(ssoConfigId: string, { roleIds, group, id }: IUpdateSamlGroup): Promise<void> {
808
- console.debug('updateSSOGroup()', { ssoConfigId, roleIds, group });
809
- return Patch(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${id}`, { group, roleIds });
810
- }
811
-
812
- /**
813
- * Delete SSO configuration group
814
- */
815
- export async function deleteSSOGroup(ssoConfigId: string, groupId: string): Promise<void> {
816
- console.debug('deleteSSOGroup()', { ssoConfigId, groupId });
817
- return Delete(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups/${groupId}`);
818
- }
819
-
820
- /**
821
- * Get SSO configuration groups
822
- */
823
- export async function getSSOGroups(ssoConfigId: string): Promise<ISamlRolesGroup[]> {
824
- console.debug('getSSOGroups()', { ssoConfigId });
825
- return Get(`${urls.team.sso.v1}/configurations/${ssoConfigId}/groups`);
826
- }
827
-
828
- /**
829
- * Check if requested email address has sso configuration
830
- * If true, this function will return the sso address to navigate to
831
- * else, return null
832
- */
833
- export async function preLoginV2(body: IPreLogin): Promise<IPreLoginWithIdpTypeResponse | null> {
834
- console.debug('preLoginV2()', body);
835
- return Post(`${urls.identity.auth.v2}/user/sso/prelogin`, body);
836
- }
837
-
838
- /**
839
- * After calling preLogin and navigated to SSO url, the IDP will redirect you to the redirect url
840
- * with code and state
841
- */
842
- export async function oidcPostLoginV2(body: IOidcPostLoginV2): Promise<ILoginResponse> {
843
- console.debug('oidcPostLoginV2()');
844
- const data = await Post(`${urls.identity.auth.v2}/user/oidc/postlogin`, body);
845
- return generateLoginResponse(data);
846
- }
847
-
848
- export async function exchangeOAuthTokens(body: IExchangeOAuthTokens): Promise<ILoginResponse> {
849
- console.debug('exchangeOauthTokens()');
850
- const data = await Post(`${urls.oauth.v1}/token`, body);
851
- return generateLoginResponseFromOAuthResponse(data);
852
- }
853
-
854
-
855
- /**
856
- * reset phone should be called in case user want to reset his phone number
857
- * when using sms authentication strategy. a 6-digits code will be send to the user email.
858
- */
859
- export async function resetPhoneNumber(body: IResetPhoneNumber): Promise<IResetPhoneNumberResponse> {
860
- console.debug('resetPhoneNumber()', body);
861
- return Post(`${urls.identity.users.v1}/phone/reset`, body);
862
- }
863
-
864
- /**
865
- * verify reset phone should be called after reset phone number request
866
- * with the token received from the reset phone number request and a code that was sent to the user email
867
- */
868
- export async function verifyResetPhoneNumber(body: IVerifyResetPhoneNumber): Promise<IVerifyResetPhoneNumberResponse> {
869
- console.debug('verifyResetPhoneNumber()', body);
870
- return Post(`${urls.identity.users.v1}/phone/reset/verify`, body);
871
- }
872
-
873
- /**
874
- * change phone number with verification.
875
- */
876
- export async function changePhoneNumberWithVerification(body: IChangePhoneNumberWithVerification): Promise<IChangePhoneNumberWithVerificationResponse> {
877
- console.debug('changePhoneNumberWithVerification()', body);
878
- return Post(`${urls.identity.users.v1}/phone`, body);
879
- }
880
-
881
- /**
882
- * verify new phone number.
883
- */
884
- export async function verifyChangePhoneNumber(body: IVerifyChangePhoneNumber): Promise<void> {
885
- console.debug('verifyChangePhoneNumber()', body);
886
- return Post(`${urls.identity.users.v1}/phone/verify`, body);
887
- }
888
-
889
- /**
890
- * change phone number should be called after verify reset phone number with the new phone number
891
- */
892
- export async function changePhoneNumber(body: IChangePhoneNumber): Promise<void> {
893
- console.debug('changePhoneNumber()', body);
894
- return Put(`${urls.identity.users.v1}/phone/change`, body);
895
- }
896
-
897
- /**
898
- * webauthn prelogin should be called when the user wants to be authenticated using his device/android/usb key
899
- */
900
- export async function webAuthnPreLogin(body: IWebAuthnPreLogin): Promise<IWebAuthnPreLoginResponse> {
901
- console.debug('webAuthnPreLogin()', body);
902
- return Post(`${urls.identity.auth.v1}/webauthn/prelogin`, body);
903
- }
904
-
905
- /**
906
- * webauthn postlogin should be called after the user used his authenticator (device/android/usb key) in order to login
907
- */
908
- export async function webAuthnPostLogin(body: IWebAuthnPostLogin): Promise<ILoginResponse> {
909
- console.debug('webAuthnPostLogin()', body);
910
- return Post(`${urls.identity.auth.v1}/webauthn/postlogin`, body);
911
- }
912
-
913
- /**
914
- * webauthn create new device should be called once the user wants to add new device as authenticator
915
- */
916
- export async function webAuthnCreateNewDeviceSession(): Promise<ICreateNewDeviceSessionResponse> {
917
- console.debug('webAuthnCreateNewDeviceSession()');
918
- return Post(urls.identity.webAuthnDevices.v1);
919
- }
920
-
921
- /**
922
- * webauthn verify new device should be called after the user used his authenticator in order to register the new device
923
- */
924
- export async function verifyNewDeviceSession(body: IVerifyNewWebAuthnDevice): Promise<void> {
925
- console.debug('verifyNewDeviceSession()', body);
926
- return Post(`${urls.identity.webAuthnDevices.v1}/verify`, body);
927
- }
928
-
929
- /**
930
- * Get public vendor auth strategies public configuration
931
- */
932
- export async function getVendorPublicAuthStrategiesConfig(): Promise<IAuthStrategiesConfig> {
933
- console.debug('getVendorPublicAuthStrategiesConfig()');
934
- return Get(`${urls.identity.configurations.v1}/auth/strategies/public`);
935
- };