zudoku 0.0.0-fix-firebase-export.f8270825 → 0.0.0-fix-warnings.z053d4e27

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 (424) hide show
  1. package/dist/app/main.d.ts +6 -6
  2. package/dist/cli/common/version-check.js +12 -3
  3. package/dist/cli/common/version-check.js.map +1 -1
  4. package/dist/config/loader.js +3 -1
  5. package/dist/config/loader.js.map +1 -1
  6. package/dist/config/validators/InputNavigationSchema.d.ts +121 -119
  7. package/dist/config/validators/InputNavigationSchema.js +1 -0
  8. package/dist/config/validators/InputNavigationSchema.js.map +1 -1
  9. package/dist/config/validators/NavigationSchema.js +6 -1
  10. package/dist/config/validators/NavigationSchema.js.map +1 -1
  11. package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
  12. package/dist/config/validators/validate.d.ts +60 -13
  13. package/dist/config/validators/validate.js +7 -4
  14. package/dist/config/validators/validate.js.map +1 -1
  15. package/dist/flat-config.d.ts +28 -26
  16. package/dist/index.d.ts +2 -1
  17. package/dist/index.js +2 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/lib/auth/issuer.js +1 -1
  20. package/dist/lib/auth/issuer.js.map +1 -1
  21. package/dist/lib/authentication/authentication.d.ts +3 -2
  22. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  23. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  24. package/dist/lib/authentication/components/SignIn.js +4 -2
  25. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  26. package/dist/lib/authentication/components/SignUp.js +4 -2
  27. package/dist/lib/authentication/components/SignUp.js.map +1 -1
  28. package/dist/lib/authentication/hook.d.ts +2 -0
  29. package/dist/lib/authentication/hook.js +10 -0
  30. package/dist/lib/authentication/hook.js.map +1 -1
  31. package/dist/lib/authentication/providers/auth0.js +11 -7
  32. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  33. package/dist/lib/authentication/providers/clerk.js +0 -22
  34. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  35. package/dist/lib/authentication/providers/firebase.js +67 -9
  36. package/dist/lib/authentication/providers/firebase.js.map +1 -1
  37. package/dist/lib/authentication/providers/supabase.js +6 -15
  38. package/dist/lib/authentication/providers/supabase.js.map +1 -1
  39. package/dist/lib/authentication/ui/EmailVerificationUi.d.ts +4 -0
  40. package/dist/lib/authentication/ui/EmailVerificationUi.js +34 -0
  41. package/dist/lib/authentication/ui/EmailVerificationUi.js.map +1 -0
  42. package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +7 -2
  43. package/dist/lib/authentication/ui/ZudokuAuthUi.js +43 -11
  44. package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -1
  45. package/dist/lib/authentication/utils/relativeRedirectUrl.d.ts +1 -0
  46. package/dist/lib/authentication/utils/relativeRedirectUrl.js +8 -0
  47. package/dist/lib/authentication/utils/relativeRedirectUrl.js.map +1 -0
  48. package/dist/lib/components/Heading.d.ts +1 -1
  49. package/dist/lib/components/Pagination.js +2 -2
  50. package/dist/lib/components/Pagination.js.map +1 -1
  51. package/dist/lib/components/index.d.ts +18 -69
  52. package/dist/lib/components/index.js +19 -32
  53. package/dist/lib/components/index.js.map +1 -1
  54. package/dist/lib/components/navigation/NavigationItem.js +2 -2
  55. package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
  56. package/dist/lib/core/RouteGuard.js +12 -7
  57. package/dist/lib/core/RouteGuard.js.map +1 -1
  58. package/dist/lib/core/plugins.d.ts +11 -1
  59. package/dist/lib/core/plugins.js +1 -0
  60. package/dist/lib/core/plugins.js.map +1 -1
  61. package/dist/lib/core/react-query.d.ts +1 -0
  62. package/dist/lib/core/react-query.js +2 -0
  63. package/dist/lib/core/react-query.js.map +1 -0
  64. package/dist/lib/core/transform-config.d.ts +2 -0
  65. package/dist/lib/core/transform-config.js +22 -0
  66. package/dist/lib/core/transform-config.js.map +1 -0
  67. package/dist/lib/errors/ErrorMessage.d.ts +3 -0
  68. package/dist/lib/errors/ErrorMessage.js +16 -0
  69. package/dist/lib/errors/ErrorMessage.js.map +1 -0
  70. package/dist/lib/hooks/index.d.ts +7 -28
  71. package/dist/lib/hooks/index.js +7 -15
  72. package/dist/lib/hooks/index.js.map +1 -1
  73. package/dist/lib/oas/graphql/circular.d.ts +2 -0
  74. package/dist/lib/oas/graphql/circular.js +32 -10
  75. package/dist/lib/oas/graphql/circular.js.map +1 -1
  76. package/dist/lib/oas/graphql/circular.test.d.ts +1 -0
  77. package/dist/lib/oas/graphql/circular.test.js +152 -0
  78. package/dist/lib/oas/graphql/circular.test.js.map +1 -0
  79. package/dist/lib/oas/graphql/index.js +7 -3
  80. package/dist/lib/oas/graphql/index.js.map +1 -1
  81. package/dist/lib/oas/parser/index.js +14 -5
  82. package/dist/lib/oas/parser/index.js.map +1 -1
  83. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +9 -172
  84. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  85. package/dist/lib/plugins/api-keys/index.d.ts +11 -4
  86. package/dist/lib/plugins/api-keys/index.js +36 -22
  87. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  88. package/dist/lib/plugins/api-keys/settings/ApiKeyItem.d.ts +12 -0
  89. package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js +133 -0
  90. package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js.map +1 -0
  91. package/dist/lib/plugins/api-keys/settings/ApiKeyList.d.ts +4 -0
  92. package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +33 -0
  93. package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -0
  94. package/dist/lib/plugins/api-keys/settings/RevealApiKey.d.ts +6 -0
  95. package/dist/lib/plugins/api-keys/settings/RevealApiKey.js +39 -0
  96. package/dist/lib/plugins/api-keys/settings/RevealApiKey.js.map +1 -0
  97. package/dist/lib/plugins/openapi/OasProvider.js +6 -2
  98. package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
  99. package/dist/lib/plugins/openapi/OperationList.js +4 -4
  100. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  101. package/dist/lib/plugins/openapi/ParamInfos.js +1 -0
  102. package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
  103. package/dist/lib/plugins/openapi/Sidecar.js +3 -2
  104. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  105. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -0
  106. package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
  107. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  108. package/dist/lib/plugins/openapi/schema/utils.js +11 -3
  109. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  110. package/dist/lib/plugins/openapi/util/createHttpSnippet.js +24 -1
  111. package/dist/lib/plugins/openapi/util/createHttpSnippet.js.map +1 -1
  112. package/dist/lib/plugins/openapi/util/getRoutes.d.ts +3 -0
  113. package/dist/lib/plugins/openapi/util/getRoutes.js +2 -1
  114. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  115. package/dist/lib/ui/Button.js +1 -1
  116. package/dist/lib/ui/Button.js.map +1 -1
  117. package/dist/lib/ui/Command.d.ts +3 -3
  118. package/dist/lib/util/flattenAllOf.d.ts +0 -2
  119. package/dist/lib/util/flattenAllOf.js +0 -46
  120. package/dist/lib/util/flattenAllOf.js.map +1 -1
  121. package/dist/lib/util/flattenAllOf.test.js +2 -1
  122. package/dist/lib/util/flattenAllOf.test.js.map +1 -1
  123. package/dist/lib/util/flattenAllOfProcessor.d.ts +2 -0
  124. package/dist/lib/util/flattenAllOfProcessor.js +48 -0
  125. package/dist/lib/util/flattenAllOfProcessor.js.map +1 -0
  126. package/dist/lib/util/invariant.d.ts +1 -1
  127. package/dist/lib/util/invariant.js +2 -2
  128. package/dist/lib/util/invariant.js.map +1 -1
  129. package/dist/lib/util/readFrontmatter.js +2 -1
  130. package/dist/lib/util/readFrontmatter.js.map +1 -1
  131. package/dist/vite/api/SchemaManager.d.ts +12 -1
  132. package/dist/vite/api/SchemaManager.js +32 -15
  133. package/dist/vite/api/SchemaManager.js.map +1 -1
  134. package/dist/vite/api/SchemaManager.test.js +45 -1
  135. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  136. package/dist/vite/build.js +91 -73
  137. package/dist/vite/build.js.map +1 -1
  138. package/dist/vite/config.js +10 -4
  139. package/dist/vite/config.js.map +1 -1
  140. package/dist/vite/error-handler.js +1 -5
  141. package/dist/vite/error-handler.js.map +1 -1
  142. package/dist/vite/mdx/remark-inject-filepath.js +5 -1
  143. package/dist/vite/mdx/remark-inject-filepath.js.map +1 -1
  144. package/dist/vite/mdx/remark-link-rewrite.js +4 -3
  145. package/dist/vite/mdx/remark-link-rewrite.js.map +1 -1
  146. package/dist/vite/plugin-api-keys.js +5 -1
  147. package/dist/vite/plugin-api-keys.js.map +1 -1
  148. package/dist/vite/plugin-api.js +5 -3
  149. package/dist/vite/plugin-api.js.map +1 -1
  150. package/dist/vite/plugin-docs.js +9 -7
  151. package/dist/vite/plugin-docs.js.map +1 -1
  152. package/dist/vite/plugin-markdown-export.js +5 -3
  153. package/dist/vite/plugin-markdown-export.js.map +1 -1
  154. package/dist/vite/prerender/utils.js +9 -3
  155. package/dist/vite/prerender/utils.js.map +1 -1
  156. package/dist/vite/prerender/worker.js +3 -0
  157. package/dist/vite/prerender/worker.js.map +1 -1
  158. package/dist/vite/zuplo.d.ts +13 -0
  159. package/dist/vite/zuplo.js +15 -0
  160. package/dist/vite/zuplo.js.map +1 -0
  161. package/lib/{ActionButton-DUgvSylL.js → ActionButton-B0CXL1Lq.js} +3 -3
  162. package/lib/{ActionButton-DUgvSylL.js.map → ActionButton-B0CXL1Lq.js.map} +1 -1
  163. package/lib/{Button-CynVW1JV.js → Button-GUVe7pmt.js} +8 -7
  164. package/lib/{Button-CynVW1JV.js.map → Button-GUVe7pmt.js.map} +1 -1
  165. package/lib/{Card-KFniaZn5.js → Card-DCdq37aA.js} +2 -2
  166. package/lib/{Card-KFniaZn5.js.map → Card-DCdq37aA.js.map} +1 -1
  167. package/lib/{ClaudeLogo-B4Xxt-x_.js → ClaudeLogo-C6q-Xn_l.js} +21 -17
  168. package/lib/ClaudeLogo-C6q-Xn_l.js.map +1 -0
  169. package/lib/{Command-BpT1iBE6.js → Command-N6VujV30.js} +3 -3
  170. package/lib/{Command-BpT1iBE6.js.map → Command-N6VujV30.js.map} +1 -1
  171. package/lib/{Dialog-BQciPiHN.js → Dialog-hlvmmQ_c.js} +2 -2
  172. package/lib/{Dialog-BQciPiHN.js.map → Dialog-hlvmmQ_c.js.map} +1 -1
  173. package/lib/{Drawer-Ci7XwhqT.js → Drawer-Ch7927PF.js} +7 -7
  174. package/lib/{Drawer-Ci7XwhqT.js.map → Drawer-Ch7927PF.js.map} +1 -1
  175. package/lib/{DropdownMenu-C8SX_-S_.js → DropdownMenu-DN0jNrjj.js} +2 -2
  176. package/lib/{DropdownMenu-C8SX_-S_.js.map → DropdownMenu-DN0jNrjj.js.map} +1 -1
  177. package/lib/Frame-DKlOmSkU.js +205 -0
  178. package/lib/Frame-DKlOmSkU.js.map +1 -0
  179. package/lib/HydrationBoundary-CNF2ZV3E.js +601 -0
  180. package/lib/HydrationBoundary-CNF2ZV3E.js.map +1 -0
  181. package/lib/{IndexingDialog-B5zCiUKr.js → IndexingDialog-D0YdGfbn.js} +3 -3
  182. package/lib/{IndexingDialog-B5zCiUKr.js.map → IndexingDialog-D0YdGfbn.js.map} +1 -1
  183. package/lib/Input-Cx-GeKoF.js +22 -0
  184. package/lib/Input-Cx-GeKoF.js.map +1 -0
  185. package/lib/{MdxPage-BagO2c-n.js → MdxPage-B1G4W1TK.js} +11 -11
  186. package/lib/{MdxPage-BagO2c-n.js.map → MdxPage-B1G4W1TK.js.map} +1 -1
  187. package/lib/{Mermaid-D_VSX7_Q.js → Mermaid-B1xNo-pf.js} +5 -4
  188. package/lib/{Mermaid-D_VSX7_Q.js.map → Mermaid-B1xNo-pf.js.map} +1 -1
  189. package/lib/{OAuthErrorPage-Fq54RLgt.js → OAuthErrorPage-01Ke086W.js} +25 -23
  190. package/lib/OAuthErrorPage-01Ke086W.js.map +1 -0
  191. package/lib/OasProvider-BG-FWDIq.js +48 -0
  192. package/lib/OasProvider-BG-FWDIq.js.map +1 -0
  193. package/lib/{OperationList-C0jiEaG5.js → OperationList-GGkJ1vac.js} +1983 -1965
  194. package/lib/OperationList-GGkJ1vac.js.map +1 -0
  195. package/lib/RouteGuard-B1lCR0C_.js +77 -0
  196. package/lib/RouteGuard-B1lCR0C_.js.map +1 -0
  197. package/lib/{SchemaList-BU0zCHn9.js → SchemaList-CNVdC9f-.js} +9 -9
  198. package/lib/{SchemaList-BU0zCHn9.js.map → SchemaList-CNVdC9f-.js.map} +1 -1
  199. package/lib/SchemaView-CrV0yIwR.js +438 -0
  200. package/lib/SchemaView-CrV0yIwR.js.map +1 -0
  201. package/lib/{Select-CkxXP5I7.js → Secret-BDBqq4p3.js} +122 -122
  202. package/lib/Secret-BDBqq4p3.js.map +1 -0
  203. package/lib/{Separator-CTPSeW1S.js → Separator-BXt1LYnm.js} +2 -2
  204. package/lib/{Separator-CTPSeW1S.js.map → Separator-BXt1LYnm.js.map} +1 -1
  205. package/lib/SignUp-8kDBaLbO.js +55 -0
  206. package/lib/SignUp-8kDBaLbO.js.map +1 -0
  207. package/lib/{SyntaxHighlight-Kdyskw3C.js → SyntaxHighlight-hZOFnYl0.js} +1749 -1723
  208. package/lib/SyntaxHighlight-hZOFnYl0.js.map +1 -0
  209. package/lib/{Toc-DJxFPfcS.js → Toc-qEIii_-W.js} +3 -3
  210. package/lib/{Toc-DJxFPfcS.js.map → Toc-qEIii_-W.js.map} +1 -1
  211. package/lib/{ErrorAlert-DrOR8w3f.js → Zudoku-DUsdmPME.js} +5449 -4427
  212. package/lib/Zudoku-DUsdmPME.js.map +1 -0
  213. package/lib/ZudokuContext-BBI06sOx.js +387 -0
  214. package/lib/ZudokuContext-BBI06sOx.js.map +1 -0
  215. package/lib/chunk-EPOLDU6W-C6C8jAwd.js +8558 -0
  216. package/lib/chunk-EPOLDU6W-C6C8jAwd.js.map +1 -0
  217. package/lib/{circular-CzWF1hj5.js → circular-bbWO95zs.js} +771 -749
  218. package/lib/{circular-CzWF1hj5.js.map → circular-bbWO95zs.js.map} +1 -1
  219. package/lib/{cn-dYga0KKN.js → cn-5-Gd1Dss.js} +531 -498
  220. package/lib/cn-5-Gd1Dss.js.map +1 -0
  221. package/lib/createServer-B7POuwZp.js +13036 -0
  222. package/lib/createServer-B7POuwZp.js.map +1 -0
  223. package/lib/createVariantComponent-Dc0vtOvr.js +18 -0
  224. package/lib/createVariantComponent-Dc0vtOvr.js.map +1 -0
  225. package/lib/{errors-Bs4duWDy.js → errors-7hgPDs1h.js} +3 -3
  226. package/lib/{errors-Bs4duWDy.js.map → errors-7hgPDs1h.js.map} +1 -1
  227. package/lib/{firebase-qUdSEL1p.js → firebase-Dwn-2ju-.js} +1590 -1342
  228. package/lib/firebase-Dwn-2ju-.js.map +1 -0
  229. package/lib/hook-ZEd1Es7D.js +52 -0
  230. package/lib/hook-ZEd1Es7D.js.map +1 -0
  231. package/lib/{index-0oT9beQN.js → index-CTCT4jlW.js} +499 -493
  232. package/lib/{index-0oT9beQN.js.map → index-CTCT4jlW.js.map} +1 -1
  233. package/lib/index-CrcNWbel.js.map +1 -1
  234. package/lib/index-DAWHN3cH.js +86 -0
  235. package/lib/index-DAWHN3cH.js.map +1 -0
  236. package/lib/{index-Bh-MffiL.js → index-Dxdhrp-I.js} +2 -2
  237. package/lib/{index-Bh-MffiL.js.map → index-Dxdhrp-I.js.map} +1 -1
  238. package/lib/index.esm-BYObtETB.js.map +1 -1
  239. package/lib/{index.esm-DtzT_KoE.js → index.esm-Ca5zvoff.js} +20 -20
  240. package/lib/{index.esm-DtzT_KoE.js.map → index.esm-Ca5zvoff.js.map} +1 -1
  241. package/lib/{index.esm-kW-Utcsi.js → index.esm-DG4KaDKR.js} +16 -14
  242. package/lib/index.esm-DG4KaDKR.js.map +1 -0
  243. package/lib/{invariant-CGOLuIIz.js → invariant-B_t_F2s_.js} +6 -6
  244. package/lib/invariant-B_t_F2s_.js.map +1 -0
  245. package/lib/jsx-runtime-BzflLqGi.js.map +1 -1
  246. package/lib/{mutation-BoVlx8yA.js → mutation-BISOc7OM.js} +70 -44
  247. package/lib/mutation-BISOc7OM.js.map +1 -0
  248. package/lib/ui/Accordion.js +1 -1
  249. package/lib/ui/ActionButton.js +2 -2
  250. package/lib/ui/Alert.js +1 -1
  251. package/lib/ui/AlertDialog.js +1 -1
  252. package/lib/ui/Badge.js +1 -1
  253. package/lib/ui/Breadcrumb.js +1 -1
  254. package/lib/ui/Button.js +7 -6
  255. package/lib/ui/Button.js.map +1 -1
  256. package/lib/ui/ButtonGroup.js +1 -1
  257. package/lib/ui/Callout.js +1 -1
  258. package/lib/ui/Card.js +1 -1
  259. package/lib/ui/Carousel.js +1 -1
  260. package/lib/ui/Carousel.js.map +1 -1
  261. package/lib/ui/Checkbox.js +1 -1
  262. package/lib/ui/CodeBlock.js +1 -1
  263. package/lib/ui/Command.js +2 -2
  264. package/lib/ui/Dialog.js +1 -1
  265. package/lib/ui/Drawer.js +3 -3
  266. package/lib/ui/DropdownMenu.js +1 -1
  267. package/lib/ui/EmbeddedCodeBlock.js +1 -1
  268. package/lib/ui/Form.js +1 -1
  269. package/lib/ui/Frame.js +1 -1
  270. package/lib/ui/HoverCard.js +1 -1
  271. package/lib/ui/Input.js +1 -1
  272. package/lib/ui/Item.js +1 -1
  273. package/lib/ui/Label.js +1 -1
  274. package/lib/ui/NativeSelect.js +1 -1
  275. package/lib/ui/Pagination.js +1 -1
  276. package/lib/ui/Popover.js +1 -1
  277. package/lib/ui/Progress.js +1 -1
  278. package/lib/ui/RadioGroup.js +1 -1
  279. package/lib/ui/ScrollArea.js +1 -1
  280. package/lib/ui/Secret.js +1 -1
  281. package/lib/ui/Separator.js +1 -1
  282. package/lib/ui/Skeleton.js +1 -1
  283. package/lib/ui/Slider.js +1 -1
  284. package/lib/ui/Switch.js +1 -1
  285. package/lib/ui/SyntaxHighlight.js +3 -3
  286. package/lib/ui/Tabs.js +1 -1
  287. package/lib/ui/Textarea.js +1 -1
  288. package/lib/ui/Toggle.js +1 -1
  289. package/lib/ui/ToggleGroup.js +1 -1
  290. package/lib/ui/Value.js +1 -1
  291. package/lib/ui/util.js +1 -1
  292. package/lib/useExposedProps-CzTDfXfq.js +30 -0
  293. package/lib/useExposedProps-CzTDfXfq.js.map +1 -0
  294. package/lib/{useMutation-C6RqWmTS.js → useMutation-CFMGlAMW.js} +39 -17
  295. package/lib/useMutation-CFMGlAMW.js.map +1 -0
  296. package/lib/useSuspenseQuery-CSB_rVek.js +1226 -0
  297. package/lib/useSuspenseQuery-CSB_rVek.js.map +1 -0
  298. package/lib/zudoku.__internal.js +827 -1325
  299. package/lib/zudoku.__internal.js.map +1 -1
  300. package/lib/zudoku.auth-auth0.js +16 -16
  301. package/lib/zudoku.auth-auth0.js.map +1 -1
  302. package/lib/zudoku.auth-azureb2c.js +4 -4
  303. package/lib/zudoku.auth-clerk.js +52 -75
  304. package/lib/zudoku.auth-clerk.js.map +1 -1
  305. package/lib/zudoku.auth-firebase.js +6 -5
  306. package/lib/zudoku.auth-firebase.js.map +1 -1
  307. package/lib/zudoku.auth-openid.js +5 -5
  308. package/lib/zudoku.auth-supabase.js +31 -40
  309. package/lib/zudoku.auth-supabase.js.map +1 -1
  310. package/lib/zudoku.components.js +29 -25
  311. package/lib/zudoku.components.js.map +1 -1
  312. package/lib/zudoku.hooks.js +24 -11
  313. package/lib/zudoku.hooks.js.map +1 -1
  314. package/lib/zudoku.mermaid.js +5 -4
  315. package/lib/zudoku.mermaid.js.map +1 -1
  316. package/lib/zudoku.plugin-api-catalog.js +35 -31
  317. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  318. package/lib/zudoku.plugin-api-keys.js +607 -551
  319. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  320. package/lib/zudoku.plugin-custom-pages.js +1 -1
  321. package/lib/zudoku.plugin-markdown.js +1 -1
  322. package/lib/zudoku.plugin-openapi.js +3 -3
  323. package/lib/zudoku.plugin-redirect.js +1 -1
  324. package/lib/zudoku.plugin-search-pagefind.js +30 -29
  325. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  326. package/lib/zudoku.plugins.js +9 -8
  327. package/lib/zudoku.plugins.js.map +1 -1
  328. package/lib/zudoku.react-query.js +440 -0
  329. package/lib/zudoku.react-query.js.map +1 -0
  330. package/lib/zudoku.router.js +1130 -1404
  331. package/lib/zudoku.router.js.map +1 -1
  332. package/package.json +30 -22
  333. package/src/lib/auth/issuer.ts +1 -1
  334. package/src/lib/authentication/authentication.ts +8 -2
  335. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  336. package/src/lib/authentication/components/SignIn.tsx +5 -2
  337. package/src/lib/authentication/components/SignUp.tsx +5 -2
  338. package/src/lib/authentication/hook.ts +16 -0
  339. package/src/lib/authentication/providers/auth0.tsx +15 -9
  340. package/src/lib/authentication/providers/clerk.tsx +0 -26
  341. package/src/lib/authentication/providers/firebase.tsx +98 -6
  342. package/src/lib/authentication/providers/supabase.tsx +6 -15
  343. package/src/lib/authentication/ui/EmailVerificationUi.tsx +129 -0
  344. package/src/lib/authentication/ui/ZudokuAuthUi.tsx +170 -38
  345. package/src/lib/authentication/utils/relativeRedirectUrl.ts +12 -0
  346. package/src/lib/components/Pagination.tsx +4 -5
  347. package/src/lib/components/index.ts +19 -35
  348. package/src/lib/components/navigation/NavigationItem.tsx +9 -3
  349. package/src/lib/core/RouteGuard.tsx +30 -24
  350. package/src/lib/core/plugins.ts +21 -1
  351. package/src/lib/core/react-query.ts +1 -0
  352. package/src/lib/core/transform-config.ts +29 -0
  353. package/src/lib/errors/ErrorMessage.tsx +38 -0
  354. package/src/lib/hooks/index.ts +7 -16
  355. package/src/lib/oas/graphql/circular.test.ts +186 -0
  356. package/src/lib/oas/graphql/circular.ts +49 -10
  357. package/src/lib/oas/graphql/index.ts +7 -3
  358. package/src/lib/oas/parser/index.ts +17 -6
  359. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +36 -476
  360. package/src/lib/plugins/api-keys/index.tsx +76 -32
  361. package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -0
  362. package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +67 -0
  363. package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +124 -0
  364. package/src/lib/plugins/openapi/OasProvider.tsx +10 -2
  365. package/src/lib/plugins/openapi/OperationList.tsx +4 -4
  366. package/src/lib/plugins/openapi/ParamInfos.tsx +1 -0
  367. package/src/lib/plugins/openapi/Sidecar.tsx +3 -2
  368. package/src/lib/plugins/openapi/interfaces.ts +6 -1
  369. package/src/lib/plugins/openapi/schema/SchemaView.tsx +6 -4
  370. package/src/lib/plugins/openapi/schema/utils.ts +15 -4
  371. package/src/lib/plugins/openapi/util/createHttpSnippet.ts +29 -1
  372. package/src/lib/plugins/openapi/util/getRoutes.tsx +4 -1
  373. package/src/lib/ui/Button.tsx +1 -0
  374. package/src/lib/util/flattenAllOf.test.ts +2 -1
  375. package/src/lib/util/flattenAllOf.ts +0 -57
  376. package/src/lib/util/flattenAllOfProcessor.ts +58 -0
  377. package/src/lib/util/invariant.ts +2 -1
  378. package/src/lib/util/readFrontmatter.ts +2 -1
  379. package/src/shiki/langs/c3.js +1 -0
  380. package/src/shiki/langs/gn.js +1 -0
  381. package/src/shiki/langs/moonbit.js +1 -0
  382. package/src/zuplo/enrich-with-zuplo-mcp.ts +168 -0
  383. package/src/zuplo/enrich-with-zuplo.ts +254 -0
  384. package/src/zuplo/policy-types.ts +46 -0
  385. package/src/zuplo/with-zuplo-processors.ts +35 -0
  386. package/src/zuplo/with-zuplo.ts +14 -0
  387. package/lib/ClaudeLogo-B4Xxt-x_.js.map +0 -1
  388. package/lib/ErrorAlert-DrOR8w3f.js.map +0 -1
  389. package/lib/OAuthErrorPage-Fq54RLgt.js.map +0 -1
  390. package/lib/OasProvider-DPH8mwDa.js +0 -40
  391. package/lib/OasProvider-DPH8mwDa.js.map +0 -1
  392. package/lib/OperationList-C0jiEaG5.js.map +0 -1
  393. package/lib/RouteGuard-9wjejsKm.js +0 -77
  394. package/lib/RouteGuard-9wjejsKm.js.map +0 -1
  395. package/lib/RouterError-DSLXagd5.js +0 -42
  396. package/lib/RouterError-DSLXagd5.js.map +0 -1
  397. package/lib/SchemaView-DVae4RO2.js +0 -597
  398. package/lib/SchemaView-DVae4RO2.js.map +0 -1
  399. package/lib/Select-CkxXP5I7.js.map +0 -1
  400. package/lib/SignUp-BjS4ozA7.js +0 -50
  401. package/lib/SignUp-BjS4ozA7.js.map +0 -1
  402. package/lib/SyntaxHighlight-Kdyskw3C.js.map +0 -1
  403. package/lib/ZudokuContext-BXldanA8.js +0 -1508
  404. package/lib/ZudokuContext-BXldanA8.js.map +0 -1
  405. package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js +0 -9
  406. package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js.map +0 -1
  407. package/lib/chunk-PVWAREVJ-dLIqswPy.js +0 -7965
  408. package/lib/chunk-PVWAREVJ-dLIqswPy.js.map +0 -1
  409. package/lib/cn-dYga0KKN.js.map +0 -1
  410. package/lib/createServer-BIr2_tGn.js +0 -16693
  411. package/lib/createServer-BIr2_tGn.js.map +0 -1
  412. package/lib/createVariantComponent-B9_dVBvu.js +0 -35
  413. package/lib/createVariantComponent-B9_dVBvu.js.map +0 -1
  414. package/lib/firebase-qUdSEL1p.js.map +0 -1
  415. package/lib/hook-BNxidGQq.js +0 -40
  416. package/lib/hook-BNxidGQq.js.map +0 -1
  417. package/lib/index-CCmMJp02.js +0 -1059
  418. package/lib/index-CCmMJp02.js.map +0 -1
  419. package/lib/index-Css56y3F.js +0 -133
  420. package/lib/index-Css56y3F.js.map +0 -1
  421. package/lib/index.esm-kW-Utcsi.js.map +0 -1
  422. package/lib/invariant-CGOLuIIz.js.map +0 -1
  423. package/lib/mutation-BoVlx8yA.js.map +0 -1
  424. package/lib/useMutation-C6RqWmTS.js.map +0 -1
