@hot-updater/console 1.2.0-rc.3 → 1.2.0-rc.30

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 (342) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{-native-builds-search-C-TGpFAm.js → -native-builds-search-DdHwfe4q.js} +1 -1
  3. package/.output/public/assets/BundleIdDisplay-CTBdtFQ8.js +1 -0
  4. package/.output/public/assets/ChannelBadge-CEabmopB.js +1 -0
  5. package/.output/public/assets/CompositeItem-KUM5yQVr.js +1 -0
  6. package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-Be-0iTww.js} +1 -1
  7. package/.output/public/assets/{EventDetails-Dl2RvPAk.js → EventDetails-bDOYte1z.js} +1 -1
  8. package/.output/public/assets/HashValueDisplay-D2f0HmyU.js +1 -0
  9. package/.output/public/assets/{InsightsPageHeader-DHhqY3DT.js → InsightsPageHeader-Cj2ROSQO.js} +1 -1
  10. package/.output/public/assets/IosInstall-CHI2C4Yd.js +1 -0
  11. package/.output/public/assets/NativeBuildsNav-DaqxQPnG.js +1 -0
  12. package/.output/public/assets/{NotFoundPage-DZ3DxyRA.js → NotFoundPage-CVBtl68B.js} +1 -1
  13. package/.output/public/assets/{PlatformIcon-BBWQlWm9.js → PlatformIcon-DVnzzGqM.js} +1 -1
  14. package/.output/public/assets/RelativeTime-B4PK8qDw.js +1 -0
  15. package/.output/public/assets/RolloutPercentageBadge-D_I0Raj2.js +1 -0
  16. package/.output/public/assets/RowReason-B7VM1ztc.js +1 -0
  17. package/.output/public/assets/SandboxBadge-BVxHg_HF.js +1 -0
  18. package/.output/public/assets/TargetDisplay-KU7JhIWG.js +1 -0
  19. package/.output/public/assets/{alert-dialog-BqYScr9y.js → alert-dialog-Ch0QxRsa.js} +1 -1
  20. package/.output/public/assets/api-C1OPeiG1.js +1 -0
  21. package/.output/public/assets/api-keys-DLC8jjaM.js +1 -0
  22. package/.output/public/assets/api-keys-eDnzgFAf.js +1 -0
  23. package/.output/public/assets/arrow-left-DQjHJAnT.js +1 -0
  24. package/.output/public/assets/arrow-right-CXp_K3xK.js +1 -0
  25. package/.output/public/assets/arrow-up-right-BFafIOrq.js +1 -0
  26. package/.output/public/assets/badge-FZMD5vvS.js +1 -0
  27. package/.output/public/assets/card-CyHYmHue.js +1 -0
  28. package/.output/public/assets/check-CqWNyG93.js +1 -0
  29. package/.output/public/assets/chevron-right-DNbYTBX1.js +1 -0
  30. package/.output/public/assets/{circle-off-C7Muo0ss.js → circle-off-BCkZpskJ.js} +1 -1
  31. package/.output/public/assets/{clipboard-DQbOcrL7.js → clipboard-DZrZK5gR.js} +1 -1
  32. package/.output/public/assets/{console-features-api-DEXSwFtc.js → console-features-api-BO5V64P3.js} +1 -1
  33. package/.output/public/assets/{copy-DsuLj3oj.js → copy-CH1__JAW.js} +1 -1
  34. package/.output/public/assets/dialog-BLj71-Nf.js +1 -0
  35. package/.output/public/assets/{dist-CPlO6ko9.js → dist-DAM__Tdz.js} +1 -1
  36. package/.output/public/assets/{download-Cf24LBde.js → download-B2GjTySo.js} +1 -1
  37. package/.output/public/assets/empty--YaE5Z4p.js +1 -0
  38. package/.output/public/assets/field-CdhSgWhI.js +1 -0
  39. package/.output/public/assets/git-branch-DG1VDaKq.js +1 -0
  40. package/.output/public/assets/history-C0wv4htz.js +1 -0
  41. package/.output/public/assets/index-CgwVUC2n.js +10 -0
  42. package/.output/public/assets/{input-group-D3OUBk4n.js → input-group-XKLcUGoa.js} +1 -1
  43. package/.output/public/assets/insights-C94CdeAA.js +1 -0
  44. package/.output/public/assets/insights-DILMVpk8.js +2 -0
  45. package/.output/public/assets/insights-_j_ieOyh.js +42 -0
  46. package/.output/public/assets/insights-api-B6Gj74n5.js +1 -0
  47. package/.output/public/assets/{insights-search-DghCbEnk.js → insights-search-Bgvg6wSP.js} +1 -1
  48. package/.output/public/assets/insights-usage-rpc-BUCinjSN.js +1 -0
  49. package/.output/public/assets/insights_.distribution-Bb6_S-hD.js +2 -0
  50. package/.output/public/assets/insights_.distribution-CRkGNelG.js +1 -0
  51. package/.output/public/assets/insights_.distribution-CyAu3RN3.js +1 -0
  52. package/.output/public/assets/installations-BA01mqJE.js +1 -0
  53. package/.output/public/assets/installations-BsD6LgNc.js +2 -0
  54. package/.output/public/assets/installations-CYTzndfP.js +1 -0
  55. package/.output/public/assets/{key-round-DwNKkHhy.js → key-round-D7UgdXyA.js} +1 -1
  56. package/.output/public/assets/{link-DTEyW70e.js → link-CN3iHC4A.js} +2 -2
  57. package/.output/public/assets/{list--NIee1FZ.js → list-Bm-CfN5g.js} +1 -1
  58. package/.output/public/assets/loader-circle-iMqC-8ZE.js +1 -0
  59. package/.output/public/assets/native-builds-BMbws1g5.js +2 -0
  60. package/.output/public/assets/native-builds-xgHiHQML.js +1 -0
  61. package/.output/public/assets/native-builds_._buildId-B04z9yfk.js +1 -0
  62. package/.output/public/assets/native-builds_._buildId-DaMmTcHo.js +2 -0
  63. package/.output/public/assets/native-builds_.devices-CTzpCVsb.js +1 -0
  64. package/.output/public/assets/native-builds_.devices-D_kl2-bc.js +2 -0
  65. package/.output/public/assets/package-BmfoZ5Zj.js +1 -0
  66. package/.output/public/assets/plus-Db0KxLZp.js +1 -0
  67. package/.output/public/assets/preload-helper-CRQjUQaZ.js +1 -0
  68. package/.output/public/assets/{refresh-cw-B9HHjLej.js → refresh-cw-BHhBYjS8.js} +1 -1
  69. package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-BYRt19mj.js} +1 -1
  70. package/.output/public/assets/remote-config-Cxkr7_BP.js +1 -0
  71. package/.output/public/assets/remote-config-DAOyn5xL.js +1 -0
  72. package/.output/public/assets/remote-config-DXv25LX1.js +6 -0
  73. package/.output/public/assets/{rotate-cw-Cv2aVbYr.js → rotate-cw-Ba-slJea.js} +1 -1
  74. package/.output/public/assets/routes-DM3TyTLW.js +2 -0
  75. package/.output/public/assets/routes-Des97uK_.js +1 -0
  76. package/.output/public/assets/search-dJG2BYmx.js +1 -0
  77. package/.output/public/assets/select-CA8r-UUe.js +1 -0
  78. package/.output/public/assets/send-DuMOCzbD.js +1 -0
  79. package/.output/public/assets/{sidebar-Di9SN47G.js → sidebar-yC7KdImc.js} +1 -1
  80. package/.output/public/assets/smartphone-D1C6BRd_.js +1 -0
  81. package/.output/public/assets/styles-BHLI87EH.css +2 -0
  82. package/.output/public/assets/switch-BsV3d4km.js +1 -0
  83. package/.output/public/assets/table-D8YjT_ht.js +1 -0
  84. package/.output/public/assets/tabs-RdhEl9sE.js +1 -0
  85. package/.output/public/assets/trash-2-B5KIvrXy.js +1 -0
  86. package/.output/public/assets/{undo-2-CUX96_BG.js → undo-2-CFcU9dIB.js} +1 -1
  87. package/.output/public/assets/{useCompositeListItem-JmyDfo3-.js → useCompositeListItem-lAmUsXcc.js} +1 -1
  88. package/.output/public/assets/{useMutation-DbYw7boA.js → useMutation-w3qYaU2L.js} +1 -1
  89. package/.output/public/assets/valueToPercent-Bn8p2lng.js +1 -0
  90. package/.output/server/{__23tanstack-start-server-fn-resolver-DJQS4eWX.mjs → __23tanstack-start-server-fn-resolver-q4YFIDyr.mjs} +94 -46
  91. package/.output/server/_chunks/ssr-renderer.mjs +2 -2
  92. package/.output/server/_libs/@base-ui/react+[...].mjs +1488 -183
  93. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  94. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
  95. package/.output/server/_libs/_.mjs +2 -0
  96. package/.output/server/_libs/lucide-react.mjs +22 -28
  97. package/.output/server/_libs/next-themes.mjs +1 -1
  98. package/.output/server/_libs/react-redux+[...].mjs +1 -1
  99. package/.output/server/_libs/recharts+[...].mjs +1 -1
  100. package/.output/server/_libs/sonner.mjs +1 -1
  101. package/.output/server/_libs/tanstack__react-query.mjs +1 -1
  102. package/.output/server/_ssr/{-native-builds-search-CwNcoXf4.mjs → -native-builds-search-Mm_AZoRU.mjs} +9 -3
  103. package/.output/server/_ssr/{BundleIdDisplay-LdRkYdnN.mjs → BundleIdDisplay-DvzlYWq8.mjs} +3 -3
  104. package/.output/server/_ssr/ChannelBadge-qF_Pc5Ud.mjs +23 -0
  105. package/.output/server/_ssr/{ConsoleFeatureUnavailable-BN-FZ8eG.mjs → ConsoleFeatureUnavailable-DKUgr0N_.mjs} +7 -7
  106. package/.output/server/_ssr/{EventDetails-B77sWxgh.mjs → EventDetails-T1XtYEDD.mjs} +8 -8
  107. package/.output/server/_ssr/{HashValueDisplay-C4Vs4cmO.mjs → HashValueDisplay-Cas_zjIS.mjs} +7 -7
  108. package/.output/server/_ssr/{InsightsPageHeader-Dx4jJ7X0.mjs → InsightsPageHeader-BrllhUl2.mjs} +8 -8
  109. package/.output/server/_ssr/IosInstall-CEHI8F2M.mjs +615 -0
  110. package/.output/server/_ssr/NativeBuildsNav-2xSHyA1a.mjs +38 -0
  111. package/.output/server/_ssr/{NotFoundPage-DB5cXeVZ.mjs → NotFoundPage-D6H9vxj_.mjs} +3 -3
  112. package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-BpGOEXjU.mjs} +13 -3
  113. package/.output/server/_ssr/RelativeTime-DpEVzDP9.mjs +237 -0
  114. package/.output/server/_ssr/{git-CTA8Aqr0.mjs → RolloutPercentageBadge-DW8-_w30.mjs} +20 -4
  115. package/.output/server/_ssr/RowReason-C-PjIxzq.mjs +186 -0
  116. package/.output/server/_ssr/SandboxBadge-CDdNew0R.mjs +97 -0
  117. package/.output/server/_ssr/TargetDisplay-BBsP7IaZ.mjs +83 -0
  118. package/.output/server/_ssr/{alert-dialog-DxboqQmd.mjs → alert-dialog-Bd4E9xdw.mjs} +2 -2
  119. package/.output/server/_ssr/{api-cvzOLlTy.mjs → api-BT7aA8UM.mjs} +167 -33
  120. package/.output/server/_ssr/{api-keys-C3QCQvpV.mjs → api-keys-D2NvcQZv.mjs} +2 -2
  121. package/.output/server/_ssr/{api-keys-CrbGr02t.mjs → api-keys-DjWpM20P.mjs} +11 -10
  122. package/.output/server/_ssr/{api-keys-rpc-BcTQzRLj.mjs → api-keys-rpc-nM5H7V7f.mjs} +4 -4
  123. package/.output/server/_ssr/{api-rpc-B48nsUak.mjs → api-rpc-DX4HynbW.mjs} +83 -35
  124. package/.output/server/_ssr/{auth-rpc-C0gtG9nJ.mjs → auth-rpc-LCxTtYz2.mjs} +5 -5
  125. package/.output/server/_ssr/{auth.server-B0JikHOQ.mjs → auth.server-CERo_xef.mjs} +797 -174
  126. package/.output/server/_ssr/{badge-oO-0mLsr.mjs → badge-Dpp4q7sD.mjs} +4 -45
  127. package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-BP40zYSt.mjs} +1 -1
  128. package/.output/server/_ssr/card-CFCftDfI.mjs +49 -0
  129. package/.output/server/_ssr/{config.server-CJVHGJtr.mjs → config.server-5W5WD8x2.mjs} +4 -4
  130. package/.output/server/_ssr/{console-access-4TW5Af_n.mjs → console-access-B0S5YFUa.mjs} +2 -2
  131. package/.output/server/_ssr/{console-features-api-DfzZRyXa.mjs → console-features-api-CV_EReEj.mjs} +4 -4
  132. package/.output/server/_ssr/{console-features-rpc-DqNpa3U9.mjs → console-features-rpc-D3xlQsuy.mjs} +4 -4
  133. package/.output/server/_ssr/{console-features-BTV-XuhQ.mjs → console-features-xaGDhRC9.mjs} +1 -1
  134. package/.output/server/_ssr/{createServerRpc-BVvRVOz5.mjs → createServerRpc-DJZel12M.mjs} +1 -1
  135. package/.output/server/_ssr/{databaseConfig-B_Bg7qS5.mjs → databaseConfig-XAvDetmn.mjs} +1 -1
  136. package/.output/server/_ssr/{databaseJsonValue-kS7cvEtz.mjs → databaseJsonValue-DuUoft8j.mjs} +1 -1
  137. package/.output/server/_ssr/{databaseRows-B6H8Cmgq.mjs → databaseRows-BtRVBD0C.mjs} +3 -3
  138. package/.output/server/_ssr/deviceProfileToken-CwWb1lPq.mjs +82 -0
  139. package/.output/server/_ssr/{dialog-DsuMZ5oh.mjs → dialog-DQR_QI_X.mjs} +2 -2
  140. package/.output/server/_ssr/{dist-TEpM_UAD.mjs → dist-B6-irDRA.mjs} +1 -1
  141. package/.output/server/_ssr/{downloadBundle-DCmr7vsj.mjs → downloadBundle-DnoYpi36.mjs} +1 -1
  142. package/.output/server/_ssr/{empty-r4kJO91t.mjs → empty-C7PFnkCH.mjs} +3 -3
  143. package/.output/server/_ssr/{empty-plugin-adapters-zrZ0xs6n.mjs → empty-plugin-adapters-BYBYBaxo.mjs} +1 -1
  144. package/.output/server/_ssr/{failureReports-Cn_zU9S8.mjs → failureReports-BA2eg11O.mjs} +3 -3
  145. package/.output/server/_ssr/{field-DfXmt9CS.mjs → field-BqYN8sZT.mjs} +3 -3
  146. package/.output/server/_ssr/foldedPage-CqpVk31Q.mjs +176 -0
  147. package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-CdqFonhl.mjs} +2 -2
  148. package/.output/server/_ssr/{input-group-BCO7zTpU.mjs → input-group-Brv0mmyp.mjs} +2 -2
  149. package/.output/server/_ssr/{insights-CRu5FUj8.mjs → insights--xI3A0KI.mjs} +5 -5
  150. package/.output/server/_ssr/{insights-DrrhPDER.mjs → insights-CD1e3EnW.mjs} +2 -2
  151. package/.output/server/_ssr/{insights-Csqlj6u7.mjs → insights-Dd0VdO-1.mjs} +27 -26
  152. package/.output/server/_ssr/{insights-api-NW5VCXqg.mjs → insights-api-Bt2XVa4Y.mjs} +5 -5
  153. package/.output/server/_ssr/{insights-errors-7BCwFybo.mjs → insights-errors-CXHg1lLV.mjs} +2 -2
  154. package/.output/server/_ssr/{insights-failures-B9VPkzZE.mjs → insights-failures-7zH97WOO.mjs} +2 -2
  155. package/.output/server/_ssr/{insights-failures-rpc-CoFrAOK9.mjs → insights-failures-rpc-DBGzXP5A.mjs} +11 -11
  156. package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-BhOg6kz2.mjs} +1 -1
  157. package/.output/server/_ssr/{insights-recovery-rpc-sud_FyGW.mjs → insights-recovery-rpc-C6fAh-i_.mjs} +7 -7
  158. package/.output/server/_ssr/{insights-rpc-Ce2Isz9q.mjs → insights-rpc-pThKC9oj.mjs} +4 -4
  159. package/.output/server/_ssr/{insights-search-B0O3YoO2.mjs → insights-search-iFN4UaUv.mjs} +5 -5
  160. package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-h8fipPTv.mjs} +1 -1
  161. package/.output/server/_ssr/{insights-usage-rpc-Cwf1t4aW.mjs → insights-usage-rpc-B-RLvdLZ.mjs} +5 -5
  162. package/.output/server/_ssr/{insights-usage-rpc-C-cS2F9s.mjs → insights-usage-rpc-CGHZQ9jq.mjs} +7 -7
  163. package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-BjSiV_X_.mjs} +3 -3
  164. package/.output/server/_ssr/{insights_.distribution-DIkh5VqM.mjs → insights_.distribution-C6iXJ93Y.mjs} +15 -14
  165. package/.output/server/_ssr/{insights_.distribution-D52TkQ2V.mjs → insights_.distribution-E6Ns2aN7.mjs} +2 -2
  166. package/.output/server/_ssr/{insights_.distribution--3aR6Kpy.mjs → insights_.distribution-xHmfwwa5.mjs} +5 -5
  167. package/.output/server/_ssr/{installations-Bu4Lb0x9.mjs → installations-7V-Xyui8.mjs} +12 -12
  168. package/.output/server/_ssr/{installations-DftevpDt.mjs → installations-CZnN6slr.mjs} +4 -4
  169. package/.output/server/_ssr/{installations-C818mFCp.mjs → installations-D6Upc9Rt.mjs} +2 -2
  170. package/.output/server/_ssr/ios-devices-rpc-CXuHk24G.mjs +139 -0
  171. package/.output/server/_ssr/iosDeviceProfile-BESi_onx.mjs +176 -0
  172. package/.output/server/_ssr/iosDevices-BmvvvZRo.mjs +129 -0
  173. package/.output/server/_ssr/listReleases-DYYA5alS.mjs +94 -0
  174. package/.output/server/_ssr/{request-guard-CPdRBuGW.mjs → local-console-Dtxlsav0.mjs} +2 -9
  175. package/.output/server/_ssr/{native-builds-DOASMwGh.mjs → native-builds-BUojmVWC.mjs} +3 -3
  176. package/.output/server/_ssr/native-builds-BXBkklfA.mjs +197 -0
  177. package/.output/server/_ssr/native-builds-BhDCE89P.mjs +717 -0
  178. package/.output/server/_ssr/{native-builds_._buildId-CTytnLBB.mjs → native-builds_._buildId-DRiCNDdO.mjs} +3 -3
  179. package/.output/server/_ssr/native-builds_._buildId-DkMpG-OB.mjs +1176 -0
  180. package/.output/server/_ssr/native-builds_.devices-DSideebA.mjs +10 -0
  181. package/.output/server/_ssr/native-builds_.devices-DsOx1R36.mjs +702 -0
  182. package/.output/server/_ssr/nativeBuildDownloadLink-DDAUVU8q.mjs +96 -0
  183. package/.output/server/_ssr/nativeBuildInstall-CcBrfTsc.mjs +250 -0
  184. package/.output/server/_ssr/nativeBuilds-Cub0EUGN.mjs +287 -0
  185. package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-CX7wutet.mjs} +6 -6
  186. package/.output/server/_ssr/publicConsoleBase-f67NLLXZ.mjs +610 -0
  187. package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-DeICczY7.mjs} +2 -2
  188. package/.output/server/_ssr/{release-adoption-rpc-OizwttJD.mjs → release-adoption-rpc-BjMXMi9A.mjs} +9 -9
  189. package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-kHZo8P90.mjs} +4 -4
  190. package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-D9dAMI17.mjs} +3 -3
  191. package/.output/server/_ssr/{releaseManagement-DHUux2az.mjs → releaseManagement-EPhok_Py.mjs} +1 -1
  192. package/.output/server/_ssr/{releaseReachability-DZOK_dH-.mjs → releaseReachability-DaZ7ifUF.mjs} +2 -2
  193. package/.output/server/_ssr/{remote-config-DaBgnVnL.mjs → remote-config-B1iZuZOF.mjs} +2 -2
  194. package/.output/server/_ssr/{remote-config-Dypc_nuk.mjs → remote-config-C_DprbJz.mjs} +23 -22
  195. package/.output/server/_ssr/{remote-config-DZu7gJLL.mjs → remote-config-C_q6FBE4.mjs} +3 -3
  196. package/.output/server/_ssr/{remote-config-rpc-DOfPhqli.mjs → remote-config-rpc-BFTPcMfZ.mjs} +5 -5
  197. package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
  198. package/.output/server/_ssr/{router-BkRbvels.mjs → router-BDXPwfwl.mjs} +92 -59
  199. package/.output/server/_ssr/{routes-D9JnXVWL.mjs → routes-BJeztqpQ.mjs} +388 -432
  200. package/.output/server/_ssr/{routes-BeTsUkNX.mjs → routes-DpapxHLc.mjs} +14 -17
  201. package/.output/server/_ssr/{runtime.server-BdMY1blX.mjs → runtime.server-CkSbWaZm.mjs} +4 -4
  202. package/.output/server/_ssr/{schema-ChlRtZIo.mjs → schema-3oDJJFWa.mjs} +1 -1
  203. package/.output/server/_ssr/{schema-migration-rpc-B2VGxRY6.mjs → schema-migration-rpc-a4bLEdaP.mjs} +4 -4
  204. package/.output/server/_ssr/{select-Cywc0NmT.mjs → select-C9HpIZxd.mjs} +2 -2
  205. package/.output/server/_ssr/{server-Ds-fU1zf.mjs → server-C8ZmMWnn.mjs} +7 -7
  206. package/.output/server/_ssr/{sidebar-t0NiN0-2.mjs → sidebar-BrVL3L7R.mjs} +3 -3
  207. package/.output/server/_ssr/ssr.mjs +1 -1
  208. package/.output/server/_ssr/{start-BvDsQehg.mjs → start-D3noqqOK.mjs} +2 -2
  209. package/.output/server/_ssr/{switch-D1T38CnM.mjs → switch-DtnsoZHO.mjs} +3 -3
  210. package/.output/server/_ssr/{table-L9ZQgxNF.mjs → table-Bg7nCnct.mjs} +2 -2
  211. package/.output/server/_ssr/{tabs-BiByrAnU.mjs → tabs-BEIoGLTL.mjs} +4 -4
  212. package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-D0bP_Ume.mjs} +3 -3
  213. package/.output/server/_ssr/{uuidv7-BIF4nb_q.mjs → uuidv7-CmHbryZT.mjs} +2 -2
  214. package/.output/server/_ssr/{version-CQ98ZBpL-CWSkTT9J.mjs → version-CQ98ZBpL-NmbU0MD2.mjs} +1 -1
  215. package/.output/server/_tanstack-start-manifest_v-C_TPyfFP.mjs +225 -0
  216. package/.output/server/index.mjs +479 -381
  217. package/lib/index.d.mts +9 -0
  218. package/package.json +7 -30
  219. package/src/components/ChannelBadge.tsx +9 -9
  220. package/src/components/DataTable.tsx +347 -0
  221. package/src/components/FoldedRows.tsx +219 -0
  222. package/src/components/HashValueDisplay.tsx +6 -3
  223. package/src/components/PlatformIcon.tsx +10 -0
  224. package/src/components/RelativeTime.tsx +31 -0
  225. package/src/components/RowReason.tsx +56 -0
  226. package/src/components/TargetDisplay.tsx +69 -0
  227. package/src/components/ThemeProvider.tsx +11 -2
  228. package/src/components/features/api-keys/ApiKeysPage.tsx +1 -1
  229. package/src/components/features/channels/ChannelManagementDialog.tsx +5 -10
  230. package/src/components/features/insights/ReleaseActivity.tsx +1 -1
  231. package/src/components/features/native-builds/BuiltInBundleCard.tsx +108 -58
  232. package/src/components/features/native-builds/CommitLink.tsx +3 -2
  233. package/src/components/features/native-builds/ImportBuild.tsx +1 -1
  234. package/src/components/features/native-builds/InstallCard.tsx +310 -67
  235. package/src/components/features/native-builds/IosDevicesPage.tsx +944 -0
  236. package/src/components/features/native-builds/IosInstall.tsx +632 -0
  237. package/src/components/features/native-builds/IpaDevicesCard.tsx +111 -0
  238. package/src/components/features/native-builds/NativeBuildDetailPage.tsx +21 -4
  239. package/src/components/features/native-builds/NativeBuildsNav.tsx +44 -0
  240. package/src/components/features/native-builds/NativeBuildsPage.tsx +65 -76
  241. package/src/components/features/native-builds/NativeBuildsTable.tsx +668 -318
  242. package/src/components/features/native-builds/OlderBuildLabel.tsx +61 -0
  243. package/src/components/features/native-builds/PatchesCard.tsx +3 -2
  244. package/src/components/features/native-builds/ReleaseNativeBuildLink.tsx +4 -4
  245. package/src/components/features/native-builds/SandboxBadge.tsx +21 -0
  246. package/src/components/features/native-builds/ServedNowCard.tsx +33 -1
  247. package/src/components/features/native-builds/ShortHash.tsx +6 -3
  248. package/src/components/features/native-builds/StoreSubmission.tsx +18 -12
  249. package/src/components/features/native-builds/playTracks.ts +19 -0
  250. package/src/components/features/remote-config/PublishDialog.tsx +4 -1
  251. package/src/components/features/remote-config/VersionsCard.tsx +5 -2
  252. package/src/components/ui/badge.tsx +2 -0
  253. package/src/components/ui/sonner.tsx +3 -1
  254. package/src/index.ts +9 -0
  255. package/src/lib/api-rpc.ts +124 -35
  256. package/src/lib/api.ts +150 -14
  257. package/src/lib/ios-devices-api.ts +110 -0
  258. package/src/lib/ios-devices-rpc.ts +183 -0
  259. package/src/lib/native-builds.ts +160 -17
  260. package/src/lib/server/console-runtime.server.ts +9 -2
  261. package/src/lib/server/deviceProfileToken.ts +187 -0
  262. package/src/lib/server/foldedPage.ts +360 -0
  263. package/src/lib/server/iosDeviceProfile.ts +230 -0
  264. package/src/lib/server/iosDevices.ts +223 -0
  265. package/src/lib/server/listReleases.ts +101 -62
  266. package/src/lib/server/local-console.ts +1 -1
  267. package/src/lib/server/nativeBuildDownloadLink.ts +193 -0
  268. package/src/lib/server/nativeBuildInstall.ts +495 -0
  269. package/src/lib/server/nativeBuilds.ts +308 -59
  270. package/src/lib/server/plistText.ts +17 -0
  271. package/src/lib/server/publicConsoleBase.ts +17 -0
  272. package/src/routeTree.gen.ts +85 -18
  273. package/src/routes/-native-builds-search.ts +20 -0
  274. package/src/routes/[_]hot-updater/devices/device-response.ts +21 -0
  275. package/src/routes/[_]hot-updater/devices/device[.]mobileconfig.ts +17 -0
  276. package/src/routes/[_]hot-updater/native-builds/$buildId/manifest[.]plist.ts +22 -0
  277. package/src/routes/api/native-builds/$buildId/download.ts +22 -1
  278. package/src/routes/index.tsx +541 -532
  279. package/src/routes/native-builds_.devices.tsx +21 -0
  280. package/src/styles.css +24 -0
  281. package/.output/public/assets/HashValueDisplay-6lNRxDJX.js +0 -1
  282. package/.output/public/assets/RolloutPercentageBadge-Cxogpi8F.js +0 -1
  283. package/.output/public/assets/StoreSubmission-ViTkW4eJ.js +0 -1
  284. package/.output/public/assets/api-P2g8dCNg.js +0 -1
  285. package/.output/public/assets/api-keys-DWQC2q6y.js +0 -1
  286. package/.output/public/assets/api-keys-FueRkF9q.js +0 -1
  287. package/.output/public/assets/arrow-left-g9cKqXuC.js +0 -1
  288. package/.output/public/assets/arrow-right-CNII8TYn.js +0 -1
  289. package/.output/public/assets/arrow-up-right-DK8Zdg40.js +0 -1
  290. package/.output/public/assets/badge-DWFcDWho.js +0 -1
  291. package/.output/public/assets/check-CXVR3s3X.js +0 -1
  292. package/.output/public/assets/chevron-right-BoUXo82O.js +0 -1
  293. package/.output/public/assets/dialog-CNUPxNxH.js +0 -1
  294. package/.output/public/assets/empty-B3Uwdd6k.js +0 -1
  295. package/.output/public/assets/field-D-2-mnNh.js +0 -1
  296. package/.output/public/assets/history-DqHlgSuV.js +0 -1
  297. package/.output/public/assets/index-CqP5HPV6.js +0 -10
  298. package/.output/public/assets/insights-B-0odqpt.js +0 -42
  299. package/.output/public/assets/insights-BSVGfxSL.js +0 -1
  300. package/.output/public/assets/insights-NK5B6ReS.js +0 -2
  301. package/.output/public/assets/insights-api-BVCXJsoV.js +0 -1
  302. package/.output/public/assets/insights-usage-rpc-CKQH0pUS.js +0 -1
  303. package/.output/public/assets/insights_.distribution-CJvgwcVZ.js +0 -2
  304. package/.output/public/assets/insights_.distribution-DblZM0mO.js +0 -1
  305. package/.output/public/assets/insights_.distribution-dvk6vYDM.js +0 -1
  306. package/.output/public/assets/installations-B674P5Z5.js +0 -2
  307. package/.output/public/assets/installations-BWxczZ2t.js +0 -1
  308. package/.output/public/assets/installations-Dv4kWQYz.js +0 -1
  309. package/.output/public/assets/native-builds-BOC71grI.js +0 -1
  310. package/.output/public/assets/native-builds-D6rldpSh.js +0 -2
  311. package/.output/public/assets/native-builds-DAy2678K.js +0 -1
  312. package/.output/public/assets/native-builds_._buildId-DD58_Phd.js +0 -1
  313. package/.output/public/assets/native-builds_._buildId-DvQDKnUQ.js +0 -2
  314. package/.output/public/assets/plus-BReVKct-.js +0 -1
  315. package/.output/public/assets/preload-helper-B44EvKhG.js +0 -1
  316. package/.output/public/assets/remote-config-B7ujqhLa.js +0 -6
  317. package/.output/public/assets/remote-config-WjpozBG5.js +0 -1
  318. package/.output/public/assets/remote-config-gXeH6PBW.js +0 -1
  319. package/.output/public/assets/routes-BDdBIxYS.js +0 -1
  320. package/.output/public/assets/routes-CCD33Azv.js +0 -2
  321. package/.output/public/assets/search-BCel4Oy6.js +0 -1
  322. package/.output/public/assets/select-CBIU0_M1.js +0 -1
  323. package/.output/public/assets/smartphone-CMaSy_ir.js +0 -1
  324. package/.output/public/assets/styles-uK-0vUMk.css +0 -2
  325. package/.output/public/assets/switch-BpdiHL_t.js +0 -1
  326. package/.output/public/assets/table-Bpy3SvSo.js +0 -1
  327. package/.output/public/assets/tabs-Xmt7tZeG.js +0 -1
  328. package/.output/public/assets/useInfiniteQuery-DX4WpBRG.js +0 -1
  329. package/.output/public/assets/valueToPercent-BLwGy_xK.js +0 -1
  330. package/.output/server/_ssr/RolloutPercentageBadge-vmwE8iae.mjs +0 -21
  331. package/.output/server/_ssr/StoreSubmission-DE4vgy5B.mjs +0 -139
  332. package/.output/server/_ssr/listReleases-D_GY00SQ.mjs +0 -79
  333. package/.output/server/_ssr/native-builds-CWjU--fI.mjs +0 -510
  334. package/.output/server/_ssr/native-builds-DhXL5zf_.mjs +0 -137
  335. package/.output/server/_ssr/native-builds_._buildId-D4lYJLIU.mjs +0 -813
  336. package/.output/server/_ssr/nativeBuildQr-84cnFQPX.mjs +0 -59
  337. package/.output/server/_ssr/nativeBuilds-B_7BPjt_.mjs +0 -133
  338. package/.output/server/_ssr/qr-code-C7kNRIDX.mjs +0 -22
  339. package/.output/server/_tanstack-start-manifest_v-B5nsO5L4.mjs +0 -184
  340. package/src/lib/server/nativeBuildQr.ts +0 -73
  341. package/src/routes/[_]hot-updater/native-builds/qr.ts +0 -14
  342. /package/.output/public/assets/{uuidv7-zXMtwR9Q.js → uuidv7-DAoOOpz9.js} +0 -0
