@hot-updater/react-native 1.0.0-rc.4 → 1.0.0-rc.40
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/build.gradle +13 -2
- package/android/proguard-rules.pro +8 -2
- package/android/src/bridge/BridgeReactInstance.kt +38 -0
- package/android/src/bridgeless/BridgeReactInstance.kt +24 -0
- package/android/src/main/java/com/hotupdater/ActivityStartGate.kt +94 -0
- package/android/src/main/java/com/hotupdater/BuiltInAssetResolver.kt +286 -0
- package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +1064 -844
- package/android/src/main/java/com/hotupdater/BundleMetadata.kt +50 -11
- package/android/src/main/java/com/hotupdater/FileManagerService.kt +45 -0
- package/android/src/main/java/com/hotupdater/HotUpdaterException.kt +287 -22
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +46 -30
- package/android/src/main/java/com/hotupdater/HotUpdaterRecoveryManager.kt +75 -192
- package/android/src/main/java/com/hotupdater/HotUpdaterRecoveryState.kt +64 -0
- 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 +127 -50
- package/android/src/main/java/com/hotupdater/ReactNativeValueConverters.kt +34 -0
- package/android/src/main/java/com/hotupdater/TarArchiveInputStream.kt +214 -375
- package/android/src/main/java/com/hotupdater/TarBrArchiveExtractor.kt +119 -0
- package/android/src/newarch/HotUpdater.kt +7 -9
- package/android/src/newarch/HotUpdaterModule.kt +109 -84
- package/android/src/newarch/JavaScriptExceptionHooks.kt +48 -0
- package/android/src/newarch/ReactIntegrationManager.kt +6 -32
- package/android/src/oldarch/HotUpdater.kt +7 -9
- package/android/src/oldarch/HotUpdaterModule.kt +98 -74
- package/android/src/oldarch/HotUpdaterSpec.kt +4 -6
- package/android/src/oldarch/JavaScriptExceptionHooks.kt +71 -0
- package/ios/HotUpdater/Internal/BrotliFileDecompressor.swift +167 -0
- package/ios/HotUpdater/Internal/BuiltInAssetResolver.swift +196 -0
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +1032 -1116
- package/ios/HotUpdater/Internal/BundleMetadata.swift +61 -54
- package/ios/HotUpdater/Internal/FileManagerService.swift +48 -0
- package/ios/HotUpdater/Internal/FileUtilities.swift +64 -0
- package/ios/HotUpdater/Internal/HotUpdater-Bridging-Header.h +0 -1
- package/ios/HotUpdater/Internal/HotUpdater.mm +32 -67
- package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +229 -73
- package/ios/HotUpdater/Internal/KeyValueStorageService.swift +71 -0
- package/ios/HotUpdater/Internal/NotificationExtension.swift +0 -2
- package/ios/HotUpdater/Internal/TarArchiveExtractor.swift +182 -311
- package/ios/HotUpdater/Internal/URLSessionDownloadService.swift +119 -71
- package/ios/HotUpdater/Internal/UpdateFailure.swift +390 -0
- package/ios/HotUpdater/Recovery/HotUpdaterRecovery.h +16 -0
- package/ios/HotUpdater/Recovery/HotUpdaterRecovery.mm +83 -0
- package/ios/HotUpdater/Recovery/HotUpdaterRecoveryHooks.mm +49 -0
- package/lib/commonjs/appReady.js +102 -0
- package/lib/commonjs/appReady.js.map +1 -0
- package/lib/commonjs/checkForUpdate.js +120 -68
- package/lib/commonjs/checkForUpdate.js.map +1 -1
- package/lib/commonjs/clientPlugin.js +13 -0
- package/lib/commonjs/clientPlugin.js.map +1 -0
- package/lib/commonjs/error.js +4 -13
- package/lib/commonjs/error.js.map +1 -1
- package/lib/commonjs/fetchJSON.js +16 -27
- package/lib/commonjs/fetchJSON.js.map +1 -1
- package/lib/commonjs/fetchUpdateResponse.js +60 -0
- package/lib/commonjs/fetchUpdateResponse.js.map +1 -0
- package/lib/commonjs/httpClient.js +63 -94
- package/lib/commonjs/httpClient.js.map +1 -1
- package/lib/commonjs/index.js +71 -18
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native.js +74 -60
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/pluginHost.js +45 -0
- package/lib/commonjs/pluginHost.js.map +1 -0
- package/lib/commonjs/releaseCatalogCache.js +36 -87
- package/lib/commonjs/releaseCatalogCache.js.map +1 -1
- package/lib/commonjs/sdkVersion.js +1 -1
- package/lib/commonjs/sdkVersion.js.map +1 -1
- package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
- package/lib/commonjs/store.js +3 -10
- package/lib/commonjs/store.js.map +1 -1
- package/lib/commonjs/updateError.js +145 -0
- package/lib/commonjs/updateError.js.map +1 -0
- package/lib/commonjs/wrap.js +43 -26
- package/lib/commonjs/wrap.js.map +1 -1
- package/lib/module/appReady.js +95 -0
- package/lib/module/appReady.js.map +1 -0
- package/lib/module/checkForUpdate.js +113 -63
- package/lib/module/checkForUpdate.js.map +1 -1
- package/lib/module/clientPlugin.js +4 -0
- package/lib/module/clientPlugin.js.map +1 -0
- package/lib/module/error.js +4 -13
- package/lib/module/error.js.map +1 -1
- package/lib/module/fetchJSON.js +14 -26
- package/lib/module/fetchJSON.js.map +1 -1
- package/lib/module/fetchUpdateResponse.js +55 -0
- package/lib/module/fetchUpdateResponse.js.map +1 -0
- package/lib/module/httpClient.js +62 -93
- package/lib/module/httpClient.js.map +1 -1
- package/lib/module/index.js +58 -20
- package/lib/module/index.js.map +1 -1
- package/lib/module/native.js +67 -53
- package/lib/module/native.js.map +1 -1
- package/lib/module/pluginHost.js +36 -0
- package/lib/module/pluginHost.js.map +1 -0
- package/lib/module/releaseCatalogCache.js +32 -82
- package/lib/module/releaseCatalogCache.js.map +1 -1
- package/lib/module/sdkVersion.js +1 -1
- package/lib/module/sdkVersion.js.map +1 -1
- package/lib/module/specs/NativeHotUpdater.js.map +1 -1
- package/lib/module/store.js +3 -10
- package/lib/module/store.js.map +1 -1
- package/lib/module/updateError.js +139 -0
- package/lib/module/updateError.js.map +1 -0
- package/lib/module/wrap.js +43 -26
- package/lib/module/wrap.js.map +1 -1
- package/lib/typescript/commonjs/appReady.d.ts +21 -0
- package/lib/typescript/commonjs/appReady.d.ts.map +1 -0
- package/lib/typescript/commonjs/checkForUpdate.d.ts +16 -4
- package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/commonjs/clientPlugin.d.ts +2 -0
- package/lib/typescript/commonjs/clientPlugin.d.ts.map +1 -0
- package/lib/typescript/commonjs/error.d.ts +4 -13
- package/lib/typescript/commonjs/error.d.ts.map +1 -1
- package/lib/typescript/commonjs/fetchJSON.d.ts +5 -5
- package/lib/typescript/commonjs/fetchJSON.d.ts.map +1 -1
- package/lib/typescript/commonjs/fetchUpdateResponse.d.ts +14 -0
- package/lib/typescript/commonjs/fetchUpdateResponse.d.ts.map +1 -0
- package/lib/typescript/commonjs/httpClient.d.ts +4 -33
- package/lib/typescript/commonjs/httpClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +4 -8
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/native.d.ts +29 -22
- package/lib/typescript/commonjs/native.d.ts.map +1 -1
- package/lib/typescript/commonjs/pluginHost.d.ts +4 -0
- package/lib/typescript/commonjs/pluginHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/releaseCatalogCache.d.ts +8 -14
- package/lib/typescript/commonjs/releaseCatalogCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/sdkVersion.d.ts +1 -1
- package/lib/typescript/commonjs/sdkVersion.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +35 -47
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/commonjs/store.d.ts +1 -3
- package/lib/typescript/commonjs/store.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +1 -1
- package/lib/typescript/commonjs/types.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 -7
- package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -1
- package/lib/typescript/module/appReady.d.ts +21 -0
- package/lib/typescript/module/appReady.d.ts.map +1 -0
- package/lib/typescript/module/checkForUpdate.d.ts +16 -4
- package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/module/clientPlugin.d.ts +2 -0
- package/lib/typescript/module/clientPlugin.d.ts.map +1 -0
- package/lib/typescript/module/error.d.ts +4 -13
- package/lib/typescript/module/error.d.ts.map +1 -1
- package/lib/typescript/module/fetchJSON.d.ts +5 -5
- package/lib/typescript/module/fetchJSON.d.ts.map +1 -1
- package/lib/typescript/module/fetchUpdateResponse.d.ts +14 -0
- package/lib/typescript/module/fetchUpdateResponse.d.ts.map +1 -0
- package/lib/typescript/module/httpClient.d.ts +4 -33
- package/lib/typescript/module/httpClient.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +4 -8
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/native.d.ts +29 -22
- package/lib/typescript/module/native.d.ts.map +1 -1
- package/lib/typescript/module/pluginHost.d.ts +4 -0
- package/lib/typescript/module/pluginHost.d.ts.map +1 -0
- package/lib/typescript/module/releaseCatalogCache.d.ts +8 -14
- package/lib/typescript/module/releaseCatalogCache.d.ts.map +1 -1
- package/lib/typescript/module/sdkVersion.d.ts +1 -1
- package/lib/typescript/module/sdkVersion.d.ts.map +1 -1
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts +35 -47
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/module/store.d.ts +1 -3
- package/lib/typescript/module/store.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +1 -1
- package/lib/typescript/module/types.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 -7
- package/lib/typescript/module/wrap.types.d.ts.map +1 -1
- package/package.json +7 -4
- package/src/appReady.ts +141 -0
- package/src/checkForUpdate.ts +145 -86
- package/src/clientPlugin.ts +18 -0
- package/src/error.ts +4 -14
- package/src/fetchJSON.ts +14 -30
- package/src/fetchUpdateResponse.ts +60 -0
- package/src/httpClient.ts +88 -159
- package/src/index.ts +90 -24
- package/src/native.ts +98 -102
- package/src/pluginHost.ts +47 -0
- package/src/releaseCatalogCache.ts +43 -172
- package/src/sdkVersion.ts +1 -1
- package/src/specs/NativeHotUpdater.ts +34 -48
- package/src/store.ts +2 -23
- package/src/types.ts +1 -1
- package/src/updateError.ts +167 -0
- package/src/wrap.tsx +57 -26
- package/src/wrap.types.ts +6 -7
- package/android/src/main/java/com/hotupdater/DecompressService.kt +0 -89
- package/android/src/main/java/com/hotupdater/DecompressionStrategy.kt +0 -26
- package/android/src/main/java/com/hotupdater/TarBrDecompressionStrategy.kt +0 -117
- package/android/src/main/java/com/hotupdater/TarGzDecompressionStrategy.kt +0 -117
- package/android/src/main/java/com/hotupdater/ZipDecompressionStrategy.kt +0 -192
- package/android/src/test/java/com/hotupdater/BsdiffPatchTest.kt +0 -46
- package/android/src/test/java/com/hotupdater/BundleFileStorageServiceTest.kt +0 -799
- package/android/src/test/java/com/hotupdater/HotUpdaterImplTest.kt +0 -273
- package/android/src/test/java/com/hotupdater/NativeConfigUtilsTest.kt +0 -20
- package/android/src/test/java/com/hotupdater/OkHttpDownloadServiceTest.kt +0 -111
- package/android/src/test/java/com/hotupdater/RelativePathResolverTest.kt +0 -41
- package/android/src/test/java/com/hotupdater/ReleaseCatalogCacheServiceTest.kt +0 -118
- package/android/src/test/java/com/hotupdater/TarArchiveInputStreamTest.kt +0 -68
- package/ios/HotUpdater/Internal/ArchiveExtractionUtilities.swift +0 -178
- package/ios/HotUpdater/Internal/DecompressService.swift +0 -112
- package/ios/HotUpdater/Internal/DecompressionStrategy.swift +0 -22
- package/ios/HotUpdater/Internal/StreamingTarArchiveExtractor.swift +0 -370
- package/ios/HotUpdater/Internal/TarBrDecompressionStrategy.swift +0 -39
- package/ios/HotUpdater/Internal/TarGzDecompressionStrategy.swift +0 -59
- package/ios/HotUpdater/Internal/ZipArchiveExtractor.swift +0 -482
- package/ios/HotUpdater/Internal/ZipDecompressionStrategy.swift +0 -56
- package/lib/commonjs/catalogCacheNative.spec.js +0 -31
- package/lib/commonjs/catalogCacheNative.spec.js.map +0 -1
- package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js +0 -616
- package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js.map +0 -1
- package/lib/commonjs/httpClient.spec.js +0 -102
- package/lib/commonjs/httpClient.spec.js.map +0 -1
- package/lib/commonjs/index.spec.js +0 -302
- package/lib/commonjs/index.spec.js.map +0 -1
- package/lib/commonjs/iosInterop.spec.js +0 -18
- package/lib/commonjs/iosInterop.spec.js.map +0 -1
- package/lib/commonjs/native.spec.js +0 -883
- package/lib/commonjs/native.spec.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js +0 -218
- package/lib/commonjs/notifyAppReadyInsights.boundary.spec.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.js +0 -133
- package/lib/commonjs/notifyAppReadyInsights.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.spec.js +0 -246
- package/lib/commonjs/notifyAppReadyInsights.spec.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.test-utils.js +0 -24
- package/lib/commonjs/notifyAppReadyInsights.test-utils.js.map +0 -1
- package/lib/commonjs/notifyAppReadyInsights.transport.spec.js +0 -117
- package/lib/commonjs/notifyAppReadyInsights.transport.spec.js.map +0 -1
- package/lib/commonjs/releaseCatalogCache.spec.js +0 -195
- package/lib/commonjs/releaseCatalogCache.spec.js.map +0 -1
- package/lib/commonjs/releaseCatalogCacheNativeContract.spec.js +0 -64
- package/lib/commonjs/releaseCatalogCacheNativeContract.spec.js.map +0 -1
- package/lib/commonjs/store.notification.spec.js +0 -76
- package/lib/commonjs/store.notification.spec.js.map +0 -1
- package/lib/commonjs/store.spec.js +0 -316
- package/lib/commonjs/store.spec.js.map +0 -1
- package/lib/commonjs/wrap.spec.js +0 -329
- package/lib/commonjs/wrap.spec.js.map +0 -1
- package/lib/module/catalogCacheNative.spec.js +0 -31
- package/lib/module/catalogCacheNative.spec.js.map +0 -1
- package/lib/module/checkForUpdate.releaseCatalog.spec.js +0 -615
- package/lib/module/checkForUpdate.releaseCatalog.spec.js.map +0 -1
- package/lib/module/httpClient.spec.js +0 -102
- package/lib/module/httpClient.spec.js.map +0 -1
- package/lib/module/index.spec.js +0 -301
- package/lib/module/index.spec.js.map +0 -1
- package/lib/module/iosInterop.spec.js +0 -18
- package/lib/module/iosInterop.spec.js.map +0 -1
- package/lib/module/native.spec.js +0 -882
- package/lib/module/native.spec.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.boundary.spec.js +0 -217
- package/lib/module/notifyAppReadyInsights.boundary.spec.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.js +0 -128
- package/lib/module/notifyAppReadyInsights.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.spec.js +0 -245
- package/lib/module/notifyAppReadyInsights.spec.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.test-utils.js +0 -18
- package/lib/module/notifyAppReadyInsights.test-utils.js.map +0 -1
- package/lib/module/notifyAppReadyInsights.transport.spec.js +0 -116
- package/lib/module/notifyAppReadyInsights.transport.spec.js.map +0 -1
- package/lib/module/releaseCatalogCache.spec.js +0 -195
- package/lib/module/releaseCatalogCache.spec.js.map +0 -1
- package/lib/module/releaseCatalogCacheNativeContract.spec.js +0 -64
- package/lib/module/releaseCatalogCacheNativeContract.spec.js.map +0 -1
- package/lib/module/store.notification.spec.js +0 -77
- package/lib/module/store.notification.spec.js.map +0 -1
- package/lib/module/store.spec.js +0 -315
- package/lib/module/store.spec.js.map +0 -1
- package/lib/module/wrap.spec.js +0 -330
- package/lib/module/wrap.spec.js.map +0 -1
- package/lib/typescript/commonjs/notifyAppReadyInsights.d.ts +0 -13
- 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 -13
- 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/catalogCacheNative.spec.ts +0 -63
- package/src/checkForUpdate.releaseCatalog.spec.ts +0 -612
- package/src/httpClient.spec.ts +0 -132
- package/src/index.spec.ts +0 -337
- package/src/iosInterop.spec.ts +0 -30
- package/src/native.spec.ts +0 -945
- package/src/notifyAppReadyInsights.boundary.spec.ts +0 -234
- package/src/notifyAppReadyInsights.spec.ts +0 -243
- package/src/notifyAppReadyInsights.test-utils.ts +0 -31
- package/src/notifyAppReadyInsights.transport.spec.ts +0 -130
- package/src/notifyAppReadyInsights.ts +0 -194
- package/src/releaseCatalogCache.spec.ts +0 -282
- package/src/releaseCatalogCacheNativeContract.spec.ts +0 -80
- package/src/store.notification.spec.ts +0 -92
- package/src/store.spec.ts +0 -372
- package/src/wrap.spec.ts +0 -406
package/lib/module/wrap.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useState } from "react";
|
|
4
|
+
import { handleNotifyAppReady } from "./appReady.js";
|
|
4
5
|
import { checkForUpdate } from "./checkForUpdate.js";
|
|
5
6
|
import { useEventCallback } from "./hooks/useEventCallback.js";
|
|
6
7
|
import { getUpdateId, reload } from "./native.js";
|
|
7
|
-
import { handleNotifyAppReady } from "./notifyAppReadyInsights.js";
|
|
8
8
|
import { useHotUpdaterStore } from "./store.js";
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
export function init(options) {
|
|
11
11
|
void handleNotifyAppReady(options);
|
|
12
12
|
}
|
|
@@ -15,23 +15,48 @@ export function wrap(options) {
|
|
|
15
15
|
reloadOnForceUpdate = true,
|
|
16
16
|
...restOptions
|
|
17
17
|
} = options;
|
|
18
|
+
|
|
19
|
+
// Progress is subscribed only where it is rendered or reported, so progress
|
|
20
|
+
// events don't re-render the wrapped app.
|
|
21
|
+
const ProgressReporter = ({
|
|
22
|
+
onProgress
|
|
23
|
+
}) => {
|
|
24
|
+
const progress = useHotUpdaterStore(state => state.progress);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
onProgress(progress);
|
|
27
|
+
}, [progress]);
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
const FallbackWithProgress = ({
|
|
31
|
+
Fallback,
|
|
32
|
+
status,
|
|
33
|
+
message
|
|
34
|
+
}) => {
|
|
35
|
+
const progressState = useHotUpdaterStore(state => state);
|
|
36
|
+
return /*#__PURE__*/_jsx(Fallback, {
|
|
37
|
+
artifactType: progressState.artifactType,
|
|
38
|
+
details: progressState.details,
|
|
39
|
+
progress: progressState.progress,
|
|
40
|
+
status: status,
|
|
41
|
+
message: message
|
|
42
|
+
});
|
|
43
|
+
};
|
|
18
44
|
return WrappedComponent => {
|
|
19
45
|
const HotUpdaterHOC = props => {
|
|
20
|
-
const progressState = useHotUpdaterStore(state => state);
|
|
21
|
-
const progress = progressState.progress;
|
|
22
46
|
const [message, setMessage] = useState(null);
|
|
23
47
|
const [updateStatus, setUpdateStatus] = useState("CHECK_FOR_UPDATE");
|
|
24
48
|
const initHotUpdater = useEventCallback(async () => {
|
|
25
49
|
try {
|
|
26
50
|
setUpdateStatus("CHECK_FOR_UPDATE");
|
|
51
|
+
const readiness = handleNotifyAppReady(restOptions);
|
|
27
52
|
const updateInfo = await checkForUpdate({
|
|
28
|
-
insights: restOptions.insights,
|
|
29
53
|
client: restOptions.client,
|
|
30
54
|
updateStrategy: restOptions.updateStrategy,
|
|
31
55
|
requestHeaders: restOptions.requestHeaders,
|
|
32
56
|
requestTimeout: restOptions.requestTimeout,
|
|
33
57
|
onError: restOptions.onError
|
|
34
58
|
});
|
|
59
|
+
await readiness;
|
|
35
60
|
setMessage(updateInfo?.message ?? null);
|
|
36
61
|
if (!updateInfo) {
|
|
37
62
|
restOptions.onUpdateProcessCompleted?.({
|
|
@@ -78,34 +103,26 @@ export function wrap(options) {
|
|
|
78
103
|
setUpdateStatus("UPDATE_PROCESS_COMPLETED");
|
|
79
104
|
}
|
|
80
105
|
});
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
restOptions.onProgress?.(progress);
|
|
83
|
-
}, [progress]);
|
|
84
|
-
|
|
85
|
-
// Read the native launch report after the first render commit.
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
void handleNotifyAppReady(restOptions);
|
|
88
|
-
}, []);
|
|
89
106
|
|
|
90
107
|
// Start update check
|
|
91
108
|
useEffect(() => {
|
|
92
109
|
initHotUpdater();
|
|
93
110
|
}, []);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
downloadedBytes: progressState.downloadedBytes,
|
|
100
|
-
progress: progress,
|
|
101
|
-
status: updateStatus,
|
|
102
|
-
message: message,
|
|
103
|
-
totalBytes: progressState.totalBytes
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return /*#__PURE__*/_jsx(WrappedComponent, {
|
|
111
|
+
const content = restOptions.fallbackComponent && updateStatus !== "UPDATE_PROCESS_COMPLETED" ? /*#__PURE__*/_jsx(FallbackWithProgress, {
|
|
112
|
+
Fallback: restOptions.fallbackComponent,
|
|
113
|
+
status: updateStatus,
|
|
114
|
+
message: message
|
|
115
|
+
}) : /*#__PURE__*/_jsx(WrappedComponent, {
|
|
107
116
|
...props
|
|
108
117
|
});
|
|
118
|
+
if (!restOptions.onProgress) {
|
|
119
|
+
return content;
|
|
120
|
+
}
|
|
121
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
122
|
+
children: [content, /*#__PURE__*/_jsx(ProgressReporter, {
|
|
123
|
+
onProgress: restOptions.onProgress
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
109
126
|
};
|
|
110
127
|
return HotUpdaterHOC;
|
|
111
128
|
};
|
package/lib/module/wrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","checkForUpdate","useEventCallback","getUpdateId","reload","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","handleNotifyAppReady","checkForUpdate","useEventCallback","getUpdateId","reload","useHotUpdaterStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","init","options","wrap","reloadOnForceUpdate","restOptions","ProgressReporter","onProgress","progress","state","FallbackWithProgress","Fallback","status","message","progressState","artifactType","details","WrappedComponent","HotUpdaterHOC","props","setMessage","updateStatus","setUpdateStatus","initHotUpdater","readiness","updateInfo","client","updateStrategy","requestHeaders","requestTimeout","onError","onUpdateProcessCompleted","shouldForceUpdate","id","updateBundle","catch","error","isSuccess","Error","normalizedError","String","content","fallbackComponent","children"],"sourceRoot":"../../src","sources":["wrap.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,oBAAoB,QAAQ,eAAY;AACjD,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,gBAAgB,QAAQ,6BAA0B;AAC3D,SAASC,WAAW,EAAEC,MAAM,QAAQ,aAAU;AAC9C,SAASC,kBAAkB,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA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,OAAOW,aAAa;EACtB,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* The Release the running bundle was selected as: the active or stable
|
|
10
|
+
* selection that names it on the current channel.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getRunningReleaseId: (bundleId: string, channel: string) => string | null;
|
|
13
|
+
/** Reads this runtime's launch once native finalizes it and reports it to plugins. */
|
|
14
|
+
export declare const handleNotifyAppReady: (options: NotifyAppReadyOptions) => Promise<NotifyAppReadyResult | undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* Calls a plugin hook after this runtime's `onAppReady`, so plugins see the
|
|
17
|
+
* launch before anything that followed it. The event is built now, from the
|
|
18
|
+
* state it describes, and only when a plugin listens.
|
|
19
|
+
*/
|
|
20
|
+
export declare const emitAfterAppReady: typeof emitPluginHook;
|
|
21
|
+
//# 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;AAwBF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aACpB,MAAM,WACP,MAAM,KACd,MAAM,GAAG,IAQX,CAAC;AAyDF,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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReleaseTransitionKind, UpdateErrorResource, UpdateErrorStage } from "./clientPlugin";
|
|
2
2
|
import type { HotUpdaterHttpClient } from "./httpClient";
|
|
3
|
+
export type { ReleaseTransitionKind };
|
|
3
4
|
export interface CheckForUpdateOptions {
|
|
4
5
|
/**
|
|
5
6
|
* Update strategy
|
|
@@ -21,7 +22,7 @@ export interface CheckForUpdateOptions {
|
|
|
21
22
|
*/
|
|
22
23
|
requestTimeout?: number;
|
|
23
24
|
}
|
|
24
|
-
export type CheckForUpdateResult =
|
|
25
|
+
export type CheckForUpdateResult = {
|
|
25
26
|
readonly id: string;
|
|
26
27
|
readonly message: string | null;
|
|
27
28
|
readonly rolloutCohortCount: number;
|
|
@@ -36,10 +37,21 @@ export type CheckForUpdateResult = ArtifactInfo & {
|
|
|
36
37
|
*/
|
|
37
38
|
updateBundle: () => Promise<boolean>;
|
|
38
39
|
};
|
|
39
|
-
export type ReleaseTransitionKind = "INSTALL" | "ADOPT_RELEASE" | "USE_EMBEDDED" | "USE_BUILTIN";
|
|
40
40
|
export interface InternalCheckForUpdateOptions extends CheckForUpdateOptions {
|
|
41
|
-
insights?: boolean;
|
|
42
41
|
client: HotUpdaterHttpClient;
|
|
43
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;
|
|
44
56
|
export declare function checkForUpdate(options: InternalCheckForUpdateOptions): Promise<CheckForUpdateResult | null>;
|
|
45
57
|
//# sourceMappingURL=checkForUpdate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkForUpdate.d.ts","sourceRoot":"","sources":["../../../src/checkForUpdate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkForUpdate.d.ts","sourceRoot":"","sources":["../../../src/checkForUpdate.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAoBzD,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,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,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAAC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,qBAAqB,CAAC;IAChD;;;OAGG;IACH,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAyCD,wEAAwE;AACxE,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,aAAa,GAAG,YAAY,CAAC;IACtD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,UACrB,OAAO,SACP,gBAAgB,YACb,mBAAmB,GAAG,SAAS,SAClC,gBAAgB,KACtB,IAmBF,CAAC;AAuRF,wBAAsB,cAAc,CAClC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA2EtC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { defineClientPlugin, type AppReadyResult, type BundleDownloadedInfo, type HotUpdaterClientContext, type HotUpdaterClientHooks, type HotUpdaterClientPlugin, type HotUpdaterClientStorage, type ReleaseTransitionKind, type UpdateCheckResult, type UpdateError, type UpdateErrorReason, type UpdateErrorResource, type UpdateErrorStage, type UpdateErrorTransport, type UpdateHttpResponse, type UpdateStrategy, } from "@hot-updater/protocol";
|
|
2
|
+
//# sourceMappingURL=clientPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientPlugin.d.ts","sourceRoot":"","sources":["../../../src/clientPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Error Classification:
|
|
9
9
|
* - Parameter Validation: Invalid or missing function parameters
|
|
10
|
-
* - Bundle Storage: Errors during download,
|
|
10
|
+
* - Bundle Storage: Errors during download, verification, and storage
|
|
11
11
|
* - Signature Verification: Cryptographic verification failures (collapsed to a single public code)
|
|
12
12
|
* - Internal: Platform-specific or unexpected errors
|
|
13
13
|
*
|
|
@@ -23,8 +23,7 @@ export declare enum HotUpdaterErrorCode {
|
|
|
23
23
|
*/
|
|
24
24
|
MISSING_BUNDLE_ID = "MISSING_BUNDLE_ID",
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* Thrown when fileUrl parameter cannot be parsed as a valid URL.
|
|
26
|
+
* Manifest or asset URL is invalid or malformed.
|
|
28
27
|
* @retryable false
|
|
29
28
|
*/
|
|
30
29
|
INVALID_FILE_URL = "INVALID_FILE_URL",
|
|
@@ -48,23 +47,15 @@ export declare enum HotUpdaterErrorCode {
|
|
|
48
47
|
* @retryable true - Download may succeed on retry
|
|
49
48
|
*/
|
|
50
49
|
INCOMPLETE_DOWNLOAD = "INCOMPLETE_DOWNLOAD",
|
|
51
|
-
/**
|
|
52
|
-
* Bundle archive format is invalid or corrupted.
|
|
53
|
-
* Thrown when ZIP file has wrong magic bytes, invalid structure, or unsupported format.
|
|
54
|
-
* Also thrown for path traversal attempts during extraction.
|
|
55
|
-
* @retryable false - Indicates corrupted or malicious bundle
|
|
56
|
-
*/
|
|
57
|
-
EXTRACTION_FORMAT_ERROR = "EXTRACTION_FORMAT_ERROR",
|
|
58
50
|
/**
|
|
59
51
|
* Bundle missing required platform files.
|
|
60
|
-
* Thrown when
|
|
52
|
+
* Thrown when the staged bundle doesn't contain index.android.bundle (Android)
|
|
61
53
|
* or main.jsbundle (iOS).
|
|
62
54
|
* @retryable false - Indicates incorrectly built bundle
|
|
63
55
|
*/
|
|
64
56
|
INVALID_BUNDLE = "INVALID_BUNDLE",
|
|
65
57
|
/**
|
|
66
|
-
* Insufficient disk space for bundle
|
|
67
|
-
* Thrown when available disk space is less than required (file size * 2).
|
|
58
|
+
* Insufficient disk space for bundle staging.
|
|
68
59
|
* Error message includes required and available bytes.
|
|
69
60
|
* @retryable false - User must free up disk space
|
|
70
61
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,oBAAY,mBAAmB;IAG7B;;;;OAIG;IACH,iBAAiB,sBAAsB;IAEvC
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,oBAAY,mBAAmB;IAG7B;;;;OAIG;IACH,iBAAiB,sBAAsB;IAEvC;;;OAGG;IACH,gBAAgB,qBAAqB;IAIrC;;;;OAIG;IACH,yBAAyB,8BAA8B;IAEvD;;;;;OAKG;IACH,eAAe,oBAAoB;IAEnC;;;;;OAKG;IACH,mBAAmB,wBAAwB;IAE3C;;;;;OAKG;IACH,cAAc,mBAAmB;IAEjC;;;;OAIG;IACH,uBAAuB,4BAA4B;IAEnD;;;;;OAKG;IACH,6BAA6B,kCAAkC;IAE/D;;;;;;OAMG;IACH,qBAAqB,0BAA0B;IAE/C;;;;;OAKG;IACH,yBAAyB,8BAA8B;IAOvD;;;;;;;OAOG;IACH,gBAAgB,qBAAqB;IAErC;;;;;OAKG;IACH,aAAa,kBAAkB;CAChC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAUzD;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,cAGC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { type UpdateRequest } from "./fetchUpdateResponse";
|
|
2
|
+
import { UpdateHttpError } from "./updateError";
|
|
3
|
+
export declare class FetchJSONResponseError extends UpdateHttpError {
|
|
4
|
+
}
|
|
5
|
+
export declare const fetchJSON: <T>(input: Omit<UpdateRequest, "resource">) => Promise<T>;
|
|
6
6
|
//# sourceMappingURL=fetchJSON.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchJSON.d.ts","sourceRoot":"","sources":["../../../src/fetchJSON.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"fetchJSON.d.ts","sourceRoot":"","sources":["../../../src/fetchJSON.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,sBAAuB,SAAQ,eAAe;CAAG;AAE9D,eAAO,MAAM,SAAS,GAAU,CAAC,SACxB,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,KACrC,OAAO,CAAC,CAAC,CASX,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UpdateHttpResponse } from "@hot-updater/protocol";
|
|
2
|
+
export interface UpdateRequest {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly resource: UpdateHttpResponse["resource"];
|
|
5
|
+
readonly requestHeaders?: Record<string, string>;
|
|
6
|
+
readonly requestTimeout?: number;
|
|
7
|
+
readonly onResponse?: (response: UpdateHttpResponse) => void;
|
|
8
|
+
}
|
|
9
|
+
/** Read once for parsing and diagnostics, under the same request timeout. */
|
|
10
|
+
export declare const fetchUpdateResponse: ({ url, resource, requestHeaders, requestTimeout, onResponse, }: UpdateRequest) => Promise<{
|
|
11
|
+
response: Response;
|
|
12
|
+
body: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=fetchUpdateResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchUpdateResponse.d.ts","sourceRoot":"","sources":["../../../src/fetchUpdateResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAClD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC9D;AAED,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,mEAM7B,aAAa,KAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CA0CrE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type ArtifactInfo, type ReleaseCatalog } from "@hot-updater/
|
|
2
|
-
import type { HotUpdaterBaseURL } from "./types";
|
|
1
|
+
import { type ArtifactInfo, type HotUpdaterBaseURL, type ReleaseCatalog, type UpdateHttpResponse } from "@hot-updater/protocol";
|
|
3
2
|
export interface ReleaseCatalogRequest {
|
|
4
3
|
readonly platform: "ios" | "android";
|
|
5
4
|
readonly channel: string;
|
|
@@ -15,42 +14,14 @@ export interface ArtifactRequest {
|
|
|
15
14
|
readonly requestHeaders?: Record<string, string>;
|
|
16
15
|
readonly requestTimeout?: number;
|
|
17
16
|
}
|
|
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_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
17
|
export interface HotUpdaterHttpSession {
|
|
46
|
-
|
|
18
|
+
/** Resolves to null when the server says the scope has no catalog, so no update. */
|
|
19
|
+
fetchReleaseCatalog: (params: ReleaseCatalogRequest) => Promise<ReleaseCatalog | null>;
|
|
47
20
|
resolveArtifact: (params: ArtifactRequest) => Promise<ArtifactInfo>;
|
|
48
|
-
sendInsightsEvent: (params: InsightsEventParams) => Promise<void>;
|
|
49
21
|
}
|
|
50
22
|
export interface HotUpdaterHttpClient {
|
|
51
23
|
createSession: () => Promise<HotUpdaterHttpSession>;
|
|
52
24
|
}
|
|
53
25
|
/** Creates the private HTTP client used by HotUpdater.init and HotUpdater.wrap. */
|
|
54
|
-
export declare const createHttpClient: (baseURL: HotUpdaterBaseURL) => HotUpdaterHttpClient;
|
|
55
|
-
export {};
|
|
26
|
+
export declare const createHttpClient: (baseURL: HotUpdaterBaseURL, onResponse?: (response: UpdateHttpResponse) => void) => HotUpdaterHttpClient;
|
|
56
27
|
//# sourceMappingURL=httpClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/httpClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"httpClient.d.ts","sourceRoot":"","sources":["../../../src/httpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAM/B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,aAAa,GAAG,YAAY,CAAC;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,oFAAoF;IACpF,mBAAmB,EAAE,CACnB,MAAM,EAAE,qBAAqB,KAC1B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACpC,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACrE;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrD;AA4ID,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,eACb,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,KAClD,oBAGD,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
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,
|
|
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
|
|
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 UpdateHttpResponse, type UpdateStrategy, } from "./clientPlugin";
|
|
5
|
+
export { insights, type InsightsOptions, type InsightsPlugin, type InsightsUser, } from "@hot-updater/plugin-insights/client";
|
|
6
|
+
export type { CustomReloadHandler, HotUpdaterEvent, HotUpdaterProgressArtifactType, HotUpdaterProgressEvent, Manifest, ManifestAsset, NotifyAppReadyResult, ActiveUpdateState, ReloadBehavior, ReloadBehaviorSetting, } from "./native";
|
|
5
7
|
export * from "./store";
|
|
6
8
|
export { extractSignatureFailure, type HotUpdaterBaseURL, isSignatureVerificationError, type SignatureVerificationFailure, } from "./types";
|
|
7
9
|
export type { HotUpdaterFallbackComponentProps, HotUpdaterInitOptions, HotUpdaterOptions, RunUpdateProcessResponse, } from "./wrap";
|
|
@@ -199,8 +201,6 @@ declare function createHotUpdaterClient(): {
|
|
|
199
201
|
*
|
|
200
202
|
* @param {UpdateBundleParams} params - Parameters object required for bundle update
|
|
201
203
|
* @param {string} params.bundleId - The bundle ID of the app
|
|
202
|
-
* @param {string|null} params.fileUrl - The URL of the zip file
|
|
203
|
-
*
|
|
204
204
|
* @returns {Promise<boolean>} Whether the update was successful
|
|
205
205
|
*
|
|
206
206
|
* @example
|
|
@@ -247,10 +247,6 @@ declare function createHotUpdaterClient(): {
|
|
|
247
247
|
* Fetches the persisted install id for this app installation.
|
|
248
248
|
*/
|
|
249
249
|
getInstallId: typeof getInstallId;
|
|
250
|
-
/**
|
|
251
|
-
* Persists nullable user identity fields associated with this installation.
|
|
252
|
-
*/
|
|
253
|
-
setUser: typeof setUser;
|
|
254
250
|
/**
|
|
255
251
|
* Reads the native launch report for the current process.
|
|
256
252
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,qBAAqB,EAI3B,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,EAEjB,KAAK,YAAY,EAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAItB,IAAI,EACL,MAAM,QAAQ,CAAC;AAEhB,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,QAAQ,EACR,KAAK,eAAe,EACp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AGH;;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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CatalogHighWater, type UpdateStatus, type PersistedSelectionReceipt } from "@hot-updater/
|
|
1
|
+
import { type CatalogHighWater, type UpdateStatus, type PersistedSelectionReceipt } from "@hot-updater/protocol";
|
|
2
2
|
import { HotUpdaterErrorCode, isHotUpdaterError } from "./error";
|
|
3
3
|
import { type UpdateBundleParams } from "./specs/NativeHotUpdater";
|
|
4
4
|
export { HotUpdaterErrorCode, isHotUpdaterError };
|
|
@@ -33,7 +33,7 @@ export type CustomReloadHandler = () => void | Promise<void>;
|
|
|
33
33
|
* - `custom`: Run a user-provided JS handler on both platforms
|
|
34
34
|
*/
|
|
35
35
|
export type ReloadBehaviorSetting = ReloadBehavior | "custom";
|
|
36
|
-
export type HotUpdaterProgressArtifactType = "
|
|
36
|
+
export type HotUpdaterProgressArtifactType = "diff";
|
|
37
37
|
export type HotUpdaterDiffFileStatus = "pending" | "downloading" | "downloaded" | "failed";
|
|
38
38
|
export interface HotUpdaterDiffFileSnapshot {
|
|
39
39
|
/**
|
|
@@ -78,11 +78,6 @@ export interface HotUpdaterDiffProgressDetails {
|
|
|
78
78
|
files: HotUpdaterDiffFileSnapshot[];
|
|
79
79
|
}
|
|
80
80
|
export type HotUpdaterProgressEvent = {
|
|
81
|
-
progress: number;
|
|
82
|
-
artifactType: "archive";
|
|
83
|
-
downloadedBytes?: number;
|
|
84
|
-
totalBytes?: number;
|
|
85
|
-
} | {
|
|
86
81
|
progress: number;
|
|
87
82
|
artifactType: "diff";
|
|
88
83
|
details: HotUpdaterDiffProgressDetails;
|
|
@@ -130,6 +125,24 @@ export declare const commitReleaseSelection: (input: {
|
|
|
130
125
|
readonly selection: PersistedSelectionReceipt;
|
|
131
126
|
readonly guard: ReleaseSelectionGuard;
|
|
132
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>;
|
|
133
146
|
/**
|
|
134
147
|
* Downloads files and applies them to the app.
|
|
135
148
|
*
|
|
@@ -220,17 +233,10 @@ export declare const isChannelSwitched: () => boolean;
|
|
|
220
233
|
*/
|
|
221
234
|
export declare const getFingerprintHash: () => string | null;
|
|
222
235
|
export declare const getInstallId: () => string;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
export declare const getPersistedUserIdentity: () => PersistedUserIdentity;
|
|
228
|
-
export type SetUserParams = {
|
|
229
|
-
userId?: string | number | null;
|
|
230
|
-
username?: string | null;
|
|
231
|
-
};
|
|
232
|
-
export declare function setUser(params: SetUserParams): void;
|
|
233
|
-
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;
|
|
234
240
|
/**
|
|
235
241
|
* Result returned by notifyAppReady()
|
|
236
242
|
*/
|
|
@@ -249,17 +255,18 @@ export type NotifyAppReadyResult = {
|
|
|
249
255
|
fromReleaseId?: string;
|
|
250
256
|
toReleaseId?: string;
|
|
251
257
|
};
|
|
252
|
-
|
|
258
|
+
/** An update applied or recovered at this launch, as native persisted it. */
|
|
259
|
+
export type LaunchTransition = {
|
|
253
260
|
type: "UPDATE_APPLIED" | "RECOVERED";
|
|
254
261
|
fromBundleId: string;
|
|
255
262
|
toBundleId: string;
|
|
256
|
-
fromReleaseId
|
|
257
|
-
toReleaseId
|
|
263
|
+
fromReleaseId: string | null;
|
|
264
|
+
toReleaseId: string | null;
|
|
258
265
|
updateStrategy: PersistedUpdateStrategy;
|
|
259
266
|
};
|
|
260
267
|
export declare const readNotifyAppReady: () => {
|
|
261
268
|
result: NotifyAppReadyResult;
|
|
262
|
-
|
|
269
|
+
transition: LaunchTransition | null;
|
|
263
270
|
pending: boolean;
|
|
264
271
|
};
|
|
265
272
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC/B,MAAM,
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../../src/native.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAyB,EACvB,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CA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E,WAAW,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEN,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,gBAAgB,GAAG,WAAW,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,uBAAuB,CAAC;CACzC,CAAC;AA8IF,eAAO,MAAM,kBAAkB,QAAO;IACpC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;CASlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,QAAO,oBAEjC,CAAC;AA0EF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,QAAO,MAAM,EAWxC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAO,OAEpC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAAO,MAAM,GAAG,IAUtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,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,4 @@
|
|
|
1
|
+
export type { PluginHostConfig } from "@hot-updater/protocol";
|
|
2
|
+
/** The app's plugin host: plugins read the native module and fetch the configured server. */
|
|
3
|
+
export declare const configurePlugins: (plugins: readonly import("@hot-updater/protocol").HotUpdaterClientPlugin[] | undefined, config: import("@hot-updater/protocol").PluginHostConfig) => void, hasPluginHook: (name: import("@hot-updater/protocol").PluginHookName) => boolean, buildPluginEvent: <K extends import("@hot-updater/protocol").PluginHookName>(name: K, createPayload: () => import("@hot-updater/protocol").PluginHookPayload<K> | null) => import("@hot-updater/protocol").PluginHookPayload<K> | null, dispatchPluginHook: <K extends import("@hot-updater/protocol").PluginHookName>(name: K, payload: import("@hot-updater/protocol").PluginHookPayload<K>) => readonly Promise<void>[], emitPluginHook: <K extends import("@hot-updater/protocol").PluginHookName>(name: K, createPayload: () => import("@hot-updater/protocol").PluginHookPayload<K> | null) => void;
|
|
4
|
+
//# sourceMappingURL=pluginHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginHost.d.ts","sourceRoot":"","sources":["../../../src/pluginHost.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,6FAA6F;AAC7F,eAAO,MACL,gBAAgB,8JAChB,aAAa,qEACb,gBAAgB,wNAChB,kBAAkB,kKAClB,cAAc,+JAsBd,CAAC"}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { type ReleaseCatalog } from "@hot-updater/
|
|
2
|
-
|
|
1
|
+
import { type ExpectedReleaseCatalogScope, type ReleaseCatalog } from "@hot-updater/protocol";
|
|
2
|
+
import { type UpdateRequest } from "./fetchUpdateResponse";
|
|
3
3
|
export declare const MAX_RELEASE_CATALOG_CACHE_ENTRY_BYTES: number;
|
|
4
|
-
export type ExpectedReleaseCatalogScope = {
|
|
5
|
-
readonly channelKey: string;
|
|
6
|
-
readonly platform: "ios" | "android";
|
|
7
|
-
} & ({
|
|
8
|
-
readonly strategy: "APP_VERSION";
|
|
9
|
-
readonly fingerprintHash?: never;
|
|
10
|
-
} | {
|
|
11
|
-
readonly strategy: "FINGERPRINT";
|
|
12
|
-
readonly fingerprintHash: string;
|
|
13
|
-
});
|
|
14
4
|
type FetchReleaseCatalogInput = {
|
|
15
5
|
readonly baseURL: string;
|
|
16
6
|
readonly expectedScope: ExpectedReleaseCatalogScope;
|
|
17
7
|
readonly requestHeaders?: Record<string, string>;
|
|
18
8
|
readonly requestTimeout?: number;
|
|
19
9
|
readonly url: string;
|
|
10
|
+
readonly onResponse?: UpdateRequest["onResponse"];
|
|
20
11
|
};
|
|
21
|
-
export declare const hasExpectedReleaseCatalogScope: (catalog: ReleaseCatalog, expected: ExpectedReleaseCatalogScope) => boolean;
|
|
22
12
|
export declare const createReleaseCatalogCachePartition: (input: Pick<FetchReleaseCatalogInput, "baseURL" | "requestHeaders" | "url">) => string;
|
|
23
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Fetches a scope's catalog, or null when the server answers that the scope
|
|
15
|
+
* has none (a 404 with `x-hot-updater-catalog: none`).
|
|
16
|
+
*/
|
|
17
|
+
export declare const fetchReleaseCatalogWithCache: (input: FetchReleaseCatalogInput) => Promise<ReleaseCatalog | null>;
|
|
24
18
|
export {};
|
|
25
19
|
//# sourceMappingURL=releaseCatalogCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releaseCatalogCache.d.ts","sourceRoot":"","sources":["../../../src/releaseCatalogCache.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"releaseCatalogCache.d.ts","sourceRoot":"","sources":["../../../src/releaseCatalogCache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,2BAA2B,EAIhC,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAKhF,eAAO,MAAM,qCAAqC,QACG,CAAC;AAiCtD,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,2BAA2B,CAAC;IACpD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACnD,CAAC;AAqDF,eAAO,MAAM,kCAAkC,UACtC,IAAI,CAAC,wBAAwB,EAAE,SAAS,GAAG,gBAAgB,GAAG,KAAK,CAAC,KAC1E,MAMC,CAAC;AA6EL;;;GAGG;AACH,eAAO,MAAM,4BAA4B,UAChC,wBAAwB,KAC9B,OAAO,CAAC,cAAc,GAAG,IAAI,CAa/B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const HOT_UPDATER_SDK_VERSION = "1.0.0-rc.
|
|
1
|
+
export declare const HOT_UPDATER_SDK_VERSION = "1.0.0-rc.40";
|
|
2
2
|
//# sourceMappingURL=sdkVersion.d.ts.map
|