@hot-updater/console 1.2.0-rc.26 → 1.2.0-rc.28

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 (286) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{-native-builds-search-OlRj4Jz0.js → -native-builds-search-7blX2yQW.js} +1 -1
  3. package/.output/public/assets/BundleIdDisplay-B0gAH01c.js +1 -0
  4. package/.output/public/assets/CompositeItem-Dy4xgOMg.js +1 -0
  5. package/.output/public/assets/{ConsoleFeatureUnavailable-DUqlpHCp.js → ConsoleFeatureUnavailable-cy_snb33.js} +1 -1
  6. package/.output/public/assets/{EventDetails-DZsRlDHk.js → EventDetails-sxag8Hfc.js} +1 -1
  7. package/.output/public/assets/{HashValueDisplay-MoZMmTeP.js → HashValueDisplay-DMweha_0.js} +1 -1
  8. package/.output/public/assets/{InsightsPageHeader-2bTrjXln.js → InsightsPageHeader-D5TJspVe.js} +1 -1
  9. package/.output/public/assets/IosInstall-B5NspihF.js +1 -0
  10. package/.output/public/assets/NativeBuildsNav-CjOOlbEu.js +1 -0
  11. package/.output/public/assets/{NotFoundPage-Ckb5GMhh.js → NotFoundPage-DDOJarFa.js} +1 -1
  12. package/.output/public/assets/{PlatformIcon-CJ69KopR.js → PlatformIcon-BBvlg6JY.js} +1 -1
  13. package/.output/public/assets/RelativeTime-CY1dKZpv.js +1 -0
  14. package/.output/public/assets/{RolloutPercentageBadge-G6qt8rVb.js → RolloutPercentageBadge-BHgHkBGB.js} +1 -1
  15. package/.output/public/assets/RowReason-BMx_vclu.js +1 -0
  16. package/.output/public/assets/SandboxBadge-irEkMf1P.js +1 -0
  17. package/.output/public/assets/TargetDisplay-DB8D019f.js +1 -0
  18. package/.output/public/assets/{alert-dialog-DiRLrFVe.js → alert-dialog-CLC_h1fL.js} +1 -1
  19. package/.output/public/assets/api-DLryz9hA.js +1 -0
  20. package/.output/public/assets/api-keys-Cd-aNt-v.js +1 -0
  21. package/.output/public/assets/api-keys-D3tAc4Uu.js +1 -0
  22. package/.output/public/assets/arrow-left-DQjHJAnT.js +1 -0
  23. package/.output/public/assets/arrow-right-CXp_K3xK.js +1 -0
  24. package/.output/public/assets/arrow-up-right-BFafIOrq.js +1 -0
  25. package/.output/public/assets/{badge-D0NFvUY5.js → badge-DJMW4YVM.js} +1 -1
  26. package/.output/public/assets/card-C4sBAMU-.js +1 -0
  27. package/.output/public/assets/check-CqWNyG93.js +1 -0
  28. package/.output/public/assets/chevron-right-DNbYTBX1.js +1 -0
  29. package/.output/public/assets/{circle-off-C7Muo0ss.js → circle-off-BCkZpskJ.js} +1 -1
  30. package/.output/public/assets/{clipboard-DQbOcrL7.js → clipboard-DZrZK5gR.js} +1 -1
  31. package/.output/public/assets/{console-features-api-DEXSwFtc.js → console-features-api-BO5V64P3.js} +1 -1
  32. package/.output/public/assets/{copy-DsuLj3oj.js → copy-CH1__JAW.js} +1 -1
  33. package/.output/public/assets/dialog-tCTZmAo8.js +1 -0
  34. package/.output/public/assets/{dist-Bf1BPKMs.js → dist-Bw_uSBJn.js} +1 -1
  35. package/.output/public/assets/empty-DsbLxQ1w.js +1 -0
  36. package/.output/public/assets/field-DL4OXTJ7.js +1 -0
  37. package/.output/public/assets/git-branch-ByZMEBxZ.js +1 -0
  38. package/.output/public/assets/history-wYnPoVmT.js +1 -0
  39. package/.output/public/assets/index-CAnjb7M2.js +10 -0
  40. package/.output/public/assets/{input-group-D_NfhUbX.js → input-group-B7jx0icS.js} +1 -1
  41. package/.output/public/assets/insights-DIs4nJI9.js +2 -0
  42. package/.output/public/assets/insights-DTF7C4jb.js +42 -0
  43. package/.output/public/assets/insights-api-B6Gj74n5.js +1 -0
  44. package/.output/public/assets/insights-bUk3ChoU.js +1 -0
  45. package/.output/public/assets/{insights-search-CYPrQVUC.js → insights-search-TfRz5kGG.js} +1 -1
  46. package/.output/public/assets/insights-usage-rpc-B4V-Qqo4.js +1 -0
  47. package/.output/public/assets/insights_.distribution-BPl5oRt4.js +2 -0
  48. package/.output/public/assets/{insights_.distribution-_dZi1_ay.js → insights_.distribution-BqfzAuAf.js} +1 -1
  49. package/.output/public/assets/insights_.distribution-BqtmnGTt.js +1 -0
  50. package/.output/public/assets/installations-6U8c_03X.js +1 -0
  51. package/.output/public/assets/{installations-Y_7QW_p8.js → installations-BU65zztK.js} +1 -1
  52. package/.output/public/assets/installations-D3MbzcFb.js +2 -0
  53. package/.output/public/assets/{key-round-DzBe6DHr.js → key-round-B-P_hhUB.js} +1 -1
  54. package/.output/public/assets/{link-DTEyW70e.js → link-CN3iHC4A.js} +2 -2
  55. package/.output/public/assets/{list-B6GeoQ_b.js → list-fFsS8Wxe.js} +1 -1
  56. package/.output/public/assets/loader-circle-GWIgH0fo.js +1 -0
  57. package/.output/public/assets/native-builds-BdzfAFnF.js +1 -0
  58. package/.output/public/assets/native-builds-CWwvuOXr.js +2 -0
  59. package/.output/public/assets/native-builds-Eh72Vr2G.js +1 -0
  60. package/.output/public/assets/native-builds_._buildId-33ksAlnZ.js +1 -0
  61. package/.output/public/assets/native-builds_._buildId-BVA5GnZP.js +2 -0
  62. package/.output/public/assets/native-builds_.devices-CElovmwq.js +1 -0
  63. package/.output/public/assets/native-builds_.devices-DWtcOVYO.js +2 -0
  64. package/.output/public/assets/{package-ytYrywZH.js → package-CXSDZsME.js} +1 -1
  65. package/.output/public/assets/plus-Cx-yFNd9.js +1 -0
  66. package/.output/public/assets/preload-helper-CRQjUQaZ.js +1 -0
  67. package/.output/public/assets/{refresh-cw-C-tvoCcE.js → refresh-cw-BgiOaFX3.js} +1 -1
  68. package/.output/public/assets/{relativeTime-DvyxGIsm.js → relativeTime-CBmDq8wh.js} +1 -1
  69. package/.output/public/assets/remote-config-B3oq9qR0.js +1 -0
  70. package/.output/public/assets/remote-config-CGbqsPh_.js +6 -0
  71. package/.output/public/assets/remote-config-D1OkfQKt.js +1 -0
  72. package/.output/public/assets/{rotate-cw-Clk5xTeE.js → rotate-cw-C1v7YuN7.js} +1 -1
  73. package/.output/public/assets/{routes-gQXSzO_n.js → routes-BTG3rg0l.js} +2 -2
  74. package/.output/public/assets/routes-CVbPjRKo.js +1 -0
  75. package/.output/public/assets/search-DiOSjaYL.js +1 -0
  76. package/.output/public/assets/select-CA8r-UUe.js +1 -0
  77. package/.output/public/assets/send-BgXZNiEA.js +1 -0
  78. package/.output/public/assets/{sidebar-Di9SN47G.js → sidebar-yC7KdImc.js} +1 -1
  79. package/.output/public/assets/smartphone-CxP0GGT6.js +1 -0
  80. package/.output/public/assets/styles-B0kzy3kp.css +2 -0
  81. package/.output/public/assets/switch-BTHWmKQ5.js +1 -0
  82. package/.output/public/assets/table-CwF7yxj4.js +1 -0
  83. package/.output/public/assets/tabs-CHNnCyvw.js +1 -0
  84. package/.output/public/assets/trash-2-CYISg7ZF.js +1 -0
  85. package/.output/public/assets/{undo-2-Bt0YXG26.js → undo-2-Bod3vw7x.js} +1 -1
  86. package/.output/public/assets/{useCompositeListItem-JmyDfo3-.js → useCompositeListItem-lAmUsXcc.js} +1 -1
  87. package/.output/public/assets/{useMutation-DbYw7boA.js → useMutation-w3qYaU2L.js} +1 -1
  88. package/.output/server/{__23tanstack-start-server-fn-resolver-z8rr63xV.mjs → __23tanstack-start-server-fn-resolver-BFiPs5uv.mjs} +85 -49
  89. package/.output/server/_libs/@base-ui/react+[...].mjs +1488 -183
  90. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  91. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +1 -1
  92. package/.output/server/_libs/_.mjs +1 -1
  93. package/.output/server/_libs/lucide-react.mjs +22 -2
  94. package/.output/server/_libs/next-themes.mjs +1 -1
  95. package/.output/server/_libs/react-redux+[...].mjs +1 -1
  96. package/.output/server/_libs/recharts+[...].mjs +1 -1
  97. package/.output/server/_libs/sonner.mjs +1 -1
  98. package/.output/server/_libs/tanstack__react-query.mjs +1 -1
  99. package/.output/server/_ssr/{-native-builds-search-M6t7EIt4.mjs → -native-builds-search-Mm_AZoRU.mjs} +8 -2
  100. package/.output/server/_ssr/{BundleIdDisplay-DRnAzJse.mjs → BundleIdDisplay-BSBR5eJ3.mjs} +3 -3
  101. package/.output/server/_ssr/{ConsoleFeatureUnavailable-BEU7r4aH.mjs → ConsoleFeatureUnavailable-DcZ4JBVq.mjs} +8 -8
  102. package/.output/server/_ssr/CopyableText-DgNEsByt.mjs +33 -0
  103. package/.output/server/_ssr/{EventDetails-CjT6o2sJ.mjs → EventDetails-CUHZuwei.mjs} +9 -9
  104. package/.output/server/_ssr/{HashValueDisplay-Bkim8r3-.mjs → HashValueDisplay-B9ORaCcP.mjs} +3 -3
  105. package/.output/server/_ssr/{InsightsPageHeader-Ctw4N3SZ.mjs → InsightsPageHeader-C0bJqC-n.mjs} +9 -9
  106. package/.output/server/_ssr/IosInstall-C5Y5gnDY.mjs +574 -0
  107. package/.output/server/_ssr/NativeBuildsNav-hFiyBaFW.mjs +38 -0
  108. package/.output/server/_ssr/{NotFoundPage-Bh3gFsR6.mjs → NotFoundPage-D4xRjmIA.mjs} +3 -3
  109. package/.output/server/_ssr/{PlatformIcon-CMLs3Wez.mjs → PlatformIcon-BpGOEXjU.mjs} +2 -2
  110. package/.output/server/_ssr/{RelativeTime-DjdCU0J7.mjs → RelativeTime-DnvxB666.mjs} +20 -9
  111. package/.output/server/_ssr/{RolloutPercentageBadge-BiIHw-V2.mjs → RolloutPercentageBadge-NBnIOzY9.mjs} +4 -4
  112. package/.output/server/_ssr/RowReason-B_jZN48d.mjs +169 -0
  113. package/.output/server/_ssr/{StoreSubmission-Cv59joPo.mjs → SandboxBadge-CFtTG1ZJ.mjs} +17 -17
  114. package/.output/server/_ssr/{TargetDisplay-D1PKOupt.mjs → TargetDisplay-0sb03v_6.mjs} +7 -33
  115. package/.output/server/_ssr/{alert-dialog-BOKQTpmP.mjs → alert-dialog-SLr1Q_AI.mjs} +2 -2
  116. package/.output/server/_ssr/{api-CDvGGB1B.mjs → api-CkgOQzSb.mjs} +74 -17
  117. package/.output/server/_ssr/{api-keys-DvbSgd9L.mjs → api-keys-BP7NJtoX.mjs} +2 -2
  118. package/.output/server/_ssr/{api-keys-NYJ0VaDB.mjs → api-keys-BcSzq0TA.mjs} +11 -11
  119. package/.output/server/_ssr/{api-keys-rpc-B0MrcD15.mjs → api-keys-rpc-IWPOq5vn.mjs} +3 -3
  120. package/.output/server/_ssr/{api-rpc-CIB9gcI7.mjs → api-rpc-cNJTB3v4.mjs} +48 -32
  121. package/.output/server/_ssr/{auth-rpc-DsIffEXe.mjs → auth-rpc-oaBbtxSP.mjs} +4 -4
  122. package/.output/server/_ssr/{auth.server-Dt9XHLs_.mjs → auth.server-WQw9JjMm.mjs} +587 -19
  123. package/.output/server/_ssr/{badge-KS3YftV5.mjs → badge-n3c0OTBQ.mjs} +2 -2
  124. package/.output/server/_ssr/{bundleActivity-BGVvqWx7.mjs → bundleActivity-BP40zYSt.mjs} +1 -1
  125. package/.output/server/_ssr/{card-CG5GqIoA.mjs → card-CYgCcRUd.mjs} +2 -2
  126. package/.output/server/_ssr/{config.server-CJs-9Zd_.mjs → config.server-R3KQbcML.mjs} +4 -4
  127. package/.output/server/_ssr/{console-access-ClmTMpo_.mjs → console-access-BLVi82IN.mjs} +2 -2
  128. package/.output/server/_ssr/{console-features-api-CpMYF0Pb.mjs → console-features-api-B2JvJOlE.mjs} +4 -4
  129. package/.output/server/_ssr/{console-features-rpc-D-dr-WF8.mjs → console-features-rpc-LAxQoSNw.mjs} +3 -3
  130. package/.output/server/_ssr/{console-features-CRP-pfov.mjs → console-features-xaGDhRC9.mjs} +1 -1
  131. package/.output/server/_ssr/deviceProfileToken-CwWb1lPq.mjs +82 -0
  132. package/.output/server/_ssr/{dialog-DvHMJkq7.mjs → dialog-eru_h5oK.mjs} +2 -2
  133. package/.output/server/_ssr/{downloadBundle-BX8ODCZT.mjs → downloadBundle-DnoYpi36.mjs} +1 -1
  134. package/.output/server/_ssr/{empty-Bx8DnyWN.mjs → empty-Bu4qodCx.mjs} +3 -3
  135. package/.output/server/_ssr/{failureReports-C_CmBF4x.mjs → failureReports-BA2eg11O.mjs} +3 -3
  136. package/.output/server/_ssr/{field-BVI4lxoz.mjs → field-DA5lwO5U.mjs} +3 -3
  137. package/.output/server/_ssr/foldedPage-CqpVk31Q.mjs +176 -0
  138. package/.output/server/_ssr/{getBundleChildren-BJTufthT.mjs → getBundleChildren-CdqFonhl.mjs} +1 -1
  139. package/.output/server/_ssr/{input-group-CpJwooTk.mjs → input-group-VV5E3q78.mjs} +2 -2
  140. package/.output/server/_ssr/{insights-b1hq1O0p.mjs → insights-BJIt1xuT.mjs} +2 -2
  141. package/.output/server/_ssr/{insights-B-VtObqr.mjs → insights-C23mopzv.mjs} +5 -5
  142. package/.output/server/_ssr/{insights-DxlHHXPK.mjs → insights-Ci82qdkq.mjs} +27 -27
  143. package/.output/server/_ssr/{insights-api-8PWQ7PiR.mjs → insights-api-BwXMKUSe.mjs} +5 -5
  144. package/.output/server/_ssr/{insights-errors-Bz3sWNZm.mjs → insights-errors-CXHg1lLV.mjs} +2 -2
  145. package/.output/server/_ssr/{insights-failures-DNQ9qVVf.mjs → insights-failures-7zH97WOO.mjs} +2 -2
  146. package/.output/server/_ssr/{insights-failures-rpc-pY2KV9HI.mjs → insights-failures-rpc-BuZ-jnby.mjs} +10 -10
  147. package/.output/server/_ssr/{insights-recovery-DOkpqnQ8.mjs → insights-recovery-BhOg6kz2.mjs} +1 -1
  148. package/.output/server/_ssr/{insights-recovery-rpc-CejmWL_y.mjs → insights-recovery-rpc-DrXSy9aA.mjs} +6 -6
  149. package/.output/server/_ssr/{insights-rpc-D_7d_AAJ.mjs → insights-rpc-DyrIZg3a.mjs} +3 -3
  150. package/.output/server/_ssr/{insights-search-CoMkZvRt.mjs → insights-search-CNkNB-aa.mjs} +3 -3
  151. package/.output/server/_ssr/{insights-usage-4KDIN3Kg.mjs → insights-usage-h8fipPTv.mjs} +1 -1
  152. package/.output/server/_ssr/{insights-usage-rpc-CrGZDHzO.mjs → insights-usage-rpc-C7UC1lom.mjs} +6 -6
  153. package/.output/server/_ssr/{insights-usage-rpc-B1XSuara.mjs → insights-usage-rpc-cTgmD-Ej.mjs} +5 -5
  154. package/.output/server/_ssr/{insightsUsage-DmQdJZqT.mjs → insightsUsage-BjSiV_X_.mjs} +3 -3
  155. package/.output/server/_ssr/{insights_.distribution-EOOOOTb6.mjs → insights_.distribution-BauOpBTE.mjs} +2 -2
  156. package/.output/server/_ssr/{insights_.distribution-CpqnDZNG.mjs → insights_.distribution-CIY_IGmh.mjs} +16 -16
  157. package/.output/server/_ssr/{insights_.distribution-B9sPDvG4.mjs → insights_.distribution-wfFKEv-Z.mjs} +5 -5
  158. package/.output/server/_ssr/{installations-BOI_y7Ma.mjs → installations-Ba3YVrAf.mjs} +13 -13
  159. package/.output/server/_ssr/{installations-dWlOOS7Y.mjs → installations-VzacOKHp.mjs} +2 -2
  160. package/.output/server/_ssr/{installations-D0_0hzdi.mjs → installations-jGW7nvEV.mjs} +4 -4
  161. package/.output/server/_ssr/ios-devices-rpc-Bhn7VVIh.mjs +138 -0
  162. package/.output/server/_ssr/iosDeviceProfile-_XT8TpgZ.mjs +176 -0
  163. package/.output/server/_ssr/iosDevices-Bc27J72d.mjs +129 -0
  164. package/.output/server/_ssr/listReleases-DYYA5alS.mjs +94 -0
  165. package/.output/server/_ssr/{native-builds-OUdRtp6m.mjs → native-builds-BXBkklfA.mjs} +28 -6
  166. package/.output/server/_ssr/{native-builds-Bx_az6YZ.mjs → native-builds-DZFJGcHy.mjs} +3 -3
  167. package/.output/server/_ssr/{native-builds-C721Rw23.mjs → native-builds-DiNkKHly.mjs} +221 -86
  168. package/.output/server/_ssr/{native-builds_._buildId-ubi48Sfs.mjs → native-builds_._buildId-CuM1PsT6.mjs} +108 -294
  169. package/.output/server/_ssr/{native-builds_._buildId-YItxv8j9.mjs → native-builds_._buildId-D0n4QZY6.mjs} +3 -3
  170. package/.output/server/_ssr/native-builds_.devices-D0JJlX8E.mjs +689 -0
  171. package/.output/server/_ssr/native-builds_.devices-DiM2FdcW.mjs +10 -0
  172. package/.output/server/_ssr/{nativeBuildDownloadLink-C0I8eLpS.mjs → nativeBuildDownloadLink-CvvWuhh0.mjs} +3 -3
  173. package/.output/server/_ssr/{nativeBuildInstall-CxG8K8TL.mjs → nativeBuildInstall-BqcVHBaD.mjs} +54 -7
  174. package/.output/server/_ssr/{nativeBuilds-CRLmvFaO.mjs → nativeBuilds-Cub0EUGN.mjs} +135 -13
  175. package/.output/server/_ssr/{publicConsoleBase-DvHYxDaG.mjs → publicConsoleBase-f67NLLXZ.mjs} +11 -3
  176. package/.output/server/_ssr/{release-adoption-C7sUFDwa.mjs → release-adoption-DeICczY7.mjs} +2 -2
  177. package/.output/server/_ssr/{release-adoption-rpc-DcZAYRWJ.mjs → release-adoption-rpc-Dm-5yAJG.mjs} +8 -8
  178. package/.output/server/_ssr/{releaseAdoption-D6ScSu-W.mjs → releaseAdoption-kHZo8P90.mjs} +3 -3
  179. package/.output/server/_ssr/{remote-config-gKqDKMxk.mjs → remote-config-D1BhIBKu.mjs} +3 -3
  180. package/.output/server/_ssr/{remote-config-DOcSXzxG.mjs → remote-config-D7RruPiO.mjs} +2 -2
  181. package/.output/server/_ssr/{remote-config-BZ_vGV97.mjs → remote-config-ZFm-l4Gi.mjs} +20 -20
  182. package/.output/server/_ssr/{remote-config-rpc-CVPd3V69.mjs → remote-config-rpc-C7AZy37o.mjs} +3 -3
  183. package/.output/server/_ssr/{router-Bcyej4cr.mjs → router-BGkGFMsT.mjs} +72 -75
  184. package/.output/server/_ssr/{routes-B10xsCh4.mjs → routes-CJJxz-Ak.mjs} +304 -230
  185. package/.output/server/_ssr/{routes-ddBRVSju.mjs → routes-CiJ2dhL9.mjs} +14 -13
  186. package/.output/server/_ssr/{runtime.server-wcHT2Cop.mjs → runtime.server-CkSbWaZm.mjs} +2 -2
  187. package/.output/server/_ssr/{schema-migration-rpc-iWZzLv70.mjs → schema-migration-rpc-D4YlwvGH.mjs} +3 -3
  188. package/.output/server/_ssr/{select-i4WT0c9r.mjs → select-BB8GE7OZ.mjs} +3 -3
  189. package/.output/server/_ssr/{server-CMgMPrDx.mjs → server-DAHTchcr.mjs} +5 -5
  190. package/.output/server/_ssr/{sidebar-mIQgB0iy.mjs → sidebar-CsKVgZHa.mjs} +3 -3
  191. package/.output/server/_ssr/ssr.mjs +1 -1
  192. package/.output/server/_ssr/{start-By4wHYjG.mjs → start-D3noqqOK.mjs} +1 -1
  193. package/.output/server/_ssr/{switch-DR8EAh5C.mjs → switch-BvvmP7Y3.mjs} +3 -3
  194. package/.output/server/_ssr/{table-DXmK6G7A.mjs → table-WKKzprFn.mjs} +2 -2
  195. package/.output/server/_ssr/{tabs-DAfypcYe.mjs → tabs-BJ-4SgmC.mjs} +4 -4
  196. package/.output/server/_ssr/{updateFailures-DNiv3S_y.mjs → updateFailures-D0bP_Ume.mjs} +3 -3
  197. package/.output/server/_tanstack-start-manifest_v-CSUJeG5D.mjs +219 -0
  198. package/.output/server/index.mjs +436 -366
  199. package/lib/index.d.mts +9 -0
  200. package/package.json +7 -30
  201. package/src/components/DataTable.tsx +21 -2
  202. package/src/components/FoldedRows.tsx +201 -0
  203. package/src/components/RowReason.tsx +56 -0
  204. package/src/components/features/native-builds/InstallCard.tsx +1 -1
  205. package/src/components/features/native-builds/IosDevicesPage.tsx +892 -0
  206. package/src/components/features/native-builds/IosInstall.tsx +292 -62
  207. package/src/components/features/native-builds/IpaDevicesCard.tsx +107 -0
  208. package/src/components/features/native-builds/NativeBuildDetailPage.tsx +7 -0
  209. package/src/components/features/native-builds/NativeBuildsNav.tsx +44 -0
  210. package/src/components/features/native-builds/NativeBuildsPage.tsx +2 -0
  211. package/src/components/features/native-builds/NativeBuildsTable.tsx +214 -30
  212. package/src/components/features/native-builds/OlderBuildLabel.tsx +61 -0
  213. package/src/index.ts +9 -0
  214. package/src/lib/api-rpc.ts +56 -29
  215. package/src/lib/api.ts +65 -2
  216. package/src/lib/ios-devices-api.ts +110 -0
  217. package/src/lib/ios-devices-rpc.ts +174 -0
  218. package/src/lib/native-builds.ts +72 -7
  219. package/src/lib/server/console-runtime.server.ts +9 -2
  220. package/src/lib/server/deviceProfileToken.ts +187 -0
  221. package/src/lib/server/foldedPage.ts +360 -0
  222. package/src/lib/server/iosDeviceProfile.ts +230 -0
  223. package/src/lib/server/iosDevices.ts +223 -0
  224. package/src/lib/server/listReleases.ts +101 -62
  225. package/src/lib/server/nativeBuildInstall.ts +138 -7
  226. package/src/lib/server/nativeBuilds.ts +221 -26
  227. package/src/routeTree.gen.ts +64 -67
  228. package/src/routes/-native-builds-search.ts +20 -0
  229. package/src/routes/[_]hot-updater/devices/device-response.ts +21 -0
  230. package/src/routes/[_]hot-updater/devices/device[.]mobileconfig.ts +17 -0
  231. package/src/routes/index.tsx +444 -299
  232. package/src/routes/native-builds_.devices.tsx +21 -0
  233. package/.output/public/assets/BundleIdDisplay-CP6rsdFO.js +0 -1
  234. package/.output/public/assets/RelativeTime-TCmpOVPg.js +0 -1
  235. package/.output/public/assets/StoreSubmission-CqSg880n.js +0 -1
  236. package/.output/public/assets/TargetDisplay-DwOaMOiI.js +0 -1
  237. package/.output/public/assets/api-LQJH44FU.js +0 -1
  238. package/.output/public/assets/api-keys-4w2-ofii.js +0 -1
  239. package/.output/public/assets/api-keys-uFY8FsN9.js +0 -1
  240. package/.output/public/assets/arrow-left-g9cKqXuC.js +0 -1
  241. package/.output/public/assets/arrow-right-CNII8TYn.js +0 -1
  242. package/.output/public/assets/arrow-up-right-DK8Zdg40.js +0 -1
  243. package/.output/public/assets/card-ulgg5xHn.js +0 -1
  244. package/.output/public/assets/check-CXVR3s3X.js +0 -1
  245. package/.output/public/assets/chevron-right-BoUXo82O.js +0 -1
  246. package/.output/public/assets/dialog-CLIaC82_.js +0 -1
  247. package/.output/public/assets/empty-Bhlj8PEo.js +0 -1
  248. package/.output/public/assets/field-q4sTYzNU.js +0 -1
  249. package/.output/public/assets/history-DakJoeSM.js +0 -1
  250. package/.output/public/assets/index-CJclLsbG.js +0 -10
  251. package/.output/public/assets/insights-0TUItqwh.js +0 -1
  252. package/.output/public/assets/insights-B75txQ_F.js +0 -42
  253. package/.output/public/assets/insights-C17Z0whn.js +0 -2
  254. package/.output/public/assets/insights-api-BVCXJsoV.js +0 -1
  255. package/.output/public/assets/insights-usage-rpc-BbFllvi_.js +0 -1
  256. package/.output/public/assets/insights_.distribution-AZcfvK7x.js +0 -1
  257. package/.output/public/assets/insights_.distribution-gDqNqI5E.js +0 -2
  258. package/.output/public/assets/installations-Ap2G2tDs.js +0 -1
  259. package/.output/public/assets/installations-D0g3xvw8.js +0 -2
  260. package/.output/public/assets/native-builds-Ba6cEZfm.js +0 -2
  261. package/.output/public/assets/native-builds-C3_-21we.js +0 -1
  262. package/.output/public/assets/native-builds_._buildId-BnP31v32.js +0 -1
  263. package/.output/public/assets/native-builds_._buildId-Cp9LJiMP.js +0 -2
  264. package/.output/public/assets/plus-BVhOauU3.js +0 -1
  265. package/.output/public/assets/preload-helper-B44EvKhG.js +0 -1
  266. package/.output/public/assets/remote-config-BRdy8QFR.js +0 -1
  267. package/.output/public/assets/remote-config-C9p5Pcdj.js +0 -6
  268. package/.output/public/assets/remote-config-CIAEArwq.js +0 -1
  269. package/.output/public/assets/routes-BLTF7nwe.js +0 -1
  270. package/.output/public/assets/search-nnvSOTEB.js +0 -1
  271. package/.output/public/assets/select-CBIU0_M1.js +0 -1
  272. package/.output/public/assets/smartphone-r0rRdPas.js +0 -1
  273. package/.output/public/assets/styles-BdlrKlVs.css +0 -2
  274. package/.output/public/assets/switch-CP6GsHmN.js +0 -1
  275. package/.output/public/assets/table-TUtVz-2l.js +0 -1
  276. package/.output/public/assets/tabs-CP3CSmtI.js +0 -1
  277. package/.output/public/assets/useInfiniteQuery-DX4WpBRG.js +0 -1
  278. package/.output/server/_ssr/listReleases-CQEceg8j.mjs +0 -79
  279. package/.output/server/_ssr/nativeBuildDevice-DJUAzAIj.mjs +0 -210
  280. package/.output/server/_tanstack-start-manifest_v-8M7ggCuB.mjs +0 -192
  281. package/src/lib/server/nativeBuildDevice.ts +0 -253
  282. package/src/routes/[_]hot-updater/native-builds/$buildId/device-response.ts +0 -17
  283. package/src/routes/[_]hot-updater/native-builds/$buildId/device.ts +0 -17
  284. package/src/routes/[_]hot-updater/native-builds/$buildId/device[.]mobileconfig.ts +0 -17
  285. /package/.output/public/assets/{uuidv7-cI6C63Fm.js → uuidv7-CVJ09bBG.js} +0 -0
  286. /package/.output/public/assets/{valueToPercent-B6X9rUJM.js → valueToPercent-Db73Kirz.js} +0 -0