@@ -1,14 +1,14 @@
1
- import { n as DatabaseBundleNotFoundError, r as DatabaseRowReferencedError } from "./databaseJsonValue-kS7cvEtz.mjs";
2
- import { O as parseReleaseCatalogScopeKey, a as RELEASE_CATALOG_FALLBACK_POLICY, c as createReleaseCatalogScopeKey, d as getAssetBaseStorageUri, f as getBundlePatch, h as getManifestStorageUri, l as decodeChannelKey, m as getManifestFileHash, r as NIL_UUID, s as canonicalizeAppVersion, u as encodeChannelKey, w as isUUIDv7 } from "./dist-TEpM_UAD.mjs";
3
- import { i as rowToBundle, n as bundleToRow, r as releaseRowToRelease, t as bundleToPatchRows } from "./databaseRows-B6H8Cmgq.mjs";
4
- import { t as ReleaseManagementError } from "./releaseManagement-DHUux2az.mjs";
5
- import { n as createUUIDv7After, t as createUUIDv7 } from "./uuidv7-BIF4nb_q.mjs";
6
- import { i as normalizeRange } from "./version-CQ98ZBpL-CWSkTT9J.mjs";
7
- import { n as projectCompiledCatalog, r as projectCompiledRollbackCatalog, t as compileReleaseCatalog } from "./releaseCatalogCompiler-DLcean2k.mjs";
8
- import { t as isRemoteDatabase } from "./databaseConfig-B_Bg7qS5.mjs";
9
- import { n as defineTable, t as defineAggregate } from "./schema-ChlRtZIo.mjs";
1
+ import { n as DatabaseBundleNotFoundError, r as DatabaseRowReferencedError } from "./databaseJsonValue-DuUoft8j.mjs";
2
+ import { O as parseReleaseCatalogScopeKey, a as RELEASE_CATALOG_FALLBACK_POLICY, c as createReleaseCatalogScopeKey, d as getAssetBaseStorageUri, f as getBundlePatch, h as getManifestStorageUri, l as decodeChannelKey, m as getManifestFileHash, r as NIL_UUID, s as canonicalizeAppVersion, u as encodeChannelKey, w as isUUIDv7 } from "./dist-B6-irDRA.mjs";
3
+ import { i as rowToBundle, n as bundleToRow, r as releaseRowToRelease, t as bundleToPatchRows } from "./databaseRows-BtRVBD0C.mjs";
4
+ import { t as ReleaseManagementError } from "./releaseManagement-EPhok_Py.mjs";
5
+ import { n as createUUIDv7After, t as createUUIDv7 } from "./uuidv7-CmHbryZT.mjs";
6
+ import { i as normalizeRange } from "./version-CQ98ZBpL-NmbU0MD2.mjs";
7
+ import { n as projectCompiledCatalog, r as projectCompiledRollbackCatalog, t as compileReleaseCatalog } from "./releaseCatalogCompiler-D9dAMI17.mjs";
8
+ import { t as isRemoteDatabase } from "./databaseConfig-XAvDetmn.mjs";
9
+ import { n as defineTable, t as defineAggregate } from "./schema-3oDJJFWa.mjs";
10
10
  import { r as rangesIntersect } from "../_libs/verkit.mjs";
