@hot-updater/console 0.36.7 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/BundleIdDisplay-D4ErdU5_.js +1 -0
  3. package/.output/public/assets/InsightsCapabilityContext-B42VqvP6.js +1 -0
  4. package/.output/public/assets/api-keys-api-DGVTTvTJ.js +1 -0
  5. package/.output/public/assets/api-keys-z16OZIP4.js +1 -0
  6. package/.output/public/assets/badge-Br_KDO0J.js +1 -0
  7. package/.output/public/assets/card-DzuEXvyJ.js +1 -0
  8. package/.output/public/assets/chart-no-axes-combined-FaYMGmQS.js +1 -0
  9. package/.output/public/assets/createServerFn-gM2-LFBy.js +3 -0
  10. package/.output/public/assets/dialog-BeAENgez.js +1 -0
  11. package/.output/public/assets/dist-Bssh_cv0.js +1 -0
  12. package/.output/public/assets/field-Buq148-A.js +1 -0
  13. package/.output/public/assets/index-uOpQAIC4.js +10 -0
  14. package/.output/public/assets/input-group-B3p5UpyW.js +1 -0
  15. package/.output/public/assets/insights-DJTr7Ozn.js +1 -0
  16. package/.output/public/assets/insights-api-DVMOoRMS.js +1 -0
  17. package/.output/public/assets/installations-BY64iIAK.js +2 -0
  18. package/.output/public/assets/installations-D5v9i3AL.js +1 -0
  19. package/.output/public/assets/lazyRouteComponent-DKYu5cZJ.js +1 -0
  20. package/.output/public/assets/preload-helper-CQ36nxok.js +1 -0
  21. package/.output/public/assets/refresh-cw-BkbfZ62O.js +1 -0
  22. package/.output/public/assets/routes-BuoI5-Cr.js +2 -0
  23. package/.output/public/assets/routes-C8fvgETO.js +1 -0
  24. package/.output/public/assets/search-qsIDvS2I.js +1 -0
  25. package/.output/public/assets/shield-check-DE_hVuHu.js +1 -0
  26. package/.output/public/assets/signing-mJD88Y4C.js +1 -0
  27. package/.output/public/assets/styles-BZIG7t42.css +2 -0
  28. package/.output/public/assets/table-RamFEclP.js +1 -0
  29. package/.output/public/assets/useCompositeListItem-ChzDqdpc.js +42 -0
  30. package/.output/public/assets/useMutation-JsGVjQMY.js +1 -0
  31. package/.output/public/assets/useOpenInteractionType-Dwfy-SpA.js +1 -0
  32. package/.output/server/__23tanstack-start-server-fn-resolver-Dftxlm2E.mjs +146 -0
  33. package/.output/server/_libs/@base-ui/react+[...].mjs +16124 -0
  34. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1554 -0
  35. package/.output/server/_libs/@tanstack/react-router+[...].mjs +41 -10
  36. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +132 -0
  37. package/.output/server/_libs/d3-array.mjs +231 -0
  38. package/.output/server/_libs/d3-color.mjs +330 -0
  39. package/.output/server/_libs/d3-format.mjs +252 -0
  40. package/.output/server/_libs/d3-interpolate.mjs +207 -0
  41. package/.output/server/_libs/d3-path.mjs +77 -0
  42. package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
  43. package/.output/server/_libs/d3-shape.mjs +818 -0
  44. package/.output/server/_libs/decimal.js-light.mjs +884 -0
  45. package/.output/server/_libs/es-toolkit.mjs +1134 -0
  46. package/.output/server/_libs/eventemitter3.mjs +236 -0
  47. package/.output/server/_libs/immer.mjs +532 -0
  48. package/.output/server/_libs/lucide-react.mjs +141 -13
  49. package/.output/server/_libs/next-themes.mjs +2 -2
  50. package/.output/server/_libs/react-redux+[...].mjs +205 -0
  51. package/.output/server/_libs/recharts+[...].mjs +14117 -0
  52. package/.output/server/_libs/sonner.mjs +2 -2
  53. package/.output/server/_libs/tanstack__query-core.mjs +114 -1
  54. package/.output/server/_libs/tanstack__react-query.mjs +3 -4
  55. package/.output/server/_runtime.mjs +10 -1
  56. package/.output/server/_ssr/BundleActivityChart-CWcdPuUn.mjs +288 -0
  57. package/.output/server/_ssr/BundleIdDisplay-BEvB3MvA.mjs +13 -0
  58. package/.output/server/_ssr/InsightsCapabilityContext-Cx8fjm2s.mjs +15 -0
  59. package/.output/server/_ssr/api-keys-CpBqHpuC.mjs +300 -0
  60. package/.output/server/_ssr/api-keys-api-Czkp57UV.mjs +60 -0
  61. package/.output/server/_ssr/api-keys-rpc-BTtMDSoR.mjs +136 -0
  62. package/.output/server/_ssr/api-rpc-BEX8ISai.mjs +1468 -0
  63. package/.output/server/_ssr/auth-BF8mbAgF.mjs +21 -0
  64. package/.output/server/_ssr/auth-rpc-BFMEC-TT.mjs +24 -0
  65. package/.output/server/_ssr/auth.server-DW71WzsD.mjs +47 -0
  66. package/.output/server/_ssr/badge-CpWXQwyF.mjs +26 -0
  67. package/.output/server/_ssr/bundle-signing-rpc-BbCFUQSu.mjs +16 -0
  68. package/.output/server/_ssr/bundle-signing.server-C4NW5mWx.mjs +12 -0
  69. package/.output/server/_ssr/card-Bsc8mRis.mjs +86 -0
  70. package/.output/server/_ssr/config-Dv8qLDZ0.mjs +13 -0
  71. package/.output/server/_ssr/config.server-DQYEr_5X.mjs +361 -0
  72. package/.output/server/_ssr/{createServerFn-DzU0k62V.mjs → createServerFn-B2hcXoPM.mjs} +1 -1
  73. package/.output/server/_ssr/createServerRpc-DB29C_5p.mjs +12 -0
  74. package/.output/server/_ssr/{sidebar-Cv_H0_Jv.mjs → createSsrRpc-DhfrxEjg.mjs} +68 -50
  75. package/.output/server/_ssr/databaseRows-QlCYLi0H.mjs +166 -0
  76. package/.output/server/_ssr/deleteBundle-Cu_XOMt0.mjs +66 -0
  77. package/.output/server/_ssr/dialog-C0vKUp8R.mjs +170 -0
  78. package/.output/server/_ssr/dist-BVSLTpoP.mjs +250 -0
  79. package/.output/server/_ssr/downloadBundle-CNnYxYO2.mjs +24 -0
  80. package/.output/server/_ssr/{empty-plugin-adapters-B4HCzgmM.mjs → empty-plugin-adapters-B5QvGpEl.mjs} +1 -1
  81. package/.output/server/_ssr/field-DASCh-5d.mjs +74 -0
  82. package/.output/server/_ssr/{getBundleChildren-CVtSiH5t.mjs → getBundleChildren-BcRMFoDF.mjs} +10 -18
  83. package/.output/server/_ssr/input-group-etIsBUqv.mjs +288 -0
  84. package/.output/server/_ssr/insights-api-C1F7UreR.mjs +71 -0
  85. package/.output/server/_ssr/insights-input-9fEJF-ZG.mjs +96 -0
  86. package/.output/server/_ssr/insights-rpc-C-8R6kED.mjs +155 -0
  87. package/.output/server/_ssr/insights-ygT_aIfo.mjs +858 -0
  88. package/.output/server/_ssr/installations-DqRT1QTd.mjs +535 -0
  89. package/.output/server/_ssr/installations-K8TCYTYh.mjs +19 -0
  90. package/.output/server/_ssr/router-BxBEvtF1.mjs +513 -0
  91. package/.output/server/_ssr/routes-BC7rn-tf.mjs +37 -0
  92. package/.output/server/_ssr/routes-CM5KAwpB.mjs +2285 -0
  93. package/.output/server/_ssr/runtime.server-la7TRAH_.mjs +527 -0
  94. package/.output/server/_ssr/server-CpzW--lT.mjs +7468 -0
  95. package/.output/server/_ssr/signing-jk4HANnl.mjs +134 -0
  96. package/.output/server/_ssr/ssr.mjs +4 -5740
  97. package/.output/server/_ssr/start-DpViQGnt.mjs +4 -0
  98. package/.output/server/_ssr/table-CU58HeI7.mjs +53 -0
  99. package/.output/server/_ssr/uuidv7-CaKuKXrV.mjs +31 -0
  100. package/.output/server/_tanstack-start-manifest_v-Mz9MmSlD.mjs +103 -0
  101. package/.output/server/index.mjs +229 -47
  102. package/README.md +29 -8
  103. package/lib/index.d.mts +35 -0
  104. package/lib/index.mjs +4 -0
  105. package/lib/vite-internal.mjs +127 -0
  106. package/lib/vite.d.mts +10 -0
  107. package/lib/vite.mjs +5 -0
  108. package/package.json +51 -29
  109. package/public/apple-touch-icon.png +0 -0
  110. package/public/favicon-16x16.png +0 -0
  111. package/public/favicon-32x32.png +0 -0
  112. package/public/favicon.ico +0 -0
  113. package/public/logo.svg +1 -0
  114. package/public/manifest.json +30 -0
  115. package/public/robots.txt +3 -0
  116. package/src/components/AppSidebar.tsx +159 -0
  117. package/src/components/BundleIdDisplay.tsx +18 -0
  118. package/src/components/ChannelBadge.tsx +31 -0
  119. package/src/components/ConsoleAccessPage.tsx +122 -0
  120. package/src/components/EnabledStatusIcon.tsx +54 -0
  121. package/src/components/HashValueDisplay.tsx +85 -0
  122. package/src/components/HotUpdaterLogo.tsx +30 -0
  123. package/src/components/NotFoundPage.tsx +33 -0
  124. package/src/components/PlatformIcon.tsx +39 -0
  125. package/src/components/RolloutPercentageBadge.tsx +28 -0
  126. package/src/components/ThemeProvider.tsx +116 -0
  127. package/src/components/TimestampDisplay.tsx +41 -0
  128. package/src/components/features/api-keys/ApiKeysPage.tsx +377 -0
  129. package/src/components/features/bundles/BundleActivityChart.tsx +193 -0
  130. package/src/components/features/bundles/BundleChildrenPanel.tsx +201 -0
  131. package/src/components/features/bundles/BundleInsightsSummary.tsx +123 -0
  132. package/src/components/features/bundles/BundleMetadata.tsx +136 -0
  133. package/src/components/features/bundles/RolloutCohortsDialog.tsx +201 -0
  134. package/src/components/features/channels/ChannelManagementDialog.tsx +228 -0
  135. package/src/components/features/insights/ActivityChart.tsx +150 -0
  136. package/src/components/features/insights/BundleDistribution.tsx +133 -0
  137. package/src/components/features/insights/BundleSelector.tsx +114 -0
  138. package/src/components/features/insights/InsightsCapabilityContext.tsx +24 -0
  139. package/src/components/features/insights/InsightsControls.tsx +115 -0
  140. package/src/components/features/insights/InsightsErrorAlert.tsx +21 -0
  141. package/src/components/features/insights/InsightsOverview.tsx +208 -0
  142. package/src/components/features/insights/InstallationHistoryCard.tsx +248 -0
  143. package/src/components/features/insights/InstallationMatchesCard.tsx +132 -0
  144. package/src/components/features/insights/InstallationPageHeader.tsx +138 -0
  145. package/src/components/features/insights/InstallationPagination.tsx +48 -0
  146. package/src/components/features/insights/InstallationSearch.tsx +230 -0
  147. package/src/components/features/insights/UpdateOutcomes.tsx +147 -0
  148. package/src/components/features/releases/ReleaseEditorSheet.tsx +879 -0
  149. package/src/components/features/releases/ReleaseStateBadge.tsx +20 -0
  150. package/src/components/features/signing/BundleSigningPage.tsx +139 -0
  151. package/src/components/ui/alert-dialog.tsx +185 -0
  152. package/src/components/ui/alert.tsx +76 -0
  153. package/src/components/ui/badge.tsx +49 -0
  154. package/src/components/ui/button.tsx +58 -0
  155. package/src/components/ui/card.tsx +89 -0
  156. package/src/components/ui/chart.tsx +371 -0
  157. package/src/components/ui/combobox.tsx +303 -0
  158. package/src/components/ui/dialog.tsx +156 -0
  159. package/src/components/ui/dropdown-menu.tsx +270 -0
  160. package/src/components/ui/field.tsx +235 -0
  161. package/src/components/ui/input-group.tsx +147 -0
  162. package/src/components/ui/input.tsx +19 -0
  163. package/src/components/ui/label.tsx +25 -0
  164. package/src/components/ui/progress.tsx +84 -0
  165. package/src/components/ui/select.tsx +205 -0
  166. package/src/components/ui/separator.tsx +23 -0
  167. package/src/components/ui/sheet.tsx +132 -0
  168. package/src/components/ui/sidebar.tsx +779 -0
  169. package/src/components/ui/skeleton.tsx +13 -0
  170. package/src/components/ui/slider.tsx +56 -0
  171. package/src/components/ui/sonner.tsx +45 -0
  172. package/src/components/ui/switch.tsx +25 -0
  173. package/src/components/ui/table.tsx +114 -0
  174. package/src/components/ui/textarea.tsx +18 -0
  175. package/src/components/ui/toggle-group.tsx +89 -0
  176. package/src/components/ui/toggle.tsx +43 -0
  177. package/src/components/ui/tooltip.tsx +66 -0
  178. package/src/hooks/use-mobile.ts +30 -0
  179. package/src/index.ts +47 -0
  180. package/src/lib/api-keys-api.ts +69 -0
  181. package/src/lib/api-keys-rpc.ts +87 -0
  182. package/src/lib/api-rpc.ts +478 -0
  183. package/src/lib/api.ts +444 -0
  184. package/src/lib/auth-rpc.ts +16 -0
  185. package/src/lib/bundle-signing-api.ts +14 -0
  186. package/src/lib/bundle-signing-rpc.ts +16 -0
  187. package/src/lib/constants.ts +1 -0
  188. package/src/lib/git.ts +51 -0
  189. package/src/lib/insights-api.ts +144 -0
  190. package/src/lib/insights-error.ts +19 -0
  191. package/src/lib/insights-input.ts +187 -0
  192. package/src/lib/insights-overview.ts +170 -0
  193. package/src/lib/insights-rpc.ts +218 -0
  194. package/src/lib/server/auth.server.ts +43 -0
  195. package/src/lib/server/bundle-signing.server.ts +23 -0
  196. package/src/lib/server/config.server.ts +109 -0
  197. package/src/lib/server/console-runtime.server.ts +61 -0
  198. package/src/lib/server/deleteBundle.ts +145 -0
  199. package/src/lib/server/downloadBundle.ts +46 -0
  200. package/src/lib/server/getBundleChildren.ts +130 -0
  201. package/src/lib/server/listReleases.ts +61 -0
  202. package/src/lib/server/releaseActivity.ts +27 -0
  203. package/src/lib/server/releaseReachability.ts +95 -0
  204. package/src/lib/server/runtime.server.ts +172 -0
  205. package/src/lib/utils.ts +9 -0
  206. package/src/logo.svg +1 -0
  207. package/src/routeTree.gen.ts +199 -0
  208. package/src/router.tsx +21 -0
  209. package/src/routes/-installations-search.ts +19 -0
  210. package/src/routes/-releases-search.ts +74 -0
  211. package/src/routes/__root.tsx +174 -0
  212. package/src/routes/api/auth/$.ts +19 -0
  213. package/src/routes/api/bundles/$bundleId/download.ts +17 -0
  214. package/src/routes/api-keys.tsx +37 -0
  215. package/src/routes/index.tsx +982 -0
  216. package/src/routes/insights.tsx +139 -0
  217. package/src/routes/installations.tsx +194 -0
  218. package/src/routes/signing.tsx +37 -0
  219. package/src/styles.css +152 -0
  220. package/src/virtual-modules.d.ts +21 -0
  221. package/src/vite-env.d.ts +1 -0
  222. package/src/vite-internal.ts +195 -0
  223. package/src/vite.ts +12 -0
  224. package/.output/public/assets/dist-DJX53faP.js +0 -3
  225. package/.output/public/assets/index-Iylis5kY.js +0 -10
  226. package/.output/public/assets/routes-HT21hs0C.js +0 -54
  227. package/.output/public/assets/styles-C0Re4quB.css +0 -2
  228. package/.output/server/__23tanstack-start-server-fn-resolver-CgwgZ0-i.mjs +0 -66
  229. package/.output/server/_libs/@floating-ui/core+[...].mjs +0 -698
  230. package/.output/server/_libs/@floating-ui/dom+[...].mjs +0 -644
  231. package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +0 -839
  232. package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +0 -2138
  233. package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +0 -308
  234. package/.output/server/_libs/@radix-ui/react-select+[...].mjs +0 -1038
  235. package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +0 -196
  236. package/.output/server/_libs/@tanstack/form-core+[...].mjs +0 -3228
  237. package/.output/server/_libs/@tanstack/react-form+[...].mjs +0 -430
  238. package/.output/server/_libs/@tanstack/react-table+[...].mjs +0 -2382
  239. package/.output/server/_libs/radix-ui__number.mjs +0 -6
  240. package/.output/server/_libs/radix-ui__primitive.mjs +0 -9
  241. package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
  242. package/.output/server/_libs/radix-ui__react-collection.mjs +0 -78
  243. package/.output/server/_libs/radix-ui__react-direction.mjs +0 -13
  244. package/.output/server/_libs/radix-ui__react-label.mjs +0 -22
  245. package/.output/server/_libs/radix-ui__react-separator.mjs +0 -30
  246. package/.output/server/_libs/radix-ui__react-slider.mjs +0 -510
  247. package/.output/server/_libs/radix-ui__react-switch.mjs +0 -157
  248. package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -493
  249. package/.output/server/_ssr/api-rpc-BIbDUKSz.mjs +0 -292
  250. package/.output/server/_ssr/config.server-BSS366KT.mjs +0 -41
  251. package/.output/server/_ssr/deleteBundle-BgbZTtpW.mjs +0 -141
  252. package/.output/server/_ssr/dist-KboydRVk.mjs +0 -120
  253. package/.output/server/_ssr/router-C3hqEy3k.mjs +0 -307
  254. package/.output/server/_ssr/routes-B0lQvvlC.mjs +0 -3048
  255. package/.output/server/_ssr/start-02sLteYG.mjs +0 -4
  256. package/.output/server/_ssr/storageProfile-FVkjPoGb.mjs +0 -9
  257. package/.output/server/_tanstack-start-manifest_v-Bpx52WOU.mjs +0 -20
  258. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  259. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  260. package/.output/server/node_modules/tslib/package.json +0 -47
  261. package/.output/server/node_modules/tslib/tslib.js +0 -484
  262. package/.output/server/package.json +0 -9