@@ -1,81 +1,180 @@
1
1
  import { j as e } from "./jsx-runtime-BzflLqGi.js";
2
- import { CircleSlashIcon as $, CheckIcon as ue, XIcon as fe, PencilLineIcon as he, RefreshCwIcon as pe, TrashIcon as me, KeyRoundIcon as xe } from "lucide-react";
3
- import { R as ye } from "./RouterError-DSLXagd5.js";
4
- import { i as A } from "./invariant-CGOLuIIz.js";
5
- import { O as ge, u as je } from "./chunk-PVWAREVJ-dLIqswPy.js";
6
- import { u as Ce } from "./hook-BNxidGQq.js";
7
- import { D as ve, a as Y } from "./ErrorAlert-DrOR8w3f.js";
8
- import { Button as v } from "./ui/Button.js";
9
- import { a as ne, f as ie, e as we } from "./ZudokuContext-BXldanA8.js";
10
- import { u as T } from "./useMutation-C6RqWmTS.js";
11
- import * as q from "react";
12
- import ke, { createContext as Q, useRef as N, useLayoutEffect as be, useEffect as re, useId as _, useContext as H, useInsertionEffect as Ke, useMemo as F, useCallback as Ee, Children as De, isValidElement as Ne, useState as D } from "react";
13
- import { A as O, a as M, b as Pe } from "./Mermaid-D_VSX7_Q.js";
14
- import { C as Ae, a as Ie } from "./Card-KFniaZn5.js";
15
- import { e as V, f as P, D as B, g as G, a as J, b as U, c as W, d as ae } from "./Dialog-BQciPiHN.js";
16
- import { S as Re, a as Se, b as Te, c as Oe, d as Me, e as Z, f as qe } from "./Select-CkxXP5I7.js";
17
- import { Input as oe } from "./ui/Input.js";
18
- import { c as L } from "./cn-dYga0KKN.js";
2
+ import { TrashIcon as me, CircleSlashIcon as z, CheckIcon as xe, XIcon as ye, PencilLineIcon as ge, RefreshCwIcon as je, KeyRoundIcon as ve } from "lucide-react";
3
+ import { Z as M, i as E } from "./invariant-B_t_F2s_.js";
4
+ import * as F from "react";
5
+ import { createContext as Q, useRef as A, useLayoutEffect as Ce, useEffect as re, useId as H, useContext as V, useInsertionEffect as we, useMemo as L, useCallback as ke, Children as Ee, isValidElement as Ie, useState as I } from "react";
6
+ import { D as Ke, c as be, a as te, E as De } from "./Zudoku-DUsdmPME.js";
7
+ import { Button as _ } from "./ui/Button.js";
8
+ import { a as B } from "./ZudokuContext-BBI06sOx.js";
9
+ import "./index-DAWHN3cH.js";
10
+ import { u as ae } from "./hook-ZEd1Es7D.js";
11
+ import { F as Pe, g as Ae, j as Se, h as Re, d as Ne, I as Oe, a as Te, b as qe, k as Me, c as Fe } from "./Frame-DKlOmSkU.js";
12
+ import { A as D, a as P, b as oe } from "./Mermaid-B1xNo-pf.js";
13
+ import { e as Z, f as S, D as G, g as J, a as Y, b as U, c as W, d as le } from "./Dialog-hlvmmQ_c.js";
14
+ import { a as ce, u as $e } from "./useSuspenseQuery-CSB_rVek.js";
15
+ import { u as q } from "./useMutation-CFMGlAMW.js";
19
16
  import { a as ze } from "./index.esm-BYObtETB.js";
