Repository navigation
Expand file tree
/
Copy pathReactNativeBundleUpdate.nitro.ts
More file actions
151 lines (130 loc) · 3.85 KB
/
Copy pathReactNativeBundleUpdate.nitro.ts
File metadata and controls
151 lines (130 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import type { HybridObject } from 'react-native-nitro-modules';
export interface BundleDownloadParams {
downloadUrl: string;
latestVersion: string;
bundleVersion: string;
fileSize: number;
sha256: string;
}
export interface BundleDownloadResult {
downloadUrl: string;
latestVersion: string;
bundleVersion: string;
sha256: string;
}
export interface BundleVerifyParams {
sha256: string;
latestVersion: string;
bundleVersion: string;
}
export interface BundleVerifyASCParams {
sha256: string;
latestVersion: string;
bundleVersion: string;
signature: string;
}
export interface BundleDownloadASCParams {
downloadUrl: string;
signature: string;
latestVersion: string;
bundleVersion: string;
sha256: string;
}
export interface BundleInstallParams {
latestVersion: string;
bundleVersion: string;
signature: string;
}
export interface BundleSwitchParams {
appVersion: string;
bundleVersion: string;
signature: string;
}
export interface BundleDownloadEvent {
type: string;
progress: number;
message: string;
}
export interface TestResult {
success: boolean;
message: string;
}
export interface LocalBundleInfo {
appVersion: string;
bundleVersion: string;
}
export interface FallbackBundleInfo {
appVersion: string;
bundleVersion: string;
signature: string;
}
export interface AscFileInfo {
fileName: string;
filePath: string;
fileSize: number;
}
export interface ReactNativeBundleUpdate
extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
// Download
downloadBundle(params: BundleDownloadParams): Promise<BundleDownloadResult>;
// Verify
verifyBundle(params: BundleVerifyParams): Promise<void>;
verifyBundleASC(params: BundleVerifyASCParams): Promise<void>;
downloadBundleASC(params: BundleDownloadASCParams): Promise<void>;
// Install
installBundle(params: BundleInstallParams): Promise<void>;
// Clear
clearDownload(): Promise<void>;
clearBundle(): Promise<void>;
clearAllJSBundleData(): Promise<TestResult>;
resetToBuiltInBundle(): Promise<void>;
// Prune every artifact whose appVersion differs from the running native
// binary version (stale OTA dirs, download stages, orphan asc, lingering
// fallback entries). Returns the count of deleted version directories.
pruneStaleAppVersionBundles(): Promise<number>;
// Bundle data
getFallbackUpdateBundleData(): Promise<FallbackBundleInfo[]>;
setCurrentUpdateBundleData(params: BundleSwitchParams): Promise<void>;
// Paths
getWebEmbedPath(): string;
getWebEmbedPathAsync(): Promise<string>;
getJsBundlePath(): string;
getJsBundlePathAsync(): Promise<string>;
getBackgroundJsBundlePath(): string;
getBackgroundJsBundlePathAsync(): Promise<string>;
getNativeAppVersion(): Promise<string>;
getNativeBuildNumber(): Promise<string>;
getBuiltinBundleVersion(): Promise<string>;
// Verification & testing
testVerification(): Promise<boolean>;
testSkipVerification(): Promise<boolean>;
isSkipGpgVerificationAllowed(): boolean;
isBundleExists(appVersion: string, bundleVersion: string): Promise<boolean>;
verifyExtractedBundle(
appVersion: string,
bundleVersion: string,
): Promise<void>;
listLocalBundles(): Promise<LocalBundleInfo[]>;
listAscFiles(): Promise<AscFileInfo[]>;
getSha256FromFilePath(filePath: string): Promise<string>;
// Test/debug methods
testDeleteJsBundle(
appVersion: string,
bundleVersion: string,
): Promise<TestResult>;
testDeleteJsRuntimeDir(
appVersion: string,
bundleVersion: string,
): Promise<TestResult>;
testDeleteMetadataJson(
appVersion: string,
bundleVersion: string,
): Promise<TestResult>;
testWriteEmptyMetadataJson(
appVersion: string,
bundleVersion: string,
): Promise<TestResult>;
// Events
addDownloadListener(callback: (event: BundleDownloadEvent) => void): number;
removeDownloadListener(id: number): void;
}