@hot-updater/react-native 1.0.0-rc.16 → 1.0.0-rc.17

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 (316) hide show
  1. package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +491 -388
  2. package/android/src/main/java/com/hotupdater/BundleMetadata.kt +5 -11
  3. package/android/src/main/java/com/hotupdater/FileManagerService.kt +45 -0
  4. package/android/src/main/java/com/hotupdater/HotUpdaterException.kt +290 -12
  5. package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +35 -19
  6. package/android/src/main/java/com/hotupdater/InstallIdentityService.kt +37 -0
  7. package/android/src/main/java/com/hotupdater/KeyValueStorageService.kt +86 -0
  8. package/android/src/main/java/com/hotupdater/NetworkState.kt +31 -0
  9. package/android/src/main/java/com/hotupdater/NoBackupStorage.kt +17 -0
  10. package/android/src/main/java/com/hotupdater/OkHttpDownloadService.kt +110 -52
  11. package/android/src/main/java/com/hotupdater/PreviousProcessExit.kt +89 -0
  12. package/android/src/main/java/com/hotupdater/ReactNativeValueConverters.kt +34 -0
  13. package/android/src/newarch/HotUpdaterModule.kt +74 -69
  14. package/android/src/oldarch/HotUpdaterModule.kt +63 -59
  15. package/android/src/oldarch/HotUpdaterSpec.kt +4 -6
  16. package/android/src/test/java/com/hotupdater/BsdiffPatchTest.kt +1 -1
  17. package/android/src/test/java/com/hotupdater/BundleFileStorageServiceTest.kt +446 -61
  18. package/android/src/test/java/com/hotupdater/HotUpdaterExceptionTest.kt +220 -0
  19. package/android/src/test/java/com/hotupdater/HotUpdaterImplTest.kt +19 -27
  20. package/android/src/test/java/com/hotupdater/InstallIdentityServiceTest.kt +71 -0
  21. package/android/src/test/java/com/hotupdater/KeyValueStorageServiceTest.kt +106 -0
  22. package/android/src/test/java/com/hotupdater/NoBackupContext.kt +11 -0
  23. package/android/src/test/java/com/hotupdater/OkHttpDownloadServiceTest.kt +309 -23
  24. package/android/src/test/java/com/hotupdater/PreviousProcessExitTest.kt +57 -0
  25. package/ios/HotUpdater/Internal/BundleFileStorageService.swift +238 -157
  26. package/ios/HotUpdater/Internal/BundleMetadata.swift +3 -53
  27. package/ios/HotUpdater/Internal/FileManagerService.swift +48 -0
  28. package/ios/HotUpdater/Internal/HotUpdater.mm +8 -18
  29. package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +48 -29
  30. package/ios/HotUpdater/Internal/KeyValueStorageService.swift +71 -0
  31. package/ios/HotUpdater/Internal/URLSessionDownloadService.swift +108 -1
  32. package/ios/HotUpdater/Internal/UpdateFailure.swift +390 -0
  33. package/lib/commonjs/appReady.js +111 -0
  34. package/lib/commonjs/appReady.js.map +1 -0
  35. package/lib/commonjs/appReady.spec.js +360 -0
  36. package/lib/commonjs/appReady.spec.js.map +1 -0
  37. package/lib/commonjs/{notifyAppReadyInsights.test-utils.js → appReady.test-utils.js} +4 -3
  38. package/lib/commonjs/appReady.test-utils.js.map +1 -0
  39. package/lib/commonjs/baseURL.js +16 -0
  40. package/lib/commonjs/baseURL.js.map +1 -0
  41. package/lib/commonjs/checkForUpdate.js +104 -56
  42. package/lib/commonjs/checkForUpdate.js.map +1 -1
  43. package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js +337 -74
  44. package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js.map +1 -1
  45. package/lib/commonjs/clientPlugin.js +49 -0
  46. package/lib/commonjs/clientPlugin.js.map +1 -0
  47. package/lib/commonjs/entryImportGraph.spec.js +50 -0
  48. package/lib/commonjs/entryImportGraph.spec.js.map +1 -0
  49. package/lib/commonjs/fetchJSON.js +2 -6
  50. package/lib/commonjs/fetchJSON.js.map +1 -1
  51. package/lib/commonjs/httpClient.js +18 -165
  52. package/lib/commonjs/httpClient.js.map +1 -1
  53. package/lib/commonjs/httpClient.spec.js +26 -199
  54. package/lib/commonjs/httpClient.spec.js.map +1 -1
  55. package/lib/commonjs/index.js +49 -36
  56. package/lib/commonjs/index.js.map +1 -1
  57. package/lib/commonjs/index.spec.js +108 -123
  58. package/lib/commonjs/index.spec.js.map +1 -1
  59. package/lib/commonjs/native.js +67 -48
  60. package/lib/commonjs/native.js.map +1 -1
  61. package/lib/commonjs/native.spec.js +80 -58
  62. package/lib/commonjs/native.spec.js.map +1 -1
  63. package/lib/commonjs/pluginHost.js +208 -0
  64. package/lib/commonjs/pluginHost.js.map +1 -0
  65. package/lib/commonjs/pluginHost.spec.js +292 -0
  66. package/lib/commonjs/pluginHost.spec.js.map +1 -0
  67. package/lib/commonjs/plugins/insights/eventId.js +129 -0
  68. package/lib/commonjs/plugins/insights/eventId.js.map +1 -0
  69. package/lib/commonjs/plugins/insights/eventId.spec.js +47 -0
  70. package/lib/commonjs/plugins/insights/eventId.spec.js.map +1 -0
  71. package/lib/commonjs/plugins/insights/index.js +272 -0
  72. package/lib/commonjs/plugins/insights/index.js.map +1 -0
  73. package/lib/commonjs/plugins/insights/insights.spec.js +640 -0
  74. package/lib/commonjs/plugins/insights/insights.spec.js.map +1 -0
  75. package/lib/commonjs/plugins/insights/sender.js +128 -0
  76. package/lib/commonjs/plugins/insights/sender.js.map +1 -0
  77. package/lib/commonjs/plugins/insights/sender.spec.js +265 -0
  78. package/lib/commonjs/plugins/insights/sender.spec.js.map +1 -0
  79. package/lib/commonjs/plugins/insights/state.js +145 -0
  80. package/lib/commonjs/plugins/insights/state.js.map +1 -0
  81. package/lib/commonjs/releaseCatalogCache.js +13 -2
  82. package/lib/commonjs/releaseCatalogCache.js.map +1 -1
  83. package/lib/commonjs/releaseCatalogCache.spec.js +18 -0
  84. package/lib/commonjs/releaseCatalogCache.spec.js.map +1 -1
  85. package/lib/commonjs/sdkVersion.js +1 -1
  86. package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
  87. package/lib/commonjs/updateError.js +132 -0
  88. package/lib/commonjs/updateError.js.map +1 -0
  89. package/lib/commonjs/updateError.spec.js +149 -0
  90. package/lib/commonjs/updateError.spec.js.map +1 -0
  91. package/lib/commonjs/wrap.js +43 -25
  92. package/lib/commonjs/wrap.js.map +1 -1
  93. package/lib/commonjs/wrap.progress.spec.js +195 -0
  94. package/lib/commonjs/wrap.progress.spec.js.map +1 -0
  95. package/lib/commonjs/wrap.spec.js +94 -230
  96. package/lib/commonjs/wrap.spec.js.map +1 -1
  97. package/lib/module/appReady.js +103 -0
  98. package/lib/module/appReady.js.map +1 -0
  99. package/lib/module/appReady.spec.js +359 -0
  100. package/lib/module/appReady.spec.js.map +1 -0
  101. package/lib/module/{notifyAppReadyInsights.test-utils.js → appReady.test-utils.js} +4 -3
  102. package/lib/module/appReady.test-utils.js.map +1 -0
  103. package/lib/module/baseURL.js +11 -0
  104. package/lib/module/baseURL.js.map +1 -0
  105. package/lib/module/checkForUpdate.js +103 -57
  106. package/lib/module/checkForUpdate.js.map +1 -1
  107. package/lib/module/checkForUpdate.releaseCatalog.spec.js +337 -74
  108. package/lib/module/checkForUpdate.releaseCatalog.spec.js.map +1 -1
  109. package/lib/module/clientPlugin.js +44 -0
  110. package/lib/module/clientPlugin.js.map +1 -0
  111. package/lib/module/entryImportGraph.spec.js +50 -0
  112. package/lib/module/entryImportGraph.spec.js.map +1 -0
  113. package/lib/module/fetchJSON.js +2 -6
  114. package/lib/module/fetchJSON.js.map +1 -1
  115. package/lib/module/httpClient.js +18 -165
  116. package/lib/module/httpClient.js.map +1 -1
  117. package/lib/module/httpClient.spec.js +27 -200
  118. package/lib/module/httpClient.spec.js.map +1 -1
  119. package/lib/module/index.js +44 -38
  120. package/lib/module/index.js.map +1 -1
  121. package/lib/module/index.spec.js +108 -123
  122. package/lib/module/index.spec.js.map +1 -1
  123. package/lib/module/native.js +63 -44
  124. package/lib/module/native.js.map +1 -1
  125. package/lib/module/native.spec.js +80 -58
  126. package/lib/module/native.spec.js.map +1 -1
  127. package/lib/module/pluginHost.js +200 -0
  128. package/lib/module/pluginHost.js.map +1 -0
  129. package/lib/module/pluginHost.spec.js +291 -0
  130. package/lib/module/pluginHost.spec.js.map +1 -0
  131. package/lib/module/plugins/insights/eventId.js +122 -0
  132. package/lib/module/plugins/insights/eventId.js.map +1 -0
  133. package/lib/module/plugins/insights/eventId.spec.js +47 -0
  134. package/lib/module/plugins/insights/eventId.spec.js.map +1 -0
  135. package/lib/module/plugins/insights/index.js +268 -0
  136. package/lib/module/plugins/insights/index.js.map +1 -0
  137. package/lib/module/plugins/insights/insights.spec.js +639 -0
  138. package/lib/module/plugins/insights/insights.spec.js.map +1 -0
  139. package/lib/module/plugins/insights/sender.js +123 -0
  140. package/lib/module/plugins/insights/sender.js.map +1 -0
  141. package/lib/module/plugins/insights/sender.spec.js +265 -0
  142. package/lib/module/plugins/insights/sender.spec.js.map +1 -0
  143. package/lib/module/plugins/insights/state.js +139 -0
  144. package/lib/module/plugins/insights/state.js.map +1 -0
  145. package/lib/module/releaseCatalogCache.js +13 -2
  146. package/lib/module/releaseCatalogCache.js.map +1 -1
  147. package/lib/module/releaseCatalogCache.spec.js +18 -0
  148. package/lib/module/releaseCatalogCache.spec.js.map +1 -1
  149. package/lib/module/sdkVersion.js +1 -1
  150. package/lib/module/specs/NativeHotUpdater.js.map +1 -1
  151. package/lib/module/updateError.js +126 -0
  152. package/lib/module/updateError.js.map +1 -0
  153. package/lib/module/updateError.spec.js +149 -0
  154. package/lib/module/updateError.spec.js.map +1 -0
  155. package/lib/module/wrap.js +43 -25
  156. package/lib/module/wrap.js.map +1 -1
  157. package/lib/module/wrap.progress.spec.js +196 -0
  158. package/lib/module/wrap.progress.spec.js.map +1 -0
  159. package/lib/module/wrap.spec.js +93 -229
  160. package/lib/module/wrap.spec.js.map +1 -1
  161. package/lib/typescript/commonjs/appReady.d.ts +23 -0
  162. package/lib/typescript/commonjs/appReady.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/appReady.test-utils.d.ts +9 -0
  164. package/lib/typescript/commonjs/appReady.test-utils.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/baseURL.d.ts +4 -0
  166. package/lib/typescript/commonjs/baseURL.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/checkForUpdate.d.ts +15 -2
  168. package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/clientPlugin.d.ts +185 -0
  170. package/lib/typescript/commonjs/clientPlugin.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/fetchJSON.d.ts +2 -3
  172. package/lib/typescript/commonjs/fetchJSON.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/httpClient.d.ts +2 -36
  174. package/lib/typescript/commonjs/httpClient.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/index.d.ts +3 -6
  176. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/native.d.ts +29 -15
  178. package/lib/typescript/commonjs/native.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/pluginHost.d.ts +29 -0
  180. package/lib/typescript/commonjs/pluginHost.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/plugins/insights/eventId.d.ts +18 -0
  182. package/lib/typescript/commonjs/plugins/insights/eventId.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/plugins/insights/index.d.ts +40 -0
  184. package/lib/typescript/commonjs/plugins/insights/index.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/plugins/insights/sender.d.ts +74 -0
  186. package/lib/typescript/commonjs/plugins/insights/sender.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/plugins/insights/state.d.ts +46 -0
  188. package/lib/typescript/commonjs/plugins/insights/state.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/releaseCatalogCache.d.ts +5 -1
  190. package/lib/typescript/commonjs/releaseCatalogCache.d.ts.map +1 -1
  191. package/lib/typescript/commonjs/sdkVersion.d.ts +1 -1
  192. package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +34 -12
  193. package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
  194. package/lib/typescript/commonjs/updateError.d.ts +26 -0
  195. package/lib/typescript/commonjs/updateError.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
  197. package/lib/typescript/commonjs/wrap.types.d.ts +6 -10
  198. package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -1
  199. package/lib/typescript/module/appReady.d.ts +23 -0
  200. package/lib/typescript/module/appReady.d.ts.map +1 -0
  201. package/lib/typescript/module/appReady.test-utils.d.ts +9 -0
  202. package/lib/typescript/module/appReady.test-utils.d.ts.map +1 -0
  203. package/lib/typescript/module/baseURL.d.ts +4 -0
  204. package/lib/typescript/module/baseURL.d.ts.map +1 -0
  205. package/lib/typescript/module/checkForUpdate.d.ts +15 -2
  206. package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
  207. package/lib/typescript/module/clientPlugin.d.ts +185 -0
  208. package/lib/typescript/module/clientPlugin.d.ts.map +1 -0
  209. package/lib/typescript/module/fetchJSON.d.ts +2 -3
  210. package/lib/typescript/module/fetchJSON.d.ts.map +1 -1
  211. package/lib/typescript/module/httpClient.d.ts +2 -36
  212. package/lib/typescript/module/httpClient.d.ts.map +1 -1
  213. package/lib/typescript/module/index.d.ts +3 -6
  214. package/lib/typescript/module/index.d.ts.map +1 -1
  215. package/lib/typescript/module/native.d.ts +29 -15
  216. package/lib/typescript/module/native.d.ts.map +1 -1
  217. package/lib/typescript/module/pluginHost.d.ts +29 -0
  218. package/lib/typescript/module/pluginHost.d.ts.map +1 -0
  219. package/lib/typescript/module/plugins/insights/eventId.d.ts +18 -0
  220. package/lib/typescript/module/plugins/insights/eventId.d.ts.map +1 -0
  221. package/lib/typescript/module/plugins/insights/index.d.ts +40 -0
  222. package/lib/typescript/module/plugins/insights/index.d.ts.map +1 -0
  223. package/lib/typescript/module/plugins/insights/sender.d.ts +74 -0
  224. package/lib/typescript/module/plugins/insights/sender.d.ts.map +1 -0
  225. package/lib/typescript/module/plugins/insights/state.d.ts +46 -0
  226. package/lib/typescript/module/plugins/insights/state.d.ts.map +1 -0
  227. package/lib/typescript/module/releaseCatalogCache.d.ts +5 -1
  228. package/lib/typescript/module/releaseCatalogCache.d.ts.map +1 -1
  229. package/lib/typescript/module/sdkVersion.d.ts +1 -1
  230. package/lib/typescript/module/specs/NativeHotUpdater.d.ts +34 -12
  231. package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
  232. package/lib/typescript/module/updateError.d.ts +26 -0
  233. package/lib/typescript/module/updateError.d.ts.map +1 -0
  234. package/lib/typescript/module/wrap.d.ts.map +1 -1
  235. package/lib/typescript/module/wrap.types.d.ts +6 -10
  236. package/lib/typescript/module/wrap.types.d.ts.map +1 -1
  237. package/package.json +14 -2
  238. package/plugins/insights/package.json +8 -0
  239. package/src/appReady.spec.ts +393 -0
  240. package/src/{notifyAppReadyInsights.test-utils.ts → appReady.test-utils.ts} +7 -7
  241. package/src/appReady.ts +149 -0
  242. package/src/baseURL.ts +15 -0
  243. package/src/checkForUpdate.releaseCatalog.spec.ts +370 -76
  244. package/src/checkForUpdate.ts +135 -80
  245. package/src/clientPlugin.ts +231 -0
  246. package/src/entryImportGraph.spec.ts +65 -0
  247. package/src/fetchJSON.ts +3 -10
  248. package/src/httpClient.spec.ts +30 -227
  249. package/src/httpClient.ts +20 -256
  250. package/src/index.spec.ts +117 -93
  251. package/src/index.ts +67 -52
  252. package/src/native.spec.ts +98 -72
  253. package/src/native.ts +93 -77
  254. package/src/pluginHost.spec.ts +297 -0
  255. package/src/pluginHost.ts +262 -0
  256. package/src/plugins/insights/eventId.spec.ts +60 -0
  257. package/src/plugins/insights/eventId.ts +171 -0
  258. package/src/plugins/insights/index.ts +367 -0
  259. package/src/plugins/insights/insights.spec.ts +732 -0
  260. package/src/plugins/insights/sender.spec.ts +287 -0
  261. package/src/plugins/insights/sender.ts +221 -0
  262. package/src/plugins/insights/state.ts +184 -0
  263. package/src/releaseCatalogCache.spec.ts +22 -0
  264. package/src/releaseCatalogCache.ts +19 -4
  265. package/src/sdkVersion.ts +1 -1
  266. package/src/specs/NativeHotUpdater.ts +34 -13
  267. package/src/updateError.spec.ts +144 -0
  268. package/src/updateError.ts +153 -0
  269. package/src/wrap.progress.spec.ts +232 -0
  270. package/src/wrap.spec.ts +100 -283
  271. package/src/wrap.tsx +57 -26
  272. package/src/wrap.types.ts +6 -12
  273. package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js +0 -225
  274. package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js.map +0 -1
  275. package/lib/commonjs/notifyAppReadyInsights.js +0 -188
  276. package/lib/commonjs/notifyAppReadyInsights.js.map +0 -1
  277. package/lib/commonjs/notifyAppReadyInsights.spec.js +0 -378
  278. package/lib/commonjs/notifyAppReadyInsights.spec.js.map +0 -1
  279. package/lib/commonjs/notifyAppReadyInsights.test-utils.js.map +0 -1
  280. package/lib/commonjs/notifyAppReadyInsights.transport.spec.js +0 -171
  281. package/lib/commonjs/notifyAppReadyInsights.transport.spec.js.map +0 -1
  282. package/lib/commonjs/uuidv7.js +0 -41
  283. package/lib/commonjs/uuidv7.js.map +0 -1
  284. package/lib/commonjs/uuidv7.spec.js +0 -30
  285. package/lib/commonjs/uuidv7.spec.js.map +0 -1
  286. package/lib/module/notifyAppReadyInsights.boundary.spec.js +0 -224
  287. package/lib/module/notifyAppReadyInsights.boundary.spec.js.map +0 -1
  288. package/lib/module/notifyAppReadyInsights.js +0 -181
  289. package/lib/module/notifyAppReadyInsights.js.map +0 -1
  290. package/lib/module/notifyAppReadyInsights.spec.js +0 -377
  291. package/lib/module/notifyAppReadyInsights.spec.js.map +0 -1
  292. package/lib/module/notifyAppReadyInsights.test-utils.js.map +0 -1
  293. package/lib/module/notifyAppReadyInsights.transport.spec.js +0 -170
  294. package/lib/module/notifyAppReadyInsights.transport.spec.js.map +0 -1
  295. package/lib/module/uuidv7.js +0 -36
  296. package/lib/module/uuidv7.js.map +0 -1
  297. package/lib/module/uuidv7.spec.js +0 -30
  298. package/lib/module/uuidv7.spec.js.map +0 -1
  299. package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts +0 -25
  300. package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts.map +0 -1
  301. package/lib/typescript/commonjs/notifyAppReadyInsights.test-utils.d.ts +0 -8
  302. package/lib/typescript/commonjs/notifyAppReadyInsights.test-utils.d.ts.map +0 -1
  303. package/lib/typescript/commonjs/uuidv7.d.ts +0 -10
  304. package/lib/typescript/commonjs/uuidv7.d.ts.map +0 -1
  305. package/lib/typescript/module/notifyAppReadyInsights.d.ts +0 -25
  306. package/lib/typescript/module/notifyAppReadyInsights.d.ts.map +0 -1
  307. package/lib/typescript/module/notifyAppReadyInsights.test-utils.d.ts +0 -8
  308. package/lib/typescript/module/notifyAppReadyInsights.test-utils.d.ts.map +0 -1
  309. package/lib/typescript/module/uuidv7.d.ts +0 -10
  310. package/lib/typescript/module/uuidv7.d.ts.map +0 -1
  311. package/src/notifyAppReadyInsights.boundary.spec.ts +0 -242
  312. package/src/notifyAppReadyInsights.spec.ts +0 -362
  313. package/src/notifyAppReadyInsights.transport.spec.ts +0 -196
  314. package/src/notifyAppReadyInsights.ts +0 -293
  315. package/src/uuidv7.spec.ts +0 -25
  316. package/src/uuidv7.ts +0 -38
