@hot-updater/console 1.2.0-rc.4 → 1.2.0-rc.41

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 (394) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/-native-builds-search-BFcW2mlI.js +1 -0
  3. package/.output/public/assets/BundleIdDisplay-C0X-k49t.js +1 -0
  4. package/.output/public/assets/ChannelBadge-BgVCJfJs.js +1 -0
  5. package/.output/public/assets/ChannelPicker-BQKoyxnf.js +1 -0
  6. package/.output/public/assets/CompositeItem-B7uxFM46.js +1 -0
  7. package/.output/public/assets/{ConsoleFeatureUnavailable-CUtcXuY2.js → ConsoleFeatureUnavailable-B3VCINom.js} +1 -1
  8. package/.output/public/assets/EventDetails-CWiI1CXb.js +1 -0
  9. package/.output/public/assets/HashValueDisplay-DvwvQchI.js +1 -0
  10. package/.output/public/assets/InsightsPageHeader-BjUAikRe.js +1 -0
  11. package/.output/public/assets/IosInstall-B5IdjCP2.js +1 -0
  12. package/.output/public/assets/NativeBuildsNav-BKdnlKMN.js +1 -0
  13. package/.output/public/assets/{NotFoundPage-DZ3DxyRA.js → NotFoundPage-BEpesHEm.js} +1 -1
  14. package/.output/public/assets/{PlatformIcon-BBWQlWm9.js → PlatformIcon-D4KPXCHL.js} +1 -1
  15. package/.output/public/assets/QrCode-BFSCkbPj.js +1 -0
  16. package/.output/public/assets/RelativeTime-5ZP9WlQ6.js +1 -0
  17. package/.output/public/assets/RolloutPercentageBadge-DCtG7c1o.js +1 -0
  18. package/.output/public/assets/RowReason-CXMCJ-Jc.js +1 -0
  19. package/.output/public/assets/SandboxBadge-PM92jCk6.js +1 -0
  20. package/.output/public/assets/TargetDisplay-DG_I3qln.js +1 -0
  21. package/.output/public/assets/alert-dialog-DGPqJBCk.js +1 -0
  22. package/.output/public/assets/api-eO-sq3Jd.js +1 -0
  23. package/.output/public/assets/api-keys-CAVLgicI.js +1 -0
  24. package/.output/public/assets/api-keys-ztwXoKcj.js +1 -0
  25. package/.output/public/assets/arrow-left-68S4uy4I.js +1 -0
  26. package/.output/public/assets/arrow-right-DjRwIoF1.js +1 -0
  27. package/.output/public/assets/arrow-up-right-C_1ALUCD.js +1 -0
  28. package/.output/public/assets/badge-zMibJGR5.js +1 -0
  29. package/.output/public/assets/card-BAs80yql.js +1 -0
  30. package/.output/public/assets/check-C3VCvMOV.js +1 -0
  31. package/.output/public/assets/chevron-right-RAuPv9r1.js +1 -0
  32. package/.output/public/assets/{circle-off-C7Muo0ss.js → circle-off-DvYMC5yF.js} +1 -1
  33. package/.output/public/assets/{clipboard-DQbOcrL7.js → clipboard-D0JWZ1KF.js} +1 -1
  34. package/.output/public/assets/{console-features-api-DEXSwFtc.js → console-features-api-CtbGqKyr.js} +1 -1
  35. package/.output/public/assets/{uuidv7-zXMtwR9Q.js → constants-C5gi7fdZ.js} +1 -1
  36. package/.output/public/assets/{copy-DsuLj3oj.js → copy-BjVLMKbo.js} +1 -1
  37. package/.output/public/assets/dialog-BvZDZzdQ.js +1 -0
  38. package/.output/public/assets/dist-BEmib-ZM.js +1 -0
  39. package/.output/public/assets/{download-Cf24LBde.js → download-CgpaZb23.js} +1 -1
  40. package/.output/public/assets/empty-C5GqArX9.js +1 -0
  41. package/.output/public/assets/field-DInLQ5oV.js +1 -0
  42. package/.output/public/assets/git-branch-BGatQV8Q.js +1 -0
  43. package/.output/public/assets/history-Ci4dhphE.js +1 -0
  44. package/.output/public/assets/index-Ck4fZq4M.js +10 -0
  45. package/.output/public/assets/input-group-CIjTdxCW.js +1 -0
  46. package/.output/public/assets/insights-V3D8tYPQ.js +1 -0
  47. package/.output/public/assets/insights-api-D4-FZeEI.js +1 -0
  48. package/.output/public/assets/insights-fSY6n4k3.js +42 -0
  49. package/.output/public/assets/insights-osTmFzzR.js +2 -0
  50. package/.output/public/assets/insights-search-CZtvD-Vf.js +1 -0
  51. package/.output/public/assets/insights-usage-rpc-Dw5_pmRH.js +1 -0
  52. package/.output/public/assets/insights_.distribution-Cws8lYLC.js +1 -0
  53. package/.output/public/assets/insights_.distribution-DpppHhaU.js +2 -0
  54. package/.output/public/assets/insights_.distribution-oIFSv2TC.js +1 -0
  55. package/.output/public/assets/installations-Byojb0Rv.js +2 -0
  56. package/.output/public/assets/installations-CFGDrY-W.js +1 -0
  57. package/.output/public/assets/installations-CcPrSZwW.js +1 -0
  58. package/.output/public/assets/{key-round-DwNKkHhy.js → key-round-BkeLvA1m.js} +1 -1
  59. package/.output/public/assets/{link-DTEyW70e.js → link-CRMwpc7-.js} +2 -2
  60. package/.output/public/assets/{list--NIee1FZ.js → list-DQ9YBIDW.js} +1 -1
  61. package/.output/public/assets/loader-circle-8lunBReu.js +1 -0
  62. package/.output/public/assets/native-builds-C4u6JvxV.js +2 -0
  63. package/.output/public/assets/native-builds-D9hoJd6W.js +1 -0
  64. package/.output/public/assets/native-builds-zwqucwx2.js +1 -0
  65. package/.output/public/assets/native-builds_._buildId-CXx2xjoI.js +1 -0
  66. package/.output/public/assets/native-builds_._buildId-DymsEZlO.js +2 -0
  67. package/.output/public/assets/native-builds_.devices-DF3g--dt.js +1 -0
  68. package/.output/public/assets/native-builds_.devices-QToUV8FB.js +2 -0
  69. package/.output/public/assets/plus-DztQIXYL.js +1 -0
  70. package/.output/public/assets/preload-helper-CE9OukVC.js +1 -0
  71. package/.output/public/assets/{relativeTime-YQt84dYr.js → relativeTime-RUNbaMyO.js} +1 -1
  72. package/.output/public/assets/remote-config-BIIj0Faf.js +1 -0
  73. package/.output/public/assets/remote-config-BJJAxy_g.js +6 -0
  74. package/.output/public/assets/remote-config-Dm1MCHDN.js +1 -0
  75. package/.output/public/assets/rotate-ccw-tITIe0Bd.js +1 -0
  76. package/.output/public/assets/{rotate-cw-Cv2aVbYr.js → rotate-cw-BFQcpUTO.js} +1 -1
  77. package/.output/public/assets/routes-9gxYg__u.js +1 -0
  78. package/.output/public/assets/routes-CUsayL0T.js +2 -0
  79. package/.output/public/assets/search-BfEqtE64.js +1 -0
  80. package/.output/public/assets/select-Bk52fOVX.js +1 -0
  81. package/.output/public/assets/sidebar-BmzmPGuv.js +3 -0
  82. package/.output/public/assets/smartphone-Dy13ukaU.js +1 -0
  83. package/.output/public/assets/styles-C1iqL6CR.css +2 -0
  84. package/.output/public/assets/switch-CI393qIT.js +1 -0
  85. package/.output/public/assets/table-DbZPkzdz.js +1 -0
  86. package/.output/public/assets/tabs-BnpNC0zf.js +1 -0
  87. package/.output/public/assets/trash-2-DI0biNI-.js +1 -0
  88. package/.output/public/assets/{undo-2-CUX96_BG.js → undo-2-CxhBbgJw.js} +1 -1
  89. package/.output/public/assets/useAnchoredPopupScrollLock-Cvx6CdPD.js +1 -0
  90. package/.output/public/assets/{useCompositeListItem-JmyDfo3-.js → useCompositeListItem-Cbk_weKW.js} +1 -1
  91. package/.output/public/assets/{useMutation-DbYw7boA.js → useMutation-D7IuoOLE.js} +1 -1
  92. package/.output/public/assets/valueToPercent-Db73Kirz.js +1 -0
  93. package/.output/server/{__23tanstack-start-server-fn-resolver-X9YQcrQI.mjs → __23tanstack-start-server-fn-resolver-76SKGuoc.mjs} +94 -46
  94. package/.output/server/_chunks/ssr-renderer.mjs +2 -2
  95. package/.output/server/_libs/@base-ui/react+[...].mjs +4436 -3131
  96. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  97. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +2 -2
  98. package/.output/server/_libs/_.mjs +2 -0
  99. package/.output/server/_libs/lucide-react.mjs +34 -28
  100. package/.output/server/_libs/next-themes.mjs +1 -1
  101. package/.output/server/_libs/react-redux+[...].mjs +1 -1
  102. package/.output/server/_libs/recharts+[...].mjs +1 -1
  103. package/.output/server/_libs/sonner.mjs +1 -1
  104. package/.output/server/_libs/tanstack__react-query.mjs +1 -1
  105. package/.output/server/_ssr/-native-builds-search-Bwt8tQzp.mjs +55 -0
  106. package/.output/server/_ssr/{BundleIdDisplay-BVrZXzTm.mjs → BundleIdDisplay-By3CbbRM.mjs} +3 -3
  107. package/.output/server/_ssr/ChannelBadge-CDup7l56.mjs +23 -0
  108. package/.output/server/_ssr/ChannelPicker-Du2TmP3P.mjs +251 -0
  109. package/.output/server/_ssr/{ConsoleFeatureUnavailable-CULyV3nR.mjs → ConsoleFeatureUnavailable-C6aGoKDE.mjs} +8 -8
  110. package/.output/server/_ssr/{EventDetails-DeI1rOQc.mjs → EventDetails-VbcnMnSs.mjs} +9 -9
  111. package/.output/server/_ssr/{HashValueDisplay-DpnPD3U2.mjs → HashValueDisplay-CnC2fHER.mjs} +7 -7
  112. package/.output/server/_ssr/{InsightsPageHeader-Dwmdtelg.mjs → InsightsPageHeader-BuOanVZL.mjs} +13 -13
  113. package/.output/server/_ssr/IosInstall-BAFhW7Q9.mjs +751 -0
  114. package/.output/server/_ssr/NativeBuildsNav-BoTu4aLF.mjs +38 -0
  115. package/.output/server/_ssr/{NotFoundPage-Dddp1HSc.mjs → NotFoundPage-Bz05xF5Q.mjs} +3 -3
  116. package/.output/server/_ssr/{PlatformIcon-CFLiTjh1.mjs → PlatformIcon-C22qEcwo.mjs} +13 -3
  117. package/.output/server/_ssr/QrCode-DWshAW81.mjs +50 -0
  118. package/.output/server/_ssr/RelativeTime-D5kDQVn1.mjs +242 -0
  119. package/.output/server/_ssr/{git-CTA8Aqr0.mjs → RolloutPercentageBadge-Dwx7dEeQ.mjs} +20 -4
  120. package/.output/server/_ssr/RowReason-pVOWQ7t5.mjs +186 -0
  121. package/.output/server/_ssr/SandboxBadge-DFbUYwhO.mjs +85 -0
  122. package/.output/server/_ssr/TargetDisplay-BtE5vntq.mjs +105 -0
  123. package/.output/server/_ssr/{alert-dialog-ei2c1b6A.mjs → alert-dialog-tcfkkNUX.mjs} +4 -4
  124. package/.output/server/_ssr/{api-keys-CVi7E0qS.mjs → api-keys-12_U0SQM.mjs} +14 -11
  125. package/.output/server/_ssr/{api-keys-BLHCygD_.mjs → api-keys-Bm8uDp2u.mjs} +2 -2
  126. package/.output/server/_ssr/{api-keys-rpc-CLZsTwih.mjs → api-keys-rpc-BxkfToWI.mjs} +4 -4
  127. package/.output/server/_ssr/{api-rpc-p-7EhGIG.mjs → api-rpc-TSnLWB7e.mjs} +83 -35
  128. package/.output/server/_ssr/{api-CvwqILEx.mjs → api-xOHZxbzu.mjs} +174 -37
  129. package/.output/server/_ssr/{auth-rpc-B1W4-hxa.mjs → auth-rpc-D3w54vsW.mjs} +5 -5
  130. package/.output/server/_ssr/{auth.server-CVKs7SWJ.mjs → auth.server-a2eP6q5P.mjs} +952 -186
  131. package/.output/server/_ssr/{badge-nS9EbEA0.mjs → badge-DrfbN1n0.mjs} +4 -45
  132. package/.output/server/_ssr/{bundleActivity-MLrjNJCT.mjs → bundleActivity-a-pEDiqu.mjs} +1 -1
  133. package/.output/server/_ssr/card-DEItjgKG.mjs +49 -0
  134. package/.output/server/_ssr/{config.server-BAdvotbH.mjs → config.server-K8dd4dRv.mjs} +4 -4
  135. package/.output/server/_ssr/{console-access-BiuC2QFp.mjs → console-access-D-DHU4YH.mjs} +2 -2
  136. package/.output/server/_ssr/{console-features-BTV-XuhQ.mjs → console-features-DTYyXrWO.mjs} +1 -1
  137. package/.output/server/_ssr/{console-features-api-FvbqhbTg.mjs → console-features-api-Chy2PrzZ.mjs} +5 -5
  138. package/.output/server/_ssr/{console-features-rpc-Cl3J66aP.mjs → console-features-rpc-_31L0k1i.mjs} +4 -4
  139. package/.output/server/_ssr/constants-BjsJZqaU.mjs +10 -0
  140. package/.output/server/_ssr/{createServerRpc-BVvRVOz5.mjs → createServerRpc-DJZel12M.mjs} +1 -1
  141. package/.output/server/_ssr/{databaseConfig-B_Bg7qS5.mjs → databaseConfig-B56IJxlu.mjs} +1 -1
  142. package/.output/server/_ssr/{databaseJsonValue-kS7cvEtz.mjs → databaseJsonValue-DuUoft8j.mjs} +1 -1
  143. package/.output/server/_ssr/{databaseRows-B6H8Cmgq.mjs → databaseRows-BZMFl5QV.mjs} +3 -3
  144. package/.output/server/_ssr/deviceProfileToken-xzDLfE0T.mjs +98 -0
  145. package/.output/server/_ssr/{dialog-GmTPeUS4.mjs → dialog-SAl1vP74.mjs} +5 -5
  146. package/.output/server/_ssr/dist-CiOq3ygH.mjs +148 -0
  147. package/.output/server/_ssr/{downloadBundle-DCmr7vsj.mjs → downloadBundle-C1KOnpiF.mjs} +1 -1
  148. package/.output/server/_ssr/{empty-CXWKv24M.mjs → empty-opJc9Fjw.mjs} +3 -3
  149. package/.output/server/_ssr/{empty-plugin-adapters-zrZ0xs6n.mjs → empty-plugin-adapters-BYBYBaxo.mjs} +1 -1
  150. package/.output/server/_ssr/{failureReports-Cn_zU9S8.mjs → failureReports-BVufgM3l.mjs} +3 -3
  151. package/.output/server/_ssr/{field-lwIHAwLc.mjs → field-D6Y7zDZd.mjs} +3 -3
  152. package/.output/server/_ssr/foldedPage-CUjJqtlF.mjs +176 -0
  153. package/.output/server/_ssr/{getBundleChildren-rtkEEJw5.mjs → getBundleChildren-CnOf4Frp.mjs} +2 -2
  154. package/.output/server/_ssr/{input-group-Dgr4DNbE.mjs → input-group-D2PvPRdm.mjs} +3 -3
  155. package/.output/server/_ssr/{insights-BxtyBLt0.mjs → insights-Cro4cYp7.mjs} +2 -2
  156. package/.output/server/_ssr/{insights-api-PN_9ilr8.mjs → insights-api-BPyvQert.mjs} +5 -5
  157. package/.output/server/_ssr/{insights-DSnQTQw1.mjs → insights-dWeLneo1.mjs} +45 -191
  158. package/.output/server/_ssr/{insights-errors-7BCwFybo.mjs → insights-errors-DwUaDs0Z.mjs} +2 -2
  159. package/.output/server/_ssr/{insights-failures-B9VPkzZE.mjs → insights-failures-DGO2_3Vx.mjs} +2 -2
  160. package/.output/server/_ssr/{insights-failures-rpc-Cxu3UtyB.mjs → insights-failures-rpc-D7M8-Et9.mjs} +11 -11
  161. package/.output/server/_ssr/{insights-recovery-BtXVU3ro.mjs → insights-recovery-Cdg3Msrj.mjs} +1 -1
  162. package/.output/server/_ssr/{insights-recovery-rpc--c6kBp3k.mjs → insights-recovery-rpc-BUMK4m4H.mjs} +7 -7
  163. package/.output/server/_ssr/{insights-rpc-oTMaAqc1.mjs → insights-rpc-BZZ4U2Ll.mjs} +4 -4
  164. package/.output/server/_ssr/{insights-search-r-Z50f0Y.mjs → insights-search-Czi553oN.mjs} +6 -8
  165. package/.output/server/_ssr/{insights-usage-DiGnuxW8.mjs → insights-usage-BVm7CDw9.mjs} +1 -1
  166. package/.output/server/_ssr/{insights-usage-rpc-DoElOI5b.mjs → insights-usage-rpc-BXvUr-z6.mjs} +7 -7
  167. package/.output/server/_ssr/{insights-usage-rpc-B00vjt0a.mjs → insights-usage-rpc-HOr6mniz.mjs} +5 -5
  168. package/.output/server/_ssr/{insights-B9NvjAWc.mjs → insights-vmCmvfXx.mjs} +5 -5
  169. package/.output/server/_ssr/{insightsUsage-ClAmoUz8.mjs → insightsUsage-lPKyRC2o.mjs} +3 -3
  170. package/.output/server/_ssr/{insights_.distribution-CnYddZ2Y.mjs → insights_.distribution-B2dxcCd_.mjs} +2 -2
  171. package/.output/server/_ssr/{insights_.distribution-mpZ0wS_R.mjs → insights_.distribution-B5V_NbK4.mjs} +17 -16
  172. package/.output/server/_ssr/{insights_.distribution-B8AMBp-Q.mjs → insights_.distribution-DongF2jp.mjs} +5 -5
  173. package/.output/server/_ssr/{installations-BfhcY_XQ.mjs → installations-B7w4LGJp.mjs} +4 -4
  174. package/.output/server/_ssr/{installations-CWTRzcR7.mjs → installations-B84kSetd.mjs} +2 -2
  175. package/.output/server/_ssr/{installations-O6Jzc5PO.mjs → installations-bieZA3xt.mjs} +13 -13
  176. package/.output/server/_ssr/ios-devices-rpc-DOQg4dpb.mjs +137 -0
  177. package/.output/server/_ssr/iosDeviceCookie-DhWNFpC6.mjs +155 -0
  178. package/.output/server/_ssr/iosDeviceProfile-jC8w4zEF.mjs +176 -0
  179. package/.output/server/_ssr/iosDevices-B4kQLURA.mjs +113 -0
  180. package/.output/server/_ssr/listReleases-QF91GLE7.mjs +94 -0
  181. package/.output/server/_ssr/{request-guard-CPdRBuGW.mjs → local-console-Dtxlsav0.mjs} +2 -9
  182. package/.output/server/_ssr/native-artifact-D4ZISXRZ.mjs +1517 -0
  183. package/.output/server/_ssr/native-builds-BU9Njiwm.mjs +696 -0
  184. package/.output/server/_ssr/native-builds-lEyKQemV.mjs +262 -0
  185. package/.output/server/_ssr/{native-builds-UIgRLMb8.mjs → native-builds-zpCsEYyA.mjs} +3 -3
  186. package/.output/server/_ssr/{native-builds_._buildId-DjUqI5sa.mjs → native-builds_._buildId-BJ4R32fq.mjs} +3 -3
  187. package/.output/server/_ssr/native-builds_._buildId-RHUotAYb.mjs +1148 -0
  188. package/.output/server/_ssr/native-builds_.devices-C0IlQkLv.mjs +10 -0
  189. package/.output/server/_ssr/native-builds_.devices-D1Ke-Fc-.mjs +820 -0
  190. package/.output/server/_ssr/nativeBuildDownloadLink-MCd5xUqP.mjs +96 -0
  191. package/.output/server/_ssr/nativeBuildInstall-DcsqDS-O.mjs +253 -0
  192. package/.output/server/_ssr/nativeBuilds-CRa36wNn.mjs +287 -0
  193. package/.output/server/_ssr/plistText-DkzlCfPI.mjs +15 -0
  194. package/.output/server/_ssr/{plugins-RIryUNWj.mjs → plugins-D9CCkDjn.mjs} +7 -6
  195. package/.output/server/_ssr/publicConsoleBase-wTKw3_iB.mjs +15 -0
  196. package/.output/server/_ssr/{release-adoption-DoAtNPED.mjs → release-adoption-gfhE5tz5.mjs} +2 -2
  197. package/.output/server/_ssr/{release-adoption-rpc-PLyiDnas.mjs → release-adoption-rpc-C4G_d8qK.mjs} +9 -9
  198. package/.output/server/_ssr/{releaseAdoption-a2byXMfz.mjs → releaseAdoption-DfEYq7I4.mjs} +4 -4
  199. package/.output/server/_ssr/{releaseCatalogCompiler-DLcean2k.mjs → releaseCatalogCompiler-CJ2Shida.mjs} +4 -3
  200. package/.output/server/_ssr/{releaseManagement-DHUux2az.mjs → releaseManagement-CqIc-SDE.mjs} +1 -1
  201. package/.output/server/_ssr/{releaseReachability-DZOK_dH-.mjs → releaseReachability-Ch1JpJkY.mjs} +2 -2
  202. package/.output/server/_ssr/{remote-config-C5j4CfGa.mjs → remote-config-1QZ0HgEu.mjs} +3 -3
  203. package/.output/server/_ssr/{remote-config-eNxv5Kzc.mjs → remote-config-CsbpqWAR.mjs} +24 -23
  204. package/.output/server/_ssr/{remote-config-tOdzsFMi.mjs → remote-config-DkgBxBka.mjs} +2 -2
  205. package/.output/server/_ssr/{remote-config-rpc-Cy4VwdMt.mjs → remote-config-rpc-KjJA9DC-.mjs} +5 -5
  206. package/.output/server/_ssr/request-guard-BPLyogIN.mjs +11 -0
  207. package/.output/server/_ssr/{router-DaQ6OkIp.mjs → router-Dy3fmb8q.mjs} +137 -64
  208. package/.output/server/_ssr/{routes-Drni4c1E.mjs → routes-68rZQGee.mjs} +470 -474
  209. package/.output/server/_ssr/{routes-BYmUIYfN.mjs → routes-Ug9uqzob.mjs} +50 -18
  210. package/.output/server/_ssr/{runtime.server-BdMY1blX.mjs → runtime.server-BUbb281Z.mjs} +4 -4
  211. package/.output/server/_ssr/{schema-ChlRtZIo.mjs → schema-CaIuQCXb.mjs} +1 -1
  212. package/.output/server/_ssr/{schema-migration-rpc-mZ_19Wt_.mjs → schema-migration-rpc-kntY9oPm.mjs} +4 -4
  213. package/.output/server/_ssr/{select-Cjrp1Sl9.mjs → select-BOKFFr_G.mjs} +12 -10
  214. package/.output/server/_ssr/{server-y3KoaSil.mjs → server-DetMvRBJ.mjs} +7 -7
  215. package/.output/server/_ssr/{sidebar-tRHVNWpo.mjs → sidebar-B46houn0.mjs} +17 -10
  216. package/.output/server/_ssr/ssr.mjs +1 -1
  217. package/.output/server/_ssr/{start-BvDsQehg.mjs → start-BSkL2B6C.mjs} +2 -2
  218. package/.output/server/_ssr/{switch-YrqCYfP-.mjs → switch-BMYzd71j.mjs} +4 -4
  219. package/.output/server/_ssr/{table-NHakBPSp.mjs → table-DWrYwJ_a.mjs} +2 -2
  220. package/.output/server/_ssr/tabs-DusHAcYy.mjs +45 -0
  221. package/.output/server/_ssr/{updateFailures-n-tGv90S.mjs → updateFailures-BwDwIoNu.mjs} +3 -3
  222. package/.output/server/_ssr/{dist-TEpM_UAD.mjs → uuid-kZvLA0Ly-DNL0qBSj.mjs} +2 -147
  223. package/.output/server/_ssr/{uuidv7-BIF4nb_q.mjs → uuidv7-C0jNe2Om.mjs} +2 -2
  224. package/.output/server/_ssr/{version-CQ98ZBpL-CWSkTT9J.mjs → version-CQ98ZBpL-zW2fpHOZ.mjs} +1 -1
  225. package/.output/server/_tanstack-start-manifest_v-CD1q5k0m.mjs +228 -0
  226. package/.output/server/index.mjs +503 -391
  227. package/lib/index.d.mts +9 -0
  228. package/package.json +7 -30
  229. package/src/components/AppSidebar.tsx +11 -2
  230. package/src/components/ChannelBadge.tsx +9 -9
  231. package/src/components/ChannelPicker.tsx +227 -0
  232. package/src/components/DataTable.tsx +363 -0
  233. package/src/components/FoldedRows.tsx +219 -0
  234. package/src/components/HashValueDisplay.tsx +6 -3
  235. package/src/components/PlatformIcon.tsx +10 -0
  236. package/src/components/RelativeTime.tsx +31 -0
  237. package/src/components/RowReason.tsx +56 -0
  238. package/src/components/TargetDisplay.tsx +95 -0
  239. package/src/components/ThemeProvider.tsx +11 -2
  240. package/src/components/features/api-keys/ApiKeysPage.tsx +5 -3
  241. package/src/components/features/bundles/BundleMetadata.tsx +1 -1
  242. package/src/components/features/bundles/RolloutCohortsDialog.tsx +8 -1
  243. package/src/components/features/channels/ChannelManagementDialog.tsx +10 -11
  244. package/src/components/features/insights/AppUsage.tsx +3 -5
  245. package/src/components/features/insights/FailureReports.tsx +3 -2
  246. package/src/components/features/insights/InsightsControls.tsx +10 -69
  247. package/src/components/features/insights/InsightsOverview.tsx +7 -1
  248. package/src/components/features/insights/InsightsPageHeader.tsx +10 -15
  249. package/src/components/features/insights/ReleaseActivity.tsx +6 -2
  250. package/src/components/features/insights/ReleaseCombobox.tsx +1 -1
  251. package/src/components/features/insights/UpdateFailures.tsx +1 -0
  252. package/src/components/features/native-builds/BuiltInBundleCard.tsx +122 -61
  253. package/src/components/features/native-builds/CommitLink.tsx +3 -2
  254. package/src/components/features/native-builds/ImportBuild.tsx +1 -1
  255. package/src/components/features/native-builds/InstallCard.tsx +316 -91
  256. package/src/components/features/native-builds/IosDevicesPage.tsx +1100 -0
  257. package/src/components/features/native-builds/IosInstall.tsx +732 -0
  258. package/src/components/features/native-builds/IpaDevicesCard.tsx +111 -0
  259. package/src/components/features/native-builds/NativeBuildDetailPage.tsx +30 -6
  260. package/src/components/features/native-builds/NativeBuildsNav.tsx +44 -0
  261. package/src/components/features/native-builds/NativeBuildsPage.tsx +94 -108
  262. package/src/components/features/native-builds/NativeBuildsTable.tsx +649 -323
  263. package/src/components/features/native-builds/OlderBuildLabel.tsx +61 -0
  264. package/src/components/features/native-builds/PatchesCard.tsx +28 -19
  265. package/src/components/features/native-builds/ReleaseNativeBuildLink.tsx +5 -5
  266. package/src/components/features/native-builds/SandboxBadge.tsx +21 -0
  267. package/src/components/features/native-builds/ServedNowCard.tsx +33 -1
  268. package/src/components/features/native-builds/ShortHash.tsx +6 -3
  269. package/src/components/features/native-builds/StoreSubmission.tsx +18 -12
  270. package/src/components/features/native-builds/playTracks.ts +7 -0
  271. package/src/components/features/releases/ReleaseEditorSheet.tsx +8 -6
  272. package/src/components/features/remote-config/PublishDialog.tsx +4 -1
  273. package/src/components/features/remote-config/VersionsCard.tsx +5 -2
  274. package/src/components/ui/alert-dialog.tsx +2 -2
  275. package/src/components/ui/badge.tsx +2 -0
  276. package/src/components/ui/button.tsx +11 -2
  277. package/src/components/ui/combobox.tsx +2 -2
  278. package/src/components/ui/dialog.tsx +3 -3
  279. package/src/components/ui/input.tsx +1 -1
  280. package/src/components/ui/select.tsx +15 -7
  281. package/src/components/ui/sheet.tsx +1 -1
  282. package/src/components/ui/sidebar.tsx +2 -2
  283. package/src/components/ui/slider.tsx +1 -1
  284. package/src/components/ui/sonner.tsx +3 -1
  285. package/src/components/ui/switch.tsx +1 -1
  286. package/src/components/ui/tabs.tsx +1 -1
  287. package/src/components/ui/textarea.tsx +1 -1
  288. package/src/index.ts +9 -0
  289. package/src/lib/api-rpc.ts +125 -35
  290. package/src/lib/api.ts +160 -16
  291. package/src/lib/constants.ts +15 -0
  292. package/src/lib/insights-search.ts +0 -3
  293. package/src/lib/ios-devices-api.ts +290 -0
  294. package/src/lib/ios-devices-rpc.ts +188 -0
  295. package/src/lib/native-builds.ts +261 -20
  296. package/src/lib/server/console-runtime.server.ts +9 -2
  297. package/src/lib/server/deviceProfileToken.ts +221 -0
  298. package/src/lib/server/foldedPage.ts +360 -0
  299. package/src/lib/server/iosDeviceCookie.ts +239 -0
  300. package/src/lib/server/iosDeviceProfile.ts +232 -0
  301. package/src/lib/server/iosDevices.ts +193 -0
  302. package/src/lib/server/listReleases.ts +101 -62
  303. package/src/lib/server/local-console.ts +1 -1
  304. package/src/lib/server/nativeBuildDownloadLink.ts +193 -0
  305. package/src/lib/server/nativeBuildInstall.ts +502 -0
  306. package/src/lib/server/nativeBuilds.ts +314 -58
  307. package/src/lib/server/plistText.ts +17 -0
  308. package/src/lib/server/publicConsoleBase.ts +17 -0
  309. package/src/routeTree.gen.ts +129 -18
  310. package/src/routes/-native-builds-search.ts +52 -4
  311. package/src/routes/-releases-search.ts +63 -2
  312. package/src/routes/[_]hot-updater/devices/device-response.ts +21 -0
  313. package/src/routes/[_]hot-updater/devices/device[.]mobileconfig.ts +17 -0
  314. package/src/routes/[_]hot-updater/devices/receipt.ts +28 -0
  315. package/src/routes/[_]hot-updater/devices/request.ts +28 -0
  316. package/src/routes/[_]hot-updater/native-builds/$buildId/manifest[.]plist.ts +22 -0
  317. package/src/routes/api/native-builds/$buildId/download.ts +22 -1
  318. package/src/routes/index.tsx +657 -577
  319. package/src/routes/insights.tsx +3 -5
  320. package/src/routes/insights_.distribution.tsx +2 -2
  321. package/src/routes/native-builds_.devices.tsx +21 -0
  322. package/src/styles.css +24 -0
  323. package/.output/public/assets/-native-builds-search-C-TGpFAm.js +0 -1
  324. package/.output/public/assets/EventDetails-Dl2RvPAk.js +0 -1
  325. package/.output/public/assets/HashValueDisplay-6lNRxDJX.js +0 -1
  326. package/.output/public/assets/InsightsPageHeader-DHhqY3DT.js +0 -1
  327. package/.output/public/assets/RolloutPercentageBadge-Cxogpi8F.js +0 -1
  328. package/.output/public/assets/StoreSubmission-ViTkW4eJ.js +0 -1
  329. package/.output/public/assets/alert-dialog-BqYScr9y.js +0 -1
  330. package/.output/public/assets/api-P2g8dCNg.js +0 -1
  331. package/.output/public/assets/api-keys-DWQC2q6y.js +0 -1
  332. package/.output/public/assets/api-keys-FueRkF9q.js +0 -1
  333. package/.output/public/assets/arrow-left-g9cKqXuC.js +0 -1
  334. package/.output/public/assets/arrow-right-CNII8TYn.js +0 -1
  335. package/.output/public/assets/arrow-up-right-DK8Zdg40.js +0 -1
  336. package/.output/public/assets/badge-DWFcDWho.js +0 -1
  337. package/.output/public/assets/check-CXVR3s3X.js +0 -1
  338. package/.output/public/assets/chevron-right-BoUXo82O.js +0 -1
  339. package/.output/public/assets/dialog-CNUPxNxH.js +0 -1
  340. package/.output/public/assets/dist-CPlO6ko9.js +0 -1
  341. package/.output/public/assets/empty-B3Uwdd6k.js +0 -1
  342. package/.output/public/assets/field-D-2-mnNh.js +0 -1
  343. package/.output/public/assets/history-DqHlgSuV.js +0 -1
  344. package/.output/public/assets/index-CqP5HPV6.js +0 -10
  345. package/.output/public/assets/input-group-D3OUBk4n.js +0 -1
  346. package/.output/public/assets/insights-B-0odqpt.js +0 -42
  347. package/.output/public/assets/insights-BSVGfxSL.js +0 -1
  348. package/.output/public/assets/insights-NK5B6ReS.js +0 -2
  349. package/.output/public/assets/insights-api-BVCXJsoV.js +0 -1
  350. package/.output/public/assets/insights-search-DghCbEnk.js +0 -1
  351. package/.output/public/assets/insights-usage-rpc-CKQH0pUS.js +0 -1
  352. package/.output/public/assets/insights_.distribution-CJvgwcVZ.js +0 -2
  353. package/.output/public/assets/insights_.distribution-DblZM0mO.js +0 -1
  354. package/.output/public/assets/insights_.distribution-dvk6vYDM.js +0 -1
  355. package/.output/public/assets/installations-B674P5Z5.js +0 -2
  356. package/.output/public/assets/installations-BWxczZ2t.js +0 -1
  357. package/.output/public/assets/installations-Dv4kWQYz.js +0 -1
  358. package/.output/public/assets/native-builds-BOC71grI.js +0 -1
  359. package/.output/public/assets/native-builds-D6rldpSh.js +0 -2
  360. package/.output/public/assets/native-builds-DAy2678K.js +0 -1
  361. package/.output/public/assets/native-builds_._buildId-DD58_Phd.js +0 -1
  362. package/.output/public/assets/native-builds_._buildId-DvQDKnUQ.js +0 -2
  363. package/.output/public/assets/plus-BReVKct-.js +0 -1
  364. package/.output/public/assets/preload-helper-B44EvKhG.js +0 -1
  365. package/.output/public/assets/refresh-cw-B9HHjLej.js +0 -1
  366. package/.output/public/assets/remote-config-B7ujqhLa.js +0 -6
  367. package/.output/public/assets/remote-config-WjpozBG5.js +0 -1
  368. package/.output/public/assets/remote-config-gXeH6PBW.js +0 -1
  369. package/.output/public/assets/routes-BDdBIxYS.js +0 -1
  370. package/.output/public/assets/routes-CCD33Azv.js +0 -2
  371. package/.output/public/assets/search-BCel4Oy6.js +0 -1
  372. package/.output/public/assets/select-CBIU0_M1.js +0 -1
  373. package/.output/public/assets/sidebar-Di9SN47G.js +0 -3
  374. package/.output/public/assets/smartphone-CMaSy_ir.js +0 -1
  375. package/.output/public/assets/styles-uK-0vUMk.css +0 -2
  376. package/.output/public/assets/switch-BpdiHL_t.js +0 -1
  377. package/.output/public/assets/table-Bpy3SvSo.js +0 -1
  378. package/.output/public/assets/tabs-Xmt7tZeG.js +0 -1
  379. package/.output/public/assets/useInfiniteQuery-DX4WpBRG.js +0 -1
  380. package/.output/public/assets/valueToPercent-BLwGy_xK.js +0 -1
  381. package/.output/server/_ssr/-native-builds-search-CwNcoXf4.mjs +0 -37
  382. package/.output/server/_ssr/RolloutPercentageBadge-CoBhJtv9.mjs +0 -21
  383. package/.output/server/_ssr/StoreSubmission-CPg_Rn5E.mjs +0 -139
  384. package/.output/server/_ssr/listReleases-D_GY00SQ.mjs +0 -79
  385. package/.output/server/_ssr/native-builds-BDcOlKnd.mjs +0 -510
  386. package/.output/server/_ssr/native-builds-DhXL5zf_.mjs +0 -137
  387. package/.output/server/_ssr/native-builds_._buildId-BjsdQO93.mjs +0 -813
  388. package/.output/server/_ssr/nativeBuildQr-84cnFQPX.mjs +0 -59
  389. package/.output/server/_ssr/nativeBuilds-B_7BPjt_.mjs +0 -133
  390. package/.output/server/_ssr/qr-code-C7kNRIDX.mjs +0 -22
  391. package/.output/server/_ssr/tabs-BgTTFotk.mjs +0 -45
  392. package/.output/server/_tanstack-start-manifest_v-B5nsO5L4.mjs +0 -184
  393. package/src/lib/server/nativeBuildQr.ts +0 -73
  394. package/src/routes/[_]hot-updater/native-builds/qr.ts +0 -14
