@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.
- package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +491 -388
- package/android/src/main/java/com/hotupdater/BundleMetadata.kt +5 -11
- package/android/src/main/java/com/hotupdater/FileManagerService.kt +45 -0
- package/android/src/main/java/com/hotupdater/HotUpdaterException.kt +290 -12
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +35 -19
- package/android/src/main/java/com/hotupdater/InstallIdentityService.kt +37 -0
- package/android/src/main/java/com/hotupdater/KeyValueStorageService.kt +86 -0
- package/android/src/main/java/com/hotupdater/NetworkState.kt +31 -0
- package/android/src/main/java/com/hotupdater/NoBackupStorage.kt +17 -0
- package/android/src/main/java/com/hotupdater/OkHttpDownloadService.kt +110 -52
- package/android/src/main/java/com/hotupdater/PreviousProcessExit.kt +89 -0
- package/android/src/main/java/com/hotupdater/ReactNativeValueConverters.kt +34 -0
- package/android/src/newarch/HotUpdaterModule.kt +74 -69
- package/android/src/oldarch/HotUpdaterModule.kt +63 -59
- package/android/src/oldarch/HotUpdaterSpec.kt +4 -6
- package/android/src/test/java/com/hotupdater/BsdiffPatchTest.kt +1 -1
- package/android/src/test/java/com/hotupdater/BundleFileStorageServiceTest.kt +446 -61
- package/android/src/test/java/com/hotupdater/HotUpdaterExceptionTest.kt +220 -0
- package/android/src/test/java/com/hotupdater/HotUpdaterImplTest.kt +19 -27
- package/android/src/test/java/com/hotupdater/InstallIdentityServiceTest.kt +71 -0
- package/android/src/test/java/com/hotupdater/KeyValueStorageServiceTest.kt +106 -0
- package/android/src/test/java/com/hotupdater/NoBackupContext.kt +11 -0
- package/android/src/test/java/com/hotupdater/OkHttpDownloadServiceTest.kt +309 -23
- package/android/src/test/java/com/hotupdater/PreviousProcessExitTest.kt +57 -0
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +238 -157
- package/ios/HotUpdater/Internal/BundleMetadata.swift +3 -53
- package/ios/HotUpdater/Internal/FileManagerService.swift +48 -0
- package/ios/HotUpdater/Internal/HotUpdater.mm +8 -18
- package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +48 -29
- package/ios/HotUpdater/Internal/KeyValueStorageService.swift +71 -0
- package/ios/HotUpdater/Internal/URLSessionDownloadService.swift +108 -1
- package/ios/HotUpdater/Internal/UpdateFailure.swift +390 -0
- package/lib/commonjs/appReady.js +111 -0
- package/lib/commonjs/appReady.js.map +1 -0
- package/lib/commonjs/appReady.spec.js +360 -0
- package/lib/commonjs/appReady.spec.js.map +1 -0
- package/lib/commonjs/{notifyAppReadyInsights.test-utils.js → appReady.test-utils.js} +4 -3
- package/lib/commonjs/appReady.test-utils.js.map +1 -0
- package/lib/commonjs/baseURL.js +16 -0
- package/lib/commonjs/baseURL.js.map +1 -0
- package/lib/commonjs/checkForUpdate.js +104 -56
- package/lib/commonjs/checkForUpdate.js.map +1 -1
- package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js +337 -74
- package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js.map +1 -1
- package/lib/commonjs/clientPlugin.js +49 -0
- package/lib/commonjs/clientPlugin.js.map +1 -0
- package/lib/commonjs/entryImportGraph.spec.js +50 -0
- package/lib/commonjs/entryImportGraph.spec.js.map +1 -0
- package/lib/commonjs/fetchJSON.js +2 -6
- package/lib/commonjs/fetchJSON.js.map +1 -1
- package/lib/commonjs/httpClient.js +15 -67
- package/lib/commonjs/httpClient.js.map +1 -1
- package/lib/commonjs/httpClient.spec.js +26 -9
- package/lib/commonjs/httpClient.spec.js.map +1 -1
- package/lib/commonjs/index.js +49 -25
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.spec.js +126 -40
- package/lib/commonjs/index.spec.js.map +1 -1
- package/lib/commonjs/native.js +67 -48
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/native.spec.js +80 -58
- package/lib/commonjs/native.spec.js.map +1 -1
- package/lib/commonjs/pluginHost.js +208 -0
- package/lib/commonjs/pluginHost.js.map +1 -0
- package/lib/commonjs/pluginHost.spec.js +292 -0
- package/lib/commonjs/pluginHost.spec.js.map +1 -0
- package/lib/commonjs/plugins/insights/eventId.js +129 -0
- package/lib/commonjs/plugins/insights/eventId.js.map +1 -0
- package/lib/commonjs/plugins/insights/eventId.spec.js +47 -0
- package/lib/commonjs/plugins/insights/eventId.spec.js.map +1 -0
- package/lib/commonjs/plugins/insights/index.js +272 -0
- package/lib/commonjs/plugins/insights/index.js.map +1 -0
- package/lib/commonjs/plugins/insights/insights.spec.js +640 -0
- package/lib/commonjs/plugins/insights/insights.spec.js.map +1 -0
- package/lib/commonjs/plugins/insights/sender.js +128 -0
- package/lib/commonjs/plugins/insights/sender.js.map +1 -0
- package/lib/commonjs/plugins/insights/sender.spec.js +265 -0
- package/lib/commonjs/plugins/insights/sender.spec.js.map +1 -0
- package/lib/commonjs/plugins/insights/state.js +145 -0
- package/lib/commonjs/plugins/insights/state.js.map +1 -0
- package/lib/commonjs/releaseCatalogCache.js +13 -2
- package/lib/commonjs/releaseCatalogCache.js.map +1 -1
- package/lib/commonjs/releaseCatalogCache.spec.js +18 -0
- package/lib/commonjs/releaseCatalogCache.spec.js.map +1 -1
- package/lib/commonjs/sdkVersion.js +1 -1
- package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
- package/lib/commonjs/updateError.js +132 -0
- package/lib/commonjs/updateError.js.map +1 -0
- package/lib/commonjs/updateError.spec.js +149 -0
- package/lib/commonjs/updateError.spec.js.map +1 -0
- package/lib/commonjs/wrap.js +43 -25
- package/lib/commonjs/wrap.js.map +1 -1
- package/lib/commonjs/wrap.progress.spec.js +195 -0
- package/lib/commonjs/wrap.progress.spec.js.map +1 -0
- package/lib/commonjs/wrap.spec.js +94 -230
- package/lib/commonjs/wrap.spec.js.map +1 -1
- package/lib/module/appReady.js +103 -0
- package/lib/module/appReady.js.map +1 -0
- package/lib/module/appReady.spec.js +359 -0
- package/lib/module/appReady.spec.js.map +1 -0
- package/lib/module/{notifyAppReadyInsights.test-utils.js → appReady.test-utils.js} +4 -3
- package/lib/module/appReady.test-utils.js.map +1 -0
- package/lib/module/baseURL.js +11 -0
- package/lib/module/baseURL.js.map +1 -0
- package/lib/module/checkForUpdate.js +103 -57
- package/lib/module/checkForUpdate.js.map +1 -1
- package/lib/module/checkForUpdate.releaseCatalog.spec.js +337 -74
- package/lib/module/checkForUpdate.releaseCatalog.spec.js.map +1 -1
- package/lib/module/clientPlugin.js +44 -0
- package/lib/module/clientPlugin.js.map +1 -0
- package/lib/module/entryImportGraph.spec.js +50 -0
- package/lib/module/entryImportGraph.spec.js.map +1 -0
- package/lib/module/fetchJSON.js +2 -6
- package/lib/module/fetchJSON.js.map +1 -1
- package/lib/module/httpClient.js +14 -66
- package/lib/module/httpClient.js.map +1 -1
- package/lib/module/httpClient.spec.js +26 -9
- package/lib/module/httpClient.spec.js.map +1 -1
- package/lib/module/index.js +44 -27
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.spec.js +127 -41
- package/lib/module/index.spec.js.map +1 -1
- package/lib/module/native.js +63 -44
- package/lib/module/native.js.map +1 -1
- package/lib/module/native.spec.js +80 -58
- package/lib/module/native.spec.js.map +1 -1
- package/lib/module/pluginHost.js +200 -0
- package/lib/module/pluginHost.js.map +1 -0
- package/lib/module/pluginHost.spec.js +291 -0
- package/lib/module/pluginHost.spec.js.map +1 -0
- package/lib/module/plugins/insights/eventId.js +122 -0
- package/lib/module/plugins/insights/eventId.js.map +1 -0
- package/lib/module/plugins/insights/eventId.spec.js +47 -0
- package/lib/module/plugins/insights/eventId.spec.js.map +1 -0
- package/lib/module/plugins/insights/index.js +268 -0
- package/lib/module/plugins/insights/index.js.map +1 -0
- package/lib/module/plugins/insights/insights.spec.js +639 -0
- package/lib/module/plugins/insights/insights.spec.js.map +1 -0
- package/lib/module/plugins/insights/sender.js +123 -0
- package/lib/module/plugins/insights/sender.js.map +1 -0
- package/lib/module/plugins/insights/sender.spec.js +265 -0
- package/lib/module/plugins/insights/sender.spec.js.map +1 -0
- package/lib/module/plugins/insights/state.js +139 -0
- package/lib/module/plugins/insights/state.js.map +1 -0
- package/lib/module/releaseCatalogCache.js +13 -2
- package/lib/module/releaseCatalogCache.js.map +1 -1
- package/lib/module/releaseCatalogCache.spec.js +18 -0
- package/lib/module/releaseCatalogCache.spec.js.map +1 -1
- package/lib/module/sdkVersion.js +1 -1
- package/lib/module/specs/NativeHotUpdater.js.map +1 -1
- package/lib/module/updateError.js +126 -0
- package/lib/module/updateError.js.map +1 -0
- package/lib/module/updateError.spec.js +149 -0
- package/lib/module/updateError.spec.js.map +1 -0
- package/lib/module/wrap.js +43 -25
- package/lib/module/wrap.js.map +1 -1
- package/lib/module/wrap.progress.spec.js +196 -0
- package/lib/module/wrap.progress.spec.js.map +1 -0
- package/lib/module/wrap.spec.js +93 -229
- package/lib/module/wrap.spec.js.map +1 -1
- package/lib/typescript/commonjs/appReady.d.ts +23 -0
- package/lib/typescript/commonjs/appReady.d.ts.map +1 -0
- package/lib/typescript/commonjs/appReady.test-utils.d.ts +9 -0
- package/lib/typescript/commonjs/appReady.test-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/baseURL.d.ts +4 -0
- package/lib/typescript/commonjs/baseURL.d.ts.map +1 -0
- package/lib/typescript/commonjs/checkForUpdate.d.ts +15 -2
- package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/commonjs/clientPlugin.d.ts +185 -0
- package/lib/typescript/commonjs/clientPlugin.d.ts.map +1 -0
- package/lib/typescript/commonjs/fetchJSON.d.ts +2 -3
- package/lib/typescript/commonjs/fetchJSON.d.ts.map +1 -1
- package/lib/typescript/commonjs/httpClient.d.ts +2 -30
- package/lib/typescript/commonjs/httpClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -6
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/native.d.ts +29 -15
- package/lib/typescript/commonjs/native.d.ts.map +1 -1
- package/lib/typescript/commonjs/pluginHost.d.ts +29 -0
- package/lib/typescript/commonjs/pluginHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugins/insights/eventId.d.ts +18 -0
- package/lib/typescript/commonjs/plugins/insights/eventId.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugins/insights/index.d.ts +40 -0
- package/lib/typescript/commonjs/plugins/insights/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugins/insights/sender.d.ts +74 -0
- package/lib/typescript/commonjs/plugins/insights/sender.d.ts.map +1 -0
- package/lib/typescript/commonjs/plugins/insights/state.d.ts +46 -0
- package/lib/typescript/commonjs/plugins/insights/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/releaseCatalogCache.d.ts +5 -1
- package/lib/typescript/commonjs/releaseCatalogCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/sdkVersion.d.ts +1 -1
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +34 -12
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/commonjs/updateError.d.ts +26 -0
- package/lib/typescript/commonjs/updateError.d.ts.map +1 -0
- package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
- package/lib/typescript/commonjs/wrap.types.d.ts +6 -5
- package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -1
- package/lib/typescript/module/appReady.d.ts +23 -0
- package/lib/typescript/module/appReady.d.ts.map +1 -0
- package/lib/typescript/module/appReady.test-utils.d.ts +9 -0
- package/lib/typescript/module/appReady.test-utils.d.ts.map +1 -0
- package/lib/typescript/module/baseURL.d.ts +4 -0
- package/lib/typescript/module/baseURL.d.ts.map +1 -0
- package/lib/typescript/module/checkForUpdate.d.ts +15 -2
- package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/module/clientPlugin.d.ts +185 -0
- package/lib/typescript/module/clientPlugin.d.ts.map +1 -0
- package/lib/typescript/module/fetchJSON.d.ts +2 -3
- package/lib/typescript/module/fetchJSON.d.ts.map +1 -1
- package/lib/typescript/module/httpClient.d.ts +2 -30
- package/lib/typescript/module/httpClient.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -6
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/native.d.ts +29 -15
- package/lib/typescript/module/native.d.ts.map +1 -1
- package/lib/typescript/module/pluginHost.d.ts +29 -0
- package/lib/typescript/module/pluginHost.d.ts.map +1 -0
- package/lib/typescript/module/plugins/insights/eventId.d.ts +18 -0
- package/lib/typescript/module/plugins/insights/eventId.d.ts.map +1 -0
- package/lib/typescript/module/plugins/insights/index.d.ts +40 -0
- package/lib/typescript/module/plugins/insights/index.d.ts.map +1 -0
- package/lib/typescript/module/plugins/insights/sender.d.ts +74 -0
- package/lib/typescript/module/plugins/insights/sender.d.ts.map +1 -0
- package/lib/typescript/module/plugins/insights/state.d.ts +46 -0
- package/lib/typescript/module/plugins/insights/state.d.ts.map +1 -0
- package/lib/typescript/module/releaseCatalogCache.d.ts +5 -1
- package/lib/typescript/module/releaseCatalogCache.d.ts.map +1 -1
- package/lib/typescript/module/sdkVersion.d.ts +1 -1
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts +34 -12
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/module/updateError.d.ts +26 -0
- package/lib/typescript/module/updateError.d.ts.map +1 -0
- package/lib/typescript/module/wrap.d.ts.map +1 -1
- package/lib/typescript/module/wrap.types.d.ts +6 -5
- package/lib/typescript/module/wrap.types.d.ts.map +1 -1
- package/package.json +14 -2
- package/plugins/insights/package.json +8 -0
- package/src/appReady.spec.ts +393 -0
- package/src/{notifyAppReadyInsights.test-utils.ts → appReady.test-utils.ts} +7 -7
- package/src/appReady.ts +149 -0
- package/src/baseURL.ts +15 -0
- package/src/checkForUpdate.releaseCatalog.spec.ts +370 -76
- package/src/checkForUpdate.ts +135 -80
- package/src/clientPlugin.ts +231 -0
- package/src/entryImportGraph.spec.ts +65 -0
- package/src/fetchJSON.ts +3 -10
- package/src/httpClient.spec.ts +28 -9
- package/src/httpClient.ts +16 -109
- package/src/index.spec.ts +129 -36
- package/src/index.ts +67 -37
- package/src/native.spec.ts +98 -72
- package/src/native.ts +93 -77
- package/src/pluginHost.spec.ts +297 -0
- package/src/pluginHost.ts +262 -0
- package/src/plugins/insights/eventId.spec.ts +60 -0
- package/src/plugins/insights/eventId.ts +171 -0
- package/src/plugins/insights/index.ts +367 -0
- package/src/plugins/insights/insights.spec.ts +732 -0
- package/src/plugins/insights/sender.spec.ts +287 -0
- package/src/plugins/insights/sender.ts +221 -0
- package/src/plugins/insights/state.ts +184 -0
- package/src/releaseCatalogCache.spec.ts +22 -0
- package/src/releaseCatalogCache.ts +19 -4
- package/src/sdkVersion.ts +1 -1
- package/src/specs/NativeHotUpdater.ts +34 -13
- package/src/updateError.spec.ts +144 -0
- package/src/updateError.ts +153 -0
- package/src/wrap.progress.spec.ts +232 -0
- package/src/wrap.spec.ts +100 -283
- package/src/wrap.tsx +57 -26
- package/src/wrap.types.ts +6 -5
- package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js +0 -225
- package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.js +0 -188
- package/lib/commonjs/notifyAppReadyInsights.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.spec.js +0 -378
- package/lib/commonjs/notifyAppReadyInsights.spec.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.test-utils.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.transport.spec.js +0 -124
- package/lib/commonjs/notifyAppReadyInsights.transport.spec.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.boundary.spec.js +0 -224
- package/lib/module/notifyAppReadyInsights.boundary.spec.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.js +0 -181
- package/lib/module/notifyAppReadyInsights.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.spec.js +0 -377
- package/lib/module/notifyAppReadyInsights.spec.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.test-utils.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.transport.spec.js +0 -123
- package/lib/module/notifyAppReadyInsights.transport.spec.js.map +0 -1
- package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts +0 -25
- package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts.map +0 -1
- package/lib/typescript/commonjs/notifyAppReadyInsights.test-utils.d.ts +0 -8
- package/lib/typescript/commonjs/notifyAppReadyInsights.test-utils.d.ts.map +0 -1
- package/lib/typescript/module/notifyAppReadyInsights.d.ts +0 -25
- package/lib/typescript/module/notifyAppReadyInsights.d.ts.map +0 -1
- package/lib/typescript/module/notifyAppReadyInsights.test-utils.d.ts +0 -8
- package/lib/typescript/module/notifyAppReadyInsights.test-utils.d.ts.map +0 -1
- package/src/notifyAppReadyInsights.boundary.spec.ts +0 -242
- package/src/notifyAppReadyInsights.spec.ts +0 -362
- package/src/notifyAppReadyInsights.transport.spec.ts +0 -138
- package/src/notifyAppReadyInsights.ts +0 -293
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { isUUIDv7 } from "@hot-updater/core";
|
|
5
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { createKeyedUUIDv7, createUUIDv7, sha256 } from "./eventId.js";
|
|
7
|
+
describe("createUUIDv7", () => {
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
vi.useRealTimers();
|
|
10
|
+
vi.unstubAllGlobals();
|
|
11
|
+
});
|
|
12
|
+
it.each([{
|
|
13
|
+
label: "Web Crypto",
|
|
14
|
+
crypto: globalThis.crypto
|
|
15
|
+
}, {
|
|
16
|
+
label: "no Web Crypto, as in React Native",
|
|
17
|
+
crypto: undefined
|
|
18
|
+
}])("leads with the 48-bit millisecond time using $label", ({
|
|
19
|
+
crypto
|
|
20
|
+
}) => {
|
|
21
|
+
vi.useFakeTimers({
|
|
22
|
+
now: 0x0192_3456_789a
|
|
23
|
+
});
|
|
24
|
+
vi.stubGlobal("crypto", crypto);
|
|
25
|
+
const id = createUUIDv7();
|
|
26
|
+
expect(isUUIDv7(id)).toBe(true);
|
|
27
|
+
expect(id.startsWith("01923456-789a-7")).toBe(true);
|
|
28
|
+
expect(createUUIDv7()).not.toBe(id);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("sha256", () => {
|
|
32
|
+
it.each(["", "abc", "a".repeat(55), "a".repeat(56), "a".repeat(64), "a".repeat(1_000), "install-id\n2026-09-30\ndownload hash_mismatch bundle-id", "한글 및 이모지 😀"])("matches Node's SHA-256 for %j", value => {
|
|
33
|
+
expect(Buffer.from(sha256(value)).toString("hex")).toBe(createHash("sha256").update(value, "utf8").digest("hex"));
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("createKeyedUUIDv7", () => {
|
|
37
|
+
it("gives one UUIDv7 per key and time, led by that time", () => {
|
|
38
|
+
const midnight = Date.UTC(2026, 8, 30);
|
|
39
|
+
const id = createKeyedUUIDv7("install-id\nfailure", midnight);
|
|
40
|
+
expect(isUUIDv7(id)).toBe(true);
|
|
41
|
+
expect(parseInt(id.replace(/-/g, "").slice(0, 12), 16)).toBe(midnight);
|
|
42
|
+
expect(createKeyedUUIDv7("install-id\nfailure", midnight)).toBe(id);
|
|
43
|
+
expect(createKeyedUUIDv7("install-id\nother", midnight)).not.toBe(id);
|
|
44
|
+
expect(createKeyedUUIDv7("install-id\nfailure", midnight + 86_400_000)).not.toBe(id);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=eventId.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createHash","isUUIDv7","afterEach","describe","expect","it","vi","createKeyedUUIDv7","createUUIDv7","sha256","useRealTimers","unstubAllGlobals","each","label","crypto","globalThis","undefined","useFakeTimers","now","stubGlobal","id","toBe","startsWith","not","repeat","value","Buffer","from","toString","update","digest","midnight","Date","UTC","parseInt","replace","slice"],"sourceRoot":"../../../../src","sources":["plugins/insights/eventId.spec.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE5D,SAASC,iBAAiB,EAAEC,YAAY,EAAEC,MAAM,QAAQ,cAAW;AAEnEN,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC7BD,SAAS,CAAC,MAAM;IACdI,EAAE,CAACI,aAAa,CAAC,CAAC;IAClBJ,EAAE,CAACK,gBAAgB,CAAC,CAAC;EACvB,CAAC,CAAC;EAEFN,EAAE,CAACO,IAAI,CAAC,CACN;IAAEC,KAAK,EAAE,YAAY;IAAEC,MAAM,EAAEC,UAAU,CAACD;EAAO,CAAC,EAClD;IAAED,KAAK,EAAE,mCAAmC;IAAEC,MAAM,EAAEE;EAAU,CAAC,CAClE,CAAC,CAAC,qDAAqD,EAAE,CAAC;IAAEF;EAAO,CAAC,KAAK;IACxER,EAAE,CAACW,aAAa,CAAC;MAAEC,GAAG,EAAE;IAAiB,CAAC,CAAC;IAC3CZ,EAAE,CAACa,UAAU,CAAC,QAAQ,EAAEL,MAAM,CAAC;IAE/B,MAAMM,EAAE,GAAGZ,YAAY,CAAC,CAAC;IAEzBJ,MAAM,CAACH,QAAQ,CAACmB,EAAE,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;IAC/BjB,MAAM,CAACgB,EAAE,CAACE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAACD,IAAI,CAAC,IAAI,CAAC;IACnDjB,MAAM,CAACI,YAAY,CAAC,CAAC,CAAC,CAACe,GAAG,CAACF,IAAI,CAACD,EAAE,C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CAACV,IAAI,CAACD,EAAE,CAAC;IACnEhB,MAAM,CAACG,iBAAiB,CAAC,mBAAmB,EAAEwB,QAAQ,CAAC,CAAC,CAACR,GAAG,CAACF,IAAI,CAACD,EAAE,CAAC;IACrEhB,MAAM,CACJG,iBAAiB,CAAC,qBAAqB,EAAEwB,QAAQ,GAAG,UAAU,CAChE,CAAC,CAACR,GAAG,CAACF,IAAI,CAACD,EAAE,CAAC;EAChB,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { defineClientPlugin } from "../../clientPlugin.js";
|
|
4
|
+
import { createKeyedUUIDv7, createUUIDv7 } from "./eventId.js";
|
|
5
|
+
import { createInsightsEventSender } from "./sender.js";
|
|
6
|
+
import { createInsightsState, utcDay, utcDayStart } from "./state.js";
|
|
7
|
+
|
|
8
|
+
/** The app's own id for the signed-in user, attached to later reports. */
|
|
9
|
+
|
|
10
|
+
/** A report the plugin built, with what the gate needs to decide on it. */
|
|
11
|
+
|
|
12
|
+
const normalizeUserId = user => {
|
|
13
|
+
if (user === null) return null;
|
|
14
|
+
const userId = String(user.userId).trim();
|
|
15
|
+
return userId.length === 0 ? null : userId;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Reports update adoption to a server that runs the `insights()` server
|
|
20
|
+
* plugin: launches (at most once a UTC day while nothing changes), downloads,
|
|
21
|
+
* applies, recoveries, and update failures. After the server answers that
|
|
22
|
+
* Insights is off, the plugin sends nothing for 24 hours, and for the rest
|
|
23
|
+
* of that runtime.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { HotUpdater } from "@hot-updater/react-native";
|
|
28
|
+
* import { insights } from "@hot-updater/react-native/plugins/insights";
|
|
29
|
+
*
|
|
30
|
+
* const analytics = insights();
|
|
31
|
+
* HotUpdater.init({ baseURL, plugins: [analytics] });
|
|
32
|
+
* analytics.setUser({ userId: "user-123" });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export const insights = (options = {}) => {
|
|
36
|
+
let context = null;
|
|
37
|
+
let state = null;
|
|
38
|
+
/** A user set before setup, applied once the plugin has storage. */
|
|
39
|
+
let pendingUser = null;
|
|
40
|
+
/** A download in this runtime: a later no-change report would hide it. */
|
|
41
|
+
let didDownload = false;
|
|
42
|
+
let lastDownloadedSelection = null;
|
|
43
|
+
const pending = new Map();
|
|
44
|
+
let send = null;
|
|
45
|
+
const createEvent = (movement, eventId) => {
|
|
46
|
+
if (context === null || state === null) return null;
|
|
47
|
+
const appVersion = context.appVersion;
|
|
48
|
+
if (appVersion === null) {
|
|
49
|
+
console.warn(`[HotUpdater] Insights needs the native app version; the ${movement.type} event was not sent.`);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const now = context.now();
|
|
53
|
+
const installId = context.installId;
|
|
54
|
+
const userId = state.readUserId();
|
|
55
|
+
const body = {
|
|
56
|
+
...movement,
|
|
57
|
+
eventId: eventId?.(now, installId) ?? createUUIDv7(),
|
|
58
|
+
installId,
|
|
59
|
+
...(userId === null ? {} : {
|
|
60
|
+
userId
|
|
61
|
+
}),
|
|
62
|
+
platform: context.platform,
|
|
63
|
+
appVersion,
|
|
64
|
+
cohort: context.getCohort(),
|
|
65
|
+
fingerprintHash: context.getFingerprintHash(),
|
|
66
|
+
sdkVersion: context.sdkVersion
|
|
67
|
+
};
|
|
68
|
+
const day = utcDay(now);
|
|
69
|
+
return {
|
|
70
|
+
body,
|
|
71
|
+
day,
|
|
72
|
+
report: movement.type === "UNCHANGED" || movement.type === "UPDATE_APPLIED" || movement.type === "RECOVERED" ? {
|
|
73
|
+
day,
|
|
74
|
+
channel: movement.channel,
|
|
75
|
+
appVersion,
|
|
76
|
+
bundleId: movement.toBundleId,
|
|
77
|
+
releaseId: movement.toReleaseId,
|
|
78
|
+
userId
|
|
79
|
+
} : null,
|
|
80
|
+
failureKey: null
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const enqueue = event => {
|
|
84
|
+
if (event === null || send === null) return;
|
|
85
|
+
const {
|
|
86
|
+
type,
|
|
87
|
+
toBundleId
|
|
88
|
+
} = event.body;
|
|
89
|
+
if (type === "UPDATE_DOWNLOADED" || type === "UPDATE_APPLIED") {
|
|
90
|
+
// A failure for a target that then arrived no longer describes it.
|
|
91
|
+
for (const queued of pending.values()) {
|
|
92
|
+
if (queued.body.type === "UPDATE_FAILED" && queued.body.toBundleId === toBundleId) {
|
|
93
|
+
queued.superseded = true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
pending.set(event.body, event);
|
|
98
|
+
void send(event.body).catch(error => {
|
|
99
|
+
console.warn(`[HotUpdater] Insights ${event.body.type} event was not delivered:`, error);
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
const reportLaunch = (channel, bundleId, releaseId, fromReleaseId) => {
|
|
103
|
+
// After a download the server shows the update as waiting; a later
|
|
104
|
+
// no-change report from this runtime would hide it.
|
|
105
|
+
if (didDownload) return;
|
|
106
|
+
enqueue(createEvent({
|
|
107
|
+
type: "UNCHANGED",
|
|
108
|
+
channel,
|
|
109
|
+
fromBundleId: null,
|
|
110
|
+
fromReleaseId,
|
|
111
|
+
toBundleId: bundleId,
|
|
112
|
+
toReleaseId: releaseId,
|
|
113
|
+
updateStrategy: null
|
|
114
|
+
}));
|
|
115
|
+
};
|
|
116
|
+
const onAppReady = result => {
|
|
117
|
+
if (result.status === "UNCHANGED") {
|
|
118
|
+
reportLaunch(result.channel, result.bundleId, result.releaseId, null);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
enqueue(createEvent({
|
|
122
|
+
type: result.status,
|
|
123
|
+
channel: result.channel,
|
|
124
|
+
fromBundleId: result.fromBundleId,
|
|
125
|
+
fromReleaseId: result.fromReleaseId,
|
|
126
|
+
toBundleId: result.toBundleId,
|
|
127
|
+
toReleaseId: result.toReleaseId,
|
|
128
|
+
updateStrategy: result.updateStrategy,
|
|
129
|
+
// Tells a crash from the system or the user closing the app.
|
|
130
|
+
...(result.status === "RECOVERED" && result.previousProcessExit !== null ? {
|
|
131
|
+
metadata: {
|
|
132
|
+
previousProcessExit: result.previousProcessExit
|
|
133
|
+
}
|
|
134
|
+
} : {})
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
const onUpdateCheck = result => {
|
|
138
|
+
if (result.status !== "UNCHANGED") return;
|
|
139
|
+
reportLaunch(result.channel, result.bundleId, result.releaseId, result.previousReleaseId === result.releaseId ? null : result.previousReleaseId);
|
|
140
|
+
};
|
|
141
|
+
const onBundleDownloaded = info => {
|
|
142
|
+
const selection = JSON.stringify([info.channel, info.toReleaseId, info.toBundleId]);
|
|
143
|
+
if (lastDownloadedSelection === selection) return;
|
|
144
|
+
lastDownloadedSelection = selection;
|
|
145
|
+
didDownload = true;
|
|
146
|
+
enqueue(createEvent({
|
|
147
|
+
type: "UPDATE_DOWNLOADED",
|
|
148
|
+
channel: info.channel,
|
|
149
|
+
fromBundleId: info.fromBundleId,
|
|
150
|
+
fromReleaseId: info.fromReleaseId,
|
|
151
|
+
toBundleId: info.toBundleId,
|
|
152
|
+
toReleaseId: info.toReleaseId,
|
|
153
|
+
updateStrategy: info.updateStrategy,
|
|
154
|
+
metadata: {
|
|
155
|
+
delivery: info.delivery,
|
|
156
|
+
...(info.patchFallback ? {
|
|
157
|
+
patchFallback: true
|
|
158
|
+
} : {})
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
};
|
|
162
|
+
const onUpdateError = error => {
|
|
163
|
+
// A check that could not reach the server means the device is offline,
|
|
164
|
+
// and its report would not arrive either.
|
|
165
|
+
if (error.stage === "check" && error.reason === "network") return;
|
|
166
|
+
const targetBundleId = error.targetBundleId ?? error.bundleId;
|
|
167
|
+
const failureKey = [error.stage, error.reason, targetBundleId].join(" ");
|
|
168
|
+
const event = createEvent({
|
|
169
|
+
type: "UPDATE_FAILED",
|
|
170
|
+
channel: error.channel,
|
|
171
|
+
fromBundleId: error.bundleId,
|
|
172
|
+
fromReleaseId: error.releaseId,
|
|
173
|
+
toBundleId: targetBundleId,
|
|
174
|
+
toReleaseId: error.targetReleaseId ?? null,
|
|
175
|
+
updateStrategy: error.updateStrategy,
|
|
176
|
+
metadata: {
|
|
177
|
+
failure: {
|
|
178
|
+
stage: error.stage,
|
|
179
|
+
reason: error.reason,
|
|
180
|
+
...(error.resource === undefined ? {} : {
|
|
181
|
+
resource: error.resource
|
|
182
|
+
}),
|
|
183
|
+
...(error.httpStatus === undefined ? {} : {
|
|
184
|
+
httpStatus: error.httpStatus
|
|
185
|
+
}),
|
|
186
|
+
...(error.transport === undefined ? {} : {
|
|
187
|
+
transport: error.transport
|
|
188
|
+
}),
|
|
189
|
+
...(error.originCode === undefined ? {} : {
|
|
190
|
+
originCode: error.originCode
|
|
191
|
+
}),
|
|
192
|
+
...(error.previousProcessExit === undefined ? {} : {
|
|
193
|
+
previousProcessExit: error.previousProcessExit
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
// One id per installation, UTC day, and failure, so the server
|
|
199
|
+
// stores a repeated failure once.
|
|
200
|
+
(now, installId) => createKeyedUUIDv7([installId, utcDay(now), failureKey].join("\n"), utcDayStart(now)));
|
|
201
|
+
enqueue(event === null ? null : {
|
|
202
|
+
...event,
|
|
203
|
+
failureKey
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
const admit = body => {
|
|
207
|
+
const event = pending.get(body);
|
|
208
|
+
if (event === undefined || state === null || context === null) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
if (event.superseded === true || state.isPaused(context.now())) {
|
|
212
|
+
pending.delete(body);
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
const admitted = body.type === "UNCHANGED" ? event.report === null || !state.repeatsReport(event.report) : body.type === "UPDATE_FAILED" ? event.failureKey === null || !state.hasFailure(event.day, event.failureKey) : true;
|
|
216
|
+
if (!admitted) pending.delete(body);
|
|
217
|
+
return admitted;
|
|
218
|
+
};
|
|
219
|
+
const settle = (body, delivery) => {
|
|
220
|
+
const event = pending.get(body);
|
|
221
|
+
pending.delete(body);
|
|
222
|
+
if (event === undefined || state === null || context === null) return;
|
|
223
|
+
if (delivery === "failed") return;
|
|
224
|
+
if (delivery === "disabled") {
|
|
225
|
+
state.pause(context.now());
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (event.failureKey !== null) {
|
|
229
|
+
state.recordFailure(event.day, event.failureKey);
|
|
230
|
+
}
|
|
231
|
+
if (delivery === "refused") return;
|
|
232
|
+
state.resume();
|
|
233
|
+
if (event.report !== null) state.recordReport(event.report);else state.forgetReport();
|
|
234
|
+
};
|
|
235
|
+
return defineClientPlugin({
|
|
236
|
+
id: "insights",
|
|
237
|
+
setup(pluginContext) {
|
|
238
|
+
context = pluginContext;
|
|
239
|
+
state = createInsightsState(pluginContext.storage);
|
|
240
|
+
if (pendingUser !== null) {
|
|
241
|
+
state.writeUserId(pendingUser.userId);
|
|
242
|
+
pendingUser = null;
|
|
243
|
+
}
|
|
244
|
+
if (pluginContext.isDebugBuild && options.debug !== true) return;
|
|
245
|
+
send = createInsightsEventSender(pluginContext.fetch, {
|
|
246
|
+
admit,
|
|
247
|
+
settle
|
|
248
|
+
});
|
|
249
|
+
return {
|
|
250
|
+
onAppReady,
|
|
251
|
+
onUpdateCheck,
|
|
252
|
+
onBundleDownloaded,
|
|
253
|
+
onUpdateError
|
|
254
|
+
};
|
|
255
|
+
},
|
|
256
|
+
setUser(user) {
|
|
257
|
+
const userId = normalizeUserId(user);
|
|
258
|
+
if (state === null) {
|
|
259
|
+
pendingUser = {
|
|
260
|
+
userId
|
|
261
|
+
};
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
state.writeUserId(userId);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defineClientPlugin","createKeyedUUIDv7","createUUIDv7","createInsightsEventSender","createInsightsState","utcDay","utcDayStart","normalizeUserId","user","userId","String","trim","length","insights","options","context","state","pendingUser","didDownload","lastDownloadedSelection","pending","Map","send","createEvent","movement","eventId","appVersion","console","warn","type","now","installId","readUserId","body","platform","cohort","getCohort","fingerprintHash","getFingerprintHash","sdkVersion","day","report","channel","bundleId","toBundleId","releaseId","toReleaseId","failureKey","enqueue","event","queued","values","superseded","set","catch","error","reportLaunch","fromReleaseId","fromBundleId","updateStrategy","onAppReady","result","status","previousProcessExit","metadata","onUpdateCheck","previousReleaseId","onBundleDownloaded","info","selection","JSON","stringify","delivery","patchFallback","onUpdateError","stage","reason","targetBundleId","join","targetReleaseId","failure","resource","undefined","httpStatus","transport","originCode","admit","get","isPaused","delete","admitted","repeatsReport","hasFailure","settle","pause","recordFailure","resume","recordReport","forgetReport","id","setup","pluginContext","storage","writeUserId","isDebugBuild","debug","fetch","setUser"],"sourceRoot":"../../../../src","sources":["plugins/insights/index.ts"],"mappings":";;AAAA,SACEA,kBAAkB,QAOb,uBAAoB;AAC3B,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,cAAW;AAC3D,SACEC,yBAAyB,QAIpB,aAAU;AACjB,SACEC,mBAAmB,EAGnBC,MAAM,EACNC,WAAW,QACN,YAAS;;AAUhB;;AA2BA;;AAYA,MAAMC,eAAe,GAAIC,IAAyB,IAAoB;EACpE,IAAIA,IAAI,KAAK,IAAI,EAAE,OAAO,IAAI;EAC9B,MAAMC,MAAM,GAAGC,MAAM,CAACF,IAAI,CAACC,MAAM,CAAC,CAACE,IAAI,CAAC,CAAC;EACzC,OAAOF,MAAM,CAACG,MAAM,KAAK,CAAC,GAAG,IAAI,GAAGH,MAAM;AAC5C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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