11
- //#region node_modules/.nitro/vite/services/ssr/assets/auth.server-B0JikHOQ.js
11
+ //#region node_modules/.nitro/vite/services/ssr/assets/auth.server-CERo_xef.js
12
12
  var SHA256_FILE_HASH_RE = /^[0-9a-f]{64}$/;
13
13
  var isContentAddressedAssetFileHash = (value) => {
14
14
  return typeof value === "string" && SHA256_FILE_HASH_RE.test(value);
@@ -1007,6 +1007,21 @@ var channels = defineTable({
1007
1007
  * or `versionCode`. `submitted_to`, `submitted_at_ms` and
1008
1008
  * `submitted_version` record the store track a build went to, when, and
1009
1009
  * the store's label of the build; they stay null for a build no store took.
1010
+ * `is_store_build` is true on the build a person or a job says the store
1011
+ * sells, and false on every other: deploys patch from it over the scope's
1012
+ * newest build. The engine copies the scope key into `store_build_scope_key`
1013
+ * for that build alone, so `byStoreBuild` holds one entry per scope at most,
1014
+ * on every store, while any number of a scope's builds hold none.
1015
+ * `is_sandbox` is true on a sandbox build, set when it registers and never
1016
+ * changed, and `sandbox_url_scheme` is the URL scheme its artifact registers,
1017
+ * which its preview links open; null on any other build, and on a sandbox
1018
+ * build registered before the column, which registered the derived one.
1019
+ * `export_method` is how an `.ipa` was exported, read from its profile when
1020
+ * it registers and never changed; null on any other artifact, on an `.ipa`
1021
+ * whose profile couldn't be read, and on one registered before the column.
1022
+ * Boolean columns follow one rule: `is_*` for a fact about the row or
1023
+ * `should_*` for an instruction to the client, never null; a unique index over
1024
+ * the rows where one is true keys a derived slot, not the boolean.
1010
1025
  */
1011
1026
  var nativeBuilds = defineTable({
1012
1027
  id: {
@@ -1083,9 +1098,28 @@ var nativeBuilds = defineTable({
1083
1098
  type: "string",
1084
1099
  maxLength: 255,
1085
1100
  required: false
1101
+ },
1102
+ is_store_build: { type: "boolean" },
1103
+ is_sandbox: { type: "boolean" },
1104
+ sandbox_url_scheme: {
1105
+ type: "string",
1106
+ maxLength: 255,
1107
+ ascii: true,
1108
+ required: false
1109
+ },
1110
+ export_method: {
1111
+ type: "string",
1112
+ maxLength: 16,
1113
+ required: false
1086
1114
  }
1087
1115
  }, {
1088
1116
  key: ["id"],
1117
+ derived: { store_build_scope_key: {
1118
+ type: "string",
1119
+ maxLength: 2048,
1120
+ ascii: true,
1121
+ compute: (row) => row.is_store_build ? row.scope_key : null
1122
+ } },
1089
1123
  indexes: {
1090
1124
  byScope: {
1091
1125
  eq: ["scope_key"],
@@ -1095,6 +1129,11 @@ var nativeBuilds = defineTable({
1095
1129
  eq: ["scope_key", "build_key"],
1096
1130
  sort: ["id"]
1097
1131
  },
1132
+ byStoreBuild: {
1133
+ eq: ["store_build_scope_key"],
1134
+ sort: [],
1135
+ unique: true
1136
+ },
1098
1137
  byChannel: {
1099
1138
  eq: ["channel_id"],
1100
1139
  sort: ["id"],
@@ -1106,6 +1145,115 @@ var nativeBuilds = defineTable({
1106
1145
  }
1107
1146
  }
1108
1147
  });
1148
+ /**
1149
+ * The iPhones a team asks to install ad hoc builds on. A row decides what the
1150
+ * CLI registers with Apple, not what an export includes: Xcode's automatic ad
1151
+ * hoc profile lists every device the Apple account has enabled. `status` is
1152
+ * `pending` until someone approves it, `approved` until a build or
1153
+ * `native-build devices add` registers it with Apple, then `registered`;
1154
+ * declining or removing one deletes its row. `udid` is the UDID in lower case.
1155
+ * `apple_issuer_id` is the App Store Connect issuer whose key registered it,
1156
+ * set once: a build signed by another account never registers these rows.
1157
+ * `apple_error` is Apple's refusal of the device, or why it stopped counting
1158
+ * it, cleared by the next success. `build_id` is the newest native build whose
1159
+ * .ipa the CLI checked lists it; deleting that build never touches the row.
1160
+ * It holds personal data: a UDID, a name, and the emails of who asked and who
1161
+ * approved, null for the CLI.
1162
+ */
1163
+ var iosDevices = defineTable({
1164
+ id: {
1165
+ type: "string",
1166
+ maxLength: 36
1167
+ },
1168
+ udid: {
1169
+ type: "string",
1170
+ maxLength: 40,
1171
+ ascii: true,
1172
+ unique: true
1173
+ },
1174
+ name: {
1175
+ type: "string",
1176
+ maxLength: 100
1177
+ },
1178
+ status: {
1179
+ type: "string",
1180
+ maxLength: 16
1181
+ },
1182
+ requested_by: {
1183
+ type: "string",
1184
+ maxLength: 320,
1185
+ required: false
1186
+ },
1187
+ created_at_ms: { type: "integer" },
1188
+ approved_by: {
1189
+ type: "string",
1190
+ maxLength: 320,
1191
+ required: false
1192
+ },
1193
+ approved_at_ms: {
1194
+ type: "integer",
1195
+ required: false
1196
+ },
1197
+ registered_at_ms: {
1198
+ type: "integer",
1199
+ required: false
1200
+ },
1201
+ apple_issuer_id: {
1202
+ type: "string",
1203
+ maxLength: 64,
1204
+ ascii: true,
1205
+ required: false
1206
+ },
1207
+ apple_error: {
1208
+ type: "string",
1209
+ maxLength: 512,
1210
+ required: false
1211
+ },
1212
+ build_id: {
1213
+ type: "string",
1214
+ maxLength: 36,
1215
+ required: false
1216
+ }
1217
+ }, {
1218
+ key: ["id"],
1219
+ indexes: {
1220
+ byStatus: {
1221
+ eq: ["status"],
1222
+ sort: ["id"]
1223
+ },
1224
+ all: {
1225
+ eq: [],
1226
+ sort: ["id"]
1227
+ }
1228
+ }
1229
+ });
1230
+ /**
1231
+ * The Apple account the iOS device registry belongs to: one row, keyed
1232
+ * `registry`, holding the App Store Connect issuer that first registered a
1233
+ * device. A build claims it before it sends Apple anything, and its key makes
1234
+ * the claim atomic on every store, so two builds of two accounts can't both
1235
+ * spend a slot; another account's build then registers nothing. Removing
1236
+ * devices never releases it.
1237
+ */
1238
+ var iosDeviceAccount = defineTable({
1239
+ id: {
1240
+ type: "string",
1241
+ maxLength: 16,
1242
+ ascii: true
1243
+ },
1244
+ apple_issuer_id: {
1245
+ type: "string",
1246
+ maxLength: 64,
1247
+ ascii: true
1248
+ },
1249
+ claimed_at_ms: { type: "integer" }
1250
+ }, {
1251
+ key: ["id"],
1252
+ indexes: { all: {
1253
+ eq: [],
1254
+ sort: ["id"]
1255
+ } }
1256
+ });
1109
1257
  /** Core's module: always installed, never a plugin. */
1110
1258
  var coreModule = {
1111
1259
  id: "core",
@@ -1126,7 +1274,9 @@ var coreModule = {
1126
1274
  sort: []
1127
1275
  } }
1128
1276
  }),
1129
- native_builds: nativeBuilds
1277
+ native_builds: nativeBuilds,
1278
+ ios_devices: iosDevices,
1279
+ ios_device_account: iosDeviceAccount
1130
1280
  }
1131
1281
  };
1132
1282
  var encoder = new TextEncoder();
@@ -1286,15 +1436,8 @@ var LEASE_TABLE = "aggregate_lease";
1286
1436
  var LEASE = { id: "compaction" };
1287
1437
  /** How long a compaction holds the lease before another process may take it. */
1288
1438
  var LEASE_MS = 3e4;
1289
- /**
1290
- * Default windows: log mode compacts every 60 seconds, since reads compact
1291
- * first; memory mode flushes every 15, since its window is what a crash
1292
- * loses.
1293
- */
1294
- var WINDOW_MS = {
1295
- log: 6e4,
1296
- memory: 15e3
1297
- };
1439
+ /** A commit compacts once this has passed since the last compaction. */
1440
+ var WINDOW_MS = 6e4;
1298
1441
  /** Log rows a compaction reads from each log table for one group. */
1299
1442
  var LOG_PAGE = 200;
1300
1443
  /**
@@ -1308,8 +1451,6 @@ var GROUPS = {
1308
1451
  };
1309
1452
  /** Tries per write after a conflict or a transient error. */
1310
1453
  var ATTEMPTS = 5;
1311
- /** Aggregate rows a memory buffer holds before a commit waits for a flush. */
1312
- var MAX_BUFFERED = 1e4;
1313
1454
  var log = defineTable({
1314
1455
  id: {
1315
1456
  type: "string",
@@ -1358,7 +1499,7 @@ var valuesOf = ({ deltas, sketches }) => ({
1358
1499
  /**
1359
1500
  * Merges `values` into the change for `key`'s identity as `tx.aggregate`
1360
1501
  * does: deltas add up and sketches merge. One constant `shardBy` keys each
1361
- * identity to one entry; the write picks the shard.
1502
+ * identity to one entry; `compile` writes it to shard 0.
1362
1503
  */
1363
1504
  var merge = (into, model, key, values) => recordAggregate(into, model, Object.fromEntries(shapeOf(model).key.map((field, at) => [field, key[at]])), values, "");
1364
1505
  var mergeAll = (into, changes) => {
@@ -1392,7 +1533,7 @@ var increment = ({ model, deltas }, key) => Object.values(deltas).some((delta) =
1392
1533
  /**
1393
1534
  * The guarded write that merges `change` into `current`: insert, patch, or
1394
1535
  * delete at zero. Unlike a transaction's, a gauge may go below zero here: a
1395
- * shard row holds one writer's net changes, and reads sum every shard.
1536
+ * group can hold a loss without the gain before it, and reads sum every shard.
1396
1537
  */
1397
1538
  var rewrite = (change, key, current) => {
1398
1539
  const { model } = change;
@@ -1430,12 +1571,12 @@ var rewrite = (change, key, current) => {
1430
1571
  };
1431
1572
  };
1432
1573
  /**
1433
- * The write for each change on its shard: a blind increment that creates
1434
- * the row for counters, and a guarded rewrite for gauges and sketches, whose
1435
- * rows are read in one batch per table.
1574
+ * The write for each change on shard 0, since one compaction runs at a time:
1575
+ * a blind increment that creates the row for counters, and a guarded rewrite
1576
+ * for gauges and sketches, whose rows are read in one batch per table.
1436
1577
  */
1437
- var compile = async (adapter, changes, shard) => {
1438
- const keys = changes.map(({ model, key }) => [...key.slice(0, -1), shard(model)]);
1578
+ var compile = async (adapter, changes) => {
1579
+ const keys = changes.map(({ key }) => [...key.slice(0, -1), 0]);
1439
1580
  const reads = /* @__PURE__ */ new Map();
1440
1581
  changes.forEach((change, at) => {
1441
1582
  if (rewrites(change)) reads.set(change.model, [...reads.get(change.model) ?? [], at]);
@@ -1489,14 +1630,13 @@ var encode = async (changes) => {
1489
1630
  return zipped !== void 0 && zipped.length < json.length ? `z${zipped}` : json;
1490
1631
  };
1491
1632
  /**
1492
- * Batches changes to aggregates declared `batched`. A transaction records
1493
- * them without writing their rows; once it commits, "memory" mode keeps
1494
- * them in this process until its timer flushes them, and "log" mode has
1495
- * written them as one log row in the same atomic write, which a compaction
1496
- * later merges into the aggregates and deletes, atomically again, so each
1497
- * applies exactly once. One lease row keeps compactions one at a time.
1633
+ * Batches changes to aggregates declared `batched`. A transaction writes
1634
+ * them as one log row in its own atomic write, in place of their rows; a
1635
+ * compaction later merges log rows into the aggregates and deletes them,
1636
+ * atomically again, so each applies exactly once. One lease row keeps
1637
+ * compactions one at a time.
1498
1638
  */
1499
- var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log", windowMs = WINDOW_MS[mode] }, now }) => {
1639
+ var createAggregateBatches = ({ engine, adapter, schema, batching: { windowMs = WINDOW_MS }, now }) => {
1500
1640
  if (!schema.models.has(LEASE_TABLE)) throw new DatabaseTransactionError("An engine that batches aggregates needs aggregateBatchingModule in its schema.");
1501
1641
  const holder = crypto.randomUUID().replaceAll("-", "");
1502
1642
  const table = (name) => schema.models.get(name).table;
@@ -1524,68 +1664,6 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1524
1664
  }
1525
1665
  return changes;
1526
1666
  };
1527
- /**
1528
- * Writes changes in atomic chunks within `fits`, and returns the ones it
1529
- * could not apply. A write whose outcome is unknown is dropped, never
1530
- * resent, so no change applies twice.
1531
- */
1532
- const apply = async (changes, shard) => {
1533
- let rest = changes;
1534
- let ops = [];
1535
- let read = true;
1536
- for (let failures = 0; rest.length > 0 && failures < ATTEMPTS;) try {
1537
- if (read) ops = await compile(adapter, rest, shard);
1538
- let size = rest.length;
1539
- const chunk = () => ops.slice(0, size).filter(isOp);
1540
- while (size > 1 && !adapter.fits(chunk())) size = Math.ceil(size / 2);
1541
- let result = { ok: true };
1542
- if (chunk().length > 0) result = await adapter.write(chunk()).catch((error) => {
1543
- warn("flush")(error);
1544
- return { ok: true };
1545
- });
1546
- read = !result.ok && !("retry" in result);
1547
- if (result.ok) {
1548
- rest = rest.slice(size);
1549
- ops = ops.slice(size);
1550
- failures = 0;
1551
- } else {
1552
- failures += 1;
1553
- if (!read) await sleep(failures);
1554
- }
1555
- } catch (error) {
1556
- warn("flush")(error);
1557
- return rest;
1558
- }
1559
- return rest;
1560
- };
1561
- let buffer = /* @__PURE__ */ new Map();
1562
- let timer;
1563
- let flushing;
1564
- const shards = /* @__PURE__ */ new Map();
1565
- /** Each process writes its own shard, so flushes of two processes rarely meet. */
1566
- const processShard = (model) => {
1567
- if (!shards.has(model)) shards.set(model, Math.floor(Math.random() * shapeOf(model).shards));
1568
- return shards.get(model);
1569
- };
1570
- const schedule = () => {
1571
- if (timer !== void 0 || buffer.size === 0) return;
1572
- timer = setTimeout(() => {
1573
- timer = void 0;
1574
- flushBuffer();
1575
- }, windowMs);
1576
- timer.unref?.();
1577
- };
1578
- /** Never rejects: what it cannot apply goes back into the buffer. */
1579
- const flushBuffer = () => flushing ??= (async () => {
1580
- clearTimeout(timer);
1581
- timer = void 0;
1582
- const pending = [...buffer.values()];
1583
- buffer = /* @__PURE__ */ new Map();
1584
- mergeAll(buffer, await apply(pending, processShard));
1585
- })().catch(warn("flush")).finally(() => {
1586
- flushing = void 0;
1587
- schedule();
1588
- });
1589
1667
  let nextDue = 0;
1590
1668
  let compacting;
1591
1669
  /** Log rows this process read, by `[log table's index, id]`, for the deletes after a group. */
@@ -1720,7 +1798,7 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1720
1798
  more
1721
1799
  };
1722
1800
  };
1723
- const rowsFor = async (changes) => (await compile(adapter, changes, () => 0)).filter(isOp);
1801
+ const rowsFor = async (changes) => (await compile(adapter, changes)).filter(isOp);
1724
1802
  /**
1725
1803
  * Applies the oldest pending log rows whose merged changes fit in one
1726
1804
  * atomic write with the lease, which lists them as applied; the rows are
@@ -1814,20 +1892,6 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1814
1892
  }))).then((pages) => pages.some((page) => page.rows.length > 0)).finally(() => {
1815
1893
  checking = void 0;
1816
1894
  });
1817
- /** Takes a committed transaction's changes; never rejects, since the transaction already committed. */
1818
- const committed = async (changes) => {
1819
- if (mode === "log") {
1820
- if (now() >= nextDue) await compact(false, GROUPS.commit);
1821
- return;
1822
- }
1823
- mergeAll(buffer, changes.values());
1824
- schedule();
1825
- if (buffer.size >= MAX_BUFFERED) await flushBuffer();
1826
- };
1827
- const flush = async () => {
1828
- await flushBuffer();
1829
- if (mode === "log" && await hasPending()) await compact(true, GROUPS.flush);
1830
- };
1831
1895
  return {
1832
1896
  async transaction(fn) {
1833
1897
  let changes = /* @__PURE__ */ new Map();
@@ -1853,7 +1917,7 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1853
1917
  aggregate
1854
1918
  });
1855
1919
  if (failure) throw failure.error;
1856
- if (mode === "log" && attempt.size > 0) {
1920
+ if (attempt.size > 0) {
1857
1921
  const id = `${now().toString(36).padStart(9, "0")}${holder.slice(0, 8)}${crypto.randomUUID().slice(0, 8)}`;
1858
1922
  const shard = Math.floor(Math.random() * LOG_TABLES.length);
1859
1923
  const merged = mergeAll(/* @__PURE__ */ new Map(), attempt.values());
@@ -1867,24 +1931,18 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1867
1931
  open = false;
1868
1932
  }
1869
1933
  });
1870
- if (changes.size > 0) await committed(changes);
1934
+ if (changes.size > 0 && now() >= nextDue) await compact(false, GROUPS.commit);
1871
1935
  return result;
1872
1936
  },
1873
1937
  async beforeRead(name) {
1874
1938
  if (!isBatched(schema.models.get(name))) return;
1875
- if (buffer.size > 0 || flushing !== void 0) await flushBuffer();
1876
- if (mode === "log") {
1877
- if (await hasPending().catch((error) => {
1878
- warn("read")(error);
1879
- return false;
1880
- })) await compact(true, GROUPS.read);
1881
- }
1939
+ if (await hasPending().catch((error) => {
1940
+ warn("read")(error);
1941
+ return false;
1942
+ })) await compact(true, GROUPS.read);
1882
1943
  },
1883
- flush,
1884
- async dispose() {
1885
- clearTimeout(timer);
1886
- timer = void 0;
1887
- await flush();
1944
+ async flush() {
1945
+ if (await hasPending()) await compact(true, GROUPS.flush);
1888
1946
  }
1889
1947
  };
1890
1948
  };
@@ -2022,7 +2080,8 @@ var fieldProblems = (definition, add) => {
2022
2080
  else if (field.required === false) add(`key field "${name}" is nullable`);
2023
2081
  else if (field.type === "json") add(`key field "${name}" is json`);
2024
2082
  }
2025
- for (const [name, { type, maxLength, ascii }] of Object.entries(definition.fields)) {
2083
+ const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
2084
+ for (const [name, { type, maxLength, ascii }] of bounded) {
2026
2085
  if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
2027
2086
  if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
2028
2087
  }
@@ -2139,11 +2198,13 @@ var resolveSchema = (modules) => {
2139
2198
  ...maxLength === void 0 ? {} : { maxLength },
2140
2199
  ...ascii ? { ascii } : {}
2141
2200
  }));
2142
- if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
2201
+ if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
2143
2202
  name: field,
2144
2203
  type,
2145
2204
  nullable: true,
2146
- ...multi ? { multi } : {}
2205
+ ...multi ? { multi } : {},
2206
+ ...maxLength === void 0 ? {} : { maxLength },
2207
+ ...ascii ? { ascii } : {}
2147
2208
  });
2148
2209
  else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
2149
2210
  name: metric,
@@ -2801,9 +2862,6 @@ var createDatabaseEngine = ({ batching, now = Date.now, meter, ...options }) =>
2801
2862
  flush: async () => {
2802
2863
  await batches?.flush();
2803
2864
  },
2804
- dispose: async () => {
2805
- await batches?.dispose();
2806
- },
2807
2865
  database(module) {
2808
2866
  const name = (model) => module.namespace ? `${module.namespace}_${model}` : model;
2809
2867
  return {
@@ -2882,11 +2940,10 @@ var createEngine = (database, { plugins = [], now = Date.now } = {}) => {
2882
2940
  if (module === void 0) throw new HotUpdaterConfigError(`Plugin "${plugin.id}" is not one of this engine's plugins.`);
2883
2941
  return engine.database(module);
2884
2942
  },
2885
- flush: () => engine.flush(),
2886
- dispose: () => engine.dispose()
2943
+ flush: () => engine.flush()
2887
2944
  };
2888
2945
  };
2889
- var HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.3";
2946
+ var HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.30";
2890
2947
  /**
2891
2948
  * `/version` on both mounts. The admin mount also lists the ids of the
2892
2949
  * plugins the server runs, sorted; apps never learn which plugins a server
@@ -3321,8 +3378,8 @@ var baseBundleIdsOf = (row, range, bundleId, limit) => {
3321
3378
  return ids;
3322
3379
  };
3323
3380
  var PAGE$2 = 500;
3324
- var pick$1 = (fields) => (row) => Object.fromEntries(fields.map((field) => [field, row[field]]));
3325
- var toBundleRow = pick$1([
3381
+ var pick$2 = (fields) => (row) => Object.fromEntries(fields.map((field) => [field, row[field]]));
3382
+ var toBundleRow = pick$2([
3326
3383
  "id",
3327
3384
  "platform",
3328
3385
  "git_commit_hash",
@@ -3331,7 +3388,7 @@ var toBundleRow = pick$1([
3331
3388
  "manifest_file_hash",
3332
3389
  "asset_base_storage_uri"
3333
3390
  ]);
3334
- var toPatchRow = pick$1([
3391
+ var toPatchRow = pick$2([
3335
3392
  "id",
3336
3393
  "bundle_id",
3337
3394
  "base_bundle_id",
@@ -3341,7 +3398,7 @@ var toPatchRow = pick$1([
3341
3398
  "byte_size",
3342
3399
  "order_index"
3343
3400
  ]);
3344
- var toReleaseRow = pick$1([
3401
+ var toReleaseRow = pick$2([
3345
3402
  "id",
3346
3403
  "revision",
3347
3404
  "scope_key",
@@ -3362,7 +3419,7 @@ var toReleaseRow = pick$1([
3362
3419
  "created_at_ms",
3363
3420
  "updated_at_ms"
3364
3421
  ]);
3365
- var toCatalogRow = pick$1([
3422
+ var toCatalogRow = pick$2([
3366
3423
  "scope_key",
3367
3424
  "catalog_id",
3368
3425
  "strategy",
@@ -3377,7 +3434,7 @@ var toCatalogRow = pick$1([
3377
3434
  "is_tombstone",
3378
3435
  "updated_at_ms"
3379
3436
  ]);
3380
- var toChannelRow = pick$1(["id", "name"]);
3437
+ var toChannelRow = pick$2(["id", "name"]);
3381
3438
  /** Every page of one read, in order. */
3382
3439
  var drain = async (read) => {
3383
3440
  const rows = [];
@@ -3390,7 +3447,15 @@ var drain = async (read) => {
3390
3447
  return rows;
3391
3448
  };
3392
3449
  /** A keyset page's range: the keys strictly after `after`, in `order`. */
3393
- var after = (input) => input.after === void 0 ? {} : { range: (input.order ?? "asc") === "asc" ? { gt: input.after } : { lt: input.after } };
3450
+ /** A keyset read's range on its index's order: past `after`, up to `through`. */
3451
+ var after = (input) => {
3452
+ const asc = (input.order ?? "asc") === "asc";
3453
+ const range = {
3454
+ ...input.after === void 0 ? {} : asc ? { gt: input.after } : { lt: input.after },
3455
+ ...input.through === void 0 ? {} : asc ? { lte: input.through } : { gte: input.through }
3456
+ };
3457
+ return Object.keys(range).length === 0 ? {} : { range };
3458
+ };
3394
3459
  /** Core's reads, each through one declared index or key. */
3395
3460
  var createCoreReads = (db, storage) => {
3396
3461
  /** A bundle row's patches, exactly as many as its reference counter holds. */
@@ -3582,6 +3647,317 @@ var createCoreReads = (db, storage) => {
3582
3647
  }
3583
3648
  };
3584
3649
  };
3650
+ /**
3651
+ * A device's UDID: 40 hex digits, or 8 and 16 joined by a hyphen. The same
3652
+ * rule as `normalizeIosUdid` of `@hot-updater/protocol/native-artifact`,
3653
+ * implemented here so the server's runtime never loads the artifact readers.
3654
+ */
3655
+ var UDID = /^(?:[0-9a-f]{40}|[0-9a-f]{8}-[0-9a-f]{16})$/iu;
3656
+ /** The form the registry stores and compares a UDID in, or null for text that isn't one. */
3657
+ var normalizeIosUdid = (value) => {
3658
+ const trimmed = value.trim();
3659
+ return UDID.test(trimmed) ? trimmed.toLowerCase() : null;
3660
+ };
3661
+ /** `ios_devices.name`'s bound in core's schema. */
3662
+ var NAME_MAX_LENGTH = 100;
3663
+ /** `ios_devices.requested_by` and `approved_by`'s bound: an email address. */
3664
+ var EMAIL_MAX_LENGTH = 320;
3665
+ /** `ios_devices.apple_issuer_id`'s bound. */
3666
+ var ISSUER_MAX_LENGTH = 64;
3667
+ /** How many registry rows one read takes while finding its account. */
3668
+ var ACCOUNT_SCAN_PAGE = 200;
3669
+ /** The one row of `ios_device_account`. */
3670
+ var ACCOUNT_ROW = "registry";
3671
+ /** `ios_devices.apple_error`'s bound. */
3672
+ var ERROR_MAX_LENGTH = 512;
3673
+ var STATUSES = [
3674
+ "pending",
3675
+ "approved",
3676
+ "registered"
3677
+ ];
3678
+ var OUTCOMES = [
3679
+ "registered",
3680
+ "refused",
3681
+ "disabled",
3682
+ "missing"
3683
+ ];
3684
+ /** The `apple_error` of a device Apple has disabled. */
3685
+ var IOS_DEVICE_DISABLED_ERROR = "Disabled in the Apple account.";
3686
+ /** The `apple_error` of a registered device Apple no longer lists. */
3687
+ var IOS_DEVICE_MISSING_ERROR = "Gone from the Apple account. Approve it again to register it.";
3688
+ /** A device or registry request core cannot store: the caller's input. */
3689
+ var IosDeviceInputError = class extends TypeError {
3690
+ name = "IosDeviceInputError";
3691
+ };
3692
+ var pick$1 = (row) => ({
3693
+ id: row.id,
3694
+ udid: row.udid,
3695
+ name: row.name,
3696
+ status: row.status,
3697
+ requested_by: row.requested_by ?? null,
3698
+ created_at_ms: row.created_at_ms,
3699
+ approved_by: row.approved_by ?? null,
3700
+ approved_at_ms: row.approved_at_ms ?? null,
3701
+ registered_at_ms: row.registered_at_ms ?? null,
3702
+ apple_issuer_id: row.apple_issuer_id ?? null,
3703
+ apple_error: row.apple_error ?? null,
3704
+ build_id: row.build_id ?? null
3705
+ });
3706
+ var udidOf = (udid) => {
3707
+ const key = typeof udid === "string" ? normalizeIosUdid(udid) : null;
3708
+ if (key === null) throw new IosDeviceInputError("Invalid iOS device: udid must be 40 hex digits, or 8 and 16 joined by a hyphen.");
3709
+ return key;
3710
+ };
3711
+ var nameOf = (name) => {
3712
+ const trimmed = typeof name === "string" ? name.trim() : "";
3713
+ if (trimmed.length === 0 || trimmed.length > NAME_MAX_LENGTH) throw new IosDeviceInputError(`Invalid iOS device: name must be 1 to ${NAME_MAX_LENGTH} characters.`);
3714
+ return trimmed;
3715
+ };
3716
+ /** An email, lower-cased, or null for the CLI. */
3717
+ var personOf = (value, field) => {
3718
+ if (value === null) return null;
3719
+ const email = typeof value === "string" ? value.trim().toLowerCase() : "";
3720
+ if (email.length === 0 || email.length > EMAIL_MAX_LENGTH) throw new IosDeviceInputError(`Invalid iOS device: ${field} must be an email of at most ${EMAIL_MAX_LENGTH} characters, or null.`);
3721
+ return email;
3722
+ };
3723
+ /** Apple's words, on one line and within the column's bound. */
3724
+ var errorText = (text) => {
3725
+ const line = text.replace(/\s+/gu, " ").trim();
3726
+ return line.length > ERROR_MAX_LENGTH ? `${line.slice(0, 511)}…` : line;
3727
+ };
3728
+ /**
3729
+ * The iOS device registry: the iPhones and iPads a team asked to install ad hoc
3730
+ * builds on. The Console writes requests and approvals, and the CLI what Apple
3731
+ * said, each over the row it read.
3732
+ */
3733
+ var createIosDeviceApi = (db, { now = Date.now } = {}) => {
3734
+ const findIosDevice = async (udid) => {
3735
+ const key = normalizeIosUdid(udid);
3736
+ if (key === null) return null;
3737
+ const row = await db.findOne("ios_devices", { udid: key });
3738
+ return row === null ? null : pick$1(row);
3739
+ };
3740
+ /**
3741
+ * The issuer of the registry's earliest registration among its rows, by
3742
+ * when and then by ID, or null when no row names one: read only while the
3743
+ * registry has no account yet, a page at a time.
3744
+ */
3745
+ const accountOfRows = async () => {
3746
+ let earliest = null;
3747
+ for (let after;;) {
3748
+ const { rows } = await db.findMany("ios_devices", {
3749
+ index: "all",
3750
+ where: {},
3751
+ order: "asc",
3752
+ limit: ACCOUNT_SCAN_PAGE,
3753
+ ...after === void 0 ? {} : { range: { gt: after } }
3754
+ });
3755
+ for (const row of rows.map(pick$1)) {
3756
+ if (row.apple_issuer_id === null) continue;
3757
+ if (earliest === null || (row.registered_at_ms ?? 0) < (earliest.registered_at_ms ?? 0)) earliest = row;
3758
+ }
3759
+ if (rows.length < ACCOUNT_SCAN_PAGE) return earliest?.apple_issuer_id ?? null;
3760
+ after = rows.at(-1).id;
3761
+ }
3762
+ };
3763
+ return {
3764
+ async listIosDevices(input) {
3765
+ if (input.status !== void 0 && !STATUSES.includes(input.status)) throw new IosDeviceInputError(`Invalid iOS device status: ${String(input.status)}. Expected ${STATUSES.join(", ")}.`);
3766
+ const page = {
3767
+ order: input.order ?? "asc",
3768
+ limit: input.limit,
3769
+ ...after(input)
3770
+ };
3771
+ const { rows } = input.status === void 0 ? await db.findMany("ios_devices", {
3772
+ index: "all",
3773
+ where: {},
3774
+ ...page
3775
+ }) : await db.findMany("ios_devices", {
3776
+ index: "byStatus",
3777
+ where: { status: input.status },
3778
+ ...page
3779
+ });
3780
+ return rows.map(pick$1);
3781
+ },
3782
+ findIosDevice,
3783
+ async requestIosDevice(input) {
3784
+ const udid = udidOf(input.udid);
3785
+ const name = nameOf(input.name);
3786
+ const requestedBy = personOf(input.requestedBy, "requestedBy");
3787
+ const existing = await db.findOne("ios_devices", { udid });
3788
+ if (existing !== null) return {
3789
+ device: pick$1(existing),
3790
+ created: false
3791
+ };
3792
+ const device = {
3793
+ id: createUUIDv7(),
3794
+ udid,
3795
+ name,
3796
+ status: "pending",
3797
+ requested_by: requestedBy,
3798
+ created_at_ms: now(),
3799
+ approved_by: null,
3800
+ approved_at_ms: null,
3801
+ registered_at_ms: null,
3802
+ apple_issuer_id: null,
3803
+ apple_error: null,
3804
+ build_id: null
3805
+ };
3806
+ try {
3807
+ await db.transaction(async (tx) => {
3808
+ tx.create("ios_devices", device);
3809
+ });
3810
+ } catch (error) {
3811
+ if (error instanceof DatabaseConstraintError && error.reason === "unique") {
3812
+ const winner = await db.findOne("ios_devices", { udid });
3813
+ if (winner !== null) return {
3814
+ device: pick$1(winner),
3815
+ created: false
3816
+ };
3817
+ }
3818
+ throw error;
3819
+ }
3820
+ return {
3821
+ device,
3822
+ created: true
3823
+ };
3824
+ },
3825
+ async approveIosDevice(id, input) {
3826
+ const name = input.name === void 0 ? void 0 : nameOf(input.name);
3827
+ const approvedBy = personOf(input.approvedBy, "approvedBy");
3828
+ return db.transaction(async (tx) => {
3829
+ const row = await tx.findOne("ios_devices", { id });
3830
+ if (row === null) return null;
3831
+ const device = pick$1(row);
3832
+ const set = {
3833
+ ...name === void 0 || name === device.name ? {} : { name },
3834
+ ...device.status === "pending" ? {
3835
+ status: "approved",
3836
+ approved_by: approvedBy,
3837
+ approved_at_ms: now()
3838
+ } : {}
3839
+ };
3840
+ if (Object.keys(set).length === 0) return device;
3841
+ tx.update("ios_devices", row, set);
3842
+ return {
3843
+ ...device,
3844
+ ...set
3845
+ };
3846
+ });
3847
+ },
3848
+ async renameIosDevice(id, input) {
3849
+ const name = nameOf(input);
3850
+ return db.transaction(async (tx) => {
3851
+ const row = await tx.findOne("ios_devices", { id });
3852
+ if (row === null) return null;
3853
+ const device = pick$1(row);
3854
+ if (device.name === name) return device;
3855
+ tx.update("ios_devices", row, { name });
3856
+ return {
3857
+ ...device,
3858
+ name
3859
+ };
3860
+ });
3861
+ },
3862
+ async recordIosDeviceOutcome({ id, seen, issuerId, outcome, reason }) {
3863
+ if (!OUTCOMES.includes(outcome)) throw new IosDeviceInputError(`Invalid iOS device outcome: ${String(outcome)}. Expected ${OUTCOMES.join(", ")}.`);
3864
+ if (typeof issuerId !== "string" || issuerId.trim().length === 0 || issuerId.length > ISSUER_MAX_LENGTH) throw new IosDeviceInputError(`Invalid iOS device outcome: issuerId must be an App Store Connect issuer of at most ${ISSUER_MAX_LENGTH} characters.`);
3865
+ return db.transaction(async (tx) => {
3866
+ const row = await tx.findOne("ios_devices", { id });
3867
+ if (row === null) return null;
3868
+ const device = pick$1(row);
3869
+ if (device.status !== seen.status || device.approved_at_ms !== seen.approvedAtMs || device.apple_issuer_id !== null && device.apple_issuer_id !== issuerId) return null;
3870
+ let set;
3871
+ switch (outcome) {
3872
+ case "registered":
3873
+ if (device.status === "pending") return null;
3874
+ set = {
3875
+ status: "registered",
3876
+ registered_at_ms: device.registered_at_ms ?? now(),
3877
+ apple_issuer_id: issuerId,
3878
+ apple_error: null
3879
+ };
3880
+ break;
3881
+ case "refused":
3882
+ if (device.status !== "approved") return null;
3883
+ set = { apple_error: errorText(reason === void 0 || reason.trim() === "" ? "Apple refused it." : reason) };
3884
+ break;
3885
+ case "disabled":
3886
+ if (device.status === "pending") return null;
3887
+ set = { apple_error: IOS_DEVICE_DISABLED_ERROR };
3888
+ break;
3889
+ case "missing":
3890
+ if (device.status !== "registered") return null;
3891
+ set = {
3892
+ status: "pending",
3893
+ approved_by: null,
3894
+ approved_at_ms: null,
3895
+ apple_error: IOS_DEVICE_MISSING_ERROR
3896
+ };
3897
+ }
3898
+ if (Object.entries(set).some(([column, value]) => device[column] !== (value ?? null))) tx.update("ios_devices", row, set);
3899
+ return {
3900
+ ...device,
3901
+ ...set
3902
+ };
3903
+ });
3904
+ },
3905
+ async markIosDevicesInBuild({ buildId, ids }) {
3906
+ for (const id of new Set(ids)) await db.transaction(async (tx) => {
3907
+ const row = await tx.findOne("ios_devices", { id });
3908
+ if (row === null || typeof row.build_id === "string" && row.build_id >= buildId) return;
3909
+ tx.update("ios_devices", row, { build_id: buildId });
3910
+ });
3911
+ },
3912
+ async claimIosDeviceAccount(issuerId) {
3913
+ if (typeof issuerId !== "string" || issuerId.trim().length === 0 || issuerId.length > ISSUER_MAX_LENGTH) throw new IosDeviceInputError(`Invalid iOS device account: issuerId must be an App Store Connect issuer of at most ${ISSUER_MAX_LENGTH} characters.`);
3914
+ const answer = (held) => ({
3915
+ issuerId: held,
3916
+ claimed: held === issuerId
3917
+ });
3918
+ const existing = await db.findOne("ios_device_account", { id: ACCOUNT_ROW });
3919
+ if (existing !== null) return answer(existing.apple_issuer_id);
3920
+ const holder = await accountOfRows() ?? issuerId;
3921
+ try {
3922
+ await db.transaction(async (tx) => {
3923
+ tx.create("ios_device_account", {
3924
+ id: ACCOUNT_ROW,
3925
+ apple_issuer_id: holder,
3926
+ claimed_at_ms: now()
3927
+ });
3928
+ });
3929
+ return answer(holder);
3930
+ } catch (error) {
3931
+ if (error instanceof DatabaseConstraintError && (error.reason === "exists" || error.reason === "unique")) {
3932
+ const winner = await db.findOne("ios_device_account", { id: ACCOUNT_ROW });
3933
+ if (winner !== null) return answer(winner.apple_issuer_id);
3934
+ }
3935
+ throw error;
3936
+ }
3937
+ },
3938
+ async deleteIosDevice(id, only) {
3939
+ const requestedBy = only?.requestedBy === void 0 ? void 0 : personOf(only.requestedBy, "requestedBy");
3940
+ return db.transaction(async (tx) => {
3941
+ const row = await tx.findOne("ios_devices", { id });
3942
+ if (row === null) return null;
3943
+ const device = pick$1(row);
3944
+ if (only?.status !== void 0 && device.status !== only.status || requestedBy !== void 0 && device.requested_by !== requestedBy) return null;
3945
+ await tx.delete("ios_devices", row);
3946
+ return device;
3947
+ });
3948
+ }
3949
+ };
3950
+ };
3951
+ /** Store destinations accepted for each native platform. */
3952
+ var NATIVE_BUILD_SUBMISSION_DESTINATIONS = {
3953
+ android: [
3954
+ "play-internal",
3955
+ "play-closed",
3956
+ "play-open",
3957
+ "play-production"
3958
+ ],
3959
+ ios: ["testflight"]
3960
+ };
3585
3961
  var PAGE$1 = 500;
3586
3962
  /** Moves one bundle into or out of its platform's total and the overall total. */
3587
3963
  var countBundle = (tx, platform, delta) => {
@@ -3696,6 +4072,13 @@ var GIT_COMMIT_HASH_MAX_LENGTH = 255;
3696
4072
  * and looks up nothing else.
3697
4073
  */
3698
4074
  var BUILD_KEY = /^nbk1:[0-9a-f]{64}$/;
4075
+ /** `native_builds.sandbox_url_scheme`'s bound in core's schema. */
4076
+ var SANDBOX_URL_SCHEME_MAX_LENGTH = 255;
4077
+ /**
4078
+ * A URL scheme as RFC 3986 spells it, in lower case: what a sandbox build's
4079
+ * artifact registers, as `@hot-updater/protocol/native-artifact` reads it.
4080
+ */
4081
+ var URL_SCHEME = new RegExp(`^[a-z][a-z0-9+.-]{0,254}$`);
3699
4082
  /** A native build or scope core cannot store or look up: the caller's input. */
3700
4083
  var NativeBuildInputError = class extends TypeError {
3701
4084
  name = "NativeBuildInputError";
@@ -3717,13 +4100,32 @@ var pick = (row) => ({
3717
4100
  build_number: row.build_number ?? null,
3718
4101
  submitted_to: row.submitted_to ?? null,
3719
4102
  submitted_at_ms: row.submitted_at_ms ?? null,
3720
- submitted_version: row.submitted_version ?? null
4103
+ submitted_version: row.submitted_version ?? null,
4104
+ is_store_build: row.is_store_build === true,
4105
+ is_sandbox: row.is_sandbox === true,
4106
+ sandbox_url_scheme: row.sandbox_url_scheme ?? null,
4107
+ export_method: row.export_method ?? null
3721
4108
  });
3722
- /** The store track each platform's builds are submitted to. */
3723
- var SUBMISSION_DESTINATIONS = {
3724
- android: "play-internal",
3725
- ios: "testflight"
3726
- };
4109
+ /** The export methods an `.ipa` registers with. */
4110
+ var EXPORT_METHODS = /* @__PURE__ */ new Set([
4111
+ "app-store",
4112
+ "ad-hoc",
4113
+ "development",
4114
+ "enterprise"
4115
+ ]);
4116
+ /**
4117
+ * The channels only sandbox builds register on: a registration's `sandbox`
4118
+ * must agree with it. The registry's convention, as
4119
+ * `@hot-updater/protocol/native-artifact` checks it for a build's artifact.
4120
+ */
4121
+ var SANDBOX_CHANNEL_PREFIX = "sandbox-";
4122
+ /**
4123
+ * How many older builds of a scope one read takes, looking for one older than
4124
+ * a bundle when a build made after the bundle is the newest.
4125
+ */
4126
+ var OLDER_BUILDS_PAGE = 20;
4127
+ /** How many times a mark runs again after losing its scope's mark to another. */
4128
+ var MARK_ATTEMPTS = 8;
3727
4129
  /** `native_builds.build_number`'s bound in core's schema. */
3728
4130
  var BUILD_NUMBER_MAX_LENGTH = 64;
3729
4131
  /** `native_builds.submitted_version`'s bound in core's schema. */
@@ -3756,17 +4158,29 @@ var nativeBuildScopeKey = (scope) => {
3756
4158
  };
3757
4159
  /** Whether `bundleId` is a native build's built-in bundle: one unique read. */
3758
4160
  var isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
3759
- var problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, artifact }) => {
4161
+ var problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, exportMethod, artifact }) => {
3760
4162
  if (!isUUIDv7(id)) return "id must be a UUIDv7";
3761
4163
  if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
3762
4164
  if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
3763
4165
  if (channel.trim().length === 0) return "channel is required";
4166
+ if (isSandbox !== void 0 && typeof isSandbox !== "boolean") return "isSandbox must be true or false";
4167
+ const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
4168
+ if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
4169
+ if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
4170
+ if (sandboxUrlScheme !== void 0 && sandboxUrlScheme !== null) {
4171
+ if (isSandbox !== true) return "sandboxUrlScheme is a sandbox build's, and this isn't one";
4172
+ if (typeof sandboxUrlScheme !== "string" || !URL_SCHEME.test(sandboxUrlScheme)) return `sandboxUrlScheme must be a URL scheme in lower case, up to ${SANDBOX_URL_SCHEME_MAX_LENGTH} characters, or null`;
4173
+ }
3764
4174
  if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
3765
4175
  if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
3766
4176
  if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
3767
4177
  if (buildNumber !== void 0 && buildNumber !== null && (buildNumber.trim().length === 0 || buildNumber.length > BUILD_NUMBER_MAX_LENGTH)) return `buildNumber must be the artifact's build number, up to ${BUILD_NUMBER_MAX_LENGTH} characters, or null`;
3768
4178
  const kinds = ARTIFACT_KINDS[platform];
3769
4179
  if (!kinds.includes(artifact.kind)) return `artifact.kind of an ${platform} build must be ${kinds.join(" or ")}`;
4180
+ if (exportMethod !== void 0 && exportMethod !== null) {
4181
+ if (artifact.kind !== "ipa") return "exportMethod is an .ipa's, and this artifact isn't one";
4182
+ if (!EXPORT_METHODS.has(exportMethod)) return `exportMethod must be ${[...EXPORT_METHODS].join(", ")}, or null`;
4183
+ }
3770
4184
  if (!Number.isSafeInteger(artifact.byteSize) || artifact.byteSize < 0) return "artifact.byteSize must be a byte count";
3771
4185
  return null;
3772
4186
  };
@@ -3795,7 +4209,11 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3795
4209
  build_number: registration.buildNumber ?? null,
3796
4210
  submitted_to: null,
3797
4211
  submitted_at_ms: null,
3798
- submitted_version: null
4212
+ submitted_version: null,
4213
+ is_store_build: false,
4214
+ is_sandbox: registration.isSandbox === true,
4215
+ sandbox_url_scheme: registration.sandboxUrlScheme ?? null,
4216
+ export_method: registration.exportMethod ?? null
3799
4217
  };
3800
4218
  for (let attempt = 1;; attempt += 1) {
3801
4219
  await insertChannel(db, {
@@ -3833,21 +4251,42 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3833
4251
  const scopeKey = nativeBuildScopeKey(scope);
3834
4252
  const buildKey = options?.buildKey;
3835
4253
  if (buildKey !== void 0 && !BUILD_KEY.test(buildKey)) throw new NativeBuildInputError("Invalid native build key: it must be nbk1: and a SHA-256.");
3836
- const { rows } = buildKey === void 0 ? await db.findMany("native_builds", {
3837
- index: "byScope",
3838
- where: { scope_key: scopeKey },
3839
- order: "desc",
3840
- limit: 1
3841
- }) : await db.findMany("native_builds", {
3842
- index: "byBuildKey",
3843
- where: {
3844
- scope_key: scopeKey,
3845
- build_key: buildKey
3846
- },
3847
- order: "desc",
3848
- limit: 1
3849
- });
3850
- return rows[0] === void 0 ? null : pick(rows[0]);
4254
+ if (options?.storeBuild) {
4255
+ const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
4256
+ return marked === null ? null : pick(marked);
4257
+ }
4258
+ const read = (limit, before) => {
4259
+ const page = {
4260
+ order: "desc",
4261
+ limit,
4262
+ ...before === void 0 ? {} : { range: { lt: before } }
4263
+ };
4264
+ return buildKey === void 0 ? db.findMany("native_builds", {
4265
+ index: "byScope",
4266
+ where: { scope_key: scopeKey },
4267
+ ...page
4268
+ }) : db.findMany("native_builds", {
4269
+ index: "byBuildKey",
4270
+ where: {
4271
+ scope_key: scopeKey,
4272
+ build_key: buildKey
4273
+ },
4274
+ ...page
4275
+ });
4276
+ };
4277
+ const { rows } = await read(1);
4278
+ const newest = rows[0];
4279
+ if (newest === void 0) return null;
4280
+ const bundleId = options?.builtInOlderThan;
4281
+ if (bundleId === void 0 || newest.min_bundle_id < bundleId) return pick(newest);
4282
+ for (let before = newest.id;;) {
4283
+ const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
4284
+ const usable = older.find(({ min_bundle_id }) => min_bundle_id < bundleId);
4285
+ if (usable !== void 0) return pick(usable);
4286
+ const last = older.at(-1);
4287
+ if (older.length < OLDER_BUILDS_PAGE || last === void 0) return null;
4288
+ before = last.id;
4289
+ }
3851
4290
  },
3852
4291
  async recordNativeBuildSubmission(id, { destination, version }) {
3853
4292
  if (version.trim().length === 0 || version.length > SUBMITTED_VERSION_MAX_LENGTH) throw new NativeBuildInputError(`Invalid native build submission: version must be the store's label of the build, up to ${SUBMITTED_VERSION_MAX_LENGTH} characters.`);
@@ -3855,7 +4294,8 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3855
4294
  const row = await tx.findOne("native_builds", { id });
3856
4295
  if (row === null) return null;
3857
4296
  const build = pick(row);
3858
- if (SUBMISSION_DESTINATIONS[build.platform] !== destination) throw new NativeBuildInputError(`Invalid native build submission: an ${build.platform} build is submitted to ${SUBMISSION_DESTINATIONS[build.platform]}, not ${destination}.`);
4297
+ if (!NATIVE_BUILD_SUBMISSION_DESTINATIONS[build.platform].includes(destination)) throw new NativeBuildInputError(`Invalid native build submission: an ${build.platform} build is submitted to ${NATIVE_BUILD_SUBMISSION_DESTINATIONS[build.platform].join(" or ")}, not ${destination}.`);
4298
+ if (build.is_sandbox && destination !== "testflight" && destination !== "play-internal") throw new NativeBuildInputError("A sandbox build can submit only to TestFlight or Play internal testing.");
3859
4299
  const set = {
3860
4300
  submitted_to: destination,
3861
4301
  submitted_at_ms: now(),
@@ -3868,6 +4308,46 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3868
4308
  };
3869
4309
  });
3870
4310
  },
4311
+ async markNativeBuild(id, { storeBuild }) {
4312
+ for (let attempt = 1;; attempt += 1) try {
4313
+ return await db.transaction(async (tx) => {
4314
+ const row = await tx.findOne("native_builds", { id });
4315
+ if (row === null) return null;
4316
+ const build = pick(row);
4317
+ if (!storeBuild) {
4318
+ if (build.is_store_build) tx.update("native_builds", row, { is_store_build: false });
4319
+ return {
4320
+ nativeBuild: {
4321
+ ...build,
4322
+ is_store_build: false
4323
+ },
4324
+ previous: null
4325
+ };
4326
+ }
4327
+ if (build.is_sandbox) throw new NativeBuildInputError("A sandbox build can't be the store build.");
4328
+ if (build.is_store_build) return {
4329
+ nativeBuild: build,
4330
+ previous: null
4331
+ };
4332
+ const holder = await tx.findOne("native_builds", { store_build_scope_key: build.scope_key });
4333
+ if (holder !== null) tx.update("native_builds", holder, { is_store_build: false });
4334
+ tx.update("native_builds", row, { is_store_build: true });
4335
+ return {
4336
+ nativeBuild: {
4337
+ ...build,
4338
+ is_store_build: true
4339
+ },
4340
+ previous: holder === null ? null : {
4341
+ ...pick(holder),
4342
+ is_store_build: false
4343
+ }
4344
+ };
4345
+ });
4346
+ } catch (error) {
4347
+ if (attempt < MARK_ATTEMPTS && error instanceof DatabaseConstraintError && error.reason === "unique") continue;
4348
+ throw error;
4349
+ }
4350
+ },
3871
4351
  async deleteNativeBuild(id) {
3872
4352
  return db.transaction(async (tx) => {
3873
4353
  const row = await tx.findOne("native_builds", { id });
@@ -4472,6 +4952,7 @@ var createCoreApi = (db, storage, options = {}) => {
4472
4952
  ...reads,
4473
4953
  ...createCoreOperations(purgingCachedRoutes(db, options.onCachedRoutesChange), options),
4474
4954
  ...createNativeBuildApi(db, options),
4955
+ ...createIosDeviceApi(db, options),
4475
4956
  ready: async () => {
4476
4957
  await reads.listReleaseCatalogs({ limit: 1 });
4477
4958
  }
@@ -4682,10 +5163,12 @@ var keyset = (url, maxValue = LIMITS.maxValue) => {
4682
5163
  const limit = limitParam === null ? Math.min(LIMITS.defaultValue, maxValue) : Number(limitParam);
4683
5164
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > maxValue) throw new HandlerBadRequestError(`limit must be between 1 and ${maxValue}.`);
4684
5165
  const cursor = url.searchParams.get("cursor");
5166
+ const through = url.searchParams.get("through");
4685
5167
  return {
4686
5168
  order,
4687
5169
  limit,
4688
- ...cursor === null ? {} : { after: cursor }
5170
+ ...cursor === null ? {} : { after: cursor },
5171
+ ...through === null ? {} : { through }
4689
5172
  };
4690
5173
  };
4691
5174
  /** A page and the cursor of the next one, when the page is full. */
@@ -4800,11 +5283,11 @@ var refusingInvalid = async (operation) => {
4800
5283
  try {
4801
5284
  return await operation();
4802
5285
  } catch (error) {
4803
- if (error instanceof NativeBuildInputError) throw new HandlerBadRequestError(error.message);
5286
+ if (error instanceof NativeBuildInputError || error instanceof IosDeviceInputError) throw new HandlerBadRequestError(error.message);
4804
5287
  throw error;
4805
5288
  }
4806
5289
  };
4807
- var isNativeBuildRegistration = (value) => isRecord$1(value) && isText(value.id) && isText(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText(value.channel) && isTextOrNull(value.fingerprintHash) && isTextOrNull(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull(value.gitCommitHash) && isTextOrNull(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull(value.buildNumber)) && isRecord$1(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord$1(value.embeddedBundle) && isText(value.embeddedBundle.manifestStorageUri) && isText(value.embeddedBundle.manifestFileHash) && isText(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord$1(value.embeddedBundle.metadata));
5290
+ var isNativeBuildRegistration = (value) => isRecord$1(value) && isText(value.id) && isText(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText(value.channel) && isTextOrNull(value.fingerprintHash) && isTextOrNull(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull(value.gitCommitHash) && isTextOrNull(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull(value.buildNumber)) && (value.isSandbox === void 0 || typeof value.isSandbox === "boolean") && (value.sandboxUrlScheme === void 0 || isTextOrNull(value.sandboxUrlScheme)) && (value.exportMethod === void 0 || isTextOrNull(value.exportMethod)) && isRecord$1(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord$1(value.embeddedBundle) && isText(value.embeddedBundle.manifestStorageUri) && isText(value.embeddedBundle.manifestFileHash) && isText(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord$1(value.embeddedBundle.metadata));
4808
5291
  var scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
4809
5292
  /** Every admin route's handler, by the name `ADMIN_ROUTES` mounts it under. */
4810
5293
  var createAdminRouteHandlers = () => ({
@@ -4926,7 +5409,13 @@ var createAdminRouteHandlers = () => ({
4926
5409
  const url = new URL(request.url);
4927
5410
  const scope = nativeBuildScopeOf(url);
4928
5411
  const buildKey = url.searchParams.get("buildKey");
4929
- return json({ data: await refusingInvalid(() => buildKey === null ? core.findNativeBuild(scope) : core.findNativeBuild(scope, { buildKey })) });
5412
+ const builtInOlderThan = url.searchParams.get("builtInOlderThan");
5413
+ const options = {
5414
+ ...buildKey === null ? {} : { buildKey },
5415
+ ...url.searchParams.get("storeBuild") === "true" ? { storeBuild: true } : {},
5416
+ ...builtInOlderThan === null ? {} : { builtInOlderThan }
5417
+ };
5418
+ return json({ data: await refusingInvalid(() => Object.keys(options).length === 0 ? core.findNativeBuild(scope) : core.findNativeBuild(scope, options)) });
4930
5419
  }),
4931
5420
  getNativeBuild: onCore(async (core, _request, params) => json({ data: await core.getNativeBuild(requireRouteParam(params, "id")) })),
4932
5421
  listNativeBuilds: onCore(async (core, request) => {
@@ -4940,14 +5429,95 @@ var createAdminRouteHandlers = () => ({
4940
5429
  }),
4941
5430
  recordNativeBuildSubmission: onCore(async (core, request, params) => {
4942
5431
  const input = await body(request);
4943
- if (!isRecord$1(input) || input.destination !== "testflight" && input.destination !== "play-internal" || !isText(input.version)) throw new HandlerBadRequestError("A native build submission needs destination (testflight or play-internal) and version.");
5432
+ if (!isRecord$1(input) || !Object.values(NATIVE_BUILD_SUBMISSION_DESTINATIONS).flat().includes(input.destination) || !isText(input.version)) throw new HandlerBadRequestError("A native build submission needs a valid store destination and version.");
4944
5433
  const submission = {
4945
5434
  destination: input.destination,
4946
5435
  version: input.version
4947
5436
  };
4948
5437
  return json({ data: await refusingInvalid(() => core.recordNativeBuildSubmission(requireRouteParam(params, "id"), submission)) });
4949
5438
  }),
5439
+ markNativeBuild: onCore(async (core, request, params) => {
5440
+ const input = await body(request);
5441
+ if (!isRecord$1(input) || typeof input.storeBuild !== "boolean") throw new HandlerBadRequestError("A native build's store build mark needs storeBuild, true or false.");
5442
+ const mark = { storeBuild: input.storeBuild };
5443
+ return json({ data: await refusingInvalid(() => core.markNativeBuild(requireRouteParam(params, "id"), mark)) });
5444
+ }),
4950
5445
  deleteNativeBuild: onCore(async (core, _request, params) => json({ data: await core.deleteNativeBuild(requireRouteParam(params, "id")) })),
5446
+ listIosDevices: onCore(async (core, request) => {
5447
+ const url = new URL(request.url);
5448
+ const input = keyset(url);
5449
+ const status = url.searchParams.get("status");
5450
+ return page(await refusingInvalid(() => core.listIosDevices({
5451
+ ...input,
5452
+ ...status === null ? {} : { status }
5453
+ })), input, ({ id }) => id);
5454
+ }),
5455
+ findIosDevice: onCore(async (core, _request, params) => json({ data: await core.findIosDevice(requireRouteParam(params, "udid")) })),
5456
+ requestIosDevice: onCore(async (core, request) => {
5457
+ const input = await body(request);
5458
+ if (!isText(input.udid) || !isText(input.name) || !isTextOrNull(input.requestedBy)) throw new HandlerBadRequestError("An iOS device request needs udid, name, and requestedBy, an email or null.");
5459
+ const device = {
5460
+ udid: input.udid,
5461
+ name: input.name,
5462
+ requestedBy: input.requestedBy
5463
+ };
5464
+ return json({ data: await refusingInvalid(() => core.requestIosDevice(device)) });
5465
+ }),
5466
+ approveIosDevice: onCore(async (core, request, params) => {
5467
+ const input = await body(request);
5468
+ if (!isTextOrNull(input.approvedBy) || input.name !== void 0 && !isText(input.name)) throw new HandlerBadRequestError("An iOS device approval needs approvedBy, an email or null, and an optional name.");
5469
+ const approval = {
5470
+ approvedBy: input.approvedBy,
5471
+ ...input.name === void 0 ? {} : { name: input.name }
5472
+ };
5473
+ return json({ data: await refusingInvalid(() => core.approveIosDevice(requireRouteParam(params, "id"), approval)) });
5474
+ }),
5475
+ renameIosDevice: onCore(async (core, request, params) => {
5476
+ const input = await body(request);
5477
+ if (!isText(input.name)) throw new HandlerBadRequestError("An iOS device's new name is required.");
5478
+ const name = input.name;
5479
+ return json({ data: await refusingInvalid(() => core.renameIosDevice(requireRouteParam(params, "id"), name)) });
5480
+ }),
5481
+ recordIosDeviceOutcome: onCore(async (core, request, params) => {
5482
+ const input = await body(request);
5483
+ const seen = input.seen;
5484
+ if (!isRecord$1(seen) || typeof seen.status !== "string" || !(seen.approvedAtMs === null || Number.isSafeInteger(seen.approvedAtMs)) || !isText(input.issuerId) || typeof input.outcome !== "string" || input.reason !== void 0 && typeof input.reason !== "string") throw new HandlerBadRequestError("An iOS device outcome needs seen { status, approvedAtMs }, issuerId, outcome, and an optional reason.");
5485
+ const outcome = {
5486
+ id: requireRouteParam(params, "id"),
5487
+ seen: {
5488
+ status: seen.status,
5489
+ approvedAtMs: seen.approvedAtMs
5490
+ },
5491
+ issuerId: input.issuerId,
5492
+ outcome: input.outcome,
5493
+ ...input.reason === void 0 ? {} : { reason: input.reason }
5494
+ };
5495
+ return json({ data: await refusingInvalid(() => core.recordIosDeviceOutcome(outcome)) });
5496
+ }),
5497
+ claimIosDeviceAccount: onCore(async (core, request) => {
5498
+ const { issuerId } = await body(request);
5499
+ if (!isText(issuerId)) throw new HandlerBadRequestError("Claiming the iOS device account needs issuerId.");
5500
+ return json({ data: await refusingInvalid(() => core.claimIosDeviceAccount(issuerId)) });
5501
+ }),
5502
+ markIosDevicesInBuild: onCore(async (core, request) => {
5503
+ const { buildId, ids } = await body(request);
5504
+ if (!isText(buildId) || !Array.isArray(ids) || !ids.every((id) => isText(id))) throw new HandlerBadRequestError("Marking iOS devices in a build needs buildId and ids.");
5505
+ await core.markIosDevicesInBuild({
5506
+ buildId,
5507
+ ids
5508
+ });
5509
+ return noContent();
5510
+ }),
5511
+ deleteIosDevice: onCore(async (core, request, params) => {
5512
+ const url = new URL(request.url);
5513
+ const status = url.searchParams.get("status");
5514
+ const requestedBy = url.searchParams.get("requestedBy");
5515
+ const only = {
5516
+ ...status === null ? {} : { status },
5517
+ ...requestedBy === null ? {} : { requestedBy }
5518
+ };
5519
+ return json({ data: await refusingInvalid(() => Object.keys(only).length === 0 ? core.deleteIosDevice(requireRouteParam(params, "id")) : core.deleteIosDevice(requireRouteParam(params, "id"), only)) });
5520
+ }),
4951
5521
  deleteBundles: onCore(async (core, request) => {
4952
5522
  const { ids } = await body(request);
4953
5523
  if (!Array.isArray(ids) || !ids.every((id) => typeof id === "string" && id.length > 0)) throw new HandlerBadRequestError("Bundle deletion needs ids");
@@ -5092,10 +5662,60 @@ var ADMIN_ROUTES = [
5092
5662
  path: "/native-builds/:id/submission",
5093
5663
  handler: "recordNativeBuildSubmission"
5094
5664
  },
5665
+ {
5666
+ method: "POST",
5667
+ path: "/native-builds/:id/store-build",
5668
+ handler: "markNativeBuild"
5669
+ },
5095
5670
  {
5096
5671
  method: "DELETE",
5097
5672
  path: "/native-builds/:id",
5098
5673
  handler: "deleteNativeBuild"
5674
+ },
5675
+ {
5676
+ method: "GET",
5677
+ path: "/ios-devices",
5678
+ handler: "listIosDevices"
5679
+ },
5680
+ {
5681
+ method: "POST",
5682
+ path: "/ios-devices",
5683
+ handler: "requestIosDevice"
5684
+ },
5685
+ {
5686
+ method: "GET",
5687
+ path: "/ios-devices/udid/:udid",
5688
+ handler: "findIosDevice"
5689
+ },
5690
+ {
5691
+ method: "POST",
5692
+ path: "/ios-devices/in-build",
5693
+ handler: "markIosDevicesInBuild"
5694
+ },
5695
+ {
5696
+ method: "POST",
5697
+ path: "/ios-devices/account",
5698
+ handler: "claimIosDeviceAccount"
5699
+ },
5700
+ {
5701
+ method: "POST",
5702
+ path: "/ios-devices/:id/approval",
5703
+ handler: "approveIosDevice"
5704
+ },
5705
+ {
5706
+ method: "POST",
5707
+ path: "/ios-devices/:id/outcome",
5708
+ handler: "recordIosDeviceOutcome"
5709
+ },
5710
+ {
5711
+ method: "PATCH",
5712
+ path: "/ios-devices/:id",
5713
+ handler: "renameIosDevice"
5714
+ },
5715
+ {
5716
+ method: "DELETE",
5717
+ path: "/ios-devices/:id",
5718
+ handler: "deleteIosDevice"
5099
5719
  }
5100
5720
  ];
5101
5721
  var CATALOG_CONTENT_TYPE = "application/vnd.hot-updater.release-catalog+json; version=1";
@@ -5603,8 +6223,11 @@ var resolveConsoleConfig = async (request) => {
5603
6223
  const { default: source } = await import("./config-CjIBFhJX.mjs");
5604
6224
  const config = typeof source === "function" ? await source(request) : source;
5605
6225
  const { database, storage, plugins = [] } = config;
5606
- const { gitUrl } = config.console ?? {};
5607
- const consoleOptions = gitUrl === void 0 ? {} : { gitUrl };
6226
+ const { gitUrl, deviceApprovers = [] } = config.console ?? {};
6227
+ const consoleOptions = {
6228
+ ...gitUrl === void 0 ? {} : { gitUrl },
6229
+ deviceApprovers: deviceApprovers.map((email) => email.trim().toLowerCase()).filter((email) => email.length > 0)
6230
+ };
5608
6231
  if (isRemoteDatabase(database)) {
5609
6232
  const checked = assemble({
5610
6233
  name: "memory",