20
- import { A as $e } from "./ActionButton-DUgvSylL.js";
21
- import { b as Fe } from "./index-Css56y3F.js";
22
- const Le = () => {
23
- const t = Ce();
24
- return t.isAuthEnabled && t.isPending ? null : t.isAuthEnabled ? t.isAuthenticated ? /* @__PURE__ */ e.jsx(ge, {}) : /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
25
- "Please login first to view this page",
26
- /* @__PURE__ */ e.jsx(v, { onClick: () => t.login(), children: "Login" })
27
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(ve, { className: "max-w-[600px]", children: [
28
- "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
29
- /* @__PURE__ */ e.jsx("code", { children: "authentication" }),
30
- "."
31
- ] }) });
32
- }, Qe = Q({});
33
- function le(t) {
34
- const r = N(null);
35
- return r.current === null && (r.current = t()), r.current;
17
+ import { u as Le } from "./chunk-EPOLDU6W-C6C8jAwd.js";
18
+ import { A as Qe } from "./ActionButton-B0CXL1Lq.js";
19
+ import { S as He, a as Ve, b as _e, c as Be, d as Ze, e as se, f as Ge } from "./Secret-BDBqq4p3.js";
20
+ import { Input as Je } from "./ui/Input.js";
21
+ import { c as X } from "./cn-5-Gd1Dss.js";
22
+ import { B as k } from "./Button-GUVe7pmt.js";
23
+ import { I as Ye } from "./Input-Cx-GeKoF.js";
24
+ function Ue({ error: t }) {
25
+ const a = t instanceof Error ? t.message : "Something went wrong", s = process.env.NODE_ENV === "development", n = t instanceof M ? t.developerHint : void 0, r = t instanceof M ? t.title : "Something went wrong", i = t instanceof Error ? t.stack : void 0, o = t instanceof Error ? t.cause : void 0, d = o instanceof Error ? String(o.stack) : i;
26
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
27
+ /* @__PURE__ */ e.jsxs(D, { variant: "destructive", children: [
28
+ /* @__PURE__ */ e.jsx(P, { children: r }),
29
+ /* @__PURE__ */ e.jsx(oe, { children: a })
30
+ ] }),
31
+ s && n && /* @__PURE__ */ e.jsx(Ke, { className: "mb-4", children: n }),
32
+ s && d && /* @__PURE__ */ e.jsx(
33
+ be,
34
+ {
35
+ className: "max-h-[400px] [&>pre]:p-4",
36
+ language: "js",
37
+ code: d
38
+ }
39
+ )
40
+ ] });
41
+ }
42
+ const We = ({
43
+ service: t,
44
+ onOpenChange: a
45
+ }) => {
46
+ const s = B(), n = ce(), r = Le(), i = ze({
47
+ defaultValues: {
48
+ expiresOn: "30"
49
+ }
50
+ }), o = ae(), d = q({
51
+ mutationFn: ({ description: c, expiresOn: u }) => {
52
+ if (!t.createKey)
53
+ throw new Error("createKey not implemented");
54
+ const p = u !== "never" ? Xe(Number(u)) : void 0;
55
+ return t.createKey({
56
+ apiKey: {
57
+ description: c || "Secret Key",
58
+ expiresOn: p
59
+ },
60
+ context: s,
61
+ auth: o
62
+ });
63
+ },
64
+ onSuccess: async () => {
65
+ await n.invalidateQueries({ queryKey: ["api-keys"] }), await r("/settings/api-keys/");
66
+ }
67
+ });
68
+ return t.createKey ? /* @__PURE__ */ e.jsxs(
69
+ "form",
70
+ {
71
+ onSubmit: i.handleSubmit(
72
+ (c) => d.mutate(
73
+ { ...c },
74
+ {
75
+ onSuccess: () => a(!1)
76
+ }
77
+ )
78
+ ),
79
+ children: [
80
+ d.error && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
81
+ /* @__PURE__ */ e.jsx(P, { children: "Error" }),
82
+ /* @__PURE__ */ e.jsx(oe, { children: d.error.message })
83
+ ] }),
84
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
85
+ "Name",
86
+ /* @__PURE__ */ e.jsx(Je, { ...i.register("description") }),
87
+ "Expiration",
88
+ /* @__PURE__ */ e.jsxs(
89
+ He,
90
+ {
91
+ onValueChange: (c) => i.setValue("expiresOn", c),
92
+ defaultValue: i.getValues("expiresOn"),
93
+ children: [
94
+ /* @__PURE__ */ e.jsx(Ve, { children: /* @__PURE__ */ e.jsx(_e, {}) }),
95
+ /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsxs(Ze, { children: [
96
+ [7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(se, { value: String(c), children: [
97
+ c,
98
+ " days"
99
+ ] }, c)),
100
+ /* @__PURE__ */ e.jsx(se, { value: "never", children: "Never" })
101
+ ] }) })
102
+ ]
103
+ }
104
+ ),
105
+ /* @__PURE__ */ e.jsxs(Z, { children: [
106
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(_, { variant: "outline", children: "Cancel" }) }),
107
+ /* @__PURE__ */ e.jsx(Qe, { isPending: d.isPending, children: "Generate Key" })
108
+ ] })
109
+ ] })
110
+ ]
111
+ }
112
+ ) : null;
113
+ }, Xe = (t) => {
114
+ const a = /* @__PURE__ */ new Date();
115
+ return a.setDate(a.getDate() + t), a.toISOString();
116
+ }, de = ({
117
+ service: t,
118
+ isOpen: a,
119
+ onOpenChange: s,
120
+ trigger: n,
121
+ buttonVariant: r = "outline"
122
+ }) => {
123
+ const i = /* @__PURE__ */ e.jsx(_, { variant: r, children: "Create API Key" });
124
+ return /* @__PURE__ */ e.jsxs(G, { open: a, onOpenChange: s, children: [
125
+ /* @__PURE__ */ e.jsx(J, { asChild: !0, children: n ?? i }),
126
+ /* @__PURE__ */ e.jsxs(Y, { children: [
127
+ /* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(W, { children: "Create API Key" }) }),
128
+ /* @__PURE__ */ e.jsx(We, { service: t, onOpenChange: s })
129
+ ] })
130
+ ] });
131
+ }, et = Q({});
132
+ function ue(t) {
133
+ const a = A(null);
134
+ return a.current === null && (a.current = t()), a.current;
36
135
  }