@@ -0,0 +1,187 @@
1
+ import { sameSecret } from "./local-console";
2
+
3
+ /**
4
+ * Signed, short-lived tokens for an iPhone's profile flow, which runs where
5
+ * the Console's session isn't: Safari's profile download and the Settings app's
6
+ * answer carry no cookie. A token holds what it grants and its expiry, and the
7
+ * Console stores nothing.
8
+ *
9
+ * - The capability (`t`) lets the profile routes serve one profile and take
10
+ * one answer for a signed-in person: `register` saves the iPhone as
11
+ * requested, `identify` only tells the build page which iPhone it is.
12
+ * - The receipt (`r`) is what `identify` hands back: it names the UDID the
13
+ * profile read and whose session asked, so Request access takes the UDID
14
+ * from it, never from a link anyone can craft.
15
+ */
16
+
17
+ /** Separates these tokens' key from every other use of the Console's secret. */
18
+ const KEY_CONTEXT = "hot-updater/console/device-profile/v1";
19
+
20
+ /** How long a capability works: one profile install. */
21
+ export const DEVICE_PROFILE_TOKEN_TTL_MS = 15 * 60 * 1000;
22
+
23
+ /** How long a receipt works, from the profile's answer to Request access. */
24
+ export const DEVICE_RECEIPT_TTL_MS = 60 * 60 * 1000;
25
+
26
+ /** What a capability lets its bearer do. */
27
+ export interface DeviceProfileGrant {
28
+ readonly m: "register" | "identify";
29
+ /** The signed-in email that asked, lower-cased. */
30
+ readonly e: string;
31
+ /** The device name a `register` saves. */
32
+ readonly n?: string;
33
+ /** The build page an `identify` returns to. */
34
+ readonly b?: string;
35
+ }
36
+
37
+ /** What a receipt says: this UDID answered this person's profile. */
38
+ export interface DeviceReceipt {
39
+ readonly u: string;
40
+ readonly e: string;
41
+ }
42
+
43
+ type Signed<T> = T & { readonly p: string; readonly x: number };
44
+
45
+ const encoder = new TextEncoder();
46
+
47
+ const base64Url = (bytes: Uint8Array) =>
48
+ btoa(String.fromCharCode(...bytes))
49
+ .replaceAll("+", "-")
50
+ .replaceAll("/", "_")
51
+ .replaceAll("=", "");
52
+
53
+ const fromBase64Url = (text: string) =>
54
+ Uint8Array.from(
55
+ atob(text.replaceAll("-", "+").replaceAll("_", "/")),
56
+ (char) => char.charCodeAt(0),
57
+ );
58
+
59
+ const hmac = async (key: BufferSource, message: string) =>
60
+ new Uint8Array(
61
+ await crypto.subtle.sign(
62
+ "HMAC",
63
+ await crypto.subtle.importKey(
64
+ "raw",
65
+ key,
66
+ { name: "HMAC", hash: "SHA-256" },
67
+ false,
68
+ ["sign"],
69
+ ),
70
+ encoder.encode(message),
71
+ ),
72
+ );
73
+
74
+ const signatureOf = async (secret: string, body: string) =>
75
+ base64Url(await hmac(await hmac(encoder.encode(secret), KEY_CONTEXT), body));
76
+
77
+ const sign = async <T extends object>(
78
+ secret: string,
79
+ purpose: string,
80
+ payload: T,
81
+ expiresAtMs: number,
82
+ ): Promise<string> => {
83
+ const body = base64Url(
84
+ encoder.encode(
85
+ JSON.stringify({ ...payload, p: purpose, x: Math.floor(expiresAtMs) }),
86
+ ),
87
+ );
88
+ return `${body}.${await signatureOf(secret, body)}`;
89
+ };
90
+
91
+ const TOKEN = /^([A-Za-z0-9_-]{1,2048})\.([A-Za-z0-9_-]{43})$/u;
92
+
93
+ /**
94
+ * The payload of a token signed for `purpose`, `expired`, or `invalid`. The
95
+ * expiry counts only under a signature that holds.
96
+ */
97
+ const verify = async <T extends object>(
98
+ secret: string,
99
+ purpose: string,
100
+ token: string,
101
+ now: number,
102
+ ): Promise<Signed<T> | "expired" | "invalid"> => {
103
+ const match = TOKEN.exec(token);
104
+ if (match === null) return "invalid";
105
+ const [, body, signature] = match as unknown as [string, string, string];
106
+ if (!sameSecret(signature, await signatureOf(secret, body))) {
107
+ return "invalid";
108
+ }
109
+ let payload: unknown;
110
+ try {
111
+ payload = JSON.parse(new TextDecoder().decode(fromBase64Url(body)));
112
+ } catch {
113
+ return "invalid";
114
+ }
115
+ if (
116
+ typeof payload !== "object" ||
117
+ payload === null ||
118
+ (payload as { p?: unknown }).p !== purpose ||
119
+ typeof (payload as { x?: unknown }).x !== "number"
120
+ ) {
121
+ return "invalid";
122
+ }
123
+ return now >= (payload as { x: number }).x
124
+ ? "expired"
125
+ : (payload as Signed<T>);
126
+ };
127
+
128
+ const PROFILE_PURPOSE = "device-profile";
129
+ const RECEIPT_PURPOSE = "device-receipt";
130
+
131
+ export const createDeviceProfileToken = (
132
+ secret: string,
133
+ grant: DeviceProfileGrant,
134
+ now: number = Date.now(),
135
+ ) => sign(secret, PROFILE_PURPOSE, grant, now + DEVICE_PROFILE_TOKEN_TTL_MS);
136
+
137
+ export const verifyDeviceProfileToken = async (
138
+ secret: string,
139
+ token: string,
140
+ now: number = Date.now(),
141
+ ): Promise<DeviceProfileGrant | "expired" | "invalid"> => {
142
+ const verified = await verify<DeviceProfileGrant>(
143
+ secret,
144
+ PROFILE_PURPOSE,
145
+ token,
146
+ now,
147
+ );
148
+ if (typeof verified === "string") return verified;
149
+ if (
150
+ (verified.m !== "register" && verified.m !== "identify") ||
151
+ typeof verified.e !== "string" ||
152
+ (verified.n !== undefined && typeof verified.n !== "string") ||
153
+ (verified.b !== undefined && typeof verified.b !== "string")
154
+ ) {
155
+ return "invalid";
156
+ }
157
+ return {
158
+ m: verified.m,
159
+ e: verified.e,
160
+ ...(verified.n === undefined ? {} : { n: verified.n }),
161
+ ...(verified.b === undefined ? {} : { b: verified.b }),
162
+ };
163
+ };
164
+
165
+ export const createDeviceReceipt = (
166
+ secret: string,
167
+ receipt: DeviceReceipt,
168
+ now: number = Date.now(),
169
+ ) => sign(secret, RECEIPT_PURPOSE, receipt, now + DEVICE_RECEIPT_TTL_MS);
170
+
171
+ export const verifyDeviceReceipt = async (
172
+ secret: string,
173
+ token: string,
174
+ now: number = Date.now(),
175
+ ): Promise<DeviceReceipt | "expired" | "invalid"> => {
176
+ const verified = await verify<DeviceReceipt>(
177
+ secret,
178
+ RECEIPT_PURPOSE,
179
+ token,
180
+ now,
181
+ );
182
+ if (typeof verified === "string") return verified;
183
+ if (typeof verified.u !== "string" || typeof verified.e !== "string") {
184
+ return "invalid";
185
+ }
186
+ return { u: verified.u, e: verified.e };
187
+ };
@@ -0,0 +1,360 @@
1
+ /*
2
+ * A list page that counts only its ordinary rows, the ones a list leads with
3
+ * (a reachable bundle, the newest build of a distribution path), and folds
4
+ * every run of other rows between them into one entry: how many rows it
5
+ * holds and where they lie, never the rows themselves. A fold's rows load
6
+ * when someone opens it. Pages read ahead through the list's own index, up to
7
+ * a budget of rows, and keep no state: a page's cursor says where it starts
8
+ * and where the pages before it started, so Previous reads a page again
9
+ * exactly as Next read it.
10
+ */
11
+
12
+ /** How many ordinary rows one page shows. */
13
+ export const FOLDED_PAGE_SIZE = 20;
14
+
15
+ /** The most rows one page reads, the list's and any it reads to classify them. */
16
+ export const FOLDED_PAGE_READ_BUDGET = 200;
17
+
18
+ /** How many rows one read of the index takes. */
19
+ export const FOLDED_PAGE_CHUNK = 50;
20
+
21
+ /** The count a fold shows exactly; past it, "100+". */
22
+ export const FOLD_COUNT_CAP = 100;
23
+
24
+ /** How many earlier pages a cursor remembers, for Previous. */
25
+ export const FOLDED_PAGE_HISTORY = 20;
26
+
27
+ /**
28
+ * A run of folded rows between two ordinary ones: the IDs between `from`
29
+ * (the row above it, not in it; none at the top of the list) and `to` (its
30
+ * last row, in it), newest first.
31
+ */
32
+ export interface Fold {
33
+ readonly kind: "fold";
34
+ /** How many rows it holds, up to `FOLD_COUNT_CAP`. */
35
+ readonly count: number;
36
+ /** Whether it holds more than `count`: past the cap, or past the page. */
37
+ readonly more: boolean;
38
+ readonly from?: string;
39
+ readonly to: string;
40
+ }
41
+
42
+ export type FoldedEntry<T> = { readonly kind: "row"; readonly row: T } | Fold;
43
+
44
+ /**
45
+ * Where the previous page is: a `before` cursor (none: the newest page), or,
46
+ * when no cursor remembers it, the rows newer than `after`.
47
+ */
48
+ export type PreviousPage =
49
+ | { readonly before?: string }
50
+ | { readonly after: string };
51
+
52
+ export interface FoldedPage<T> {
53
+ /** Ordinary rows and folds, newest first. */
54
+ readonly entries: readonly FoldedEntry<T>[];
55
+ /** `before` of the next page, when there may be older rows. */
56
+ readonly next?: string;
57
+ /** The previous page, when there may be newer rows. */
58
+ readonly previous?: PreviousPage;
59
+ }
60
+
61
+ /** The rows a page may still read; reads and classification spend it. */
62
+ export interface ReadBudget {
63
+ left: number;
64
+ }
65
+
66
+ /**
67
+ * One read of the list's index: rows older (`desc`) or newer (`asc`) than
68
+ * `after`, up to `through`, which ends the read with that row.
69
+ */
70
+ export type ReadRows<T> = (input: {
71
+ readonly order: "asc" | "desc";
72
+ readonly after?: string;
73
+ readonly through?: string;
74
+ readonly limit: number;
75
+ }) => Promise<readonly T[]>;
76
+
77
+ /**
78
+ * Which rows of a chunk are ordinary: the list's own rule, with its own
79
+ * reads, which spend `budget` too. `newerThan` is the newest row of a
80
+ * page under a cursor: the rows above it are on earlier pages.
81
+ */
82
+ export type ClassifyRows<T> = (
83
+ rows: readonly T[],
84
+ context: {
85
+ readonly budget: ReadBudget;
86
+ /** The order `rows` came in: newest first, or oldest first. */
87
+ readonly order: "asc" | "desc";
88
+ readonly newerThan?: string;
89
+ },
90
+ ) => Promise<ReadonlySet<string>>;
91
+
92
+ /*
93
+ * A cursor: `s.` (it remembers every page back to the second) or `t.` (it
94
+ * forgot the oldest), then the IDs pages start under, this page's first. A
95
+ * bare ID, as an older link holds, remembers no page.
96
+ */
97
+ const SEPARATOR = ".";
98
+ const ID = /^[0-9A-Za-z-]+$/u;
99
+
100
+ interface Cursor {
101
+ /** The ID this page reads under. */
102
+ readonly id: string;
103
+ /** The IDs the pages before it read under, nearest first. */
104
+ readonly history: readonly string[];
105
+ /** Whether `history` reaches the second page. */
106
+ readonly complete: boolean;
107
+ }
108
+
109
+ const parseCursor = (token: string): Cursor => {
110
+ const [mark, ...ids] = token.split(SEPARATOR);
111
+ if ((mark === "s" || mark === "t") && ids.length > 0) {
112
+ if (!ids.every((id) => ID.test(id))) {
113
+ throw new Error("Invalid page cursor.");
114
+ }
115
+ return { id: ids[0]!, history: ids.slice(1), complete: mark === "s" };
116
+ }
117
+ if (!ID.test(token)) throw new Error("Invalid page cursor.");
118
+ return { id: token, history: [], complete: false };
119
+ };
120
+
121
+ const cursorToken = (ids: readonly string[], complete: boolean) => {
122
+ const kept = ids.slice(0, FOLDED_PAGE_HISTORY + 1);
123
+ return [complete && kept.length === ids.length ? "s" : "t", ...kept].join(
124
+ SEPARATOR,
125
+ );
126
+ };
127
+
128
+ interface Scanned<T> {
129
+ readonly row: T;
130
+ /** Whether it counts toward the page: an ordinary row. */
131
+ readonly ordinary: boolean;
132
+ /** Whether it shows as a row: an ordinary one, or the pinned one. */
133
+ readonly shown: boolean;
134
+ }
135
+
136
+ /**
137
+ * Reads from `after` in `order`, a chunk at a time, while the budget lasts,
138
+ * until it finds the ordinary row past `size` of them: the first of the page
139
+ * beyond, which is left out (`beyond`). `ended` when the index ran out.
140
+ */
141
+ async function scan<T extends { readonly id: string }>(
142
+ read: ReadRows<T>,
143
+ classify: ClassifyRows<T>,
144
+ order: "asc" | "desc",
145
+ after: string | undefined,
146
+ size: number,
147
+ budget: ReadBudget,
148
+ pinned: string | undefined,
149
+ ): Promise<{ rows: Scanned<T>[]; ended: boolean; beyond: boolean }> {
150
+ const rows: Scanned<T>[] = [];
151
+ let ordinary = 0;
152
+ let cursor = after;
153
+ // Rows newer than the page's first row are on earlier pages.
154
+ let pageTop: string | undefined;
155
+ while (budget.left > 0) {
156
+ const limit = Math.min(FOLDED_PAGE_CHUNK, budget.left);
157
+ const chunk = await read({
158
+ order,
159
+ limit,
160
+ ...(cursor === undefined ? {} : { after: cursor }),
161
+ });
162
+ budget.left -= chunk.length;
163
+ pageTop ??= chunk[0]?.id;
164
+ const ordinaryIds =
165
+ chunk.length === 0
166
+ ? new Set<string>()
167
+ : await classify(chunk, {
168
+ budget,
169
+ order,
170
+ ...(order === "desc" && after !== undefined && pageTop !== undefined
171
+ ? { newerThan: pageTop }
172
+ : {}),
173
+ });
174
+ for (const row of chunk) {
175
+ const isOrdinary = ordinaryIds.has(row.id);
176
+ if (isOrdinary && ordinary === size) {
177
+ return { rows, ended: false, beyond: true };
178
+ }
179
+ if (isOrdinary) ordinary += 1;
180
+ rows.push({
181
+ row,
182
+ ordinary: isOrdinary,
183
+ shown: isOrdinary || row.id === pinned,
184
+ });
185
+ }
186
+ if (chunk.length < limit) return { rows, ended: true, beyond: false };
187
+ cursor = chunk.at(-1)!.id;
188
+ }
189
+ return { rows, ended: false, beyond: false };
190
+ }
191
+
192
+ /**
193
+ * Rows newest first as entries: each run of folded rows one fold. `above`
194
+ * is the row over the first one; `topContinues` and `bottomContinues` say a
195
+ * run at either edge goes on past the page.
196
+ */
197
+ const entriesOf = <T extends { readonly id: string }>(
198
+ rows: readonly Scanned<T>[],
199
+ above: string | undefined,
200
+ { topContinues = false, bottomContinues = false } = {},
201
+ ): FoldedEntry<T>[] => {
202
+ const entries: FoldedEntry<T>[] = [];
203
+ let run: T[] = [];
204
+ let from = above;
205
+ const close = (continues: boolean) => {
206
+ if (run.length === 0) return;
207
+ entries.push({
208
+ kind: "fold",
209
+ count: Math.min(run.length, FOLD_COUNT_CAP),
210
+ more: run.length > FOLD_COUNT_CAP || continues,
211
+ ...(from === undefined ? {} : { from }),
212
+ to: run.at(-1)!.id,
213
+ });
214
+ run = [];
215
+ };
216
+ for (const { row, shown } of rows) {
217
+ if (shown) {
218
+ close(entries.length === 0 && topContinues);
219
+ entries.push({ kind: "row", row });
220
+ from = row.id;
221
+ } else {
222
+ run.push(row);
223
+ }
224
+ }
225
+ close(bottomContinues || (entries.length === 0 && topContinues));
226
+ return entries;
227
+ };
228
+
229
+ /**
230
+ * One page newest first. `before` is a cursor from `next` or `previous`;
231
+ * `after` reads the page above a row, when no cursor remembers it; neither
232
+ * is the newest page. A page holds `size` ordinary rows and the folds
233
+ * between them, and the run of folded rows under its last ordinary row, so
234
+ * the next page starts with an ordinary row. It reads at most `budget` rows:
235
+ * a page that runs out first ends in a fold that goes on, and the next page
236
+ * continues it.
237
+ */
238
+ export async function foldedPage<T extends { readonly id: string }>({
239
+ read,
240
+ classify,
241
+ before,
242
+ after,
243
+ pinned,
244
+ size = FOLDED_PAGE_SIZE,
245
+ budget = FOLDED_PAGE_READ_BUDGET,
246
+ }: {
247
+ readonly read: ReadRows<T>;
248
+ readonly classify: ClassifyRows<T>;
249
+ readonly before?: string;
250
+ readonly after?: string;
251
+ /**
252
+ * A row that shows wherever it sits, folded or not, such as the one a
253
+ * link selects: it splits its run, and counts toward no page, so it stays
254
+ * on the page whose run holds it.
255
+ */
256
+ readonly pinned?: string;
257
+ readonly size?: number;
258
+ readonly budget?: number;
259
+ }): Promise<FoldedPage<T>> {
260
+ const left: ReadBudget = { left: budget };
261
+ if (after === undefined) {
262
+ const cursor = before === undefined ? undefined : parseCursor(before);
263
+ const { rows, ended } = await scan(
264
+ read,
265
+ classify,
266
+ "desc",
267
+ cursor?.id,
268
+ size,
269
+ left,
270
+ pinned,
271
+ );
272
+ const last = rows.at(-1)?.row.id;
273
+ // Out of budget inside a run: the run goes on past this page.
274
+ const outOfBudget = !ended && left.left === 0;
275
+ const pages = cursor === undefined ? [] : [cursor.id, ...cursor.history];
276
+ const complete = cursor === undefined || cursor.complete;
277
+ const previous = (): PreviousPage | undefined => {
278
+ if (cursor === undefined) return undefined;
279
+ if (cursor.history.length > 0) {
280
+ return { before: cursorToken(cursor.history, cursor.complete) };
281
+ }
282
+ if (cursor.complete) return {};
283
+ return { after: rows[0]?.row.id ?? cursor.id };
284
+ };
285
+ const previousPage = previous();
286
+ return {
287
+ entries: entriesOf(rows, cursor?.id, { bottomContinues: outOfBudget }),
288
+ ...(!ended && last !== undefined
289
+ ? { next: cursorToken([last, ...pages], complete) }
290
+ : {}),
291
+ ...(previousPage === undefined ? {} : { previous: previousPage }),
292
+ };
293
+ }
294
+
295
+ // The page above `after`, read upward. The run just above `after` ends
296
+ // that page. A run above its top ordinary row belongs to the page above
297
+ // it when the next ordinary row up is in: the page above starts there. Out
298
+ // of budget, the last row read is kept as the edge, so the read stays in
299
+ // budget and the run over the page's top goes on past it.
300
+ const { rows, ended, beyond } = await scan(
301
+ read,
302
+ classify,
303
+ "asc",
304
+ after,
305
+ size,
306
+ left,
307
+ pinned,
308
+ );
309
+ let top = rows.length;
310
+ let above: string | undefined;
311
+ if (beyond) {
312
+ while (top > 0 && !rows[top - 1]!.ordinary) top -= 1;
313
+ above = rows[top]?.row.id;
314
+ } else if (!ended && rows.length > 0) {
315
+ top -= 1;
316
+ above = rows[top]!.row.id;
317
+ }
318
+ const page = rows.slice(0, top).reverse();
319
+ const first = page[0]?.row.id;
320
+ return {
321
+ entries: entriesOf(page, ended ? undefined : above, {
322
+ topContinues: !ended && !beyond,
323
+ }),
324
+ ...(page.length > 0
325
+ ? { next: cursorToken([page.at(-1)!.row.id], false) }
326
+ : {}),
327
+ ...(!ended && first !== undefined ? { previous: { after: first } } : {}),
328
+ };
329
+ }
330
+
331
+ /**
332
+ * One chunk of a fold's rows, newest first: the rows under `from` (or under
333
+ * `after`, the last row of the chunk before) down to `to`. `next` is the
334
+ * `after` of the next chunk, while the fold goes on.
335
+ */
336
+ export async function readFold<T extends { readonly id: string }>({
337
+ read,
338
+ from,
339
+ to,
340
+ after,
341
+ limit = FOLDED_PAGE_CHUNK,
342
+ }: {
343
+ readonly read: ReadRows<T>;
344
+ readonly from?: string;
345
+ readonly to: string;
346
+ readonly after?: string;
347
+ readonly limit?: number;
348
+ }): Promise<{ readonly rows: readonly T[]; readonly next?: string }> {
349
+ const cursor = after ?? from;
350
+ // The read ends at `to`, so it reads the fold's rows and no other.
351
+ const rows = await read({
352
+ order: "desc",
353
+ limit,
354
+ through: to,
355
+ ...(cursor === undefined ? {} : { after: cursor }),
356
+ });
357
+ const last = rows.at(-1)?.id;
358
+ const done = rows.length < limit || last === to;
359
+ return { rows, ...(done || last === undefined ? {} : { next: last }) };
360
+ }