@hot-updater/react-native 1.0.0-rc.4 → 1.0.0-rc.41
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 +96 -0
- package/lib/commonjs/appReady.js.map +1 -0
- package/lib/commonjs/checkForUpdate.js +121 -69
- 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 +5 -14
- 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 +64 -95
- package/lib/commonjs/httpClient.js.map +1 -1
- package/lib/commonjs/index.js +355 -324
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/init.types.js +6 -0
- package/lib/commonjs/init.types.js.map +1 -0
- package/lib/commonjs/native.js +77 -63
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/pluginHost.js +41 -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 +46 -38
- package/lib/commonjs/wrap.js.map +1 -1
- package/lib/module/appReady.js +90 -0
- package/lib/module/appReady.js.map +1 -0
- package/lib/module/checkForUpdate.js +114 -64
- 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 +5 -14
- 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 +63 -94
- package/lib/module/httpClient.js.map +1 -1
- package/lib/module/index.js +335 -327
- package/lib/module/index.js.map +1 -1
- package/lib/module/init.types.js +4 -0
- package/lib/module/init.types.js.map +1 -0
- package/lib/module/native.js +70 -56
- 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 +47 -38
- package/lib/module/wrap.js.map +1 -1
- package/lib/typescript/commonjs/appReady.d.ts +30 -0
- package/lib/typescript/commonjs/appReady.d.ts.map +1 -0
- package/lib/typescript/commonjs/checkForUpdate.d.ts +20 -6
- 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 +5 -14
- 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 +5 -34
- package/lib/typescript/commonjs/httpClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +124 -116
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/init.types.d.ts +21 -0
- package/lib/typescript/commonjs/init.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/native.d.ts +32 -25
- package/lib/typescript/commonjs/native.d.ts.map +1 -1
- package/lib/typescript/commonjs/pluginHost.d.ts +8 -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 +2 -3
- package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
- package/lib/typescript/commonjs/wrap.types.d.ts +13 -41
- package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -1
- package/lib/typescript/module/appReady.d.ts +30 -0
- package/lib/typescript/module/appReady.d.ts.map +1 -0
- package/lib/typescript/module/checkForUpdate.d.ts +20 -6
- 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 +5 -14
- 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 +5 -34
- package/lib/typescript/module/httpClient.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +124 -116
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/init.types.d.ts +21 -0
- package/lib/typescript/module/init.types.d.ts.map +1 -0
- package/lib/typescript/module/native.d.ts +32 -25
- package/lib/typescript/module/native.d.ts.map +1 -1
- package/lib/typescript/module/pluginHost.d.ts +8 -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 +2 -3
- package/lib/typescript/module/wrap.d.ts.map +1 -1
- package/lib/typescript/module/wrap.types.d.ts +13 -41
- package/lib/typescript/module/wrap.types.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/appReady.ts +147 -0
- package/src/checkForUpdate.ts +156 -89
- package/src/clientPlugin.ts +21 -0
- package/src/error.ts +5 -15
- package/src/fetchJSON.ts +14 -30
- package/src/fetchUpdateResponse.ts +60 -0
- package/src/httpClient.ts +89 -160
- package/src/index.ts +413 -425
- package/src/init.types.ts +24 -0
- package/src/native.ts +101 -105
- package/src/pluginHost.ts +52 -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 +60 -43
- package/src/wrap.types.ts +18 -46
- 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
|
@@ -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
|
-
/** Creates the private HTTP client
|
|
54
|
-
export declare const createHttpClient: (baseURL: HotUpdaterBaseURL) => HotUpdaterHttpClient;
|
|
55
|
-
export {};
|
|
25
|
+
/** Creates the private HTTP client HotUpdater.init configures. */
|
|
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,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,eACb,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,KAClD,oBAGD,CAAC"}
|
|
@@ -1,65 +1,26 @@
|
|
|
1
|
+
import { type LaunchReporter } from "./appReady";
|
|
1
2
|
import { type CheckForUpdateOptions } from "./checkForUpdate";
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
|
|
3
|
+
import type { ClientPluginApis, HotUpdaterClientPlugin } from "./clientPlugin";
|
|
4
|
+
import { type HotUpdaterHttpClient } from "./httpClient";
|
|
5
|
+
import type { HotUpdaterInitOptions } from "./init.types";
|
|
6
|
+
import { addListener, clearCrashHistory, getAppVersion, getUpdateId, getChannel, getCohort, getCrashHistory, getDefaultChannel, getFingerprintHash, getInstallId, getManifest, getMinBundleId, isChannelSwitched, notifyAppReady, reload, setCohort, setReloadBehavior, type UpdateParams } from "./native";
|
|
7
|
+
import { type HotUpdaterWrapOptions } from "./wrap";
|
|
8
|
+
export { defineClientPlugin, type AppReadyResult, type BundleDownloadedInfo, type ClientPluginApi, type ClientPluginApis, type HotUpdaterClientContext, type HotUpdaterClientHooks, type HotUpdaterClientPlugin, type HotUpdaterClientSetup, type HotUpdaterClientStorage, type ReleaseTransitionKind, type UpdateCheckResult, type UpdateError, type UpdateErrorReason, type UpdateErrorStage, type UpdateHttpResponse, type UpdateStrategy, } from "./clientPlugin";
|
|
9
|
+
export { insights, type InsightsClient, type InsightsOptions, type InsightsPlugin, type InsightsUser, } from "@hot-updater/plugin-insights/client";
|
|
10
|
+
export { remoteConfig, type RemoteConfigClient, type RemoteConfigDefaults, type RemoteConfigDefaultValue, type RemoteConfigFetchOptions, type RemoteConfigFetchStatus, type RemoteConfigKey, type RemoteConfigOptions, type RemoteConfigPlugin, type RemoteConfigValue, type RemoteConfigValueSource, } from "@hot-updater/plugin-remote-config/client";
|
|
11
|
+
export type { CustomReloadHandler, HotUpdaterEvent, HotUpdaterProgressArtifactType, HotUpdaterProgressEvent, Manifest, ManifestAsset, NotifyAppReadyResult, ActiveUpdateState, ReloadBehavior, ReloadBehaviorSetting, } from "./native";
|
|
5
12
|
export * from "./store";
|
|
6
13
|
export { extractSignatureFailure, type HotUpdaterBaseURL, isSignatureVerificationError, type SignatureVerificationFailure, } from "./types";
|
|
7
|
-
export type {
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Creates a HotUpdater client instance with all update management methods.
|
|
14
|
-
* This function is called once on module initialization to create a singleton instance.
|
|
15
|
-
*/
|
|
16
|
-
declare function createHotUpdaterClient(): {
|
|
17
|
-
/**
|
|
18
|
-
* `HotUpdater.wrap` checks for updates at the entry point, and if there is a bundle to update, it downloads the bundle and applies the update strategy.
|
|
19
|
-
*
|
|
20
|
-
* @param {object} options - Configuration options
|
|
21
|
-
* @param {string} options.source - Update server URL
|
|
22
|
-
* @param {object} [options.requestHeaders] - Request headers
|
|
23
|
-
* @param {React.ComponentType} [options.fallbackComponent] - Component to display during updates
|
|
24
|
-
* @param {boolean} [options.reloadOnForceUpdate=true] - Whether to automatically reload the app on force updates
|
|
25
|
-
* @param {Function} [options.onUpdateProcessCompleted] - Callback after update process completes
|
|
26
|
-
* @param {Function} [options.onProgress] - Callback to track bundle download progress
|
|
27
|
-
* @returns {Function} Higher-order component that wraps the app component
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* export default HotUpdater.wrap({
|
|
32
|
-
* baseURL: "<your-update-server-url>",
|
|
33
|
-
* updateStrategy: "appVersion",
|
|
34
|
-
* requestHeaders: {
|
|
35
|
-
* "x-api-key": "<your-api-key>",
|
|
36
|
-
* },
|
|
37
|
-
* })(App);
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
wrap: (options: HotUpdaterOptions) => <P extends object>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
41
|
-
/**
|
|
42
|
-
* Initializes HotUpdater without wrapping a React component.
|
|
43
|
-
*
|
|
44
|
-
* Use this for manual update flows in runtimes where a root component HOC
|
|
45
|
-
* is not convenient. Use this instead of wrapping the root component.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```tsx
|
|
49
|
-
* HotUpdater.init({
|
|
50
|
-
* baseURL: "<your-update-server-url>",
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* export default App;
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
init: (options: HotUpdaterInitOptions) => void;
|
|
14
|
+
export type { HotUpdaterInitOptions } from "./init.types";
|
|
15
|
+
export type { HotUpdaterFallbackComponentProps, HotUpdaterWrapOptions, RunUpdateProcessResponse, } from "./wrap";
|
|
16
|
+
/** The methods that read or change native state, the same on every instance. */
|
|
17
|
+
declare const nativeMethods: {
|
|
57
18
|
/**
|
|
58
19
|
* Reloads the app.
|
|
59
20
|
*/
|
|
60
21
|
reload: typeof reload;
|
|
61
22
|
/**
|
|
62
|
-
* Configures how `
|
|
23
|
+
* Configures how `hotUpdater.reload()` behaves.
|
|
63
24
|
*
|
|
64
25
|
* This can be called unconditionally on both platforms.
|
|
65
26
|
* The default is `processRestart`.
|
|
@@ -72,7 +33,7 @@ declare function createHotUpdaterClient(): {
|
|
|
72
33
|
/**
|
|
73
34
|
* Returns whether an update has finished downloading in this app session.
|
|
74
35
|
*
|
|
75
|
-
* When it returns true, calling `
|
|
36
|
+
* When it returns true, calling `hotUpdater.reload()` (or restarting the app)
|
|
76
37
|
* will apply the downloaded update bundle.
|
|
77
38
|
*
|
|
78
39
|
* - Derived from `progress` reaching 1.0
|
|
@@ -81,8 +42,8 @@ declare function createHotUpdaterClient(): {
|
|
|
81
42
|
* @returns {boolean} True if a downloaded update is ready to apply
|
|
82
43
|
* @example
|
|
83
44
|
* ```ts
|
|
84
|
-
* if (
|
|
85
|
-
* await
|
|
45
|
+
* if (hotUpdater.isUpdateDownloaded()) {
|
|
46
|
+
* await hotUpdater.reload();
|
|
86
47
|
* }
|
|
87
48
|
* ```
|
|
88
49
|
*/
|
|
@@ -113,7 +74,7 @@ declare function createHotUpdaterClient(): {
|
|
|
113
74
|
* @default "production"
|
|
114
75
|
* @example
|
|
115
76
|
* ```ts
|
|
116
|
-
* const channel =
|
|
77
|
+
* const channel = hotUpdater.getChannel();
|
|
117
78
|
* console.log(`Current channel: ${channel}`);
|
|
118
79
|
* ```
|
|
119
80
|
*/
|
|
@@ -126,7 +87,7 @@ declare function createHotUpdaterClient(): {
|
|
|
126
87
|
* @returns {string} The default release channel embedded in the app
|
|
127
88
|
* @example
|
|
128
89
|
* ```ts
|
|
129
|
-
* const defaultChannel =
|
|
90
|
+
* const defaultChannel = hotUpdater.getDefaultChannel();
|
|
130
91
|
* console.log(`Default channel: ${defaultChannel}`);
|
|
131
92
|
* ```
|
|
132
93
|
*/
|
|
@@ -155,7 +116,7 @@ declare function createHotUpdaterClient(): {
|
|
|
155
116
|
*
|
|
156
117
|
* @example
|
|
157
118
|
* ```ts
|
|
158
|
-
* const unsubscribe =
|
|
119
|
+
* const unsubscribe = hotUpdater.addListener("onProgress", ({ progress }) => {
|
|
159
120
|
* console.log(`Update progress: ${progress * 100}%`);
|
|
160
121
|
* });
|
|
161
122
|
*
|
|
@@ -165,7 +126,71 @@ declare function createHotUpdaterClient(): {
|
|
|
165
126
|
*/
|
|
166
127
|
addListener: typeof addListener;
|
|
167
128
|
/**
|
|
168
|
-
*
|
|
129
|
+
* Clears the runtime channel override and restores the original bundle.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Promise<boolean>} Resolves with true if reset was successful
|
|
132
|
+
*/
|
|
133
|
+
resetChannel: () => Promise<boolean>;
|
|
134
|
+
/**
|
|
135
|
+
* Fetches the fingerprint of the app.
|
|
136
|
+
*
|
|
137
|
+
* @returns {string} The fingerprint of the app
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const fingerprint = hotUpdater.getFingerprintHash();
|
|
142
|
+
* console.log(`Fingerprint: ${fingerprint}`);
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
getFingerprintHash: typeof getFingerprintHash;
|
|
146
|
+
/**
|
|
147
|
+
* Fetches the persisted install id for this app installation.
|
|
148
|
+
*/
|
|
149
|
+
getInstallId: typeof getInstallId;
|
|
150
|
+
/**
|
|
151
|
+
* Reads the native launch report for the current process.
|
|
152
|
+
*/
|
|
153
|
+
notifyAppReady: typeof notifyAppReady;
|
|
154
|
+
/**
|
|
155
|
+
* Gets the list of bundle IDs that have been marked as crashed.
|
|
156
|
+
* These bundles will be rejected if attempted to install again.
|
|
157
|
+
*
|
|
158
|
+
* @returns {string[]} Array of crashed bundle IDs
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const crashedBundles = hotUpdater.getCrashHistory();
|
|
163
|
+
* console.log("Crashed bundles:", crashedBundles);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
getCrashHistory: typeof getCrashHistory;
|
|
167
|
+
/**
|
|
168
|
+
* Clears the crashed bundle history, allowing previously crashed bundles
|
|
169
|
+
* to be installed again.
|
|
170
|
+
*
|
|
171
|
+
* @returns {boolean} true if clearing was successful
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* // Clear crash history to allow retrying a previously failed bundle
|
|
176
|
+
* hotUpdater.clearCrashHistory();
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
clearCrashHistory: typeof clearCrashHistory;
|
|
180
|
+
};
|
|
181
|
+
/** What an instance's own methods use: its server, settings, and launch. */
|
|
182
|
+
interface InstanceConfig {
|
|
183
|
+
readonly client: HotUpdaterHttpClient;
|
|
184
|
+
readonly requestHeaders?: Record<string, string>;
|
|
185
|
+
readonly requestTimeout?: number;
|
|
186
|
+
readonly onError?: (error: unknown) => void;
|
|
187
|
+
readonly launch: LaunchReporter;
|
|
188
|
+
}
|
|
189
|
+
/** The methods that use the instance's own configuration and plugins. */
|
|
190
|
+
declare const createConfiguredMethods: (config: InstanceConfig) => {
|
|
191
|
+
/**
|
|
192
|
+
* Checks for an update, with this instance's server and request
|
|
193
|
+
* settings.
|
|
169
194
|
*
|
|
170
195
|
* @param {Object} config - Update check configuration
|
|
171
196
|
* @param {string} [config.channel] - Optional channel override for this update check
|
|
@@ -175,7 +200,7 @@ declare function createHotUpdaterClient(): {
|
|
|
175
200
|
*
|
|
176
201
|
* @example
|
|
177
202
|
* ```ts
|
|
178
|
-
* const updateInfo = await
|
|
203
|
+
* const updateInfo = await hotUpdater.checkForUpdate({
|
|
179
204
|
* updateStrategy: "appVersion",
|
|
180
205
|
* requestHeaders: {
|
|
181
206
|
* "x-api-key": "<your-api-key>",
|
|
@@ -189,23 +214,21 @@ declare function createHotUpdaterClient(): {
|
|
|
189
214
|
*
|
|
190
215
|
* await updateInfo.updateBundle();
|
|
191
216
|
* if (updateInfo.shouldForceUpdate) {
|
|
192
|
-
* await
|
|
217
|
+
* await hotUpdater.reload();
|
|
193
218
|
* }
|
|
194
219
|
* ```
|
|
195
220
|
*/
|
|
196
|
-
checkForUpdate: (
|
|
221
|
+
checkForUpdate: (options: CheckForUpdateOptions) => Promise<import("./checkForUpdate").CheckForUpdateResult | null>;
|
|
197
222
|
/**
|
|
198
223
|
* Updates the bundle of the app.
|
|
199
224
|
*
|
|
200
225
|
* @param {UpdateBundleParams} params - Parameters object required for bundle update
|
|
201
226
|
* @param {string} params.bundleId - The bundle ID of the app
|
|
202
|
-
* @param {string|null} params.fileUrl - The URL of the zip file
|
|
203
|
-
*
|
|
204
227
|
* @returns {Promise<boolean>} Whether the update was successful
|
|
205
228
|
*
|
|
206
229
|
* @example
|
|
207
230
|
* ```ts
|
|
208
|
-
* const updateInfo = await
|
|
231
|
+
* const updateInfo = await hotUpdater.checkForUpdate({
|
|
209
232
|
* updateStrategy: "appVersion",
|
|
210
233
|
* requestHeaders: {
|
|
211
234
|
* "x-api-key": "<your-api-key>",
|
|
@@ -220,70 +243,55 @@ declare function createHotUpdaterClient(): {
|
|
|
220
243
|
*
|
|
221
244
|
* await updateInfo.updateBundle();
|
|
222
245
|
* if (updateInfo.shouldForceUpdate) {
|
|
223
|
-
* await
|
|
246
|
+
* await hotUpdater.reload();
|
|
224
247
|
* }
|
|
225
248
|
* ```
|
|
226
249
|
*/
|
|
227
250
|
updateBundle: (params: UpdateParams) => Promise<boolean>;
|
|
228
251
|
/**
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
|
|
233
|
-
resetChannel: () => Promise<boolean>;
|
|
234
|
-
/**
|
|
235
|
-
* Fetches the fingerprint of the app.
|
|
236
|
-
*
|
|
237
|
-
* @returns {string} The fingerprint of the app
|
|
252
|
+
* Wraps the app's root: when it mounts, it checks for an update with
|
|
253
|
+
* this instance's configuration, downloads one, and reloads for a
|
|
254
|
+
* forced update. A `fallbackComponent` replaces the root until the
|
|
255
|
+
* check and a forced update finish.
|
|
238
256
|
*
|
|
239
257
|
* @example
|
|
240
|
-
* ```
|
|
241
|
-
*
|
|
242
|
-
*
|
|
258
|
+
* ```tsx
|
|
259
|
+
* export default hotUpdater.wrap({
|
|
260
|
+
* updateStrategy: "appVersion",
|
|
261
|
+
* fallbackComponent: ({ progress }) => <Splash progress={progress} />,
|
|
262
|
+
* })(App);
|
|
243
263
|
* ```
|
|
244
264
|
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
* Reads the native launch report for the current process.
|
|
256
|
-
*/
|
|
257
|
-
notifyAppReady: typeof notifyAppReady;
|
|
265
|
+
wrap: (options: HotUpdaterWrapOptions) => <P extends object>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
|
|
266
|
+
};
|
|
267
|
+
/** The methods of every instance `HotUpdater.init` returns. */
|
|
268
|
+
export type HotUpdaterCore = typeof nativeMethods & ReturnType<typeof createConfiguredMethods>;
|
|
269
|
+
/**
|
|
270
|
+
* The instance `HotUpdater.init` returns: HotUpdater's methods, and each
|
|
271
|
+
* plugin's API under the plugin's id.
|
|
272
|
+
*/
|
|
273
|
+
export type HotUpdaterInstance<TPlugins extends readonly HotUpdaterClientPlugin[] = readonly []> = Readonly<HotUpdaterCore> & ClientPluginApis<TPlugins>;
|
|
274
|
+
export declare const HotUpdater: {
|
|
258
275
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
276
|
+
* Creates the app's HotUpdater instance: the update server, its request
|
|
277
|
+
* settings, and the client plugins. Each call returns an independent
|
|
278
|
+
* instance with its own configuration and plugins, so create one, at the
|
|
279
|
+
* top level of a module, and export it.
|
|
261
280
|
*
|
|
262
|
-
*
|
|
281
|
+
* The instance has every HotUpdater method, such as `wrap`,
|
|
282
|
+
* `checkForUpdate`, and `reload`, and each plugin's API under the
|
|
283
|
+
* plugin's id, such as `hotUpdater.remoteConfig` for `remoteConfig()`.
|
|
263
284
|
*
|
|
264
285
|
* @example
|
|
265
|
-
* ```
|
|
266
|
-
* const
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
|
|
270
|
-
getCrashHistory: typeof getCrashHistory;
|
|
271
|
-
/**
|
|
272
|
-
* Clears the crashed bundle history, allowing previously crashed bundles
|
|
273
|
-
* to be installed again.
|
|
274
|
-
*
|
|
275
|
-
* @returns {boolean} true if clearing was successful
|
|
286
|
+
* ```tsx
|
|
287
|
+
* export const hotUpdater = HotUpdater.init({
|
|
288
|
+
* baseURL: "<your-update-server-url>",
|
|
289
|
+
* plugins: [remoteConfig({ defaults: { welcome_message: "Hi" } })],
|
|
290
|
+
* });
|
|
276
291
|
*
|
|
277
|
-
*
|
|
278
|
-
* ```ts
|
|
279
|
-
* // Clear crash history to allow retrying a previously failed bundle
|
|
280
|
-
* HotUpdater.clearCrashHistory();
|
|
292
|
+
* hotUpdater.remoteConfig.getString("welcome_message");
|
|
281
293
|
* ```
|
|
282
294
|
*/
|
|
283
|
-
|
|
284
|
-
};
|
|
285
|
-
type HotUpdaterClient = Omit<ReturnType<typeof createHotUpdaterClient>, "wrap"> & {
|
|
286
|
-
wrap: HotUpdaterWrap;
|
|
295
|
+
init: <const TPlugins extends readonly HotUpdaterClientPlugin[] = readonly []>(options: HotUpdaterInitOptions<TPlugins>) => HotUpdaterInstance<TPlugins>;
|
|
287
296
|
};
|
|
288
|
-
export declare const HotUpdater: HotUpdaterClient;
|
|
289
297
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"m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EAAE,oBAAoB,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED,yEAAyE;AACzE,QAAA,MAAM,uBAAuB,WAAY,cAAc;IAenD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,cAAc,YA5CQ,qBAAqB;IA8C3C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,YAAY,WAAiB,YAAY;IAgDzC;;;;;;;;;;;;;OAaG;IACH,IAAI,YAAY,qBAAqB;CAQxC,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG,OAAO,aAAa,GAC/C,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAC5B,QAAQ,SAAS,SAAS,sBAAsB,EAAE,GAAG,SAAS,EAAE,IAC9D,QAAQ,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AAE1D,eAAO,MAAM,UAAU;IACrB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,GACF,KAAK,CAAC,QAAQ,SAAS,SAAS,sBAAsB,EAAE,GAAG,SAAS,EAAE,WAE7D,qBAAqB,CAAC,QAAQ,CAAC,KACvC,kBAAkB,CAAC,QAAQ,CAAC;CA+ChC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HotUpdaterClientPlugin } from "./clientPlugin";
|
|
2
|
+
import type { HotUpdaterError } from "./error";
|
|
3
|
+
import type { NotifyAppReadyResult } from "./native";
|
|
4
|
+
import type { HotUpdaterBaseURL } from "./types";
|
|
5
|
+
export interface HotUpdaterInitOptions<TPlugins extends readonly HotUpdaterClientPlugin[] = readonly HotUpdaterClientPlugin[]> {
|
|
6
|
+
/**
|
|
7
|
+
* Client plugins, such as `insights()` and `remoteConfig()` from
|
|
8
|
+
* `@hot-updater/react-native`. Each plugin's `setup` runs once for the
|
|
9
|
+
* instance `init` returns; its hooks observe that instance's launch,
|
|
10
|
+
* update checks, downloads, and update failures, and its API is on the
|
|
11
|
+
* instance, under the plugin's id. Plugin ids must be unique.
|
|
12
|
+
*/
|
|
13
|
+
plugins?: TPlugins;
|
|
14
|
+
/** Base URL of a server exposing the Hot Updater v1 client HTTP protocol. */
|
|
15
|
+
baseURL: HotUpdaterBaseURL;
|
|
16
|
+
requestHeaders?: Record<string, string>;
|
|
17
|
+
requestTimeout?: number;
|
|
18
|
+
onNotifyAppReady?: (result: NotifyAppReadyResult) => void;
|
|
19
|
+
onError?: (error: HotUpdaterError | Error | unknown) => void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=init.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.types.d.ts","sourceRoot":"","sources":["../../../src/init.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,qBAAqB,CACpC,QAAQ,SAAS,SAAS,sBAAsB,EAAE,GAChD,SAAS,sBAAsB,EAAE;IAEnC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,6EAA6E;IAC7E,OAAO,EAAE,iBAAiB,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,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"}
|
|
@@ -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 };
|
|
@@ -12,7 +12,7 @@ export interface Manifest {
|
|
|
12
12
|
assets: Record<string, ManifestAsset>;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Built-in reload behaviors used by `
|
|
15
|
+
* Built-in reload behaviors used by `hotUpdater.reload()`.
|
|
16
16
|
*
|
|
17
17
|
* - `reload`: In-process React Native reload.
|
|
18
18
|
* - `processRestart`: Android-only cold restart. On iOS the same call behaves like `reload`.
|
|
@@ -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
|
*
|
|
@@ -158,7 +171,7 @@ export declare const getAppVersion: () => string | null;
|
|
|
158
171
|
*/
|
|
159
172
|
export declare const reload: () => Promise<void>;
|
|
160
173
|
/**
|
|
161
|
-
* Configures how `
|
|
174
|
+
* Configures how `hotUpdater.reload()` should behave.
|
|
162
175
|
*
|
|
163
176
|
* This API is available on both Android and iOS so app code can stay symmetric.
|
|
164
177
|
* By default, HotUpdater uses `processRestart`.
|
|
@@ -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
|
/**
|
|
@@ -274,7 +281,7 @@ export declare const readNotifyAppReady: () => {
|
|
|
274
281
|
*
|
|
275
282
|
* @example
|
|
276
283
|
* ```ts
|
|
277
|
-
* const result =
|
|
284
|
+
* const result = hotUpdater.notifyAppReady();
|
|
278
285
|
*
|
|
279
286
|
* if (result.status === "RECOVERED") {
|
|
280
287
|
* console.log(result.fromBundleId, result.toBundleId);
|
|
@@ -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,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC;AAGlD,KAAK,uBAAuB,GAAG,aAAa,GAAG,YAAY,CAAC;AAU5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACvC;AAUD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7D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AC;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,8 @@
|
|
|
1
|
+
import { type PluginHost } from "@hot-updater/protocol";
|
|
2
|
+
export type { PluginHost, PluginHostConfig } from "@hot-updater/protocol";
|
|
3
|
+
/**
|
|
4
|
+
* Creates an instance's plugin host: its plugins read the native module and
|
|
5
|
+
* fetch the server the instance was configured with.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createAppPluginHost: () => PluginHost;
|
|
8
|
+
//# sourceMappingURL=pluginHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginHost.d.ts","sourceRoot":"","sources":["../../../src/pluginHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EAEhB,MAAM,uBAAuB,CAAC;AAgB/B,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AA0B1E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAO,UACR,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
|