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

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 (266) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/AnalyticsCapabilityContext-BCke57-7.js +1 -0
  3. package/.output/public/assets/BundleActivityChart-CnsBe_1J.js +42 -0
  4. package/.output/public/assets/BundleIdDisplay-Dky75zLU.js +1 -0
  5. package/.output/public/assets/alert-C-1KvDW8.js +1 -0
  6. package/.output/public/assets/analytics-Bqz0c-BT.js +1 -0
  7. package/.output/public/assets/analytics-api-CJdrTLLO.js +1 -0
  8. package/.output/public/assets/api-B_Rh-uzC.js +1 -0
  9. package/.output/public/assets/api-keys-BurCFhzH.js +1 -0
  10. package/.output/public/assets/api-keys-api-BEDJdQg3.js +1 -0
  11. package/.output/public/assets/badge-Bf0fZ-Gx.js +1 -0
  12. package/.output/public/assets/chart-no-axes-combined-FaYMGmQS.js +1 -0
  13. package/.output/public/assets/createServerFn-gM2-LFBy.js +3 -0
  14. package/.output/public/assets/dialog-BS60BRr2.js +1 -0
  15. package/.output/public/assets/dist-DspNKfMj.js +1 -0
  16. package/.output/public/assets/download-O-yNBc9H.js +1 -0
  17. package/.output/public/assets/field-Buq148-A.js +1 -0
  18. package/.output/public/assets/index-kFhd2S78.js +10 -0
  19. package/.output/public/assets/installations-BrQ-od41.js +2 -0
  20. package/.output/public/assets/installations-CGlZ3ROz.js +1 -0
  21. package/.output/public/assets/lazyRouteComponent-rPzgA7S-.js +1 -0
  22. package/.output/public/assets/loader-circle-DCYF-wJl.js +1 -0
  23. package/.output/public/assets/preload-helper-TKOBYGYD.js +1 -0
  24. package/.output/public/assets/refresh-cw-n8XYbPPj.js +1 -0
  25. package/.output/public/assets/routes-CrdokJ80.js +1 -0
  26. package/.output/public/assets/routes-DcQnVajO.js +2 -0
  27. package/.output/public/assets/search-DLhbWw3W.js +1 -0
  28. package/.output/public/assets/shield-check-DE_hVuHu.js +1 -0
  29. package/.output/public/assets/signing-HRexfjsH.js +1 -0
  30. package/.output/public/assets/styles-eB4EtvFS.css +2 -0
  31. package/.output/public/assets/table-D8CLieHX.js +1 -0
  32. package/.output/public/assets/textarea-YJLTVAoq.js +1 -0
  33. package/.output/public/assets/useMutation-JsGVjQMY.js +1 -0
  34. package/.output/public/assets/useOpenInteractionType-4cRD5xO0.js +1 -0
  35. package/.output/server/__23tanstack-start-server-fn-resolver-DBP9TQ7K.mjs +146 -0
  36. package/.output/server/_libs/@base-ui/react+[...].mjs +16124 -0
  37. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1554 -0
  38. package/.output/server/_libs/@tanstack/react-router+[...].mjs +41 -10
  39. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +132 -0
  40. package/.output/server/_libs/d3-array.mjs +231 -0
  41. package/.output/server/_libs/d3-color.mjs +330 -0
  42. package/.output/server/_libs/d3-format.mjs +252 -0
  43. package/.output/server/_libs/d3-interpolate.mjs +207 -0
  44. package/.output/server/_libs/d3-path.mjs +77 -0
  45. package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
  46. package/.output/server/_libs/d3-shape.mjs +818 -0
  47. package/.output/server/_libs/decimal.js-light.mjs +884 -0
  48. package/.output/server/_libs/es-toolkit.mjs +1134 -0
  49. package/.output/server/_libs/eventemitter3.mjs +236 -0
  50. package/.output/server/_libs/immer.mjs +532 -0
  51. package/.output/server/_libs/lucide-react.mjs +141 -13
  52. package/.output/server/_libs/next-themes.mjs +2 -2
  53. package/.output/server/_libs/react-redux+[...].mjs +205 -0
  54. package/.output/server/_libs/recharts+[...].mjs +14117 -0
  55. package/.output/server/_libs/sonner.mjs +2 -2
  56. package/.output/server/_libs/tanstack__query-core.mjs +114 -1
  57. package/.output/server/_libs/tanstack__react-query.mjs +3 -4
  58. package/.output/server/_runtime.mjs +10 -1
  59. package/.output/server/_ssr/AnalyticsCapabilityContext-ui4DX8GO.mjs +15 -0
  60. package/.output/server/_ssr/BundleActivityChart-BiB9ZORH.mjs +288 -0
  61. package/.output/server/_ssr/BundleIdDisplay-Czk6iR6p.mjs +13 -0
  62. package/.output/server/_ssr/alert-Dim3MGY5.mjs +86 -0
  63. package/.output/server/_ssr/analytics-DtMTn8fn.mjs +858 -0
  64. package/.output/server/_ssr/analytics-api-Cg1M5v_H.mjs +71 -0
  65. package/.output/server/_ssr/analytics-input-fRRRn0uA.mjs +96 -0
  66. package/.output/server/_ssr/analytics-rpc-DY5uXvHT.mjs +155 -0
  67. package/.output/server/_ssr/api-BTSv1tZb.mjs +282 -0
  68. package/.output/server/_ssr/api-keys-BnM_o2nS.mjs +300 -0
  69. package/.output/server/_ssr/api-keys-api-CIywsSF5.mjs +60 -0
  70. package/.output/server/_ssr/api-keys-rpc-BSp1wkIV.mjs +136 -0
  71. package/.output/server/_ssr/api-rpc-cG5wd_tO.mjs +1468 -0
  72. package/.output/server/_ssr/auth-BF8mbAgF.mjs +21 -0
  73. package/.output/server/_ssr/auth-rpc-BrJ6obHJ.mjs +24 -0
  74. package/.output/server/_ssr/auth.server-DwKoZoQM.mjs +50 -0
  75. package/.output/server/_ssr/badge-DCxbEeof.mjs +26 -0
  76. package/.output/server/_ssr/bundle-signing-rpc-COoQhW8E.mjs +16 -0
  77. package/.output/server/_ssr/bundle-signing.server-D5u8KkMp.mjs +51 -0
  78. package/.output/server/_ssr/config-Dv8qLDZ0.mjs +13 -0
  79. package/.output/server/_ssr/config.server-DEiLhKmy.mjs +361 -0
  80. package/.output/server/_ssr/{createServerFn-DzU0k62V.mjs → createServerFn-B2hcXoPM.mjs} +1 -1
  81. package/.output/server/_ssr/createServerRpc-DB29C_5p.mjs +12 -0
  82. package/.output/server/_ssr/{sidebar-Cv_H0_Jv.mjs → createSsrRpc-9P0S0lJ3.mjs} +68 -50
  83. package/.output/server/_ssr/databaseRows-CwbNwYSl.mjs +166 -0
  84. package/.output/server/_ssr/deleteBundle-Cu_XOMt0.mjs +66 -0
  85. package/.output/server/_ssr/dialog-CQuRMNZ4.mjs +170 -0
  86. package/.output/server/_ssr/dist-BVSLTpoP.mjs +250 -0
  87. package/.output/server/_ssr/downloadBundle-CNnYxYO2.mjs +24 -0
  88. package/.output/server/_ssr/{empty-plugin-adapters-B4HCzgmM.mjs → empty-plugin-adapters-B5QvGpEl.mjs} +1 -1
  89. package/.output/server/_ssr/field-DRIXKjZG.mjs +74 -0
  90. package/.output/server/_ssr/{getBundleChildren-CVtSiH5t.mjs → getBundleChildren-BcRMFoDF.mjs} +10 -18
  91. package/.output/server/_ssr/installations-B-azgAvX.mjs +19 -0
  92. package/.output/server/_ssr/installations-Ctvzp2JH.mjs +535 -0
  93. package/.output/server/_ssr/router-C-KUBfOi.mjs +513 -0
  94. package/.output/server/_ssr/routes-BM4ht9jb.mjs +2286 -0
  95. package/.output/server/_ssr/routes-Z7TwC6nC.mjs +37 -0
  96. package/.output/server/_ssr/runtime.server-awTLiiXW.mjs +527 -0
  97. package/.output/server/_ssr/server-BjzmvXnO.mjs +7468 -0
  98. package/.output/server/_ssr/signing-k8GxyBDF.mjs +202 -0
  99. package/.output/server/_ssr/ssr.mjs +4 -5740
  100. package/.output/server/_ssr/start-DpViQGnt.mjs +4 -0
  101. package/.output/server/_ssr/table-v1yCvYo7.mjs +53 -0
  102. package/.output/server/_ssr/textarea-DYHnskhb.mjs +14 -0
  103. package/.output/server/_ssr/uuidv7-BbJ-9D_I.mjs +31 -0
  104. package/.output/server/_tanstack-start-manifest_v-CH4StzJu.mjs +108 -0
  105. package/.output/server/index.mjs +256 -53
  106. package/README.md +29 -8
  107. package/lib/index.d.mts +36 -0
  108. package/lib/index.mjs +4 -0
  109. package/lib/vite-internal.mjs +127 -0
  110. package/lib/vite.d.mts +10 -0
  111. package/lib/vite.mjs +5 -0
  112. package/package.json +51 -29
  113. package/public/apple-touch-icon.png +0 -0
  114. package/public/favicon-16x16.png +0 -0
  115. package/public/favicon-32x32.png +0 -0
  116. package/public/favicon.ico +0 -0
  117. package/public/logo.svg +1 -0
  118. package/public/manifest.json +30 -0
  119. package/public/robots.txt +3 -0
  120. package/src/components/AppSidebar.tsx +159 -0
  121. package/src/components/BundleIdDisplay.tsx +18 -0
  122. package/src/components/ChannelBadge.tsx +31 -0
  123. package/src/components/ConsoleAccessPage.tsx +122 -0
  124. package/src/components/EnabledStatusIcon.tsx +54 -0
  125. package/src/components/HashValueDisplay.tsx +85 -0
  126. package/src/components/HotUpdaterLogo.tsx +30 -0
  127. package/src/components/NotFoundPage.tsx +33 -0
  128. package/src/components/PlatformIcon.tsx +39 -0
  129. package/src/components/RolloutPercentageBadge.tsx +28 -0
  130. package/src/components/ThemeProvider.tsx +116 -0
  131. package/src/components/TimestampDisplay.tsx +41 -0
  132. package/src/components/features/analytics/ActivityChart.tsx +150 -0
  133. package/src/components/features/analytics/AnalyticsCapabilityContext.tsx +24 -0
  134. package/src/components/features/analytics/AnalyticsControls.tsx +115 -0
  135. package/src/components/features/analytics/AnalyticsErrorAlert.tsx +21 -0
  136. package/src/components/features/analytics/AnalyticsOverview.tsx +208 -0
  137. package/src/components/features/analytics/BundleDistribution.tsx +133 -0
  138. package/src/components/features/analytics/BundleSelector.tsx +114 -0
  139. package/src/components/features/analytics/InstallationHistoryCard.tsx +248 -0
  140. package/src/components/features/analytics/InstallationMatchesCard.tsx +132 -0
  141. package/src/components/features/analytics/InstallationPageHeader.tsx +138 -0
  142. package/src/components/features/analytics/InstallationPagination.tsx +48 -0
  143. package/src/components/features/analytics/InstallationSearch.tsx +230 -0
  144. package/src/components/features/analytics/UpdateOutcomes.tsx +147 -0
  145. package/src/components/features/api-keys/ApiKeysPage.tsx +377 -0
  146. package/src/components/features/bundles/BundleActivityChart.tsx +193 -0
  147. package/src/components/features/bundles/BundleAnalyticsSummary.tsx +123 -0
  148. package/src/components/features/bundles/BundleChildrenPanel.tsx +201 -0
  149. package/src/components/features/bundles/BundleMetadata.tsx +136 -0
  150. package/src/components/features/bundles/RolloutCohortsDialog.tsx +201 -0
  151. package/src/components/features/channels/ChannelManagementDialog.tsx +228 -0
  152. package/src/components/features/releases/ReleaseEditorSheet.tsx +879 -0
  153. package/src/components/features/releases/ReleaseStateBadge.tsx +20 -0
  154. package/src/components/features/signing/BundleSigningPage.tsx +247 -0
  155. package/src/components/ui/alert-dialog.tsx +185 -0
  156. package/src/components/ui/alert.tsx +76 -0
  157. package/src/components/ui/badge.tsx +49 -0
  158. package/src/components/ui/button.tsx +58 -0
  159. package/src/components/ui/card.tsx +89 -0
  160. package/src/components/ui/chart.tsx +371 -0
  161. package/src/components/ui/combobox.tsx +303 -0
  162. package/src/components/ui/dialog.tsx +156 -0
  163. package/src/components/ui/dropdown-menu.tsx +270 -0
  164. package/src/components/ui/field.tsx +235 -0
  165. package/src/components/ui/input-group.tsx +147 -0
  166. package/src/components/ui/input.tsx +19 -0
  167. package/src/components/ui/label.tsx +25 -0
  168. package/src/components/ui/progress.tsx +84 -0
  169. package/src/components/ui/select.tsx +205 -0
  170. package/src/components/ui/separator.tsx +23 -0
  171. package/src/components/ui/sheet.tsx +132 -0
  172. package/src/components/ui/sidebar.tsx +779 -0
  173. package/src/components/ui/skeleton.tsx +13 -0
  174. package/src/components/ui/slider.tsx +56 -0
  175. package/src/components/ui/sonner.tsx +45 -0
  176. package/src/components/ui/switch.tsx +25 -0
  177. package/src/components/ui/table.tsx +114 -0
  178. package/src/components/ui/textarea.tsx +18 -0
  179. package/src/components/ui/toggle-group.tsx +89 -0
  180. package/src/components/ui/toggle.tsx +43 -0
  181. package/src/components/ui/tooltip.tsx +66 -0
  182. package/src/hooks/use-mobile.ts +30 -0
  183. package/src/index.ts +48 -0
  184. package/src/lib/analytics-api.ts +145 -0
  185. package/src/lib/analytics-error.ts +19 -0
  186. package/src/lib/analytics-input.ts +187 -0
  187. package/src/lib/analytics-overview.ts +170 -0
  188. package/src/lib/analytics-rpc.ts +218 -0
  189. package/src/lib/api-keys-api.ts +69 -0
  190. package/src/lib/api-keys-rpc.ts +87 -0
  191. package/src/lib/api-rpc.ts +478 -0
  192. package/src/lib/api.ts +444 -0
  193. package/src/lib/auth-rpc.ts +16 -0
  194. package/src/lib/bundle-signing-api.ts +14 -0
  195. package/src/lib/bundle-signing-rpc.ts +16 -0
  196. package/src/lib/constants.ts +1 -0
  197. package/src/lib/git.ts +51 -0
  198. package/src/lib/server/auth.server.ts +43 -0
  199. package/src/lib/server/bundle-signing.server.ts +100 -0
  200. package/src/lib/server/config.server.ts +109 -0
  201. package/src/lib/server/console-runtime.server.ts +70 -0
  202. package/src/lib/server/deleteBundle.ts +145 -0
  203. package/src/lib/server/downloadBundle.ts +46 -0
  204. package/src/lib/server/getBundleChildren.ts +130 -0
  205. package/src/lib/server/listReleases.ts +61 -0
  206. package/src/lib/server/releaseActivity.ts +27 -0
  207. package/src/lib/server/releaseReachability.ts +95 -0
  208. package/src/lib/server/runtime.server.ts +172 -0
  209. package/src/lib/utils.ts +9 -0
  210. package/src/logo.svg +1 -0
  211. package/src/routeTree.gen.ts +199 -0
  212. package/src/router.tsx +21 -0
  213. package/src/routes/-installations-search.ts +19 -0
  214. package/src/routes/-releases-search.ts +74 -0
  215. package/src/routes/__root.tsx +174 -0
  216. package/src/routes/analytics.tsx +139 -0
  217. package/src/routes/api/auth/$.ts +19 -0
  218. package/src/routes/api/bundles/$bundleId/download.ts +17 -0
  219. package/src/routes/api-keys.tsx +37 -0
  220. package/src/routes/index.tsx +982 -0
  221. package/src/routes/installations.tsx +194 -0
  222. package/src/routes/signing.tsx +37 -0
  223. package/src/styles.css +152 -0
  224. package/src/virtual-modules.d.ts +21 -0
  225. package/src/vite-env.d.ts +1 -0
  226. package/src/vite-internal.ts +195 -0
  227. package/src/vite.ts +12 -0
  228. package/.output/public/assets/dist-DJX53faP.js +0 -3
  229. package/.output/public/assets/index-Iylis5kY.js +0 -10
  230. package/.output/public/assets/routes-HT21hs0C.js +0 -54
  231. package/.output/public/assets/styles-C0Re4quB.css +0 -2
  232. package/.output/server/__23tanstack-start-server-fn-resolver-CgwgZ0-i.mjs +0 -66
  233. package/.output/server/_libs/@floating-ui/core+[...].mjs +0 -698
  234. package/.output/server/_libs/@floating-ui/dom+[...].mjs +0 -644
  235. package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +0 -839
  236. package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +0 -2138
  237. package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +0 -308
  238. package/.output/server/_libs/@radix-ui/react-select+[...].mjs +0 -1038
  239. package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +0 -196
  240. package/.output/server/_libs/@tanstack/form-core+[...].mjs +0 -3228
  241. package/.output/server/_libs/@tanstack/react-form+[...].mjs +0 -430
  242. package/.output/server/_libs/@tanstack/react-table+[...].mjs +0 -2382
  243. package/.output/server/_libs/radix-ui__number.mjs +0 -6
  244. package/.output/server/_libs/radix-ui__primitive.mjs +0 -9
  245. package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
  246. package/.output/server/_libs/radix-ui__react-collection.mjs +0 -78
  247. package/.output/server/_libs/radix-ui__react-direction.mjs +0 -13
  248. package/.output/server/_libs/radix-ui__react-label.mjs +0 -22
  249. package/.output/server/_libs/radix-ui__react-separator.mjs +0 -30
  250. package/.output/server/_libs/radix-ui__react-slider.mjs +0 -510
  251. package/.output/server/_libs/radix-ui__react-switch.mjs +0 -157
  252. package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -493
  253. package/.output/server/_ssr/api-rpc-BIbDUKSz.mjs +0 -292
  254. package/.output/server/_ssr/config.server-BSS366KT.mjs +0 -41
  255. package/.output/server/_ssr/deleteBundle-BgbZTtpW.mjs +0 -141
  256. package/.output/server/_ssr/dist-KboydRVk.mjs +0 -120
  257. package/.output/server/_ssr/router-C3hqEy3k.mjs +0 -307
  258. package/.output/server/_ssr/routes-B0lQvvlC.mjs +0 -3048
  259. package/.output/server/_ssr/start-02sLteYG.mjs +0 -4
  260. package/.output/server/_ssr/storageProfile-FVkjPoGb.mjs +0 -9
  261. package/.output/server/_tanstack-start-manifest_v-Bpx52WOU.mjs +0 -20
  262. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  263. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  264. package/.output/server/node_modules/tslib/package.json +0 -47
  265. package/.output/server/node_modules/tslib/tslib.js +0 -484
  266. package/.output/server/package.json +0 -9