@@ -0,0 +1,23 @@
1
+ import type { HotUpdaterError } from "./error";
2
+ import { type NotifyAppReadyResult } from "./native";
3
+ import { emitPluginHook } from "./pluginHost";
4
+ export type NotifyAppReadyOptions = {
5
+ onNotifyAppReady?: (result: NotifyAppReadyResult) => void;
6
+ onError?: (error: HotUpdaterError | Error | unknown) => void;
7
+ };
8
+ /** Android 11+: why the app's previous main process exited, once the launch was read. */
9
+ export declare const getPreviousProcessExit: () => string | null;
10
+ /**
11
+ * The Release the running bundle was selected as: the active or stable
12
+ * selection that names it on the current channel.
13
+ */
14
+ export declare const getRunningReleaseId: (bundleId: string, channel: string) => string | null;
15
+ /** Reads this runtime's launch once native finalizes it and reports it to plugins. */
16
+ export declare const handleNotifyAppReady: (options: NotifyAppReadyOptions) => Promise<NotifyAppReadyResult | undefined>;
17
+ /**
18
+ * Calls a plugin hook after this runtime's `onAppReady`, so plugins see the
19
+ * launch before anything that followed it. The event is built now, from the
20
+ * state it describes, and only when a plugin listens.
21
+ */
22
+ export declare const emitAfterAppReady: typeof emitPluginHook;
23
+ //# sourceMappingURL=appReady.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appReady.d.ts","sourceRoot":"","sources":["../../../src/appReady.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAKL,KAAK,oBAAoB,EAE1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,qBAAqB,GAAG;IAClC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,GAAG,OAAO,KAAK,IAAI,CAAC;CAC9D,CAAC;AAUF,yFAAyF;AACzF,eAAO,MAAM,sBAAsB,QAAO,MAAM,GAAG,IAA2B,CAAC;AAkB/E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aACpB,MAAM,WACP,MAAM,KACd,MAAM,GAAG,IAQX,CAAC;AA4DF,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,YACtB,qBAAqB,KAC7B,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAI1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,cAWtC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { LaunchTransition, NotifyAppReadyResult } from "./native";
2
+ export declare const createNotifyReadResult: (result?: NotifyAppReadyResult, transition?: LaunchTransition | null, pending?: boolean, previousProcessExit?: string | null) => {
3
+ transition: LaunchTransition | null;
4
+ previousProcessExit: string | null;
5
+ pending: boolean;
6
+ result: NotifyAppReadyResult;
7
+ };
8
+ export declare const stubNotifyFrame: () => void;
9
+ //# sourceMappingURL=appReady.test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appReady.test-utils.d.ts","sourceRoot":"","sources":["../../../src/appReady.test-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEvE,eAAO,MAAM,sBAAsB,YACzB,oBAAoB,eAChB,gBAAgB,GAAG,IAAI,2CAEd,MAAM,GAAG,IAAI,KACjC;IACD,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,oBAAoB,CAAC;CAM7B,CAAC;AAEH,eAAO,MAAM,eAAe,YAS3B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { HotUpdaterBaseURL } from "./types";
2
+ /** Resolves a functional baseURL and drops trailing slashes. */
3
+ export declare const resolveBaseURL: (baseURL: HotUpdaterBaseURL) => Promise<string>;
4
+ //# sourceMappingURL=baseURL.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseURL.d.ts","sourceRoot":"","sources":["../../../src/baseURL.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,gEAAgE;AAChE,eAAO,MAAM,cAAc,YAChB,iBAAiB,KACzB,OAAO,CAAC,MAAM,CAShB,CAAC"}
@@ -1,4 +1,6 @@
1
+ import type { ReleaseTransitionKind, UpdateErrorResource, UpdateErrorStage } from "./clientPlugin";
1
2
  import type { HotUpdaterHttpClient } from "./httpClient";
