@dbmx/confy 0.0.73 → 0.0.76

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 (413) hide show
  1. package/esm/components/SelectMemberMenu/index.js +1 -1
  2. package/esm/ducks/utils.js +1 -1
  3. package/esm/forms/utils.js +2 -2
  4. package/esm/hooks/roles.js +1 -1
  5. package/esm/lib/api/apiKeys.js +51 -0
  6. package/esm/lib/api/apiKeys.js.map +1 -0
  7. package/esm/lib/api/dataBuckets.js +18 -0
  8. package/esm/lib/api/dataBuckets.js.map +1 -0
  9. package/esm/lib/api/jobs.js +56 -0
  10. package/esm/lib/api/jobs.js.map +1 -0
  11. package/esm/lib/api/members.js +33 -0
  12. package/esm/lib/api/members.js.map +1 -0
  13. package/esm/lib/api/people.js +50 -0
  14. package/esm/lib/api/people.js.map +1 -0
  15. package/esm/lib/api/roles.js +17 -0
  16. package/esm/lib/api/roles.js.map +1 -0
  17. package/esm/lib/api/routes.js +43 -0
  18. package/esm/lib/api/routes.js.map +1 -0
  19. package/esm/lib/api/servicesMap.js +17 -0
  20. package/esm/lib/api/servicesMap.js.map +1 -0
  21. package/esm/lib/api/spaces.js +32 -0
  22. package/esm/lib/api/spaces.js.map +1 -0
  23. package/esm/lib/api/storage.js +94 -0
  24. package/esm/lib/api/storage.js.map +1 -0
  25. package/esm/node_modules/@dbmx/auth/dist/index.js +638 -0
  26. package/esm/node_modules/@dbmx/auth/dist/index.js.map +1 -0
  27. package/esm/node_modules/@dbmx/auth/dist/oidc-client.js +107 -0
  28. package/esm/node_modules/@dbmx/auth/dist/oidc-client.js.map +1 -0
  29. package/esm/node_modules/@dbmx/semver/dist/index.esm.js +958 -0
  30. package/esm/node_modules/@dbmx/semver/dist/index.esm.js.map +1 -0
  31. package/esm/node_modules/@dbmx/semver/node_modules/lru-cache/index.js +340 -0
  32. package/esm/node_modules/@dbmx/semver/node_modules/lru-cache/index.js.map +1 -0
  33. package/esm/node_modules/@dbmx/semver/node_modules/yallist/iterator.js +18 -0
  34. package/esm/node_modules/@dbmx/semver/node_modules/yallist/iterator.js.map +1 -0
  35. package/esm/node_modules/@dbmx/semver/node_modules/yallist/yallist.js +430 -0
  36. package/esm/node_modules/@dbmx/semver/node_modules/yallist/yallist.js.map +1 -0
  37. package/esm/node_modules/@dbmx/users/esm/index.js +251 -0
  38. package/esm/node_modules/@dbmx/users/esm/index.js.map +1 -0
  39. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/ap.js +44 -0
  40. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/ap.js.map +1 -0
  41. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/bind.js +36 -0
  42. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/bind.js.map +1 -0
  43. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curry.js +53 -0
  44. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curry.js.map +1 -0
  45. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curryN.js +60 -0
  46. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/curryN.js.map +1 -0
  47. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/difference.js +50 -0
  48. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/difference.js.map +1 -0
  49. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/either.js +46 -0
  50. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/either.js.map +1 -0
  51. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/equals.js +37 -0
  52. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/equals.js.map +1 -0
  53. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/flip.js +37 -0
  54. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/flip.js.map +1 -0
  55. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/identity.js +29 -0
  56. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/identity.js.map +1 -0
  57. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/includes.js +32 -0
  58. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/includes.js.map +1 -0
  59. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_Set.js +201 -0
  60. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_Set.js.map +1 -0
  61. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arity.js +65 -0
  62. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arity.js.map +1 -0
  63. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arrayFromIterator.js +13 -0
  64. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_arrayFromIterator.js.map +1 -0
  65. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_concat.js +37 -0
  66. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_concat.js.map +1 -0
  67. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry1.js +23 -0
  68. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry1.js.map +1 -0
  69. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry2.js +35 -0
  70. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry2.js.map +1 -0
  71. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry3.js +53 -0
  72. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curry3.js.map +1 -0
  73. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curryN.js +46 -0
  74. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_curryN.js.map +1 -0
  75. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_dispatchable.js +50 -0
  76. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_dispatchable.js.map +1 -0
  77. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_equals.js +170 -0
  78. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_equals.js.map +1 -0
  79. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_filter.js +18 -0
  80. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_filter.js.map +1 -0
  81. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_functionName.js +8 -0
  82. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_functionName.js.map +1 -0
  83. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_has.js +6 -0
  84. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_has.js.map +1 -0
  85. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_identity.js +6 -0
  86. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_identity.js.map +1 -0
  87. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includes.js +8 -0
  88. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includes.js.map +1 -0
  89. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includesWith.js +17 -0
  90. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_includesWith.js.map +1 -0
  91. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_indexOf.js +71 -0
  92. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_indexOf.js.map +1 -0
  93. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArguments.js +16 -0
  94. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArguments.js.map +1 -0
  95. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArray.js +18 -0
  96. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArray.js.map +1 -0
  97. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArrayLike.js +58 -0
  98. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isArrayLike.js.map +1 -0
  99. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isFunction.js +7 -0
  100. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isFunction.js.map +1 -0
  101. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isInteger.js +14 -0
  102. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isInteger.js.map +1 -0
  103. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isPlaceholder.js +6 -0
  104. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isPlaceholder.js.map +1 -0
  105. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isString.js +6 -0
  106. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isString.js.map +1 -0
  107. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isTransformer.js +6 -0
  108. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_isTransformer.js.map +1 -0
  109. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_map.js +15 -0
  110. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_map.js.map +1 -0
  111. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_objectIs.js +17 -0
  112. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_objectIs.js.map +1 -0
  113. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_reduce.js +74 -0
  114. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_reduce.js.map +1 -0
  115. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xfBase.js +11 -0
  116. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xfBase.js.map +1 -0
  117. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xmap.js +29 -0
  118. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xmap.js.map +1 -0
  119. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xwrap.js +28 -0
  120. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/internal/_xwrap.js.map +1 -0
  121. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/intersection.js +42 -0
  122. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/intersection.js.map +1 -0
  123. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/is.js +34 -0
  124. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/is.js.map +1 -0
  125. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/keys.js +92 -0
  126. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/keys.js.map +1 -0
  127. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/lift.js +34 -0
  128. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/lift.js.map +1 -0
  129. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/liftN.js +35 -0
  130. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/liftN.js.map +1 -0
  131. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/map.js +68 -0
  132. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/map.js.map +1 -0
  133. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/nth.js +39 -0
  134. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/nth.js.map +1 -0
  135. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/or.js +31 -0
  136. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/or.js.map +1 -0
  137. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/path.js +32 -0
  138. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/path.js.map +1 -0
  139. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/paths.js +47 -0
  140. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/paths.js.map +1 -0
  141. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/prop.js +33 -0
  142. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/prop.js.map +1 -0
  143. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/propEq.js +37 -0
  144. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/propEq.js.map +1 -0
  145. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/type.js +36 -0
  146. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/type.js.map +1 -0
  147. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniq.js +27 -0
  148. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniq.js.map +1 -0
  149. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniqBy.js +46 -0
  150. package/esm/node_modules/@dbmx/users/esm/node_modules/ramda/es/uniqBy.js.map +1 -0
  151. package/esm/node_modules/@dbmx/users/esm/roles.js +127 -0
  152. package/esm/node_modules/@dbmx/users/esm/roles.js.map +1 -0
  153. package/esm/node_modules/jsrsasign/lib/jsrsasign.js +248 -0
  154. package/esm/node_modules/jsrsasign/lib/jsrsasign.js.map +1 -0
  155. package/esm/node_modules/jwt-decode/build/esm/index.js +60 -0
  156. package/esm/node_modules/jwt-decode/build/esm/index.js.map +1 -0
  157. package/esm/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js +3591 -0
  158. package/esm/node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js.map +1 -0
  159. package/esm/node_modules/ramda/es/internal/_objectAssign.js +32 -0
  160. package/esm/node_modules/ramda/es/internal/_objectAssign.js.map +1 -0
  161. package/esm/node_modules/ramda/es/merge.js +36 -0
  162. package/esm/node_modules/ramda/es/merge.js.map +1 -0
  163. package/esm/utils/authorizations.js +1 -1
  164. package/esm/utils/confy.js +1 -1
  165. package/package.json +5 -8
  166. package/esm/_virtual/browser.js +0 -4
  167. package/esm/_virtual/browser.js.map +0 -1
  168. package/esm/_virtual/index15.js +0 -4
  169. package/esm/_virtual/index15.js.map +0 -1
  170. package/esm/_virtual/index16.js +0 -4
  171. package/esm/_virtual/index16.js.map +0 -1
  172. package/esm/_virtual/index17.js +0 -4
  173. package/esm/_virtual/index17.js.map +0 -1
  174. package/esm/_virtual/index18.js +0 -4
  175. package/esm/_virtual/index18.js.map +0 -1
  176. package/esm/_virtual/node.js +0 -4
  177. package/esm/_virtual/node.js.map +0 -1
  178. package/esm/_virtual/serialOrdered.js +0 -4
  179. package/esm/_virtual/serialOrdered.js.map +0 -1
  180. package/esm/node_modules/asynckit/index.js +0 -13
  181. package/esm/node_modules/asynckit/index.js.map +0 -1
  182. package/esm/node_modules/asynckit/lib/abort.js +0 -32
  183. package/esm/node_modules/asynckit/lib/abort.js.map +0 -1
  184. package/esm/node_modules/asynckit/lib/async.js +0 -39
  185. package/esm/node_modules/asynckit/lib/async.js.map +0 -1
  186. package/esm/node_modules/asynckit/lib/defer.js +0 -29
  187. package/esm/node_modules/asynckit/lib/defer.js.map +0 -1
  188. package/esm/node_modules/asynckit/lib/iterate.js +0 -81
  189. package/esm/node_modules/asynckit/lib/iterate.js.map +0 -1
  190. package/esm/node_modules/asynckit/lib/state.js +0 -40
  191. package/esm/node_modules/asynckit/lib/state.js.map +0 -1
  192. package/esm/node_modules/asynckit/lib/terminator.js +0 -35
  193. package/esm/node_modules/asynckit/lib/terminator.js.map +0 -1
  194. package/esm/node_modules/asynckit/parallel.js +0 -50
  195. package/esm/node_modules/asynckit/parallel.js.map +0 -1
  196. package/esm/node_modules/asynckit/serial.js +0 -22
  197. package/esm/node_modules/asynckit/serial.js.map +0 -1
  198. package/esm/node_modules/asynckit/serialOrdered.js +0 -85
  199. package/esm/node_modules/asynckit/serialOrdered.js.map +0 -1
  200. package/esm/node_modules/axios/index.js +0 -26
  201. package/esm/node_modules/axios/index.js.map +0 -1
  202. package/esm/node_modules/axios/lib/adapters/adapters.js +0 -133
  203. package/esm/node_modules/axios/lib/adapters/adapters.js.map +0 -1
  204. package/esm/node_modules/axios/lib/adapters/fetch.js +0 -331
  205. package/esm/node_modules/axios/lib/adapters/fetch.js.map +0 -1
  206. package/esm/node_modules/axios/lib/adapters/http.js +0 -945
  207. package/esm/node_modules/axios/lib/adapters/http.js.map +0 -1
  208. package/esm/node_modules/axios/lib/adapters/xhr.js +0 -225
  209. package/esm/node_modules/axios/lib/adapters/xhr.js.map +0 -1
  210. package/esm/node_modules/axios/lib/axios.js +0 -87
  211. package/esm/node_modules/axios/lib/axios.js.map +0 -1
  212. package/esm/node_modules/axios/lib/cancel/CancelToken.js +0 -134
  213. package/esm/node_modules/axios/lib/cancel/CancelToken.js.map +0 -1
  214. package/esm/node_modules/axios/lib/cancel/CanceledError.js +0 -21
  215. package/esm/node_modules/axios/lib/cancel/CanceledError.js.map +0 -1
  216. package/esm/node_modules/axios/lib/cancel/isCancel.js +0 -6
  217. package/esm/node_modules/axios/lib/cancel/isCancel.js.map +0 -1
  218. package/esm/node_modules/axios/lib/core/Axios.js +0 -260
  219. package/esm/node_modules/axios/lib/core/Axios.js.map +0 -1
  220. package/esm/node_modules/axios/lib/core/AxiosError.js +0 -89
  221. package/esm/node_modules/axios/lib/core/AxiosError.js.map +0 -1
  222. package/esm/node_modules/axios/lib/core/AxiosHeaders.js +0 -343
  223. package/esm/node_modules/axios/lib/core/AxiosHeaders.js.map +0 -1
  224. package/esm/node_modules/axios/lib/core/InterceptorManager.js +0 -71
  225. package/esm/node_modules/axios/lib/core/InterceptorManager.js.map +0 -1
  226. package/esm/node_modules/axios/lib/core/buildFullPath.js +0 -23
  227. package/esm/node_modules/axios/lib/core/buildFullPath.js.map +0 -1
  228. package/esm/node_modules/axios/lib/core/dispatchRequest.js +0 -78
  229. package/esm/node_modules/axios/lib/core/dispatchRequest.js.map +0 -1
  230. package/esm/node_modules/axios/lib/core/mergeConfig.js +0 -108
  231. package/esm/node_modules/axios/lib/core/mergeConfig.js.map +0 -1
  232. package/esm/node_modules/axios/lib/core/settle.js +0 -32
  233. package/esm/node_modules/axios/lib/core/settle.js.map +0 -1
  234. package/esm/node_modules/axios/lib/core/transformData.js +0 -29
  235. package/esm/node_modules/axios/lib/core/transformData.js.map +0 -1
  236. package/esm/node_modules/axios/lib/defaults/index.js +0 -171
  237. package/esm/node_modules/axios/lib/defaults/index.js.map +0 -1
  238. package/esm/node_modules/axios/lib/defaults/transitional.js +0 -9
  239. package/esm/node_modules/axios/lib/defaults/transitional.js.map +0 -1
  240. package/esm/node_modules/axios/lib/env/data.js +0 -4
  241. package/esm/node_modules/axios/lib/env/data.js.map +0 -1
  242. package/esm/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -155
  243. package/esm/node_modules/axios/lib/helpers/AxiosTransformStream.js.map +0 -1
  244. package/esm/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -61
  245. package/esm/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +0 -1
  246. package/esm/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -78
  247. package/esm/node_modules/axios/lib/helpers/HttpStatusCode.js.map +0 -1
  248. package/esm/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -28
  249. package/esm/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js.map +0 -1
  250. package/esm/node_modules/axios/lib/helpers/bind.js +0 -15
  251. package/esm/node_modules/axios/lib/helpers/bind.js.map +0 -1
  252. package/esm/node_modules/axios/lib/helpers/buildURL.js +0 -67
  253. package/esm/node_modules/axios/lib/helpers/buildURL.js.map +0 -1
  254. package/esm/node_modules/axios/lib/helpers/callbackify.js +0 -19
  255. package/esm/node_modules/axios/lib/helpers/callbackify.js.map +0 -1
  256. package/esm/node_modules/axios/lib/helpers/combineURLs.js +0 -16
  257. package/esm/node_modules/axios/lib/helpers/combineURLs.js.map +0 -1
  258. package/esm/node_modules/axios/lib/helpers/composeSignals.js +0 -57
  259. package/esm/node_modules/axios/lib/helpers/composeSignals.js.map +0 -1
  260. package/esm/node_modules/axios/lib/helpers/cookies.js +0 -51
  261. package/esm/node_modules/axios/lib/helpers/cookies.js.map +0 -1
  262. package/esm/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -76
  263. package/esm/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js.map +0 -1
  264. package/esm/node_modules/axios/lib/helpers/formDataToJSON.js +0 -94
  265. package/esm/node_modules/axios/lib/helpers/formDataToJSON.js.map +0 -1
  266. package/esm/node_modules/axios/lib/helpers/formDataToStream.js +0 -119
  267. package/esm/node_modules/axios/lib/helpers/formDataToStream.js.map +0 -1
  268. package/esm/node_modules/axios/lib/helpers/fromDataURI.js +0 -54
  269. package/esm/node_modules/axios/lib/helpers/fromDataURI.js.map +0 -1
  270. package/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -20
  271. package/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +0 -1
  272. package/esm/node_modules/axios/lib/helpers/isAxiosError.js +0 -15
  273. package/esm/node_modules/axios/lib/helpers/isAxiosError.js.map +0 -1
  274. package/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -19
  275. package/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +0 -1
  276. package/esm/node_modules/axios/lib/helpers/parseHeaders.js +0 -70
  277. package/esm/node_modules/axios/lib/helpers/parseHeaders.js.map +0 -1
  278. package/esm/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
  279. package/esm/node_modules/axios/lib/helpers/parseProtocol.js.map +0 -1
  280. package/esm/node_modules/axios/lib/helpers/progressEventReducer.js +0 -54
  281. package/esm/node_modules/axios/lib/helpers/progressEventReducer.js.map +0 -1
  282. package/esm/node_modules/axios/lib/helpers/readBlob.js +0 -16
  283. package/esm/node_modules/axios/lib/helpers/readBlob.js.map +0 -1
  284. package/esm/node_modules/axios/lib/helpers/resolveConfig.js +0 -73
  285. package/esm/node_modules/axios/lib/helpers/resolveConfig.js.map +0 -1
  286. package/esm/node_modules/axios/lib/helpers/speedometer.js +0 -54
  287. package/esm/node_modules/axios/lib/helpers/speedometer.js.map +0 -1
  288. package/esm/node_modules/axios/lib/helpers/spread.js +0 -29
  289. package/esm/node_modules/axios/lib/helpers/spread.js.map +0 -1
  290. package/esm/node_modules/axios/lib/helpers/throttle.js +0 -45
  291. package/esm/node_modules/axios/lib/helpers/throttle.js.map +0 -1
  292. package/esm/node_modules/axios/lib/helpers/toFormData.js +0 -239
  293. package/esm/node_modules/axios/lib/helpers/toFormData.js.map +0 -1
  294. package/esm/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -20
  295. package/esm/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +0 -1
  296. package/esm/node_modules/axios/lib/helpers/trackStream.js +0 -92
  297. package/esm/node_modules/axios/lib/helpers/trackStream.js.map +0 -1
  298. package/esm/node_modules/axios/lib/helpers/validator.js +0 -111
  299. package/esm/node_modules/axios/lib/helpers/validator.js.map +0 -1
  300. package/esm/node_modules/axios/lib/platform/common/utils.js +0 -47
  301. package/esm/node_modules/axios/lib/platform/common/utils.js.map +0 -1
  302. package/esm/node_modules/axios/lib/platform/index.js +0 -10
  303. package/esm/node_modules/axios/lib/platform/index.js.map +0 -1
  304. package/esm/node_modules/axios/lib/platform/node/classes/FormData.js +0 -6
  305. package/esm/node_modules/axios/lib/platform/node/classes/FormData.js.map +0 -1
  306. package/esm/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -6
  307. package/esm/node_modules/axios/lib/platform/node/classes/URLSearchParams.js.map +0 -1
  308. package/esm/node_modules/axios/lib/platform/node/index.js +0 -40
  309. package/esm/node_modules/axios/lib/platform/node/index.js.map +0 -1
  310. package/esm/node_modules/axios/lib/utils.js +0 -920
  311. package/esm/node_modules/axios/lib/utils.js.map +0 -1
  312. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js +0 -66
  313. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js.map +0 -1
  314. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js +0 -7
  315. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js.map +0 -1
  316. package/esm/node_modules/combined-stream/lib/combined_stream.js +0 -215
  317. package/esm/node_modules/combined-stream/lib/combined_stream.js.map +0 -1
  318. package/esm/node_modules/debug/src/browser.js +0 -287
  319. package/esm/node_modules/debug/src/browser.js.map +0 -1
  320. package/esm/node_modules/debug/src/common.js +0 -304
  321. package/esm/node_modules/debug/src/common.js.map +0 -1
  322. package/esm/node_modules/debug/src/index.js +0 -24
  323. package/esm/node_modules/debug/src/index.js.map +0 -1
  324. package/esm/node_modules/debug/src/node.js +0 -281
  325. package/esm/node_modules/debug/src/node.js.map +0 -1
  326. package/esm/node_modules/deep-equal/node_modules/has-symbols/index.js +0 -22
  327. package/esm/node_modules/deep-equal/node_modules/has-symbols/index.js.map +0 -1
  328. package/esm/node_modules/deep-equal/node_modules/has-symbols/shams.js +0 -58
  329. package/esm/node_modules/deep-equal/node_modules/has-symbols/shams.js.map +0 -1
  330. package/esm/node_modules/deep-equal/node_modules/has-tostringtag/shams.js +0 -9
  331. package/esm/node_modules/deep-equal/node_modules/has-tostringtag/shams.js.map +0 -1
  332. package/esm/node_modules/deep-equal/node_modules/is-regex/index.js +0 -53
  333. package/esm/node_modules/deep-equal/node_modules/is-regex/index.js.map +0 -1
  334. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/callBound.js +0 -16
  335. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/callBound.js.map +0 -1
  336. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/index.js +0 -53
  337. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/index.js.map +0 -1
  338. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/get-intrinsic/index.js +0 -307
  339. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/get-intrinsic/index.js.map +0 -1
  340. package/esm/node_modules/delayed-stream/lib/delayed_stream.js +0 -113
  341. package/esm/node_modules/delayed-stream/lib/delayed_stream.js.map +0 -1
  342. package/esm/node_modules/es-set-tostringtag/index.js +0 -41
  343. package/esm/node_modules/es-set-tostringtag/index.js.map +0 -1
  344. package/esm/node_modules/follow-redirects/debug.js +0 -20
  345. package/esm/node_modules/follow-redirects/debug.js.map +0 -1
  346. package/esm/node_modules/follow-redirects/index.js +0 -701
  347. package/esm/node_modules/follow-redirects/index.js.map +0 -1
  348. package/esm/node_modules/form-data/lib/form_data.js +0 -514
  349. package/esm/node_modules/form-data/lib/form_data.js.map +0 -1
  350. package/esm/node_modules/form-data/lib/populate.js +0 -11
  351. package/esm/node_modules/form-data/lib/populate.js.map +0 -1
  352. package/esm/node_modules/get-intrinsic/node_modules/function-bind/implementation.js +0 -75
  353. package/esm/node_modules/get-intrinsic/node_modules/function-bind/implementation.js.map +0 -1
  354. package/esm/node_modules/get-intrinsic/node_modules/function-bind/index.js +0 -16
  355. package/esm/node_modules/get-intrinsic/node_modules/function-bind/index.js.map +0 -1
  356. package/esm/node_modules/has/src/index.js +0 -7
  357. package/esm/node_modules/has/src/index.js.map +0 -1
  358. package/esm/node_modules/has-flag/index.js +0 -18
  359. package/esm/node_modules/has-flag/index.js.map +0 -1
  360. package/esm/node_modules/hasown/node_modules/function-bind/implementation.js +0 -75
  361. package/esm/node_modules/hasown/node_modules/function-bind/implementation.js.map +0 -1
  362. package/esm/node_modules/hasown/node_modules/function-bind/index.js +0 -16
  363. package/esm/node_modules/hasown/node_modules/function-bind/index.js.map +0 -1
  364. package/esm/node_modules/is-boolean-object/node_modules/call-bind/callBound.js +0 -16
  365. package/esm/node_modules/is-boolean-object/node_modules/call-bind/callBound.js.map +0 -1
  366. package/esm/node_modules/is-boolean-object/node_modules/call-bind/index.js +0 -53
  367. package/esm/node_modules/is-boolean-object/node_modules/call-bind/index.js.map +0 -1
  368. package/esm/node_modules/is-boolean-object/node_modules/get-intrinsic/index.js +0 -307
  369. package/esm/node_modules/is-boolean-object/node_modules/get-intrinsic/index.js.map +0 -1
  370. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/index.js +0 -22
  371. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/index.js.map +0 -1
  372. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/shams.js +0 -67
  373. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/shams.js.map +0 -1
  374. package/esm/node_modules/is-boolean-object/node_modules/has-tostringtag/shams.js +0 -18
  375. package/esm/node_modules/is-boolean-object/node_modules/has-tostringtag/shams.js.map +0 -1
  376. package/esm/node_modules/is-number-object/node_modules/has-symbols/shams.js +0 -58
  377. package/esm/node_modules/is-number-object/node_modules/has-symbols/shams.js.map +0 -1
  378. package/esm/node_modules/is-number-object/node_modules/has-tostringtag/shams.js +0 -9
  379. package/esm/node_modules/is-number-object/node_modules/has-tostringtag/shams.js.map +0 -1
  380. package/esm/node_modules/is-string/node_modules/has-symbols/shams.js +0 -58
  381. package/esm/node_modules/is-string/node_modules/has-symbols/shams.js.map +0 -1
  382. package/esm/node_modules/is-string/node_modules/has-tostringtag/shams.js +0 -9
  383. package/esm/node_modules/is-string/node_modules/has-tostringtag/shams.js.map +0 -1
  384. package/esm/node_modules/is-symbol/node_modules/has-symbols/index.js +0 -22
  385. package/esm/node_modules/is-symbol/node_modules/has-symbols/index.js.map +0 -1
  386. package/esm/node_modules/is-symbol/node_modules/has-symbols/shams.js +0 -58
  387. package/esm/node_modules/is-symbol/node_modules/has-symbols/shams.js.map +0 -1
  388. package/esm/node_modules/mime-db/db.json.js +0 -10705
  389. package/esm/node_modules/mime-db/db.json.js.map +0 -1
  390. package/esm/node_modules/mime-db/index.js +0 -17
  391. package/esm/node_modules/mime-db/index.js.map +0 -1
  392. package/esm/node_modules/mime-types/index.js +0 -194
  393. package/esm/node_modules/mime-types/index.js.map +0 -1
  394. package/esm/node_modules/ms/index.js +0 -173
  395. package/esm/node_modules/ms/index.js.map +0 -1
  396. package/esm/node_modules/proxy-from-env/index.js +0 -112
  397. package/esm/node_modules/proxy-from-env/index.js.map +0 -1
  398. package/esm/node_modules/side-channel/node_modules/call-bind/callBound.js +0 -16
  399. package/esm/node_modules/side-channel/node_modules/call-bind/callBound.js.map +0 -1
  400. package/esm/node_modules/side-channel/node_modules/call-bind/index.js +0 -53
  401. package/esm/node_modules/side-channel/node_modules/call-bind/index.js.map +0 -1
  402. package/esm/node_modules/side-channel/node_modules/get-intrinsic/index.js +0 -307
  403. package/esm/node_modules/side-channel/node_modules/get-intrinsic/index.js.map +0 -1
  404. package/esm/node_modules/side-channel/node_modules/has-symbols/index.js +0 -22
  405. package/esm/node_modules/side-channel/node_modules/has-symbols/index.js.map +0 -1
  406. package/esm/node_modules/side-channel/node_modules/has-symbols/shams.js +0 -58
  407. package/esm/node_modules/side-channel/node_modules/has-symbols/shams.js.map +0 -1
  408. package/esm/node_modules/side-channel/node_modules/object-inspect/index.js +0 -469
  409. package/esm/node_modules/side-channel/node_modules/object-inspect/index.js.map +0 -1
  410. package/esm/node_modules/side-channel/node_modules/object-inspect/util.inspect.js +0 -6
  411. package/esm/node_modules/side-channel/node_modules/object-inspect/util.inspect.js.map +0 -1
  412. package/esm/node_modules/supports-color/index.js +0 -149
  413. package/esm/node_modules/supports-color/index.js.map +0 -1
