@hot-updater/react-native 1.0.0-rc.15 → 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 (302) 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 +15 -67
  52. package/lib/commonjs/httpClient.js.map +1 -1
  53. package/lib/commonjs/httpClient.spec.js +26 -9
  54. package/lib/commonjs/httpClient.spec.js.map +1 -1
  55. package/lib/commonjs/index.js +49 -25
  56. package/lib/commonjs/index.js.map +1 -1
  57. package/lib/commonjs/index.spec.js +126 -40
  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 +14 -66
  116. package/lib/module/httpClient.js.map +1 -1
  117. package/lib/module/httpClient.spec.js +26 -9
  118. package/lib/module/httpClient.spec.js.map +1 -1
  119. package/lib/module/index.js +44 -27
  120. package/lib/module/index.js.map +1 -1
  121. package/lib/module/index.spec.js +127 -41
  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 -30
  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 -5
  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 -30
  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 -5
  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 +28 -9
  249. package/src/httpClient.ts +16 -109
  250. package/src/index.spec.ts +129 -36
  251. package/src/index.ts +67 -37
  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 -5
  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 -124
  281. package/lib/commonjs/notifyAppReadyInsights.transport.spec.js.map +0 -1
  282. package/lib/module/notifyAppReadyInsights.boundary.spec.js +0 -224
  283. package/lib/module/notifyAppReadyInsights.boundary.spec.js.map +0 -1
  284. package/lib/module/notifyAppReadyInsights.js +0 -181
  285. package/lib/module/notifyAppReadyInsights.js.map +0 -1
  286. package/lib/module/notifyAppReadyInsights.spec.js +0 -377
  287. package/lib/module/notifyAppReadyInsights.spec.js.map +0 -1
  288. package/lib/module/notifyAppReadyInsights.test-utils.js.map +0 -1
  289. package/lib/module/notifyAppReadyInsights.transport.spec.js +0 -123
  290. package/lib/module/notifyAppReadyInsights.transport.spec.js.map +0 -1
  291. package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts +0 -25
  292. package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts.map +0 -1
  293. package/lib/typescript/commonjs/notifyAppReadyInsights.test-utils.d.ts +0 -8
  294. package/lib/typescript/commonjs/notifyAppReadyInsights.test-utils.d.ts.map +0 -1
  295. package/lib/typescript/module/notifyAppReadyInsights.d.ts +0 -25
  296. package/lib/typescript/module/notifyAppReadyInsights.d.ts.map +0 -1
  297. package/lib/typescript/module/notifyAppReadyInsights.test-utils.d.ts +0 -8
  298. package/lib/typescript/module/notifyAppReadyInsights.test-utils.d.ts.map +0 -1
  299. package/src/notifyAppReadyInsights.boundary.spec.ts +0 -242
  300. package/src/notifyAppReadyInsights.spec.ts +0 -362
  301. package/src/notifyAppReadyInsights.transport.spec.ts +0 -138
  302. package/src/notifyAppReadyInsights.ts +0 -293