3
+ export type { ReleaseTransitionKind };
2
4
  export interface CheckForUpdateOptions {
3
5
  /**
4
6
  * Update strategy
@@ -35,10 +37,21 @@ export type CheckForUpdateResult = {
35
37
  */
36
38
  updateBundle: () => Promise<boolean>;
37
39
  };
38
- export type ReleaseTransitionKind = "INSTALL" | "ADOPT_RELEASE" | "USE_EMBEDDED" | "USE_BUILTIN";
39
40
  export interface InternalCheckForUpdateOptions extends CheckForUpdateOptions {
40
- insights?: boolean;
41
41
  client: HotUpdaterHttpClient;
42
42
  }
43
+ /** The running bundle, the channel checked, and the update's target. */
44
+ type UpdateErrorScope = {
45
+ readonly channel: string;
46
+ readonly bundleId: string;
47
+ readonly updateStrategy: "fingerprint" | "appVersion";
48
+ readonly targetBundleId?: string;
49
+ readonly targetReleaseId?: string | null;
50
+ };
51
+ /**
52
+ * Tells plugins why an update failed, when it failed as an update. An error
53
+ * the SDK's JavaScript raised happened in `stage`, fetching `resource`.
54
+ */
55
+ export declare const reportUpdateError: (error: unknown, stage: UpdateErrorStage, resource: UpdateErrorResource | undefined, scope: UpdateErrorScope) => void;
43
56
  export declare function checkForUpdate(options: InternalCheckForUpdateOptions): Promise<CheckForUpdateResult | null>;