@@ -0,0 +1,300 @@
1
+ import { i as __toESM } from "../_runtime.mjs";
2
+ import { at as require_react, it as require_jsx_runtime } from "../_libs/@base-ui/react+[...].mjs";
3
+ import { E as Clipboard, N as Check, b as KeyRound, d as RefreshCw, f as Plus, n as TriangleAlert, s as ShieldOff, v as LoaderCircle } from "../_libs/lucide-react.mjs";
4
+ import { _ as Skeleton, g as SidebarTrigger, n as Input, t as Button$1 } from "./createSsrRpc-DhfrxEjg.mjs";
5
+ import { a as useRevokeApiKeyMutation, i as useCreateApiKeyMutation, r as useApiKeysQuery } from "./api-keys-api-Czkp57UV.mjs";
6
+ import { a as Card, i as AlertTitle, l as CardHeader, n as AlertAction, o as CardContent, r as AlertDescription, t as Alert, u as CardTitle } from "./card-Bsc8mRis.mjs";
7
+ import { a as AlertDialogDescription, c as AlertDialogMedia, d as Dialog$1, f as DialogContent, g as DialogTitle, h as DialogHeader, i as AlertDialogContent, l as AlertDialogTitle, m as DialogFooter, n as AlertDialogAction, o as AlertDialogFooter, p as DialogDescription, r as AlertDialogCancel, s as AlertDialogHeader, t as AlertDialog$1, u as AlertDialogTrigger } from "./dialog-C0vKUp8R.mjs";
8
+ import { t as Badge } from "./badge-CpWXQwyF.mjs";
9
+ import { a as FieldLabel, i as FieldGroup, n as FieldDescription, r as FieldError, t as Field } from "./field-DASCh-5d.mjs";
10
+ import { a as TableHeader, i as TableHead, n as TableBody, o as TableRow, r as TableCell, t as Table } from "./table-CU58HeI7.mjs";
11
+ import { n as toast } from "../_libs/sonner.mjs";
12
+ //#region node_modules/.nitro/vite/services/ssr/assets/api-keys-CpBqHpuC.js
13
+ var import_react = /* @__PURE__ */ __toESM(require_react());
14
+ var import_jsx_runtime = require_jsx_runtime();
15
+ var formatCreatedAt = (createdAt) => new Date(createdAt).toISOString().slice(0, 10);
16
+ function CreateApiKeyDialog() {
17
+ const [open, setOpen] = (0, import_react.useState)(false);
18
+ const [name, setName] = (0, import_react.useState)("");
19
+ const [apiKey, setApiKey] = (0, import_react.useState)(null);
20
+ const create = useCreateApiKeyMutation();
21
+ const normalizedName = name.trim();
22
+ const nameError = normalizedName.length > 64 ? "Name must be 64 characters or fewer." : null;
23
+ const reset = () => {
24
+ setName("");
25
+ setApiKey(null);
26
+ create.reset();
27
+ };
28
+ const handleOpenChange = (nextOpen) => {
29
+ setOpen(nextOpen);
30
+ if (!nextOpen) reset();
31
+ };
32
+ const handleSubmit = async (event) => {
33
+ event.preventDefault();
34
+ if (normalizedName.length === 0 || nameError !== null) return;
35
+ try {
36
+ setApiKey((await create.mutateAsync(normalizedName)).apiKey);
37
+ toast.success("API key created");
38
+ } catch (error) {
39
+ toast.error(error instanceof Error ? error.message : "Unable to create API key");
40
+ }
41
+ };
42
+ const copyKey = async () => {
43
+ if (apiKey === null) return;
44
+ try {
45
+ await navigator.clipboard.writeText(apiKey);
46
+ toast.success("API key copied");
47
+ } catch {
48
+ toast.error("Unable to copy API key");
49
+ }
50
+ };
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$1, {
52
+ onClick: () => setOpen(true),
53
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { "data-icon": "inline-start" }), "Create API key"]
54
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog$1, {
55
+ open,
56
+ onOpenChange: handleOpenChange,
57
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
58
+ showCloseButton: apiKey === null,
59
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: apiKey === null ? "Create API key" : "Save your API key" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { children: apiKey === null ? "Name the app or environment that will use this key." : "This key is shown once. Store it securely before closing." })] }), apiKey === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
60
+ onSubmit: handleSubmit,
61
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, {
62
+ "data-invalid": nameError !== null || void 0,
63
+ children: [
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, {
65
+ htmlFor: "api-key-name",
66
+ children: "Name"
67
+ }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
69
+ id: "api-key-name",
70
+ autoComplete: "off",
71
+ maxLength: 65,
72
+ onChange: (event) => setName(event.target.value),
73
+ placeholder: "Production app",
74
+ value: name
75
+ }),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldDescription, { children: "Use a name you can identify before revoking the key." }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldError, { children: nameError })
78
+ ]
79
+ }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogFooter, {
80
+ className: "mt-4",
81
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$1, {
82
+ disabled: create.isPending || normalizedName.length === 0 || nameError !== null,
83
+ type: "submit",
84
+ children: [create.isPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, {
85
+ "data-icon": "inline-start",
86
+ className: "animate-spin"
87
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyRound, { "data-icon": "inline-start" }), "Create API key"]
88
+ })
89
+ })]
90
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FieldGroup, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, {
91
+ htmlFor: "created-api-key",
92
+ children: "API key"
93
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
94
+ className: "flex gap-2",
95
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
96
+ id: "created-api-key",
97
+ className: "font-mono",
98
+ readOnly: true,
99
+ value: apiKey
100
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$1, {
101
+ onClick: copyKey,
102
+ type: "button",
103
+ variant: "outline",
104
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Clipboard, { "data-icon": "inline-start" }), "Copy"]
105
+ })]
106
+ })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$1, {
107
+ onClick: () => handleOpenChange(false),
108
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { "data-icon": "inline-start" }), "Done"]
109
+ }) })] })]
110
+ })
111
+ })] });
112
+ }
113
+ function RevokeApiKeyDialog({ record }) {
114
+ const [open, setOpen] = (0, import_react.useState)(false);
115
+ const revoke = useRevokeApiKeyMutation();
116
+ const handleRevoke = async (event) => {
117
+ event.preventDefault();
118
+ try {
119
+ await revoke.mutateAsync(record.id);
120
+ setOpen(false);
121
+ toast.success("API key revoked");
122
+ } catch (error) {
123
+ toast.error(error instanceof Error ? error.message : "Unable to revoke API key");
124
+ }
125
+ };
126
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialog$1, {
127
+ open,
128
+ onOpenChange: (nextOpen) => {
129
+ if (!revoke.isPending) setOpen(nextOpen);
130
+ },
131
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogTrigger, {
132
+ render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
133
+ size: "sm",
134
+ variant: "ghost"
135
+ }),
136
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldOff, { "data-icon": "inline-start" }), "Revoke"]
137
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogMedia, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldOff, {}) }),
139
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogTitle, { children: [
140
+ "Revoke ",
141
+ record.name,
142
+ "?"
143
+ ] }),
144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogDescription, { children: [
145
+ "Apps using ",
146
+ record.prefix,
147
+ "… will immediately lose OTA update and insights access. This action cannot be undone."
148
+ ] })
149
+ ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, {
150
+ disabled: revoke.isPending,
151
+ children: "Cancel"
152
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, {
153
+ disabled: revoke.isPending,
154
+ onClick: (event) => void handleRevoke(event),
155
+ variant: "destructive",
156
+ children: "Revoke API key"
157
+ })] })] })]
158
+ });
159
+ }
160
+ function ApiKeysPage() {
161
+ const apiKeys = useApiKeysQuery();
162
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
163
+ className: "overflow-hidden shadow-sm",
164
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CardHeader, {
165
+ className: "flex-row items-center justify-between space-y-0 border-b px-4 py-3",
166
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardTitle, {
167
+ className: "text-sm",
168
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: "API keys" })
169
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CreateApiKeyDialog, {})]
170
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardContent, {
171
+ className: "p-0",
172
+ children: apiKeys.isError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
173
+ className: "p-4",
174
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
175
+ variant: "destructive",
176
+ children: [
177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, {}),
178
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: "API keys couldn't be loaded" }),
179
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, { children: "Check your connection and try again." }),
180
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertAction, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$1, {
181
+ onClick: () => void apiKeys.refetch(),
182
+ size: "xs",
183
+ variant: "outline",
184
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefreshCw, { "data-icon": "inline-start" }), "Retry"]
185
+ }) })
186
+ ]
187
+ })
188
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table, {
189
+ "aria-label": "API keys",
190
+ className: "table-fixed",
191
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, { children: [
192
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { children: "Key" }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
194
+ className: "w-32",
195
+ children: "Created"
196
+ }),
197
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, {
198
+ className: "w-24 text-right",
199
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
200
+ className: "sr-only",
201
+ children: "Actions"
202
+ })
203
+ })
204
+ ] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, { children: apiKeys.isLoading ? Array.from({ length: 3 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, { children: [
205
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableCell, {
206
+ className: "space-y-2 py-3",
207
+ children: [
208
+ index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
209
+ className: "sr-only",
210
+ children: "Loading API keys"
211
+ }) : null,
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-32" }),
213
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3 w-20" })
214
+ ]
215
+ }),
216
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-20" }) }),
217
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "ml-auto h-6 w-16" }) })
218
+ ] }, index)) : apiKeys.data?.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
219
+ colSpan: 3,
220
+ className: "h-40 text-center text-muted-foreground",
221
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
222
+ className: "mx-auto flex max-w-xs flex-col items-center gap-2",
223
+ children: [
224
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyRound, { className: "size-5" }),
225
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
226
+ className: "font-medium text-foreground",
227
+ children: "No API keys"
228
+ }),
229
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Create an API key to connect an app." })
230
+ ]
231
+ })
232
+ }) }) : apiKeys.data?.map((apiKey) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, {
233
+ className: apiKey.revoked_at_ms === null ? void 0 : "text-muted-foreground",
234
+ children: [
235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
236
+ className: "whitespace-normal py-3",
237
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
238
+ className: "min-w-0 space-y-1",
239
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
240
+ className: "break-words font-medium text-foreground",
241
+ children: apiKey.name
242
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
243
+ className: "font-mono text-xs text-muted-foreground",
244
+ children: [apiKey.prefix, "…"]
245
+ })]
246
+ })
247
+ }),
248
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
249
+ className: "text-xs text-muted-foreground",
250
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", {
251
+ dateTime: new Date(apiKey.created_at_ms).toISOString(),
252
+ children: formatCreatedAt(apiKey.created_at_ms)
253
+ })
254
+ }),
255
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
256
+ className: "text-right",
257
+ children: apiKey.revoked_at_ms === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RevokeApiKeyDialog, { record: apiKey }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
258
+ variant: "outline",
259
+ children: "Revoked"
260
+ })
261
+ })
262
+ ]
263
+ }, apiKey.id)) })]
264
+ })
265
+ })]
266
+ });
267
+ }
268
+ function ApiKeysRoute() {
269
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
270
+ className: "flex h-svh min-h-0 flex-col",
271
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
272
+ className: "sticky top-0 z-10 flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b bg-background px-3 py-3 sm:min-h-12 sm:flex-nowrap sm:bg-card/70 sm:px-4 sm:backdrop-blur-sm",
273
+ children: [
274
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarTrigger, { className: "-ml-1" }),
275
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
276
+ className: "flex items-center gap-1.5",
277
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(KeyRound, {
278
+ "aria-hidden": "true",
279
+ className: "size-3.5 text-muted-foreground"
280
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
281
+ className: "text-sm font-medium",
282
+ children: "API keys"
283
+ })]
284
+ }),
285
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
286
+ className: "basis-full pl-9 text-xs text-muted-foreground sm:basis-auto sm:pl-0",
287
+ children: "API keys can download OTA updates and submit insights only."
288
+ })
289
+ ]
290
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
291
+ className: "min-h-0 min-w-0 flex-1 overflow-y-auto bg-muted/5 p-3 sm:p-6",
292
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
293
+ className: "mx-auto w-full max-w-5xl",
294
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApiKeysPage, {})
295
+ })
296
+ })]
297
+ });
298
+ }
299
+ //#endregion
300
+ export { ApiKeysRoute as component };
@@ -0,0 +1,60 @@
1
+ import { c as createServerFn } from "./createServerFn-B2hcXoPM.mjs";
2
+ import { w as createSsrRpc } from "./createSsrRpc-DhfrxEjg.mjs";
3
+ import { g as redirect } from "../_libs/@tanstack/react-router+[...].mjs";
4
+ import { i as useQueryClient, n as useQuery, t as useMutation } from "../_libs/tanstack__react-query.mjs";
5
+ //#region node_modules/.nitro/vite/services/ssr/assets/api-keys-api-Czkp57UV.js
6
+ var parseName = (input) => {
7
+ const name = typeof input === "object" && input !== null ? Reflect.get(input, "name") : void 0;
8
+ if (typeof name !== "string") throw new TypeError("API key name must be a string.");
9
+ return { name };
10
+ };
11
+ var parseId = (input) => {
12
+ const id = typeof input === "object" && input !== null ? Reflect.get(input, "id") : void 0;
13
+ if (typeof id !== "string" || !/^api-[A-Za-z0-9_-]{43}$/u.test(id)) throw new TypeError("Invalid API key id.");
14
+ return { id };
15
+ };
16
+ var getApiKeyCapabilityRpc = createServerFn({ method: "GET" }).handler(createSsrRpc("29665ce3a33cde2eb2ee082694288db269438f62f3a4d0a005dec3256e0f15c1"));
17
+ var listApiKeysRpc = createServerFn({ method: "GET" }).handler(createSsrRpc("2c7f3cdb9bd3cab2c026a48abdc84c362db0362924a08679052a325640aec56b"));
18
+ var createApiKeyRpc = createServerFn({ method: "POST" }).validator(parseName).handler(createSsrRpc("68a2d94ee016be64936401f5eba60ab08a47ff373e1cf9de48e4413336e6034b"));
19
+ var revokeApiKeyRpc = createServerFn({ method: "POST" }).validator(parseId).handler(createSsrRpc("a1cb80b19ca72a64fb631ca28ebb9b6941db245983de082d5dd3203ec2eef795"));
20
+ var apiKeyQueryKeys = {
21
+ capability: ["api-keys", "capability"],
22
+ list: ["api-keys", "list"]
23
+ };
24
+ var getApiKeyCapabilityQueryOptions = () => ({
25
+ queryKey: apiKeyQueryKeys.capability,
26
+ queryFn: () => getApiKeyCapabilityRpc(),
27
+ staleTime: Infinity
28
+ });
29
+ var useApiKeyCapabilityQuery = () => useQuery(getApiKeyCapabilityQueryOptions());
30
+ var ensureApiKeyRouteAccess = async (queryClient) => {
31
+ if (!(await queryClient.ensureQueryData(getApiKeyCapabilityQueryOptions())).apiKeys) throw redirect({
32
+ to: "/",
33
+ search: {},
34
+ replace: true
35
+ });
36
+ };
37
+ var useApiKeysQuery = () => useQuery({
38
+ queryKey: apiKeyQueryKeys.list,
39
+ queryFn: () => listApiKeysRpc()
40
+ });
41
+ var useCreateApiKeyMutation = () => {
42
+ const queryClient = useQueryClient();
43
+ return useMutation({
44
+ mutationFn: (name) => createApiKeyRpc({ data: { name } }),
45
+ onSuccess: async () => {
46
+ await queryClient.invalidateQueries({ queryKey: apiKeyQueryKeys.list });
47
+ }
48
+ });
49
+ };
50
+ var useRevokeApiKeyMutation = () => {
51
+ const queryClient = useQueryClient();
52
+ return useMutation({
53
+ mutationFn: (id) => revokeApiKeyRpc({ data: { id } }),
54
+ onSuccess: async () => {
55
+ await queryClient.invalidateQueries({ queryKey: apiKeyQueryKeys.list });
56
+ }
57
+ });
58
+ };
59
+ //#endregion
60
+ export { useRevokeApiKeyMutation as a, useCreateApiKeyMutation as i, useApiKeyCapabilityQuery as n, useApiKeysQuery as r, ensureApiKeyRouteAccess as t };
@@ -0,0 +1,136 @@
1
+ import { c as createServerFn } from "./createServerFn-B2hcXoPM.mjs";
2
+ import { t as createServerRpc } from "./createServerRpc-DB29C_5p.mjs";
3
+ //#region node_modules/.nitro/vite/services/ssr/assets/api-keys-rpc-BTtMDSoR.js
4
+ var BASE64URL_32_PATTERN = /^[A-Za-z0-9_-]{43}$/u;
5
+ var bytesToBase64Url = (bytes) => {
6
+ let binary = "";
7
+ for (const byte of bytes) binary += String.fromCharCode(byte);
8
+ return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/u, "");
9
+ };
10
+ var isApiKey = (value) => {
11
+ if (!BASE64URL_32_PATTERN.test(value)) return false;
12
+ try {
13
+ const base64 = value.replaceAll("-", "+").replaceAll("_", "/");
14
+ const binary = atob(`${base64}=`);
15
+ const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));
16
+ return bytes.byteLength === 32 && bytesToBase64Url(bytes) === value;
17
+ } catch {
18
+ return false;
19
+ }
20
+ };
21
+ var hashApiKey = async (apiKey) => {
22
+ if (!isApiKey(apiKey)) throw new TypeError("API key must be a canonical 32-byte base64url value.");
23
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(apiKey));
24
+ return bytesToBase64Url(new Uint8Array(digest));
25
+ };
26
+ var apiKeyId = () => {
27
+ const bytes = new Uint8Array(16);
28
+ crypto.getRandomValues(bytes);
29
+ return `api-${bytesToBase64Url(bytes)}`;
30
+ };
31
+ var normalizeApiKeyName = (name) => {
32
+ const normalized = name.trim();
33
+ if (normalized.length === 0 || normalized.length > 64 || /[\p{Cc}\p{Cf}]/u.test(normalized)) throw new TypeError("API key names must contain 1-64 visible characters.");
34
+ return normalized;
35
+ };
36
+ var toApiKeyMetadata = ({ hash: _hash, ...metadata }) => Object.freeze(metadata);
37
+ var registerApiKey = async (input) => {
38
+ const hash = await hashApiKey(input.apiKey);
39
+ const createdAtMs = input.createdAtMs ?? Date.now();
40
+ if (!Number.isSafeInteger(createdAtMs) || createdAtMs < 0) throw new TypeError("API key creation time must be non-negative.");
41
+ const record = Object.freeze({
42
+ created_at_ms: createdAtMs,
43
+ hash,
44
+ id: apiKeyId(),
45
+ name: normalizeApiKeyName(input.name),
46
+ prefix: input.apiKey.slice(0, 6),
47
+ revoked_at_ms: null,
48
+ role: "client"
49
+ });
50
+ if (await input.apiKeys.create(record) === "existing") {
51
+ const existing = await input.apiKeys.findByHash(hash);
52
+ if (existing === null || existing.revoked_at_ms !== null) throw new Error("The API key has been revoked.");
53
+ return Object.freeze({
54
+ apiKey: input.apiKey,
55
+ record: toApiKeyMetadata(existing)
56
+ });
57
+ }
58
+ return Object.freeze({
59
+ apiKey: input.apiKey,
60
+ record: toApiKeyMetadata(record)
61
+ });
62
+ };
63
+ var createApiKey = (input) => {
64
+ const bytes = new Uint8Array(32);
65
+ crypto.getRandomValues(bytes);
66
+ return registerApiKey({
67
+ apiKey: bytesToBase64Url(bytes),
68
+ apiKeys: input.apiKeys,
69
+ name: input.name
70
+ });
71
+ };
72
+ var toApiKeyView = ({ hash: _hash, ...record }) => record;
73
+ var parseName = (input) => {
74
+ const name = typeof input === "object" && input !== null ? Reflect.get(input, "name") : void 0;
75
+ if (typeof name !== "string") throw new TypeError("API key name must be a string.");
76
+ return { name };
77
+ };
78
+ var parseId = (input) => {
79
+ const id = typeof input === "object" && input !== null ? Reflect.get(input, "id") : void 0;
80
+ if (typeof id !== "string" || !/^api-[A-Za-z0-9_-]{43}$/u.test(id)) throw new TypeError("Invalid API key id.");
81
+ return { id };
82
+ };
83
+ var requireStore = async () => {
84
+ const { prepareConfig } = await import("./config.server-DQYEr_5X.mjs");
85
+ const { apiKeyStore } = await prepareConfig();
86
+ if (apiKeyStore === null) throw new Error("API keys are not supported by the configured database plugin.");
87
+ return apiKeyStore;
88
+ };
89
+ var getApiKeyCapabilityRpc_createServerFn_handler = createServerRpc({
90
+ id: "29665ce3a33cde2eb2ee082694288db269438f62f3a4d0a005dec3256e0f15c1",
91
+ name: "getApiKeyCapabilityRpc",
92
+ filename: "src/lib/api-keys-rpc.ts"
93
+ }, (opts) => getApiKeyCapabilityRpc.__executeServer(opts));
94
+ var getApiKeyCapabilityRpc = createServerFn({ method: "GET" }).handler(getApiKeyCapabilityRpc_createServerFn_handler, async () => {
95
+ const { prepareConfig } = await import("./config.server-DQYEr_5X.mjs");
96
+ const { apiKeyStore } = await prepareConfig();
97
+ return { apiKeys: apiKeyStore !== null };
98
+ });
99
+ var listApiKeysRpc_createServerFn_handler = createServerRpc({
100
+ id: "2c7f3cdb9bd3cab2c026a48abdc84c362db0362924a08679052a325640aec56b",
101
+ name: "listApiKeysRpc",
102
+ filename: "src/lib/api-keys-rpc.ts"
103
+ }, (opts) => listApiKeysRpc.__executeServer(opts));
104
+ var listApiKeysRpc = createServerFn({ method: "GET" }).handler(listApiKeysRpc_createServerFn_handler, async () => {
105
+ return [...await (await requireStore()).list()].sort((left, right) => right.created_at_ms - left.created_at_ms).map(toApiKeyView);
106
+ });
107
+ var createApiKeyRpc_createServerFn_handler = createServerRpc({
108
+ id: "68a2d94ee016be64936401f5eba60ab08a47ff373e1cf9de48e4413336e6034b",
109
+ name: "createApiKeyRpc",
110
+ filename: "src/lib/api-keys-rpc.ts"
111
+ }, (opts) => createApiKeyRpc.__executeServer(opts));
112
+ var createApiKeyRpc = createServerFn({ method: "POST" }).validator(parseName).handler(createApiKeyRpc_createServerFn_handler, async ({ data }) => {
113
+ const created = await createApiKey({
114
+ apiKeys: await requireStore(),
115
+ name: data.name
116
+ });
117
+ return {
118
+ apiKey: created.apiKey,
119
+ record: created.record
120
+ };
121
+ });
122
+ var revokeApiKeyRpc_createServerFn_handler = createServerRpc({
123
+ id: "a1cb80b19ca72a64fb631ca28ebb9b6941db245983de082d5dd3203ec2eef795",
124
+ name: "revokeApiKeyRpc",
125
+ filename: "src/lib/api-keys-rpc.ts"
126
+ }, (opts) => revokeApiKeyRpc.__executeServer(opts));
127
+ var revokeApiKeyRpc = createServerFn({ method: "POST" }).validator(parseId).handler(revokeApiKeyRpc_createServerFn_handler, async ({ data }) => {
128
+ const revoked = await (await requireStore()).revoke({
129
+ id: data.id,
130
+ revokedAtMs: Date.now()
131
+ });
132
+ if (revoked === null) throw new Error("API key not found.");
133
+ return toApiKeyView(revoked);
134
+ });
135
+ //#endregion
136
+ export { createApiKeyRpc_createServerFn_handler, getApiKeyCapabilityRpc_createServerFn_handler, listApiKeysRpc_createServerFn_handler, revokeApiKeyRpc_createServerFn_handler };