@@ -1,292 +0,0 @@
1
- import { c as createServerFn, i as TSS_SERVER_FUNCTION } from "./createServerFn-DzU0k62V.mjs";
2
- import { n as isRuntimeStoragePlugin } from "./storageProfile-FVkjPoGb.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/api-rpc-BIbDUKSz.js
4
- var createServerRpc = (serverFnMeta, splitImportFn) => {
5
- const url = "/_serverFn/" + serverFnMeta.id;
6
- return Object.assign(splitImportFn, {
7
- url,
8
- serverFnMeta,
9
- [TSS_SERVER_FUNCTION]: true
10
- });
11
- };
12
- var assertRemoteDownloadUrl = (fileUrl) => {
13
- try {
14
- const protocol = new URL(fileUrl).protocol.replace(":", "");
15
- if (protocol === "http" || protocol === "https") return fileUrl;
16
- } catch {}
17
- throw new Error("Storage plugin returned a local file path; browser downloads require an HTTP(S) download URL.");
18
- };
19
- var getConfig_createServerFn_handler = createServerRpc({
20
- id: "51a34c05479a893c7d320bd4cd1604427289d667698c48b9f30a01aabf8a5e68",
21
- name: "getConfig",
22
- filename: "src/lib/api-rpc.ts"
23
- }, (opts) => getConfig.__executeServer(opts));
24
- var getConfig = createServerFn().handler(getConfig_createServerFn_handler, async () => {
25
- try {
26
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
27
- const { config } = await prepareConfig();
28
- return { console: config.console };
29
- } catch (error) {
30
- console.error("Error during config retrieval:", error);
31
- throw error;
32
- }
33
- });
34
- var getChannels_createServerFn_handler = createServerRpc({
35
- id: "79ada05964de8f2123bfcd62b10097d59bf8fd689ef5c7161031e5871d8396c5",
36
- name: "getChannels",
37
- filename: "src/lib/api-rpc.ts"
38
- }, (opts) => getChannels.__executeServer(opts));
39
- var getChannels = createServerFn().handler(getChannels_createServerFn_handler, async () => {
40
- try {
41
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
42
- const { databasePlugin } = await prepareConfig();
43
- return await databasePlugin.getChannels() ?? [];
44
- } catch (error) {
45
- console.error("Error during channel retrieval:", error);
46
- throw error;
47
- }
48
- });
49
- var getConfigLoaded_createServerFn_handler = createServerRpc({
50
- id: "f8bdca3d0579adb812d6404f55d9261a89cdb025e920b1fcad82883646a5fe9e",
51
- name: "getConfigLoaded",
52
- filename: "src/lib/api-rpc.ts"
53
- }, (opts) => getConfigLoaded.__executeServer(opts));
54
- var getConfigLoaded = createServerFn().handler(getConfigLoaded_createServerFn_handler, async () => {
55
- try {
56
- const { isConfigLoaded } = await import("./config.server-BSS366KT.mjs");
57
- return { configLoaded: isConfigLoaded() };
58
- } catch (error) {
59
- console.error("Error during config loaded retrieval:", error);
60
- throw error;
61
- }
62
- });
63
- var getBundles_createServerFn_handler = createServerRpc({
64
- id: "00ccacb4a0212c83ec29f4d11719046ad91ea8291cfc557d514dbf00d3bd7f5f",
65
- name: "getBundles",
66
- filename: "src/lib/api-rpc.ts"
67
- }, (opts) => getBundles.__executeServer(opts));
68
- var getBundles = createServerFn({ method: "GET" }).inputValidator((input) => input).handler(getBundles_createServerFn_handler, async ({ data }) => {
69
- try {
70
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
71
- const query = {
72
- channel: data?.channel ?? void 0,
73
- platform: data?.platform ?? void 0,
74
- targetAppVersion: data?.targetAppVersion ?? void 0,
75
- page: typeof data?.page === "number" && Number.isInteger(data.page) && data.page > 1 ? data.page : void 0,
76
- limit: data?.limit ? Number(data.limit) : 20,
77
- after: data?.after ?? void 0,
78
- before: data?.before ?? void 0
79
- };
80
- const { databasePlugin } = await prepareConfig();
81
- const bundleQueryOptions = {
82
- where: {
83
- channel: query.channel,
84
- platform: query.platform,
85
- targetAppVersion: query.targetAppVersion
86
- },
87
- limit: query.limit,
88
- page: query.page,
89
- cursor: query.after || query.before ? {
90
- after: query.after,
91
- before: query.before
92
- } : void 0
93
- };
94
- return await databasePlugin.getBundles(bundleQueryOptions) ?? {
95
- data: [],
96
- pagination: {
97
- total: 0,
98
- hasNextPage: false,
99
- hasPreviousPage: false,
100
- currentPage: 1,
101
- totalPages: 0
102
- }
103
- };
104
- } catch (error) {
105
- console.error("Error during bundle retrieval:", error);
106
- throw error;
107
- }
108
- });
109
- var getBundle_createServerFn_handler = createServerRpc({
110
- id: "1bd85c2a50e24785cb6abb023a247a9f048f37ddfa85cbb1c57e579563bad013",
111
- name: "getBundle",
112
- filename: "src/lib/api-rpc.ts"
113
- }, (opts) => getBundle.__executeServer(opts));
114
- var getBundle = createServerFn({ method: "GET" }).inputValidator((input) => input).handler(getBundle_createServerFn_handler, async ({ data }) => {
115
- try {
116
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
117
- const { databasePlugin } = await prepareConfig();
118
- return await databasePlugin.getBundleById(data.bundleId) ?? null;
119
- } catch (error) {
120
- console.error("Error during bundle retrieval:", error);
121
- throw error;
122
- }
123
- });
124
- var getBundleChildren_createServerFn_handler = createServerRpc({
125
- id: "4370f1bf70b91f1168d85379d3008449a1bedb915e9878ca4ef89d5f3a80fa7f",
126
- name: "getBundleChildren",
127
- filename: "src/lib/api-rpc.ts"
128
- }, (opts) => getBundleChildren.__executeServer(opts));
129
- var getBundleChildren = createServerFn({ method: "GET" }).inputValidator((input) => input).handler(getBundleChildren_createServerFn_handler, async ({ data }) => {
130
- try {
131
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
132
- const { getBundleChildren: getBundleChildrenWithConfig } = await import("./getBundleChildren-CVtSiH5t.mjs");
133
- const { databasePlugin } = await prepareConfig();
134
- return await getBundleChildrenWithConfig(data, { databasePlugin });
135
- } catch (error) {
136
- console.error("Error during bundle children retrieval:", error);
137
- throw error;
138
- }
139
- });
140
- var getBundleChildCounts_createServerFn_handler = createServerRpc({
141
- id: "4ca367070b00f58179a572f0bb8196a4ccdd3881e9b1dbfe33deee0cb6e1f549",
142
- name: "getBundleChildCounts",
143
- filename: "src/lib/api-rpc.ts"
144
- }, (opts) => getBundleChildCounts.__executeServer(opts));
145
- var getBundleChildCounts = createServerFn({ method: "GET" }).inputValidator((input) => input).handler(getBundleChildCounts_createServerFn_handler, async ({ data }) => {
146
- try {
147
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
148
- const { getBundleChildCounts: getBundleChildCountsWithConfig } = await import("./getBundleChildren-CVtSiH5t.mjs");
149
- const { databasePlugin } = await prepareConfig();
150
- return await getBundleChildCountsWithConfig(data.bundleIds, { databasePlugin });
151
- } catch (error) {
152
- console.error("Error during bundle child count retrieval:", error);
153
- throw error;
154
- }
155
- });
156
- var getBundleDownloadUrl_createServerFn_handler = createServerRpc({
157
- id: "e000081a14772a0496dfdf615232fbbb1a23b89191d0e32f89a05dd67a1916f7",
158
- name: "getBundleDownloadUrl",
159
- filename: "src/lib/api-rpc.ts"
160
- }, (opts) => getBundleDownloadUrl.__executeServer(opts));
161
- var getBundleDownloadUrl = createServerFn({ method: "GET" }).inputValidator((input) => input).handler(getBundleDownloadUrl_createServerFn_handler, async ({ data }) => {
162
- try {
163
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
164
- const { databasePlugin, storagePlugin } = await prepareConfig();
165
- const bundle = await databasePlugin.getBundleById(data.bundleId);
166
- if (!bundle) throw new Error("Bundle not found");
167
- const { storageUri } = bundle;
168
- if (!storageUri) throw new Error("Bundle has no storage URI");
169
- const protocol = new URL(storageUri).protocol.replace(":", "");
170
- if (protocol === "http" || protocol === "https") return { fileUrl: storageUri };
171
- if (!storagePlugin) throw new Error("Storage plugin is not configured");
172
- if (storagePlugin.supportedProtocol !== protocol) throw new Error(`No storage plugin for protocol: ${protocol}`);
173
- if (!isRuntimeStoragePlugin(storagePlugin)) throw new Error(`${storagePlugin.name} does not support runtime download URL resolution.`);
174
- const { fileUrl } = await storagePlugin.profiles.runtime.getDownloadUrl(storageUri);
175
- if (!fileUrl) throw new Error("Storage plugin returned empty fileUrl");
176
- return { fileUrl: assertRemoteDownloadUrl(fileUrl) };
177
- } catch (error) {
178
- console.error("Error during bundle download URL retrieval:", error);
179
- throw error;
180
- }
181
- });
182
- var updateBundle_createServerFn_handler = createServerRpc({
183
- id: "67f90ce4cd10fd0226cd9d77cdcd8d0f25a59a6ac406360b655e44296bc4208b",
184
- name: "updateBundle",
185
- filename: "src/lib/api-rpc.ts"
186
- }, (opts) => updateBundle.__executeServer(opts));
187
- var updateBundle = createServerFn({ method: "POST" }).inputValidator((input) => input).handler(updateBundle_createServerFn_handler, async ({ data }) => {
188
- try {
189
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
190
- const { databasePlugin } = await prepareConfig();
191
- await databasePlugin.updateBundle(data.bundleId, data.bundle);
192
- await databasePlugin.commitBundle();
193
- const updatedBundle = await databasePlugin.getBundleById(data.bundleId);
194
- if (!updatedBundle) throw new Error("Updated bundle not found");
195
- return {
196
- success: true,
197
- bundle: updatedBundle
198
- };
199
- } catch (error) {
200
- console.error("Error during bundle update:", error);
201
- throw error;
202
- }
203
- });
204
- var promoteBundle_createServerFn_handler = createServerRpc({
205
- id: "c4ef3bbb77ea8a4410623fd18a4741e2ff0668b1a97510bcdd032a8428eaa5da",
206
- name: "promoteBundle",
207
- filename: "src/lib/api-rpc.ts"
208
- }, (opts) => promoteBundle.__executeServer(opts));
209
- var promoteBundle = createServerFn({ method: "POST" }).inputValidator((input) => input).handler(promoteBundle_createServerFn_handler, async ({ data }) => {
210
- try {
211
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
212
- const { promoteBundle: promoteBundleWithConfig } = await import("@hot-updater/cli-tools");
213
- const { config, databasePlugin, storagePlugin } = await prepareConfig();
214
- return {
215
- success: true,
216
- bundle: await promoteBundleWithConfig(data, {
217
- config,
218
- databasePlugin,
219
- storagePlugin
220
- })
221
- };
222
- } catch (error) {
223
- console.error("Error during bundle promotion:", error);
224
- throw error;
225
- }
226
- });
227
- var createBundle_createServerFn_handler = createServerRpc({
228
- id: "16cc7c2f080ea5b73e0c6bba815b110dbd7727796036d248ba0d8ae819ddef08",
229
- name: "createBundle",
230
- filename: "src/lib/api-rpc.ts"
231
- }, (opts) => createBundle.__executeServer(opts));
232
- var createBundle = createServerFn({ method: "POST" }).inputValidator((input) => input).handler(createBundle_createServerFn_handler, async ({ data }) => {
233
- try {
234
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
235
- const { databasePlugin } = await prepareConfig();
236
- await databasePlugin.appendBundle(data);
237
- await databasePlugin.commitBundle();
238
- return {
239
- success: true,
240
- bundleId: data.id
241
- };
242
- } catch (error) {
243
- console.error("Error during bundle creation:", error);
244
- throw error;
245
- }
246
- });
247
- var deleteBundle_createServerFn_handler = createServerRpc({
248
- id: "3a27ff5679228b86a346b3fe42142e7a5bf0264f73173c0dbe5f07fb37c43cf7",
249
- name: "deleteBundle",
250
- filename: "src/lib/api-rpc.ts"
251
- }, (opts) => deleteBundle.__executeServer(opts));
252
- var deleteBundle = createServerFn({ method: "POST" }).inputValidator((input) => input).handler(deleteBundle_createServerFn_handler, async ({ data }) => {
253
- try {
254
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
255
- const { deleteBundle: deleteBundleWithStorage } = await import("./deleteBundle-BgbZTtpW.mjs");
256
- const { databasePlugin, storagePlugin } = await prepareConfig();
257
- await deleteBundleWithStorage(data, {
258
- databasePlugin,
259
- storagePlugin,
260
- waitForStorageCleanup: false
261
- });
262
- return { success: true };
263
- } catch (error) {
264
- console.error("Error during bundle deletion:", error);
265
- throw error;
266
- }
267
- });
268
- var deleteBundles_createServerFn_handler = createServerRpc({
269
- id: "61de3b69779c5ce2a5f5d3c27e2cfaca8fba8f14c8803559b9cd733c456494fa",
270
- name: "deleteBundles",
271
- filename: "src/lib/api-rpc.ts"
272
- }, (opts) => deleteBundles.__executeServer(opts));
273
- var deleteBundles = createServerFn({ method: "POST" }).inputValidator((input) => input).handler(deleteBundles_createServerFn_handler, async ({ data }) => {
274
- try {
275
- const { prepareConfig } = await import("./config.server-BSS366KT.mjs");
276
- const { deleteBundles: deleteBundlesWithStorage } = await import("./deleteBundle-BgbZTtpW.mjs");
277
- const { databasePlugin, storagePlugin } = await prepareConfig();
278
- return {
279
- success: true,
280
- ...await deleteBundlesWithStorage(data, {
281
- databasePlugin,
282
- storagePlugin,
283
- waitForStorageCleanup: false
284
- })
285
- };
286
- } catch (error) {
287
- console.error("Error during bundle deletion:", error);
288
- throw error;
289
- }
290
- });
291
- //#endregion
292
- export { createBundle_createServerFn_handler, deleteBundle_createServerFn_handler, deleteBundles_createServerFn_handler, getBundleChildCounts_createServerFn_handler, getBundleChildren_createServerFn_handler, getBundleDownloadUrl_createServerFn_handler, getBundle_createServerFn_handler, getBundles_createServerFn_handler, getChannels_createServerFn_handler, getConfigLoaded_createServerFn_handler, getConfig_createServerFn_handler, promoteBundle_createServerFn_handler, updateBundle_createServerFn_handler };
@@ -1,41 +0,0 @@
1
- import { t as assertNodeStoragePlugin } from "./storageProfile-FVkjPoGb.mjs";
2
- import { loadConfig } from "@hot-updater/cli-tools";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/config.server-BSS366KT.js
4
- var configPromise = null;
5
- var storagePluginPromise = null;
6
- var loadCachedConfig = async () => {
7
- if (!configPromise) configPromise = loadConfig(null).catch((error) => {
8
- configPromise = null;
9
- throw error;
10
- });
11
- return configPromise;
12
- };
13
- var loadCachedStoragePlugin = async (config) => {
14
- if (!storagePluginPromise) storagePluginPromise = Promise.resolve(config.storage()).then((storagePlugin) => {
15
- if (!storagePlugin) throw new Error("Storage plugin initialization failed");
16
- assertNodeStoragePlugin(storagePlugin);
17
- return storagePlugin;
18
- }).catch((error) => {
19
- storagePluginPromise = null;
20
- throw error;
21
- });
22
- return storagePluginPromise;
23
- };
24
- var prepareConfig = async () => {
25
- try {
26
- const config = await loadCachedConfig();
27
- const [databasePlugin, storagePlugin] = await Promise.all([config.database(), loadCachedStoragePlugin(config)]);
28
- if (!databasePlugin) throw new Error("Database plugin initialization failed");
29
- return {
30
- config,
31
- databasePlugin,
32
- storagePlugin
33
- };
34
- } catch (error) {
35
- console.error("Error during configuration initialization:", error);
36
- throw error;
37
- }
38
- };
39
- var isConfigLoaded = () => Boolean(configPromise);
40
- //#endregion
41
- export { isConfigLoaded, prepareConfig };
@@ -1,141 +0,0 @@
1
- import { a as getManifestStorageUri, i as getBundlePatches, r as getAssetBaseStorageUri, u as getPatchStorageUri } from "./dist-KboydRVk.mjs";
2
- import { randomUUID } from "node:crypto";
3
- import path from "node:path";
4
- import fs from "node:fs/promises";
5
- //#region node_modules/.nitro/vite/services/ssr/assets/deleteBundle-BgbZTtpW.js
6
- var createStorageUriWithRelativePath = ({ baseStorageUri, relativePath }) => {
7
- const storageUrl = new URL(baseStorageUri);
8
- storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
9
- return storageUrl.toString();
10
- };
11
- var getAssetStorageLayout = (assetBaseStorageUri) => {
12
- const pathname = new URL(assetBaseStorageUri).pathname.replace(/\/+$/, "");
13
- return pathname.endsWith("/assets") || pathname === "/assets" ? "content-addressed" : "legacy-files";
14
- };
15
- var isContentAddressedAssetBaseStorageUri = (assetBaseStorageUri) => getAssetStorageLayout(assetBaseStorageUri) === "content-addressed";
16
- /**
17
- * LEGACY: older /files bundles own a per-bundle asset directory.
18
- * Remove this file and the deleteBundle branch that calls it when legacy
19
- * storage layouts are no longer supported.
20
- */
21
- function getLegacyBundleAssetCleanupUris({ assetBaseStorageUri, manifest }) {
22
- return Object.keys(manifest.assets ?? {}).sort((a, b) => a.localeCompare(b)).map((assetPath) => createStorageUriWithRelativePath({
23
- baseStorageUri: assetBaseStorageUri,
24
- relativePath: assetPath
25
- }));
26
- }
27
- var HOT_UPDATER_DOWNLOAD_DIR_PREFIX = "downloads-";
28
- function resolveStorageUriForDeletion(storageUri, storagePlugin) {
29
- const protocol = new URL(storageUri).protocol.replace(":", "");
30
- if (protocol === "http" || protocol === "https") return null;
31
- if (storagePlugin.supportedProtocol !== protocol) throw new Error(`No storage plugin for protocol: ${protocol}`);
32
- return storageUri;
33
- }
34
- async function downloadStorageBytes(storageUri, storagePlugin) {
35
- const protocol = new URL(storageUri).protocol.replace(":", "");
36
- if (protocol === "http" || protocol === "https") {
37
- const response = await fetch(storageUri);
38
- if (!response.ok) throw new Error(`Failed to download bundle manifest: ${response.statusText}`);
39
- return new Uint8Array(await response.arrayBuffer());
40
- }
41
- if (storagePlugin.supportedProtocol !== protocol) throw new Error(`No storage plugin for protocol: ${protocol}`);
42
- const downloadRoot = path.join(process.cwd(), ".hot-updater");
43
- await fs.mkdir(downloadRoot, { recursive: true });
44
- const workDir = await fs.mkdtemp(path.join(downloadRoot, HOT_UPDATER_DOWNLOAD_DIR_PREFIX));
45
- const filename = path.basename(new URL(storageUri).pathname) || randomUUID();
46
- const filePath = path.join(workDir, filename);
47
- try {
48
- await storagePlugin.profiles.node.downloadFile(storageUri, filePath);
49
- return new Uint8Array(await fs.readFile(filePath));
50
- } finally {
51
- await fs.rm(workDir, {
52
- force: true,
53
- recursive: true
54
- });
55
- }
56
- }
57
- async function loadBundleManifest(manifestStorageUri, storagePlugin) {
58
- const manifestBytes = await downloadStorageBytes(manifestStorageUri, storagePlugin);
59
- return JSON.parse(new TextDecoder().decode(manifestBytes));
60
- }
61
- async function cleanupBundleStorage(bundle, storagePlugin) {
62
- const cleanupUris = /* @__PURE__ */ new Set();
63
- const addCleanupUri = (storageUri) => {
64
- if (!storageUri) return;
65
- const resolvedStorageUri = resolveStorageUriForDeletion(storageUri, storagePlugin);
66
- if (resolvedStorageUri) cleanupUris.add(resolvedStorageUri);
67
- };
68
- addCleanupUri(bundle.storageUri);
69
- addCleanupUri(getManifestStorageUri(bundle) ?? void 0);
70
- addCleanupUri(getPatchStorageUri(bundle) ?? void 0);
71
- for (const patch of getBundlePatches(bundle)) addCleanupUri(patch.patchStorageUri);
72
- const manifestStorageUri = getManifestStorageUri(bundle);
73
- const assetBaseStorageUri = getAssetBaseStorageUri(bundle);
74
- if (assetBaseStorageUri) if (!manifestStorageUri) {
75
- if (!isContentAddressedAssetBaseStorageUri(assetBaseStorageUri)) addCleanupUri(assetBaseStorageUri);
76
- } else if (isContentAddressedAssetBaseStorageUri(assetBaseStorageUri)) {} else try {
77
- const manifest = await loadBundleManifest(manifestStorageUri, storagePlugin);
78
- for (const storageUri of getLegacyBundleAssetCleanupUris({
79
- assetBaseStorageUri,
80
- manifest
81
- })) addCleanupUri(storageUri);
82
- } catch (error) {
83
- console.error("Failed to load bundle manifest for storage cleanup:", error);
84
- if (!isContentAddressedAssetBaseStorageUri(assetBaseStorageUri)) addCleanupUri(assetBaseStorageUri);
85
- }
86
- if (cleanupUris.size === 0) return;
87
- for (const storageUri of cleanupUris) try {
88
- await storagePlugin.profiles.node.delete(storageUri);
89
- } catch (error) {
90
- console.error("Failed to delete bundle from storage:", error);
91
- }
92
- }
93
- async function deleteBundles({ bundleIds }, { databasePlugin, storagePlugin, waitForStorageCleanup = true }) {
94
- const uniqueBundleIds = [...new Set(bundleIds)];
95
- const { data: matchedBundles } = await databasePlugin.getBundles({
96
- where: { id: { in: uniqueBundleIds } },
97
- limit: uniqueBundleIds.length
98
- });
99
- const matchedById = new Map(matchedBundles.map((bundle) => [bundle.id, bundle]));
100
- const bundles = uniqueBundleIds.flatMap((bundleId) => {
101
- const bundle = matchedById.get(bundleId);
102
- return bundle ? [bundle] : [];
103
- });
104
- const missingBundleIds = uniqueBundleIds.filter((bundleId) => !matchedById.has(bundleId));
105
- for (const bundle of bundles) {
106
- const cleanupCandidates = [
107
- bundle.storageUri,
108
- getManifestStorageUri(bundle),
109
- getAssetBaseStorageUri(bundle),
110
- getPatchStorageUri(bundle),
111
- ...getBundlePatches(bundle).map((patch) => patch.patchStorageUri)
112
- ].filter((value) => Boolean(value));
113
- for (const candidate of cleanupCandidates) resolveStorageUriForDeletion(candidate, storagePlugin);
114
- }
115
- if (bundles.length > 0) {
116
- for (const bundle of bundles) await databasePlugin.deleteBundle(bundle);
117
- await databasePlugin.commitBundle();
118
- }
119
- const cleanupStorage = async () => {
120
- for (const bundle of bundles) await cleanupBundleStorage(bundle, storagePlugin);
121
- };
122
- if (waitForStorageCleanup) {
123
- await cleanupStorage();
124
- return {
125
- deletedBundleIds: bundles.map((bundle) => bundle.id),
126
- missingBundleIds
127
- };
128
- }
129
- cleanupStorage().catch((error) => {
130
- console.error("Failed to clean up bundle storage:", error);
131
- });
132
- return {
133
- deletedBundleIds: bundles.map((bundle) => bundle.id),
134
- missingBundleIds
135
- };
136
- }
137
- async function deleteBundle({ bundleId }, dependencies) {
138
- if ((await deleteBundles({ bundleIds: [bundleId] }, dependencies)).missingBundleIds.length > 0) throw new Error(`Bundle not found: ${bundleId}`);
139
- }
140
- //#endregion
141
- export { deleteBundle, deleteBundles };
@@ -1,120 +0,0 @@
1
- //#region node_modules/.nitro/vite/services/ssr/assets/dist-KboydRVk.js
2
- var getManifestStorageUri = (bundle) => bundle.manifestStorageUri ?? null;
3
- var getAssetBaseStorageUri = (bundle) => bundle.assetBaseStorageUri ?? null;
4
- var isBundlePatchArtifact = (value) => {
5
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
6
- const candidate = value;
7
- return typeof candidate.baseBundleId === "string" && typeof candidate.baseFileHash === "string" && typeof candidate.patchFileHash === "string" && typeof candidate.patchStorageUri === "string";
8
- };
9
- var readBundlePatchArray = (patches) => {
10
- if (!Array.isArray(patches)) return [];
11
- return patches.filter(isBundlePatchArtifact);
12
- };
13
- var getBundlePatches = (bundle) => {
14
- const patches = readBundlePatchArray(bundle.patches);
15
- const seenBaseBundleIds = /* @__PURE__ */ new Set();
16
- return patches.filter((patch) => {
17
- if (seenBaseBundleIds.has(patch.baseBundleId)) return false;
18
- seenBaseBundleIds.add(patch.baseBundleId);
19
- return true;
20
- });
21
- };
22
- var getPrimaryPatch = (bundle) => {
23
- return getBundlePatches(bundle)[0] ?? null;
24
- };
25
- var getPatchBaseBundleId = (bundle) => bundle.patchBaseBundleId ?? getPrimaryPatch(bundle)?.baseBundleId ?? null;
26
- var getPatchBaseFileHash = (bundle) => bundle.patchBaseFileHash ?? getPrimaryPatch(bundle)?.baseFileHash ?? null;
27
- var getPatchFileHash = (bundle) => bundle.patchFileHash ?? getPrimaryPatch(bundle)?.patchFileHash ?? null;
28
- var getPatchStorageUri = (bundle) => bundle.patchStorageUri ?? getPrimaryPatch(bundle)?.patchStorageUri ?? null;
29
- var NUMERIC_COHORT_SIZE = 1e3;
30
- var DEFAULT_ROLLOUT_COHORT_COUNT = NUMERIC_COHORT_SIZE;
31
- var INVALID_COHORT_ERROR_MESSAGE = `Invalid cohort. Use 1-1000 or a lowercase slug without spaces, up to 64 characters.`;
32
- var CUSTOM_COHORT_PATTERN = /^[a-z0-9-]+$/;
33
- function parseNumericCohortValue(cohort) {
34
- if (!/^\d+$/.test(cohort)) return null;
35
- const parsed = Number.parseInt(cohort, 10);
36
- if (Number.isNaN(parsed) || parsed < 1 || parsed > 1e3) return null;
37
- return parsed;
38
- }
39
- function positiveMod(value, modulus) {
40
- return (value % modulus + modulus) % modulus;
41
- }
42
- function hashString(value) {
43
- let hash = 0;
44
- for (let i = 0; i < value.length; i++) {
45
- const char = value.charCodeAt(i);
46
- hash = (hash << 5) - hash + char;
47
- hash |= 0;
48
- }
49
- return hash;
50
- }
51
- function gcd(a, b) {
52
- let x = Math.abs(a);
53
- let y = Math.abs(b);
54
- while (y !== 0) {
55
- const next = x % y;
56
- x = y;
57
- y = next;
58
- }
59
- return x;
60
- }
61
- function modularInverse(value, modulus) {
62
- let t = 0;
63
- let newT = 1;
64
- let r = modulus;
65
- let newR = positiveMod(value, modulus);
66
- while (newR !== 0) {
67
- const quotient = Math.floor(r / newR);
68
- [t, newT] = [newT, t - quotient * newT];
69
- [r, newR] = [newR, r - quotient * newR];
70
- }
71
- if (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);
72
- return positiveMod(t, modulus);
73
- }
74
- function getRolloutShuffleParameters(bundleId) {
75
- let multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);
76
- if (multiplier === 0) multiplier = 1;
77
- while (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {
78
- multiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);
79
- if (multiplier === 0) multiplier = 1;
80
- }
81
- const offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);
82
- return {
83
- multiplier,
84
- offset,
85
- inverseMultiplier: modularInverse(multiplier, NUMERIC_COHORT_SIZE)
86
- };
87
- }
88
- function normalizeRolloutCohortCount(rolloutCohortCount) {
89
- if (rolloutCohortCount === null || rolloutCohortCount === void 0) return DEFAULT_ROLLOUT_COHORT_COUNT;
90
- if (rolloutCohortCount <= 0) return 0;
91
- if (rolloutCohortCount >= 1e3) return NUMERIC_COHORT_SIZE;
92
- return Math.floor(rolloutCohortCount);
93
- }
94
- function normalizeCohortValue(cohort) {
95
- const normalized = cohort.trim().toLowerCase();
96
- const numericCohort = parseNumericCohortValue(normalized);
97
- if (numericCohort !== null) return String(numericCohort);
98
- return normalized;
99
- }
100
- function getNumericCohortValue(cohort) {
101
- return parseNumericCohortValue(normalizeCohortValue(cohort));
102
- }
103
- function isNumericCohort(cohort) {
104
- return getNumericCohortValue(cohort) !== null;
105
- }
106
- function isCustomCohort(cohort) {
107
- const normalized = normalizeCohortValue(cohort);
108
- return normalized.length > 0 && normalized.length <= 64 && !/^\d+$/.test(normalized) && CUSTOM_COHORT_PATTERN.test(normalized);
109
- }
110
- function isValidCohort(cohort) {
111
- const normalized = normalizeCohortValue(cohort);
112
- return isNumericCohort(normalized) || isCustomCohort(normalized);
113
- }
114
- function getNumericCohortRolloutPosition(bundleId, cohortValue) {
115
- if (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);
116
- const { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);
117
- return positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);
118
- }
119
- //#endregion
120
- export { getManifestStorageUri as a, getPatchBaseFileHash as c, isValidCohort as d, normalizeCohortValue as f, getBundlePatches as i, getPatchFileHash as l, NUMERIC_COHORT_SIZE as n, getNumericCohortRolloutPosition as o, normalizeRolloutCohortCount as p, getAssetBaseStorageUri as r, getPatchBaseBundleId as s, INVALID_COHORT_ERROR_MESSAGE as t, getPatchStorageUri as u };