@@ -0,0 +1,638 @@
1
+ import urljoin from '../../../url-join/lib/url-join.js';
2
+ import axios from 'axios';
3
+ import { nanoid } from 'nanoid';
4
+ import { jws, hextob64u as hextob64u_1, crypto as crypto_1 } from '../../../jsrsasign/lib/jsrsasign.js';
5
+ import { AuthRedirect as AuthRedirect$1 } from './oidc-client.js';
6
+ import '../../../oidc-client-ts/dist/esm/oidc-client-ts.js';
7
+ import merge from '../../../ramda/es/merge.js';
8
+ import prop from '../../../ramda/es/prop.js';
9
+
10
+ let self;
11
+
12
+ const DEFAULT_CONFIG = {
13
+ response_type: 'code',
14
+ scope: 'openid offline_access',
15
+ automaticSilentRenew: true,
16
+ };
17
+
18
+ const SESSION_ENDING_TIMEOUT = 30;
19
+ const OTP_ACCESS_TOKEN_NAME = 'OTP_ACCESS_TOKEN';
20
+
21
+ class EventEmitter {
22
+ constructor() {
23
+ this.listeners = {};
24
+ }
25
+
26
+ on(type, cb) {
27
+ if (!(type in this.listeners)) {
28
+ this.listeners[type] = [];
29
+ }
30
+ this.listeners[type].push(cb);
31
+ }
32
+
33
+ emit(event) {
34
+ if (!(event.type in this.listeners)) return
35
+ const stack = this.listeners[event.type].slice();
36
+ for (let i = 0, l = stack.length; i < l; i++) {
37
+ stack[i].call(this, event);
38
+ }
39
+ }
40
+ }
41
+
42
+ class Auth extends EventEmitter {
43
+ constructor(options, tokens) {
44
+ super();
45
+ this.options = options;
46
+ this.tokens = tokens;
47
+ }
48
+
49
+ registerLogout(delay) {
50
+ if (!this.tokens) return
51
+ this.logoutTimer = setTimeout(() => this.signOut(), delay || this.tokens.expires_in * 1000);
52
+ }
53
+
54
+ registerEndSession() {
55
+ if (!this.tokens) return
56
+ if (this.refreshSessionTimer) clearTimeout(this.refreshSessionTimer);
57
+ this.refreshSessionTimer = setTimeout(() => {
58
+ this.checkSession()
59
+ .then(() => this.emit({ type: 'sessionEnding', timeout: SESSION_ENDING_TIMEOUT }))
60
+ .catch(() => this.signOut());
61
+ }, this.getSessionExpirationDelay(this.tokens));
62
+ }
63
+
64
+ async refreshTokens() {
65
+ if (!this.tokens) return
66
+ try {
67
+ const url = '/api/authOTP/refreshTokens';
68
+ const res = await fetch(url, {
69
+ method: 'POST',
70
+ headers: {
71
+ 'Content-Type': 'application/json',
72
+ Authorization: `Bearer ${this.tokens.access_token}`,
73
+ },
74
+ body: JSON.stringify({
75
+ refreshToken: this.tokens.refresh_token,
76
+ }),
77
+ });
78
+ if (!res.ok) {
79
+ const errorData = await res.json();
80
+ throw { response: { data: errorData }, status: res.status }
81
+ }
82
+ const { accessToken, refreshToken, idToken } = await res.json();
83
+ const id_token = jws.JWS.parse(idToken);
84
+ this.tokens = {
85
+ access_token: accessToken,
86
+ refresh_token: refreshToken,
87
+ expires_in: id_token.payloadObj.exp,
88
+ };
89
+
90
+ this.emit({
91
+ ...this.tokens,
92
+ type: 'tokensRefreshed',
93
+ payload: id_token.payloadObj,
94
+ });
95
+
96
+ this.setAccessTokenCookie(accessToken, this.tokens);
97
+ this.registerEndSession();
98
+
99
+ return { ...this.tokens, payload: id_token.payloadObj }
100
+ } catch (err) {
101
+ this.signOut();
102
+ if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
103
+ throw err
104
+ }
105
+ }
106
+
107
+ getSessionExpirationDelay(token) {
108
+ if (!token?.expires_in) return 3570000
109
+ return Math.max(0, token.expires_in * 1000 - Date.now() - SESSION_ENDING_TIMEOUT * 1000)
110
+ }
111
+
112
+ autoRefreshTokens() {
113
+ if (!this.tokens) return
114
+ if (this.autoRefreshTimer) clearTimeout(this.autoRefreshTimer); // autoRefreshTimer can be called by a client
115
+ this.autoRefreshTimer = setTimeout(() => this.refreshTokens(), this.getSessionExpirationDelay(this.tokens));
116
+ }
117
+
118
+ async signOut() {
119
+ await this.endSession();
120
+ // await this.revokeRefreshToken()
121
+ this.tokens = null;
122
+ this.logoutTimer = clearTimeout(this.logoutTimer);
123
+ this.autoRefreshTimer = clearTimeout(this.autoRefreshTimer);
124
+ this.refreshSessionTimer = clearTimeout(this.refreshSessionTimer);
125
+ }
126
+ }
127
+
128
+ class Oidc extends EventEmitter {
129
+ constructor(options, tokens) {
130
+ super();
131
+ if (!this.isValidConfig(options)) throw new Error(`Invalid setup`)
132
+ this.options = options;
133
+ this.tokens = tokens;
134
+ }
135
+
136
+ get configurationUrl() {
137
+ return urljoin(this.options.authority, '/.well-known/openid-configuration')
138
+ }
139
+
140
+ decodeState(state) {
141
+ return state && JSON.parse(atob(state))
142
+ }
143
+
144
+ makeState() {
145
+ const state = {
146
+ srcUrl: window.location.href,
147
+ };
148
+ return btoa(JSON.stringify(state))
149
+ }
150
+
151
+ getSessionExpirationDelay(token) {
152
+ if (!token?.expires_in) return 3570000
153
+ return token.expires_in * 1000 - SESSION_ENDING_TIMEOUT * 1000
154
+ }
155
+
156
+ get authorizationUrl() {
157
+ this.code_verifier = `${nanoid()}-${nanoid()}`;
158
+ localStorage.setItem('code_verifier', this.code_verifier);
159
+ this.code_challenge = hextob64u_1(crypto_1.Util.hashString(this.code_verifier, 'SHA256'));
160
+ return urljoin(
161
+ this.authConfig.authorization_endpoint,
162
+ `?client_id=${this.options.client_id}`,
163
+ `?scope=${this.options.scope}`,
164
+ `?redirect_uri=${this.options.redirect_uri}`,
165
+ `?response_type=${this.options.response_type}`,
166
+ `?nonce=${nanoid()}`,
167
+ `?code_challenge=${this.code_challenge}`,
168
+ `?code_challenge_method=S256`,
169
+ `?state=${this.makeState()}`,
170
+ )
171
+ }
172
+
173
+ get endSessionUrl() {
174
+ return urljoin(
175
+ this.authConfig.end_session_endpoint,
176
+ `?client_id=${this.options.client_id}`,
177
+ `?id_token_hint=${this.tokens?.id_token}`,
178
+ )
179
+ }
180
+
181
+ get endSessionUrlWithRedirect() {
182
+ return urljoin(this.endSessionUrl, `&post_logout_redirect_uri=${this.options.redirect_uri}`)
183
+ }
184
+
185
+ async getOpenIdConfiguration() {
186
+ try {
187
+ const res = await axios.get(this.configurationUrl).then(prop('data'));
188
+ this.emit({ type: 'configurationLoaded', config: this.authConfig });
189
+ return res
190
+ } catch (err) {
191
+ throw new Error(`Cannot load openid configuration from ${this.configurationUrl}`)
192
+ }
193
+ }
194
+
195
+ async revoke(type) {
196
+ const url = this.authConfig.revocation_endpoint;
197
+ const config = {
198
+ headers: {
199
+ 'Content-Type': 'application/x-www-form-urlencoded',
200
+ },
201
+ };
202
+ const params = new URLSearchParams();
203
+ params.append('client_id', this.options.client_id);
204
+ params.append('token', this.tokens[type]);
205
+ params.append('token_type_hint', type);
206
+
207
+ try {
208
+ await axios.post(url, params, config).then(prop('data'));
209
+ } catch (err) {
210
+ if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
211
+ throw err
212
+ }
213
+ }
214
+
215
+ revokeAccessToken() {
216
+ return this.revoke('access_token')
217
+ }
218
+
219
+ revokeRefreshToken() {
220
+ return this.revoke('refresh_token')
221
+ }
222
+
223
+ registerLogout(delay) {
224
+ if (!this.tokens) return
225
+ this.logoutTimer = setTimeout(() => this.signOut(), delay || this.tokens.expires_in * 1000);
226
+ }
227
+
228
+ autoRefreshTokens() {
229
+ if (!this.tokens) return
230
+ if (this.autoRefreshTimer) clearTimeout(this.autoRefreshTimer); // autoRefreshTimer can be called by a client
231
+ this.autoRefreshTimer = setTimeout(() => this.refreshTokens(), this.getSessionExpirationDelay(this.tokens));
232
+ }
233
+
234
+ async checkSession() {
235
+ if (!this.tokens) return
236
+ const url = urljoin(this.authConfig.userinfo_endpoint, `?access_token=${this.tokens.access_token}`);
237
+ return axios.get(url)
238
+ }
239
+
240
+ manageSession(delay = 60 * 1000) {
241
+ if (!this.tokens) return
242
+ setTimeout(() => {
243
+ this.checkSession()
244
+ .then(() => this.manageSession(delay))
245
+ .catch(() => this.signOut());
246
+ }, delay);
247
+ }
248
+
249
+ registerEndSession() {
250
+ if (!this.tokens) return
251
+ if (this.refreshSessionTimer) clearTimeout(this.refreshSessionTimer);
252
+ this.refreshSessionTimer = setTimeout(() => {
253
+ this.checkSession()
254
+ .then(() => this.emit({ type: 'sessionEnding', timeout: SESSION_ENDING_TIMEOUT }))
255
+ .catch(() => this.signOut());
256
+ }, this.getSessionExpirationDelay(this.tokens));
257
+ }
258
+
259
+ isValidConfig(config) {
260
+ return config?.authority
261
+ }
262
+
263
+ async getAccessTokenFromCode(code) {
264
+ const params = new URLSearchParams();
265
+ params.append('code', code);
266
+ params.append('client_id', this.options.client_id);
267
+ params.append('grant_type', 'authorization_code');
268
+ params.append('redirect_uri', this.options.redirect_uri);
269
+ params.append('code_verifier', this.code_verifier);
270
+ const config = {
271
+ headers: {
272
+ 'Content-Type': 'application/x-www-form-urlencoded',
273
+ },
274
+ };
275
+ const url = this.authConfig.token_endpoint;
276
+ try {
277
+ this.tokens = await axios.post(url, params, config).then(prop('data'));
278
+ const id_token = jws.JWS.parse(this.tokens.id_token);
279
+ if (this.options.autoRefresh) this.autoRefreshTokens();
280
+ else this.registerEndSession();
281
+ this.emit({ ...this.tokens, type: 'signedIn', payload: id_token.payloadObj });
282
+ return { ...this.tokens, payload: id_token.payloadObj }
283
+ } catch (err) {
284
+ if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
285
+ throw err
286
+ }
287
+ }
288
+
289
+ async refreshTokens() {
290
+ if (!this.tokens) return
291
+ const params = new URLSearchParams();
292
+ params.append('client_id', this.options.client_id);
293
+ params.append('grant_type', 'refresh_token');
294
+ params.append('refresh_token', this.tokens.refresh_token);
295
+ const config = {
296
+ headers: {
297
+ 'Content-Type': 'application/x-www-form-urlencoded',
298
+ },
299
+ };
300
+ const url = this.authConfig.token_endpoint;
301
+ try {
302
+ this.tokens = await axios.post(url, params, config).then(prop('data'));
303
+ const id_token = jws.JWS.parse(this.tokens.id_token);
304
+ if (this.options.autoRefresh) this.autoRefreshTokens();
305
+ else this.registerEndSession();
306
+ this.emit({ ...this.tokens, type: 'tokensRefreshed', payload: id_token.payloadObj });
307
+ return { ...this.tokens, payload: id_token.payloadObj }
308
+ } catch (err) {
309
+ this.signOut();
310
+ if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
311
+ throw err
312
+ }
313
+ }
314
+
315
+ async signOut() {
316
+ await this.endSession();
317
+ // await this.revokeRefreshToken()
318
+ this.tokens = null;
319
+ this.logoutTimer = clearTimeout(this.logoutTimer);
320
+ this.autoRefreshTimer = clearTimeout(this.autoRefreshTimer);
321
+ this.refreshSessionTimer = clearTimeout(this.refreshSessionTimer);
322
+ }
323
+
324
+ async init(tokens) {
325
+ this.authConfig = await this.getOpenIdConfiguration();
326
+ if (tokens || tokens === null) this.tokens = tokens;
327
+ this.emit({ type: 'configurationLoaded', config: this.authConfig });
328
+ return this
329
+ }
330
+ }
331
+
332
+ class OidcIFrame extends Oidc {
333
+ async signIn(params) {
334
+ const options = merge(this.options, params);
335
+ try {
336
+ if (!this.authConfig) await this.init();
337
+ let iframe;
338
+ if (!options.frame) iframe = this.loginIframe;
339
+ else {
340
+ iframe = window.document.getElementById(options.frame);
341
+ this.loginIframe = iframe;
342
+ }
343
+ if (!iframe) throw new Error(`Cannot get login iframe ${options.frame}`)
344
+ iframe.src = this.authorizationUrl;
345
+ } catch (err) {
346
+ this.emit({ type: 'error', error_description: err.message || err.toString() });
347
+ }
348
+ }
349
+
350
+ async endSession() {
351
+ if (!this.tokens) return
352
+ let iframe = document.querySelector('iframe[id=logout-frame]');
353
+ if (!iframe) {
354
+ iframe = window.document.createElement('iframe');
355
+ iframe.id = 'logout-frame';
356
+ iframe.style = 'position: absolute; width: 1px; height: 1px; inset: -9999px; display: none;';
357
+ window.document.body.appendChild(iframe);
358
+ }
359
+ iframe.src = this.endSessionUrl;
360
+ }
361
+ }
362
+
363
+ class OidcLib extends Oidc {
364
+ async init() {
365
+ try {
366
+ this.code_verifier = localStorage.getItem('code_verifier');
367
+ if (!this.authConfig) this.authConfig = await this.getOpenIdConfiguration();
368
+ this.emit({ type: 'configurationLoaded', config: this.authConfig });
369
+ } catch (err) {
370
+ this.emit({ type: 'error', error_description: err.message || err.toString() });
371
+ }
372
+ }
373
+
374
+ async signIn() {
375
+ try {
376
+ if (!this.authConfig) await this.init();
377
+ window.location.replace(this.authorizationUrl);
378
+ } catch (err) {
379
+ this.emit({ type: 'error', error_description: err.message || err.toString() });
380
+ }
381
+ }
382
+
383
+ async endSession() {
384
+ try {
385
+ if (!this.tokens) return
386
+ this.emit({ type: 'signedOut' });
387
+ window.location.replace(this.endSessionUrlWithRedirect);
388
+ } catch (err) {
389
+ this.emit({ type: 'error', error_description: err.message || err.toString() });
390
+ }
391
+ }
392
+ }
393
+
394
+ class OTP extends Auth {
395
+ init(tokens) {
396
+ this.tokens = tokens;
397
+ return this
398
+ }
399
+
400
+ async endSession() {
401
+ if (!this.tokens) return
402
+
403
+ try {
404
+ const url = '/api/authOTP/logout';
405
+ const res = await fetch(url, {
406
+ method: 'POST',
407
+ headers: {
408
+ 'Content-Type': 'application/json',
409
+ },
410
+ body: JSON.stringify({
411
+ accessToken: this.tokens.access_token,
412
+ }),
413
+ });
414
+
415
+ if (!res.ok) {
416
+ const errorData = await res.json();
417
+ throw { response: { data: errorData }, status: res.status }
418
+ }
419
+
420
+ this.removeAccessTokenCookie();
421
+ this.emit({ type: 'signedOut' });
422
+ } catch (err) {
423
+ if (err.response?.data) return this.emit({ type: 'error', ...err.response.data })
424
+ throw err
425
+ }
426
+ }
427
+
428
+ async checkSession() {
429
+ if (!this.tokens) return
430
+
431
+ const url = '/api/authOTP/getMe';
432
+
433
+ const res = await fetch(url, {
434
+ method: 'POST',
435
+ headers: {
436
+ 'Content-Type': 'application/json',
437
+ },
438
+ body: JSON.stringify({
439
+ accessToken: this.tokens.access_token,
440
+ }),
441
+ });
442
+
443
+ if (!res.ok) {
444
+ throw new Error(`Request failed with status ${res.status}`)
445
+ }
446
+
447
+ return res.json()
448
+ }
449
+
450
+ getHostname() {
451
+ return location.hostname
452
+ }
453
+
454
+ getBaseDomain() {
455
+ const hostname = this.getHostname();
456
+ const parts = hostname.split('.');
457
+ if (parts.length >= 2) {
458
+ // take the last two parts for base domain (x.com)
459
+ const base = parts.slice(-2).join('.');
460
+ return `.${base}`
461
+ }
462
+ return hostname
463
+ }
464
+
465
+ getCookieDomain() {
466
+ const hostname = this.getHostname();
467
+ return hostname === 'localhost' || hostname === '0.0.0.0' || hostname === '127.0.0.1'
468
+ ? ''
469
+ : `domain=${this.getBaseDomain()};`
470
+ }
471
+
472
+ setAccessTokenCookie(value, token) {
473
+ const nowSeconds = Math.floor(Date.now() / 1000);
474
+ const maxAge = Math.max(0, token.expires_in - nowSeconds);
475
+ const domain = this.getCookieDomain();
476
+ const addationalParams = domain ? 'Secure; SameSite=None;' : '';
477
+ document.cookie = `${OTP_ACCESS_TOKEN_NAME}=${value}; max-age=${maxAge}; ${domain} path=/; ${addationalParams}`;
478
+ }
479
+
480
+ getAccessTokenCookie() {
481
+ const cookies = document.cookie.split(';');
482
+ for (let cookie of cookies) {
483
+ const [cookieName, cookieValue] = cookie.split('=');
484
+ if (cookieName.trim() === OTP_ACCESS_TOKEN_NAME) {
485
+ const value = cookieValue?.trim();
486
+ return value ? value : null
487
+ }
488
+ }
489
+ return null
490
+ }
491
+
492
+ removeAccessTokenCookie() {
493
+ const domain = this.getCookieDomain();
494
+ document.cookie = `${OTP_ACCESS_TOKEN_NAME}=; ${domain} path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;
495
+ }
496
+
497
+ async userTokens(tokens) {
498
+ const { accessToken, refreshToken, idToken } = tokens;
499
+
500
+ try {
501
+ const idTokenPayload = jws.JWS.parse(idToken);
502
+
503
+ this.tokens = {
504
+ access_token: accessToken,
505
+ refresh_token: refreshToken,
506
+ expires_in: idTokenPayload.payloadObj.exp,
507
+ };
508
+
509
+ const signedInOptions = {
510
+ ...this.tokens,
511
+ payload: idTokenPayload.payloadObj,
512
+ };
513
+
514
+ this.emit({
515
+ type: 'signedIn',
516
+ ...signedInOptions,
517
+ });
518
+
519
+ this.setAccessTokenCookie(accessToken, this.tokens);
520
+ this.registerEndSession();
521
+
522
+ return signedInOptions
523
+ } catch (error) {
524
+ // this.emit({ type: 'error', error_description: err.message || err.toString() })
525
+ this.emit({ type: 'error', error: 'failed' });
526
+ }
527
+ }
528
+ }
529
+
530
+ /**
531
+ * Factory function to create an instance of AuthIFrame, enabling authentication using an iframe
532
+ *
533
+ * @function AuthIFrame
534
+ * @tag auth
535
+ * @param {Object} - [options]: Configuration options for authentication
536
+ * @param {Function} - [onSignIn]: Callback function invoked on successful sign-in
537
+ * @param {Function} - [onSignOut]: Callback function invoked on sign-out
538
+ * @param {Function} - [onAuthError]: Callback function invoked on authentication error
539
+ * @param {string} - [options.authority]: The authority URL for authentication
540
+ * @param {string} - [options.redirect_uri]: The redirect URI for authentication
541
+ * @param {string} - [options.client_id]: The client ID for authentication
542
+ * @return {Auth} - An instance of Auth
543
+ */
544
+ const AuthIFrame = ({ onSignIn, onSignOut, onAuthError, ...config } = {}) => {
545
+ let signInTimer;
546
+ if (!self) {
547
+ const oidc = new OidcIFrame(Object.assign({}, DEFAULT_CONFIG, config, { redirect_uri: config.redirect_uri }));
548
+ if (onSignIn) oidc.on('signedIn', onSignIn);
549
+ if (onSignOut) oidc.on('signedOut', onSignOut);
550
+ if (onAuthError) oidc.on('error', onAuthError);
551
+ window.onmessage = e => {
552
+ if (e.origin === new URL(config.authority).origin) {
553
+ switch (e.data.type) {
554
+ case 'code':
555
+ oidc.getAccessTokenFromCode(e.data.code);
556
+ break
557
+ case 'signedOut':
558
+ oidc.emit({ type: 'signedOut' });
559
+ break
560
+ case 'session_not_found':
561
+ oidc.emit({
562
+ type: 'error',
563
+ error: 'session_not_found',
564
+ error_description: 'Session was expired, please sign in again',
565
+ });
566
+ if (signInTimer) clearTimeout(signInTimer);
567
+ signInTimer = setTimeout(() => oidc.signIn(), 1000);
568
+ break
569
+ default:
570
+ oidc.emit({ ...e.data, type: 'error' });
571
+ }
572
+ }
573
+ };
574
+ self = oidc;
575
+ }
576
+ return self
577
+ };
578
+
579
+ /**
580
+ * Factory function to create an instance of AuthRedirect, enabling redirect authentication.
581
+ *
582
+ * @function AuthRedirect
583
+ * @tag auth
584
+ * @param {Object} - [options]: Configuration options for authentication
585
+ * @param {Function} - [onSignIn]: Callback function invoked on successful sign-in
586
+ * @param {Function} - [onSignOut]: Callback function invoked on sign-out
587
+ * @param {Function} - [onAuthError]: Callback function invoked on authentication error
588
+ * @param {string} - [options.redirect_uri]: The redirect URI for authentication
589
+ * @return {AuthRedirect} - An instance of Auth
590
+ */
591
+ const AuthRedirect = ({ onSignIn, onSignOut, onAuthError, ...config } = {}) => {
592
+ if (config.lib === 'oidc-client-ts') return AuthRedirect$1({ onSignIn, onSignOut, onAuthError, ...config })
593
+
594
+ if (!self) {
595
+ const oidc = new OidcLib(Object.assign({}, DEFAULT_CONFIG, config, { redirect_uri: config.redirect_uri }));
596
+ if (onSignIn) oidc.on('signedIn', onSignIn);
597
+ if (onSignOut) oidc.on('signedOut', onSignOut);
598
+ if (onAuthError) oidc.on('error', onAuthError);
599
+
600
+ window.onmessage = async e => {
601
+ switch (e.data.type) {
602
+ case 'code':
603
+ await oidc.init();
604
+ oidc.getAccessTokenFromCode(e.data.code);
605
+ break
606
+ }
607
+ };
608
+
609
+ self = oidc;
610
+ }
611
+ return self
612
+ };
613
+
614
+ /**
615
+ * Factory function to create an instance of AuthOTP, enabling OTP authentication.
616
+ *
617
+ * @function AuthOTP
618
+ * @tag auth
619
+ * @param {Object} - [options]: Configuration options for authentication
620
+ * @param {Function} - [onSignIn]: Callback function invoked on successful sign-in
621
+ * @param {Function} - [onSignOut]: Callback function invoked on sign-out
622
+ * @param {Function} - [onAuthError]: Callback function invoked on authentication error
623
+ * @return {AuthOTP} - An instance of AuthOTP
624
+ */
625
+ const AuthOTP = ({ onSignIn, onSignOut, onAuthError, ...config } = {}) => {
626
+ if (!self) {
627
+ const otp = new OTP(Object.assign({}, config));
628
+ if (onSignIn) otp.on('signedIn', onSignIn);
629
+ if (onSignOut) otp.on('signedOut', onSignOut);
630
+ if (onAuthError) otp.on('error', onAuthError);
631
+
632
+ self = otp;
633
+ }
634
+ return self
635
+ };
636
+
637
+ export { AuthIFrame, AuthOTP, AuthRedirect, self };
638
+ //# sourceMappingURL=index.js.map