@@ -1,14 +1,15 @@
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 { a as getAssetBaseStorageUri, c as getManifestFileHash, i as RELEASE_CATALOG_FALLBACK_POLICY, l as getManifestStorageUri, o as getBundlePatch } from "./dist-CiOq3ygH.mjs";
3
+ import { i as rowToBundle, n as bundleToRow, r as releaseRowToRelease, t as bundleToPatchRows } from "./databaseRows-BZMFl5QV.mjs";
4
+ import { a as decodeChannelKey, c as parseReleaseCatalogScopeKey, i as createReleaseCatalogScopeKey, o as encodeChannelKey, r as canonicalizeAppVersion, s as isUUIDv7, t as NIL_UUID } from "./uuid-kZvLA0Ly-DNL0qBSj.mjs";
5
+ import { t as ReleaseManagementError } from "./releaseManagement-CqIc-SDE.mjs";
6
+ import { n as createUUIDv7After, t as createUUIDv7 } from "./uuidv7-C0jNe2Om.mjs";
7
+ import { i as normalizeRange } from "./version-CQ98ZBpL-zW2fpHOZ.mjs";
8
+ import { n as projectCompiledCatalog, r as projectCompiledRollbackCatalog, t as compileReleaseCatalog } from "./releaseCatalogCompiler-CJ2Shida.mjs";
9
+ import { t as isRemoteDatabase } from "./databaseConfig-B56IJxlu.mjs";
10
+ import { n as defineTable, t as defineAggregate } from "./schema-CaIuQCXb.mjs";
10
11
  import { r as rangesIntersect } from "../_libs/verkit.mjs";