44
57
  //# sourceMappingURL=checkForUpdate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkForUpdate.d.ts","sourceRoot":"","sources":["../../../src/checkForUpdate.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,oBAAoB,EAAyB,MAAM,cAAc,CAAC;AA0BhF,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,cAAc,EAAE,YAAY,GAAG,aAAa,CAAC;IAE7C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAA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use
4
+ * the same one, as server plugins do.
5
+ */
6
+ export type UpdateStrategy = "fingerprint" | "appVersion";
7
+ /** How an update moves the app's selection. */
8
+ export type ReleaseTransitionKind = "INSTALL" | "ADOPT_RELEASE" | "USE_EMBEDDED" | "USE_BUILTIN";
9
+ /** The launch outcome native reports once per JavaScript runtime. */
10
+ export type AppReadyResult = ({
11
+ /** No update was applied or recovered at this launch. */
12
+ readonly status: "UNCHANGED";
13
+ readonly channel: string;
14
+ /** The running bundle. */
15
+ readonly bundleId: string;
16
+ /** The Release the running bundle was selected as, when known. */
17
+ readonly releaseId: string | null;
18
+ } | {
19
+ /**
20
+ * `UPDATE_APPLIED`: a staged update became active at this launch.
21
+ * `RECOVERED`: a failed update was rolled back to `toBundleId`.
22
+ */
23
+ readonly status: "UPDATE_APPLIED" | "RECOVERED";
24
+ readonly channel: string;
25
+ readonly fromBundleId: string;
26
+ readonly fromReleaseId: string | null;
27
+ readonly toBundleId: string;
28
+ readonly toReleaseId: string | null;
29
+ readonly updateStrategy: UpdateStrategy;
30
+ }) & {
31
+ /**
32
+ * Android 11+: why the app's previous main process exited, the
33
+ * `ApplicationExitInfo` reason without its `REASON_` prefix, such as
34
+ * `CRASH`, `ANR`, `LOW_MEMORY`, or `USER_REQUESTED`. Null on iOS and on
35
+ * older Android. It tells a crash from the system or the user closing the
36
+ * app.
37
+ */
38
+ readonly previousProcessExit: string | null;
39
+ };
40
+ /** What an update check found. */
41
+ export type UpdateCheckResult = {
42
+ /**
43
+ * The app keeps running its bundle: the check found nothing to
44
+ * install, or the app adopted a newer Release of the running bundle.
45
+ */
46
+ readonly status: "UNCHANGED";
47
+ readonly channel: string;
48
+ readonly bundleId: string;
49
+ /** The Release the running bundle is selected as after the check. */
50
+ readonly releaseId: string | null;
51
+ /** The Release before the check; it differs after an adoption. */
52
+ readonly previousReleaseId: string | null;
53
+ } | {
54
+ /** The check found a Release to install, adopt, or roll back to. */
55
+ readonly status: "UPDATE_AVAILABLE";
56
+ readonly channel: string;
57
+ readonly fromBundleId: string;
58
+ readonly fromReleaseId: string | null;
59
+ readonly toBundleId: string;
60
+ readonly toReleaseId: string | null;
61
+ readonly transitionKind: ReleaseTransitionKind;
62
+ readonly updateStatus: "UPDATE" | "ROLLBACK";
63
+ readonly shouldForceUpdate: boolean;
64
+ readonly updateStrategy: UpdateStrategy;
65
+ };
66
+ /** A bundle the SDK downloaded, verified, and staged for the next launch. */
67
+ export interface BundleDownloadedInfo {
68
+ readonly channel: string;
69
+ readonly fromBundleId: string;
70
+ readonly fromReleaseId: string | null;
71
+ readonly toBundleId: string;
72
+ readonly toReleaseId: string | null;
73
+ readonly updateStrategy: UpdateStrategy;
74
+ /**
75
+ * How the bundle arrived: `patch` when a bsdiff patch produced a file,
76
+ * `manifest` when only the changed files were downloaded, `archive` for
77
+ * the full archive.
78
+ */
79
+ readonly delivery: "patch" | "manifest" | "archive";
80
+ /** A patch was tried, but the file or the archive was downloaded instead. */
81
+ readonly patchFallback: boolean;
82
+ }
83
+ /**
84
+ * Where an update failed: `check` covers the Release catalog request,
85
+ * `download` the transfer and verification of the update's files, and
86
+ * `install` patching, extracting, and moving them into place.
87
+ */
88
+ export type UpdateErrorStage = "check" | "download" | "install";
89
+ /** What the SDK was fetching or applying when an update failed. */
90
+ export type UpdateErrorResource = "catalog" | "artifact" | "manifest" | "file" | "patch" | "archive";
91
+ /** Why no response arrived, for a `network` failure. */
92
+ export type UpdateErrorTransport = "timeout" | "dns" | "tls" | "connection" | "offline" | "cancelled";
93
+ export type UpdateErrorReason = "network" | "http" | "invalid_response" | "hash_mismatch" | "signature" | "patch" | "extract" | "storage" | "unknown";
94
+ /** An update check, download, or install that failed. */
95
+ export interface UpdateError {
96
+ readonly stage: UpdateErrorStage;
97
+ readonly reason: UpdateErrorReason;
98
+ /** What was being fetched or applied, when the SDK knows. */
99
+ readonly resource?: UpdateErrorResource;
100
+ /** The response status when `reason` is `"http"`. */
101
+ readonly httpStatus?: number;
102
+ /**
103
+ * The storage origin's XML error `<Code>`, such as `AccessDenied`,
104
+ * `NoSuchKey`, or `ExpiredToken`, when an `http` failure's body names one.
105
+ * It tells an expired signed URL from a missing file.
106
+ */
107
+ readonly originCode?: string;
108
+ /** Why no response arrived, for a `network` failure, when the SDK knows. */
109
+ readonly transport?: UpdateErrorTransport;
110
+ /** Android 11+: why the previous main process exited (see `AppReadyResult`). */
111
+ readonly previousProcessExit?: string;
112
+ /** The bundle the update targeted; absent for the check stage. */
113
+ readonly targetBundleId?: string;
114
+ /** The Release the update targeted, when it names one. */
115
+ readonly targetReleaseId?: string;
116
+ readonly channel: string;
117
+ /** The running bundle and the Release it was selected as. */
118
+ readonly bundleId: string;
119
+ readonly releaseId: string | null;
120
+ readonly updateStrategy: UpdateStrategy;
121
+ /** The error the SDK caught. */
122
+ readonly cause: unknown;
123
+ }
124
+ /**
125
+ * Lifecycle hooks a plugin returns from `setup`. Hooks observe: the SDK
126
+ * never waits for one and ignores what it returns, and a hook that throws or
127
+ * rejects is reported through `onError`, or a console warning without one,
128
+ * so a plugin can never delay or change an update.
129
+ */
130
+ export interface HotUpdaterClientHooks {
131
+ /** Called once per JavaScript runtime, after native reports the launch. */
132
+ onAppReady?(result: AppReadyResult): void | Promise<void>;
133
+ /** Called after each update check, and after a Release adoption commits. */
134
+ onUpdateCheck?(result: UpdateCheckResult): void | Promise<void>;
135
+ /** Called after the SDK stages a downloaded bundle. */
136
+ onBundleDownloaded?(info: BundleDownloadedInfo): void | Promise<void>;
137
+ /** Called when an update check, download, or install fails. */
138
+ onUpdateError?(error: UpdateError): void | Promise<void>;
139
+ }
140
+ /**
141
+ * A plugin's persistent key-value store. Native keeps it on the device,
142
+ * outside device backups, and the SDK scopes its keys to the plugin's id.
143
+ * It is meant for small values, up to 64 KB each.
144
+ */
145
+ export interface HotUpdaterClientStorage {
146
+ get(key: string): string | null;
147
+ /** Writes the value; `null` removes the key. */
148
+ set(key: string, value: string | null): void;
149
+ }
150
+ export interface HotUpdaterClientContext {
151
+ /**
152
+ * Requests a path relative to the configured `baseURL`, with the SDK's
153
+ * `requestHeaders` and `requestTimeout` applied. Rejects with
154
+ * `Request timed out` when the timeout passes before a response arrives.
155
+ */
156
+ fetch(path: string, init?: RequestInit): Promise<Response>;
157
+ /** A random id native creates once per installation. */
158
+ readonly installId: string;
159
+ readonly platform: "ios" | "android";
160
+ /** The native app version, or null when the native build has none. */
161
+ readonly appVersion: string | null;
162
+ readonly sdkVersion: string;
163
+ /** Whether this is a debug build (`__DEV__`). */
164
+ readonly isDebugBuild: boolean;
165
+ /** The bundle native reports as current. */
166
+ getBundleId(): string;
167
+ getChannel(): string;
168
+ getCohort(): string;
169
+ getFingerprintHash(): string | null;
170
+ readonly storage: HotUpdaterClientStorage;
171
+ /** The current time in milliseconds since the epoch. */
172
+ now(): number;
173
+ }
174
+ export interface HotUpdaterClientPlugin {
175
+ /** Unique among an app's plugins; two plugins with one id throw at init. */
176
+ readonly id: string;
177
+ /**
178
+ * Called once, when `HotUpdater.init` or `HotUpdater.wrap` first
179
+ * configures the runtime with this plugin.
180
+ */
181
+ setup(context: HotUpdaterClientContext): HotUpdaterClientHooks | void;
182
+ }
183
+ /** Declares a client plugin; built-in and third-party plugins use the same contract. */
184
+ export declare const defineClientPlugin: <const P extends HotUpdaterClientPlugin>(plugin: P) => P;
185
+ //# sourceMappingURL=clientPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientPlugin.d.ts","sourceRoot":"","sources":["../../../src/clientPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC;AAE1D,+CAA+C;AAC/C,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,eAAe,GACf,cAAc,GACd,aAAa,CAAC;AAElB,qEAAqE;AACrE,MAAM,MAAM,cAAc,GAAG,CACzB;IACE,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO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1,6 +1,5 @@
1
- export declare class FetchJSONResponseError extends Error {
2
- readonly status: number;
3
- constructor(status: number, statusText: string);
1
+ import { UpdateHttpError } from "./updateError";
2
+ export declare class FetchJSONResponseError extends UpdateHttpError {
4
3
  }
5
4
  export declare const fetchJSON: <T>({ url, requestHeaders, requestTimeout, }: {
6
5
  url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"fetchJSON.d.ts","sourceRoot":"","sources":["../../../src/fetchJSON.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,KAAK;IAE7C,QAAQ,CAAC,MAAM,EAAE,MAAM;IADzB,YACW,MAAM,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAKnB;CACF;AAED,eAAO,MAAM,SAAS,GAAU,CAAC,4CAI9B;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,KAAG,OAAO,CAAC,CAAC,CAwBZ,CAAC"}
1
+ {"version":3,"file":"fetchJSON.d.ts","sourceRoot":"","sources":["../../../src/fetchJSON.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,sBAAuB,SAAQ,eAAe;CAAG;AAE9D,eAAO,MAAM,SAAS,GAAU,CAAC,4CAI9B;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,KAAG,OAAO,CAAC,CAAC,CAwBZ,CAAC"}
@@ -15,48 +15,14 @@ export interface ArtifactRequest {
15
15
  readonly requestHeaders?: Record<string, string>;
16
16
  readonly requestTimeout?: number;
17
17
  }
18
- interface InsightsEventCommonParams {
19
- readonly installId: string;
20
- readonly userId?: string;
21
- readonly username?: string;
22
- readonly platform: "ios" | "android";
23
- readonly appVersion: string;
24
- readonly channel: string;
25
- readonly cohort: string;
26
- readonly fingerprintHash: string | null;
27
- readonly fromReleaseId?: string | null;
28
- readonly toReleaseId?: string | null;
29
- readonly requestHeaders?: Record<string, string>;
30
- readonly requestTimeout?: number;
31
- }
32
- type InsightsTransitionEventParams = InsightsEventCommonParams & {
33
- readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "RECOVERED";
34
- readonly fromBundleId: string;
35
- readonly toBundleId: string;
36
- readonly updateStrategy: "fingerprint" | "appVersion";
37
- };
38
- type InsightsUnchangedEventParams = InsightsEventCommonParams & {
39
- readonly type: "UNCHANGED";
40
- readonly fromBundleId: null;
41
- readonly toBundleId: string;
42
- readonly updateStrategy: null;
43
- };
44
- export type InsightsEventParams = InsightsTransitionEventParams | InsightsUnchangedEventParams;
45
18
  export interface HotUpdaterHttpSession {
46
- fetchReleaseCatalog: (params: ReleaseCatalogRequest) => Promise<ReleaseCatalog>;
19
+ /** Resolves to null when the server says the scope has no catalog, so no update. */
20
+ fetchReleaseCatalog: (params: ReleaseCatalogRequest) => Promise<ReleaseCatalog | null>;
47
21
  resolveArtifact: (params: ArtifactRequest) => Promise<ArtifactInfo>;
48
- /**
49
- * Posts an Insights event under a client `eventId`, retrying a network
50
- * error, timeout, 429 or 5xx for up to three attempts in all. Resolves once
51
- * the event is delivered or left to background retries; rejects when its
52
- * first attempt fails for good, such as with a 400.
53
- */
54
- sendInsightsEvent: (params: InsightsEventParams) => Promise<void>;
55
22
  }
56
23
  export interface HotUpdaterHttpClient {
57
24
  createSession: () => Promise<HotUpdaterHttpSession>;
58
25
  }
59
26
  /** Creates the private HTTP client used by HotUpdater.init and HotUpdater.wrap. */
60
27
  export declare const createHttpClient: (baseURL: HotUpdaterBaseURL) => HotUpdaterHttpClient;
61
- export {};
62
28
  //# sourceMappingURL=httpClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/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mFAAmF;AACnF,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,KACzB,oBAED,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { type CheckForUpdateOptions } from "./checkForUpdate";
2
- import { addListener, clearCrashHistory, getAppVersion, getUpdateId, getChannel, getCohort, getCrashHistory, getDefaultChannel, getFingerprintHash, getInstallId, getManifest, getMinBundleId, isChannelSwitched, notifyAppReady, reload, setCohort, setReloadBehavior, setUser, type UpdateParams } from "./native";
2
+ import { addListener, clearCrashHistory, getAppVersion, getUpdateId, getChannel, getCohort, getCrashHistory, getDefaultChannel, getFingerprintHash, getInstallId, getManifest, getMinBundleId, isChannelSwitched, notifyAppReady, reload, setCohort, setReloadBehavior, type UpdateParams } from "./native";
3
3
  import { type AutoUpdateOptions, type HotUpdaterInitOptions, type HotUpdaterOptions, wrap } from "./wrap";
4
- export type { CustomReloadHandler, HotUpdaterEvent, HotUpdaterProgressArtifactType, HotUpdaterProgressEvent, Manifest, ManifestAsset, NotifyAppReadyResult, ActiveUpdateState, ReloadBehavior, ReloadBehaviorSetting, SetUserParams, } from "./native";
4
+ export { defineClientPlugin, type AppReadyResult, type BundleDownloadedInfo, type HotUpdaterClientContext, type HotUpdaterClientHooks, type HotUpdaterClientPlugin, type HotUpdaterClientStorage, type ReleaseTransitionKind, type UpdateCheckResult, type UpdateError, type UpdateErrorReason, type UpdateErrorStage, type UpdateStrategy, } from "./clientPlugin";
5
+ export type { CustomReloadHandler, HotUpdaterEvent, HotUpdaterProgressArtifactType, HotUpdaterProgressEvent, Manifest, ManifestAsset, NotifyAppReadyResult, ActiveUpdateState, ReloadBehavior, ReloadBehaviorSetting, } from "./native";
5
6
  export * from "./store";
6
7
  export { extractSignatureFailure, type HotUpdaterBaseURL, isSignatureVerificationError, type SignatureVerificationFailure, } from "./types";
7
8
  export type { HotUpdaterFallbackComponentProps, HotUpdaterInitOptions, HotUpdaterOptions, RunUpdateProcessResponse, } from "./wrap";
@@ -245,10 +246,6 @@ declare function createHotUpdaterClient(): {
245
246
  * Fetches the persisted install id for this app installation.
246
247
  */
247
248
  getInstallId: typeof getInstallId;
248
- /**
249
- * Persists nullable user identity fields associated with this installation.
250
- */
251
- setUser: typeof setUser;
252
249
  /**
253
250
  * Reads the native launch report for the current process.
254
251
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAG3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,WAAW,EAIX,iBAAiB,EACjB,aAAa,EAEb,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,MAAM,EAEN,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,KAAK,YAAY,EAElB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAItB,IAAI,EACL,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,8BAA8B,EAC9B,uBAAuB,EACvB,QAAQ,EACR,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,4BAA4B,EAC5B,KAAK,4BAA4B,GAClC,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gCAAgC,EAChC,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,QAAQ,CAAC;AAoBhB,KAAK,cAAc,GAAG;IACpB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;IACtD,CAAC,OAAO,EAAE,iBAAi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;IAGH;;;;;;;;;OASG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;OAEG;;IAGH,wDAAwD;;IAGxD;;;OAGG;;IAGH,wEAAwE;;IAGxE;;OAEG;;IAGH;;;;;;;;;;;;OAYG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;OAIG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAGH;;;;;;;;;;;;;;;;OAgBG;;IAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;6BACsB,qBAAqB;IAiB9C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;2BAC0B,YAAY;IAiDzC;;;;OAIG;;IAcH;;;;;;;;;;OAUG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;;;;;;;OAWG;;IAGH;;;;;;;;;;;OAWG;;EAGN;AAED,KAAK,gBAAgB,GAAG,IAAI,CAC1B,UAAU,CAAC,OAAO,sBAAsB,CAAC,EACzC,MAAM,CACP,GAAG;IACF,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,gBAA2C,CAAC"}
@@ -125,6 +125,24 @@ export declare const commitReleaseSelection: (input: {
125
125
  readonly selection: PersistedSelectionReceipt;
126
126
  readonly guard: ReleaseSelectionGuard;
127
127
  }) => Promise<boolean>;
128
+ /** How native delivered a staged bundle. */
129
+ export type BundleDelivery = {
130
+ /**
131
+ * "patch" when a bsdiff patch produced a file, "manifest" when only the
132
+ * changed files were downloaded, "archive" for the full archive.
133
+ */
134
+ readonly delivery: "patch" | "manifest" | "archive";
135
+ /** A patch was tried, but the file or the archive was downloaded instead. */
136
+ readonly patchFallback: boolean;
137
+ };
138
+ /**
139
+ * Stages a bundle for the next launch. Resolves with how native delivered
140
+ * it, or with null when this runtime had already staged it and nothing was
141
+ * downloaded; rejects when the download or install fails.
142
+ *
143
+ * @throws {Error} Rejects with error.code from HotUpdaterErrorCode enum and error.message
144
+ */
145
+ export declare function stageBundle(params: UpdateParams): Promise<BundleDelivery | null>;
128
146
  /**
129
147
  * Downloads files and applies them to the app.
130
148
  *
@@ -215,17 +233,10 @@ export declare const isChannelSwitched: () => boolean;
215
233
  */
216
234
  export declare const getFingerprintHash: () => string | null;
217
235
  export declare const getInstallId: () => string;
218
- export type PersistedUserIdentity = {
219
- userId?: string;
220
- username?: string;
221
- };
222
- export declare const getPersistedUserIdentity: () => PersistedUserIdentity;
223
- export type SetUserParams = {
224
- userId?: string | number | null;
225
- username?: string | null;
226
- };
227
- export declare function setUser(params: SetUserParams): void;
228
- export declare function setUser(params: null): void;
236
+ /** Reads a value from the SDK's native key-value store. */
237
+ export declare const getStorageItem: (key: string) => string | null;
238
+ /** Writes a value to the SDK's native key-value store; null removes it. */
239
+ export declare const setStorageItem: (key: string, value: string | null) => void;
229
240
  /**
230
241
  * Result returned by notifyAppReady()
231
242
  */
@@ -244,17 +255,20 @@ export type NotifyAppReadyResult = {
244
255
  fromReleaseId?: string;
245
256
  toReleaseId?: string;
246
257
  };
247
- export type NotifyAppReadyInsightsEvent = {
258
+ /** An update applied or recovered at this launch, as native persisted it. */
259
+ export type LaunchTransition = {
248
260
  type: "UPDATE_APPLIED" | "RECOVERED";
249
261
  fromBundleId: string;
250
262
  toBundleId: string;
251
- fromReleaseId?: string | null;
252
- toReleaseId?: string | null;
263
+ fromReleaseId: string | null;
264
+ toReleaseId: string | null;
253
265
  updateStrategy: PersistedUpdateStrategy;
254
266
  };
255
267
  export declare const readNotifyAppReady: () => {
256
268
  result: NotifyAppReadyResult;
257
- insightsEvent: NotifyAppReadyInsightsEvent | null;
269
+ transition: LaunchTransition | null;
270
+ /** Android 11+: why the previous main process exited, when native knows. */
271
+ previousProcessExit: string | null;
258
272
  pending: boolean;
259
273
  };
260
274
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAC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QAAa,OAAO,CAAC,OAAO,CAMpD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,WAAY,MAAM,KAAG,IAI1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,MAS5B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { HotUpdaterClientHooks, HotUpdaterClientPlugin } from "./clientPlugin";
2
+ import type { HotUpdaterBaseURL } from "./types";
3
+ type HookName = keyof HotUpdaterClientHooks;
4
+ type HookPayload<K extends HookName> = Parameters<NonNullable<HotUpdaterClientHooks[K]>>[0];
5
+ /** The init or wrap settings plugins see through their context. */
6
+ export interface PluginHostConfig {
7
+ readonly baseURL: HotUpdaterBaseURL;
8
+ readonly requestHeaders?: Record<string, string>;
9
+ readonly requestTimeout?: number;
10
+ readonly onError?: (error: unknown) => void;
11
+ }
12
+ /**
13
+ * Sets up the plugins of an init or wrap call. A plugin passed to an earlier
14
+ * call keeps its hooks, and a plugin left out stops receiving events.
15
+ */
16
+ export declare const configurePlugins: (plugins: readonly HotUpdaterClientPlugin[] | undefined, nextConfig: PluginHostConfig) => void;
17
+ /** Whether any plugin listens to this hook, so callers build events only when one does. */
18
+ export declare const hasPluginHook: (name: HookName) => boolean;
19
+ /**
20
+ * Builds a hook's event when a plugin listens. A failure to build it is
21
+ * reported, not thrown, since reporting never changes an update.
22
+ */
23
+ export declare const buildPluginEvent: <K extends HookName>(name: K, createPayload: () => HookPayload<K> | null) => HookPayload<K> | null;
24
+ /** Calls a hook on every plugin that listens, without waiting for any. */
25
+ export declare const dispatchPluginHook: <K extends HookName>(name: K, payload: HookPayload<K>) => void;
26
+ /** Builds a hook's event when a plugin listens and calls the hook right away. */
27
+ export declare const emitPluginHook: <K extends HookName>(name: K, createPayload: () => HookPayload<K> | null) => void;
28
+ export {};
29
+ //# sourceMappingURL=pluginHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluginHost.d.ts","sourceRoot":"","sources":["../../../src/plugin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AC,CAAC,CAAC,GAAG,IAAI,KACzC,IAGF,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Creates an RFC 9562 UUIDv7: a 48-bit millisecond timestamp, then random bits.
3
+ *
4
+ * `createUUIDv7` from `@hot-updater/plugin-core` calls `crypto.getRandomValues`
5
+ * unconditionally, but React Native has no Web Crypto unless the app installs a
6
+ * polyfill. An Insights event ID only has to tell one event from another so a
7
+ * retried POST is counted once, so `Math.random` is enough without one.
8
+ */
9
+ export declare const createUUIDv7: () => string;
10
+ /** SHA-256 of a string's UTF-8 bytes, since React Native has no Web Crypto. */
11
+ export declare const sha256: (value: string) => Uint8Array;
12
+ /**
13
+ * A UUIDv7 derived from a key: its time field is `timestamp` and its random
14
+ * bits are the key's SHA-256, so the same key and time always give the same
15
+ * id, and a server that stores reports by id counts it once.
16
+ */
17
+ export declare const createKeyedUUIDv7: (key: string, timestamp: number) => string;
18
+ //# sourceMappingURL=eventId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventId.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/insights/eventId.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,QAAO,MAW/B,CAAC;AA0CF,+EAA+E;AAC/E,eAAO,MAAM,MAAM,UAAW,MAAM,KAAG,UA+EtC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAS,MAAM,aAAa,MAAM,KAAG,MAChB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type HotUpdaterClientPlugin } from "../../clientPlugin";
2
+ export interface InsightsOptions {
3
+ /**
4
+ * Also report from debug builds (`__DEV__`). Defaults to `false`, so
5
+ * development sessions stay out of production Insights.
6
+ */
7
+ readonly debug?: boolean;
8
+ }
9
+ /** The app's own id for the signed-in user, attached to later reports. */
10
+ export interface InsightsUser {
11
+ readonly userId: string | number;
12
+ }
13
+ export interface InsightsPlugin extends HotUpdaterClientPlugin {
14
+ readonly id: "insights";
15
+ /**
16
+ * Attaches the signed-in user's id to later reports, or clears it with
17
+ * `null`. It persists on the device, sends nothing by itself, and can be
18
+ * called before `HotUpdater.init`.
19
+ */
20
+ setUser(user: InsightsUser | null): void;
21
+ }
22
+ /**
23
+ * Reports update adoption to a server that runs the `insights()` server
24
+ * plugin: launches (at most once a UTC day while nothing changes), downloads,
25
+ * applies, recoveries, and update failures. After the server answers that
26
+ * Insights is off, the plugin sends nothing for 24 hours, and for the rest
27
+ * of that runtime.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { HotUpdater } from "@hot-updater/react-native";
32
+ * import { insights } from "@hot-updater/react-native/plugins/insights";
33
+ *
34
+ * const analytics = insights();
35
+ * HotUpdater.init({ baseURL, plugins: [analytics] });
36
+ * analytics.setUser({ userId: "user-123" });
37
+ * ```
38
+ */
39
+ export declare const insights: (options?: InsightsOptions) => InsightsPlugin;
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/insights/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,sBAAsB,EAG5B,MAAM,oBAAoB,CAAC;AAgB5B,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,cAAe,SAAQ,sBAAsB;IAC5D,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;CAC1C;AAgCD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,aAAa,eAAe,KAAQ,cAgRxD,CAAC"}