@@ -0,0 +1,360 @@
1
+ "use strict";
2
+
3
+ var _vitest = require("vitest");
4
+ var _appReadyTestUtils = require("./appReady.test-utils.js");
5
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
6
+ _vitest.vi.mock("react-native", () => ({
7
+ Platform: {
8
+ OS: "ios"
9
+ }
10
+ }));
11
+ const mocks = _vitest.vi.hoisted(() => {
12
+ Reflect.set(globalThis, "HotUpdater", {
13
+ SDK_VERSION: "test-sdk-version"
14
+ });
15
+ return {
16
+ getAppVersion: _vitest.vi.fn(() => "1.0.0"),
17
+ getBundleId: _vitest.vi.fn(() => "bundle-id"),
18
+ getChannel: _vitest.vi.fn(() => "production"),
19
+ getActiveUpdateState: _vitest.vi.fn(),
20
+ getCohort: _vitest.vi.fn(() => "123"),
21
+ getFingerprintHash: _vitest.vi.fn(() => "fingerprint-hash"),
22
+ getInstallId: _vitest.vi.fn(() => "install-id"),
23
+ getStorageItem: _vitest.vi.fn(() => null),
24
+ setStorageItem: _vitest.vi.fn(),
25
+ readNotifyAppReady: _vitest.vi.fn(() => (0, _appReadyTestUtils.createNotifyReadResult)())
26
+ };
27
+ });
28
+ _vitest.vi.mock("./native", () => mocks);
29
+ const recordingPlugin = (hooks = events => ({
30
+ onAppReady: result => {
31
+ events.push(["onAppReady", result]);
32
+ },
33
+ onBundleDownloaded: info => {
34
+ events.push(["onBundleDownloaded", info]);
35
+ }
36
+ })) => {
37
+ const events = [];
38
+ const plugin = {
39
+ id: "recorder",
40
+ setup: () => hooks(events)
41
+ };
42
+ return {
43
+ events,
44
+ plugin
45
+ };
46
+ };
47
+ const configure = async (plugins, onError) => {
48
+ const {
49
+ configurePlugins
50
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./pluginHost")));
51
+ configurePlugins(plugins, {
52
+ baseURL: "https://updates.example.com",
53
+ ...(onError ? {
54
+ onError
55
+ } : {})
56
+ });
57
+ };
58
+ (0, _vitest.describe)("app-ready reporting to plugins", () => {
59
+ (0, _vitest.beforeEach)(() => {
60
+ _vitest.vi.resetModules();
61
+ _vitest.vi.unstubAllGlobals();
62
+ _vitest.vi.useRealTimers();
63
+ for (const mock of Object.values(mocks)) mock.mockReset();
64
+ mocks.getAppVersion.mockReturnValue("1.0.0");
65
+ mocks.getBundleId.mockReturnValue("bundle-id");
66
+ mocks.getChannel.mockReturnValue("production");
67
+ mocks.getActiveUpdateState.mockReturnValue({
68
+ activeSelection: null,
69
+ stableSelection: null,
70
+ verificationPending: false
71
+ });
72
+ mocks.getCohort.mockReturnValue("123");
73
+ mocks.getFingerprintHash.mockReturnValue("fingerprint-hash");
74
+ mocks.getInstallId.mockReturnValue("install-id");
75
+ mocks.getStorageItem.mockReturnValue(null);
76
+ mocks.readNotifyAppReady.mockReturnValue((0, _appReadyTestUtils.createNotifyReadResult)());
77
+ });
78
+ _vitest.it.each([{
79
+ label: "running selection",
80
+ pending: false,
81
+ channel: "production",
82
+ expected: "release-running"
83
+ }, {
84
+ label: "staged selection",
85
+ pending: true,
86
+ channel: "production",
87
+ expected: "release-running"
88
+ }, {
89
+ label: "another channel",
90
+ pending: false,
91
+ channel: "preview",
92
+ expected: null
93
+ }])("attributes an unchanged launch with $label", async ({
94
+ pending,
95
+ channel,
96
+ expected
97
+ }) => {
98
+ (0, _appReadyTestUtils.stubNotifyFrame)();
99
+ const running = {
100
+ kind: "BUNDLE",
101
+ releaseId: "release-running",
102
+ bundleId: "bundle-id",
103
+ channel
104
+ };
105
+ mocks.getActiveUpdateState.mockReturnValue({
106
+ activeSelection: pending ? {
107
+ ...running,
108
+ releaseId: "release-pending",
109
+ bundleId: "bundle-pending"
110
+ } : running,
111
+ stableSelection: pending ? running : null,
112
+ verificationPending: pending
113
+ });
114
+ const {
115
+ events,
116
+ plugin
117
+ } = recordingPlugin();
118
+ await configure([plugin]);
119
+ const {
120
+ handleNotifyAppReady
121
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
122
+ const readiness = handleNotifyAppReady({});
123
+ await _vitest.vi.runOnlyPendingTimersAsync();
124
+ await readiness;
125
+ (0, _vitest.expect)(events).toEqual([["onAppReady", {
126
+ status: "UNCHANGED",
127
+ channel: "production",
128
+ bundleId: "bundle-id",
129
+ releaseId: expected,
130
+ previousProcessExit: null
131
+ }]]);
132
+ });
133
+ _vitest.it.each(["UPDATE_APPLIED", "RECOVERED"])("reports %s with the persisted transition and calls onNotifyAppReady", async status => {
134
+ (0, _appReadyTestUtils.stubNotifyFrame)();
135
+ mocks.readNotifyAppReady.mockReturnValue((0, _appReadyTestUtils.createNotifyReadResult)({
136
+ status,
137
+ fromBundleId: "bundle-a",
138
+ toBundleId: "bundle-b"
139
+ }, {
140
+ type: status,
141
+ fromBundleId: "bundle-a",
142
+ fromReleaseId: "release-a",
143
+ toBundleId: "bundle-b",
144
+ toReleaseId: "release-b",
145
+ updateStrategy: "fingerprint"
146
+ }));
147
+ const {
148
+ events,
149
+ plugin
150
+ } = recordingPlugin();
151
+ await configure([plugin]);
152
+ const onNotifyAppReady = _vitest.vi.fn();
153
+ const {
154
+ handleNotifyAppReady
155
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
156
+ const readiness = handleNotifyAppReady({
157
+ onNotifyAppReady
158
+ });
159
+ await _vitest.vi.runOnlyPendingTimersAsync();
160
+ await readiness;
161
+ (0, _vitest.expect)(events).toEqual([["onAppReady", {
162
+ status,
163
+ channel: "production",
164
+ fromBundleId: "bundle-a",
165
+ fromReleaseId: "release-a",
166
+ toBundleId: "bundle-b",
167
+ toReleaseId: "release-b",
168
+ updateStrategy: "fingerprint",
169
+ previousProcessExit: null
170
+ }]]);
171
+ (0, _vitest.expect)(onNotifyAppReady).toHaveBeenCalledWith({
172
+ status,
173
+ fromBundleId: "bundle-a",
174
+ toBundleId: "bundle-b"
175
+ });
176
+ });
177
+ (0, _vitest.it)("waits for native launch verification before reporting", async () => {
178
+ (0, _appReadyTestUtils.stubNotifyFrame)();
179
+ mocks.readNotifyAppReady.mockReturnValueOnce((0, _appReadyTestUtils.createNotifyReadResult)(undefined, null, true)).mockReturnValueOnce((0, _appReadyTestUtils.createNotifyReadResult)(undefined, null, true)).mockReturnValue((0, _appReadyTestUtils.createNotifyReadResult)());
180
+ const {
181
+ events,
182
+ plugin
183
+ } = recordingPlugin();
184
+ await configure([plugin]);
185
+ const {
186
+ handleNotifyAppReady
187
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
188
+ const readiness = handleNotifyAppReady({});
189
+ await _vitest.vi.runOnlyPendingTimersAsync();
190
+ (0, _vitest.expect)(events).toEqual([]);
191
+ await _vitest.vi.runAllTimersAsync();
192
+ await readiness;
193
+ (0, _vitest.expect)(mocks.readNotifyAppReady).toHaveBeenCalledTimes(3);
194
+ (0, _vitest.expect)(events).toHaveLength(1);
195
+ });
196
+ (0, _vitest.it)("reports the launch once per runtime while every init call gets readiness", async () => {
197
+ (0, _appReadyTestUtils.stubNotifyFrame)();
198
+ const {
199
+ events,
200
+ plugin
201
+ } = recordingPlugin();
202
+ await configure([plugin]);
203
+ const onNotifyAppReady = _vitest.vi.fn();
204
+ const {
205
+ handleNotifyAppReady
206
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
207
+ const first = handleNotifyAppReady({
208
+ onNotifyAppReady
209
+ });
210
+ const second = handleNotifyAppReady({
211
+ onNotifyAppReady
212
+ });
213
+ await _vitest.vi.runOnlyPendingTimersAsync();
214
+ await Promise.all([first, second]);
215
+ (0, _vitest.expect)(events).toHaveLength(1);
216
+ (0, _vitest.expect)(onNotifyAppReady).toHaveBeenCalledTimes(2);
217
+ });
218
+ (0, _vitest.it)("skips onAppReady for an applied launch without its persisted transition", async () => {
219
+ (0, _appReadyTestUtils.stubNotifyFrame)();
220
+ mocks.readNotifyAppReady.mockReturnValue((0, _appReadyTestUtils.createNotifyReadResult)({
221
+ status: "UPDATE_APPLIED",
222
+ fromBundleId: "bundle-a",
223
+ toBundleId: "bundle-b"
224
+ }, null));
225
+ const {
226
+ events,
227
+ plugin
228
+ } = recordingPlugin();
229
+ await configure([plugin]);
230
+ const onNotifyAppReady = _vitest.vi.fn();
231
+ const {
232
+ handleNotifyAppReady
233
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
234
+ const readiness = handleNotifyAppReady({
235
+ onNotifyAppReady
236
+ });
237
+ await _vitest.vi.runOnlyPendingTimersAsync();
238
+ await readiness;
239
+ (0, _vitest.expect)(events).toEqual([]);
240
+ (0, _vitest.expect)(onNotifyAppReady).toHaveBeenCalledOnce();
241
+ });
242
+ (0, _vitest.it)("reports a throwing or rejecting hook through onError and keeps readiness", async () => {
243
+ (0, _appReadyTestUtils.stubNotifyFrame)();
244
+ const onError = _vitest.vi.fn();
245
+ const throwing = {
246
+ id: "throwing",
247
+ setup: () => ({
248
+ onAppReady: () => {
249
+ throw new Error("hook failed");
250
+ }
251
+ })
252
+ };
253
+ const rejecting = {
254
+ id: "rejecting",
255
+ setup: () => ({
256
+ onAppReady: async () => {
257
+ throw new Error("hook rejected");
258
+ }
259
+ })
260
+ };
261
+ await configure([throwing, rejecting], onError);
262
+ const onNotifyAppReady = _vitest.vi.fn();
263
+ const {
264
+ handleNotifyAppReady
265
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
266
+ const readiness = handleNotifyAppReady({
267
+ onNotifyAppReady
268
+ });
269
+ await _vitest.vi.runOnlyPendingTimersAsync();
270
+ await readiness;
271
+ await _vitest.vi.runAllTimersAsync();
272
+ (0, _vitest.expect)(onNotifyAppReady).toHaveBeenCalledWith({
273
+ status: "UNCHANGED"
274
+ });
275
+ (0, _vitest.expect)(onError).toHaveBeenCalledTimes(2);
276
+ (0, _vitest.expect)(onError).toHaveBeenCalledWith(_vitest.expect.objectContaining({
277
+ message: '[HotUpdater] Plugin "throwing" failed in onAppReady',
278
+ cause: _vitest.expect.objectContaining({
279
+ message: "hook failed"
280
+ })
281
+ }));
282
+ (0, _vitest.expect)(onError).toHaveBeenCalledWith(_vitest.expect.objectContaining({
283
+ message: '[HotUpdater] Plugin "rejecting" failed in onAppReady'
284
+ }));
285
+ });
286
+ (0, _vitest.it)("delivers events after the launch, even when they happen first", async () => {
287
+ (0, _appReadyTestUtils.stubNotifyFrame)();
288
+ const {
289
+ events,
290
+ plugin
291
+ } = recordingPlugin();
292
+ await configure([plugin]);
293
+ const {
294
+ emitAfterAppReady,
295
+ handleNotifyAppReady
296
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
297
+ const readiness = handleNotifyAppReady({});
298
+ emitAfterAppReady("onBundleDownloaded", () => ({
299
+ channel: "production",
300
+ fromBundleId: "bundle-id",
301
+ fromReleaseId: null,
302
+ toBundleId: "next-bundle",
303
+ toReleaseId: "next-release",
304
+ updateStrategy: "appVersion",
305
+ delivery: "manifest",
306
+ patchFallback: false
307
+ }));
308
+ (0, _vitest.expect)(events).toEqual([]);
309
+ await _vitest.vi.runOnlyPendingTimersAsync();
310
+ await readiness;
311
+ await Promise.resolve();
312
+ (0, _vitest.expect)(events.map(event => event[0])).toEqual(["onAppReady", "onBundleDownloaded"]);
313
+ });
314
+ (0, _vitest.it)("passes on why the previous process exited, and keeps it for later events", async () => {
315
+ (0, _appReadyTestUtils.stubNotifyFrame)();
316
+ mocks.readNotifyAppReady.mockReturnValue((0, _appReadyTestUtils.createNotifyReadResult)({
317
+ status: "RECOVERED",
318
+ fromBundleId: "bundle-b",
319
+ toBundleId: "bundle-a"
320
+ }, {
321
+ type: "RECOVERED",
322
+ fromBundleId: "bundle-b",
323
+ fromReleaseId: null,
324
+ toBundleId: "bundle-a",
325
+ toReleaseId: null,
326
+ updateStrategy: "appVersion"
327
+ }, false, "CRASH_NATIVE"));
328
+ const {
329
+ events,
330
+ plugin
331
+ } = recordingPlugin();
332
+ await configure([plugin]);
333
+ const {
334
+ getPreviousProcessExit,
335
+ handleNotifyAppReady
336
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
337
+ (0, _vitest.expect)(getPreviousProcessExit()).toBeNull();
338
+ const readiness = handleNotifyAppReady({});
339
+ await _vitest.vi.runOnlyPendingTimersAsync();
340
+ await readiness;
341
+ (0, _vitest.expect)(events).toEqual([["onAppReady", _vitest.expect.objectContaining({
342
+ status: "RECOVERED",
343
+ previousProcessExit: "CRASH_NATIVE"
344
+ })]]);
345
+ (0, _vitest.expect)(getPreviousProcessExit()).toBe("CRASH_NATIVE");
346
+ });
347
+ (0, _vitest.it)("builds no event when no plugin listens", async () => {
348
+ (0, _appReadyTestUtils.stubNotifyFrame)();
349
+ await configure([]);
350
+ const {
351
+ handleNotifyAppReady
352
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require("./appReady")));
353
+ const readiness = handleNotifyAppReady({});
354
+ await _vitest.vi.runOnlyPendingTimersAsync();
355
+ await readiness;
356
+ (0, _vitest.expect)(mocks.getActiveUpdateState).not.toHaveBeenCalled();
357
+ (0, _vitest.expect)(mocks.getBundleId).not.toHaveBeenCalled();
358
+ });
359
+ });
360
+ //# sourceMappingURL=appReady.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_vitest","require","_appReadyTestUtils","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","vi","mock","Platform","OS","mocks","hoisted","Reflect","globalThis","SDK_VERSION","getAppVersion","fn","getBundleId","getChannel","getActiveUpdateState","getCohort","getFingerprintHash","getInstallId","getStorageItem","setStorageItem","readNotifyAppReady","createNotifyReadResult","recordingPlugin","hooks","events","onAppReady","result","push","onBundleDownloaded","info","plugin","id","setup","configure","plugins","onError","configurePlugins","Promise","resolve","then","baseURL","describe","beforeEach","resetModules","unstubAllGlobals","useRealTimers","values","mockReset","mockReturnValue","activeSelection","stableSelection","verificationPending","it","each","label","pending","channel","expected","stubNotifyFrame","running","kind","releaseId","bundleId","handleNotifyAppReady","readiness","runOnlyPendingTimersAsync","expect","toEqual","status","previousProcessExit","fromBundleId","toBundleId","type","fromReleaseId","toReleaseId","updateStrategy","onNotifyAppReady","toHaveBeenCalledWith","mockReturnValueOnce","undefined","runAllTimersAsync","toHaveBeenCalledTimes","toHaveLength","first","second","all","toHaveBeenCalledOnce","throwing","Error","rejecting","objectContaining","message","cause","emitAfterAppReady","delivery","patchFallback","map","event","getPreviousProcessExit","toBeNull","toBe","not","toHaveBeenCalled"],"sourceRoot":"../../src","sources":["appReady.spec.ts"],"mappings":";;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AAAgF,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAA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gC,sBAAsB,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IAE3C,MAAMnC,SAAS,GAAGD,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM9D,UAAE,CAACgE,yBAAyB,CAAC,CAAC;IACpC,MAAMD,SAAS;IAEf,IAAAE,cAAM,EAAC1C,MAAM,CAAC,CAAC2C,OAAO,CAAC,CACrB,CACE,YAAY,EACZD,cAAM,CAACwB,gBAAgB,CAAC;MACtBtB,MAAM,EAAE,WAAW;MACnBC,mBAAmB,EAAE;IACvB,CAAC,CAAC,CACH,CACF,CAAC;IACF,IAAAH,cAAM,EAACgC,sBAAsB,CAAC,CAAC,CAAC,CAACE,IAAI,CAAC,cAAc,CAAC;EACvD,CAAC,CAAC;EAEF,IAAAhD,UAAE,EAAC,wCAAwC,EAAE,YAAY;IACvD,IAAAM,kCAAe,EAAC,CAAC;IACjB,MAAMzB,SAAS,CAAC,EAAE,CAAC;IACnB,MAAM;MAAE8B;IAAqB,CAAC,GAAG,MAAA1B,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAA1D,uBAAA,CAAAF,OAAA,CAAa,YAAY,GAAC;IAE3D,MAAMqF,SAAS,GAAGD,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM9D,UAAE,CAACgE,yBAAyB,CAAC,CAAC;IACpC,MAAMD,SAAS;IAEf,IAAAE,cAAM,EAAC7D,KAAK,CAACS,oBAAoB,CAAC,CAACuF,GAAG,CAACC,gBAAgB,CAAC,CAAC;IACzD,IAAApC,cAAM,EAAC7D,KAAK,CAACO,WAAW,CAAC,CAACyF,GAAG,CAACC,gBAAgB,CAAC,CAAC;EAClD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -7,8 +7,9 @@ exports.stubNotifyFrame = exports.createNotifyReadResult = void 0;
7
7
  var _vitest = require("vitest");
8
8
  const createNotifyReadResult = (result = {
9
9
  status: "UNCHANGED"
10
- }, insightsEvent = null, pending = false) => ({
11
- insightsEvent,
10
+ }, transition = null, pending = false, previousProcessExit = null) => ({
11
+ transition,
12
+ previousProcessExit,
12
13
  pending,
13
14
  result
14
15
  });
@@ -21,4 +22,4 @@ const stubNotifyFrame = () => {
21
22
  }));
22
23
  };
23
24
  exports.stubNotifyFrame = stubNotifyFrame;
24
- //# sourceMappingURL=notifyAppReadyInsights.test-utils.js.map
25
+ //# sourceMappingURL=appReady.test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_vitest","require","createNotifyReadResult","result","status","transition","pending","previousProcessExit","exports","stubNotifyFrame","vi","useFakeTimers","stubGlobal","fn","callback","setTimeout"],"sourceRoot":"../../src","sources":["appReady.test-utils.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAIO,MAAMC,sBAAsB,GAAGA,CACpCC,MAA4B,GAAG;EAAEC,MAAM,EAAE;AAAY,CAAC,EACtDC,UAAmC,GAAG,IAAI,EAC1CC,OAAO,GAAG,KAAK,EACfC,mBAAkC,GAAG,IAAI,MAMrC;EACJF,UAAU;EACVE,mBAAmB;EACnBD,OAAO;EACPH;AACF,CAAC,CAAC;AAACK,OAAA,CAAAN,sBAAA,GAAAA,sBAAA;AAEI,MAAMO,eAAe,GAAGA,CAAA,KAAM;EACnCC,UAAE,CAACC,aAAa,CAAC,CAAC;EAClBD,UAAE,CAACE,UAAU,CACX,uBAAuB,EACvBF,UAAE,CAACG,EAAE,CAAEC,QAAqC,IAAK;IAC/CC,UAAU,CAAC,MAAMD,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,CAAC;EACV,CAAC,CACH,CAAC;AACH,CAAC;AAACN,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveBaseURL = void 0;
7
+ /** Resolves a functional baseURL and drops trailing slashes. */
8
+ const resolveBaseURL = async baseURL => {
9
+ const resolvedBaseURL = typeof baseURL === "function" ? await baseURL() : baseURL;
10
+ if (!resolvedBaseURL) {
11
+ throw new Error("baseURL function must return a non-empty string");
12
+ }
13
+ return resolvedBaseURL.replace(/\/+$/, "");
14
+ };
15
+ exports.resolveBaseURL = resolveBaseURL;
16
+ //# sourceMappingURL=baseURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["resolveBaseURL","baseURL","resolvedBaseURL","Error","replace","exports"],"sourceRoot":"../../src","sources":["baseURL.ts"],"mappings":";;;;;;AAEA;AACO,MAAMA,cAAc,GAAG,MAC5BC,OAA0B,IACN;EACpB,MAAMC,eAAe,GACnB,OAAOD,OAAO,KAAK,UAAU,GAAG,MAAMA,OAAO,CAAC,CAAC,GAAGA,OAAO;EAE3D,IAAI,CAACC,eAAe,EAAE;IACpB,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;EACpE;EAEA,OAAOD,eAAe,CAACE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;AAC5C,CAAC;AAACC,OAAA,CAAAL,cAAA,GAAAA,cAAA","ignoreList":[]}