11
- //#region node_modules/.nitro/vite/services/ssr/assets/auth.server-CVKs7SWJ.js
12
+ //#region node_modules/.nitro/vite/services/ssr/assets/auth.server-a2eP6q5P.js
12
13
  var SHA256_FILE_HASH_RE = /^[0-9a-f]{64}$/;
13
14
  var isContentAddressedAssetFileHash = (value) => {
14
15
  return typeof value === "string" && SHA256_FILE_HASH_RE.test(value);
@@ -997,7 +998,10 @@ var channels = defineTable({
997
998
  /**
998
999
  * The native builds `native-build android` and `native-build ios` track, newest first
999
1000
  * in each scope: a platform, a channel, and the fingerprint or app version
1000
- * the build compiled in. `min_bundle_id` names the build's built-in bundle,
1001
+ * the build compiled in. A sandbox build's scope has no channel: its app ID,
1002
+ * URL scheme, artifact kind and distribution in its place, so pull requests
1003
+ * reuse it across channels, while `channel_id` still names the channel it
1004
+ * embeds. `min_bundle_id` names the build's built-in bundle,
1001
1005
  * a `bundles` row no release publishes. Its references keep no counters, so
1002
1006
  * adding this table changes no existing one; a channel with builds is
1003
1007
  * refused deletion through `byChannel`. `build_key` is the native build key
@@ -1007,6 +1011,27 @@ var channels = defineTable({
1007
1011
  * or `versionCode`. `submitted_to`, `submitted_at_ms` and
1008
1012
  * `submitted_version` record the store track a build went to, when, and
1009
1013
  * the store's label of the build; they stay null for a build no store took.
1014
+ * `is_store_build` is true on the build a person or a job says the store
1015
+ * sells, and false on every other: deploys patch from it over the scope's
1016
+ * newest build. The engine copies the scope key into `store_build_scope_key`
1017
+ * for that build alone, so `byStoreBuild` holds one entry per scope at most,
1018
+ * on every store, while any number of a scope's builds hold none.
1019
+ * `is_sandbox` is true on a sandbox build, set from its artifact when it
1020
+ * registers and never changed, and `sandbox_url_scheme` is the URL scheme its artifact registers,
1021
+ * which its preview links open; null on any other build, and on a sandbox
1022
+ * build registered before the column, which registered the derived one.
1023
+ * `export_method` is how an `.ipa` was exported, read from its profile when
1024
+ * it registers and never changed; null on any other artifact, on an `.ipa`
1025
+ * whose profile couldn't be read, and on one registered before the column.
1026
+ * `native_app_version` is the app version the artifact itself reports, its
1027
+ * `CFBundleShortVersionString` or `versionName`, read from the artifact when
1028
+ * it registers and never changed, whatever the update strategy; `app_version`
1029
+ * stays the version OTAs target, null on a fingerprint build. It is null
1030
+ * when the artifact's can't be read, and on a build registered before the
1031
+ * column.
1032
+ * Boolean columns follow one rule: `is_*` for a fact about the row or
1033
+ * `should_*` for an instruction to the client, never null; a unique index over
1034
+ * the rows where one is true keys a derived slot, not the boolean.
1010
1035
  */
1011
1036
  var nativeBuilds = defineTable({
1012
1037
  id: {
@@ -1083,9 +1108,32 @@ var nativeBuilds = defineTable({
1083
1108
  type: "string",
1084
1109
  maxLength: 255,
1085
1110
  required: false
1111
+ },
1112
+ is_store_build: { type: "boolean" },
1113
+ is_sandbox: { type: "boolean" },
1114
+ sandbox_url_scheme: {
1115
+ type: "string",
1116
+ maxLength: 255,
1117
+ ascii: true,
1118
+ required: false
1119
+ },
1120
+ export_method: {
1121
+ type: "string",
1122
+ maxLength: 16,
1123
+ required: false
1124
+ },
1125
+ native_app_version: {
1126
+ type: "string",
1127
+ required: false
1086
1128
  }
1087
1129
  }, {
1088
1130
  key: ["id"],
1131
+ derived: { store_build_scope_key: {
1132
+ type: "string",
1133
+ maxLength: 2048,
1134
+ ascii: true,
1135
+ compute: (row) => row.is_store_build ? row.scope_key : null
1136
+ } },
1089
1137
  indexes: {
1090
1138
  byScope: {
1091
1139
  eq: ["scope_key"],
@@ -1095,6 +1143,11 @@ var nativeBuilds = defineTable({
1095
1143
  eq: ["scope_key", "build_key"],
1096
1144
  sort: ["id"]
1097
1145
  },
1146
+ byStoreBuild: {
1147
+ eq: ["store_build_scope_key"],
1148
+ sort: [],
1149
+ unique: true
1150
+ },
1098
1151
  byChannel: {
1099
1152
  eq: ["channel_id"],
1100
1153
  sort: ["id"],
@@ -1106,6 +1159,115 @@ var nativeBuilds = defineTable({
1106
1159
  }
1107
1160
  }
1108
1161
  });
1162
+ /**
1163
+ * The iPhones a team asks to install ad hoc builds on. A row decides what the
1164
+ * CLI registers with Apple, not what an export includes: Xcode's automatic ad
1165
+ * hoc profile lists every device the Apple account has enabled. `status` is
1166
+ * `pending` until someone approves it, `approved` until a build or
1167
+ * `native-build devices add` registers it with Apple, then `registered`;
1168
+ * declining or removing one deletes its row. `udid` is the UDID in lower case.
1169
+ * `apple_issuer_id` is the App Store Connect issuer whose key registered it,
1170
+ * set once: a build signed by another account never registers these rows.
1171
+ * `apple_error` is Apple's refusal of the device, or why it stopped counting
1172
+ * it, cleared by the next success. `build_id` is the newest native build whose
1173
+ * .ipa the CLI checked lists it; deleting that build never touches the row.
1174
+ * It holds personal data: a UDID, a name, and the emails of who asked and who
1175
+ * approved, null for the CLI.
1176
+ */
1177
+ var iosDevices = defineTable({
1178
+ id: {
1179
+ type: "string",
1180
+ maxLength: 36
1181
+ },
1182
+ udid: {
1183
+ type: "string",
1184
+ maxLength: 40,
1185
+ ascii: true,
1186
+ unique: true
1187
+ },
1188
+ name: {
1189
+ type: "string",
1190
+ maxLength: 100
1191
+ },
1192
+ status: {
1193
+ type: "string",
1194
+ maxLength: 16
1195
+ },
1196
+ requested_by: {
1197
+ type: "string",
1198
+ maxLength: 320,
1199
+ required: false
1200
+ },
1201
+ created_at_ms: { type: "integer" },
1202
+ approved_by: {
1203
+ type: "string",
1204
+ maxLength: 320,
1205
+ required: false
1206
+ },
1207
+ approved_at_ms: {
1208
+ type: "integer",
1209
+ required: false
1210
+ },
1211
+ registered_at_ms: {
1212
+ type: "integer",
1213
+ required: false
1214
+ },
1215
+ apple_issuer_id: {
1216
+ type: "string",
1217
+ maxLength: 64,
1218
+ ascii: true,
1219
+ required: false
1220
+ },
1221
+ apple_error: {
1222
+ type: "string",
1223
+ maxLength: 512,
1224
+ required: false
1225
+ },
1226
+ build_id: {
1227
+ type: "string",
1228
+ maxLength: 36,
1229
+ required: false
1230
+ }
1231
+ }, {
1232
+ key: ["id"],
1233
+ indexes: {
1234
+ byStatus: {
1235
+ eq: ["status"],
1236
+ sort: ["id"]
1237
+ },
1238
+ all: {
1239
+ eq: [],
1240
+ sort: ["id"]
1241
+ }
1242
+ }
1243
+ });
1244
+ /**
1245
+ * The Apple account the iOS device registry belongs to: one row, keyed
1246
+ * `registry`, holding the App Store Connect issuer that first registered a
1247
+ * device. A build claims it before it sends Apple anything, and its key makes
1248
+ * the claim atomic on every store, so two builds of two accounts can't both
1249
+ * spend a slot; another account's build then registers nothing. Removing
1250
+ * devices never releases it.
1251
+ */
1252
+ var iosDeviceAccount = defineTable({
1253
+ id: {
1254
+ type: "string",
1255
+ maxLength: 16,
1256
+ ascii: true
1257
+ },
1258
+ apple_issuer_id: {
1259
+ type: "string",
1260
+ maxLength: 64,
1261
+ ascii: true
1262
+ },
1263
+ claimed_at_ms: { type: "integer" }
1264
+ }, {
1265
+ key: ["id"],
1266
+ indexes: { all: {
1267
+ eq: [],
1268
+ sort: ["id"]
1269
+ } }
1270
+ });
1109
1271
  /** Core's module: always installed, never a plugin. */
1110
1272
  var coreModule = {
1111
1273
  id: "core",
@@ -1126,7 +1288,9 @@ var coreModule = {
1126
1288
  sort: []
1127
1289
  } }
1128
1290
  }),
1129
- native_builds: nativeBuilds
1291
+ native_builds: nativeBuilds,
1292
+ ios_devices: iosDevices,
1293
+ ios_device_account: iosDeviceAccount
1130
1294
  }
1131
1295
  };
1132
1296
  var encoder = new TextEncoder();
@@ -1286,15 +1450,8 @@ var LEASE_TABLE = "aggregate_lease";
1286
1450
  var LEASE = { id: "compaction" };
1287
1451
  /** How long a compaction holds the lease before another process may take it. */
1288
1452
  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
- };
1453
+ /** A commit compacts once this has passed since the last compaction. */
1454
+ var WINDOW_MS = 6e4;
1298
1455
  /** Log rows a compaction reads from each log table for one group. */
1299
1456
  var LOG_PAGE = 200;
1300
1457
  /**
@@ -1308,8 +1465,6 @@ var GROUPS = {
1308
1465
  };
1309
1466
  /** Tries per write after a conflict or a transient error. */
1310
1467
  var ATTEMPTS = 5;
1311
- /** Aggregate rows a memory buffer holds before a commit waits for a flush. */
1312
- var MAX_BUFFERED = 1e4;
1313
1468
  var log = defineTable({
1314
1469
  id: {
1315
1470
  type: "string",
@@ -1358,7 +1513,7 @@ var valuesOf = ({ deltas, sketches }) => ({
1358
1513
  /**
1359
1514
  * Merges `values` into the change for `key`'s identity as `tx.aggregate`
1360
1515
  * does: deltas add up and sketches merge. One constant `shardBy` keys each
1361
- * identity to one entry; the write picks the shard.
1516
+ * identity to one entry; `compile` writes it to shard 0.
1362
1517
  */
1363
1518
  var merge = (into, model, key, values) => recordAggregate(into, model, Object.fromEntries(shapeOf(model).key.map((field, at) => [field, key[at]])), values, "");
1364
1519
  var mergeAll = (into, changes) => {
@@ -1392,7 +1547,7 @@ var increment = ({ model, deltas }, key) => Object.values(deltas).some((delta) =
1392
1547
  /**
1393
1548
  * The guarded write that merges `change` into `current`: insert, patch, or
1394
1549
  * 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.
1550
+ * group can hold a loss without the gain before it, and reads sum every shard.
1396
1551
  */
1397
1552
  var rewrite = (change, key, current) => {
1398
1553
  const { model } = change;
@@ -1430,12 +1585,12 @@ var rewrite = (change, key, current) => {
1430
1585
  };
1431
1586
  };
1432
1587
  /**
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.
1588
+ * The write for each change on shard 0, since one compaction runs at a time:
1589
+ * a blind increment that creates the row for counters, and a guarded rewrite
1590
+ * for gauges and sketches, whose rows are read in one batch per table.
1436
1591
  */
1437
- var compile = async (adapter, changes, shard) => {
1438
- const keys = changes.map(({ model, key }) => [...key.slice(0, -1), shard(model)]);
1592
+ var compile = async (adapter, changes) => {
1593
+ const keys = changes.map(({ key }) => [...key.slice(0, -1), 0]);
1439
1594
  const reads = /* @__PURE__ */ new Map();
1440
1595
  changes.forEach((change, at) => {
1441
1596
  if (rewrites(change)) reads.set(change.model, [...reads.get(change.model) ?? [], at]);
@@ -1489,14 +1644,13 @@ var encode = async (changes) => {
1489
1644
  return zipped !== void 0 && zipped.length < json.length ? `z${zipped}` : json;
1490
1645
  };
1491
1646
  /**
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.
1647
+ * Batches changes to aggregates declared `batched`. A transaction writes
1648
+ * them as one log row in its own atomic write, in place of their rows; a
1649
+ * compaction later merges log rows into the aggregates and deletes them,
1650
+ * atomically again, so each applies exactly once. One lease row keeps
1651
+ * compactions one at a time.
1498
1652
  */
1499
- var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log", windowMs = WINDOW_MS[mode] }, now }) => {
1653
+ var createAggregateBatches = ({ engine, adapter, schema, batching: { windowMs = WINDOW_MS }, now }) => {
1500
1654
  if (!schema.models.has(LEASE_TABLE)) throw new DatabaseTransactionError("An engine that batches aggregates needs aggregateBatchingModule in its schema.");
1501
1655
  const holder = crypto.randomUUID().replaceAll("-", "");
1502
1656
  const table = (name) => schema.models.get(name).table;
@@ -1524,68 +1678,6 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1524
1678
  }
1525
1679
  return changes;
1526
1680
  };
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
1681
  let nextDue = 0;
1590
1682
  let compacting;
1591
1683
  /** Log rows this process read, by `[log table's index, id]`, for the deletes after a group. */
@@ -1720,7 +1812,7 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1720
1812
  more
1721
1813
  };
1722
1814
  };
1723
- const rowsFor = async (changes) => (await compile(adapter, changes, () => 0)).filter(isOp);
1815
+ const rowsFor = async (changes) => (await compile(adapter, changes)).filter(isOp);
1724
1816
  /**
1725
1817
  * Applies the oldest pending log rows whose merged changes fit in one
1726
1818
  * atomic write with the lease, which lists them as applied; the rows are
@@ -1814,20 +1906,6 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1814
1906
  }))).then((pages) => pages.some((page) => page.rows.length > 0)).finally(() => {
1815
1907
  checking = void 0;
1816
1908
  });
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
1909
  return {
1832
1910
  async transaction(fn) {
1833
1911
  let changes = /* @__PURE__ */ new Map();
@@ -1853,7 +1931,7 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1853
1931
  aggregate
1854
1932
  });
1855
1933
  if (failure) throw failure.error;
1856
- if (mode === "log" && attempt.size > 0) {
1934
+ if (attempt.size > 0) {
1857
1935
  const id = `${now().toString(36).padStart(9, "0")}${holder.slice(0, 8)}${crypto.randomUUID().slice(0, 8)}`;
1858
1936
  const shard = Math.floor(Math.random() * LOG_TABLES.length);
1859
1937
  const merged = mergeAll(/* @__PURE__ */ new Map(), attempt.values());
@@ -1867,24 +1945,18 @@ var createAggregateBatches = ({ engine, adapter, schema, batching: { mode = "log
1867
1945
  open = false;
1868
1946
  }
1869
1947
  });
1870
- if (changes.size > 0) await committed(changes);
1948
+ if (changes.size > 0 && now() >= nextDue) await compact(false, GROUPS.commit);
1871
1949
  return result;
1872
1950
  },
1873
1951
  async beforeRead(name) {
1874
1952
  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
- }
1953
+ if (await hasPending().catch((error) => {
1954
+ warn("read")(error);
1955
+ return false;
1956
+ })) await compact(true, GROUPS.read);
1882
1957
  },
1883
- flush,
1884
- async dispose() {
1885
- clearTimeout(timer);
1886
- timer = void 0;
1887
- await flush();
1958
+ async flush() {
1959
+ if (await hasPending()) await compact(true, GROUPS.flush);
1888
1960
  }
1889
1961
  };
1890
1962
  };
@@ -2022,7 +2094,8 @@ var fieldProblems = (definition, add) => {
2022
2094
  else if (field.required === false) add(`key field "${name}" is nullable`);
2023
2095
  else if (field.type === "json") add(`key field "${name}" is json`);
2024
2096
  }
2025
- for (const [name, { type, maxLength, ascii }] of Object.entries(definition.fields)) {
2097
+ const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
2098
+ for (const [name, { type, maxLength, ascii }] of bounded) {
2026
2099
  if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
2027
2100
  if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
2028
2101
  }
@@ -2139,11 +2212,13 @@ var resolveSchema = (modules) => {
2139
2212
  ...maxLength === void 0 ? {} : { maxLength },
2140
2213
  ...ascii ? { ascii } : {}
2141
2214
  }));
2142
- if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
2215
+ if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
2143
2216
  name: field,
2144
2217
  type,
2145
2218
  nullable: true,
2146
- ...multi ? { multi } : {}
2219
+ ...multi ? { multi } : {},
2220
+ ...maxLength === void 0 ? {} : { maxLength },
2221
+ ...ascii ? { ascii } : {}
2147
2222
  });
2148
2223
  else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
2149
2224
  name: metric,
@@ -2801,9 +2876,6 @@ var createDatabaseEngine = ({ batching, now = Date.now, meter, ...options }) =>
2801
2876
  flush: async () => {
2802
2877
  await batches?.flush();
2803
2878
  },
2804
- dispose: async () => {
2805
- await batches?.dispose();
2806
- },
2807
2879
  database(module) {
2808
2880
  const name = (model) => module.namespace ? `${module.namespace}_${model}` : model;
2809
2881
  return {
@@ -2882,11 +2954,10 @@ var createEngine = (database, { plugins = [], now = Date.now } = {}) => {
2882
2954
  if (module === void 0) throw new HotUpdaterConfigError(`Plugin "${plugin.id}" is not one of this engine's plugins.`);
2883
2955
  return engine.database(module);
2884
2956
  },
2885
- flush: () => engine.flush(),
2886
- dispose: () => engine.dispose()
2957
+ flush: () => engine.flush()
2887
2958
  };
2888
2959
  };
2889
- var HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.4";
2960
+ var HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.41";
2890
2961
  /**
2891
2962
  * `/version` on both mounts. The admin mount also lists the ids of the
2892
2963
  * plugins the server runs, sorted; apps never learn which plugins a server
@@ -3321,8 +3392,8 @@ var baseBundleIdsOf = (row, range, bundleId, limit) => {
3321
3392
  return ids;
3322
3393
  };
3323
3394
  var PAGE$2 = 500;
3324
- var pick$1 = (fields) => (row) => Object.fromEntries(fields.map((field) => [field, row[field]]));
3325
- var toBundleRow = pick$1([
3395
+ var pick$2 = (fields) => (row) => Object.fromEntries(fields.map((field) => [field, row[field]]));
3396
+ var toBundleRow = pick$2([
3326
3397
  "id",
3327
3398
  "platform",
3328
3399
  "git_commit_hash",
@@ -3331,7 +3402,7 @@ var toBundleRow = pick$1([
3331
3402
  "manifest_file_hash",
3332
3403
  "asset_base_storage_uri"
3333
3404
  ]);
3334
- var toPatchRow = pick$1([
3405
+ var toPatchRow = pick$2([
3335
3406
  "id",
3336
3407
  "bundle_id",
3337
3408
  "base_bundle_id",
@@ -3341,7 +3412,7 @@ var toPatchRow = pick$1([
3341
3412
  "byte_size",
3342
3413
  "order_index"
3343
3414
  ]);
3344
- var toReleaseRow = pick$1([
3415
+ var toReleaseRow = pick$2([
3345
3416
  "id",
3346
3417
  "revision",
3347
3418
  "scope_key",
@@ -3362,7 +3433,7 @@ var toReleaseRow = pick$1([
3362
3433
  "created_at_ms",
3363
3434
  "updated_at_ms"
3364
3435
  ]);
3365
- var toCatalogRow = pick$1([
3436
+ var toCatalogRow = pick$2([
3366
3437
  "scope_key",
3367
3438
  "catalog_id",
3368
3439
  "strategy",
@@ -3377,7 +3448,7 @@ var toCatalogRow = pick$1([
3377
3448
  "is_tombstone",
3378
3449
  "updated_at_ms"
3379
3450
  ]);
3380
- var toChannelRow = pick$1(["id", "name"]);
3451
+ var toChannelRow = pick$2(["id", "name"]);
3381
3452
  /** Every page of one read, in order. */
3382
3453
  var drain = async (read) => {
3383
3454
  const rows = [];
@@ -3390,7 +3461,15 @@ var drain = async (read) => {
3390
3461
  return rows;
3391
3462
  };
3392
3463
  /** 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 } };
3464
+ /** A keyset read's range on its index's order: past `after`, up to `through`. */
3465
+ var after = (input) => {
3466
+ const asc = (input.order ?? "asc") === "asc";
3467
+ const range = {
3468
+ ...input.after === void 0 ? {} : asc ? { gt: input.after } : { lt: input.after },
3469
+ ...input.through === void 0 ? {} : asc ? { lte: input.through } : { gte: input.through }
3470
+ };
3471
+ return Object.keys(range).length === 0 ? {} : { range };
3472
+ };
3394
3473
  /** Core's reads, each through one declared index or key. */
3395
3474
  var createCoreReads = (db, storage) => {
3396
3475
  /** A bundle row's patches, exactly as many as its reference counter holds. */
@@ -3582,6 +3661,322 @@ var createCoreReads = (db, storage) => {
3582
3661
  }
3583
3662
  };
3584
3663
  };
3664
+ /**
3665
+ * A device's UDID: 40 hex digits, or 8 and 16 joined by a hyphen. The same
3666
+ * rule as `normalizeIosUdid` of `@hot-updater/protocol/native-artifact`,
3667
+ * implemented here so the server's runtime never loads the artifact readers.
3668
+ */
3669
+ var UDID = /^(?:[0-9a-f]{40}|[0-9a-f]{8}-[0-9a-f]{16})$/iu;
3670
+ /** The form the registry stores and compares a UDID in, or null for text that isn't one. */
3671
+ var normalizeIosUdid = (value) => {
3672
+ const trimmed = value.trim();
3673
+ return UDID.test(trimmed) ? trimmed.toLowerCase() : null;
3674
+ };
3675
+ /** `ios_devices.name`'s bound in core's schema. */
3676
+ var NAME_MAX_LENGTH = 100;
3677
+ /** `ios_devices.requested_by` and `approved_by`'s bound: an email address. */
3678
+ var EMAIL_MAX_LENGTH = 320;
3679
+ /** `ios_devices.apple_issuer_id`'s bound. */
3680
+ var ISSUER_MAX_LENGTH = 64;
3681
+ /** How many registry rows one read takes while finding its account. */
3682
+ var ACCOUNT_SCAN_PAGE = 200;
3683
+ /** The one row of `ios_device_account`. */
3684
+ var ACCOUNT_ROW = "registry";
3685
+ /** `ios_devices.apple_error`'s bound. */
3686
+ var ERROR_MAX_LENGTH = 512;
3687
+ var STATUSES = [
3688
+ "pending",
3689
+ "approved",
3690
+ "registered"
3691
+ ];
3692
+ var OUTCOMES = [
3693
+ "registered",
3694
+ "refused",
3695
+ "disabled",
3696
+ "missing"
3697
+ ];
3698
+ /** The `apple_error` of a device Apple has disabled. */
3699
+ var IOS_DEVICE_DISABLED_ERROR = "Disabled in the Apple account.";
3700
+ /** The `apple_error` of a registered device Apple no longer lists. */
3701
+ var IOS_DEVICE_MISSING_ERROR = "Gone from the Apple account. Approve it again to register it.";
3702
+ /** A device or registry request core cannot store: the caller's input. */
3703
+ var IosDeviceInputError = class extends TypeError {
3704
+ name = "IosDeviceInputError";
3705
+ };
3706
+ var pick$1 = (row) => ({
3707
+ id: row.id,
3708
+ udid: row.udid,
3709
+ name: row.name,
3710
+ status: row.status,
3711
+ requested_by: row.requested_by ?? null,
3712
+ created_at_ms: row.created_at_ms,
3713
+ approved_by: row.approved_by ?? null,
3714
+ approved_at_ms: row.approved_at_ms ?? null,
3715
+ registered_at_ms: row.registered_at_ms ?? null,
3716
+ apple_issuer_id: row.apple_issuer_id ?? null,
3717
+ apple_error: row.apple_error ?? null,
3718
+ build_id: row.build_id ?? null
3719
+ });
3720
+ var udidOf = (udid) => {
3721
+ const key = typeof udid === "string" ? normalizeIosUdid(udid) : null;
3722
+ if (key === null) throw new IosDeviceInputError("Invalid iOS device: udid must be 40 hex digits, or 8 and 16 joined by a hyphen.");
3723
+ return key;
3724
+ };
3725
+ var nameOf = (name) => {
3726
+ const trimmed = typeof name === "string" ? name.trim() : "";
3727
+ if (trimmed.length === 0 || trimmed.length > NAME_MAX_LENGTH) throw new IosDeviceInputError(`Invalid iOS device: name must be 1 to ${NAME_MAX_LENGTH} characters.`);
3728
+ return trimmed;
3729
+ };
3730
+ /** An email, lower-cased, or null for the CLI. */
3731
+ var personOf = (value, field) => {
3732
+ if (value === null) return null;
3733
+ const email = typeof value === "string" ? value.trim().toLowerCase() : "";
3734
+ 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.`);
3735
+ return email;
3736
+ };
3737
+ /** Apple's words, on one line and within the column's bound. */
3738
+ var errorText = (text) => {
3739
+ const line = text.replace(/\s+/gu, " ").trim();
3740
+ return line.length > ERROR_MAX_LENGTH ? `${line.slice(0, 511)}…` : line;
3741
+ };
3742
+ /**
3743
+ * The iOS device registry: the iPhones and iPads a team asked to install ad hoc
3744
+ * builds on. The Console writes requests and approvals, and the CLI what Apple
3745
+ * said, each over the row it read.
3746
+ */
3747
+ var createIosDeviceApi = (db, { now = Date.now } = {}) => {
3748
+ const findIosDevice = async (udid) => {
3749
+ const key = normalizeIosUdid(udid);
3750
+ if (key === null) return null;
3751
+ const row = await db.findOne("ios_devices", { udid: key });
3752
+ return row === null ? null : pick$1(row);
3753
+ };
3754
+ /**
3755
+ * The issuer of the registry's earliest registration among its rows, by
3756
+ * when and then by ID, or null when no row names one: read only while the
3757
+ * registry has no account yet, a page at a time.
3758
+ */
3759
+ const accountOfRows = async () => {
3760
+ let earliest = null;
3761
+ for (let after;;) {
3762
+ const { rows } = await db.findMany("ios_devices", {
3763
+ index: "all",
3764
+ where: {},
3765
+ order: "asc",
3766
+ limit: ACCOUNT_SCAN_PAGE,
3767
+ ...after === void 0 ? {} : { range: { gt: after } }
3768
+ });
3769
+ for (const row of rows.map(pick$1)) {
3770
+ if (row.apple_issuer_id === null) continue;
3771
+ if (earliest === null || (row.registered_at_ms ?? 0) < (earliest.registered_at_ms ?? 0)) earliest = row;
3772
+ }
3773
+ if (rows.length < ACCOUNT_SCAN_PAGE) return earliest?.apple_issuer_id ?? null;
3774
+ after = rows.at(-1).id;
3775
+ }
3776
+ };
3777
+ return {
3778
+ async listIosDevices(input) {
3779
+ if (input.status !== void 0 && !STATUSES.includes(input.status)) throw new IosDeviceInputError(`Invalid iOS device status: ${String(input.status)}. Expected ${STATUSES.join(", ")}.`);
3780
+ const page = {
3781
+ order: input.order ?? "asc",
3782
+ limit: input.limit,
3783
+ ...after(input)
3784
+ };
3785
+ const { rows } = input.status === void 0 ? await db.findMany("ios_devices", {
3786
+ index: "all",
3787
+ where: {},
3788
+ ...page
3789
+ }) : await db.findMany("ios_devices", {
3790
+ index: "byStatus",
3791
+ where: { status: input.status },
3792
+ ...page
3793
+ });
3794
+ return rows.map(pick$1);
3795
+ },
3796
+ findIosDevice,
3797
+ async requestIosDevice(input) {
3798
+ const udid = udidOf(input.udid);
3799
+ const name = nameOf(input.name);
3800
+ const requestedBy = personOf(input.requestedBy, "requestedBy");
3801
+ const existing = await db.findOne("ios_devices", { udid });
3802
+ if (existing !== null) return {
3803
+ device: pick$1(existing),
3804
+ created: false
3805
+ };
3806
+ const device = {
3807
+ id: createUUIDv7(),
3808
+ udid,
3809
+ name,
3810
+ status: "pending",
3811
+ requested_by: requestedBy,
3812
+ created_at_ms: now(),
3813
+ approved_by: null,
3814
+ approved_at_ms: null,
3815
+ registered_at_ms: null,
3816
+ apple_issuer_id: null,
3817
+ apple_error: null,
3818
+ build_id: null
3819
+ };
3820
+ try {
3821
+ await db.transaction(async (tx) => {
3822
+ tx.create("ios_devices", device);
3823
+ });
3824
+ } catch (error) {
3825
+ if (error instanceof DatabaseConstraintError && error.reason === "unique") {
3826
+ const winner = await db.findOne("ios_devices", { udid });
3827
+ if (winner !== null) return {
3828
+ device: pick$1(winner),
3829
+ created: false
3830
+ };
3831
+ }
3832
+ throw error;
3833
+ }
3834
+ return {
3835
+ device,
3836
+ created: true
3837
+ };
3838
+ },
3839
+ async approveIosDevice(id, input) {
3840
+ const name = input.name === void 0 ? void 0 : nameOf(input.name);
3841
+ const approvedBy = personOf(input.approvedBy, "approvedBy");
3842
+ return db.transaction(async (tx) => {
3843
+ const row = await tx.findOne("ios_devices", { id });
3844
+ if (row === null) return null;
3845
+ const device = pick$1(row);
3846
+ const set = {
3847
+ ...name === void 0 || name === device.name ? {} : { name },
3848
+ ...device.status === "pending" ? {
3849
+ status: "approved",
3850
+ approved_by: approvedBy,
3851
+ approved_at_ms: now()
3852
+ } : {}
3853
+ };
3854
+ if (Object.keys(set).length === 0) return device;
3855
+ tx.update("ios_devices", row, set);
3856
+ return {
3857
+ ...device,
3858
+ ...set
3859
+ };
3860
+ });
3861
+ },
3862
+ async renameIosDevice(id, input) {
3863
+ const name = nameOf(input);
3864
+ return db.transaction(async (tx) => {
3865
+ const row = await tx.findOne("ios_devices", { id });
3866
+ if (row === null) return null;
3867
+ const device = pick$1(row);
3868
+ if (device.name === name) return device;
3869
+ tx.update("ios_devices", row, { name });
3870
+ return {
3871
+ ...device,
3872
+ name
3873
+ };
3874
+ });
3875
+ },
3876
+ async recordIosDeviceOutcome({ id, seen, issuerId, outcome, reason }) {
3877
+ if (!OUTCOMES.includes(outcome)) throw new IosDeviceInputError(`Invalid iOS device outcome: ${String(outcome)}. Expected ${OUTCOMES.join(", ")}.`);
3878
+ 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.`);
3879
+ return db.transaction(async (tx) => {
3880
+ const row = await tx.findOne("ios_devices", { id });
3881
+ if (row === null) return null;
3882
+ const device = pick$1(row);
3883
+ if (device.status !== seen.status || device.approved_at_ms !== seen.approvedAtMs || device.apple_issuer_id !== null && device.apple_issuer_id !== issuerId) return null;
3884
+ let set;
3885
+ switch (outcome) {
3886
+ case "registered":
3887
+ if (device.status === "pending") return null;
3888
+ set = {
3889
+ status: "registered",
3890
+ registered_at_ms: device.registered_at_ms ?? now(),
3891
+ apple_issuer_id: issuerId,
3892
+ apple_error: null
3893
+ };
3894
+ break;
3895
+ case "refused":
3896
+ if (device.status !== "approved") return null;
3897
+ set = { apple_error: errorText(reason === void 0 || reason.trim() === "" ? "Apple refused it." : reason) };
3898
+ break;
3899
+ case "disabled":
3900
+ if (device.status === "pending") return null;
3901
+ set = { apple_error: IOS_DEVICE_DISABLED_ERROR };
3902
+ break;
3903
+ case "missing":
3904
+ if (device.status !== "registered") return null;
3905
+ set = {
3906
+ status: "pending",
3907
+ approved_by: null,
3908
+ approved_at_ms: null,
3909
+ apple_error: IOS_DEVICE_MISSING_ERROR
3910
+ };
3911
+ }
3912
+ if (Object.entries(set).some(([column, value]) => device[column] !== (value ?? null))) tx.update("ios_devices", row, set);
3913
+ return {
3914
+ ...device,
3915
+ ...set
3916
+ };
3917
+ });
3918
+ },
3919
+ async markIosDevicesInBuild({ buildId, ids }) {
3920
+ for (const id of new Set(ids)) await db.transaction(async (tx) => {
3921
+ const row = await tx.findOne("ios_devices", { id });
3922
+ if (row === null || typeof row.build_id === "string" && row.build_id >= buildId) return;
3923
+ tx.update("ios_devices", row, { build_id: buildId });
3924
+ });
3925
+ },
3926
+ async findIosDeviceAccount() {
3927
+ const existing = await db.findOne("ios_device_account", { id: ACCOUNT_ROW });
3928
+ const issuerId = existing === null ? await accountOfRows() : existing.apple_issuer_id;
3929
+ return issuerId === null ? null : { issuerId };
3930
+ },
3931
+ async claimIosDeviceAccount(issuerId) {
3932
+ 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.`);
3933
+ const answer = (held) => ({
3934
+ issuerId: held,
3935
+ claimed: held === issuerId
3936
+ });
3937
+ const existing = await db.findOne("ios_device_account", { id: ACCOUNT_ROW });
3938
+ if (existing !== null) return answer(existing.apple_issuer_id);
3939
+ const holder = await accountOfRows() ?? issuerId;
3940
+ try {
3941
+ await db.transaction(async (tx) => {
3942
+ tx.create("ios_device_account", {
3943
+ id: ACCOUNT_ROW,
3944
+ apple_issuer_id: holder,
3945
+ claimed_at_ms: now()
3946
+ });
3947
+ });
3948
+ return answer(holder);
3949
+ } catch (error) {
3950
+ if (error instanceof DatabaseConstraintError && (error.reason === "exists" || error.reason === "unique")) {
3951
+ const winner = await db.findOne("ios_device_account", { id: ACCOUNT_ROW });
3952
+ if (winner !== null) return answer(winner.apple_issuer_id);
3953
+ }
3954
+ throw error;
3955
+ }
3956
+ },
3957
+ async deleteIosDevice(id, only) {
3958
+ const requestedBy = only?.requestedBy === void 0 ? void 0 : personOf(only.requestedBy, "requestedBy");
3959
+ return db.transaction(async (tx) => {
3960
+ const row = await tx.findOne("ios_devices", { id });
3961
+ if (row === null) return null;
3962
+ const device = pick$1(row);
3963
+ if (only?.status !== void 0 && device.status !== only.status || requestedBy !== void 0 && device.requested_by !== requestedBy) return null;
3964
+ await tx.delete("ios_devices", row);
3965
+ return device;
3966
+ });
3967
+ }
3968
+ };
3969
+ };
3970
+ /** Store destinations accepted for each native platform. */
3971
+ var NATIVE_BUILD_SUBMISSION_DESTINATIONS = {
3972
+ android: [
3973
+ "play-internal",
3974
+ "play-closed",
3975
+ "play-open",
3976
+ "play-production"
3977
+ ],
3978
+ ios: ["testflight"]
3979
+ };
3585
3980
  var PAGE$1 = 500;
3586
3981
  /** Moves one bundle into or out of its platform's total and the overall total. */
3587
3982
  var countBundle = (tx, platform, delta) => {
@@ -3610,8 +4005,10 @@ var deleteBundle = async (tx, current) => {
3610
4005
  /**
3611
4006
  * Replaces a bundle's patches with `rows`: kept patches are updated where
3612
4007
  * they changed, others deleted or created, so no key is written twice.
4008
+ * `checkNew` sees each patch it is about to create, and refuses one by
4009
+ * throwing, which leaves the transaction's writes undone.
3613
4010
  */
3614
- var replaceBundlePatches = async (tx, bundle, rows) => {
4011
+ var replaceBundlePatches = async (tx, bundle, rows, checkNew) => {
3615
4012
  const wanted = new Map(rows.map((row) => [row.id, row]));
3616
4013
  const count = bundle._refs_bundle_patches_bundle_id ?? 0;
3617
4014
  let cursor;
@@ -3636,6 +4033,7 @@ var replaceBundlePatches = async (tx, bundle, rows) => {
3636
4033
  if (page.next === void 0) break;
3637
4034
  cursor = page.next;
3638
4035
  }
4036
+ if (checkNew !== void 0) for (const row of wanted.values()) await checkNew(row);
3639
4037
  for (const row of wanted.values()) tx.create("bundle_patches", row);
3640
4038
  };
3641
4039
  /** A channel by name, created when missing; a concurrent creator's row is returned instead. */
@@ -3696,6 +4094,27 @@ var GIT_COMMIT_HASH_MAX_LENGTH = 255;
3696
4094
  * and looks up nothing else.
3697
4095
  */
3698
4096
  var BUILD_KEY = /^nbk1:[0-9a-f]{64}$/;
4097
+ /** `native_builds.sandbox_url_scheme`'s bound in core's schema. */
4098
+ var SANDBOX_URL_SCHEME_MAX_LENGTH = 255;
4099
+ /**
4100
+ * A URL scheme as RFC 3986 spells it, in lower case: what a sandbox build's
4101
+ * artifact registers, as `@hot-updater/protocol/native-artifact` reads it.
4102
+ */
4103
+ var URL_SCHEME = new RegExp(`^[a-z][a-z0-9+.-]{0,254}$`);
4104
+ /**
4105
+ * A bundle identifier or application ID, as an artifact reports it: letters,
4106
+ * digits, dots, dashes and underscores, which a scope key holds as they are.
4107
+ */
4108
+ var APP_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/;
4109
+ /** A fingerprint hash as a Release Catalog scope key holds it. */
4110
+ var FINGERPRINT_HASH = /^[A-Za-z0-9._~-]{1,255}$/;
4111
+ /** How each kind of artifact can install. */
4112
+ var DISTRIBUTIONS = {
4113
+ apk: ["direct"],
4114
+ app: ["direct"],
4115
+ aab: ["store"],
4116
+ ipa: ["direct", "store"]
4117
+ };
3699
4118
  /** A native build or scope core cannot store or look up: the caller's input. */
3700
4119
  var NativeBuildInputError = class extends TypeError {
3701
4120
  name = "NativeBuildInputError";
@@ -3717,24 +4136,67 @@ var pick = (row) => ({
3717
4136
  build_number: row.build_number ?? null,
3718
4137
  submitted_to: row.submitted_to ?? null,
3719
4138
  submitted_at_ms: row.submitted_at_ms ?? null,
3720
- submitted_version: row.submitted_version ?? null
4139
+ submitted_version: row.submitted_version ?? null,
4140
+ is_store_build: row.is_store_build === true,
4141
+ is_sandbox: row.is_sandbox === true,
4142
+ sandbox_url_scheme: row.sandbox_url_scheme ?? null,
4143
+ export_method: row.export_method ?? null,
4144
+ native_app_version: row.native_app_version ?? null
3721
4145
  });
3722
- /** The store track each platform's builds are submitted to. */
3723
- var SUBMISSION_DESTINATIONS = {
3724
- android: "play-internal",
3725
- ios: "testflight"
3726
- };
4146
+ /** The export methods an `.ipa` registers with. */
4147
+ var EXPORT_METHODS = /* @__PURE__ */ new Set([
4148
+ "app-store",
4149
+ "ad-hoc",
4150
+ "development",
4151
+ "enterprise"
4152
+ ]);
4153
+ /**
4154
+ * How many older builds of a scope one read takes, looking for one older than
4155
+ * a bundle when a build made after the bundle is the newest.
4156
+ */
4157
+ var OLDER_BUILDS_PAGE = 20;
4158
+ /** How many times a mark runs again after losing its scope's mark to another. */
4159
+ var MARK_ATTEMPTS = 8;
3727
4160
  /** `native_builds.build_number`'s bound in core's schema. */
3728
4161
  var BUILD_NUMBER_MAX_LENGTH = 64;
3729
4162
  /** `native_builds.submitted_version`'s bound in core's schema. */
3730
4163
  var SUBMITTED_VERSION_MAX_LENGTH = 255;
4164
+ var checkedScopeKey = (scopeKey) => {
4165
+ if (scopeKey.length > SCOPE_KEY_MAX_LENGTH) throw new NativeBuildInputError(`Invalid native build scope: its key is longer than ${SCOPE_KEY_MAX_LENGTH} characters; shorten the channel or app version.`);
4166
+ return scopeKey;
4167
+ };
4168
+ /**
4169
+ * How a registered artifact installs: an `.ipa` by its export method, and
4170
+ * `unknown` for one whose export no profile confirmed, which no lookup asks
4171
+ * for, so it is never reused as either.
4172
+ */
4173
+ var registeredDistribution = (kind, exportMethod) => kind !== "ipa" ? DISTRIBUTIONS[kind][0] : exportMethod === void 0 || exportMethod === null ? "unknown" : exportMethod === "app-store" ? "store" : "direct";
4174
+ /**
4175
+ * A sandbox build scope's key, which names no channel: the app ID, URL
4176
+ * scheme, artifact kind and distribution in its place, then the fingerprint,
4177
+ * or the app-version strategy and the exact app version. `v1:sandbox:` is no
4178
+ * Release Catalog strategy, so it never meets a normal build's key.
4179
+ */
4180
+ var sandboxScopeKey = (scope, sandbox) => {
4181
+ const { appId, urlScheme, artifactKind, distribution } = sandbox;
4182
+ const problem = typeof appId !== "string" || !APP_ID.test(appId) ? "its app ID must be a bundle identifier or application ID, up to 255 characters" : typeof urlScheme !== "string" || !URL_SCHEME.test(urlScheme) ? `its URL scheme must be a URL scheme in lower case, up to ${SANDBOX_URL_SCHEME_MAX_LENGTH} characters` : !ARTIFACT_KINDS[scope.platform]?.includes(artifactKind) ? `its artifact kind must be one an ${scope.platform} build makes` : distribution !== "unknown" && !DISTRIBUTIONS[artifactKind].includes(distribution) ? `an .${artifactKind} doesn't install as ${String(distribution)}` : scope.fingerprintHash !== null && !FINGERPRINT_HASH.test(scope.fingerprintHash) ? "its fingerprint hash must be 1-255 URL-safe ASCII characters" : null;
4183
+ if (problem !== null) throw new NativeBuildInputError(`Invalid sandbox build scope: ${problem}.`);
4184
+ const target = scope.fingerprintHash === null ? `app-version:${encodeURIComponent(scope.appVersion)}` : `fingerprint:${scope.fingerprintHash}`;
4185
+ return checkedScopeKey(`v1:sandbox:${scope.platform}:${appId}:${urlScheme}:${artifactKind}:${distribution}:${target}`);
4186
+ };
3731
4187
  /**
3732
4188
  * A native build scope's key: the Release Catalog scope key of a
3733
4189
  * fingerprint, or of the app-version strategy followed by the exact app
3734
4190
  * version the build compiled in. One key serves both strategies, so one
3735
- * index finds the newest build of either.
4191
+ * index finds the newest build of either. A sandbox scope's key names no
4192
+ * channel, so pull requests find a sandbox build on any.
3736
4193
  */
3737
4194
  var nativeBuildScopeKey = (scope) => {
4195
+ const { sandbox } = scope;
4196
+ if (sandbox !== void 0 && sandbox !== null) {
4197
+ if (sandbox.distribution !== "direct" && sandbox.distribution !== "store") throw new NativeBuildInputError("Invalid sandbox build scope: its distribution must be direct or store.");
4198
+ return sandboxScopeKey(scope, sandbox);
4199
+ }
3738
4200
  let scopeKey;
3739
4201
  try {
3740
4202
  const channelKey = encodeChannelKey(scope.channel);
@@ -3751,22 +4213,71 @@ var nativeBuildScopeKey = (scope) => {
3751
4213
  } catch (error) {
3752
4214
  throw new NativeBuildInputError(`Invalid native build scope: ${error instanceof Error ? error.message : String(error)}.`);
3753
4215
  }
3754
- if (scopeKey.length > SCOPE_KEY_MAX_LENGTH) throw new NativeBuildInputError(`Invalid native build scope: its key is longer than ${SCOPE_KEY_MAX_LENGTH} characters; shorten the channel or app version.`);
3755
- return scopeKey;
4216
+ return checkedScopeKey(scopeKey);
4217
+ };
4218
+ /** The channel row a registration names, or the refusal of its channel. */
4219
+ var channelIdOf = (channel) => {
4220
+ try {
4221
+ return `channel:${encodeChannelKey(channel)}`;
4222
+ } catch (error) {
4223
+ throw new NativeBuildInputError(`Invalid native build scope: ${error instanceof Error ? error.message : String(error)}.`);
4224
+ }
4225
+ };
4226
+ /**
4227
+ * A registration's scope key, from the registration's own facts: a sandbox
4228
+ * build's from what its artifact says, whatever `sandbox` it names.
4229
+ */
4230
+ var registrationScopeKey = (registration) => {
4231
+ channelIdOf(registration.channel);
4232
+ return registration.isSandbox === true ? sandboxScopeKey(registration, {
4233
+ appId: registration.sandboxAppId,
4234
+ urlScheme: registration.sandboxUrlScheme,
4235
+ artifactKind: registration.artifact.kind,
4236
+ distribution: registeredDistribution(registration.artifact.kind, registration.exportMethod)
4237
+ }) : nativeBuildScopeKey({
4238
+ ...registration,
4239
+ sandbox: null
4240
+ });
4241
+ };
4242
+ /**
4243
+ * Refuses a patch from a sandbox build's built-in bundle: no deploy patches
4244
+ * from one, so no store or test install of the app gets a patch made for a
4245
+ * sandbox build. One unique read of the base.
4246
+ */
4247
+ var refuseSandboxPatchBase = async (db, baseBundleId) => {
4248
+ if ((await db.findOne("native_builds", { min_bundle_id: baseBundleId }))?.is_sandbox === true) throw new NativeBuildInputError("A sandbox build's built-in bundle is no patch base.");
3756
4249
  };
3757
4250
  /** Whether `bundleId` is a native build's built-in bundle: one unique read. */
3758
4251
  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 }) => {
4252
+ var problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, sandboxAppId, exportMethod, nativeAppVersion, artifact }) => {
3760
4253
  if (!isUUIDv7(id)) return "id must be a UUIDv7";
3761
4254
  if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
3762
4255
  if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
3763
4256
  if (channel.trim().length === 0) return "channel is required";
4257
+ if (isSandbox !== void 0 && typeof isSandbox !== "boolean") return "isSandbox must be true or false";
4258
+ if (sandboxUrlScheme !== void 0 && sandboxUrlScheme !== null) {
4259
+ if (isSandbox !== true) return "sandboxUrlScheme is a sandbox build's, and this isn't one";
4260
+ 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`;
4261
+ }
4262
+ if (sandboxAppId !== void 0 && sandboxAppId !== null) {
4263
+ if (isSandbox !== true) return "sandboxAppId is a sandbox build's, and this isn't one";
4264
+ if (typeof sandboxAppId !== "string" || !APP_ID.test(sandboxAppId)) return "sandboxAppId must be the artifact's bundle identifier or application ID, up to 255 characters";
4265
+ }
4266
+ if (isSandbox === true) {
4267
+ if (sandboxUrlScheme === void 0 || sandboxUrlScheme === null) return "a sandbox build needs the sandboxUrlScheme its artifact registers";
4268
+ if (sandboxAppId === void 0 || sandboxAppId === null) return "a sandbox build needs the sandboxAppId its artifact reports, which an older hot-updater CLI doesn't send. Upgrade the hot-updater CLI to the version that matches this server, and build again";
4269
+ }
3764
4270
  if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
3765
4271
  if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
3766
4272
  if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
3767
4273
  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`;
4274
+ if (nativeAppVersion !== void 0 && nativeAppVersion !== null && (typeof nativeAppVersion !== "string" || nativeAppVersion.trim().length === 0)) return "nativeAppVersion must be the artifact's app version, or null";
3768
4275
  const kinds = ARTIFACT_KINDS[platform];
3769
4276
  if (!kinds.includes(artifact.kind)) return `artifact.kind of an ${platform} build must be ${kinds.join(" or ")}`;
4277
+ if (exportMethod !== void 0 && exportMethod !== null) {
4278
+ if (artifact.kind !== "ipa") return "exportMethod is an .ipa's, and this artifact isn't one";
4279
+ if (!EXPORT_METHODS.has(exportMethod)) return `exportMethod must be ${[...EXPORT_METHODS].join(", ")}, or null`;
4280
+ }
3770
4281
  if (!Number.isSafeInteger(artifact.byteSize) || artifact.byteSize < 0) return "artifact.byteSize must be a byte count";
3771
4282
  return null;
3772
4283
  };
@@ -3775,8 +4286,8 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3775
4286
  async registerNativeBuild(registration) {
3776
4287
  const problem = problemOf(registration);
3777
4288
  if (problem !== null) throw new NativeBuildInputError(`Invalid native build: ${problem}.`);
3778
- const scopeKey = nativeBuildScopeKey(registration);
3779
- const channelId = `channel:${encodeChannelKey(registration.channel)}`;
4289
+ const scopeKey = registrationScopeKey(registration);
4290
+ const channelId = channelIdOf(registration.channel);
3780
4291
  const { embeddedBundle } = registration;
3781
4292
  const row = {
3782
4293
  id: registration.id,
@@ -3795,7 +4306,12 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3795
4306
  build_number: registration.buildNumber ?? null,
3796
4307
  submitted_to: null,
3797
4308
  submitted_at_ms: null,
3798
- submitted_version: null
4309
+ submitted_version: null,
4310
+ is_store_build: false,
4311
+ is_sandbox: registration.isSandbox === true,
4312
+ sandbox_url_scheme: registration.sandboxUrlScheme ?? null,
4313
+ export_method: registration.exportMethod ?? null,
4314
+ native_app_version: registration.nativeAppVersion ?? null
3799
4315
  };
3800
4316
  for (let attempt = 1;; attempt += 1) {
3801
4317
  await insertChannel(db, {
@@ -3833,21 +4349,43 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3833
4349
  const scopeKey = nativeBuildScopeKey(scope);
3834
4350
  const buildKey = options?.buildKey;
3835
4351
  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]);
4352
+ if (options?.storeBuild) {
4353
+ const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
4354
+ return marked === null ? null : pick(marked);
4355
+ }
4356
+ const read = (limit, before) => {
4357
+ const page = {
4358
+ order: "desc",
4359
+ limit,
4360
+ ...before === void 0 ? {} : { range: { lt: before } }
4361
+ };
4362
+ return buildKey === void 0 ? db.findMany("native_builds", {
4363
+ index: "byScope",
4364
+ where: { scope_key: scopeKey },
4365
+ ...page
4366
+ }) : db.findMany("native_builds", {
4367
+ index: "byBuildKey",
4368
+ where: {
4369
+ scope_key: scopeKey,
4370
+ build_key: buildKey
4371
+ },
4372
+ ...page
4373
+ });
4374
+ };
4375
+ const bundleId = options?.builtInOlderThan;
4376
+ if (bundleId !== void 0 && scope.sandbox !== void 0 && scope.sandbox !== null) return null;
4377
+ const { rows } = await read(1);
4378
+ const newest = rows[0];
4379
+ if (newest === void 0) return null;
4380
+ if (bundleId === void 0 || newest.min_bundle_id < bundleId) return pick(newest);
4381
+ for (let before = newest.id;;) {
4382
+ const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
4383
+ const usable = older.find(({ min_bundle_id }) => min_bundle_id < bundleId);
4384
+ if (usable !== void 0) return pick(usable);
4385
+ const last = older.at(-1);
4386
+ if (older.length < OLDER_BUILDS_PAGE || last === void 0) return null;
4387
+ before = last.id;
4388
+ }
3851
4389
  },
3852
4390
  async recordNativeBuildSubmission(id, { destination, version }) {
3853
4391
  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 +4393,8 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3855
4393
  const row = await tx.findOne("native_builds", { id });
3856
4394
  if (row === null) return null;
3857
4395
  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}.`);
4396
+ 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}.`);
4397
+ 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
4398
  const set = {
3860
4399
  submitted_to: destination,
3861
4400
  submitted_at_ms: now(),
@@ -3868,6 +4407,46 @@ var createNativeBuildApi = (db, { now = Date.now } = {}) => ({
3868
4407
  };
3869
4408
  });
3870
4409
  },
4410
+ async markNativeBuild(id, { storeBuild }) {
4411
+ for (let attempt = 1;; attempt += 1) try {
4412
+ return await db.transaction(async (tx) => {
4413
+ const row = await tx.findOne("native_builds", { id });
4414
+ if (row === null) return null;
4415
+ const build = pick(row);
4416
+ if (!storeBuild) {
4417
+ if (build.is_store_build) tx.update("native_builds", row, { is_store_build: false });
4418
+ return {
4419
+ nativeBuild: {
4420
+ ...build,
4421
+ is_store_build: false
4422
+ },
4423
+ previous: null
4424
+ };
4425
+ }
4426
+ if (build.is_sandbox) throw new NativeBuildInputError("A sandbox build can't be the store build.");
4427
+ if (build.is_store_build) return {
4428
+ nativeBuild: build,
4429
+ previous: null
4430
+ };
4431
+ const holder = await tx.findOne("native_builds", { store_build_scope_key: build.scope_key });
4432
+ if (holder !== null) tx.update("native_builds", holder, { is_store_build: false });
4433
+ tx.update("native_builds", row, { is_store_build: true });
4434
+ return {
4435
+ nativeBuild: {
4436
+ ...build,
4437
+ is_store_build: true
4438
+ },
4439
+ previous: holder === null ? null : {
4440
+ ...pick(holder),
4441
+ is_store_build: false
4442
+ }
4443
+ };
4444
+ });
4445
+ } catch (error) {
4446
+ if (attempt < MARK_ATTEMPTS && error instanceof DatabaseConstraintError && error.reason === "unique") continue;
4447
+ throw error;
4448
+ }
4449
+ },
3871
4450
  async deleteNativeBuild(id) {
3872
4451
  return db.transaction(async (tx) => {
3873
4452
  const row = await tx.findOne("native_builds", { id });
@@ -4209,7 +4788,11 @@ var createCoreOperations = (db, { now = Date.now } = {}) => {
4209
4788
  for (const { release } of deployments) if (!channels.has(release.channel)) channels.set(release.channel, await ensureChannel(release.channel));
4210
4789
  const platforms = /* @__PURE__ */ new Map();
4211
4790
  for (const deployment of deployments) {
4212
- if (!("bundleId" in deployment) || platforms.has(deployment.bundleId)) continue;
4791
+ if (!("bundleId" in deployment)) {
4792
+ for (const { baseBundleId } of deployment.bundle.patches ?? []) await refuseSandboxPatchBase(db, baseBundleId);
4793
+ continue;
4794
+ }
4795
+ if (platforms.has(deployment.bundleId)) continue;
4213
4796
  const row = await db.findOne("bundles", { id: deployment.bundleId });
4214
4797
  if (row === null) throw new DatabaseBundleNotFoundError(deployment.bundleId);
4215
4798
  if (await isBuiltInBundle(db, deployment.bundleId)) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", `Bundle "${deployment.bundleId}" is a native build's built-in bundle, which no release publishes.`);
@@ -4412,7 +4995,7 @@ var createCoreOperations = (db, { now = Date.now } = {}) => {
4412
4995
  if (patches !== void 0) await replaceBundlePatches(tx, current, bundleToPatchRows({
4413
4996
  ...next,
4414
4997
  patches
4415
- }));
4998
+ }), (row) => refuseSandboxPatchBase(tx, row.base_bundle_id));
4416
4999
  }),
4417
5000
  deleteBundles: async (ids) => {
4418
5001
  try {
@@ -4472,6 +5055,7 @@ var createCoreApi = (db, storage, options = {}) => {
4472
5055
  ...reads,
4473
5056
  ...createCoreOperations(purgingCachedRoutes(db, options.onCachedRoutesChange), options),
4474
5057
  ...createNativeBuildApi(db, options),
5058
+ ...createIosDeviceApi(db, options),
4475
5059
  ready: async () => {
4476
5060
  await reads.listReleaseCatalogs({ limit: 1 });
4477
5061
  }
@@ -4682,10 +5266,12 @@ var keyset = (url, maxValue = LIMITS.maxValue) => {
4682
5266
  const limit = limitParam === null ? Math.min(LIMITS.defaultValue, maxValue) : Number(limitParam);
4683
5267
  if (!Number.isSafeInteger(limit) || limit < 1 || limit > maxValue) throw new HandlerBadRequestError(`limit must be between 1 and ${maxValue}.`);
4684
5268
  const cursor = url.searchParams.get("cursor");
5269
+ const through = url.searchParams.get("through");
4685
5270
  return {
4686
5271
  order,
4687
5272
  limit,
4688
- ...cursor === null ? {} : { after: cursor }
5273
+ ...cursor === null ? {} : { after: cursor },
5274
+ ...through === null ? {} : { through }
4689
5275
  };
4690
5276
  };
4691
5277
  /** A page and the cursor of the next one, when the page is full. */
@@ -4783,7 +5369,8 @@ var nativeBuildScopeOf = (url) => {
4783
5369
  const fingerprintHash = params.get("fingerprintHash");
4784
5370
  const appVersion = params.get("appVersion");
4785
5371
  if (platform === void 0 || !isText(channel) || fingerprintHash === null === (appVersion === null) || fingerprintHash === "" || appVersion === "") throw new HandlerBadRequestError("A native build lookup needs platform, channel, and fingerprintHash or appVersion.");
4786
- return fingerprintHash !== null ? {
5372
+ const sandbox = sandboxScopeOf(params);
5373
+ const scope = fingerprintHash !== null ? {
4787
5374
  platform,
4788
5375
  channel,
4789
5376
  fingerprintHash,
@@ -4794,17 +5381,49 @@ var nativeBuildScopeOf = (url) => {
4794
5381
  fingerprintHash: null,
4795
5382
  appVersion
4796
5383
  };
5384
+ return sandbox === null ? scope : {
5385
+ ...scope,
5386
+ sandbox
5387
+ };
5388
+ };
5389
+ /** The query parameters a sandbox lookup names, all four or none. */
5390
+ var SANDBOX_SCOPE_PARAMS = [
5391
+ "sandboxAppId",
5392
+ "sandboxUrlScheme",
5393
+ "artifactKind",
5394
+ "distribution"
5395
+ ];
5396
+ /**
5397
+ * A lookup's sandbox scope: null without one, and a bad request for one
5398
+ * named in part. Core checks each value.
5399
+ */
5400
+ var sandboxScopeOf = (params) => {
5401
+ const [appId, urlScheme, artifactKind, distribution] = SANDBOX_SCOPE_PARAMS.map((name) => params.get(name));
5402
+ const named = [
5403
+ appId,
5404
+ urlScheme,
5405
+ artifactKind,
5406
+ distribution
5407
+ ].filter((value) => value !== null).length;
5408
+ if (named === 0) return null;
5409
+ if (named !== SANDBOX_SCOPE_PARAMS.length) throw new HandlerBadRequestError(`A sandbox build lookup needs ${SANDBOX_SCOPE_PARAMS.join(", ")}.`);
5410
+ return {
5411
+ appId,
5412
+ urlScheme,
5413
+ artifactKind,
5414
+ distribution
5415
+ };
4797
5416
  };
4798
5417
  /** A native build or scope core refuses: a bad request. */
4799
5418
  var refusingInvalid = async (operation) => {
4800
5419
  try {
4801
5420
  return await operation();
4802
5421
  } catch (error) {
4803
- if (error instanceof NativeBuildInputError) throw new HandlerBadRequestError(error.message);
5422
+ if (error instanceof NativeBuildInputError || error instanceof IosDeviceInputError) throw new HandlerBadRequestError(error.message);
4804
5423
  throw error;
4805
5424
  }
4806
5425
  };
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));
5426
+ 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.sandboxAppId === void 0 || isTextOrNull(value.sandboxAppId)) && (value.exportMethod === void 0 || isTextOrNull(value.exportMethod)) && (value.nativeAppVersion === void 0 || isTextOrNull(value.nativeAppVersion)) && 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
5427
  var scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
4809
5428
  /** Every admin route's handler, by the name `ADMIN_ROUTES` mounts it under. */
4810
5429
  var createAdminRouteHandlers = () => ({
@@ -4880,7 +5499,8 @@ var createAdminRouteHandlers = () => ({
4880
5499
  rebuildReleaseCatalog: onCore(async (core, _request, params) => json({ data: await core.rebuildReleaseCatalog(scopeKeyOf(params)) })),
4881
5500
  updateBundle: onCore(async (core, request, params) => {
4882
5501
  const bundleId = requireRouteParam(params, "id");
4883
- await core.updateBundle(bundleId, bundleUpdateOf(await request.json(), bundleId));
5502
+ const update = bundleUpdateOf(await request.json(), bundleId);
5503
+ await refusingInvalid(() => core.updateBundle(bundleId, update));
4884
5504
  return noContent();
4885
5505
  }),
4886
5506
  countBundles: onCore(async (core, request) => json({ data: await core.countBundles(platformOf(new URL(request.url))) })),
@@ -4903,7 +5523,7 @@ var createAdminRouteHandlers = () => ({
4903
5523
  deployReleases: onCore(async (core, request) => {
4904
5524
  const { deployments } = await body(request);
4905
5525
  if (!Array.isArray(deployments) || deployments.length === 0 || !deployments.every(isDeployment)) throw new HandlerBadRequestError("Deploy needs deployments, each a bundle and its release policy.");
4906
- return json({ data: await core.deploy(deployments) }, 201);
5526
+ return json({ data: await refusingInvalid(() => core.deploy(deployments)) }, 201);
4907
5527
  }),
4908
5528
  promoteRelease: onCore(async (core, request, params) => {
4909
5529
  const input = await body(request);
@@ -4926,7 +5546,13 @@ var createAdminRouteHandlers = () => ({
4926
5546
  const url = new URL(request.url);
4927
5547
  const scope = nativeBuildScopeOf(url);
4928
5548
  const buildKey = url.searchParams.get("buildKey");
4929
- return json({ data: await refusingInvalid(() => buildKey === null ? core.findNativeBuild(scope) : core.findNativeBuild(scope, { buildKey })) });
5549
+ const builtInOlderThan = url.searchParams.get("builtInOlderThan");
5550
+ const options = {
5551
+ ...buildKey === null ? {} : { buildKey },
5552
+ ...url.searchParams.get("storeBuild") === "true" ? { storeBuild: true } : {},
5553
+ ...builtInOlderThan === null ? {} : { builtInOlderThan }
5554
+ };
5555
+ return json({ data: await refusingInvalid(() => Object.keys(options).length === 0 ? core.findNativeBuild(scope) : core.findNativeBuild(scope, options)) });
4930
5556
  }),
4931
5557
  getNativeBuild: onCore(async (core, _request, params) => json({ data: await core.getNativeBuild(requireRouteParam(params, "id")) })),
4932
5558
  listNativeBuilds: onCore(async (core, request) => {
@@ -4940,14 +5566,96 @@ var createAdminRouteHandlers = () => ({
4940
5566
  }),
4941
5567
  recordNativeBuildSubmission: onCore(async (core, request, params) => {
4942
5568
  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.");
5569
+ 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
5570
  const submission = {
4945
5571
  destination: input.destination,
4946
5572
  version: input.version
4947
5573
  };
4948
5574
  return json({ data: await refusingInvalid(() => core.recordNativeBuildSubmission(requireRouteParam(params, "id"), submission)) });
4949
5575
  }),
5576
+ markNativeBuild: onCore(async (core, request, params) => {
5577
+ const input = await body(request);
5578
+ if (!isRecord$1(input) || typeof input.storeBuild !== "boolean") throw new HandlerBadRequestError("A native build's store build mark needs storeBuild, true or false.");
5579
+ const mark = { storeBuild: input.storeBuild };
5580
+ return json({ data: await refusingInvalid(() => core.markNativeBuild(requireRouteParam(params, "id"), mark)) });
5581
+ }),
4950
5582
  deleteNativeBuild: onCore(async (core, _request, params) => json({ data: await core.deleteNativeBuild(requireRouteParam(params, "id")) })),
5583
+ listIosDevices: onCore(async (core, request) => {
5584
+ const url = new URL(request.url);
5585
+ const input = keyset(url);
5586
+ const status = url.searchParams.get("status");
5587
+ return page(await refusingInvalid(() => core.listIosDevices({
5588
+ ...input,
5589
+ ...status === null ? {} : { status }
5590
+ })), input, ({ id }) => id);
5591
+ }),
5592
+ findIosDevice: onCore(async (core, _request, params) => json({ data: await core.findIosDevice(requireRouteParam(params, "udid")) })),
5593
+ requestIosDevice: onCore(async (core, request) => {
5594
+ const input = await body(request);
5595
+ 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.");
5596
+ const device = {
5597
+ udid: input.udid,
5598
+ name: input.name,
5599
+ requestedBy: input.requestedBy
5600
+ };
5601
+ return json({ data: await refusingInvalid(() => core.requestIosDevice(device)) });
5602
+ }),
5603
+ approveIosDevice: onCore(async (core, request, params) => {
5604
+ const input = await body(request);
5605
+ 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.");
5606
+ const approval = {
5607
+ approvedBy: input.approvedBy,
5608
+ ...input.name === void 0 ? {} : { name: input.name }
5609
+ };
5610
+ return json({ data: await refusingInvalid(() => core.approveIosDevice(requireRouteParam(params, "id"), approval)) });
5611
+ }),
5612
+ renameIosDevice: onCore(async (core, request, params) => {
5613
+ const input = await body(request);
5614
+ if (!isText(input.name)) throw new HandlerBadRequestError("An iOS device's new name is required.");
5615
+ const name = input.name;
5616
+ return json({ data: await refusingInvalid(() => core.renameIosDevice(requireRouteParam(params, "id"), name)) });
5617
+ }),
5618
+ recordIosDeviceOutcome: onCore(async (core, request, params) => {
5619
+ const input = await body(request);
5620
+ const seen = input.seen;
5621
+ 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.");
5622
+ const outcome = {
5623
+ id: requireRouteParam(params, "id"),
5624
+ seen: {
5625
+ status: seen.status,
5626
+ approvedAtMs: seen.approvedAtMs
5627
+ },
5628
+ issuerId: input.issuerId,
5629
+ outcome: input.outcome,
5630
+ ...input.reason === void 0 ? {} : { reason: input.reason }
5631
+ };
5632
+ return json({ data: await refusingInvalid(() => core.recordIosDeviceOutcome(outcome)) });
5633
+ }),
5634
+ claimIosDeviceAccount: onCore(async (core, request) => {
5635
+ const { issuerId } = await body(request);
5636
+ if (!isText(issuerId)) throw new HandlerBadRequestError("Claiming the iOS device account needs issuerId.");
5637
+ return json({ data: await refusingInvalid(() => core.claimIosDeviceAccount(issuerId)) });
5638
+ }),
5639
+ findIosDeviceAccount: onCore(async (core) => json({ data: await core.findIosDeviceAccount() })),
5640
+ markIosDevicesInBuild: onCore(async (core, request) => {
5641
+ const { buildId, ids } = await body(request);
5642
+ if (!isText(buildId) || !Array.isArray(ids) || !ids.every((id) => isText(id))) throw new HandlerBadRequestError("Marking iOS devices in a build needs buildId and ids.");
5643
+ await core.markIosDevicesInBuild({
5644
+ buildId,
5645
+ ids
5646
+ });
5647
+ return noContent();
5648
+ }),
5649
+ deleteIosDevice: onCore(async (core, request, params) => {
5650
+ const url = new URL(request.url);
5651
+ const status = url.searchParams.get("status");
5652
+ const requestedBy = url.searchParams.get("requestedBy");
5653
+ const only = {
5654
+ ...status === null ? {} : { status },
5655
+ ...requestedBy === null ? {} : { requestedBy }
5656
+ };
5657
+ return json({ data: await refusingInvalid(() => Object.keys(only).length === 0 ? core.deleteIosDevice(requireRouteParam(params, "id")) : core.deleteIosDevice(requireRouteParam(params, "id"), only)) });
5658
+ }),
4951
5659
  deleteBundles: onCore(async (core, request) => {
4952
5660
  const { ids } = await body(request);
4953
5661
  if (!Array.isArray(ids) || !ids.every((id) => typeof id === "string" && id.length > 0)) throw new HandlerBadRequestError("Bundle deletion needs ids");
@@ -5092,10 +5800,65 @@ var ADMIN_ROUTES = [
5092
5800
  path: "/native-builds/:id/submission",
5093
5801
  handler: "recordNativeBuildSubmission"
5094
5802
  },
5803
+ {
5804
+ method: "POST",
5805
+ path: "/native-builds/:id/store-build",
5806
+ handler: "markNativeBuild"
5807
+ },
5095
5808
  {
5096
5809
  method: "DELETE",
5097
5810
  path: "/native-builds/:id",
5098
5811
  handler: "deleteNativeBuild"
5812
+ },
5813
+ {
5814
+ method: "GET",
5815
+ path: "/ios-devices",
5816
+ handler: "listIosDevices"
5817
+ },
5818
+ {
5819
+ method: "POST",
5820
+ path: "/ios-devices",
5821
+ handler: "requestIosDevice"
5822
+ },
5823
+ {
5824
+ method: "GET",
5825
+ path: "/ios-devices/udid/:udid",
5826
+ handler: "findIosDevice"
5827
+ },
5828
+ {
5829
+ method: "POST",
5830
+ path: "/ios-devices/in-build",
5831
+ handler: "markIosDevicesInBuild"
5832
+ },
5833
+ {
5834
+ method: "GET",
5835
+ path: "/ios-devices/account",
5836
+ handler: "findIosDeviceAccount"
5837
+ },
5838
+ {
5839
+ method: "POST",
5840
+ path: "/ios-devices/account",
5841
+ handler: "claimIosDeviceAccount"
5842
+ },
5843
+ {
5844
+ method: "POST",
5845
+ path: "/ios-devices/:id/approval",
5846
+ handler: "approveIosDevice"
5847
+ },
5848
+ {
5849
+ method: "POST",
5850
+ path: "/ios-devices/:id/outcome",
5851
+ handler: "recordIosDeviceOutcome"
5852
+ },
5853
+ {
5854
+ method: "PATCH",
5855
+ path: "/ios-devices/:id",
5856
+ handler: "renameIosDevice"
5857
+ },
5858
+ {
5859
+ method: "DELETE",
5860
+ path: "/ios-devices/:id",
5861
+ handler: "deleteIosDevice"
5099
5862
  }
5100
5863
  ];
5101
5864
  var CATALOG_CONTENT_TYPE = "application/vnd.hot-updater.release-catalog+json; version=1";
@@ -5603,8 +6366,11 @@ var resolveConsoleConfig = async (request) => {
5603
6366
  const { default: source } = await import("./config-CjIBFhJX.mjs");
5604
6367
  const config = typeof source === "function" ? await source(request) : source;
5605
6368
  const { database, storage, plugins = [] } = config;
5606
- const { gitUrl } = config.console ?? {};
5607
- const consoleOptions = gitUrl === void 0 ? {} : { gitUrl };
6369
+ const { gitUrl, deviceApprovers = [] } = config.console ?? {};
6370
+ const consoleOptions = {
6371
+ ...gitUrl === void 0 ? {} : { gitUrl },
6372
+ deviceApprovers: deviceApprovers.map((email) => email.trim().toLowerCase()).filter((email) => email.length > 0)
6373
+ };
5608
6374
  if (isRemoteDatabase(database)) {
5609
6375
  const checked = assemble({
5610
6376
  name: "memory",