37
- const _e = typeof window < "u", He = _e ? be : re, ce = /* @__PURE__ */ Q(null);
38
- function Ve(t) {
136
+ const tt = typeof window < "u", st = tt ? Ce : re, fe = /* @__PURE__ */ Q(null);
137
+ function nt(t) {
39
138
  return typeof t == "object" && t !== null;
40
139
  }
41
- function Be(t) {
42
- return Ve(t) && "offsetHeight" in t;
140
+ function it(t) {
141
+ return nt(t) && "offsetHeight" in t;
43
142
  }
44
- const Ge = Q({
143
+ const rt = Q({
45
144
  transformPagePoint: (t) => t,
46
145
  isStatic: !1,
47
146
  reducedMotion: "never"
48
147
  });
49
- function ee(t, r) {
148
+ function ne(t, a) {
50
149
  if (typeof t == "function")
51
- return t(r);
52
- t != null && (t.current = r);
150
+ return t(a);
151
+ t != null && (t.current = a);
53
152
  }
54
- function Je(...t) {
55
- return (r) => {
153
+ function at(...t) {
154
+ return (a) => {
56
155
  let s = !1;
57
- const n = t.map((i) => {
58
- const a = ee(i, r);
59
- return !s && typeof a == "function" && (s = !0), a;
156
+ const n = t.map((r) => {
157
+ const i = ne(r, a);
158
+ return !s && typeof i == "function" && (s = !0), i;
60
159
  });
61
160
  if (s)
62
161
  return () => {
63
- for (let i = 0; i < n.length; i++) {
64
- const a = n[i];
65
- typeof a == "function" ? a() : ee(t[i], null);
162
+ for (let r = 0; r < n.length; r++) {
163
+ const i = n[r];
164
+ typeof i == "function" ? i() : ne(t[r], null);
66
165
  }
67
166
  };
68
167
  };
69
168
  }
70
- function Ue(...t) {
71
- return q.useCallback(Je(...t), t);
169
+ function ot(...t) {
170
+ return F.useCallback(at(...t), t);
72
171
  }
73
- class We extends q.Component {
74
- getSnapshotBeforeUpdate(r) {
172
+ class lt extends F.Component {
173
+ getSnapshotBeforeUpdate(a) {
75
174
  const s = this.props.childRef.current;
76
- if (s && r.isPresent && !this.props.isPresent) {
77
- const n = s.offsetParent, i = Be(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
78
- a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right = i - a.width - a.left;
175
+ if (s && a.isPresent && !this.props.isPresent) {
176
+ const n = s.offsetParent, r = it(n) && n.offsetWidth || 0, i = this.props.sizeRef.current;
177
+ i.height = s.offsetHeight || 0, i.width = s.offsetWidth || 0, i.top = s.offsetTop, i.left = s.offsetLeft, i.right = r - i.width - i.left;
79
178
  }
80
179
  return null;
81
180
  }
@@ -88,558 +187,502 @@ class We extends q.Component {
88
187
  return this.props.children;
89
188
  }
90
189
  }
91
- function Xe({ children: t, isPresent: r, anchorX: s, root: n }) {
92
- const i = _(), a = N(null), l = N({
190
+ function ct({ children: t, isPresent: a, anchorX: s, root: n }) {
191
+ const r = H(), i = A(null), o = A({
93
192
  width: 0,
94
193
  height: 0,
95
194
  top: 0,
96
195
  left: 0,
97
196
  right: 0
98
- }), { nonce: u } = H(Ge), f = Ue(a, t?.ref);
99
- return Ke(() => {
100
- const { width: d, height: y, top: h, left: x, right: p } = l.current;
101
- if (r || !a.current || !d || !y)
197
+ }), { nonce: d } = V(rt), c = ot(i, t?.ref);
198
+ return we(() => {
199
+ const { width: u, height: p, top: f, left: m, right: g } = o.current;
200
+ if (a || !i.current || !u || !p)
102
201
  return;
103
- const k = s === "left" ? `left: ${x}` : `right: ${p}`;
104
- a.current.dataset.motionPopId = i;
105
- const m = document.createElement("style");
106
- u && (m.nonce = u);
107
- const K = n ?? document.head;
108
- return K.appendChild(m), m.sheet && m.sheet.insertRule(`
109
- [data-motion-pop-id="${i}"] {
202
+ const j = s === "left" ? `left: ${m}` : `right: ${g}`;
203
+ i.current.dataset.motionPopId = r;
204
+ const l = document.createElement("style");
205
+ d && (l.nonce = d);
206
+ const x = n ?? document.head;
207
+ return x.appendChild(l), l.sheet && l.sheet.insertRule(`
208
+ [data-motion-pop-id="${r}"] {
110
209
  position: absolute !important;
111
- width: ${d}px !important;
112
- height: ${y}px !important;
113
- ${k}px !important;
114
- top: ${h}px !important;
210
+ width: ${u}px !important;
211
+ height: ${p}px !important;
212
+ ${j}px !important;
213
+ top: ${f}px !important;
115
214
  }
116
215
  `), () => {
117
- K.contains(m) && K.removeChild(m);
216
+ x.contains(l) && x.removeChild(l);
118
217
  };
119
- }, [r]), e.jsx(We, { isPresent: r, childRef: a, sizeRef: l, children: q.cloneElement(t, { ref: f }) });
218
+ }, [a]), e.jsx(lt, { isPresent: a, childRef: i, sizeRef: o, children: F.cloneElement(t, { ref: c }) });
120
219
  }
121
- const Ye = ({ children: t, initial: r, isPresent: s, onExitComplete: n, custom: i, presenceAffectsLayout: a, mode: l, anchorX: u, root: f }) => {
122
- const d = le(Ze), y = _();
123
- let h = !0, x = F(() => (h = !1, {
124
- id: y,
125
- initial: r,
220
+ const dt = ({ children: t, initial: a, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: i, mode: o, anchorX: d, root: c }) => {
221
+ const u = ue(ut), p = H();
222
+ let f = !0, m = L(() => (f = !1, {
223
+ id: p,
224
+ initial: a,
126
225
  isPresent: s,
127
- custom: i,
128
- onExitComplete: (p) => {
129
- d.set(p, !0);
130
- for (const k of d.values())
131
- if (!k)
226
+ custom: r,
227
+ onExitComplete: (g) => {
228
+ u.set(g, !0);
229
+ for (const j of u.values())
230
+ if (!j)
132
231
  return;
133
232
  n && n();
134
233
  },
135
- register: (p) => (d.set(p, !1), () => d.delete(p))
136
- }), [s, d, n]);
137
- return a && h && (x = { ...x }), F(() => {
138
- d.forEach((p, k) => d.set(k, !1));
139
- }, [s]), q.useEffect(() => {
140
- !s && !d.size && n && n();
141
- }, [s]), l === "popLayout" && (t = e.jsx(Xe, { isPresent: s, anchorX: u, root: f, children: t })), e.jsx(ce.Provider, { value: x, children: t });
234
+ register: (g) => (u.set(g, !1), () => u.delete(g))
235
+ }), [s, u, n]);
236
+ return i && f && (m = { ...m }), L(() => {
237
+ u.forEach((g, j) => u.set(j, !1));
238
+ }, [s]), F.useEffect(() => {
239
+ !s && !u.size && n && n();
240
+ }, [s]), o === "popLayout" && (t = e.jsx(ct, { isPresent: s, anchorX: d, root: c, children: t })), e.jsx(fe.Provider, { value: m, children: t });
142
241
  };
143
- function Ze() {
242
+ function ut() {
144
243
  return /* @__PURE__ */ new Map();
145
244
  }
146
- function et(t = !0) {
147
- const r = H(ce);
148
- if (r === null)
245
+ function ft(t = !0) {
246
+ const a = V(fe);
247
+ if (a === null)
149
248
  return [!0, null];
150
- const { isPresent: s, onExitComplete: n, register: i } = r, a = _();
249
+ const { isPresent: s, onExitComplete: n, register: r } = a, i = H();
151
250
  re(() => {
152
251
  if (t)
153
- return i(a);
252
+ return r(i);
154
253
  }, [t]);
155
- const l = Ee(() => t && n && n(a), [a, n, t]);
156
- return !s && n ? [!1, l] : [!0];
254
+ const o = ke(() => t && n && n(i), [i, n, t]);
255
+ return !s && n ? [!1, o] : [!0];
157
256
  }
158
- const I = (t) => t.key || "";
159
- function te(t) {
160
- const r = [];
161
- return De.forEach(t, (s) => {
162
- Ne(s) && r.push(s);
163
- }), r;
257
+ const R = (t) => t.key || "";
258
+ function ie(t) {
259
+ const a = [];
260
+ return Ee.forEach(t, (s) => {
261
+ Ie(s) && a.push(s);
262
+ }), a;
164
263
  }
165
- const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presenceAffectsLayout: i = !0, mode: a = "sync", propagate: l = !1, anchorX: u = "left", root: f }) => {
166
- const [d, y] = et(l), h = F(() => te(t), [t]), x = l && !d ? [] : h.map(I), p = N(!0), k = N(h), m = le(() => /* @__PURE__ */ new Map()), [K, o] = D(h), [c, j] = D(h);
167
- He(() => {
168
- p.current = !1, k.current = h;
169
- for (let C = 0; C < c.length; C++) {
170
- const g = I(c[C]);
171
- x.includes(g) ? m.delete(g) : m.get(g) !== !0 && m.set(g, !1);
264
+ const pt = ({ children: t, custom: a, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: i = "sync", propagate: o = !1, anchorX: d = "left", root: c }) => {
265
+ const [u, p] = ft(o), f = L(() => ie(t), [t]), m = o && !u ? [] : f.map(R), g = A(!0), j = A(f), l = ue(() => /* @__PURE__ */ new Map()), [x, v] = I(f), [h, C] = I(f);
266
+ st(() => {
267
+ g.current = !1, j.current = f;
268
+ for (let w = 0; w < h.length; w++) {
269
+ const y = R(h[w]);
270
+ m.includes(y) ? l.delete(y) : l.get(y) !== !0 && l.set(y, !1);
172
271
  }
173
- }, [c, x.length, x.join("-")]);
174
- const w = [];
175
- if (h !== K) {
176
- let C = [...h];
177
- for (let g = 0; g < c.length; g++) {
178
- const E = c[g], z = I(E);
179
- x.includes(z) || (C.splice(g, 0, E), w.push(E));
272
+ }, [h, m.length, m.join("-")]);
273
+ const b = [];
274
+ if (f !== x) {
275
+ let w = [...f];
276
+ for (let y = 0; y < h.length; y++) {
277
+ const K = h[y], $ = R(K);
278
+ m.includes($) || (w.splice(y, 0, K), b.push(K));
180
279
  }
181
- return a === "wait" && w.length && (C = w), j(te(C)), o(h), null;
280
+ return i === "wait" && b.length && (w = b), C(ie(w)), v(f), null;
182
281
  }
183
- process.env.NODE_ENV !== "production" && a === "wait" && c.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
184
- const { forceRender: b } = H(Qe);
185
- return e.jsx(e.Fragment, { children: c.map((C) => {
186
- const g = I(C), E = l && !d ? !1 : h === c || x.includes(g), z = () => {
187
- if (m.has(g))
188
- m.set(g, !0);
282
+ process.env.NODE_ENV !== "production" && i === "wait" && h.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
283
+ const { forceRender: pe } = V(et);
284
+ return e.jsx(e.Fragment, { children: h.map((w) => {
285
+ const y = R(w), K = o && !u ? !1 : f === h || m.includes(y), $ = () => {
286
+ if (l.has(y))
287
+ l.set(y, !0);
189
288
  else
190
289
  return;
191
- let X = !0;
192
- m.forEach((de) => {
193
- de || (X = !1);
194
- }), X && (b?.(), j(k.current), l && y?.(), n && n());
290
+ let ee = !0;
291
+ l.forEach((he) => {
292
+ he || (ee = !1);
293
+ }), ee && (pe?.(), C(j.current), o && p?.(), n && n());
195
294
  };
196
- return e.jsx(Ye, { isPresent: E, initial: !p.current || s ? void 0 : !1, custom: r, presenceAffectsLayout: i, mode: a, root: f, onExitComplete: E ? void 0 : z, anchorX: u, children: C }, g);
295
+ return e.jsx(dt, { isPresent: K, initial: !g.current || s ? void 0 : !1, custom: a, presenceAffectsLayout: r, mode: i, root: c, onExitComplete: K ? void 0 : $, anchorX: d, children: w }, y);
197
296
  }) });
198
- }, st = ({
199
- service: t,
200
- onOpenChange: r
297
+ }, ht = ({
298
+ apiKey: t,
299
+ onDeleteKey: a,
300
+ className: s
201
301
  }) => {
202
- const s = ne(), n = ie(), i = je(), a = ze({
203
- defaultValues: {
204
- expiresOn: "30"
205
- }
206
- }), l = Fe(), u = T({
207
- mutationFn: ({ description: f, expiresOn: d }) => {
208
- if (!t.createKey)
209
- throw new Error("createKey not implemented");
210
- const y = d !== "never" ? nt(Number(d)) : void 0;
211
- return t.createKey({
212
- apiKey: {
213
- description: f || "Secret Key",
214
- expiresOn: y
215
- },
216
- context: s,
217
- auth: l
218
- });
219
- },
220
- onSuccess: async () => {
221
- await n.invalidateQueries({ queryKey: ["api-keys"] }), await i("/settings/api-keys/");
222
- }
223
- });
224
- return t.createKey ? /* @__PURE__ */ e.jsxs(
225
- "form",
226
- {
227
- onSubmit: a.handleSubmit(
228
- (f) => u.mutate(
229
- { ...f },
230
- {
231
- onSuccess: () => r(!1)
232
- }
233
- )
302
+ const [n, r] = I(!1), { key: i, createdOn: o, expiresOn: d } = t, c = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
303
+ (new Date(d).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
304
+ ) : 1 / 0, p = u <= 7 && !c;
305
+ return /* @__PURE__ */ e.jsxs("div", { className: X("grid col-span-full grid-cols-subgrid p-6", s), children: [
306
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
307
+ /* @__PURE__ */ e.jsx(
308
+ Ge,
309
+ {
310
+ className: "max-w-fit w-full",
311
+ secret: i,
312
+ status: c ? "expired" : p ? "expiring" : "active",
313
+ revealed: n,
314
+ onReveal: r
315
+ }
234
316
  ),
235
- children: [
236
- u.error && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
237
- /* @__PURE__ */ e.jsx(M, { children: "Error" }),
238
- /* @__PURE__ */ e.jsx(Pe, { children: u.error.message })
317
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
318
+ o && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
319
+ "Created ",
320
+ mt(o),
321
+ "."
239
322
  ] }),
240
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
241
- "Name",
242
- /* @__PURE__ */ e.jsx(oe, { ...a.register("description") }),
243
- "Expiration",
244
- /* @__PURE__ */ e.jsxs(
245
- Re,
323
+ " ",
324
+ d && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
325
+ "Expires in ",
326
+ u,
327
+ " ",
328
+ u === 1 ? "day" : "days",
329
+ "."
330
+ ] }),
331
+ d && c && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
332
+ "Expired",
333
+ " ",
334
+ u === 0 ? "today." : `${u * -1} days ago.`
335
+ ] })
336
+ ] })
337
+ ] }),
338
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && a && /* @__PURE__ */ e.jsxs(G, { children: [
339
+ /* @__PURE__ */ e.jsx(J, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(me, { size: 16 }) }) }),
340
+ /* @__PURE__ */ e.jsxs(Y, { children: [
341
+ /* @__PURE__ */ e.jsxs(U, { children: [
342
+ /* @__PURE__ */ e.jsx(W, { children: "Delete API Key" }),
343
+ /* @__PURE__ */ e.jsx(le, { children: "Are you sure you want to delete this API key?" })
344
+ ] }),
345
+ /* @__PURE__ */ e.jsxs(Z, { children: [
346
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
347
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
348
+ k,
246
349
  {
247
- onValueChange: (f) => a.setValue("expiresOn", f),
248
- defaultValue: a.getValues("expiresOn"),
249
- children: [
250
- /* @__PURE__ */ e.jsx(Se, { children: /* @__PURE__ */ e.jsx(Te, {}) }),
251
- /* @__PURE__ */ e.jsx(Oe, { children: /* @__PURE__ */ e.jsxs(Me, { children: [
252
- [7, 30, 60, 90].map((f) => /* @__PURE__ */ e.jsxs(Z, { value: String(f), children: [
253
- f,
254
- " days"
255
- ] }, f)),
256
- /* @__PURE__ */ e.jsx(Z, { value: "never", children: "Never" })
257
- ] }) })
258
- ]
350
+ onClick: () => {
351
+ a();
352
+ },
353
+ children: "Delete"
259
354
  }
260
- ),
261
- /* @__PURE__ */ e.jsxs(V, { children: [
262
- /* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(v, { variant: "outline", children: "Cancel" }) }),
263
- /* @__PURE__ */ e.jsx($e, { isPending: u.isPending, children: "Generate Key" })
264
- ] })
355
+ ) })
265
356
  ] })
266
- ]
267
- }
268
- ) : null;
269
- }, nt = (t) => {
270
- const r = /* @__PURE__ */ new Date();
271
- return r.setDate(r.getDate() + t), r.toISOString();
272
- }, se = ({
273
- service: t,
274
- isOpen: r,
275
- onOpenChange: s,
276
- trigger: n,
277
- buttonVariant: i = "outline"
278
- }) => {
279
- const a = /* @__PURE__ */ e.jsx(v, { variant: i, children: "Create API Key" });
280
- return /* @__PURE__ */ e.jsxs(B, { open: r, onOpenChange: s, children: [
281
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: n ?? a }),
282
- /* @__PURE__ */ e.jsxs(J, { children: [
283
- /* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(W, { children: "Create API Key" }) }),
284
- /* @__PURE__ */ e.jsx(st, { service: t, onOpenChange: s })
285
- ] })
357
+ ] })
358
+ ] }) })
286
359
  ] });
287
- }, it = ({ service: t }) => {
288
- const r = ne(), s = ie(), [n, i] = D(
289
- null
290
- ), [a, l] = D(""), { data: u, isFetching: f } = we({
291
- queryFn: () => t.getConsumers(r),
292
- queryKey: ["api-keys"],
293
- retry: !1
294
- }), [d, y] = D(!1), h = T({
360
+ }, mt = (t) => {
361
+ const a = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((a.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
362
+ return n < 60 ? r.format(-n, "second") : n < 3600 ? r.format(-Math.floor(n / 60), "minute") : n < 86400 ? r.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? r.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? r.format(-Math.floor(n / 2592e3), "month") : r.format(-Math.floor(n / 31536e3), "year");
363
+ }, xt = ({
364
+ consumer: t,
365
+ onUpdate: a,
366
+ onRollKey: s,
367
+ onDeleteKey: n
368
+ }) => {
369
+ const [r, i] = I(!1), [o, d] = I(t.label), c = ce(), u = B(), p = q({
370
+ mutationFn: async (l) => {
371
+ if (!s)
372
+ throw new Error("rollKey not implemented");
373
+ return await s?.(l, u);
374
+ },
375
+ onSuccess: () => void c.invalidateQueries({ queryKey: ["api-keys"] })
376
+ }), f = q({
295
377
  mutationFn: ({
296
- consumerId: o,
297
- keyId: c
378
+ consumerId: l,
379
+ keyId: x
298
380
  }) => {
299
- if (!t.deleteKey)
381
+ if (!n)
300
382
  throw new Error("deleteKey not implemented");
301
- return t.deleteKey(o, c, r);
383
+ return n(l, x, u);
302
384
  },
303
- onMutate: async ({ consumerId: o, keyId: c }) => {
304
- await s.cancelQueries({ queryKey: ["api-keys"] });
305
- const j = s.getQueryData([
385
+ onMutate: async ({ consumerId: l, keyId: x }) => {
386
+ await c.cancelQueries({ queryKey: ["api-keys"] });
387
+ const v = c.getQueryData([
306
388
  "api-keys"
307
389
  ]);
308
- return s.setQueryData(["api-keys"], (w) => w && w.map((b) => b.id === o ? {
309
- ...b,
310
- apiKeys: b.apiKeys.filter((C) => C.id !== c)
311
- } : b)), { previousData: j };
390
+ return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
391
+ ...C,
392
+ apiKeys: C.apiKeys.filter((b) => b.id !== x)
393
+ } : C)), { previousData: v };
312
394
  },
313
- onError: (o, c, j) => {
314
- j?.previousData && s.setQueryData(["api-keys"], j.previousData);
395
+ onError: (l, x, v) => {
396
+ v?.previousData && c.setQueryData(["api-keys"], v.previousData);
315
397
  },
316
398
  onSuccess: () => {
317
- s.invalidateQueries({ queryKey: ["api-keys"] });
399
+ c.invalidateQueries({ queryKey: ["api-keys"] });
318
400
  }
319
- }), x = T({
401
+ }), m = q({
320
402
  mutationFn: ({
321
- consumerId: o,
322
- label: c
403
+ consumerId: l,
404
+ label: x
323
405
  }) => {
324
- if (!t.updateConsumer)
406
+ if (!a)
325
407
  throw new Error("updateConsumer not implemented");
326
- return t.updateConsumer({ id: o, label: c }, r);
408
+ return a({ id: l, label: x }, u);
327
409
  },
328
- onMutate: async ({ consumerId: o, label: c }) => {
329
- await s.cancelQueries({ queryKey: ["api-keys"] });
330
- const j = s.getQueryData(["api-keys"]);
331
- return s.setQueryData(["api-keys"], (w) => w && w.map((b) => b.id === o ? {
332
- ...b,
333
- label: c
334
- } : b)), { previousData: j };
410
+ onMutate: async ({ consumerId: l, label: x }) => {
411
+ await c.cancelQueries({ queryKey: ["api-keys"] });
412
+ const v = c.getQueryData(["api-keys"]);
413
+ return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
414
+ ...C,
415
+ label: x
416
+ } : C)), { previousData: v };
335
417
  },
336
- onError: (o, c, j) => {
337
- j?.previousData && s.setQueryData(["api-keys"], j.previousData);
418
+ onError: (l, x, v) => {
419
+ v?.previousData && c.setQueryData(["api-keys"], v.previousData);
338
420
  },
339
421
  onSuccess: () => {
340
- s.invalidateQueries({ queryKey: ["api-keys"] });
422
+ c.invalidateQueries({ queryKey: ["api-keys"] });
341
423
  }
342
- }), p = T({
343
- mutationFn: (o) => {
344
- if (!t.rollKey)
345
- throw new Error("rollKey not implemented");
346
- return t.rollKey(o, r);
347
- },
348
- onSuccess: () => s.invalidateQueries({ queryKey: ["api-keys"] })
349
- }), k = (o, c) => {
350
- i(o), l(c);
351
- }, m = (o) => {
352
- a.trim() && x.mutate({
353
- consumerId: o,
354
- label: a.trim()
355
- }), i(null), l("");
356
- }, K = () => {
357
- i(null), l("");
424
+ }), g = () => {
425
+ i(!0), d(t.label);
426
+ }, j = () => {
427
+ o.trim() && m.mutate({
428
+ label: o.trim(),
429
+ consumerId: t.id
430
+ }), i(!1);
358
431
  };
359
- return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-md h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
360
- /* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page" }),
361
- /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
362
- /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
363
- t.createKey && /* @__PURE__ */ e.jsx(
364
- se,
365
- {
366
- service: t,
367
- isOpen: d,
368
- onOpenChange: y
369
- }
370
- )
371
- ] }),
372
- /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
373
- /* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page-before-keys" }),
374
- /* @__PURE__ */ e.jsx("div", { className: "h-8" }),
375
- p.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
376
- /* @__PURE__ */ e.jsx($, { size: 16 }),
377
- /* @__PURE__ */ e.jsx(M, { children: p.error.message })
432
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
433
+ p.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
434
+ /* @__PURE__ */ e.jsx(z, { size: 16 }),
435
+ /* @__PURE__ */ e.jsx(P, { children: p.error.message })
378
436
  ] }),
379
- x.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
380
- /* @__PURE__ */ e.jsx($, { size: 16 }),
381
- /* @__PURE__ */ e.jsx(M, { children: x.error.message })
437
+ m.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
438
+ /* @__PURE__ */ e.jsx(z, { size: 16 }),
439
+ /* @__PURE__ */ e.jsx(P, { children: m.error.message })
382
440
  ] }),
383
- h.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
384
- /* @__PURE__ */ e.jsx($, { size: 16 }),
385
- /* @__PURE__ */ e.jsx(M, { children: h.error.message })
441
+ f.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
442
+ /* @__PURE__ */ e.jsx(z, { size: 16 }),
443
+ /* @__PURE__ */ e.jsx(P, { children: f.error.message })
386
444
  ] }),
387
- /* @__PURE__ */ e.jsx("div", { className: "", children: u.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
388
- /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
389
- "You have no API keys yet.",
390
- /* @__PURE__ */ e.jsx("br", {}),
391
- t.createKey && "Get started and create your first key."
392
- ] }),
393
- t.createKey && /* @__PURE__ */ e.jsx(
394
- se,
395
- {
396
- service: t,
397
- isOpen: d,
398
- onOpenChange: y
399
- }
400
- )
401
- ] }) : /* @__PURE__ */ e.jsx(
402
- "ul",
445
+ /* @__PURE__ */ e.jsxs(
446
+ Pe,
403
447
  {
404
- className: L(
405
- "grid grid-cols-[1fr_min-content] divide-y divide-border col-span-6"
406
- ),
407
- children: u.map((o) => /* @__PURE__ */ e.jsxs(
408
- Ae,
409
- {
410
- className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
411
- children: [
412
- /* @__PURE__ */ e.jsxs(Ie, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
413
- /* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
414
- /* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
415
- n === o.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
448
+ className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
449
+ children: [
450
+ /* @__PURE__ */ e.jsxs(Ae, { className: "col-span-full flex-row items-start justify-between gap-4", children: [
451
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
452
+ r ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
453
+ /* @__PURE__ */ e.jsx(
454
+ Ye,
455
+ {
456
+ maxLength: 32,
457
+ value: o,
458
+ onChange: (l) => d(l.target.value),
459
+ onKeyDown: (l) => {
460
+ l.key === "Enter" ? j() : l.key === "Escape" && i(!1);
461
+ },
462
+ autoFocus: !0
463
+ }
464
+ ),
465
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
466
+ /* @__PURE__ */ e.jsx(
467
+ k,
468
+ {
469
+ size: "icon",
470
+ variant: "ghost",
471
+ onClick: j,
472
+ disabled: !o.trim(),
473
+ children: /* @__PURE__ */ e.jsx(xe, { size: 16 })
474
+ }
475
+ ),
476
+ /* @__PURE__ */ e.jsx(
477
+ k,
478
+ {
479
+ size: "icon",
480
+ variant: "ghost",
481
+ onClick: () => i(!1),
482
+ children: /* @__PURE__ */ e.jsx(ye, { size: 16 })
483
+ }
484
+ )
485
+ ] })
486
+ ] }) : /* @__PURE__ */ e.jsx(Se, { children: t.label }),
487
+ /* @__PURE__ */ e.jsxs(Re, { children: [
488
+ t.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
489
+ "Created on ",
490
+ new Date(t.createdOn).toLocaleDateString()
491
+ ] }),
492
+ t.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
493
+ "Expires on ",
494
+ new Date(t.expiresOn).toLocaleDateString()
495
+ ] })
496
+ ] })
497
+ ] }),
498
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
499
+ a && /* @__PURE__ */ e.jsxs(
500
+ k,
501
+ {
502
+ variant: "ghost",
503
+ onClick: g,
504
+ className: X(
505
+ "flex gap-2",
506
+ r && "opacity-0! pointer-events-none"
507
+ ),
508
+ disabled: r,
509
+ children: [
510
+ /* @__PURE__ */ e.jsx(ge, { size: 16 }),
511
+ /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
512
+ ]
513
+ }
514
+ ),
515
+ s && /* @__PURE__ */ e.jsxs(G, { children: [
516
+ /* @__PURE__ */ e.jsx(J, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
517
+ k,
518
+ {
519
+ title: "Roll this key",
520
+ variant: "ghost",
521
+ disabled: p.isPending,
522
+ className: "flex items-center gap-2",
523
+ children: [
416
524
  /* @__PURE__ */ e.jsx(
417
- oe,
525
+ je,
418
526
  {
419
- maxLength: 32,
420
- value: a,
421
- onChange: (c) => l(c.target.value),
422
- onKeyDown: (c) => {
423
- c.key === "Enter" ? m(o.id) : c.key === "Escape" && K();
424
- },
425
- className: "text-lg font-medium",
426
- autoFocus: !0
527
+ size: 16,
528
+ className: p.isPending ? "animate-spin" : void 0
427
529
  }
428
530
  ),
429
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
430
- /* @__PURE__ */ e.jsx(
431
- v,
432
- {
433
- size: "icon",
434
- variant: "ghost",
435
- onClick: () => m(o.id),
436
- disabled: !a.trim(),
437
- children: /* @__PURE__ */ e.jsx(ue, { size: 16 })
438
- }
439
- ),
440
- /* @__PURE__ */ e.jsx(
441
- v,
442
- {
443
- size: "icon",
444
- variant: "ghost",
445
- onClick: K,
446
- children: /* @__PURE__ */ e.jsx(fe, { size: 16 })
447
- }
448
- )
449
- ] })
450
- ] }) : o.label,
451
- /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: o.createdOn })
531
+ /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
532
+ ]
533
+ }
534
+ ) }),
535
+ /* @__PURE__ */ e.jsxs(Y, { children: [
536
+ /* @__PURE__ */ e.jsxs(U, { children: [
537
+ /* @__PURE__ */ e.jsx(W, { children: "Roll API Key" }),
538
+ /* @__PURE__ */ e.jsx(le, { children: "Are you sure you want to roll this API key?" })
452
539
  ] }),
453
- /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-xs", children: [
454
- o.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
455
- "Created on",
456
- " ",
457
- new Date(o.createdOn).toLocaleDateString()
458
- ] }),
459
- o.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
460
- "Expires on",
461
- " ",
462
- new Date(o.expiresOn).toLocaleDateString()
463
- ] })
464
- ] })
465
- ] }),
466
- /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
467
- t.updateConsumer && /* @__PURE__ */ e.jsxs(
468
- v,
469
- {
470
- variant: "ghost",
471
- onClick: () => k(o.id, o.label),
472
- className: L(
473
- "flex gap-2",
474
- n === o.id && "opacity-0! pointer-events-none"
475
- ),
476
- disabled: n === o.id,
477
- children: [
478
- /* @__PURE__ */ e.jsx(he, { size: 16 }),
479
- /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
480
- ]
481
- }
482
- ),
483
- t.rollKey && /* @__PURE__ */ e.jsxs(B, { children: [
484
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
485
- v,
540
+ /* @__PURE__ */ e.jsxs(Z, { children: [
541
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
542
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
543
+ k,
486
544
  {
487
- title: "Roll this key",
488
- variant: "ghost",
489
- disabled: p.isPending,
490
- className: "flex items-center gap-2",
491
- children: [
492
- /* @__PURE__ */ e.jsx(
493
- pe,
494
- {
495
- size: 16,
496
- className: p.isPending ? "animate-spin" : void 0
497
- }
498
- ),
499
- /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
500
- ]
545
+ onClick: () => {
546
+ p.mutate(t.id);
547
+ },
548
+ children: "Roll Key"
501
549
  }
502
- ) }),
503
- /* @__PURE__ */ e.jsxs(J, { children: [
504
- /* @__PURE__ */ e.jsxs(U, { children: [
505
- /* @__PURE__ */ e.jsx(W, { children: "Roll API Key" }),
506
- /* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to roll this API key?" })
507
- ] }),
508
- /* @__PURE__ */ e.jsxs(V, { children: [
509
- /* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(v, { variant: "outline", children: "Cancel" }) }),
510
- /* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(
511
- v,
512
- {
513
- onClick: () => {
514
- p.mutate(o.id);
515
- },
516
- children: "Roll Key"
517
- }
518
- ) })
519
- ] })
520
- ] })
550
+ ) })
521
551
  ] })
522
552
  ] })
523
- ] }),
524
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(tt, { children: o.apiKeys.map((c) => /* @__PURE__ */ e.jsxs(ke.Fragment, { children: [
525
- /* @__PURE__ */ e.jsx(
526
- at,
527
- {
528
- apiKey: c,
529
- onDeleteKey: () => {
530
- h.mutate({
531
- consumerId: o.id,
532
- keyId: c.id
533
- });
534
- },
535
- className: h.variables?.keyId === c.id && (h.isPending || f) ? "opacity-10!" : void 0
536
- }
537
- ),
538
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
539
- ] }, c.id)) }) })
540
- ]
541
- },
542
- o.id
543
- ))
544
- }
545
- ) })
553
+ ] })
554
+ ] })
555
+ ] }),
556
+ /* @__PURE__ */ e.jsx(Ne, { className: "p-0 grid grid-cols-subgrid col-span-full divide-y divide-border", children: /* @__PURE__ */ e.jsx(pt, { children: t.apiKeys.map((l) => /* @__PURE__ */ e.jsx(
557
+ ht,
558
+ {
559
+ apiKey: l,
560
+ onDeleteKey: () => {
561
+ f.mutate({
562
+ consumerId: t.id,
563
+ keyId: l.id
564
+ });
565
+ },
566
+ className: f.variables?.keyId === l.id && f.isPending ? "opacity-10!" : void 0
567
+ },
568
+ l.id
569
+ )) }) })
570
+ ]
571
+ },
572
+ t.id
573
+ )
546
574
  ] });
547
- }, rt = (t) => {
548
- const r = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((r.getTime() - s.getTime()) / 1e3), i = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
549
- return n < 60 ? i.format(-n, "second") : n < 3600 ? i.format(-Math.floor(n / 60), "minute") : n < 86400 ? i.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? i.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? i.format(-Math.floor(n / 2592e3), "month") : i.format(-Math.floor(n / 31536e3), "year");
550
- }, at = ({
551
- apiKey: t,
552
- onDeleteKey: r,
553
- className: s
554
- }) => {
555
- const [n, i] = D(!1), { key: a, createdOn: l, expiresOn: u } = t, f = u && new Date(u) < /* @__PURE__ */ new Date(), d = u ? Math.ceil(
556
- (new Date(u).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
557
- ) : 1 / 0, y = d <= 7 && !f;
558
- return /* @__PURE__ */ e.jsxs("div", { className: L("grid col-span-full grid-cols-subgrid p-6", s), children: [
559
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
560
- /* @__PURE__ */ e.jsx(
561
- qe,
575
+ }, yt = ({ service: t }) => {
576
+ const a = B(), { data: s } = $e({
577
+ queryFn: async () => {
578
+ try {
579
+ return await t.getConsumers(a);
580
+ } catch (i) {
581
+ throw i instanceof M ? i : new M("Cannot get API keys", {
582
+ cause: i,
583
+ title: "Error getting API keys",
584
+ developerHint: "Check the response of the API request for more information."
585
+ });
586
+ }
587
+ },
588
+ queryKey: ["api-keys"],
589
+ retry: !1
590
+ }), [n, r] = I(!1);
591
+ return /* @__PURE__ */ e.jsx("div", { className: "mt-8", children: s.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
592
+ /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
593
+ "You have no API keys yet.",
594
+ /* @__PURE__ */ e.jsx("br", {}),
595
+ t.createKey && "Get started and create your first key."
596
+ ] }),
597
+ t.createKey && /* @__PURE__ */ e.jsx(
598
+ de,
599
+ {
600
+ service: t,
601
+ isOpen: n,
602
+ onOpenChange: r
603
+ }
604
+ )
605
+ ] }) : /* @__PURE__ */ e.jsx("ul", { className: X("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((i) => /* @__PURE__ */ e.jsx(
606
+ xt,
607
+ {
608
+ consumer: i,
609
+ onUpdate: t.updateConsumer,
610
+ onRollKey: t.rollKey,
611
+ onDeleteKey: t.deleteKey
612
+ },
613
+ i.id
614
+ )) }) });
615
+ }, gt = ({ service: t }) => {
616
+ const [a, s] = I(!1), n = ae();
617
+ return /* @__PURE__ */ e.jsxs("div", { className: "max-w-3xl h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
618
+ /* @__PURE__ */ e.jsx(te.Target, { name: "api-keys-list-page" }),
619
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
620
+ /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
621
+ t.createKey && /* @__PURE__ */ e.jsx(
622
+ de,
562
623
  {
563
- className: "max-w-fit w-full",
564
- secret: a,
565
- status: f ? "expired" : y ? "expiring" : "active",
566
- revealed: n,
567
- onReveal: i
624
+ service: t,
625
+ isOpen: a,
626
+ onOpenChange: s
568
627
  }
569
- ),
570
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
571
- l && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
572
- "Created ",
573
- rt(l),
574
- "."
575
- ] }),
576
- " ",
577
- u && y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
578
- "Expires in ",
579
- d,
580
- " ",
581
- d === 1 ? "day" : "days",
582
- "."
583
- ] }),
584
- u && f && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
585
- "Expired",
586
- " ",
587
- d === 0 ? "today." : `${d * -1} days ago.`
588
- ] })
589
- ] })
628
+ )
590
629
  ] }),
591
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: u && r && /* @__PURE__ */ e.jsxs(B, { children: [
592
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsx(v, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(me, { size: 16 }) }) }),
593
- /* @__PURE__ */ e.jsxs(J, { children: [
594
- /* @__PURE__ */ e.jsxs(U, { children: [
595
- /* @__PURE__ */ e.jsx(W, { children: "Delete API Key" }),
596
- /* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to delete this API key?" })
597
- ] }),
598
- /* @__PURE__ */ e.jsxs(V, { children: [
599
- /* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(v, { variant: "outline", children: "Cancel" }) }),
600
- /* @__PURE__ */ e.jsx(P, { asChild: !0, children: /* @__PURE__ */ e.jsx(
601
- v,
602
- {
603
- onClick: () => {
604
- r();
605
- },
606
- children: "Delete"
607
- }
608
- ) })
609
- ] })
610
- ] })
611
- ] }) })
630
+ /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
631
+ /* @__PURE__ */ e.jsx(te.Target, { name: "api-keys-list-page-before-keys" }),
632
+ n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(Oe, { variant: "outline", children: [
633
+ /* @__PURE__ */ e.jsxs(Te, { children: [
634
+ /* @__PURE__ */ e.jsx(qe, { children: "Verified email required" }),
635
+ /* @__PURE__ */ e.jsx(Me, { children: "You need to verify your email to access API keys." })
636
+ ] }),
637
+ /* @__PURE__ */ e.jsx(Fe, { children: /* @__PURE__ */ e.jsx(_, { onClick: () => n.requestEmailVerification(), children: "Verify email" }) })
638
+ ] }) : /* @__PURE__ */ e.jsx(
639
+ De,
640
+ {
641
+ fallbackRender: ({ error: r }) => /* @__PURE__ */ e.jsx(Ue, { error: r }),
642
+ children: /* @__PURE__ */ e.jsx(yt, { service: t })
643
+ }
644
+ )
612
645
  ] });
613
- }, R = "https://api.zuploedge.com/v2/client", ot = async (t) => {
646
+ }, N = "https://api.zuploedge.com/v2/client", jt = async (t) => {
614
647
  try {
615
648
  return await t.json();
616
649
  } catch {
617
650
  return;
618
651
  }
619
- }, S = async (t) => {
620
- const r = t.headers.get("content-type");
621
- if (!t.ok && r?.includes("application/problem+json")) {
622
- const s = await ot(t);
652
+ }, O = async (t) => {
653
+ const a = t.headers.get("content-type");
654
+ if (!t.ok && a?.includes("application/problem+json")) {
655
+ const s = await jt(t);
623
656
  if (s.type && s.title)
624
657
  throw new Error(s.detail ?? s.title);
625
658
  }
626
- }, lt = (t, r) => ({
627
- deleteKey: async (s, n, i) => {
628
- const a = new Request(
629
- R + `/${t}/consumers/${s}/keys/${n}`,
659
+ }, T = {
660
+ developerHint: "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started with API Keys.",
661
+ title: "Not linked to a Zuplo deployment"
662
+ }, vt = ({
663
+ deploymentName: t,
664
+ ...a
665
+ }) => ({
666
+ deleteKey: async (s, n, r) => {
667
+ E(t, "Cannot delete API key.", T);
668
+ const i = new Request(
669
+ N + `/${t}/consumers/${s}/keys/${n}`,
630
670
  {
631
671
  method: "DELETE"
632
672
  }
633
- );
634
- await i.signRequest(a);
635
- const l = await fetch(a);
636
- await S(l), A(l.ok, "Failed to delete API key");
673
+ ), o = await fetch(await r.signRequest(i));
674
+ await O(o), E(o.ok, "Failed to delete API key");
637
675
  },
638
676
  updateConsumer: async (s, n) => {
639
- const i = await fetch(
677
+ E(
678
+ t,
679
+ "Cannot update API key description.",
680
+ T
681
+ );
682
+ const r = await fetch(
640
683
  await n.signRequest(
641
684
  new Request(
642
- R + `/${t}/consumers/${s.id}`,
685
+ `${N}/${t}/consumers/${s.id}`,
643
686
  {
644
687
  method: "PATCH",
645
688
  headers: {
@@ -652,13 +695,14 @@ const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
652
695
  )
653
696
  )
654
697
  );
655
- await S(i), A(i.ok, "Failed to update API key description");
698
+ await O(r), E(r.ok, "Failed to update API key description");
656
699
  },
657
700
  rollKey: async (s, n) => {
658
- const i = await fetch(
701
+ E(t, "Cannot roll API key.", T);
702
+ const r = await fetch(
659
703
  await n.signRequest(
660
704
  new Request(
661
- R + `/${t}/consumers/${s}/roll-key`,
705
+ `${N}/${t}/consumers/${s}/roll-key`,
662
706
  {
663
707
  method: "POST",
664
708
  headers: {
@@ -669,42 +713,59 @@ const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
669
713
  )
670
714
  )
671
715
  );
672
- await S(i), A(i.ok, "Failed to delete API key");
716
+ await O(r), E(r.ok, "Failed to roll API key");
673
717
  },
674
718
  getConsumers: async (s) => {
719
+ E(t, "Cannot get API keys.", T);
675
720
  const n = new Request(
676
- `${R}/${t}/consumers`
721
+ `${N}/${t}/consumers`
677
722
  );
678
723
  await s.signRequest(n);
679
- const i = await fetch(n);
680
- return await S(i), A(i.ok, "Failed to fetch API keys"), (await i.json()).data.map((l) => ({
681
- id: l.id,
682
- label: l.label || l.subject || "API Key",
683
- apiKeys: l.apiKeys.data,
684
- key: l.apiKeys.data.at(0)
724
+ const r = await fetch(n);
725
+ return await O(r), E(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((o) => ({
726
+ id: o.id,
727
+ createdOn: o.createdOn,
728
+ updatedOn: o.updatedOn,
729
+ expiresOn: o.expiresOn,
730
+ label: o.label || o.subject || "API Key",
731
+ apiKeys: o.apiKeys.data,
732
+ key: o.apiKeys.data.at(0)
685
733
  }));
686
734
  },
687
- ...r
688
- }), Pt = (t) => t, At = (t) => {
689
- const r = "deploymentName" in t ? lt(t.deploymentName, t) : t;
735
+ ...a
736
+ }), Ht = (t) => t, Vt = ({
737
+ deploymentName: t,
738
+ isZuplo: a,
739
+ ...s
740
+ }) => {
741
+ a && !t && console.warn(
742
+ "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started."
743
+ );
744
+ const n = a ? vt({ deploymentName: t, ...s }) : s;
745
+ if (!n.getConsumers)
746
+ throw new Error("getConsumers is required when using the apiKeyPlugin");
747
+ const r = {
748
+ ...n,
749
+ getConsumers: n.getConsumers
750
+ };
690
751
  return {
691
752
  getProfileMenuItems: () => [
692
753
  {
693
754
  label: "API Keys",
694
755
  path: "/settings/api-keys",
695
756
  category: "middle",
696
- icon: xe
757
+ icon: ve
697
758
  }
698
759
  ],
699
- getIdentities: async (s) => {
760
+ getIdentities: async (i) => {
700
761
  try {
701
- return (await r.getConsumers(s)).map((i) => ({
702
- authorizeRequest: (a) => (a.headers.set(
762
+ return (await r.getConsumers(i)).map((d) => ({
763
+ authorizeRequest: (c) => (c.headers.set(
703
764
  "Authorization",
704
- `Bearer ${i.apiKeys.at(0)?.key}`
705
- ), a),
706
- id: i.id,
707
- label: i.label
765
+ `Bearer ${d.apiKeys.at(0)?.key}`
766
+ ), c),
767
+ id: d.id,
768
+ label: d.label
708
769
  }));
709
770
  } catch {
710
771
  return [];
@@ -712,20 +773,15 @@ const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
712
773
  },
713
774
  getRoutes: () => [
714
775
  {
715
- element: /* @__PURE__ */ e.jsx(Le, {}),
716
- errorElement: /* @__PURE__ */ e.jsx(ye, {}),
717
- children: [
718
- {
719
- path: "/settings/api-keys",
720
- element: /* @__PURE__ */ e.jsx(it, { service: r })
721
- }
722
- ]
776
+ path: "/settings/api-keys",
777
+ element: /* @__PURE__ */ e.jsx(gt, { service: r })
723
778
  }
724
- ]
779
+ ],
780
+ getProtectedRoutes: () => ["/settings/api-keys"]
725
781
  };
726
782
  };
727
783
  export {
728
- At as apiKeyPlugin,
729
- Pt as createApiKeyService
784
+ Vt as apiKeyPlugin,
785
+ Ht as createApiKeyService
730
786
  };
731
787
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map